MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / getargs

Function getargs

extern/btyacc/main.c:157–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155
156
157void getargs(int argc, char **argv)
158{
159 register int i;
160 register char *s;
161
162 if (argc > 0)
163 myname = argv[0];
164
165 for (i = 1; i < argc; ++i)
166 {
167 s = argv[i];
168 if (*s != '-')
169 break;
170
171 switch (*++s)
172 {
173 case '\0':
174 input_file = stdin;
175 if (i + 1 < argc)
176 usage();
177 return;
178
179 case '-':
180 ++i;
181 no_more_options(i, argc, argv);
182 return;
183
184 case 'b':
185 if (*++s)
186 file_prefix = s;
187 else if (++i < argc)
188 file_prefix = argv[i];
189 else
190 usage();
191 continue;
192
193 case 'd':
194 dflag = 1;
195 break;
196
197 case 'D':
198 /* Find the preprocessor variable */
199 {
200 char **ps;
201 char *var_name = s + 1;
202 extern char *defd_vars[];
203 for (ps = &defd_vars[0]; *ps; ps++)
204 {
205 if (strcmp(*ps, var_name) == 0) {
206 error(lineno, 0, 0, "Preprocessor variable %s already defined", var_name);
207 }
208 }
209 *ps = MALLOC(strlen(var_name)+1);
210 strcpy(*ps, var_name);
211 *++ps = NULL;
212 }
213 continue;
214

Callers 1

mainFunction · 0.85

Calls 4

no_more_optionsFunction · 0.85
read_skelFunction · 0.85
usageFunction · 0.70
errorFunction · 0.70

Tested by

no test coverage detected