home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d136 / bison.lha / Bison / getargs.c < prev    next >
C/C++ Source or Header  |  1988-03-19  |  2KB  |  69 lines

  1. /* Parse command line arguments for bison,
  2.    Copyright (C) 1984, 1986 Bob Corbett and Free Software Foundation, Inc.
  3.  
  4. BISON is distributed in the hope that it will be useful, but WITHOUT ANY
  5. WARRANTY.  No author or distributor accepts responsibility to anyone
  6. for the consequences of using it or for whether it serves any
  7. particular purpose or works at all, unless he says so in writing.
  8. Refer to the BISON General Public License for full details.
  9.  
  10. Everyone is granted permission to copy, modify and redistribute BISON,
  11. but only under the conditions described in the BISON General Public
  12. License.  A copy of this license is supposed to have been given to you
  13. along with BISON so you can know your rights and responsibilities.  It
  14. should be in a file named COPYING.  Among other things, the copyright
  15. notice and this notice must be preserved on all copies.
  16.  
  17.  In other words, you are welcome to use, share and improve this program.
  18.  You are forbidden to forbid anyone else to use, share and improve
  19.  what you give them.   Help stamp out software-hoarding!  */
  20.  
  21. #include <stdio.h>
  22. #include "files.h"
  23.  
  24. int verboseflag;
  25. int definesflag;
  26. extern int fixed_outfiles;/* JF */
  27.  
  28.  
  29. getargs(argc, argv)
  30. int argc;
  31. char *argv[];
  32. {
  33.   register int c;
  34.   register char *cp;
  35.  
  36.   extern int optind;
  37.  
  38.   verboseflag = 0;
  39.   definesflag = 0;
  40.   fixed_outfiles = 0;
  41.  
  42.   while ((c = getopt (argc, argv, "yYvVdD")) != EOF)
  43.     switch (c)
  44.       {
  45.       case 'y':
  46.       case 'Y':
  47.     fixed_outfiles = 1;
  48.     break;
  49.  
  50.       case 'v':
  51.       case 'V':
  52.     verboseflag = 1;
  53.     break;
  54.  
  55.       case 'd':
  56.       case 'D':
  57.     definesflag = 1;
  58.     break;
  59.       }
  60.  
  61.   if (optind == argc)
  62.     fatal("grammar file not specified");
  63.   else
  64.     infile = argv[optind];
  65.  
  66.   if (optind < argc - 1)
  67.     fprintf(stderr, "warning: extra arguments ignored");
  68. }
  69.