diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/Config.src | 124 | ||||
-rw-r--r-- | shell/ash.c | 50 | ||||
-rw-r--r-- | shell/cttyhack.c | 54 | ||||
-rw-r--r-- | shell/hush.c | 54 |
4 files changed, 141 insertions, 141 deletions
diff --git a/shell/Config.src b/shell/Config.src index 0dbf304..81c4ec8 100644 --- a/shell/Config.src +++ b/shell/Config.src @@ -10,26 +10,26 @@ choice prompt "Choose which shell is aliased to 'sh' name" default 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. + 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 SH_IS_ASH depends on !NOMMU bool "ash" help - Choose ash to be the shell executed by 'sh' name. - The ash code will be built into busybox. If you don't select - "ash" choice (CONFIG_ASH), this shell may only be invoked by - the name 'sh' (and not 'ash'). + Choose ash to be the shell executed by 'sh' name. + The ash code will be built into busybox. If you don't select + "ash" choice (CONFIG_ASH), this shell may only be invoked by + the name 'sh' (and not 'ash'). config SH_IS_HUSH bool "hush" help - Choose hush to be the shell executed by 'sh' name. - The hush code will be built into busybox. If you don't select - "hush" choice (CONFIG_HUSH), this shell may only be invoked by - the name 'sh' (and not 'hush'). + Choose hush to be the shell executed by 'sh' name. + The hush code will be built into busybox. If you don't select + "hush" choice (CONFIG_HUSH), this shell may only be invoked by + the name 'sh' (and not 'hush'). config SH_IS_NONE bool "none" @@ -40,36 +40,36 @@ choice prompt "Choose which shell is aliased to 'bash' name" default 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, - although compatibility is far from being complete. + Choose which shell you want to be executed by 'bash' alias. + The ash shell is the most bash compatible and full featured one, + although compatibility is far from being complete. - 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. + 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. + 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 BASH_IS_ASH depends on !NOMMU bool "ash" help - Choose ash to be the shell executed by 'bash' name. - The ash code will be built into busybox. If you don't select - "ash" choice (CONFIG_ASH), this shell may only be invoked by - the name 'bash' (and not 'ash'). + Choose ash to be the shell executed by 'bash' name. + The ash code will be built into busybox. If you don't select + "ash" choice (CONFIG_ASH), this shell may only be invoked by + the name 'bash' (and not 'ash'). config BASH_IS_HUSH bool "hush" help - Choose hush to be the shell executed by 'bash' name. - The hush code will be built into busybox. If you don't select - "hush" choice (CONFIG_HUSH), this shell may only be invoked by - the name 'bash' (and not 'hush'). + Choose hush to be the shell executed by 'bash' name. + The hush code will be built into busybox. If you don't select + "hush" choice (CONFIG_HUSH), this shell may only be invoked by + the name 'bash' (and not 'hush'). config BASH_IS_NONE bool "none" @@ -88,78 +88,78 @@ config FEATURE_SH_MATH 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. + Enable math support in the shell via $((...)) syntax. config FEATURE_SH_MATH_64 bool "Extend POSIX math support to 64 bit" default y depends on FEATURE_SH_MATH 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. + 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 ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH help - Remove the busybox introduction when starting a shell. + 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 - 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. - - However, there are drawbacks: it is problematic in chroot jails - without mounted /proc, and ps/top may show command name as 'exe' - for applets started this way. + 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. + + However, there are drawbacks: it is problematic in chroot jails + without mounted /proc, and ps/top may show command name as 'exe' + for applets started this way. 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, - if possible. (Sometimes it is not possible: for example, - this is not possible in pipes). + This option causes busybox shells 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 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 may significantly speed up some shell scripts. - This feature is relatively new. Use with care. Report bugs - to project mailing list. + This feature is relatively new. Use with care. Report bugs + to project mailing list. config FEATURE_SH_READ_FRAC bool "read -t N.NNN support (+110 bytes)" default y depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH help - Enable support for fractional second timeout in read builtin. + Enable support for fractional second timeout in read builtin. 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. + 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. endif # Options common to all shells diff --git a/shell/ash.c b/shell/ash.c index 9d81f4b..b28731e 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -20,10 +20,10 @@ //config: default y //config: depends on !NOMMU //config: help -//config: The most complete and most pedantically correct shell included with -//config: busybox. This shell is actually a derivative of the Debian 'dash' -//config: shell (by Herbert Xu), which was created by porting the 'ash' shell -//config: (written by Kenneth Almquist) from NetBSD. +//config: The most complete and most pedantically correct shell included with +//config: busybox. This shell is actually a derivative of the Debian 'dash' +//config: shell (by Herbert Xu), which was created by porting the 'ash' shell +//config: (written by Kenneth Almquist) from NetBSD. //config: //config:# ash options //config:# note: Don't remove !NOMMU part in the next line; it would break @@ -40,11 +40,11 @@ //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" -//config: or similar build errors. -//config: Note that as of now (2017-01), uclibc and musl glob() both have bugs -//config: which would break ash if you select N here. +//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" +//config: or similar build errors. +//config: Note that as of now (2017-01), uclibc and musl glob() both have bugs +//config: which would break ash if you select N here. //config: //config:config ASH_BASH_COMPAT //config: bool "bash-compatible extensions" @@ -66,37 +66,37 @@ //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. -//config: You can reset the generator by using a specified start value. -//config: After "unset RANDOM" the generator will switch off and this -//config: variable will no longer have special treatment. +//config: Enable pseudorandom generator and dynamic variable "$RANDOM". +//config: Each read of "$RANDOM" will generate a new pseudorandom value. +//config: You can reset the generator by using a specified start value. +//config: After "unset RANDOM" the generator will switch off and this +//config: variable will no longer have special treatment. //config: //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 -//config: variable each time it is displayed. +//config: $PS# may contain volatile content, such as backquote commands. +//config: This option recreates the prompt string from the environment +//config: variable each time it is displayed. //config: //config:config ASH_IDLE_TIMEOUT //config: bool "Idle timeout variable $TMOUT" //config: default y //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH //config: help -//config: Enable bash-like auto-logout after $TMOUT seconds of idle time. +//config: Enable bash-like auto-logout after $TMOUT seconds of idle time. //config: //config:config ASH_MAIL //config: bool "Check for new mail in interactive shell" //config: default y //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH //config: help -//config: Enable "check for new mail" function: -//config: if set, $MAIL file and $MAILPATH list of files -//config: are checked for mtime changes, and "you have mail" -//config: message is printed if change is detected. +//config: Enable "check for new mail" function: +//config: if set, $MAIL file and $MAILPATH list of files +//config: are checked for mtime changes, and "you have mail" +//config: message is printed if change is detected. //config: //config:config ASH_ECHO //config: bool "echo builtin" @@ -128,9 +128,9 @@ //config: default y //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH //config: help -//config: Enable support for the 'command' builtin, which allows -//config: you to run the specified command or builtin, -//config: even when there is a function with the same name. +//config: Enable support for the 'command' builtin, which allows +//config: you to run the specified command or builtin, +//config: even when there is a function with the same name. //config: //config:endif # ash options diff --git a/shell/cttyhack.c b/shell/cttyhack.c index 9a5f4bb..9004b47 100644 --- a/shell/cttyhack.c +++ b/shell/cttyhack.c @@ -14,45 +14,45 @@ //config: bool "cttyhack (2.5 kb)" //config: default y //config: help -//config: One common problem reported on the mailing list is the "can't -//config: access tty; job control turned off" error message, which typically -//config: appears when one tries to use a shell with stdin/stdout on -//config: /dev/console. -//config: This device is special - it cannot be a controlling tty. +//config: One common problem reported on the mailing list is the "can't +//config: access tty; job control turned off" error message, which typically +//config: appears when one tries to use a shell with stdin/stdout on +//config: /dev/console. +//config: This device is special - it cannot be a controlling tty. //config: -//config: The proper solution is to use the correct device instead of -//config: /dev/console. +//config: The proper solution is to use the correct device instead of +//config: /dev/console. //config: -//config: cttyhack provides a "quick and dirty" solution to this problem. -//config: It analyzes stdin with various ioctls, trying to determine whether -//config: it is a /dev/ttyN or /dev/ttySN (virtual terminal or serial line). -//config: On Linux it also checks sysfs for a pointer to the active console. -//config: If cttyhack is able to find the real console device, it closes -//config: stdin/out/err and reopens that device. -//config: Then it executes the given program. Opening the device will make -//config: that device a controlling tty. This may require cttyhack -//config: to be a session leader. +//config: cttyhack provides a "quick and dirty" solution to this problem. +//config: It analyzes stdin with various ioctls, trying to determine whether +//config: it is a /dev/ttyN or /dev/ttySN (virtual terminal or serial line). +//config: On Linux it also checks sysfs for a pointer to the active console. +//config: If cttyhack is able to find the real console device, it closes +//config: stdin/out/err and reopens that device. +//config: Then it executes the given program. Opening the device will make +//config: that device a controlling tty. This may require cttyhack +//config: to be a session leader. //config: -//config: Example for /etc/inittab (for busybox init): +//config: Example for /etc/inittab (for busybox init): //config: -//config: ::respawn:/bin/cttyhack /bin/sh +//config: ::respawn:/bin/cttyhack /bin/sh //config: -//config: Starting an interactive shell from boot shell script: +//config: Starting an interactive shell from boot shell script: //config: -//config: setsid cttyhack sh +//config: setsid cttyhack sh //config: -//config: Giving controlling tty to shell running with PID 1: +//config: Giving controlling tty to shell running with PID 1: //config: -//config: # exec cttyhack sh +//config: # exec cttyhack sh //config: -//config: Without cttyhack, you need to know exact tty name, -//config: and do something like this: +//config: Without cttyhack, you need to know exact tty name, +//config: and do something like this: //config: -//config: # exec setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1' +//config: # exec setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1' //config: -//config: Starting getty on a controlling tty from a shell script: +//config: Starting getty on a controlling tty from a shell script: //config: -//config: # getty 115200 $(cttyhack) +//config: # getty 115200 $(cttyhack) //usage:#define cttyhack_trivial_usage //usage: "[PROG ARGS]" diff --git a/shell/hush.c b/shell/hush.c index 4f1f81f..170d5f3 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -104,15 +104,15 @@ //config: bool "hush (64 kb)" //config: default y //config: help -//config: hush is a small shell. It handles the normal flow control -//config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops, -//config: case/esac. Redirections, here documents, $((arithmetic)) -//config: and functions are supported. +//config: hush is a small shell. It handles the normal flow control +//config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops, +//config: case/esac. Redirections, here documents, $((arithmetic)) +//config: and functions are supported. //config: -//config: It will compile and work on no-mmu systems. +//config: It will compile and work on no-mmu systems. //config: -//config: It does not handle select, aliases, tilde expansion, -//config: &>file and >&file redirection of stdout+stderr. +//config: It does not handle select, aliases, tilde expansion, +//config: &>file and >&file redirection of stdout+stderr. //config: //config:config HUSH_BASH_COMPAT //config: bool "bash-compatible extensions" @@ -124,17 +124,17 @@ //config: default y //config: depends on HUSH_BASH_COMPAT //config: help -//config: Enable {abc,def} extension. +//config: Enable {abc,def} extension. //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 -//config: from stdin just like a shell script from a file. -//config: No prompt, no PS1/PS2 magic shell variables. +//config: Enable interactive mode (prompt and command editing). +//config: Without this, hush simply reads and executes commands +//config: from stdin just like a shell script from a file. +//config: No prompt, no PS1/PS2 magic shell variables. //config: //config:config HUSH_SAVEHISTORY //config: bool "Save command history to .hush_history" @@ -146,18 +146,18 @@ //config: default y //config: depends on HUSH_INTERACTIVE //config: help -//config: Enable job control: Ctrl-Z backgrounds, Ctrl-C interrupts current -//config: command (not entire shell), fg/bg builtins work. Without this option, -//config: "cmd &" still works by simply spawning a process and immediately -//config: prompting for next command (or executing next command in a script), -//config: but no separate process group is formed. +//config: Enable job control: Ctrl-Z backgrounds, Ctrl-C interrupts current +//config: command (not entire shell), fg/bg builtins work. Without this option, +//config: "cmd &" still works by simply spawning a process and immediately +//config: prompting for next command (or executing next command in a script), +//config: but no separate process group is formed. //config: //config:config HUSH_TICK //config: bool "Support process substitution" //config: default y //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH //config: help -//config: Enable `command` and $(command). +//config: Enable `command` and $(command). //config: //config:config HUSH_IF //config: bool "Support if/then/elif/else/fi" @@ -174,37 +174,37 @@ //config: default y //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH //config: help -//config: Enable case ... esac statement. +400 bytes. +//config: Enable case ... esac statement. +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. +800 bytes. +//config: Enable support for shell functions. +800 bytes. //config: //config:config HUSH_LOCAL //config: bool "local builtin" //config: default y //config: depends on HUSH_FUNCTIONS //config: help -//config: Enable support for local variables in functions. +//config: Enable support for local variables in functions. //config: //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. +//config: Enable pseudorandom generator and dynamic variable "$RANDOM". +//config: Each read of "$RANDOM" will generate a new pseudorandom value. //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: This instructs hush to print commands before execution. +//config: Adds ~300 bytes. //config: //config:config HUSH_ECHO //config: bool "echo builtin" @@ -236,14 +236,14 @@ //config: default y //config: depends on HUSH_EXPORT //config: help -//config: export -n unexports variables. It is a bash extension. +//config: export -n unexports variables. It is a bash extension. //config: //config:config HUSH_READONLY //config: bool "readonly builtin" //config: default y //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH //config: help -//config: Enable support for read-only variables. +//config: Enable support for read-only variables. //config: //config:config HUSH_KILL //config: bool "kill builtin (supports kill %jobspec)" |