From: Colin McCabe Date: Sun, 13 Dec 2009 23:27:54 +0000 (-0800) Subject: Add errno-printing program X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a35015ff7bfb494ee126be0474e40640900c82f5;p=cmccabe-bin Add errno-printing program --- diff --git a/errno_speak.c b/errno_speak.c new file mode 100644 index 0000000..832ebe3 --- /dev/null +++ b/errno_speak.c @@ -0,0 +1,23 @@ +#include +#include +#include + +/* + * 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; +} +