aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* hush: support %%, %+ and % jobspec (meaning "current job")Denys Vlasenko2017-01-081-9/+21
| | | | | | | | function old new delta parse_jobspec 83 133 +50 builtin_wait 278 283 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: correct exitcode for unterminated ')' - exitcode2.tests testcaseDenys Vlasenko2017-01-031-2/+7
| | | | | | | function old new delta parse_stream 2595 2609 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Make it possible to select "sh" and "bash" aliases without selecting ash or hushDenys Vlasenko2016-12-231-35/+24
| | | | | | | The same can be done for msh, but we are probably better off just deleting it in a next versio or two. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: move "config" blocks above their use in coditional includesDenys Vlasenko2016-12-221-29/+29
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: suppress "unused var/func" warnings on some configsDenys Vlasenko2016-12-121-4/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash,hush: make ^C in interactive mode visually much closer to bash behaviorDenys Vlasenko2016-11-251-6/+11
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash,hush: ^C from command line should set $? to 128+SIGINTDenys Vlasenko2016-11-241-5/+21
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make getch/peek functions directly calledDenys Vlasenko2016-11-081-27/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Indirect calls are more difficult to predict. Unfortunately, on x64 direct call is 5 bytes while indirect "call (reg+ofs)" is 3 bytes: function old new delta i_getch - 82 +82 i_peek - 63 +63 parse_stream 2531 2579 +48 parse_dollar 771 797 +26 parse_redirect 296 321 +25 add_till_closing_bracket 408 420 +12 encode_string 256 265 +9 i_peek_and_eat_bkslash_nl 93 99 +6 add_till_backquote 110 114 +4 parse_and_run_stream 139 141 +2 expand_vars_to_list 1143 1144 +1 static_peek 6 - -6 setup_string_in_str 39 18 -21 setup_file_in_str 40 19 -21 static_get 27 - -27 file_peek 52 - -52 file_get 65 - -65 ------------------------------------------------------------------------------ (add/remove: 2/4 grow/shrink: 9/2 up/down: 278/-192) Total: 86 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: renumber PIPE_foo, make PIPE_SEQ = 0Denys Vlasenko2016-11-081-5/+4
| | | | | | | | | | PIPE_SEQ is used most often, having it zero makes code smaller: function old new delta done_word 719 707 -12 parse_stream 2546 2531 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: small optimization in run_listDenys Vlasenko2016-11-081-7/+8
| | | | | | | | | I thought gcc can detect this itself. It doesn't. function old new delta run_list 1030 1021 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: deindent large block of code, no code changesDenys Vlasenko2016-11-081-58/+57
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: simplify insert_bg_jobsDenys Vlasenko2016-11-081-10/+8
| | | | | | | function old new delta insert_bg_job 366 281 -85 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: make "wait %1" less likely to play with signal maskDenys Vlasenko2016-11-081-8/+7
| | | | | | | | | | | Was playing with "sleep 3 | exit 3 & wait %1" and noticed that often SIGCHLD arrives even before I get to signal masking. Can avoid it in this case. function old new delta wait_for_child_or_signal 228 265 +37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: rework "wait %jobspec" to work in non-interactive shells tooDenys Vlasenko2016-11-081-13/+8
| | | | | | | | | Also add tests. wait5.tests so far fails (but works for ash and dash). function old new delta builtin_wait 305 283 -22 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>