VMSGETAR.C 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* VMS version of getargs; Uses DCL command parsing.
  2. Copyright (C) 1989 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 1, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
  14. #include <ctype.h>
  15. /*
  16. * VMS version of getargs(): Uses DCL command parsing
  17. * (argc and argv are ignored)
  18. */
  19. int verboseflag;
  20. int definesflag;
  21. int debugflag;
  22. int nolinesflag;
  23. extern int fixed_outfiles;
  24. getargs(argc,argv)
  25. int argc;
  26. char *argv[];
  27. {
  28. register char *cp;
  29. static char Input_File[256];
  30. extern char *infile;
  31. verboseflag = 0;
  32. definesflag = 0;
  33. debugflag = 0;
  34. fixed_outfiles = 0;
  35. nolinesflag = 0;
  36. /*
  37. * Check for /VERBOSE qualifier
  38. */
  39. if (cli_present("BISON$VERBOSE")) verboseflag = 1;
  40. /*
  41. * Check for /DEFINES qualifier
  42. */
  43. if (cli_present("BISON$DEFINES")) definesflag = 1;
  44. /*
  45. * Check for /FIXED_OUTFILES qualifier
  46. */
  47. if (cli_present("BISON$FIXED_OUTFILES")) fixed_outfiles = 1;
  48. /*
  49. * Check for /NOLINES qualifier
  50. */
  51. if (cli_present("BISON$NOLINES")) nolinesflag = 1;
  52. /*
  53. * Check for /DEBUG qualifier
  54. */
  55. if (cli_present("BISON$DEBUG")) debugflag = 1;
  56. /*
  57. * Get the filename
  58. */
  59. cli_get_value("BISON$INFILE", Input_File, sizeof(Input_File));
  60. /*
  61. * Lowercaseify the input filename
  62. */
  63. cp = Input_File;
  64. while(*cp) {
  65. if (isupper(*cp)) *cp = tolower(*cp);
  66. cp++;
  67. }
  68. infile = Input_File;
  69. }
  70. /************ DCL PARSING ROUTINES **********/
  71. /*
  72. * See if "NAME" is present
  73. */
  74. int
  75. cli_present(Name)
  76. char *Name;
  77. {
  78. struct {int Size; char *Ptr;} Descr;
  79. Descr.Ptr = Name;
  80. Descr.Size = strlen(Name);
  81. return((cli$present(&Descr) & 1) ? 1 : 0);
  82. }
  83. /*
  84. * Get value of "NAME"
  85. */
  86. int
  87. cli_get_value(Name,Buffer,Size)
  88. char *Name;
  89. char *Buffer;
  90. {
  91. struct {int Size; char *Ptr;} Descr1,Descr2;
  92. Descr1.Ptr = Name;
  93. Descr1.Size = strlen(Name);
  94. Descr2.Ptr = Buffer;
  95. Descr2.Size = Size-1;
  96. if (cli$get_value(&Descr1,&Descr2,&Descr2.Size) & 1) {
  97. Buffer[Descr2.Size] = 0;
  98. return(1);
  99. }
  100. return(0);
  101. }