diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-07-16 14:31:34 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-07-16 14:31:34 +0200 |
| commit | 771f1995a99e63600a513f97ce35cbb9f6865138 (patch) | |
| tree | bcf36201ace3b73e8158fe3f248539bd155718dc /shell | |
| parent | 29082231d0cb1a5b327de5d515b16f332d4dbdaf (diff) | |
| download | busybox-w32-771f1995a99e63600a513f97ce35cbb9f6865138.tar.gz busybox-w32-771f1995a99e63600a513f97ce35cbb9f6865138.tar.bz2 busybox-w32-771f1995a99e63600a513f97ce35cbb9f6865138.zip | |
ash: move config stuff into ash.c, no code chages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/Config.src | 114 | ||||
| -rw-r--r-- | shell/Kbuild.src | 3 | ||||
| -rw-r--r-- | shell/ash.c | 117 | ||||
| -rw-r--r-- | shell/hush.c | 2 |
4 files changed, 126 insertions, 110 deletions
diff --git a/shell/Config.src b/shell/Config.src index f415a5fa6..6389d943a 100644 --- a/shell/Config.src +++ b/shell/Config.src | |||
| @@ -7,109 +7,6 @@ menu "Shells" | |||
| 7 | 7 | ||
| 8 | INSERT | 8 | INSERT |
| 9 | 9 | ||
| 10 | config ASH | ||
| 11 | bool "ash" | ||
| 12 | default y | ||
| 13 | depends on !NOMMU | ||
| 14 | help | ||
| 15 | Tha 'ash' shell adds about 60k in the default configuration and is | ||
| 16 | the most complete and most pedantically correct shell included with | ||
| 17 | busybox. This shell is actually a derivative of the Debian 'dash' | ||
| 18 | shell (by Herbert Xu), which was created by porting the 'ash' shell | ||
| 19 | (written by Kenneth Almquist) from NetBSD. | ||
| 20 | |||
| 21 | config ASH_BASH_COMPAT | ||
| 22 | bool "bash-compatible extensions" | ||
| 23 | default y | ||
| 24 | depends on ASH | ||
| 25 | help | ||
| 26 | Enable bash-compatible extensions. | ||
| 27 | |||
| 28 | config ASH_JOB_CONTROL | ||
| 29 | bool "Job control" | ||
| 30 | default y | ||
| 31 | depends on ASH | ||
| 32 | help | ||
| 33 | Enable job control in the ash shell. | ||
| 34 | |||
| 35 | config ASH_ALIAS | ||
| 36 | bool "alias support" | ||
| 37 | default y | ||
| 38 | depends on ASH | ||
| 39 | help | ||
| 40 | Enable alias support in the ash shell. | ||
| 41 | |||
| 42 | config ASH_GETOPTS | ||
| 43 | bool "Builtin getopt to parse positional parameters" | ||
| 44 | default y | ||
| 45 | depends on ASH | ||
| 46 | help | ||
| 47 | Enable getopts builtin in the ash shell. | ||
| 48 | |||
| 49 | config ASH_BUILTIN_ECHO | ||
| 50 | bool "Builtin version of 'echo'" | ||
| 51 | default y | ||
| 52 | depends on ASH | ||
| 53 | help | ||
| 54 | Enable support for echo, builtin to ash. | ||
| 55 | |||
| 56 | config ASH_BUILTIN_PRINTF | ||
| 57 | bool "Builtin version of 'printf'" | ||
| 58 | default y | ||
| 59 | depends on ASH | ||
| 60 | help | ||
| 61 | Enable support for printf, builtin to ash. | ||
| 62 | |||
| 63 | config ASH_BUILTIN_TEST | ||
| 64 | bool "Builtin version of 'test'" | ||
| 65 | default y | ||
| 66 | depends on ASH | ||
| 67 | help | ||
| 68 | Enable support for test, builtin to ash. | ||
| 69 | |||
| 70 | config ASH_CMDCMD | ||
| 71 | bool "'command' command to override shell builtins" | ||
| 72 | default y | ||
| 73 | depends on ASH | ||
| 74 | help | ||
| 75 | Enable support for the ash 'command' builtin, which allows | ||
| 76 | you to run the specified command with the specified arguments, | ||
| 77 | even when there is an ash builtin command with the same name. | ||
| 78 | |||
| 79 | config ASH_MAIL | ||
| 80 | bool "Check for new mail on interactive shells" | ||
| 81 | default n | ||
| 82 | depends on ASH | ||
| 83 | help | ||
| 84 | Enable "check for new mail" in the ash shell. | ||
| 85 | |||
| 86 | config ASH_OPTIMIZE_FOR_SIZE | ||
| 87 | bool "Optimize for size instead of speed" | ||
| 88 | default y | ||
| 89 | depends on ASH | ||
| 90 | help | ||
| 91 | Compile ash for reduced size at the price of speed. | ||
| 92 | |||
| 93 | config ASH_RANDOM_SUPPORT | ||
| 94 | bool "Pseudorandom generator and $RANDOM variable" | ||
| 95 | default y | ||
| 96 | depends on ASH | ||
| 97 | help | ||
| 98 | Enable pseudorandom generator and dynamic variable "$RANDOM". | ||
| 99 | Each read of "$RANDOM" will generate a new pseudorandom value. | ||
| 100 | You can reset the generator by using a specified start value. | ||
| 101 | After "unset RANDOM" the generator will switch off and this | ||
| 102 | variable will no longer have special treatment. | ||
| 103 | |||
| 104 | config ASH_EXPAND_PRMT | ||
| 105 | bool "Expand prompt string" | ||
| 106 | default y | ||
| 107 | depends on ASH | ||
| 108 | help | ||
| 109 | "PS#" may contain volatile content, such as backquote commands. | ||
| 110 | This option recreates the prompt string from the environment | ||
| 111 | variable each time it is displayed. | ||
| 112 | |||
| 113 | 10 | ||
| 114 | choice | 11 | choice |
| 115 | prompt "Choose which shell is aliased to 'sh' name" | 12 | prompt "Choose which shell is aliased to 'sh' name" |
| @@ -284,12 +181,17 @@ config CTTYHACK | |||
| 284 | 181 | ||
| 285 | ::respawn:/bin/cttyhack /bin/sh | 182 | ::respawn:/bin/cttyhack /bin/sh |
| 286 | 183 | ||
| 184 | Starting an interactive shell from boot shell script: | ||
| 185 | |||
| 186 | setsid cttyhack sh | ||
| 187 | |||
| 287 | Giving controlling tty to shell running with PID 1: | 188 | Giving controlling tty to shell running with PID 1: |
| 288 | 189 | ||
| 289 | $ exec cttyhack sh | 190 | # exec cttyhack sh |
| 290 | 191 | ||
| 291 | Starting an interactive shell from boot shell script: | 192 | Without cttyhack, you need to know exact tty name, |
| 193 | and do something like this: | ||
| 292 | 194 | ||
| 293 | setsid cttyhack sh | 195 | # exec setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1' |
| 294 | 196 | ||
| 295 | endmenu | 197 | endmenu |
diff --git a/shell/Kbuild.src b/shell/Kbuild.src index c7eb5b61a..bce99240f 100644 --- a/shell/Kbuild.src +++ b/shell/Kbuild.src | |||
| @@ -8,8 +8,5 @@ lib-y:= | |||
| 8 | 8 | ||
| 9 | INSERT | 9 | INSERT |
| 10 | 10 | ||
| 11 | lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o | ||
| 12 | lib-$(CONFIG_CTTYHACK) += cttyhack.o | 11 | lib-$(CONFIG_CTTYHACK) += cttyhack.o |
| 13 | |||
| 14 | lib-$(CONFIG_SH_MATH_SUPPORT) += math.o | 12 | lib-$(CONFIG_SH_MATH_SUPPORT) += math.o |
| 15 | lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o | ||
diff --git a/shell/ash.c b/shell/ash.c index 0337a5535..9b33e78ec 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -70,6 +70,123 @@ | |||
| 70 | # error "Do not even bother, ash will not run on NOMMU machine" | 70 | # error "Do not even bother, ash will not run on NOMMU machine" |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | //applet:IF_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_DROP)) | ||
| 74 | //applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_DROP, sh)) | ||
| 75 | //applet:IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, _BB_DIR_BIN, _BB_SUID_DROP, bash)) | ||
| 76 | |||
| 77 | //kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o | ||
| 78 | //kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o | ||
| 79 | |||
| 80 | //config:config ASH | ||
| 81 | //config: bool "ash" | ||
| 82 | //config: default y | ||
| 83 | //config: depends on !NOMMU | ||
| 84 | //config: help | ||
| 85 | //config: Tha 'ash' shell adds about 60k in the default configuration and is | ||
| 86 | //config: the most complete and most pedantically correct shell included with | ||
| 87 | //config: busybox. This shell is actually a derivative of the Debian 'dash' | ||
| 88 | //config: shell (by Herbert Xu), which was created by porting the 'ash' shell | ||
| 89 | //config: (written by Kenneth Almquist) from NetBSD. | ||
| 90 | //config: | ||
| 91 | //config:config ASH_BASH_COMPAT | ||
| 92 | //config: bool "bash-compatible extensions" | ||
| 93 | //config: default y | ||
| 94 | //config: depends on ASH | ||
| 95 | //config: help | ||
| 96 | //config: Enable bash-compatible extensions. | ||
| 97 | //config: | ||
| 98 | //config:config ASH_JOB_CONTROL | ||
| 99 | //config: bool "Job control" | ||
| 100 | //config: default y | ||
| 101 | //config: depends on ASH | ||
| 102 | //config: help | ||
| 103 | //config: Enable job control in the ash shell. | ||
| 104 | //config: | ||
| 105 | //config:config ASH_ALIAS | ||
| 106 | //config: bool "alias support" | ||
| 107 | //config: default y | ||
| 108 | //config: depends on ASH | ||
| 109 | //config: help | ||
| 110 | //config: Enable alias support in the ash shell. | ||
| 111 | //config: | ||
| 112 | //config:config ASH_GETOPTS | ||
| 113 | //config: bool "Builtin getopt to parse positional parameters" | ||
| 114 | //config: default y | ||
| 115 | //config: depends on ASH | ||
| 116 | //config: help | ||
| 117 | //config: Enable getopts builtin in the ash shell. | ||
| 118 | //config: | ||
| 119 | //config:config ASH_BUILTIN_ECHO | ||
| 120 | //config: bool "Builtin version of 'echo'" | ||
| 121 | //config: default y | ||
| 122 | //config: depends on ASH | ||
| 123 | //config: help | ||
| 124 | //config: Enable support for echo, builtin to ash. | ||
| 125 | //config: | ||
| 126 | //config:config ASH_BUILTIN_PRINTF | ||
| 127 | //config: bool "Builtin version of 'printf'" | ||
| 128 | //config: default y | ||
| 129 | //config: depends on ASH | ||
| 130 | //config: help | ||
| 131 | //config: Enable support for printf, builtin to ash. | ||
| 132 | //config: | ||
| 133 | //config:config ASH_BUILTIN_TEST | ||
| 134 | //config: bool "Builtin version of 'test'" | ||
| 135 | //config: default y | ||
| 136 | //config: depends on ASH | ||
| 137 | //config: help | ||
| 138 | //config: Enable support for test, builtin to ash. | ||
| 139 | //config: | ||
| 140 | //config:config ASH_CMDCMD | ||
| 141 | //config: bool "'command' command to override shell builtins" | ||
| 142 | //config: default y | ||
| 143 | //config: depends on ASH | ||
| 144 | //config: help | ||
| 145 | //config: Enable support for the ash 'command' builtin, which allows | ||
| 146 | //config: you to run the specified command with the specified arguments, | ||
| 147 | //config: even when there is an ash builtin command with the same name. | ||
| 148 | //config: | ||
| 149 | //config:config ASH_MAIL | ||
| 150 | //config: bool "Check for new mail on interactive shells" | ||
| 151 | //config: default n | ||
| 152 | //config: depends on ASH | ||
| 153 | //config: help | ||
| 154 | //config: Enable "check for new mail" in the ash shell. | ||
| 155 | //config: | ||
| 156 | //config:config ASH_OPTIMIZE_FOR_SIZE | ||
| 157 | //config: bool "Optimize for size instead of speed" | ||
| 158 | //config: default y | ||
| 159 | //config: depends on ASH | ||
| 160 | //config: help | ||
| 161 | //config: Compile ash for reduced size at the price of speed. | ||
| 162 | //config: | ||
| 163 | //config:config ASH_RANDOM_SUPPORT | ||
| 164 | //config: bool "Pseudorandom generator and $RANDOM variable" | ||
| 165 | //config: default y | ||
| 166 | //config: depends on ASH | ||
| 167 | //config: help | ||
| 168 | //config: Enable pseudorandom generator and dynamic variable "$RANDOM". | ||
| 169 | //config: Each read of "$RANDOM" will generate a new pseudorandom value. | ||
| 170 | //config: You can reset the generator by using a specified start value. | ||
| 171 | //config: After "unset RANDOM" the generator will switch off and this | ||
| 172 | //config: variable will no longer have special treatment. | ||
| 173 | //config: | ||
| 174 | //config:config ASH_EXPAND_PRMT | ||
| 175 | //config: bool "Expand prompt string" | ||
| 176 | //config: default y | ||
| 177 | //config: depends on ASH | ||
| 178 | //config: help | ||
| 179 | //config: "PS#" may contain volatile content, such as backquote commands. | ||
| 180 | //config: This option recreates the prompt string from the environment | ||
| 181 | //config: variable each time it is displayed. | ||
| 182 | |||
| 183 | //usage:#define ash_trivial_usage NOUSAGE_STR | ||
| 184 | //usage:#define ash_full_usage "" | ||
| 185 | //usage:#define sh_trivial_usage NOUSAGE_STR | ||
| 186 | //usage:#define sh_full_usage "" | ||
| 187 | //usage:#define bash_trivial_usage NOUSAGE_STR | ||
| 188 | //usage:#define bash_full_usage "" | ||
| 189 | |||
| 73 | 190 | ||
| 74 | /* ============ Hash table sizes. Configurable. */ | 191 | /* ============ Hash table sizes. Configurable. */ |
| 75 | 192 | ||
diff --git a/shell/hush.c b/shell/hush.c index c5a8ea617..56a3f4b14 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
| @@ -114,7 +114,7 @@ | |||
| 114 | //config: bool "hush" | 114 | //config: bool "hush" |
| 115 | //config: default y | 115 | //config: default y |
| 116 | //config: help | 116 | //config: help |
| 117 | //config: hush is a small shell (22k). It handles the normal flow control | 117 | //config: hush is a small shell (25k). It handles the normal flow control |
| 118 | //config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops, | 118 | //config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops, |
| 119 | //config: case/esac. Redirections, here documents, $((arithmetic)) | 119 | //config: case/esac. Redirections, here documents, $((arithmetic)) |
| 120 | //config: and functions are supported. | 120 | //config: and functions are supported. |
