vmsgetargs.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #include <ctype.h>
  2. /*
  3. * VMS version of getargs(): Uses DCL command parsing
  4. * (argc and argv are ignored)
  5. */
  6. getargs(argc,argv)
  7. int argc;
  8. char *argv[];
  9. {
  10. register char *cp;
  11. static char Input_File[256];
  12. extern int verboseflag, definesflag, fixed_outfiles;
  13. extern char *infile;
  14. verboseflag = 0;
  15. definesflag = 0;
  16. /*
  17. * Check for /VERBOSE qualifier
  18. */
  19. if (cli_present("BISON$VERBOSE")) verboseflag = 1;
  20. /*
  21. * Check for /DEFINES qualifier
  22. */
  23. if (cli_present("BISON$DEFINES")) definesflag = 1;
  24. /*
  25. * Check for /FIXED_OUTFILES qualifier
  26. */
  27. if (cli_present("BISON$FIXED_OUTFILES")) fixed_outfiles = 1;
  28. /*
  29. * Get the filename
  30. */
  31. cli_get_value("BISON$INFILE", Input_File, sizeof(Input_File));
  32. /*
  33. * Lowercaseify the input filename
  34. */
  35. cp = Input_File;
  36. while(*cp) {
  37. if (isupper(*cp)) *cp = tolower(*cp);
  38. cp++;
  39. }
  40. infile = Input_File;
  41. }
  42. /************ DCL PARSING ROUTINES **********/
  43. /*
  44. * See if "NAME" is present
  45. */
  46. int
  47. cli_present(Name)
  48. char *Name;
  49. {
  50. struct {int Size; char *Ptr;} Descr;
  51. Descr.Ptr = Name;
  52. Descr.Size = strlen(Name);
  53. return((cli$present(&Descr) & 1) ? 1 : 0);
  54. }
  55. /*
  56. * Get value of "NAME"
  57. */
  58. int
  59. cli_get_value(Name,Buffer,Size)
  60. char *Name;
  61. char *Buffer;
  62. {
  63. struct {int Size; char *Ptr;} Descr1,Descr2;
  64. Descr1.Ptr = Name;
  65. Descr1.Size = strlen(Name);
  66. Descr2.Ptr = Buffer;
  67. Descr2.Size = Size-1;
  68. if (cli$get_value(&Descr1,&Descr2,&Descr2.Size) & 1) {
  69. Buffer[Descr2.Size] = 0;
  70. return(1);
  71. }
  72. return(0);
  73. }