Commit Graph

566 Commits

Author SHA1 Message Date
Denys Vlasenko
599ae1eb9f shell: consolidate builtin_foo.? into shell_common.?; delete obsolete shells
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-23 17:49:50 +02:00
Denys Vlasenko
8391c4800c hush: trivial code shrink
function                                             old     new   delta
static_get                                            26      22      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 17:50:43 +02:00
Denys Vlasenko
2e48d536ce hush: reduce #ifdef forest a bit, rename handle_dollar -> parse_dollar
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 17:30:39 +02:00
Denys Vlasenko
5ae8f1cdbe hush: fix hush -c 'echo $0' - was showing empty string
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 06:32:11 +02:00
Denys Vlasenko
e85248afa2 hush: fix segfault in ${?:N:M}
function                                             old     new   delta
expand_vars_to_list                                 2374    2409     +35
builtin_umask                                        132     133      +1
builtin_exit                                          47      48      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 37/0)               Total: 37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 06:20:26 +02:00
Denys Vlasenko
8a33679694 hush: fix "hush -c 'echo $#'" showing -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 06:05:02 +02:00
Denys Vlasenko
1e811b1231 hush: support ${var:EXPR:EXPR}!
function                                             old     new   delta
handle_dollar                                        574     681    +107
expand_and_evaluate_arith                              -      77     +77
expand_vars_to_list                                 2302    2374     +72
add_till_closing_bracket                             359     368      +9
builtin_exit                                          48      47      -1
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 265/-1)            Total: 264 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 03:12:29 +02:00
Denys Vlasenko
ddc62f64ba hush: fix a nommu todo in recent commits
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 00:53:32 +02:00
Denys Vlasenko
a6ad397ea9 hush: fix more obscure ${var%...} cases
function                                             old     new   delta
add_till_closing_paren                               313     359     +46
builtin_exit                                          48      47      -1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 00:26:06 +02:00
Denys Vlasenko
7436950a75 hush: fix a=abc; c=c; echo ${a%${c}}
function                                             old     new   delta
expand_vars_to_list                                 2229    2302     +73
add_till_closing_paren                               286     313     +27
handle_dollar                                        623     574     -49
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 100/-49)            Total: 51 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 19:52:01 +02:00
Denys Vlasenko
3f78cec347 hush: handle expansions in ${var?expanded_word} constructs
function                                             old     new   delta
expand_vars_to_list                                 2209    2229     +20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 17:54:46 +02:00
Denys Vlasenko
349ef96bb5 hush: reorganized TODO comment at top
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 15:46:24 +02:00
Denys Vlasenko
214b8ca3dc hush: add a list of unsupported builtins
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 15:35:44 +02:00
Denys Vlasenko
73e013fca7 hush: handle ${var:NUM:} too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 15:24:12 +02:00
Denys Vlasenko
4f2c59b267 hush: remove extra comparison from prev commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 01:25:16 +02:00
Denys Vlasenko
4d8e5fdc1d hush: optional support for ${var:N:M} bashism
function                                             old     new   delta
expand_vars_to_list                                 1999    2183    +184
handle_dollar                                        682     623     -59

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 01:15:42 +02:00
Denys Vlasenko
53b513331a hush: explain various parameter expansion ops in comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-20 21:46:45 +02:00
Denys Vlasenko
ee0775dd13 hush: small code shrink
function                                             old     new   delta
expand_vars_to_list                                 2012    1999     -13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-20 16:37:53 +02:00
Denys Vlasenko
e3be7842be hush: shrink variable expansion code
function                                             old     new   delta
expand_vars_to_list                                 2164    2012    -152

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-20 16:27:42 +02:00
Denys Vlasenko
cddbb610cb hush: fix var=exit 2 not setting $? to 2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-20 14:27:09 +02:00
Denys Vlasenko
44c86ce5d7 hush: code shrink
text    data     bss     dec     hex filename
 843121     453    6828  850402   cf9e2 busybox_old
 843108     453    6828  850389   cf9d5 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-20 04:22:55 +02:00
Denys Vlasenko
b131ccec9c hush: support "cd -- DIR" and such
function                                             old     new   delta
skip_dash_dash                                         -      33     +33
builtin_exit                                          43      48      +5
builtin_umask                                        121     125      +4
builtin_shift                                        115     119      +4
builtin_cd                                            71      75      +4
builtin_wait                                         271     274      +3
builtin_source                                       171     174      +3
builtin_exec                                          57      60      +3
builtin_eval                                          46      45      -1
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 7/1 up/down: 59/-1)              Total: 58 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-20 03:39:43 +02:00
Denys Vlasenko
e66cf821cf ash,hush: make bare "." set exitcode to 2
function                                             old     new   delta
dotcmd                                               300     305      +5
builtin_source                                       176     171      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-18 09:12:53 +02:00
Denys Vlasenko
adc0e20892 hush: update bash compat todo comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 18:56:58 +02:00
Denys Vlasenko
82731b4b7a ash,hush: make "source" a synonym for . if bash compat is on
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 17:49:52 +02:00
Denys Vlasenko
3227d3f982 hush: fix hush-bugs/parse_err.tests
function                                             old     new   delta
parse_stream                                        2325    2339     +14
builtin_umask                                        121     123      +2
builtin_type                                         116     114      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 09:49:47 +02:00
Denys Vlasenko
8806d64acd hush: mention PPID, RANDOM support
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-16 02:36:18 +02:00
Denys Vlasenko
651a2697f7 *: merge some common strings
text   data    bss    dec    hexfilename
 838650   8009      0 846659  ceb43busybox_old
 838519   8009      0 846528  ceac0busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 16:25:17 +01:00
Denys Vlasenko
1497484839 ash,hush: make it possible to build them individually
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 01:08:26 +01:00
Denys Vlasenko
f3c742f925 hush: use ash's ulimit builtin; make it more more bash0like while at it
Based on a patch by Tobias Klauser <tklauser@distanz.ch>

function                                             old     new   delta
shell_builtin_ulimit                                   -     498    +498
limits_tbl                                            33      88     +55
ulimit_opt_string                                      -      38     +38
bltins1                                              288     300     +12
limits_name                                          127       -    -127
ulimitcmd                                            415       7    -408
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/1 up/down: 603/-535)           Total: 68 bytes
   text    data     bss     dec     hex filename
 839229     453    6828  846510   ceaae busybox_old
 839423     453    6828  846704   ceb70 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-06 20:12:00 +01:00
Denys Vlasenko
14a917eaab hush: note a FIXME
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-08 03:04:22 +01:00
Denys Vlasenko
17323a6245 hush: more "greppable" field names. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-28 01:57:05 +01:00
Denys Vlasenko
3581c62515 whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-25 13:39:24 +01:00
Denys Vlasenko
6b01b71e83 randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-24 22:52:21 +01:00
Denys Vlasenko
25d9b91d94 shell/read: check that variable names are sane
function                                             old     new   delta
shell_builtin_read                                  1000    1055     +55
parse_command                                       1460    1463      +3
builtin_umask                                        121     123      +2
is_well_formed_var_name                               73      66      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-13 18:22:35 +01:00
Denys Vlasenko
03dad22f8a hush: use ash's read builtin
function                                             old     new   delta
shell_builtin_read                                     -    1000   +1000
set_local_var_from_halves                              -      24     +24
setvar2                                                -       7      +7
...
popstring                                            140     134      -6
ash_main                                            1375    1368      -7
setvar                                               184     174     -10
arith_set_local_var                                   36       -     -36
builtin_read                                        1096     185    -911
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 5/23 up/down: 1038/-1007)        Total: 31 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 23:29:57 +01:00
Denys Vlasenko
6c93b24ce9 hush: fix potential buffer overflow on NOMMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 19:28:10 +01:00
Denys Vlasenko
e89a241b9e hush: fix subshell.tests failure on NOMMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 15:19:31 +01:00
Denys Vlasenko
b70cef71eb hush: two NOMMU fixes for bugs 877 and 883
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 13:45:45 +01:00
Denys Vlasenko
385cc59117 hush: plug a memory leak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 06:47:39 +01:00
Denys Vlasenko
a4899efd03 hush: fix exitcodes of killed processes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 11:37:09 +01:00
Denys Vlasenko
c270454f8f fix fallout from isprint() changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-20 19:14:19 +01:00
Denys Vlasenko
f3e2818895 hush: improve HUSH_BRACE_EXP code (still disabled). ~0 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-17 03:35:31 +01:00
Denys Vlasenko
160746b603 tweak in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-16 05:51:18 +01:00
Denys Vlasenko
5b2db97703 hush: initial stab at brace expansion support
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-16 05:49:36 +01:00
Denys Vlasenko
d8389ad760 hush: fix handling of words with braces. +65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-16 03:18:46 +01:00
Denys Vlasenko
00243b0a1a hush: fix exit code propagation from cmd. +45 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-16 02:00:03 +01:00
Denys Vlasenko
a7ccdeef39 libbb: added xfdopen_for_read/write
function                                             old     new   delta
xfdopen_helper                                         -      40     +40
logdir_open                                         1163    1184     +21
process_stdin                                        433     443     +10
xfdopen_for_write                                      -       9      +9
doCommands                                          2465    2474      +9
patch_main                                          1214    1222      +8
bbunpack                                             457     465      +8
xfdopen_for_read                                       -       7      +7
scan_tree                                            258     262      +4
xstrtoul_range_sfx                                   230     231      +1
sendmail_main                                        957     955      -2
passwd_main                                         1027    1023      -4
parse                                                969     964      -5
test_main                                            253     247      -6
sed_main                                             655     649      -6
dos2unix_main                                        437     429      -8
fbsplash_main                                        950     938     -12
handle_dir_common                                    371     354     -17
expand_vars_to_list                                 2197    2169     -28
update_passwd                                       1275    1246     -29
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 7/10 up/down: 117/-117)           Total: 0 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-15 23:28:11 +01:00
Denys Vlasenko
647553a4fc hush: wait for cmd to complete, and immediately store its exitcode in $?
function                                             old     new   delta
expand_vars_to_list                                 2129    2197     +68

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-15 19:58:19 +01:00
Denys Vlasenko
8131eea3dc *: introduce and use ffulsh_all()
function                                             old     new   delta
buffer_fill_and_print                                179     196     +17
fflush_all                                             -       9      +9
spawn                                                 87      92      +5
rtcwake_main                                         455     453      -2
...
alarm_intr                                            93      84      -9
readcmd                                             1072    1062     -10
bb_ask                                               345     333     -12
more_main                                            845     832     -13
flush_stdout_stderr                                   42      23     -19
xfflush_stdout                                        27       -     -27
flush_stderr                                          30       -     -30
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397)         Total: -366 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 14:19:51 +01:00