summaryrefslogtreecommitdiff
path: root/share/misc/getopt
blob: 1ae9cbf3249a34e4a6aa7f7c2759990287388caf (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
/*	$OpenBSD: getopt,v 1.7 2002/07/22 20:13:14 pvalchev Exp $	*/
/*
 * Main/getopt(3) fragment.
 *
 *	from: @(#)getopt	5.3 (Berkeley) 3/28/94
 */

#include <sys/types.h>
#include <stdlib.h>

void usage(void);

int
main(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);
}