aboutsummaryrefslogtreecommitdiff
path: root/util-linux/getopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/getopt.c')
-rw-r--r--util-linux/getopt.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index cf1bc592f..a151b7e56 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -42,32 +42,18 @@
42//config: 42//config:
43//config:config FEATURE_GETOPT_LONG 43//config:config FEATURE_GETOPT_LONG
44//config: bool "Support -l LONGOPTs" 44//config: bool "Support -l LONGOPTs"
45//config: default y if LONG_OPTS 45//config: default y
46//config: depends on GETOPT 46//config: depends on GETOPT && LONG_OPTS
47//config: help 47//config: help
48//config: Enable support for long options (option -l). 48//config: Enable support for long options (option -l).
49 49
50//applet:IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP)) 50//applet:IF_GETOPT(APPLET_NOEXEC(getopt, getopt, BB_DIR_BIN, BB_SUID_DROP, getopt))
51 51
52//kbuild:lib-$(CONFIG_GETOPT) += getopt.o 52//kbuild:lib-$(CONFIG_GETOPT) += getopt.o
53 53
54//usage:#define getopt_trivial_usage 54//usage:#define getopt_trivial_usage
55//usage: "[OPTIONS] [--] OPTSTRING PARAMS" 55//usage: "[OPTIONS] [--] OPTSTRING PARAMS"
56//usage:#define getopt_full_usage "\n\n" 56//usage:#define getopt_full_usage "\n\n"
57//usage: IF_LONG_OPTS(
58//usage: IF_FEATURE_GETOPT_LONG(
59//usage: " -a,--alternative Allow long options starting with single -\n"
60//usage: " -l,--longoptions LOPT[,...] Long options to recognize\n"
61//usage: )
62//usage: " -n,--name PROGNAME The name under which errors are reported"
63//usage: "\n -o,--options OPTSTRING Short options to recognize"
64//usage: "\n -q,--quiet No error messages on unrecognized options"
65//usage: "\n -Q,--quiet-output No normal output"
66//usage: "\n -s,--shell SHELL Set shell quoting conventions"
67//usage: "\n -T,--test Version test (exits with 4)"
68//usage: "\n -u,--unquoted Don't quote output"
69//usage: )
70//usage: IF_NOT_LONG_OPTS(
71//usage: IF_FEATURE_GETOPT_LONG( 57//usage: IF_FEATURE_GETOPT_LONG(
72//usage: " -a Allow long options starting with single -\n" 58//usage: " -a Allow long options starting with single -\n"
73//usage: " -l LOPT[,...] Long options to recognize\n" 59//usage: " -l LOPT[,...] Long options to recognize\n"
@@ -79,7 +65,6 @@
79//usage: "\n -s SHELL Set shell quoting conventions" 65//usage: "\n -s SHELL Set shell quoting conventions"
80//usage: "\n -T Version test (exits with 4)" 66//usage: "\n -T Version test (exits with 4)"
81//usage: "\n -u Don't quote output" 67//usage: "\n -u Don't quote output"
82//usage: )
83//usage: IF_FEATURE_GETOPT_LONG( /* example uses -l, needs FEATURE_GETOPT_LONG */ 68//usage: IF_FEATURE_GETOPT_LONG( /* example uses -l, needs FEATURE_GETOPT_LONG */
84//usage: "\n" 69//usage: "\n"
85//usage: "\nExample:" 70//usage: "\nExample:"
@@ -411,8 +396,7 @@ int getopt_main(int argc, char **argv)
411#if !ENABLE_FEATURE_GETOPT_LONG 396#if !ENABLE_FEATURE_GETOPT_LONG
412 opt = getopt32(argv, "+o:n:qQs:Tu", &optstr, &name, &s_arg); 397 opt = getopt32(argv, "+o:n:qQs:Tu", &optstr, &name, &s_arg);
413#else 398#else
414 applet_long_options = getopt_longopts; 399 opt = getopt32long(argv, "+o:n:qQs:Tual:*", getopt_longopts,
415 opt = getopt32(argv, "+o:n:qQs:Tual:*",
416 &optstr, &name, &s_arg, &l_arg); 400 &optstr, &name, &s_arg, &l_arg);
417 /* Effectuate the read options for the applet itself */ 401 /* Effectuate the read options for the applet itself */
418 while (l_arg) { 402 while (l_arg) {