diff options
Diffstat (limited to '')
-rw-r--r-- | util-linux/getopt.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 7c498538f..10e1dc49b 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c | |||
@@ -31,6 +31,54 @@ | |||
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | 33 | ||
34 | //usage:#define getopt_trivial_usage | ||
35 | //usage: "[OPTIONS]" | ||
36 | //usage:#define getopt_full_usage "\n\n" | ||
37 | //usage: "Options:" | ||
38 | //usage: IF_LONG_OPTS( | ||
39 | //usage: "\n -a,--alternative Allow long options starting with single -" | ||
40 | //usage: "\n -l,--longoptions=longopts Long options to be recognized" | ||
41 | //usage: "\n -n,--name=progname The name under which errors are reported" | ||
42 | //usage: "\n -o,--options=optstring Short options to be recognized" | ||
43 | //usage: "\n -q,--quiet Disable error reporting by getopt(3)" | ||
44 | //usage: "\n -Q,--quiet-output No normal output" | ||
45 | //usage: "\n -s,--shell=shell Set shell quoting conventions" | ||
46 | //usage: "\n -T,--test Test for getopt(1) version" | ||
47 | //usage: "\n -u,--unquoted Don't quote the output" | ||
48 | //usage: ) | ||
49 | //usage: IF_NOT_LONG_OPTS( | ||
50 | //usage: "\n -a Allow long options starting with single -" | ||
51 | //usage: "\n -l longopts Long options to be recognized" | ||
52 | //usage: "\n -n progname The name under which errors are reported" | ||
53 | //usage: "\n -o optstring Short options to be recognized" | ||
54 | //usage: "\n -q Disable error reporting by getopt(3)" | ||
55 | //usage: "\n -Q No normal output" | ||
56 | //usage: "\n -s shell Set shell quoting conventions" | ||
57 | //usage: "\n -T Test for getopt(1) version" | ||
58 | //usage: "\n -u Don't quote the output" | ||
59 | //usage: ) | ||
60 | //usage: | ||
61 | //usage:#define getopt_example_usage | ||
62 | //usage: "$ cat getopt.test\n" | ||
63 | //usage: "#!/bin/sh\n" | ||
64 | //usage: "GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \\\n" | ||
65 | //usage: " -n 'example.busybox' -- \"$@\"`\n" | ||
66 | //usage: "if [ $? != 0 ]; then exit 1; fi\n" | ||
67 | //usage: "eval set -- \"$GETOPT\"\n" | ||
68 | //usage: "while true; do\n" | ||
69 | //usage: " case $1 in\n" | ||
70 | //usage: " -a|--a-long) echo \"Option a\"; shift;;\n" | ||
71 | //usage: " -b|--b-long) echo \"Option b, argument '$2'\"; shift 2;;\n" | ||
72 | //usage: " -c|--c-long)\n" | ||
73 | //usage: " case \"$2\" in\n" | ||
74 | //usage: " \"\") echo \"Option c, no argument\"; shift 2;;\n" | ||
75 | //usage: " *) echo \"Option c, argument '$2'\"; shift 2;;\n" | ||
76 | //usage: " esac;;\n" | ||
77 | //usage: " --) shift; break;;\n" | ||
78 | //usage: " *) echo \"Internal error!\"; exit 1;;\n" | ||
79 | //usage: " esac\n" | ||
80 | //usage: "done\n" | ||
81 | |||
34 | #include <getopt.h> | 82 | #include <getopt.h> |
35 | #include "libbb.h" | 83 | #include "libbb.h" |
36 | 84 | ||