summaryrefslogtreecommitdiff
path: root/share/misc/getopt
blob: 45b6a4d4de5bec0ac69b5ecef0ace30e31344774 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Main/getopt(3) fragment.
 *
 *	from: @(#)getopt	5.3 (Berkeley) 3/28/94
 *	$Id: getopt,v 1.1 1995/10/18 08:44:44 deraadt Exp $
 */

#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);
}