Commit Graph

1380 Commits

Author SHA1 Message Date
Denys Vlasenko
023a08f229 ash: line up builtin table. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 15:53:33 +01:00
Denys Vlasenko
496d5bf4c6 ash: trap with bad signal name should not abort
function                                             old     new   delta
trapcmd                                              236     271     +35

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 15:52:24 +01: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
b76356b28e ash: fix quadratic matching slowdown is ${v/*foo*/repl} (really bad one)
It is especially bad with patterns starting with "*".

With ASH_OPTIMIZE_FOR_SIZE=y, only those are optimized, +few bytes:
   text    data     bss     dec     hex filename
 836337     441    7564  844342   ce236 busybox_old
 836341     441    7564  844346   ce23a busybox_unstripped

With ASH_OPTIMIZE_FOR_SIZE off, we also optimize patterns _ending_ with "*",
which costs about 80 bytes:
   text    data     bss     dec     hex filename
 836656     441    7564  844661   ce375 busybox_old
 836732     441    7564  844737   ce3c1 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-13 16:19:04 +01:00
Denys Vlasenko
f15620c377 shell/ulimit: code shrink by 10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-08 23:28:30 +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
4b1100edd8 *: use NULL for null pointers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-05 14:10:54 +01:00
Denys Vlasenko
153fcaa6c1 Replace __uClinux__ define with !BB_MMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-21 05:17:41 +01:00
Denys Vlasenko
7426920461 fix bug 1087. Fix by Leonid (lly.dev AT gmail.com)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-21 01:26:42 +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
083e172641 style fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-28 12:30:24 +01:00
Denys Vlasenko
6b9f163353 *: style fixes. no code changes (verified with objdump)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-28 02:24:24 +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
85d286efc8 ash: remove config items for read options which are no longer optional
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-13 18:31:29 +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
03d81ef43a builtin_read: note about better implementation
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-13 14:53:49 +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
045f4ad92c shell/read: fix "'read' without parameters" bash compat thingy
previous change:

function                                             old     new   delta
builtin_read                                          82    1074    +992
popstring                                            134     140      +6
readcmd                                             1034     148    -886
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 998/-886)          Total: 112 bytes

this change:

builtin_read                                        1074    1096     +22
static.arg_REPLY                                       8       -      -8
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 22/-8)              Total: 14 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 22:12:10 +01:00
Denys Vlasenko
7306727d1b shell: split read builtin from ash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 22:11:24 +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
f2c8aa6676 libbb: introduce and use monotonic_ms
function                                             old     new   delta
monotonic_ms                                           -      60     +60
process_stdin                                        433     443     +10
display_speed                                         85      90      +5
nmeter_main                                          672     674      +2
builtin_type                                         114     116      +2
bb__parsespent                                       117     119      +2
ifplugd_main                                        1110    1109      -1
acpid_main                                           441     440      -1
chat_main                                           1361    1359      -2
doCommands                                          2458    2449      -9
arpping                                              466     450     -16
run_command                                          268     234     -34
readcmd                                             1072    1034     -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/7 up/down: 81/-101)           Total: -20 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 12:52:30 +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
8cd04d1cb6 ash: fix for read $IFS splitting. Closes bug 235
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-08 15:44:07 +01:00
Chris Metcalf
c3c1fb676b ash: fix mishandling of bash-style redirects
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-08 13:18:06 +01:00
Denys Vlasenko
2ec91aead5 *: remove some uses of argc
function                                             old     new   delta
whoami_main                                           34      37      +3
logname_main                                          60      63      +3
hostid_main                                           35      38      +3
ttysize_main                                         136     135      -1
nmeter_main                                          673     672      -1
logger_main                                          387     386      -1
uuencode_main                                        330     328      -2
ifupdown_main                                       2125    2123      -2
mesg_main                                            158     155      -3
free_main                                            333     330      -3
cal_main                                             902     899      -3
acpid_main                                           443     440      -3
ar_main                                              196     189      -7
find_main                                            476     467      -9
ifconfig_main                                       1235    1221     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/12 up/down: 9/-49)            Total: -40 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 14:15:38 +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
46a1477107 ash: trivial optimization -6 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-10 21:27:13 +01:00
Denys Vlasenko
e9ac32a067 ash: fix double comma in initializer
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-05 02:01:25 +01:00
Michael Abbott
359da5e3be ash: implement set -o pipefail (conditional on bash compat). +39 bytes
Signed-off-by: Michael Abbott <michael@araneidae.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-04 23:03:29 +01:00
Denys Vlasenko
285ad155c4 ash: preparatory work for pipefail and code shrink. -44 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-04 23:02:27 +01:00
Denys Vlasenko
7a7b034482 ash: re-enable SIGHUP on entry. Closes bug 771.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-04 04:18:31 +01:00
Denys Vlasenko
8eda4a9005 ash: straighten up a bit of code in varvalue()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-30 12:16:17 +01:00
Denys Vlasenko
2ce42e98d7 ash: more cosmetics and cleanups
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-29 02:18:13 +01:00
Denys Vlasenko
068d386a6c ash: cosmetics, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-29 01:41:11 +01:00
Denys Vlasenko
76bc2d6deb ash: remove last "signed char"; make SIT() clearer. -12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-29 01:37:46 +01:00
Denys Vlasenko
0337e038a9 ash: randmconfig fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-29 00:12:30 +01:00
Denys Vlasenko
cd71683ae6 ash: remake strange signed char machinery to be unsigned. -57 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-28 22:14:02 +01:00
Denys Vlasenko
160b9ca731 ntpd: make it NOMMU-safe; ash: exclude it on NOMMU builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-27 02:35:15 +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