diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-20 18:36:55 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-20 18:36:55 +0000 |
commit | 456fa6c0b17b2ff465a34db031f667b3fcd4bf2e (patch) | |
tree | c33b80a72a22047d49243ea6307de8e19d3a98e2 /libbb/getopt32.c | |
parent | df5189269074042a60fa87425ef8a01a9aaa4af6 (diff) | |
download | busybox-w32-456fa6c0b17b2ff465a34db031f667b3fcd4bf2e.tar.gz busybox-w32-456fa6c0b17b2ff465a34db031f667b3fcd4bf2e.tar.bz2 busybox-w32-456fa6c0b17b2ff465a34db031f667b3fcd4bf2e.zip |
readlink: do not emit errors if file doesnt not exist / not a link
getopt32: add =N support
Diffstat (limited to 'libbb/getopt32.c')
-rw-r--r-- | libbb/getopt32.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libbb/getopt32.c b/libbb/getopt32.c index 2f2f0b9e9..73e6b8684 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c | |||
@@ -188,6 +188,10 @@ Special characters: | |||
188 | by a single digit (0-9) means that at least N non-option | 188 | by a single digit (0-9) means that at least N non-option |
189 | arguments must be present on the command line | 189 | arguments must be present on the command line |
190 | 190 | ||
191 | "=N" An equal sign as the first char in a opt_complementary group followed | ||
192 | by a single digit (0-9) means that exactly N non-option | ||
193 | arguments must be present on the command line | ||
194 | |||
191 | "V-" An option with dash before colon or end-of-line results in | 195 | "V-" An option with dash before colon or end-of-line results in |
192 | bb_show_usage being called if this option is encountered. | 196 | bb_show_usage being called if this option is encountered. |
193 | This is typically used to implement "print verbose usage message | 197 | This is typically used to implement "print verbose usage message |
@@ -400,6 +404,11 @@ getopt32(int argc, char **argv, const char *applet_opts, ...) | |||
400 | } | 404 | } |
401 | continue; | 405 | continue; |
402 | } | 406 | } |
407 | if (*s == '=') { | ||
408 | min_arg = max_arg = c - '0'; | ||
409 | s++; | ||
410 | continue; | ||
411 | } | ||
403 | for (on_off = complementary; on_off->opt; on_off++) | 412 | for (on_off = complementary; on_off->opt; on_off++) |
404 | if (on_off->opt == *s) | 413 | if (on_off->opt == *s) |
405 | break; | 414 | break; |