diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-24 21:46:24 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-24 21:46:24 +0000 |
commit | 6666ac42a5cd63a8b18ec72f6c1364f31ef53921 (patch) | |
tree | 64110c3cfad98cada86b87d1e6059173ca33dbd7 /libbb | |
parent | 2062fc415524e966862c60a6e35d03285f366cbb (diff) | |
download | busybox-w32-6666ac42a5cd63a8b18ec72f6c1364f31ef53921.tar.gz busybox-w32-6666ac42a5cd63a8b18ec72f6c1364f31ef53921.tar.bz2 busybox-w32-6666ac42a5cd63a8b18ec72f6c1364f31ef53921.zip |
cp,mv: simpler arg[cv] handling -> smallish code savings
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/getopt32.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libbb/getopt32.c b/libbb/getopt32.c index 3033bf11e..bcb7ea6a0 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c | |||
@@ -178,7 +178,7 @@ Special characters: | |||
178 | This is typically used to implement "print verbose usage message | 178 | This is typically used to implement "print verbose usage message |
179 | and exit" option. | 179 | and exit" option. |
180 | 180 | ||
181 | "-" A dash between two options causes the second of the two | 181 | "a-b" A dash between two options causes the second of the two |
182 | to be unset (and ignored) if it is given on the command line. | 182 | to be unset (and ignored) if it is given on the command line. |
183 | 183 | ||
184 | [FIXME: what if they are the same? like "x-x"? Is it ever useful?] | 184 | [FIXME: what if they are the same? like "x-x"? Is it ever useful?] |
@@ -204,7 +204,7 @@ Special characters: | |||
204 | if (opt & 4) | 204 | if (opt & 4) |
205 | printf("Detected odd -x usage\n"); | 205 | printf("Detected odd -x usage\n"); |
206 | 206 | ||
207 | "--" A double dash between two options, or between an option and a group | 207 | "a--b" A double dash between two options, or between an option and a group |
208 | of options, means that they are mutually exclusive. Unlike | 208 | of options, means that they are mutually exclusive. Unlike |
209 | the "-" case above, an error will be forced if the options | 209 | the "-" case above, an error will be forced if the options |
210 | are used together. | 210 | are used together. |
@@ -220,7 +220,7 @@ Special characters: | |||
220 | "x--x" Variation of the above, it means that -x option should occur | 220 | "x--x" Variation of the above, it means that -x option should occur |
221 | at most once. | 221 | at most once. |
222 | 222 | ||
223 | "::" A double colon after a char in opt_complementary means that the | 223 | "a::" A double colon after a char in opt_complementary means that the |
224 | option can occur multiple times. Each occurrence will be saved as | 224 | option can occur multiple times. Each occurrence will be saved as |
225 | a llist_t element instead of char*. | 225 | a llist_t element instead of char*. |
226 | 226 | ||
@@ -240,7 +240,7 @@ Special characters: | |||
240 | root:x:0:0:root:/root:/bin/bash | 240 | root:x:0:0:root:/root:/bin/bash |
241 | user:x:500:500::/home/user:/bin/bash | 241 | user:x:500:500::/home/user:/bin/bash |
242 | 242 | ||
243 | "?" An "?" between an option and a group of options means that | 243 | "a?b" A "?" between an option and a group of options means that |
244 | at least one of them is required to occur if the first option | 244 | at least one of them is required to occur if the first option |
245 | occurs in preceding command line arguments. | 245 | occurs in preceding command line arguments. |
246 | 246 | ||
@@ -259,7 +259,7 @@ Special characters: | |||
259 | For example from "start-stop-daemon" applet: | 259 | For example from "start-stop-daemon" applet: |
260 | 260 | ||
261 | // Don't allow -KS -SK, but -S or -K is required | 261 | // Don't allow -KS -SK, but -S or -K is required |
262 | opt_complementary = "K:S:?K--S:S--K"; | 262 | opt_complementary = "K:S:K--S:S--K"; |
263 | flags = getopt32(argv, "KS...); | 263 | flags = getopt32(argv, "KS...); |
264 | 264 | ||
265 | 265 | ||
@@ -268,6 +268,7 @@ Special characters: | |||
268 | max 3 args; count uses of '-2'; min 2 args; if there is | 268 | max 3 args; count uses of '-2'; min 2 args; if there is |
269 | a '-2' option then unset '-3', '-X' and '-a'; if there is | 269 | a '-2' option then unset '-3', '-X' and '-a'; if there is |
270 | a '-2' and after it a '-x' then error out. | 270 | a '-2' and after it a '-x' then error out. |
271 | But it's far too obfuscated. Use ':' to separate groups. | ||
271 | */ | 272 | */ |
272 | 273 | ||
273 | /* Code here assumes that 'unsigned' is at least 32 bits wide */ | 274 | /* Code here assumes that 'unsigned' is at least 32 bits wide */ |