Add errno-printing program
[cmccabe-bin] / errno_speak.c
1 #include <errno.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4
5 /*
6  * This program takes an errno number as input, and prints out a long
7  * description of the error, using strerror.
8  *
9  * Colin McCabe
10  */
11
12 int main(int argc, char **argv)
13 {
14     int err;
15     if (argc != 2) {
16         printf("usage: %s [errno number]\n", __func__);
17         return 1;
18     }
19     err = atoi(argv[1]);
20     printf("errno %d: %s\n", err, strerror(err));
21     return 0;
22 }
23