1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
/* VMS version of getargs; Uses DCL command parsing.
Copyright (C) 1989 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <ctype.h>
#include <stdio.h>
#include "files.h"
/*
* VMS version of getargs(): Uses DCL command parsing
* (argc and argv are ignored)
*/
int verboseflag;
int definesflag;
int debugflag;
int nolinesflag;
extern int fixed_outfiles;
extern char * version_string;
/* Allocate storgate and initialize, since bison uses them elsewhere. */
char *spec_name_prefix;
char *spec_file_prefix;
getargs(argc,argv)
int argc;
char *argv[];
{
register char *cp;
static char Input_File[256];
static char output_spec[256], name_prefix_spec[256], file_prefix_spec[256];
extern char *infile;
verboseflag = 0;
definesflag = 0;
debugflag = 0;
fixed_outfiles = 0;
nolinesflag = 0;
/*
* Check for /VERBOSE qualifier
*/
if (cli_present("BISON$VERBOSE")) verboseflag = 1;
/*
* Check for /DEFINES qualifier
*/
if (cli_present("BISON$DEFINES")) definesflag = 1;
/*
* Check for /FIXED_OUTFILES qualifier
*/
if (cli_present("BISON$FIXED_OUTFILES")) fixed_outfiles = 1;
if (cli_present("BISON$YACC")) fixed_outfiles = 1;
/*
* Check for /VERSION qualifier
*/
if (cli_present("BISON$VERSION")) printf("%s",version_string);
/*
* Check for /NOLINES qualifier
*/
if (cli_present("BISON$NOLINES")) nolinesflag = 1;
/*
* Check for /DEBUG qualifier
*/
if (cli_present("BISON$DEBUG")) debugflag = 1;
/*
* Get the filename
*/
cli_get_value("BISON$INFILE", Input_File, sizeof(Input_File));
/*
* Lowercaseify the input filename
*/
cp = Input_File;
while(*cp)
{
if (isupper(*cp)) *cp = tolower(*cp);
cp++;
}
infile = Input_File;
/*
* Get the output file
*/
if (cli_present("BISON$OUTPUT"))
{
cli_get_value("BISON$OUTPUT", output_spec, sizeof(output_spec));
for (cp = spec_outfile = output_spec; *cp; cp++)
if (isupper(*cp))
*cp = tolower(*cp);
}
/*
* Get the output file
*/
if (cli_present("BISON$FILE_PREFIX"))
{
cli_get_value("BISON$FILE_PREFIX", file_prefix_spec,
sizeof(file_prefix_spec));
for (cp = spec_file_prefix = file_prefix_spec; *cp; cp++)
if (isupper(*cp))
*cp = tolower(*cp);
}
/*
* Get the output file
*/
if (cli_present("BISON$NAME_PREFIX"))
{
cli_get_value("BISON$NAME_PREFIX", name_prefix_spec,
sizeof(name_prefix_spec));
for (cp = spec_name_prefix = name_prefix_spec; *cp; cp++)
if (isupper(*cp))
*cp = tolower(*cp);
}
}
/************ DCL PARSING ROUTINES **********/
/*
* See if "NAME" is present
*/
int
cli_present(Name)
char *Name;
{
struct {int Size; char *Ptr;} Descr;
Descr.Ptr = Name;
Descr.Size = strlen(Name);
return((cli$present(&Descr) & 1) ? 1 : 0);
}
/*
* Get value of "NAME"
*/
int
cli_get_value(Name,Buffer,Size)
char *Name;
char *Buffer;
{
struct {int Size; char *Ptr;} Descr1,Descr2;
Descr1.Ptr = Name;
Descr1.Size = strlen(Name);
Descr2.Ptr = Buffer;
Descr2.Size = Size-1;
if (cli$get_value(&Descr1,&Descr2,&Descr2.Size) & 1) {
Buffer[Descr2.Size] = 0;
return(1);
}
return(0);
}
|