xref: /original-bsd/admin/style/getopt (revision e58c8952)
1/*
2 * Main/getopt(3) fragment.
3 *
4 *	@(#)getopt	5.4 (Berkeley) 03/30/94
5 */
6
7#include <sys/types.h>
8
9#include <stdlib.h>
10#include <stdio.h>
11
12void usage __P((void));
13
14int
15main(argc, argv)
16	int argc;
17	char *argv[];
18{
19	int ch;
20
21	while ((ch = getopt(argc, argv, "")) != EOF)
22		switch (ch) {
23		case '':
24			break;
25		case '?':
26		default:
27			usage();
28		}
29	argc -= optind;
30	argv += optind;
31}
32
33void
34usage()
35{
36	(void)fprintf(stderr, "usage: program [-abc] [-f file]\n");
37	exit(1);
38}
39