/* $Id: errno.c,v 1.3 2008/02/01 00:14:56 - - $ Cahern Colin Ahern */ #include #include #include static void exit1(int a){ printf("errno(%d) = \"%s\"\n",a,strerror(a)); } int main(int argc, char **argv){ int count1,count2; int test,exit; int error; if(argc==1) { printf("useage: errno [-a] [-e exitvar] [desired errno]\n"); return EXIT_SUCCESS; } while((test = getopt(argc, argv, "ae:")) != EOF){ switch(test){ case 'a': for(count1=0;count1<151;count1++){ printf("Code %d = %s\n",count1,strerror(count1)); } break; case 'e': error=strtol(optarg,NULL,10); printf("Code %d returns %s\n",error,strerror(error)); break; } } for(count2=1;count2