Mercurial > hg > toybox
changeset 931:011df43e35d5
Option type @ counts number of occurrences, it doesn't take an argument.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 22 Jun 2013 15:36:25 -0500 |
parents | 39ac9e0ad6ad |
children | 58b5263d63bf |
files | lib/args.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/args.c Sat Jun 22 14:23:06 2013 -0500 +++ b/lib/args.c Sat Jun 22 15:36:25 2013 -0500 @@ -142,7 +142,9 @@ // Does this option take an argument? gof->arg++; type = opt->type; - if (type) { + + if (type == '@') ++*(opt->arg); + else if (type) { char *arg = gof->arg; // Handle "-xblah" and "-x blah", but also a third case: "abxc blah" @@ -176,7 +178,7 @@ error_exit("-%c < %lf", opt->c, (double)opt->val[0].f); if (opt->val[1].l != LONG_MAX && *f > opt->val[1].f) error_exit("-%c > %lf", opt->c, (double)opt->val[1].f); - } else if (type == '@') ++*(opt->arg); + } if (!gof->nodash_now) gof->arg = ""; }