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.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 18d490987..f6ecc3dde 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -28,8 +28,28 @@
28 * Removed --version/-V and --help/-h 28 * Removed --version/-V and --help/-h
29 * Removed parse_error(), using bb_error_msg() from Busybox instead 29 * Removed parse_error(), using bb_error_msg() from Busybox instead
30 * Replaced our_malloc with xmalloc and our_realloc with xrealloc 30 * Replaced our_malloc with xmalloc and our_realloc with xrealloc
31 *
32 */ 31 */
32//config:config GETOPT
33//config: bool "getopt"
34//config: default y
35//config: help
36//config: The getopt utility is used to break up (parse) options in command
37//config: lines to make it easy to write complex shell scripts that also check
38//config: for legal (and illegal) options. If you want to write horribly
39//config: complex shell scripts, or use some horribly complex shell script
40//config: written by others, this utility may be for you. Most people will
41//config: wisely leave this disabled.
42//config:
43//config:config FEATURE_GETOPT_LONG
44//config: bool "Support option -l"
45//config: default y if LONG_OPTS
46//config: depends on GETOPT
47//config: help
48//config: Enable support for long options (option -l).
49
50//applet:IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP))
51
52//kbuild:lib-$(CONFIG_GETOPT) += getopt.o
33 53
34//usage:#define getopt_trivial_usage 54//usage:#define getopt_trivial_usage
35//usage: "[OPTIONS] [--] OPTSTRING PARAMS" 55//usage: "[OPTIONS] [--] OPTSTRING PARAMS"
@@ -327,9 +347,9 @@ static struct option *add_long_options(struct option *long_options, char *option
327 347
328static void set_shell(const char *new_shell) 348static void set_shell(const char *new_shell)
329{ 349{
330 if (!strcmp(new_shell, "bash") || !strcmp(new_shell, "sh")) 350 if (strcmp(new_shell, "bash") == 0 || strcmp(new_shell, "sh") == 0)
331 return; 351 return;
332 if (!strcmp(new_shell, "tcsh") || !strcmp(new_shell, "csh")) 352 if (strcmp(new_shell, "tcsh") == 0 || strcmp(new_shell, "csh") == 0)
333 option_mask32 |= SHELL_IS_TCSH; 353 option_mask32 |= SHELL_IS_TCSH;
334 else 354 else
335 bb_error_msg("unknown shell '%s', assuming bash", new_shell); 355 bb_error_msg("unknown shell '%s', assuming bash", new_shell);