1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 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; }