]>
git.saurik.com Git - bison.git/blob - src/vmsgetargs.c
1 /* VMS version of getargs; Uses DCL command parsing.
2 Copyright 1989, 1992 Free Software Foundation, Inc.
4 This file is part of Bison, the GNU Compiler Compiler.
6 Bison is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 Bison is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Bison; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
27 * VMS version of getargs: Uses DCL command parsing
28 * (argc and argv are ignored)
34 extern int no_parser_flag
;
35 extern int token_table_flag
;
38 extern char * version_string
;
40 /* Allocate storgate and initialize, since bison uses them elsewhere. */
41 char *spec_name_prefix
;
42 char *spec_file_prefix
;
49 static char Input_File
[256];
50 static char output_spec
[256], name_prefix_spec
[256], file_prefix_spec
[256];
62 * Check for /VERBOSE qualifier
64 if (cli_present("BISON$VERBOSE")) verbose_flag
= 1;
66 * Check for /DEFINES qualifier
68 if (cli_present("BISON$DEFINES")) defines_flag
= 1;
70 * Check for /FIXED_OUTFILES qualifier
72 if (cli_present("BISON$FIXED_OUTFILES")) yacc_flag
= 1;
73 if (cli_present("BISON$YACC")) yacc_flag
= 1;
75 * Check for /VERSION qualifier
77 if (cli_present("BISON$VERSION")) printf("%s",version_string
);
79 * Check for /NOLINES qualifier
81 if (cli_present("BISON$NOLINES")) no_lines_flag
= 1;
83 * Check for /NOPARSER qualifier
85 if (cli_present("BISON$NOPARSER")) no_parser_flag
= 1;
87 * Check for /RAW qualifier
89 if (cli_present("BISON$RAW")) raw_flag
= 1;
91 * Check for /TOKEN_TABLE qualifier
93 if (cli_present("BISON$TOKEN_TABLE")) token_table_flag
= 1;
95 * Check for /DEBUG qualifier
97 if (cli_present("BISON$DEBUG")) debug_flag
= 1;
101 cli_get_value("BISON$INFILE", Input_File
, sizeof(Input_File
));
103 * Lowercaseify the input filename
108 if (isupper(*cp
)) *cp
= tolower(*cp
);
113 * Get the output file
115 if (cli_present("BISON$OUTPUT"))
117 cli_get_value("BISON$OUTPUT", output_spec
, sizeof(output_spec
));
118 for (cp
= spec_outfile
= output_spec
; *cp
; cp
++)
123 * Get the output file
125 if (cli_present("BISON$FILE_PREFIX"))
127 cli_get_value("BISON$FILE_PREFIX", file_prefix_spec
,
128 sizeof(file_prefix_spec
));
129 for (cp
= spec_file_prefix
= file_prefix_spec
; *cp
; cp
++)
134 * Get the output file
136 if (cli_present("BISON$NAME_PREFIX"))
138 cli_get_value("BISON$NAME_PREFIX", name_prefix_spec
,
139 sizeof(name_prefix_spec
));
140 for (cp
= spec_name_prefix
= name_prefix_spec
; *cp
; cp
++)
146 /************ DCL PARSING ROUTINES **********/
149 * See if "NAME" is present
155 struct {int Size
; char *Ptr
;} Descr
;
158 Descr
.Size
= strlen(Name
);
159 return (cli$
present(&Descr
) & 1) ? 1 : 0;
163 * Get value of "NAME"
166 cli_get_value(Name
,Buffer
,Size
)
170 struct {int Size
; char *Ptr
;} Descr1
,Descr2
;
173 Descr1
.Size
= strlen(Name
);
175 Descr2
.Size
= Size
-1;
176 if (cli$
get_value(&Descr1
,&Descr2
,&Descr2
.Size
) & 1) {
177 Buffer
[Descr2
.Size
] = 0;