diff options
author | Rob Landley <rob@landley.net> | 2008-06-26 22:48:43 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2008-06-26 22:48:43 -0500 |
commit | b1487dc9ed8c892afde94a8ac04350e3ca0e7074 (patch) | |
tree | f9e041f48ececa6e63decbd2957394275f81d3e6 /lib | |
parent | f901f24334ee8c0f03b72c2a1ad365b61334db5a (diff) | |
download | toybox-b1487dc9ed8c892afde94a8ac04350e3ca0e7074.tar.gz |
Option parsing: stopearly is now a ^ prefix (not +), and an option string with
no flags auto-enables stopearly (so seq doesn't have to specify it to avoid
having negative number arguments eaten by the option parsing logic).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/args.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -25,7 +25,7 @@ // !X die with error if X already set (x!x die if x supplied twice) // [yz] needs at least one of y or z. // at the beginning: -// + stop at first nonoption argument +// ^ stop at first nonoption argument // <0 at least # leftover arguments needed (default 0) // >9 at most # leftover arguments needed (default MAX_INT) // ? don't show_usage() on unknown argument. @@ -167,7 +167,7 @@ void get_optflags(void) // Parse leading special behavior indicators for (;;) { - if (*options == '+') stopearly++; + if (*options == '^') stopearly++; else if (*options == '<') minargs=*(++options)-'0'; else if (*options == '>') maxargs=*(++options)-'0'; else if (*options == '?') gof.noerror++; @@ -176,6 +176,7 @@ void get_optflags(void) options++; } + if (!*options) stopearly++; // Parse rest of opts into array while (*options) { char *temp; |