1/* 2 * Main/getopt(3) fragment. 3 * 4 * $NetBSD: getopt,v 1.5 1997/11/01 06:23:38 lukem Exp $ 5 * @(#)getopt 5.3 (Berkeley) 3/28/94 6 */ 7 8#include <sys/types.h> 9 10#include <stdlib.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, "")) != -1) 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