diff options
author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-09-06 16:08:33 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-09-06 16:08:33 +0000 |
commit | 45a8ed89c69f95fa35f139a7c9ddb3874b13de46 (patch) | |
tree | e079fe949b391fc103b6329c1d12149fd8a7bfda /libbb | |
parent | 1443487c924cff2f664811d1d45bff3fe59a8408 (diff) | |
download | busybox-w32-45a8ed89c69f95fa35f139a7c9ddb3874b13de46.tar.gz busybox-w32-45a8ed89c69f95fa35f139a7c9ddb3874b13de46.tar.bz2 busybox-w32-45a8ed89c69f95fa35f139a7c9ddb3874b13de46.zip |
- sync traceroute with Slackware-10.1
(support -FIl -g gw -i if -z pt now).
- libbb/getopt_ulflags.c support bb_opt_complementally="x-x" as trigger now
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/getopt_ulflags.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libbb/getopt_ulflags.c b/libbb/getopt_ulflags.c index 44c8e1a76..58077c55f 100644 --- a/libbb/getopt_ulflags.c +++ b/libbb/getopt_ulflags.c | |||
@@ -113,7 +113,8 @@ const char *bb_opt_complementally | |||
113 | Special characters: | 113 | Special characters: |
114 | 114 | ||
115 | "-" A dash between two options causes the second of the two | 115 | "-" A dash between two options causes the second of the two |
116 | to be unset (and ignored) if it is given on the command line. | 116 | to be unset (and ignored or triggered) if it is given on |
117 | the command line. | ||
117 | 118 | ||
118 | For example: | 119 | For example: |
119 | The du applet has the options "-s" and "-d depth". If | 120 | The du applet has the options "-s" and "-d depth". If |
@@ -128,13 +129,15 @@ Special characters: | |||
128 | 129 | ||
129 | char *smax_print_depth; | 130 | char *smax_print_depth; |
130 | 131 | ||
131 | bb_opt_complementally = "s-d:d-s"; | 132 | bb_opt_complementally = "s-d:d-s:x-x"; |
132 | opt = bb_getopt_ulflags(argc, argv, "sd:", &smax_print_depth); | 133 | opt = bb_getopt_ulflags(argc, argv, "sd:x", &smax_print_depth); |
133 | 134 | ||
134 | if (opt & 2) { | 135 | if (opt & 2) { |
135 | max_print_depth = bb_xgetularg10_bnd(smax_print_depth, | 136 | max_print_depth = bb_xgetularg10_bnd(smax_print_depth, |
136 | 0, INT_MAX); | 137 | 0, INT_MAX); |
137 | } | 138 | } |
139 | if(opt & 4) | ||
140 | printf("Detected odd -x usaging\n"); | ||
138 | 141 | ||
139 | "~" A tilde between two options, or between an option and a group | 142 | "~" A tilde between two options, or between an option and a group |
140 | of options, means that they are mutually exclusive. Unlike | 143 | of options, means that they are mutually exclusive. Unlike |
@@ -297,6 +300,8 @@ bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...) | |||
297 | 300 | ||
298 | while ((c = getopt_long (argc, argv, applet_opts, | 301 | while ((c = getopt_long (argc, argv, applet_opts, |
299 | bb_applet_long_options, NULL)) > 0) { | 302 | bb_applet_long_options, NULL)) > 0) { |
303 | unsigned long trigger; | ||
304 | |||
300 | for (on_off = complementally; on_off->opt != c; on_off++) { | 305 | for (on_off = complementally; on_off->opt != c; on_off++) { |
301 | if(!on_off->opt) | 306 | if(!on_off->opt) |
302 | bb_show_usage (); | 307 | bb_show_usage (); |
@@ -306,8 +311,10 @@ bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...) | |||
306 | bb_show_usage (); | 311 | bb_show_usage (); |
307 | flags |= BB_GETOPT_ERROR; | 312 | flags |= BB_GETOPT_ERROR; |
308 | } | 313 | } |
309 | flags &= ~on_off->switch_off; | 314 | trigger = on_off->switch_on & on_off->switch_off; |
310 | flags |= on_off->switch_on; | 315 | flags &= ~(on_off->switch_off ^ trigger); |
316 | flags |= on_off->switch_on ^ trigger; | ||
317 | flags ^= trigger; | ||
311 | if(on_off->list_flg) { | 318 | if(on_off->list_flg) { |
312 | *(llist_t **)(on_off->optarg) = | 319 | *(llist_t **)(on_off->optarg) = |
313 | llist_add_to(*(llist_t **)(on_off->optarg), optarg); | 320 | llist_add_to(*(llist_t **)(on_off->optarg), optarg); |