/* c-getopt -- template for use of getopt */ /* $Id$ */ /* Carlos Duarte, 980517 */ #include #include #include #include #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 #endif #ifndef EXIT_FAILURE #define EXIT_FAILURE 1 #endif /* protos */ int main(int argc, char *argv[]); static char *mk_progname(char *s); static void usage(void); static char *program_name; int main(int argc, char *argv[]) { int c; program_name = mk_progname(argv[0]); while ((c = getopt(argc, argv, "abc")) != EOF) switch (c) { case 'a': break; case 'b': break; case 'c': break; case '?': default: usage(); } argv += optind; argc -= optind; /* * rest of code * use from argv[0] to argv[argc-1], like: * for (i=0; i