projects
/
cmccabe-bin
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
69f68e7
)
Add errno-printing program
author
Colin McCabe
<cmccabe@alumni.cmu.edu>
Sun, 13 Dec 2009 23:27:54 +0000 (15:27 -0800)
committer
Colin McCabe
<cmccabe@alumni.cmu.edu>
Sun, 13 Dec 2009 23:27:54 +0000 (15:27 -0800)
errno_speak.c
[new file with mode: 0644]
patch
|
blob
diff --git a/errno_speak.c
b/errno_speak.c
new file mode 100644
(file)
index 0000000..
832ebe3
--- /dev/null
+++ b/
errno_speak.c
@@ -0,0
+1,23
@@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/*
+ * This program takes an errno number as input, and prints out a long
+ * description of the error, using strerror.
+ *
+ * Colin McCabe
+ */
+
+int main(int argc, char **argv)
+{
+ int err;
+ if (argc != 2) {
+ printf("usage: %s [errno number]\n", __func__);
+ return 1;
+ }
+ err = atoi(argv[1]);
+ printf("errno %d: %s\n", err, strerror(err));
+ return 0;
+}
+