Commit Graph

1554 Commits

Author SHA1 Message Date
Denys Vlasenko
8d0e0cdadf move utmp.h include to libbb.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 23:21:46 +01:00
Denys Vlasenko
a146319173 hush: improve prompt in nested {}s, remove unused in_str->promptme member
function                                             old     new   delta
setup_string_in_str                                   29      38      +9
parse_and_run_stream                                  79      88      +9
setup_file_in_str                                     32      39      +7
parse_stream                                        2430    2422      -8
file_get                                             262     235     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 25/-35)            Total: -10 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 17:55:04 +01:00
Denys Vlasenko
98c46d10ee hush: fix "cmd & <newline>" problem
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 17:30:07 +01:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko
642e71a789 hush: fix wrong prompt problem on empty interactive commants
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-07 15:16:05 +01:00
Denys Vlasenko
6088e138e1 init: simpler handling of leading dash in commands
function                                             old     new   delta
init_exec                                            233     219     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-25 23:58:42 +01:00
Denys Vlasenko
75eb9d20e9 hush: fix FEATURE_CLEAN_UP code (was freeing unallocated memory)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-12-21 21:18:12 +01:00
Denys Vlasenko
0d6a4ecb30 hush: fix build breakage (variable declared in for())
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-18 01:34:49 +01:00
Denys Vlasenko
8da415ef25 add if guards around include <malloc.h>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-05 01:30:14 +01:00
Denys Vlasenko
57542ebe4f hush: move G_x_mode define to the more appropriate place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 03:59:30 +01:00
Dan Fandrich
85c62470b7 Support set -o xtrace/noexec alternates for set -x/-n
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 03:56:39 +01:00
Dan Fandrich
89ca2f99a2 hush: display useful help text
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 01:54:39 +01:00
Denys Vlasenko
26777aa1c6 fixes for bugs discovered by randomconfig builds and tests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-22 23:49:10 +01:00
Denys Vlasenko
7b4c0fd5f4 hush: fix improper handling of newline and hash chars in few corner cases
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-11-22 17:58:14 +01:00
Denys Vlasenko
6696eac274 hush: add support for "set -o pipefail"
function                                             old     new   delta
checkjobs                                            467     517     +50
builtin_set                                          259     286     +27
o_opt_strings                                          -      10     +10
hush_main                                           1011    1013      +2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 89/0)               Total: 89 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-14 02:01:50 +01:00
Denys Vlasenko
c08c3f5d26 hush: preparatory patch for set -o pipefail support
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-14 01:59:55 +01:00
Denys Vlasenko
fb132e4737 whitespace cleanup
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
cacb2cd281 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-05 00:13:02 +02:00
Denys Vlasenko
e2069fb325 hush: remove "doesn't support brace expansion" from config help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-04 00:01:47 +02:00
Denys Vlasenko
bbecd74d5a hush: remove brace expansion from TODO list in comments. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03 17:22:52 +02:00
Denys Vlasenko
957f79f471 hush: small code shrink
function                                             old     new   delta
expand_on_ifs                                        231     222      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03 17:15:50 +02:00
Denys Vlasenko
2bcba5cc53 hush: add brace expansion testcase
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03 17:07:57 +02:00
Denys Vlasenko
9e800223f1 hush: implement brace expansion
When enabled:

function                                             old     new   delta
glob_brace                                             -     402    +402
next_brace_sub                                         -      70     +70
expand_on_ifs                                        185     231     +46
bbconfig_config_bz2                                 4923    4929      +6
o_save_ptr                                           282     140    -142
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/1 up/down: 524/-142)          Total: 382 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03 14:28:04 +02:00
Denys Vlasenko
238081f750 hush: preparatory patch, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03 14:26:26 +02:00
Denys Vlasenko
b563f62bbb ash: fix signal and "set -e" interaction
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-09-25 17:15:13 +02:00
Denys Vlasenko
0e13b4019c hush: use smaller EXP_FLAG_foo constants
function                                             old     new   delta
expand_string_to_string                              126     124      -2
parse_stream                                        2376    2370      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-8)               Total: -8 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-21 12:35:39 +02:00
Denys Vlasenko
395b97aeac shell/math: better comment. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-17 18:02:17 +02:00
Denys Vlasenko
52e460b744 hush: move shell_ver from globals to main's stack.
function                                             old     new   delta
hush_main                                            995    1011     +16
pseudo_exec_argv                                     253     251      -2
execvp_or_die                                         50      48      -2
maybe_set_to_sigexit                                  50      47      -3
hush_exit                                             78      75      -3
builtin_wait                                         274     271      -3
check_and_run_traps                                  205     200      -5
init_sigmasks                                        214     190     -24
builtin_trap                                         465     441     -24
reset_traps_to_defaults                              238     211     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/9 up/down: 16/-93)            Total: -77 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-16 16:12:00 +02:00
Denys Vlasenko
bed7c81ea2 shell/math: deconvolute and explain ?: handling. Give better error message
function                                             old     new   delta
arith_apply                                         1271    1283     +12

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-16 11:50:46 +02:00
Denys Vlasenko
063847d6bd shell/math: return string error indicator, not integer
function                                             old     new   delta
expand_and_evaluate_arith                             87     106     +19
expand_one_var                                      1563    1570      +7
arith                                                 12      18      +6
evaluate_string                                      678     680      +2
arith_apply                                         1269    1271      +2
builtin_umask                                        133     132      -1
ash_arith                                            118      75     -43
expand_vars_to_list                                 1094    1038     -56
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/3 up/down: 36/-100)           Total: -64 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-15 13:33:02 +02:00
Denys Vlasenko
0eac8ff164 shell/math.c: stop using bss variable
function                                             old     new   delta
evaluate_string                                        -     678    +678
expand_one_var                                      1543    1563     +20
builtin_type                                         114     116      +2
expand_and_evaluate_arith                             89      87      -2
prev_chk_var_recursive                                 4       -      -4
ash_arith                                            122     118      -4
arith_lookup_val                                     142     132     -10
arith                                                674      12    -662
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/4 up/down: 700/-682)           Total: 18 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 12:49:52 +02:00
Denys Vlasenko
06d44d7dfb shell/math.c: rename arith_eval_hooks to arith_state, put error code into it
function                                             old     new   delta
expand_and_evaluate_arith                             79      89     +10
arith                                                675     674      -1
arith_lookup_val                                     151     142      -9
ash_arith                                            135     122     -13
arith_apply                                         1304    1269     -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 10/-58)            Total: -48 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 12:49:03 +02:00
Denys Vlasenko
bd14770b0c shell/math.c: small code shrink; fixed incomprehensible comments
function                                             old     new   delta
arith_apply                                         1334    1304     -30

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 11:11:40 +02:00
Denys Vlasenko
51850c818c shell: small code shrink
function                                             old     new   delta
arith                                                680     675      -5

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 01:09:11 +02:00
Denys Vlasenko
b771c654ca shell: shrink arith code; and prepare for returning text error codes
function                                             old     new   delta
arith                                                701     680     -21

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 00:34:26 +02:00
Denys Vlasenko
99862cbfad hush: optional support for history saving
function                                             old     new   delta
hush_main                                            945     995     +50

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 17:34:13 +02:00
Denys Vlasenko
de8c3f667a hush: move the EXIT trap comment. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 16:13:44 +02:00
Denys Vlasenko
a110c90de2 hush: fix EXIT trap display inside exit trap handler
function                                             old     new   delta
hush_exit                                             84      78      -6

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:38:04 +02:00
Denys Vlasenko
2d8187c139 shell/match.c: shrink by dropping double bool inversion
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:06:42 +02:00
Denys Vlasenko
acd5bc8f64 hush: fix handling of \" in quoted/unquoted cmd
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:05:39 +02:00
Denys Vlasenko
958581a8d9 ash: shrink by folding an if check into setprompt; unindent big block
function                                             old     new   delta
setprompt_if                                           -      66     +66
parseheredoc                                         126     124      -2
parsecmd                                              68      66      -2
redirect                                            1254    1249      -5
xxreadtoken                                          351     343      -8
readtoken1                                          3219    3204     -15
setprompt                                             62       -     -62
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/5 up/down: 66/-94)            Total: -28 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:04:27 +02:00
Denys Vlasenko
6040fe88f4 ash: add missing casts to match CTLfoo; add TODO comments
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:03:16 +02:00
Denys Vlasenko
5277a9db70 hush: remove forgotten commented-out block. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 15:34:53 +02:00
Denys Vlasenko
4f870496e7 hush: do fewer strdups in % and hash expansions
function                                             old     new   delta
builtin_umask                                        133     132      -1
expand_one_var                                      1552    1543      -9

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 11:06:01 +02:00
Denys Vlasenko
d98e5c65c3 hush: better function and parameter names
Also, trim code which isn't needed for non-bash compat.
No logic changes.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 10:44:23 +02:00
Denys Vlasenko
cc461736d6 hush: fixes to testsuite
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 10:19:22 +02:00
Denys Vlasenko
ebee410fe2 hush: fix var_bash5.tests failure
function                                             old     new   delta
expand_one_var                                      1513    1552     +39
expand_pseudo_dquoted                                118     135     +17
expand_string_to_string                              110     126     +16
setup_heredoc                                        298     308     +10
expand_and_evaluate_arith                             69      79     +10
parse_stream_dquoted                                 233     241      +8
setup_redirects                                      220     225      +5
run_list                                             956     961      +5
expand_assignments                                    76      81      +5
run_pipe                                            1587    1590      +3
parse_stream                                        2371    2374      +3
builtin_umask                                        132     133      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 12/0 up/down: 122/0)            Total: 122 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 10:17:53 +02:00
Denys Vlasenko
14e289b324 hush: fix var_bash3.tests failure
function                                             old     new   delta
expand_one_var                                      1513    1538     +25
parse_stream_dquoted                                 233     241      +8
expand_pseudo_dquoted                                118     126      +8
setup_heredoc                                        298     303      +5
expand_and_evaluate_arith                             69      74      +5
parse_stream                                        2371    2374      +3
builtin_umask                                        132     133      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/0 up/down: 55/0)               Total: 55 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 10:15:18 +02:00
Denys Vlasenko
a769e0225d hush: remove useless ESC_GLOB_CHARS clears/resotres
function                                             old     new   delta
o_addQstr                                             43     165    +122
expand_on_ifs                                        210     189     -21
expand_vars_to_list                                 1122    1094     -28
o_addqblock                                          139       -    -139
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 122/-188)          Total: -66 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 10:12:34 +02:00