summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+}