#
# For a description of the syntax of this configuration file,
# see scripts/kbuild/config-language.txt.
#

menu "Shells"

INSERT

config ASH
	bool "ash"
	default y
	depends on !NOMMU
	help
	  Tha 'ash' shell adds about 60k in the default configuration and is
	  the most complete and most pedantically correct shell included with
	  busybox. This shell is actually a derivative of the Debian 'dash'
	  shell (by Herbert Xu), which was created by porting the 'ash' shell
	  (written by Kenneth Almquist) from NetBSD.

config ASH_BASH_COMPAT
	bool "bash-compatible extensions"
	default y
	depends on ASH
	help
	  Enable bash-compatible extensions.

config ASH_JOB_CONTROL
	bool "Job control"
	default y
	depends on ASH
	help
	  Enable job control in the ash shell.

config ASH_ALIAS
	bool "alias support"
	default y
	depends on ASH
	help
	  Enable alias support in the ash shell.

config ASH_GETOPTS
	bool "Builtin getopt to parse positional parameters"
	default y
	depends on ASH
	help
	  Enable getopts builtin in the ash shell.

config ASH_BUILTIN_ECHO
	bool "Builtin version of 'echo'"
	default y
	depends on ASH
	help
	  Enable support for echo, builtin to ash.

config ASH_BUILTIN_PRINTF
	bool "Builtin version of 'printf'"
	default y
	depends on ASH
	help
	  Enable support for printf, builtin to ash.

config ASH_BUILTIN_TEST
	bool "Builtin version of 'test'"
	default y
	depends on ASH
	help
	  Enable support for test, builtin to ash.

config ASH_CMDCMD
	bool "'command' command to override shell builtins"
	default y
	depends on ASH
	help
	  Enable support for the ash 'command' builtin, which allows
	  you to run the specified command with the specified arguments,
	  even when there is an ash builtin command with the same name.

config ASH_MAIL
	bool "Check for new mail on interactive shells"
	default n
	depends on ASH
	help
	  Enable "check for new mail" in the ash shell.

config ASH_OPTIMIZE_FOR_SIZE
	bool "Optimize for size instead of speed"
	default y
	depends on ASH
	help
	  Compile ash for reduced size at the price of speed.

config ASH_RANDOM_SUPPORT
	bool "Pseudorandom generator and $RANDOM variable"
	default y
	depends on ASH
	help
	  Enable pseudorandom generator and dynamic variable "$RANDOM".
	  Each read of "$RANDOM" will generate a new pseudorandom value.
	  You can reset the generator by using a specified start value.
	  After "unset RANDOM" the generator will switch off and this
	  variable will no longer have special treatment.

config ASH_EXPAND_PRMT
	bool "Expand prompt string"
	default y
	depends on ASH
	help
	  "PS#" may contain volatile content, such as backquote commands.
	  This option recreates the prompt string from the environment
	  variable each time it is displayed.

config HUSH
	bool "hush"
	default y
	help
	  hush is a small shell (22k). It handles the normal flow control
	  constructs such as if/then/elif/else/fi, for/in/do/done, while loops,
	  case/esac. Redirections, here documents, $((arithmetic))
	  and functions are supported.

	  It will compile and work on no-mmu systems.

	  It does not handle select, aliases, brace expansion,
	  tilde expansion, &>file and >&file redirection of stdout+stderr.

config HUSH_BASH_COMPAT
	bool "bash-compatible extensions"
	default y
	depends on HUSH
	help
	  Enable bash-compatible extensions.

config HUSH_HELP
	bool "help builtin"
	default y
	depends on HUSH
	help
	  Enable help builtin in hush. Code size + ~1 kbyte.

config HUSH_INTERACTIVE
	bool "Interactive mode"
	default y
	depends on HUSH
	help
	  Enable interactive mode (prompt and command editing).
	  Without this, hush simply reads and executes commands
	  from stdin just like a shell script from a file.
	  No prompt, no PS1/PS2 magic shell variables.

config HUSH_JOB
	bool "Job control"
	default y
	depends on HUSH_INTERACTIVE
	help
	  Enable job control: Ctrl-Z backgrounds, Ctrl-C interrupts current
	  command (not entire shell), fg/bg builtins work. Without this option,
	  "cmd &" still works by simply spawning a process and immediately
	  prompting for next command (or executing next command in a script),
	  but no separate process group is formed.

config HUSH_TICK
	bool "Process substitution"
	default y
	depends on HUSH
	help
	  Enable process substitution `command` and $(command) in hush.

config HUSH_IF
	bool "Support if/then/elif/else/fi"
	default y
	depends on HUSH
	help
	  Enable if/then/elif/else/fi in hush.

config HUSH_LOOPS
	bool "Support for, while and until loops"
	default y
	depends on HUSH
	help
	  Enable for, while and until loops in hush.

config HUSH_CASE
	bool "Support case ... esac statement"
	default y
	depends on HUSH
	help
	  Enable case ... esac statement in hush. +400 bytes.

config HUSH_FUNCTIONS
	bool "Support funcname() { commands; } syntax"
	default y
	depends on HUSH
	help
	  Enable support for shell functions in hush. +800 bytes.

config HUSH_LOCAL
	bool "Support local builtin"
	default y
	depends on HUSH_FUNCTIONS
	help
	  Enable support for local variables in functions.

config HUSH_EXPORT_N
	bool "Support export '-n' option"
	default y
	depends on HUSH
	help
	  Enable support for export '-n' option in hush. It is a bash extension.

config HUSH_RANDOM_SUPPORT
	bool "Pseudorandom generator and $RANDOM variable"
	default y
	depends on HUSH
	help
	  Enable pseudorandom generator and dynamic variable "$RANDOM".
	  Each read of "$RANDOM" will generate a new pseudorandom value.


choice
	prompt "Choose which shell is aliased to 'sh' name"
	default FEATURE_SH_IS_ASH
	help
	  Choose which shell you want to be executed by 'sh' alias.
	  The ash shell is the most bash compatible and full featured one.

# note: cannot use "select ASH" here, it breaks "make allnoconfig"
config FEATURE_SH_IS_ASH
	depends on ASH
	bool "ash"
	depends on !NOMMU

config FEATURE_SH_IS_HUSH
	depends on HUSH
	bool "hush"

config FEATURE_SH_IS_NONE
	bool "none"

endchoice

choice
	prompt "Choose which shell is aliased to 'bash' name"
	default FEATURE_BASH_IS_NONE
	help
	  Choose which shell you want to be executed by 'bash' alias.
	  The ash shell is the most bash compatible and full featured one.

	  Note that selecting this option does not switch on any bash
	  compatibility code. It merely makes it possible to install
	  /bin/bash (sym)link and run scripts which start with
	  #!/bin/bash line.

	  Many systems use it in scripts which use bash-specific features,
	  even simple ones like $RANDOM. Without this option, busybox
	  can't be used for running them because it won't recongnize
	  "bash" as a supported applet name.

config FEATURE_BASH_IS_ASH
	depends on ASH
	bool "ash"
	depends on !NOMMU

config FEATURE_BASH_IS_HUSH
	depends on HUSH
	bool "hush"

config FEATURE_BASH_IS_NONE
	bool "none"

endchoice


config LASH
	bool "lash (deprecated: aliased to hush)"
	default n
	select HUSH
	help
	  lash is deprecated and will be removed, please migrate to hush.

config MSH
	bool "msh (deprecated: please use hush)"
	default n
	select HUSH
	help
	  msh is deprecated and will be removed, please migrate to hush.
	  If there is a feature msh has but hush does not, please let us know.

#	  The minix shell (adds just 30k) is quite complete and handles things
#	  like for/do/done, case/esac and all the things you expect a Bourne
#	  shell to do. It is not always pedantically correct about Bourne
#	  shell grammar (try running the shell testscript "tests/sh.testcases"
#	  on it and compare vs bash) but for most things it works quite well.
#	  It uses only vfork, so it can be used on uClinux systems.


config SH_MATH_SUPPORT
	bool "POSIX math support"
	default y
	depends on ASH || HUSH
	help
	  Enable math support in the shell via $((...)) syntax.

config SH_MATH_SUPPORT_64
	bool "Extend POSIX math support to 64 bit"
	default y
	depends on SH_MATH_SUPPORT
	help
	  Enable 64-bit math support in the shell. This will make the shell
	  slightly larger, but will allow computation with very large numbers.
	  This is not in POSIX, so do not rely on this in portable code.

config FEATURE_SH_EXTRA_QUIET
	bool "Hide message on interactive shell startup"
	default y
	depends on HUSH || ASH
	help
	  Remove the busybox introduction when starting a shell.

config FEATURE_SH_STANDALONE
	bool "Standalone shell"
	default n
	depends on (HUSH || ASH) && FEATURE_PREFER_APPLETS
	help
	  This option causes busybox shells to use busybox applets
	  in preference to executables in the PATH whenever possible. For
	  example, entering the command 'ifconfig' into the shell would cause
	  busybox to use the ifconfig busybox applet. Specifying the fully
	  qualified executable name, such as '/sbin/ifconfig' will still
	  execute the /sbin/ifconfig executable on the filesystem. This option
	  is generally used when creating a statically linked version of busybox
	  for use as a rescue shell, in the event that you screw up your system.

	  This is implemented by re-execing /proc/self/exe (typically)
	  with right parameters. Some selected applets ("NOFORK" applets)
	  can even be executed without creating new process.
	  Instead, busybox will call <applet>_main() internally.

	  However, this causes problems in chroot jails without mounted /proc
	  and with ps/top (command name can be shown as 'exe' for applets
	  started this way).
# untrue?
#	  Note that this will *also* cause applets to take precedence
#	  over shell builtins of the same name. So turning this on will
#	  eliminate any performance gained by turning on the builtin "echo"
#	  and "test" commands in ash.
# untrue?
#	  Note that when using this option, the shell will attempt to directly
#	  run '/bin/busybox'. If you do not have the busybox binary sitting in
#	  that exact location with that exact name, this option will not work at
#	  all.

config FEATURE_SH_NOFORK
	bool "Run 'nofork' applets directly"
	default n
	depends on (HUSH || ASH) && FEATURE_PREFER_APPLETS
	help
	  This option causes busybox shells [currently only ash]
	  to not execute typical fork/exec/wait sequence, but call <applet>_main
	  directly, if possible. (Sometimes it is not possible: for example,
	  this is not possible in pipes).

	  This will be done only for some applets (those which are marked
	  NOFORK in include/applets.h).

	  This may significantly speed up some shell scripts.

	  This feature is relatively new. Use with care.

config CTTYHACK
	bool "cttyhack"
	default y
	help
	  One common problem reported on the mailing list is "can't access tty;
	  job control turned off" error message which typically appears when
	  one tries to use shell with stdin/stdout opened to /dev/console.
	  This device is special - it cannot be a controlling tty.

	  Proper solution is to use correct device instead of /dev/console.

	  cttyhack provides "quick and dirty" solution to this problem.
	  It analyzes stdin with various ioctls, trying to determine whether
	  it is a /dev/ttyN or /dev/ttySN (virtual terminal or serial line).
	  If it detects one, it closes stdin/out/err and reopens that device.
	  Then it executes given program. Opening the device will make
	  that device a controlling tty. This may require cttyhack
	  to be a session leader.

	  Example for /etc/inittab (for busybox init):

	  ::respawn:/bin/cttyhack /bin/sh

	  Giving controlling tty to shell running with PID 1:

	  $ exec cttyhack sh

	  Starting an interactive shell from boot shell script:

	  setsid cttyhack sh

endmenu
