home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / share / misc / getopt < prev    next >
Encoding:
Text File  |  2001-09-17  |  508 b   |  39 lines

  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.  
  12. void usage __P((void));
  13.  
  14. int
  15. main(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.  
  33. void
  34. usage()
  35. {
  36.     (void)fprintf(stderr, "usage: program [-abc] [-f file]\n");
  37.     exit(1);
  38. }
  39.