mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-21 10:51:10 +00:00
Do not force -[aci] parameters' arguments to be in the same argv; (Allow 'gmqcc -c foo' to act like 'gmqcc -cfoo'
This commit is contained in:
parent
2a9b3c7877
commit
488859a218
1 changed files with 19 additions and 3 deletions
22
main.c
22
main.c
|
@ -86,9 +86,20 @@ int main(int argc, char **argv) {
|
|||
);
|
||||
return 0;
|
||||
}
|
||||
case 'c': items_add((argitem){util_strdup(&argv[1][2]), 0}); break; /* compile */
|
||||
case 'a': items_add((argitem){util_strdup(&argv[1][2]), 1}); break; /* assemble */
|
||||
case 'i': items_add((argitem){util_strdup(&argv[1][2]), 2}); break; /* includes */
|
||||
#define param_argument(argtype) do { \
|
||||
if (argv[1][2]) \
|
||||
items_add((argitem){util_strdup(&argv[1][2]), argtype}); \
|
||||
else { \
|
||||
++argv; --argc; \
|
||||
if (argc <= 1) \
|
||||
goto clean_params_usage; \
|
||||
items_add((argitem){util_strdup(&argv[1][0]), argtype}); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
case 'c': param_argument(0); break; /* compile */
|
||||
case 'a': param_argument(1); break; /* assemble */
|
||||
case 'i': param_argument(2); break; /* includes */
|
||||
default:
|
||||
if (!strncmp(&argv[1][1], "debug" , 5)) { opts_debug = true; break; }
|
||||
if (!strncmp(&argv[1][1], "memchk", 6)) { opts_memchk = true; break; }
|
||||
|
@ -158,4 +169,9 @@ int main(int argc, char **argv) {
|
|||
|
||||
util_meminfo();
|
||||
return 0;
|
||||
clean_params_usage:
|
||||
for (itr = 0; itr < items_elements; itr++)
|
||||
mem_d(items_data[itr].name);
|
||||
mem_d(items_data);
|
||||
return usage(app);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue