summaryrefslogtreecommitdiff
authorPekka Paalanen <ppaalanen@gmail.com>2012-08-22 06:40:59 (GMT)
committer Pekka Paalanen <ppaalanen@gmail.com>2012-08-22 07:12:37 (GMT)
commit5265df7d8050c92fa5a076e6f81ccace872572cc (patch) (side-by-side diff)
treed610e5a6812f2e1f64362eba452850da251ab4bb
parentc1b0881f4db2447f537c2fe8e2be4abf82f5ed28 (diff)
downloadandrogenizer-5265df7d8050c92fa5a076e6f81ccace872572cc.tar.gz
androgenizer-5265df7d8050c92fa5a076e6f81ccace872572cc.tar.bz2
make the "skip next argument" logic generic
Make it available for all modes, not just LDFLAGS. Nothing else uses it yet, though.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--options.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/options.c b/options.c
index a1d0153..d4719e5 100644
--- a/options.c
+++ b/options.c
@@ -531,10 +531,17 @@ struct project *options_parse(int argc, char **args)
else
arg = strdup(args[i]);
- if (nm != MODE_UNDEFINED)
+ if (nm != MODE_UNDEFINED) {
free(arg);
+ skip = 0;
+ }
if (nm == MODE_UNDEFINED) {
+ if (skip) {
+ skip = 0;
+ continue;
+ }
+
switch (mode) {
case MODE_UNDEFINED:
die("Androgenizer arguments must start with a valid -: switch, like -:PROJECT.");
@@ -567,12 +574,7 @@ struct project *options_parse(int argc, char **args)
case MODE_LDFLAGS:
if (!m)
die("a module type must be declared before adding -:LDFLAGS");
- if (!skip) {
- skip = add_ldflag(m, arg, p->btype);
- } else {
- /* We were asked to skip this argument in the previous step */
- skip = 0;
- }
+ skip = add_ldflag(m, arg, p->btype);
break;
case MODE_CFLAGS:
if (!p || !m)