[PATCH 2/3] Explicltly group "ash options" and "hush options"

Kang-Che Sung explorer09 at gmail.com
Wed Jan 4 00:56:20 UTC 2017


(This mail and patch was sent to busybox mailing list on Dec 25, 2016,
and I'm re-sending again for people to notice.)

This tries to workaround a menuconfig bug that all ash options are no
longer indented under "ash" after SH_IS_ASH becomes independently
selectable. Also allows "depends on ASH || SH_IS_ASH || BASH_IS_ASH"
lines and such be grouped into one place.

Signed-off-by: Kang-Che Sung <explorer09 at gmail.com>
---
 shell/Config.src |  9 ++++-----
 shell/ash.c      | 20 +++++---------------
 shell/hush.c     | 16 +++++-----------
 3 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/shell/Config.src b/shell/Config.src
index 794f9985a..1fb05fab6 100644
--- a/shell/Config.src
+++ b/shell/Config.src
@@ -57,10 +57,12 @@ config BASH_IS_NONE

 endchoice

+menu "Options common to all shells"
+ depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH ||
BASH_IS_HUSH
+
 config FEATURE_SH_MATH
  bool "POSIX math support"
  default y
- depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH ||
BASH_IS_HUSH
  help
   Enable math support in the shell via $((...)) syntax.

@@ -76,14 +78,12 @@ config FEATURE_SH_MATH_64
 config FEATURE_SH_EXTRA_QUIET
  bool "Hide message on interactive shell startup"
  default y
- depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH ||
BASH_IS_HUSH
  help
   Remove the busybox introduction when starting a shell.

 config FEATURE_SH_STANDALONE
  bool "Standalone shell"
  default n
- depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH ||
BASH_IS_HUSH
  help
   This option causes busybox shells to use busybox applets
   in preference to executables in the PATH whenever possible. For
@@ -116,7 +116,6 @@ config FEATURE_SH_STANDALONE
 config FEATURE_SH_NOFORK
  bool "Run 'nofork' applets directly"
  default n
- depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH ||
BASH_IS_HUSH
  help
   This option causes busybox shells to not execute typical
   fork/exec/wait sequence, but call <applet>_main directly,
@@ -134,11 +133,11 @@ config FEATURE_SH_NOFORK
 config FEATURE_SH_HISTFILESIZE
  bool "Use $HISTFILESIZE"
  default y
- depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH ||
BASH_IS_HUSH
  help
   This option makes busybox shells to use $HISTFILESIZE variable
   to set shell history size. Note that its max value is capped
   by "History size" setting in library tuning section.

+endmenu

 endmenu
diff --git a/shell/ash.c b/shell/ash.c
index 430e42a7b..a5a94a18d 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -26,17 +26,18 @@
 //config:  shell (by Herbert Xu), which was created by porting the 'ash' shell
 //config:  (written by Kenneth Almquist) from NetBSD.
 //config:
+//config:menu "ash options"
+//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
+//config:
 //config:config ASH_OPTIMIZE_FOR_SIZE
 //config: bool "Optimize for size instead of speed"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Compile ash for reduced size at the price of speed.
 //config:
 //config:config ASH_INTERNAL_GLOB
 //config: bool "Use internal glob() implementation"
 //config: default y # Y is bigger, but because of uclibc glob() bug,
let Y be default for now
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Do not use glob() function from libc, use internal implementation.
 //config:  Use this if you are getting "glob.h: No such file or directory"
@@ -45,7 +46,6 @@
 //config:config ASH_RANDOM_SUPPORT
 //config: bool "Pseudorandom generator and $RANDOM variable"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable pseudorandom generator and dynamic variable "$RANDOM".
 //config:  Each read of "$RANDOM" will generate a new pseudorandom value.
@@ -56,7 +56,6 @@
 //config:config ASH_EXPAND_PRMT
 //config: bool "Expand prompt string"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  "PS#" may contain volatile content, such as backquote commands.
 //config:  This option recreates the prompt string from the environment
@@ -65,70 +64,60 @@
 //config:config ASH_BASH_COMPAT
 //config: bool "bash-compatible extensions"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable bash-compatible extensions.
 //config:
 //config:config ASH_IDLE_TIMEOUT
 //config: bool "Idle timeout variable"
 //config: default n
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enables bash-like auto-logout after $TMOUT seconds of idle time.
 //config:
 //config:config ASH_JOB_CONTROL
 //config: bool "Job control"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable job control in the ash shell.
 //config:
 //config:config ASH_ALIAS
 //config: bool "Alias support"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable alias support in the ash shell.
 //config:
 //config:config ASH_GETOPTS
 //config: bool "Builtin getopt to parse positional parameters"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable support for getopts builtin in ash.
 //config:
 //config:config ASH_BUILTIN_ECHO
 //config: bool "Builtin version of 'echo'"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable support for echo builtin in ash.
 //config:
 //config:config ASH_BUILTIN_PRINTF
 //config: bool "Builtin version of 'printf'"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable support for printf builtin in ash.
 //config:
 //config:config ASH_BUILTIN_TEST
 //config: bool "Builtin version of 'test'"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable support for test builtin in ash.
 //config:
 //config:config ASH_HELP
 //config: bool "help builtin"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable help builtin in ash.
 //config:
 //config:config ASH_CMDCMD
 //config: bool "'command' command to override shell builtins"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable support for the ash 'command' builtin, which allows
 //config:  you to run the specified command with the specified arguments,
@@ -137,9 +126,10 @@
 //config:config ASH_MAIL
 //config: bool "Check for new mail on interactive shells"
 //config: default y
-//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable "check for new mail" function in the ash shell.
+//config:
+//config:endmenu

 //applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
 //applet:IF_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
diff --git a/shell/hush.c b/shell/hush.c
index fecc89294..76c38ef87 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -96,10 +96,12 @@
 //config:  It does not handle select, aliases, tilde expansion,
 //config:  &>file and >&file redirection of stdout+stderr.
 //config:
+//config:menu "hush options"
+//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
+//config:
 //config:config HUSH_BASH_COMPAT
 //config: bool "bash-compatible extensions"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  Enable bash-compatible extensions.
 //config:
@@ -113,14 +115,12 @@
 //config:config HUSH_HELP
 //config: bool "help builtin"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  Enable help builtin in hush. Code size + ~1 kbyte.
 //config:
 //config:config HUSH_INTERACTIVE
 //config: bool "Interactive mode"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  Enable interactive mode (prompt and command editing).
 //config:  Without this, hush simply reads and executes commands
@@ -148,35 +148,30 @@
 //config:config HUSH_TICK
 //config: bool "Process substitution"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  Enable process substitution `command` and $(command) in hush.
 //config:
 //config:config HUSH_IF
 //config: bool "Support if/then/elif/else/fi"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  Enable if/then/elif/else/fi in hush.
 //config:
 //config:config HUSH_LOOPS
 //config: bool "Support for, while and until loops"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  Enable for, while and until loops in hush.
 //config:
 //config:config HUSH_CASE
 //config: bool "Support case ... esac statement"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  Enable case ... esac statement in hush. +400 bytes.
 //config:
 //config:config HUSH_FUNCTIONS
 //config: bool "Support funcname() { commands; } syntax"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  Enable support for shell functions in hush. +800 bytes.
 //config:
@@ -190,7 +185,6 @@
 //config:config HUSH_RANDOM_SUPPORT
 //config: bool "Pseudorandom generator and $RANDOM variable"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  Enable pseudorandom generator and dynamic variable "$RANDOM".
 //config:  Each read of "$RANDOM" will generate a new pseudorandom value.
@@ -198,18 +192,18 @@
 //config:config HUSH_EXPORT_N
 //config: bool "Support 'export -n' option"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  export -n unexports variables. It is a bash extension.
 //config:
 //config:config HUSH_MODE_X
 //config: bool "Support 'hush -x' option and 'set -x' command"
 //config: default y
-//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
 //config:  This instructs hush to print commands before execution.
 //config:  Adds ~300 bytes.
 //config:
+//config:endmenu
+//config:
 //config:config MSH
 //config: bool "msh (deprecated: aliased to hush)"
 //config: default n
--
2.11.0


More information about the busybox mailing list