NetBSD/share/misc/getopt
1997-03-26 06:57:08 +00:00

39 lines
509 B
Plaintext

/*
* Main/getopt(3) fragment.
*
* $NetBSD: getopt,v 1.4 1997/03/26 06:57:08 mikel Exp $
* @(#)getopt 5.3 (Berkeley) 3/28/94
*/
#include <sys/types.h>
#include <stdlib.h>
void usage __P((void));
int
main(argc, argv)
int argc;
char *argv[];
{
int ch;
while ((ch = getopt(argc, argv, "")) != EOF)
switch (ch) {
case '':
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
}
void
usage()
{
(void)fprintf(stderr, "usage: program [-abc] [-f file]\n");
exit(1);
}