aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* hush: forgot to emit error on (failing) second "readonly VAR=VAL"Denys Vlasenko2017-07-171-3/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: smaller code in !READONLY configsDenys Vlasenko2017-07-171-4/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: implement "readonly" builtinDenys Vlasenko2017-07-171-36/+63
| | | | | | | | | | | | | | | | | | | | function old new delta builtin_readonly - 70 +70 helper_export_local 152 174 +22 bltins1 348 360 +12 expand_one_var 1620 1625 +5 builtin_export 168 173 +5 set_pwd_var 36 40 +4 set_local_var 410 414 +4 set_vars_and_save_old 85 88 +3 set_local_var_from_halves 24 27 +3 run_pipe 1551 1554 +3 run_list 1046 1048 +2 builtin_type 116 114 -2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 10/1 up/down: 133/-2) Total: 131 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: small fix to last commitDenys Vlasenko2017-07-171-1/+1
| | | | | | die_if_script() indeed dies only in scripts! Must handle the case where it continues. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: support ${VAR:N:-M}Denys Vlasenko2017-07-171-23/+25
| | | | | | | | function old new delta expand_one_var 1602 1615 +13 builtin_type 114 116 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shells: expand TODO comments, no code changesDenys Vlasenko2017-07-171-5/+26
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix "cmd1 && cmd2 &" handling on NOMMUDenys Vlasenko2017-07-161-9/+13
| | | | | | | function old new delta done_pipe 234 238 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix and_or_and_backgrounding.tests failureDenys Vlasenko2017-07-151-1/+36
| | | | | | | function old new delta done_pipe 133 218 +85 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make "wait %1" work even if the job is deadDenys Vlasenko2017-07-141-39/+52
| | | | | | | | | | | | | | | | | | | | | | Example script: sleep 1 | (sleep 1;exit 3) & sleep 2 echo Zero:$? wait %1 echo Three:$? function old new delta clean_up_last_dead_job - 24 +24 process_wait_result 426 447 +21 builtin_wait 285 293 +8 insert_job_into_table 264 269 +5 builtin_jobs 68 73 +5 remove_job_from_table 59 57 -2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/1 up/down: 63/-2) Total: 61 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: remove superfluous comparisonDenys Vlasenko2017-07-141-1/+1
| | | | | | | function old new delta builtin_wait 291 285 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add support for "set -e"Denys Vlasenko2017-07-141-21/+45
| | | | | | | | | | | | | | function old new delta run_list 978 1046 +68 o_opt_strings 24 32 +8 reset_traps_to_defaults 136 142 +6 pick_sighandler 57 60 +3 packed_usage 31772 31770 -2 hush_main 983 961 -22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/2 up/down: 85/-24) Total: 61 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add TODO for "set -e"Denys Vlasenko2017-07-101-0/+17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: simplify insert_job_into_table() a bitDenys Vlasenko2017-07-101-15/+12
| | | | | | | | | | function old new delta done_word 767 761 -6 insert_job_into_table 325 264 -61 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 59/-126) Total: -67 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: rename a few functionsDenys Vlasenko2017-07-101-10/+10
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: explain why wait5.tests is failingDenys Vlasenko2017-07-081-0/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix "(sleep 1; exit 3) & sleep 2; echo $?; wait $!; echo $?"Denys Vlasenko2017-07-071-5/+10
| | | | | | | | | | | function old new delta process_wait_result 414 426 +12 builtin_wait 283 291 +8 run_list 974 978 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 24/0) Total: 24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix two redirection testcase failuresDenys Vlasenko2017-07-071-64/+115
| | | | | | | | | | | | | | | | function old new delta save_fds_on_redirect 183 256 +73 fcntl_F_DUPFD - 46 +46 restore_redirects 74 96 +22 xdup_and_close 51 72 +21 setup_redirects 196 200 +4 hush_main 988 983 -5 static.C 12 - -12 run_pipe 1595 1551 -44 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 4/2 up/down: 166/-61) Total: 105 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* main: fix the case where user has "halt" as login shell. Closes 9986Denys Vlasenko2017-07-071-1/+1
| | | | | | | | | | halt::0:0::/:/sbin/halt function old new delta run_applet_and_exit 748 751 +3 run_applet_no_and_exit 467 459 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add a TODO about redir3.tests failureDenys Vlasenko2017-07-061-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: Print error messages on shift -1Denys Vlasenko2017-07-061-1/+12
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: implement negative start in the ${v: -n[:m]} idiomDenys Vlasenko2017-07-061-2/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: "adopt" ash signal4.testsDenys Vlasenko2017-07-061-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: correctly handle quoting in "case" even if !BASH_PATTERN_SUBSTDenys Vlasenko2017-07-061-2/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix quoted_punct.tests failureDenys Vlasenko2017-07-051-2/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fixes for bugs found by make_single_applets.shDenys Vlasenko2017-07-031-20/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* msh: delete this appletDenys Vlasenko2017-07-031-18/+0
| | | | | | It's deprecated since 2009 and interferes with make_single_applets.sh tests. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2017-07-031-3/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash,hush: fix SIGCHLD interrupting read builtinDenys Vlasenko2017-05-221-1/+4
| | | | | | | | | | | | function old new delta readcmd 169 217 +48 shell_builtin_read 1087 1097 +10 localcmd 366 364 -2 builtin_read 197 193 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 58/-6) Total: 52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Spelling fixes in comments, documentation, tests and examplesDenys Vlasenko2017-04-171-6/+6
| | | | | | By klemens <ka7@github.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: add comment about APPLET_ODDNAME formatDenys Vlasenko2017-01-291-2/+3
| | | | | | It confused me more than once Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: reinstate [[ builtinDenys Vlasenko2017-01-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Mike deleted it: commit 39456a18a104b228de240b265bd943251219849d Author: Mike Frysinger <vapier@gentoo.org> Date: Sat Mar 28 12:21:57 2009 +0000 stop lying about [[ test support probably because it was not properly ifdefed around, and was enabled even when bash compat is off. I just tested it - it works: $ [ *.diff = z.diff ]; echo $? 0 $ [[ *.diff = z.diff ]]; echo $? 1 Of course, not all numerous bash tricks of [[ ]] are implemented... function old new delta bltins2 60 72 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: split bash compatible extensions into separate defines. No code changesKang-Che Sung2017-01-111-29/+44
| | | | | | | | Splitting these options makes it self-documenting about what bash-compatible features we have. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: shorten output of "help" builtinDenys Vlasenko2017-01-101-9/+12
| | | | | | | | text data bss dec hex filename 891272 485 6856 898613 db635 busybox_old 891232 485 6856 898573 db60d busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: reorder builtins (cd and pwd ought to be close, etc), no code changesDenys Vlasenko2017-01-101-297/+295
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shells: make hush test optional, rename ASH_BUILTIN_foo -> ASH_fooDenys Vlasenko2017-01-101-1/+15
| | | | | | | This makes hash and ash more symmetrical wrt config menu and config options. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Big cleanup in config help and descriptionDenys Vlasenko2017-01-101-53/+15
| | | | | | | | | | | | | Redundant help texts (one which only repeats the description) are deleted. Descriptions and help texts are trimmed. Some config options are moved, even across menus. No config option _names_ are changed. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make echo builtin optionalDenys Vlasenko2017-01-091-9/+20
| | | | | | | | | | It's a bit overkill (who would want it off?) but ash already has it configurable. Let's be symmetric. Also tweak kbuild logic to use ASH_BUILTIN_ECHO to select echo.o, not ASH. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix a bug in argv restoration after sourcing a fileDenys Vlasenko2017-01-091-2/+4
| | | | | | if sourced file "shift"ed argvs so that $1 is NULL, restore wasn't done. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: global_args_malloced is used only if set builtin is enabledDenys Vlasenko2017-01-091-9/+14
| | | | | | | | | | | | | function old new delta run_pipe 1623 1635 +12 builtin_source 210 222 +12 save_and_replace_G_args 70 60 -10 builtin_shift 132 94 -38 restore_G_args 98 - -98 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/2 up/down: 24/-146) Total: -122 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix 'defined but not used' warningDenys Vlasenko2017-01-091-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: remove redundand test for ENABLE_HUSH_JOBDenys Vlasenko2017-01-091-3/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix kill builtin without jobs supportDenys Vlasenko2017-01-091-12/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* typo fixDenys Vlasenko2017-01-091-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: conditionalize print_escaped() on EXPORT || TRAPDenys Vlasenko2017-01-081-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make memleak builtin optionalDenys Vlasenko2017-01-081-4/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make export builtin optionalDenys Vlasenko2017-01-081-11/+26
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make umask builtin optionalDenys Vlasenko2017-01-081-0/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make set/unset builtins optionalDenys Vlasenko2017-01-081-5/+35
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make read and trap builtins optionalDenys Vlasenko2017-01-081-71/+118
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: kill builtin and kill %jobspec supportDenys Vlasenko2017-01-081-4/+130
| | | | | | | | | | | | | Also made it and printf, type and wait builtins optional. function old new delta builtin_kill - 323 +323 bltins1 336 348 +12 builtin_type 114 116 +2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 337/0) Total: 337 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>