Commit Graph

500 Commits

Author SHA1 Message Date
Denys Vlasenko
c34c033c42 ash,hush: share string
function                                             old     new   delta
optschanged                                          133     139      +6
hush_main                                            997     982     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 6/-15)              Total: -9 bytes
   text   data    bss    dec    hexfilename
 823160    445   7668 831273  caf29busybox_old
 823102    445   7668 831215  caeefbusybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-29 12:25:30 +02:00
Denys Vlasenko
e74aaf9385 ash,hush: make trap output short signal names, without SIG prefix
function                                             old     new   delta
evalvar                                             1373    1371      -2
builtin_trap                                         457     441     -16
trapcmd                                              260     236     -24

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-27 02:05:45 +02:00
Denys Vlasenko
67f7186403 hush: do not reset to default "" traps in subshell
function                                             old     new   delta
reset_traps_to_defaults                              164     211     +47
builtin_umask                                        123     121      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-25 14:21:06 +02:00
Denys Vlasenko
4ea0ca8193 hush: document a TODO. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-25 12:58:37 +02:00
Denys Vlasenko
7188540257 hush: small speed optimization. +10 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-24 01:44:13 +02:00
Denys Vlasenko
2f7894b1bb ash,hush: fix trap reporting: s/SIGEXIT/EXIT/
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-24 01:43:21 +02:00
Denys Vlasenko
606291beab *: more portability fixes by Dan Fandrich
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23 23:15:43 +02:00
Denys Vlasenko
91836baf85 hush: fix trap
function                                             old     new   delta
expand_variables                                    2217    2280     +63
static.argv                                            -       8      +8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23 01:46:19 +02:00
Denys Vlasenko
69b1cef921 hush: better wording in comments. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-21 10:21:44 +02:00
Denys Vlasenko
27726cb6aa hush: make memleak debugging more robust
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-12 14:48:33 +02:00
Denys Vlasenko
873273da94 hush: code shrink by Dan Fandrich (dan AT coneharvesters.com)
function                                             old     new   delta
find_function_slot                                     -      47     +47
run_list                                            2508    2491     -17
find_function                                         40       8     -32
builtin_unset                                        227     165     -62

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-12 14:47:41 +02:00
Denys Vlasenko
90a9904e9e remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)
function                                             old     new   delta
logdirs_reopen                                      1310    1308      -2
read_line_input                                     4757    4753      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6)               Total: -6 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 02:36:23 +02:00
Denys Vlasenko
6db4784d27 hush: export PWD
function                                             old     new   delta
set_pwd_var                                            -      36     +36
hush_main                                            941     951     +10
evalvar                                             1365    1363      -2
ash_main                                            1364    1362      -2
builtin_cd                                            75      72      -3
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/3 up/down: 46/-7)              Total: 39 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-05 20:15:17 +02:00
Denys Vlasenko
1cc4b13917 msh: aliased to hush
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-21 00:05:51 +02:00
Denys Vlasenko
0793491ff8 hush: enable "lash is deprecated, please use hush instead" message
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-20 03:40:04 +02:00
Denys Vlasenko
a67a9627d0 hush: do not process options after non-option args
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-20 03:38:58 +02:00
Denys Vlasenko
cbfe6ad4c6 hush: fix \<newline> handling on NOMMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-12 19:47:44 +02:00
Denys Vlasenko
19679784c0 hush tests: remove the requirement that .config is in ../..
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-12 14:53:44 +02:00
Denys Vlasenko
9038d6f8f5 remove trailing whitespace
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-15 20:02:19 +02:00
Denys Vlasenko
82a6fb3ea6 ash: fix . builtin
Also, move [[ ]] comment to test.c and expand it

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-14 19:42:12 +02:00
Denys Vlasenko
77539190ab added comments about [[ ]] to ash and hush. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-10 14:09:48 +02:00
Denys Vlasenko
9ca656b149 hush: add HUSH_BASH_COMPAT, make [[ special handling depend on it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-10 13:39:35 +02:00
Denys Vlasenko
9d617c44d2 hush: specially handle [[ - suppress globbing & multiword expansion
It's a bashism, but is surprisingly easy to do and costs very little code.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-09 18:40:52 +02:00
Denys Vlasenko
764b2f0ec0 hush: drop REDIRECT_INVALID; other minor tweaks
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-07 16:05:04 +02:00
Denys Vlasenko
df5131cf3d hush: fix a segfault in export builtin
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-07 16:04:17 +02:00
Denys Vlasenko
d6b05eb9c2 hush: make builtins work in pipes (eval ... | ...) on NOMMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-06 20:59:55 +02:00
Denys Vlasenko
d5f1b1bbe0 *: add FAST_FUNC to function ptrs where it makes sense
function                                             old     new   delta
evalcommand                                         1195    1209     +14
testcmd                                                -      10     +10
printfcmd                                              -      10     +10
echocmd                                                -      10     +10
func_exec                                            270     276      +6
echo_dg                                              104     109      +5
store_nlmsg                                           85      89      +4
pseudo_exec_argv                                     195     198      +3
dotcmd                                               287     290      +3
machtime_stream                                       29      31      +2
discard_stream                                        24      26      +2
argstr                                              1299    1301      +2
killcmd                                              108     109      +1
evalfor                                              226     227      +1
daytime_stream                                        43      44      +1
run_list                                            2544    2543      -1
lookupvar                                             62      61      -1
ipaddr_modify                                       1310    1309      -1
...
parse_stream                                        2254    2245      -9
evalpipe                                             356     347      -9
collect_if                                           210     197     -13
read_opt                                             869     851     -18
handle_dollar                                        681     658     -23
print_addrinfo                                      1342    1303     -39
iterate_on_dir                                       156      59     -97
print_route                                         1709    1609    -100
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 12/130 up/down: 74/-767)       Total: -693 bytes
   text    data     bss     dec     hex filename
 841748     467    7872  850087   cf8a7 busybox_old
 841061     467    7872  849400   cf5f8 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 12:06:05 +02:00
Denys Vlasenko
0821801349 hush: document a TODO in export builtin
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-03 14:43:56 +02:00
Denys Vlasenko
6f22624a91 hush: fix a case when backgrounded cmd makes shell hang
Signed-off-by: Bayram Kurumahmut <kbayram@ubicom.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-03 14:37:30 +02:00
Denys Vlasenko
295fef80bc hush: add support for local builtin
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-03 12:47:26 +02:00
Mike Frysinger
6a46ab8b8f hush: unify syntax_error_unterm_{ch,str} a bit
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Mike Frysinger
ef3e7fdd3b hush: push down expansion var in handle_dollar()
Declare the variable in the scope it is used rather than the entire
function scope so it's obvious it is only used there.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Mike Frysinger
dc3bc40578 hush: add support for special vars in braces
Some people like to use ${?} rather than $?, so make sure we support all
the special single char vars that use this form.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Denys Vlasenko
28a105d867 nc, hush: cosmetic cleanups, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-01 11:26:30 +02:00
Denys Vlasenko
4b7db4f2ca read_key: drop optimization where we read 3 bytes at once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-29 10:39:06 +02:00
Denys Vlasenko
171932d7ca hust: trivial simplification in builtin_type
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 17:07:22 +02:00
Denys Vlasenko
e640cb4ad1 hush: fix bug 353 (wrong handling of \x in assignments)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 16:49:11 +02:00
Denys Vlasenko
5d7cca2090 hush: optimize type builtin a bit more
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 09:58:43 +02:00
Denys Vlasenko
dd6b211921 hush: optimize type builtin a bit
function                                             old     new   delta
builtin_type                                         130     125      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 09:45:50 +02:00
Mike Frysinger
93cadc2fdd hush: implement type
Implement support for the POSIX `type` command.  Only POSIX stuff is
supported here, no bash extensions like -p or -P.

In the process, split the $PATH searching code out of builtin_source() and
into its own find_in_path() function so we don't duplicate it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-27 17:06:25 -04:00
Denys Vlasenko
673e945052 hush: remove outdated TODO and superfluous macro; fix compile breakage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-27 14:39:35 +02:00
Denys Vlasenko
68759edb6e hush: tweak comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-26 14:39:41 +02:00
Denys Vlasenko
e2df5f46d0 hush: rename last_waitpid_was_0 to we_have_children
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-26 14:34:10 +02:00
Denys Vlasenko
8d7be232a3 hush: fix SIGCHLD counting code, but keep it disabled for now.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-25 16:38:32 +02:00
Denys Vlasenko
e9bda90e54 hush: fix problems with case in subshells and with "case esac"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-23 16:50:07 +02:00
Mike Frysinger
38478a600f hush: fix build failure when jobs are disabled
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reported-by: Thomas Chou <thomas@wytron.com.tw>
2009-05-20 04:48:06 -04:00
root
6245202e7f hush: small fix for unset -f on NOMMU.
Signed-off-by: root <root@localhost.localdomain>
2009-05-04 12:00:19 +02:00
Denys Vlasenko
acdc49c073 hush: add more complex case to leak testcase, fix found breakage
function                                             old     new   delta
unset_local_var_len                                    -     167    +167
run_list                                            2350    2457    +107
set_vars_and_save_old                                  -      87     +87
free_pipe                                            207     227     +20
builtin_unset                                        220     229      +9
builtin_exit                                          49      47      -2
free_strings_and_unset                                53       -     -53
set_vars_all_and_save_old                             87       -     -87
unset_local_var                                      168       -    -168
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 3/1 up/down: 390/-310)           Total: 80 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-04 01:58:10 +02:00
Denys Vlasenko
cb6ff25afe hush: fix bug where in "var=val func" var's value is not visible in func
function                                             old     new   delta
unset_local_var                                        -     168    +168
set_vars_all_and_save_old                              -      87     +87
get_ptr_to_local_var                                   -      77     +77
free_strings_and_unset                                 -      53     +53
builtin_export                                       266     274      +8
get_local_var_value                                   31      33      +2
putenv_all                                            27       -     -27
free_strings_and_unsetenv                             53       -     -53
get_local_var                                         68       -     -68
run_list                                            2475    2350    -125
builtin_unset                                        380     220    -160
------------------------------------------------------------------------------
(add/remove: 4/3 grow/shrink: 2/2 up/down: 395/-433)          Total: -38 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-04 00:14:30 +02:00
Denys Vlasenko
e19e1935a3 hush: fix \<newline> handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-03 02:15:18 +02:00