summaryrefslogtreecommitdiffhomepage
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-24 21:46:24 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-24 21:46:24 +0000
commit6666ac42a5cd63a8b18ec72f6c1364f31ef53921 (patch)
tree64110c3cfad98cada86b87d1e6059173ca33dbd7 /libbb
parent2062fc415524e966862c60a6e35d03285f366cbb (diff)
cp,mv: simpler arg[cv] handling -> smallish code savings
Diffstat (limited to 'libbb')
-rw-r--r--libbb/getopt32.c11
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:
This is typically used to implement "print verbose usage message
and exit" option.
- "-" A dash between two options causes the second of the two
+ "a-b" A dash between two options causes the second of the two
to be unset (and ignored) if it is given on the command line.
[FIXME: what if they are the same? like "x-x"? Is it ever useful?]
@@ -204,7 +204,7 @@ Special characters:
if (opt & 4)
printf("Detected odd -x usage\n");
- "--" A double dash between two options, or between an option and a group
+ "a--b" A double dash between two options, or between an option and a group
of options, means that they are mutually exclusive. Unlike
the "-" case above, an error will be forced if the options
are used together.
@@ -220,7 +220,7 @@ Special characters:
"x--x" Variation of the above, it means that -x option should occur
at most once.
- "::" A double colon after a char in opt_complementary means that the
+ "a::" A double colon after a char in opt_complementary means that the
option can occur multiple times. Each occurrence will be saved as
a llist_t element instead of char*.
@@ -240,7 +240,7 @@ Special characters:
root:x:0:0:root:/root:/bin/bash
user:x:500:500::/home/user:/bin/bash
- "?" An "?" between an option and a group of options means that
+ "a?b" A "?" between an option and a group of options means that
at least one of them is required to occur if the first option
occurs in preceding command line arguments.
@@ -259,7 +259,7 @@ Special characters:
For example from "start-stop-daemon" applet:
// Don't allow -KS -SK, but -S or -K is required
- opt_complementary = "K:S:?K--S:S--K";
+ opt_complementary = "K:S:K--S:S--K";
flags = getopt32(argv, "KS...);
@@ -268,6 +268,7 @@ Special characters:
max 3 args; count uses of '-2'; min 2 args; if there is
a '-2' option then unset '-3', '-X' and '-a'; if there is
a '-2' and after it a '-x' then error out.
+ But it's far too obfuscated. Use ':' to separate groups.
*/
/* Code here assumes that 'unsigned' is at least 32 bits wide */