home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d170 / dis6502.lha / Dis6502 / initopts.c < prev    next >
C/C++ Source or Header  |  1988-11-22  |  929b  |  54 lines

  1.  
  2. /* 
  3.  * 
  4.  *  dis [-p predefineds] file
  5.  *
  6.  *  The -p option may be repeated.
  7.  */
  8.  
  9. #include "dis.h"
  10.  
  11. char *predef[NPREDEF];
  12. int  npredef = 0;
  13. char *file;
  14. char *progname = "dis";
  15. int  bopt = 0;
  16.  
  17. initopts(argc,argv)
  18. int argc;
  19. char *argv[];
  20. {
  21.     int ai;
  22.     char *ca;
  23.     int fileset = 0;
  24.  
  25.     progname = argv[0];
  26.  
  27.     while (--argc) {
  28.         if ((*++argv)[0] == '-') {
  29.         ca = *argv;
  30.         for(ai = 1; ca[ai] != '\0'; ai++)
  31.                 switch (ca[ai]) {
  32.                 case 'p':
  33.             predef[npredef] = *++argv;
  34.             npredef++;
  35.                     argc--;
  36.                     break;
  37.         case 'b':
  38.             bopt = 1;
  39.             break;
  40.  
  41.         case 'c':
  42.             bopt = 2;
  43.             break;
  44.                 default: crash("Invalid option letter");
  45.                 }
  46.         } else if (!fileset) {
  47.         file = *argv;
  48.         fileset++;
  49.     } else crash("Usage: [-{c|b}] [-p predef] file");
  50.     }
  51.     if (!fileset)
  52.      crash("Usage: [-{c|b}] [-p predef] file");
  53. }
  54.