/* $OpenBSD: getopt,v 1.6 2002/02/16 21:27:40 millert Exp $ */ /* * Main/getopt(3) fragment. * * from: @(#)getopt 5.3 (Berkeley) 3/28/94 */ #include #include void usage(void); int main(argc, argv) int argc; char *argv[]; { int ch; while ((ch = getopt(argc, argv, "abcf:")) != -1) switch (ch) { case '': break; case '?': default: usage(); } argc -= optind; argv += optind; } void usage(void) { extern char *__progname; (void)fprintf(stderr, "usage: %s [-abc] [-f file]\n", __progname); exit(1); }