NetBSD/share/misc/getopt

39 lines
508 B
Plaintext
Raw Normal View History

1994-03-26 06:24:50 +03:00
/*
* Main/getopt(3) fragment.
*
1997-11-01 09:23:38 +03:00
* $NetBSD: getopt,v 1.5 1997/11/01 06:23:38 lukem Exp $
1997-03-26 09:57:08 +03:00
* @(#)getopt 5.3 (Berkeley) 3/28/94
1994-03-26 06:24:50 +03:00
*/
#include <sys/types.h>
#include <stdlib.h>
void usage __P((void));
int
main(argc, argv)
int argc;
char *argv[];
{
int ch;
1997-11-01 09:23:38 +03:00
while ((ch = getopt(argc, argv, "")) != -1)
1994-03-26 06:24:50 +03:00
switch (ch) {
case '':
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
}
void
usage()
{
1994-03-29 06:05:36 +04:00
(void)fprintf(stderr, "usage: program [-abc] [-f file]\n");
1994-03-26 06:24:50 +03:00
exit(1);
}