summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-07-15 11:35:18 -0400
committerJakob Kaivo <jkk@ung.org>2019-07-15 11:35:18 -0400
commit800d24aad29a47942ed455cda4f79409aafd3675 (patch)
tree45004a5052f0d92b63c13d2eebaa1064a1ffbd47
strerror with error messages only
-rw-r--r--strerror.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/strerror.c b/strerror.c
new file mode 100644
index 0000000..e7b1695
--- /dev/null
+++ b/strerror.c
@@ -0,0 +1,20 @@
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
+{
+ int n = 1;
+
+ if (argc < 2) {
+ printf("Usage: %s errno...\n", argv[0]);
+ return 1;
+ }
+
+ do {
+ int err = atoi(argv[n]);
+ printf("%d: %s\n", err, strerror(err));
+ } while (argv[++n]);
+
+ return 0;
+}