mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 08:29:45 +00:00
ash: move config stuff into ash.c, no code chages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
29082231d0
commit
771f1995a9
@ -72,10 +72,8 @@ IF_ADJTIMEX(APPLET(adjtimex, _BB_DIR_SBIN, _BB_SUID_DROP))
|
|||||||
IF_AR(APPLET(ar, _BB_DIR_USR_BIN, _BB_SUID_DROP))
|
IF_AR(APPLET(ar, _BB_DIR_USR_BIN, _BB_SUID_DROP))
|
||||||
IF_ARP(APPLET(arp, _BB_DIR_SBIN, _BB_SUID_DROP))
|
IF_ARP(APPLET(arp, _BB_DIR_SBIN, _BB_SUID_DROP))
|
||||||
IF_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_DROP))
|
IF_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_DROP))
|
||||||
IF_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_DROP))
|
|
||||||
IF_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_DROP, awk))
|
IF_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_DROP, awk))
|
||||||
IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_DROP, basename))
|
IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_DROP, basename))
|
||||||
IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, _BB_DIR_BIN, _BB_SUID_DROP, bash))
|
|
||||||
IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_DROP))
|
IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_DROP))
|
||||||
//IF_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_DROP))
|
//IF_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_DROP))
|
||||||
IF_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _BB_SUID_DROP))
|
IF_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _BB_SUID_DROP))
|
||||||
@ -344,7 +342,6 @@ IF_SETLOGCONS(APPLET(setlogcons, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
|
|||||||
IF_SETSEBOOL(APPLET(setsebool, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
|
IF_SETSEBOOL(APPLET(setsebool, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
|
||||||
IF_SETSID(APPLET(setsid, _BB_DIR_USR_BIN, _BB_SUID_DROP))
|
IF_SETSID(APPLET(setsid, _BB_DIR_USR_BIN, _BB_SUID_DROP))
|
||||||
IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_DROP, setuidgid))
|
IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_DROP, setuidgid))
|
||||||
IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_DROP, sh))
|
|
||||||
IF_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha1sum))
|
IF_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha1sum))
|
||||||
IF_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha256sum))
|
IF_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha256sum))
|
||||||
IF_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha512sum))
|
IF_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha512sum))
|
||||||
|
@ -115,13 +115,6 @@ INSERT
|
|||||||
"\n -s SRC_IP Sender IP address" \
|
"\n -s SRC_IP Sender IP address" \
|
||||||
"\n DST_IP Target IP address" \
|
"\n DST_IP Target IP address" \
|
||||||
|
|
||||||
#define sh_trivial_usage NOUSAGE_STR
|
|
||||||
#define sh_full_usage ""
|
|
||||||
#define ash_trivial_usage NOUSAGE_STR
|
|
||||||
#define ash_full_usage ""
|
|
||||||
#define bash_trivial_usage NOUSAGE_STR
|
|
||||||
#define bash_full_usage ""
|
|
||||||
|
|
||||||
#define awk_trivial_usage \
|
#define awk_trivial_usage \
|
||||||
"[OPTIONS] [AWK_PROGRAM] [FILE]..."
|
"[OPTIONS] [AWK_PROGRAM] [FILE]..."
|
||||||
#define awk_full_usage "\n\n" \
|
#define awk_full_usage "\n\n" \
|
||||||
|
116
shell/Config.src
116
shell/Config.src
@ -7,109 +7,6 @@ menu "Shells"
|
|||||||
|
|
||||||
INSERT
|
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.
|
|
||||||
|
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Choose which shell is aliased to 'sh' name"
|
prompt "Choose which shell is aliased to 'sh' name"
|
||||||
@ -284,12 +181,17 @@ config CTTYHACK
|
|||||||
|
|
||||||
::respawn:/bin/cttyhack /bin/sh
|
::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:
|
Starting an interactive shell from boot shell script:
|
||||||
|
|
||||||
setsid cttyhack sh
|
setsid cttyhack sh
|
||||||
|
|
||||||
|
Giving controlling tty to shell running with PID 1:
|
||||||
|
|
||||||
|
# exec cttyhack sh
|
||||||
|
|
||||||
|
Without cttyhack, you need to know exact tty name,
|
||||||
|
and do something like this:
|
||||||
|
|
||||||
|
# exec setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1'
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -8,8 +8,5 @@ lib-y:=
|
|||||||
|
|
||||||
INSERT
|
INSERT
|
||||||
|
|
||||||
lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
|
|
||||||
lib-$(CONFIG_CTTYHACK) += cttyhack.o
|
lib-$(CONFIG_CTTYHACK) += cttyhack.o
|
||||||
|
|
||||||
lib-$(CONFIG_SH_MATH_SUPPORT) += math.o
|
lib-$(CONFIG_SH_MATH_SUPPORT) += math.o
|
||||||
lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
|
|
||||||
|
117
shell/ash.c
117
shell/ash.c
@ -70,6 +70,123 @@
|
|||||||
# error "Do not even bother, ash will not run on NOMMU machine"
|
# error "Do not even bother, ash will not run on NOMMU machine"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//applet:IF_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_DROP))
|
||||||
|
//applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_DROP, sh))
|
||||||
|
//applet:IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, _BB_DIR_BIN, _BB_SUID_DROP, bash))
|
||||||
|
|
||||||
|
//kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
|
||||||
|
//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
|
||||||
|
|
||||||
|
//config:config ASH
|
||||||
|
//config: bool "ash"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on !NOMMU
|
||||||
|
//config: help
|
||||||
|
//config: Tha 'ash' shell adds about 60k in the default configuration and is
|
||||||
|
//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:config ASH_BASH_COMPAT
|
||||||
|
//config: bool "bash-compatible extensions"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: Enable bash-compatible extensions.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_JOB_CONTROL
|
||||||
|
//config: bool "Job control"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on 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
|
||||||
|
//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
|
||||||
|
//config: help
|
||||||
|
//config: Enable getopts builtin in the ash shell.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_BUILTIN_ECHO
|
||||||
|
//config: bool "Builtin version of 'echo'"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: Enable support for echo, builtin to ash.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_BUILTIN_PRINTF
|
||||||
|
//config: bool "Builtin version of 'printf'"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: Enable support for printf, builtin to ash.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_BUILTIN_TEST
|
||||||
|
//config: bool "Builtin version of 'test'"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: Enable support for test, builtin to ash.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_CMDCMD
|
||||||
|
//config: bool "'command' command to override shell builtins"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: Enable support for the ash 'command' builtin, which allows
|
||||||
|
//config: you to run the specified command with the specified arguments,
|
||||||
|
//config: even when there is an ash builtin command with the same name.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_MAIL
|
||||||
|
//config: bool "Check for new mail on interactive shells"
|
||||||
|
//config: default n
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: Enable "check for new mail" in the ash shell.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_OPTIMIZE_FOR_SIZE
|
||||||
|
//config: bool "Optimize for size instead of speed"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: Compile ash for reduced size at the price of speed.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_RANDOM_SUPPORT
|
||||||
|
//config: bool "Pseudorandom generator and $RANDOM variable"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on 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:
|
||||||
|
//config:config ASH_EXPAND_PRMT
|
||||||
|
//config: bool "Expand prompt string"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on 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.
|
||||||
|
|
||||||
|
//usage:#define ash_trivial_usage NOUSAGE_STR
|
||||||
|
//usage:#define ash_full_usage ""
|
||||||
|
//usage:#define sh_trivial_usage NOUSAGE_STR
|
||||||
|
//usage:#define sh_full_usage ""
|
||||||
|
//usage:#define bash_trivial_usage NOUSAGE_STR
|
||||||
|
//usage:#define bash_full_usage ""
|
||||||
|
|
||||||
|
|
||||||
/* ============ Hash table sizes. Configurable. */
|
/* ============ Hash table sizes. Configurable. */
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
//config: bool "hush"
|
//config: bool "hush"
|
||||||
//config: default y
|
//config: default y
|
||||||
//config: help
|
//config: help
|
||||||
//config: hush is a small shell (22k). It handles the normal flow control
|
//config: hush is a small shell (25k). It handles the normal flow control
|
||||||
//config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops,
|
//config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops,
|
||||||
//config: case/esac. Redirections, here documents, $((arithmetic))
|
//config: case/esac. Redirections, here documents, $((arithmetic))
|
||||||
//config: and functions are supported.
|
//config: and functions are supported.
|
||||||
|
Loading…
Reference in New Issue
Block a user