Commit Graph

1369 Commits

Author SHA1 Message Date
Bernhard Reutner-Fischer
864329d674 - fix compilation on OSF/1 2008-09-25 10:55:05 +00:00
Denis Vlasenko
34c73c499b ash: fix "(cat < file)" hang introduced by rev 22944. 2008-08-16 11:48:02 +00:00
Bernhard Reutner-Fischer
1dbc643dd3 - fix typo 2008-08-06 17:39:30 +00:00
Denis Vlasenko
2b576b8e76 hush: fix mishandling of a'b'c=fff as assignments. They are not.
function                                             old     new   delta
parse_stream                                        1920    2004     +84
done_word                                            715     752     +37
parse_and_run_stream                                 328     333      +5
builtin_exec                                          25      29      +4
pseudo_exec_argv                                     138     139      +1
run_list                                            2006    1999      -7
is_assignment                                        215     134     -81
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/2 up/down: 131/-88)            Total: 43 bytes
2008-08-04 00:46:07 +00:00
Denis Vlasenko
c8bec9a085 hush: remove a comment about already fixed bug 2008-08-03 22:27:50 +00:00
Denis Vlasenko
d498131168 hush: support $_NUMBERS variable names 2008-07-31 10:34:48 +00:00
Denis Vlasenko
f173607520 hush: fix "case ... in <newline> word)..." 2008-07-31 10:09:26 +00:00
Denis Vlasenko
fbeeb328b8 hush: support "pattern1|pattern2...)" in case statements
parse_stream                                        1847    1861     +14
run_list                                            1995    2006     +11
2008-07-31 00:17:01 +00:00
Denis Vlasenko
c90e1be01b ash: bash compat: "shift $BIGNUM" is equivalent to "shift 1" 2008-07-30 15:35:05 +00:00
Denis Vlasenko
4f504a9e57 hush: trivial code shrink
function                                             old     new   delta
builtin_continue                                      48      22     -26
2008-07-29 19:48:30 +00:00
Denis Vlasenko
87a8655f46 hush: use G.xxx instead of #define xxx G.xxx. We have too many globals
there and #defines get messy. Remove one write-only G.variable.
2008-07-29 19:43:10 +00:00
Denis Vlasenko
ff29b4fc42 randomconfig fix 2008-07-29 13:57:59 +00:00
Denis Vlasenko
4554b721ad hush: small fix for repeated continue and fix for wrong loop depth count
after Ctrl-C; with testcase for first one
2008-07-29 13:36:09 +00:00
Denis Vlasenko
45cb9f9581 hush: fix inverted check (was making all break's to act as "break 99999") 2008-07-29 11:47:46 +00:00
Denis Vlasenko
fcf37c3183 hush: fix break'ing out of {} and () groups; with testcase
function                                             old     new   delta
builtin_break                                         93     129     +36
builtin_continue                                      21      47     +26
run_list                                            1973    1976      +3
2008-07-29 11:37:15 +00:00
Denis Vlasenko
d91afa33fd randomconfig fixes 2008-07-29 11:10:01 +00:00
Denis Vlasenko
dadfb4975b hush: add #defines to switch off break/continue if loops are not supported
*: remove a few inline keywords
no code changes
2008-07-29 10:16:05 +00:00
Denis Vlasenko
918a34b9e0 hush: fix "while false; ..." exitcode; add testsuites 2008-07-28 23:17:31 +00:00
Denis Vlasenko
6a2d40f239 hush: support "break N" and "continue N"
fix non-detection of builtins and applets in "v=break; ...; $v; ..." case
 add testsuite entries for the above

function                                             old     new   delta
builtin_break                                         12      93     +81
run_list                                            1948    1971     +23
builtin_continue                                      12      21      +9
pseudo_exec_argv                                     132     138      +6
builtin_exec                                          23      25      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 121/0)             Total: 121 bytes
2008-07-28 23:07:06 +00:00
Denis Vlasenko
bcb25537d0 hush: implement break and continue
function                                             old     new   delta
bltins                                               252     276     +24
builtin_continue                                       -      12     +12
builtin_break                                          -      12     +12
static.version_str                                    18      17      -1
run_list                                            1984    1948     -36
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/2 up/down: 48/-27)             Total: 11 bytes
2008-07-28 23:04:34 +00:00
Denis Vlasenko
cf22c89f9a hush: in run_list(), some loop_top ops seems to be superfluous.
comment them out. Also, use separate temp variable
 for verification loop, helps gcc to optimize better.

function                                             old     new   delta
run_list                                            2039    1984     -55
2008-07-28 15:17:44 +00:00
Denis Vlasenko
12acec5ad4 hush: in run_list(), last_cond_code seems to be superfluous. comment it out
function                                             old     new   delta
run_list                                            2055    2039     -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-16)             Total: -16 bytes
2008-07-28 15:15:59 +00:00
Denis Vlasenko
5e052cab17 hush: explain run_list() in detail; small optimizations
function                                             old     new   delta
hush_main                                            785     786      +1
expand_variables                                    1447    1448      +1
builtin_exit                                          48      49      +1
builtin_eval                                          54      55      +1
run_list                                            2075    2055     -20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 4/-20)             Total: -16 bytes
2008-07-28 15:15:09 +00:00
Denis Vlasenko
38c89210d6 documentation fix 2008-07-28 00:06:02 +00:00
Denis Vlasenko
be709c24d4 hush: finish and enable optional case...esac support. Code size cost:
function                                             old     new   delta
run_list                                            1891    2075    +184
parse_stream                                        1764    1847     +83
expand_strvec_to_string                                -      83     +83
done_word                                            647     715     +68
static.reserved_list                                 144     168     +24
static.reserved_match                                  -      12     +12
done_pipe                                             95     105     +10
builtin_exit                                          48      46      -2
builtin_eval                                         127      54     -73
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 5/2 up/down: 464/-75)           Total: 389 bytes
2008-07-28 00:01:16 +00:00
Denis Vlasenko
8dbea7dbb1 ash: add slightly different testcase 2008-07-26 14:20:04 +00:00
Denis Vlasenko
5c13270359 ash: fix testcase to not sleep for whole 10 seconds,
gets annoying pretty fast. Also fix wrong message there.
2008-07-26 13:53:42 +00:00
Denis Vlasenko
87d5fd984e ash: fix typo 2008-07-26 13:48:35 +00:00
Denis Vlasenko
4e19a9c81a ash: hopefully close bug 4324. With testcase.
function                                             old     new   delta
evaltree                                             621     869    +248
popstring                                            134     140      +6
2008-07-26 13:45:57 +00:00
Denis Vlasenko
2b2e267b43 ash: testsuite entries for last change 2008-07-25 13:40:06 +00:00
Denis Vlasenko
6a0ad25061 ash: dont allow e.g. exec <&10 to attach to stript's fd!
function                                             old     new   delta
is_hidden_fd                                           -      61     +61
redirect                                            1135    1164     +29
popstring                                            134     140      +6
printf_main                                          635     637      +2
evalvar                                             1374    1376      +2
echo_main                                            294     296      +2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/0 up/down: 102/0)             Total: 102 bytes
2008-07-25 13:34:05 +00:00
Denis Vlasenko
22f7414843 ash: prevent exec NN>&- from closing fd used for script reading 2008-07-24 22:34:43 +00:00
Denis Vlasenko
5a867317bb ash: fix a bug where redirection fds were not closed afterwards.
optimize close+fcntl(DUPFD) into dup2. add testsuites.

function                                             old     new   delta
copyfd                                                47      68     +21
argstr                                              1311    1298     -13
popredir                                             148     131     -17
redirect                                            1139    1107     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 21/-62)            Total: -41 bytes
2008-07-24 19:46:38 +00:00
Denis Vlasenko
6fbb43bc3c ash: teach ash about 123>file. It could take only 0..9 before
function                                             old     new   delta
redirect                                            1052    1139     +87
need_to_remember                                       -      36     +36
popredir                                             132     148     +16
fixredir                                              86     101     +15
readtoken1                                          3130    3143     +13
evalvar                                             1374    1376      +2
popstring                                            140     134      -6
cmdtxt                                               592     561     -31
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/2 up/down: 169/-37)           Total: 132 bytes
2008-07-24 19:44:41 +00:00
Denis Vlasenko
6514c5e35c ash: ducument where "no fds > 9 in redirects" limitation is.
no code changes.
2008-07-24 13:41:37 +00:00
Denis Vlasenko
8d924ecf38 ash: ditch dupredirect(), it was only making code harder to read.
incorporate it in its single callsite.

function                                             old     new   delta
redirect                                            1054    1052      -2
changepath                                           196     194      -2
2008-07-24 11:34:27 +00:00
Denis Vlasenko
0b76964ae1 ash: explain redirect code a bit
function                                             old     new   delta
redirect                                            1059    1054      -5
2008-07-24 07:54:57 +00:00
Denis Vlasenko
2dc240c0d6 ash: code shrink
function                                             old     new   delta
copynode                                             171     180      +9
evaltreenr                                           615     621      +6
evaltree                                             615     621      +6
calcsize                                             121     127      +6
evalpipe                                             349     350      +1
redirect                                            1059    1057      -2
parseheredoc                                         129     126      -3
makename                                              35      32      -3
expredir                                             130     127      -3
parsefname                                           224     219      -5
popstring                                            140     134      -6
pipeline                                             276     268      -8
list                                                 360     351      -9
readtoken1                                          3157    3130     -27
parse_command                                       1504    1460     -44
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/10 up/down: 28/-110)          Total: -82 bytes
2008-07-24 06:07:50 +00:00
Bernhard Reutner-Fischer
3e8669f359 - wrap overlong lines (Cristian Ionescu-Idbohrn)
- s/\.  /. /g;# (me)
2008-07-22 18:27:53 +00:00
Denis Vlasenko
5415c856ea libbb: [x]fopen_for_{read,write} introduced and used.
(by Valdimir)

function                                             old     new   delta
config_open2                                           -      41     +41
config_read                                          507     542     +35
find_pair                                            169     187     +18
fopen_for_write                                        -      14     +14
fopen_for_read                                         -      14     +14
find_main                                            406     418     +12
xfopen_for_write                                       -      10     +10
xfopen_for_read                                        -      10     +10
popstring                                            134     140      +6
parse_inittab                                        396     401      +5
next_token                                           923     928      +5
pack_gzip                                           1659    1661      +2
bb__parsespent                                       117     119      +2
fallbackSort                                        1719    1717      -2
evalvar                                             1376    1374      -2
qrealloc                                              36      33      -3
...
...
...
...
singlemount                                         4579    4569     -10
process_stdin                                        443     433     -10
patch_main                                          1111    1101     -10
ifupdown_main                                       2175    2165     -10
file_action_grep                                      90      80     -10
uuidcache_init                                       649     637     -12
hush_main                                            797     785     -12
read_config                                          230     217     -13
dpkg_main                                           3835    3820     -15
read_line_input                                     3134    3110     -24
sysctl_main                                          232     203     -29
config_open                                           40      10     -30
WARN_BAD_LINE                                         44       -     -44
login_main                                          1714    1575    -139
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737)        Total: -563 bytes
2008-07-21 23:05:26 +00:00
Bernhard Reutner-Fischer
a53de7f7c2 - fix spelling 2008-07-21 13:46:54 +00:00
Denis Vlasenko
7ae1cc16b4 msh: fix "while...continue" bug 3884. 2008-07-20 23:03:23 +00:00
Denis Vlasenko
c185e290ee config help fixes 2008-07-16 23:45:11 +00:00
Denis Vlasenko
757361f9f5 hush: fix "... pattern) cmd;; esac" case 2008-07-14 08:26:47 +00:00
Denis Vlasenko
395ae45216 hush: delete unused field in struct child.
reinstate needed check for invalid syntax.
 document command parsing in hush_doc.txt.
2008-07-14 06:29:38 +00:00
Denis Vlasenko
17f02e79f4 hush: add case statement support. It is incomplete and disabled for now.
costs ~300 bytes when enabled.
2008-07-14 04:32:29 +00:00
Denis Vlasenko
3177ba0852 ash: small code shrink 2008-07-13 20:39:23 +00:00
Denis Vlasenko
e7067e38ea ash: fix segfault in "command -v" 2008-07-11 23:09:34 +00:00
Denis Vlasenko
6bdff08e6c hush: compile fixes for !LOOPS case 2008-07-09 20:14:53 +00:00
Denis Vlasenko
733e3fbc2f hush: support "for if in do done then; do echo $if; done" case
function                                             old     new   delta
done_pipe                                             83      95     +12
parse_stream                                        1758    1764      +6
done_word                                            674     647     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 18/-27)             Total: -9 bytes
2008-07-06 10:01:13 +00:00
Denis Vlasenko
ff182a3d68 hush: support "for v; do ... done" syntax (implied 'in "$@"') 2008-07-05 20:29:59 +00:00
Denis Vlasenko
afdcd12ed7 hush: fix a case where "$@" must expand to no word at all 2008-07-05 17:40:04 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
fa0b56db76 sendmail: fix wrong vfork usage here too
*: shorten error texts

function                                             old     new   delta
launch_helper                                          -     151    +151
vfork_or_die                                          20       -     -20
sendgetmail_main                                    1946    1848     -98
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 151/-118)           Total: 33 bytes
2008-07-01 16:09:07 +00:00
Denis Vlasenko
82604e9730 revert last two commits. vfork cannot be used in subroutine,
it trashes stack on return
2008-07-01 15:59:42 +00:00
Denis Vlasenko
58d60c3333 *: introduce and use xfork()
function                                             old     new   delta
xfork                                                  -      20     +20
msh_main                                            1377    1380      +3
mod_process                                          455     446      -9
forkexit_or_rexec                                     30      17     -13
expand_variables                                    1434    1421     -13
open_transformer                                      91      76     -15
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/4 up/down: 23/-50)            Total: -27 bytes
2008-07-01 11:11:24 +00:00
Denis Vlasenko
3da5572bfa *: introduce and use xvfork()
function                                             old     new   delta
time_main                                           1052    1285    +233
crontab_main                                         623     856    +233
ifupdown_main                                       2202    2403    +201
xvfork                                                 -      20     +20
passwd_main                                         1049    1053      +4
grave                                               1068    1066      -2
script_main                                          935     921     -14
vfork_or_die                                          20       -     -20
vfork_compressor                                     206     175     -31
open_as_user                                         109       -    -109
popen2                                               218       -    -218
edit_file                                            910     690    -220
run_command                                          268       -    -268
------------------------------------------------------------------------------
(add/remove: 1/4 grow/shrink: 4/4 up/down: 691/-882)         Total: -191 bytes
2008-07-01 10:40:41 +00:00
Denis Vlasenko
ce13b76002 libbb: shrink monotonic_XXX functions, introduce monotonic_ns
(unused for now)

function                                             old     new   delta
get_mono                                               -      31     +31
sv_main                                             1228    1234      +6
expand                                              1693    1697      +4
get_address                                          178     181      +3
utoa_to_buf                                          108     110      +2
builtin_exit                                          46      48      +2
qrealloc                                              36      33      -3
qgravechar                                           109     106      -3
ash_main                                            1383    1380      -3
grep_file                                            850     846      -4
popstring                                            140     134      -6
monotonic_us                                          85      60     -25
monotonic_sec                                         41      16     -25
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/7 up/down: 48/-69)            Total: -21 bytes
2008-06-29 02:25:53 +00:00
Denis Vlasenko
defc1ea340 *: introduce and use FAST_FUNC: regparm on i386, otherwise no-on
text    data     bss     dec     hex filename
 808035     611    6868  815514   c719a busybox_old
 804472     611    6868  811951   c63af busybox_unstripped
2008-06-27 02:52:20 +00:00
Denis Vlasenko
26bc57d8b2 ash: improve comments 2008-06-27 00:29:34 +00:00
Denis Vlasenko
448d30ee17 ash: fix very weak $RANDOM generator; and move even more things
out of data/bss

   text    data     bss     dec     hex filename
 807935     611    6884  815430   c7146 busybox_old
 808035     611    6868  815514   c719a busybox_unstripped
2008-06-27 00:24:11 +00:00
Denis Vlasenko
843cbd54d1 ash: move stuff out of data/bss
text    data     bss     dec     hex filename
 807939     611    6900  815450   c715a busybox_old
 807935     611    6884  815430   c7146 busybox_unstripped
2008-06-27 00:23:18 +00:00
Denis Vlasenko
f5d8c90d73 style fixes, no code changes 2008-06-26 14:32:57 +00:00
Denis Vlasenko
7049ff8696 whitespace fixes. no code changes 2008-06-25 09:53:17 +00:00
Denis Vlasenko
5ec6132c98 hush: ifdef out parts which are not needed
if neither loops nor ifs are supported. Code savings:

function                                             old     new   delta
parse_stream                                        1758    1757      -1
checkjobs                                            335     318     -17
done_pipe                                             74      52     -22
expand_variables                                    1437    1407     -30
run_list                                            1232    1189     -43
parse_and_run_stream                                 328     267     -61
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-174)           Total: -174 bytes
2008-06-24 00:50:07 +00:00
Denis Vlasenko
003f9fb213 hush: kill some old unused fields; small code shrink
function                                             old     new   delta
builtin_exit                                          48      47      -1
checkjobs                                            351     335     -16
checkjobs_and_fg_shell                                60      35     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-42)             Total: -42 bytes
2008-06-24 00:47:58 +00:00
Denis Vlasenko
cc3f20b9bd fix breakage found by randomconfig 2008-06-23 22:31:52 +00:00
Denis Vlasenko
211b59be43 hush: trivial fix in debug code 2008-06-23 16:28:53 +00:00
Denis Vlasenko
2f5d0cd511 ash: trivial code readability fixes 2008-06-23 13:24:19 +00:00
Denis Vlasenko
2b75a94118 ash: improve readability of the code. No real code changes. 2008-06-23 13:06:34 +00:00
Denis Vlasenko
ef527f50e6 ash: optional support for $'...\t...\n...' bashism
function                                             old     new   delta
readtoken1                                          2824    3172    +348
static.C_escapes                                       -      18     +18
parse_command                                       1504    1500      -4
SIT                                                   89      83      -6
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/2 up/down: 366/-10)           Total: 356 bytes
2008-06-23 01:52:30 +00:00
Denis Vlasenko
b07a496229 ash: minor shrink (mostly smallints) and variable renaming
function                                             old     new   delta
optschanged                                           85      91      +6
tryexec                                              115     118      +3
xxreadtoken                                          290     292      +2
raise_error_unexpected_syntax                         75      77      +2
bltincmd                                               6       8      +2
parseheredoc                                         128     129      +1
static.is_interactive                                  4       1      -3
readtoken                                            156     153      -3
lasttoken                                              4       1      -3
evalcommand                                         1147    1144      -3
checkkwd                                               4       1      -3
back_exitstatus                                        4       1      -3
pipeline                                             282     276      -6
list                                                 369     360      -9
ash_main                                            1402    1393      -9
options                                              616     606     -10
readtoken1                                          2823    2811     -12
parse_command                                       1529    1507     -22
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 6/12 up/down: 21/-91)           Total: -70 bytes
   text    data     bss     dec     hex filename
 807603     611    6908  815122   c7012 busybox_old
 807545     611    6900  815056   c6fd0 busybox_unstripped
2008-06-22 13:16:23 +00:00
Denis Vlasenko
9cd4c76b50 ash: fix "shift BIGNUM" and "read with no variable name" bugs.
omg. hush testsuite helps to find bugs in ash! what next?

function                                             old     new   delta
static.arg_REPLY                                       -       8      +8
readcmd                                             1023    1021      -2
shiftcmd                                             129     125      -4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 8/-6)                Total: 2 bytes
2008-06-18 19:22:19 +00:00
Denis Vlasenko
1ba323e5b6 cosmetics in hush testsuites 2008-06-18 17:53:57 +00:00
Denis Vlasenko
324a3fdf87 fix globbing in unquoted $* and $@ 2008-06-18 17:49:58 +00:00
Denis Vlasenko
55789c6646 hush: fix a bug with backslashes improperly handled in unquoted variables.
with previous patch:

function                                             old     new   delta
parse_stream                                        1638    1758    +120
expand_on_ifs                                         97     174     +77
free_pipe                                            206     237     +31
setup_redirect                                       217     220      +3
setup_redirects                                      143     144      +1
done_word                                            698     688     -10
free_strings                                          38       -     -38
expand_variables                                    1451    1403     -48
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 5/2 up/down: 232/-96)           Total: 136 bytes
2008-06-18 16:30:42 +00:00
Denis Vlasenko
ab876cd107 hush: add testsuite for "no globbing in redirection" rule.
simplify redirection habdling
2008-06-18 16:29:32 +00:00
Denis Vlasenko
985de15bf3 hush: expand quote3.tests and move from hush-bugs to hush-parsing 2008-06-18 09:22:31 +00:00
Denis Vlasenko
c1c63b622d hush: fix last hush-bugs testcase (disappearing "", $empty"" etc) 2008-06-18 09:20:35 +00:00
Denis Vlasenko
16c2fea280 hush: fix $$ handling 2008-06-17 12:28:44 +00:00
Denis Vlasenko
6eaf8deddd hush: fix "for a in; do echo 'I should never run'; done" bug 2008-06-17 12:09:21 +00:00
Denis Vlasenko
988339259f move glob_and_assign.tests from hush-bugs to hush-glob 2008-06-17 07:26:52 +00:00
Denis Vlasenko
30c9cc5b17 hush: continue fixing quoting and subst: fix glob_and_assign.tests. 2008-06-17 07:24:29 +00:00
Denis Vlasenko
c7985b76c5 hush: cleanup pass, the biggest is - moved builtins to the end of the file,
they really annoy in the middle of parser code. no real code changes.
2008-06-17 05:43:38 +00:00
Denis Vlasenko
b61e13d247 hush: fix memory leak. it was actually rather invloved problem.
Now finally glob/variable expansion is done IN THE RIGHT ORDER!
It opens up a possibility to cleanly fix remaining known bugs.

function                                             old     new   delta
o_save_ptr                                           115     286    +171
o_save_ptr_helper                                      -     115    +115
done_word                                            591     690     +99
o_get_last_ptr                                         -      31     +31
expand_on_ifs                                        125      97     -28
add_string_to_strings                                 28       -     -28
run_list                                            1895    1862     -33
debug_print_strings                                   42       -     -42
add_strings_to_strings                               126       -    -126
expand_variables                                    1550    1394    -156
o_debug_list                                         168       -    -168
expand_strvec_to_strvec                              388      10    -378
------------------------------------------------------------------------------
(add/remove: 2/4 grow/shrink: 2/4 up/down: 416/-959)         Total: -543 bytes
2008-06-17 05:11:43 +00:00
Denis Vlasenko
ccce59d562 hush: fixing fallout from last big glob fix:
fix segfault; identify where we leak memory

function                                             old     new   delta
expand_strvec_to_strvec                              353     336     -17
2008-06-16 14:35:57 +00:00
Denis Vlasenko
32d8423e63 hush: delete hush-bugs/glob_and_vars.tests for real 2008-06-16 12:53:33 +00:00
Denis Vlasenko
82dfec3e4e hush: fix hush-bugs/glob_and_vars.tests testcase:
globbing is now done _after_ variable/`cmd` substitution

function                                             old     new   delta
expand_strvec_to_strvec                                7     353    +346
expand_variables                                    1348    1383     +35
add_string_to_strings                                  -      28     +28
globhack                                             114       -    -114
done_word                                            778     579    -199
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/1 up/down: 409/-313)           Total: 96 bytes
2008-06-16 12:47:11 +00:00
Denis Vlasenko
5703c22a51 hush: eliminate PARSEFLAG_SEMICOLON and ctx->parse_type field.
function                                             old     new   delta
parse_and_run_file                                    30      27      -3
hush_main                                            795     792      -3
initialize_context                                    45      39      -6
done_word                                            791     778     -13
parse_and_run_stream                                 375     338     -37
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-62)             Total: -62 bytes
2008-06-15 11:49:42 +00:00
Denis Vlasenko
f8d01d3f66 hush: fix a bug where we were requiring semicolon here: (cmd;)
also fix a bug where after error prompt is not shown.

function                                             old     new   delta
parse_stream                                        1612    1638     +26
parse_and_run_stream                                 361     375     +14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 40/0)               Total: 40 bytes
2008-06-14 17:13:20 +00:00
Denis Vlasenko
dd316dd283 hush: add support for ':'; create testsuite entries
text    data     bss     dec     hex filename
 809569     612    7044  817225   c7849 busybox_old
 809528     612    7044  817184   c7820 busybox_unstripped
2008-06-14 15:50:55 +00:00
Denis Vlasenko
a84420062a hush: support "! cmd | cmd" negation
function                                             old     new   delta
done_word                                            749     791     +42
run_list                                            1821    1859     +38
checkjobs                                            334     351     +17
done_pipe                                             61      74     +13
static.reserved_list                                 132     144     +12
initialize_context                                    53      45      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/1 up/down: 122/-8)            Total: 114 bytes
2008-06-14 11:00:17 +00:00
Denis Vlasenko
29038c06d6 ash: small cosmetic change 2008-06-14 06:14:02 +00:00
Denis Vlasenko
2659c63213 ash: fix ${var/s/r} handling, add testcase. 2008-06-14 06:04:59 +00:00
Denis Vlasenko
7e3d33b6ce hush: speed up o_addX{chr,str}
function                                             old     new   delta
o_addQstr                                              -     162    +162
o_addQchr                                              -      89     +89
o_addstr                                               -      58     +58
o_addqchr                                             50      81     +31
expand_on_ifs                                        103      97      -6
add_till_backquote                                    92      82     -10
expand_variables                                    1281    1217     -64
parse_stream                                        1675    1609     -66
o_addqstr                                            155       -    -155
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 1/4 up/down: 340/-301)           Total: 39 bytes
   text    data     bss     dec     hex filename
 759870     604    6684  767158   bb4b6 busybox_old
 759909     604    6684  767197   bb4dd busybox_unstripped
2008-06-12 13:31:04 +00:00
Denis Vlasenko
76db5adbf7 hush: fix for nested $()s with escapes + testsuite 2008-06-12 12:58:20 +00:00
Denis Vlasenko
87f40bac14 hush: more backtick and quoting fixes... 2008-06-10 22:39:37 +00:00
Denis Vlasenko
43360e5178 hush: fix escaping of \[*?; add testsuites for these and for globbing 2008-06-10 20:13:40 +00:00
Denis Vlasenko
2e76c3f901 hush: fix yet another fallout
hush: move fixed testsuites out of hush-bugs/*
2008-06-10 18:27:50 +00:00
Denis Vlasenko
895bea2303 hush: fix some fallout from prev commits, add testsuite 2008-06-10 18:06:24 +00:00
Denis Vlasenko
46ccdcb96e hush: search/and/replace style cleanups, no code changes 2008-06-10 18:05:12 +00:00
Denis Vlasenko
7b4f3f13d3 hush: fix two nasty bugs:
hush-bugs/tick2.tests: ok
hush-bugs/tick.tests: ok

function                                             old     new   delta
parse_stream                                        1332    1557    +225
b_addptr                                               -      97     +97
add_till_backquote                                     -      82     +82
b_addstr                                               -      58     +58
b_grow_by                                              -      50     +50
setup_string_in_str                                    -      29     +29
expand_variables                                    1196    1199      +3
expand_on_ifs                                        100      97      -3
b_addqchr                                             57      50      -7
parse_and_run_string                                  48      31     -17
lookup_param                                          27       -     -27
b_addchr                                              75      45     -30
count_ifs                                             44       -     -44
process_command_subs                                 222       -    -222
------------------------------------------------------------------------------
(add/remove: 5/3 grow/shrink: 2/4 up/down: 544/-350)          Total: 194 bytes
   text    data     bss     dec     hex filename
 759354     604    6684  766642   bb2b2 busybox_old
 759534     604    6684  766822   bb366 busybox_unstripped
2008-06-10 18:04:32 +00:00
Denis Vlasenko
76d50418b3 hush: fix a memory leak in NOMMU case 2008-06-10 16:19:39 +00:00
Denis Vlasenko
3fe4f986a0 less: fix a case when regexp matches ""
hush: remove wrong comment, expand another one
2008-06-09 16:02:39 +00:00
Mike Frysinger
98a6f56d49 reword the error msg so people realize that they broke it, they buy it 2008-06-09 09:38:45 +00:00
Denis Vlasenko
598bb732e8 cosmetics 2008-06-09 07:58:53 +00:00
Denis Vlasenko
2d0529c9bc msh_function.patch: picked it up in the wild.
Fixed allocation bugs (it was allocating
one too small vectors) but it still is very buggy,
thus not applied.
2008-06-09 07:50:25 +00:00
Denis Vlasenko
ed9d621cf4 msh: style cleanups. No code changes. 2008-06-09 07:44:19 +00:00
Denis Vlasenko
b8c9354114 hush: add yet another bug to testsuite :( 2008-06-08 16:47:09 +00:00
Denis Vlasenko
66d56c565e ash testsuite: modify it so that it can run hush and msh tests 2008-06-05 09:07:02 +00:00
Denis Vlasenko
cd2663f15e ash: optional printf builtin. +25 bytes if off, +35 if on.
by Cristian Ionescu-Idbohrn.
2008-06-01 22:36:39 +00:00
Denis Vlasenko
d78920675f msh: fix ENOENT testcase 2008-06-01 14:16:54 +00:00
Denis Vlasenko
447bd66837 msh: fix the case where the file has exec bit but can't be run directly
(run "$SHELL $file" instead)
msh: fix exit codes when command is not found or can't be execed
     (with testcases)
2008-05-30 22:28:32 +00:00
Denis Vlasenko
4830fc565a hush: make it ignore SIGINT etc in a config wich has no job control 2008-05-25 21:50:55 +00:00
Bernhard Reutner-Fischer
5e25ddb7d3 - use STD*_FILENO some more. No object-code changes 2008-05-19 09:48:17 +00:00
Bernhard Reutner-Fischer
636a1f85e8 - use EXIT_{SUCCESS,FAILURE}. No object-code changes 2008-05-19 09:29:47 +00:00
Denis Vlasenko
29eb3599e4 ash: more of -Wall fixes 2008-05-18 14:06:08 +00:00
Denis Vlasenko
6b06cb80be more of -Wall fixes from Cristian Ionescu-Idbohrn.
Some are fixing real bugs.

function                                             old     new   delta
syslogd_main                                         938     958     +20
get_signum                                           136     143      +7
obj_load                                             777     782      +5
recv_from_to                                         210     214      +4
get_next_block                                      1795    1799      +4
display_topmem_process_list                         1117    1121      +4
logread_main                                         484     487      +3
buffer_fill_and_print                                 73      76      +3
kill_main                                            687     689      +2
ll_remember_index                                    240     241      +1
do_stats                                             452     453      +1
if_readconf                                          166     165      -1
display_process_list                                1192    1191      -1
run_applet_and_exit                                  507     505      -2
print_signames                                        33      31      -2
parse_one_line                                      1092    1090      -2
find_out_spec                                         57      55      -2
add_ksymoops_symbols                                 421     419      -2
ash_main                                            1407    1402      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17)            Total: 37 bytes
2008-05-15 21:30:45 +00:00
Mike Frysinger
b81f97bbd2 fix by Jie Zhang for exit status and POSIX compliance:
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
The exit status of a command that terminated because it received a signal shall be reported as greater than 128.
2008-05-14 11:51:04 +00:00
Denis Vlasenko
dddfaff363 ash: make set -o and set +o work as in dash/bash.
by Cristian Ionescu-Idbohrn.

function                                             old     new   delta
options                                              565     625     +60
getoptscmd                                           709     698     -11
2008-05-06 15:30:27 +00:00
Denis Vlasenko
bc1918a7a2 trivial fixes to make bbox compile with gcc 4.3.0 2008-04-15 01:17:50 +00:00
Denis Vlasenko
c7131c3e58 ash: fix breakage introduced in rev 21481.
Fixes ash-vars/var_posix1.tests testsuite entry.
2008-04-14 01:59:53 +00:00
Denis Vlasenko
6d1ebecf65 ash: add another testsuite entry ("leaking variables" bug) 2008-04-13 17:45:56 +00:00
Denis Vlasenko
7465dbcf2a ash: speed up NOFORK code in ash by eliminating second find_applet().
some code reduction along the way.

function                                             old     new   delta
run_list                                            1971    1981     +10
run_nofork_applet_prime                              181     182      +1
unsetcmd                                              97      96      -1
delete_cmd_entry                                      54      53      -1
describe_command                                     399     397      -2
cmdlookup                                            152     150      -2
evaltreenr                                           602     599      -3
evaltree                                             602     599      -3
clearcmdentry                                        101      98      -3
cdcmd                                                675     672      -3
hashcmd                                              305     301      -4
find_command                                         933     910     -23
evalcommand                                         1371    1229    -142
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/11 up/down: 11/-187)         Total: -176 bytes
2008-04-13 02:25:53 +00:00
Denis Vlasenko
f78a656f7c ash: a bit more complete POSIX subst testsuite entry 2008-04-12 23:02:43 +00:00
Denis Vlasenko
033424a213 ash: add testsuite entry for POSIX-mandated ${var#word} ${var##word}
${var%word} ${var%%word}
2008-04-12 22:55:33 +00:00
Denis Vlasenko
9bc80d7062 ash: add FEATURE_SH_NOFORK support 2008-04-12 20:07:53 +00:00
Denis Vlasenko
4a9ca13fe7 ash: do not do find_applet() twice in shellexec/tryexec 2008-04-12 20:07:08 +00:00
Denis Vlasenko
93b8263652 fix build with gcc -combine 2008-04-11 11:27:29 +00:00
Denis Vlasenko
468aea2d88 shells: do not frocibly enable test, echo and kill _applets_,
just build relevant source and use xxx_main functions.
build system: add a special case when we have exactly one applet enabled
(makes "true", "false", "basename" REALLY tiny).
getopt32: do not use stdio.

function                                             old     new   delta
getopt32                                            1385    1412     +27
make_device                                         1187    1200     +13
basename_main                                        120     127      +7
tcpudpsvd_main                                      1922    1926      +4
testcmd                                                5       -      -5
echocmd                                                5       -      -5
fuser_main                                          1243    1231     -12
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 4/1 up/down: 51/-22)             Total: 29 bytes
2008-04-01 14:47:57 +00:00
Denis Vlasenko
80591b0a00 ash: support for && and || in [[ expr ]]; add testsuite checks 2008-03-25 07:49:43 +00:00
Denis Vlasenko
f7d5665969 ash: comment about [[; code style fixes. No code changes. 2008-03-25 05:51:41 +00:00
Denis Vlasenko
92e13c2a11 ash: optional bash-like pattern subst and substring opts
(by James Simmons <jsimmons AT infradead.org>)
TODO: write testsuite!

BASH_COMPAT off:
scanleft                                             101     262    +161
subevalvar                                           346     335     -11
BASH_COMPAT on:
subevalvar                                           346    1397   +1051
scanleft                                             101     262    +161
readtoken1                                          2739    2807     +68
cmdputs                                              397     399      +2
static.vstype                                         64      48     -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 1282/-16)         Total: 1266 bytes
2008-03-25 01:17:40 +00:00
Denis Vlasenko
59f351ccda ash: add read -u; fix read -t and read -n; add testsuite entries. 2008-03-25 00:07:12 +00:00
Denis Vlasenko
c693840fe8 *: whitespace fixes, no code changes 2008-03-24 02:18:03 +00:00
Denis Vlasenko
42cc304e90 lpr: add more accurate comments
*: trailing whitespace removal
2008-03-24 02:05:58 +00:00
Denis Vlasenko
0b6c6a9c9f lpd: fix OOM vulnerability (was eating arbitrarily large commands) 2008-03-24 00:04:42 +00:00
Denis Vlasenko
c93b162248 patch: shrink by Pascal Bellard <pascal.bellard AT ads-lu.com> (-80 bytes)
*: removal of #include <getopt.h>
2008-03-23 22:55:25 +00:00
Denis Vlasenko
f90ab183d6 *: use fopen_or_warn in few more places 2008-03-20 21:19:35 +00:00
Denis Vlasenko
62a90cdd74 *: shrink by using [f]open_or_warn_stdin where appropriate
function                                             old     new   delta
lsattr_main                                           62     143     +81
open_or_warn_stdin                                     -      36     +36
fclose_if_not_stdin                                   20      47     +27
xfopen_stdin                                           -      20     +20
tac_main                                             336     356     +20
cksum_main                                           249     259     +10
bb_argv_dash                                           -       8      +8
su_main                                              448     455      +7
cmp_main                                             630     633      +3
passwd_main                                         1072    1074      +2
uudecode_main                                        317     315      -2
text_yank                                            110     108      -2
handle_incoming_and_exit                            2653    2651      -2
flags                                                  5       1      -4
write_leases                                         235     230      -5
fopen_or_warn_stdin                                   48      42      -6
fold_main                                            648     642      -6
static.argv_dash                                       8       -      -8
sum_main                                             142     128     -14
tail_main                                           1237    1221     -16
sed_main                                             711     695     -16
cmp_xfopen_input                                      17       -     -17
bb_cat                                               113      96     -17
catv_main                                            328     306     -22
strings_main                                         457     434     -23
hash_file                                            298     274     -24
sum_file                                             353     325     -28
sort_main                                            904     859     -45
expand_main                                          736     686     -50
cut_main                                            1116    1065     -51
md5_sha1_sum_main                                    549     493     -56
lsattr_args                                           90       -     -90
read_stduu                                           408     255    -153
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 7/20 up/down: 214/-657)        Total: -443 bytes
   text    data     bss     dec     hex filename
 797417     658    7428  805503   c4a7f busybox_old
 796973     658    7428  805059   c48c3 busybox_unstripped
2008-03-17 09:07:36 +00:00
Denis Vlasenko
85c247161b *: fix fallout from -Wunused-parameter
function                                             old     new   delta
bbunpack                                             358     366      +8
passwd_main                                         1070    1072      +2
handle_incoming_and_exit                            2651    2653      +2
getpty                                                88      86      -2
script_main                                          975     972      -3
inetd_main                                          2036    2033      -3
dname_enc                                            377     373      -4
make_new_session                                     474     462     -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/5 up/down: 12/-24)            Total: -12 bytes
   text    data     bss     dec     hex filename
 797429     658    7428  805515   c4a8b busybox_old
 797417     658    7428  805503   c4a7f busybox_unstripped
2008-03-17 09:04:04 +00:00
Denis Vlasenko
68404f13d4 *: add -Wunused-parameter; fix resulting breakage
function                                             old     new   delta
procps_scan                                         1265    1298     +33
aliascmd                                             278     283      +5
parse_file_cmd                                       116     120      +4
dname_enc                                            373     377      +4
setcmd                                                90      93      +3
execcmd                                               57      60      +3
count_lines                                           72      74      +2
process_command_subs                                 340     339      -1
test_main                                            409     407      -2
mknod_main                                           179     177      -2
handle_incoming_and_exit                            2653    2651      -2
argstr                                              1312    1310      -2
shiftcmd                                             131     128      -3
exitcmd                                               46      43      -3
dotcmd                                               297     294      -3
breakcmd                                              86      83      -3
evalpipe                                             353     349      -4
evalcommand                                         1180    1176      -4
evalcmd                                              109     105      -4
send_tree                                            374     369      -5
mkfifo_main                                           82      77      -5
evalsubshell                                         152     147      -5
typecmd                                               75      69      -6
letcmd                                                61      55      -6
add_cmd                                             1190    1183      -7
main                                                 891     883      -8
ash_main                                            1415    1407      -8
parse_stream                                        1377    1367     -10
alloc_procps_scan                                     55       -     -55
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148)          Total: -94 bytes
   text    data     bss     dec     hex filename
 797195     658    7428  805281   c49a1 busybox_old
 797101     658    7428  805187   c4943 busybox_unstripped
2008-03-17 09:00:54 +00:00
Denis Vlasenko
3f165fa5b3 libbb: introduce and use sigprocmask_allsigs and sigaction_set.
libbb: rename sig_pause to wait_for_any_sig.
2008-03-17 08:29:08 +00:00
Denis Vlasenko
8e2cfec1cd libbb: introduse and use signal_[no_]SA_RESTART_empty_mask and sigaction_set
signal_SA_RESTART_empty_mask                           -      65     +65
signal_no_SA_RESTART_empty_mask                        -      54     +54
dd_main                                             1325    1369     +44
sigaction_set                                          -      19     +19
dname_enc                                            373     377      +4
UNSPEC_print                                          64      66      +2
setsignal                                            296     294      -2
bb_signals_recursive                                  95      92      -3
bb_askpass                                           367     361      -6
inetd_main                                          1810    1797     -13
rx_main                                              912     883     -29
sigdelset                                             32       -     -32
__sigdelset                                           32       -     -32
__GI_sigdelset                                        32       -     -32
sighup_handler                                        84      37     -47
arping_main                                         1844    1797     -47
fsck_main                                           1869    1807     -62
run_list                                            1917    1844     -73
vlock_main                                           492     409     -83
progressmeter                                        883     798     -85
handle_incoming_and_exit                            2737    2651     -86
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 3/12 up/down: 188/-632)        Total: -444 bytes
2008-03-12 23:19:35 +00:00
Denis Vlasenko
a43dba76ea msh: create testsuite (based on hush one)
hush: add TODO (doesn't know ":" command)
2008-03-02 19:57:53 +00:00
Denis Vlasenko
4aafd5f4e3 msh: a few fields renamed; short->int conversion for a field
holding file descriptors; short->smalling for flag field

synio                                                263     264      +1
readc                                                247     242      -5
forkexec                                            1339    1307     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 1/-37)             Total: -36 bytes
2008-03-02 14:33:26 +00:00
Denis Vlasenko
fb29038b59 libbb: inntroduce and use bb_pstrcmp() and qsort_string_vector()
msh: glob0/glob1/glob2/glob3 are just a sorting routine! remove them.

bb_pstrcmp                                             -      25     +25
qsort_string_vector                                    -      24     +24
expand                                              2209    2227     +18
getopt32                                            1359    1370     +11
passwd_main                                         1072    1074      +2
handle_incoming_and_exit                            2737    2735      -2
UNSPEC_print                                          66      64      -2
forkexec                                            1343    1339      -4
input_tab                                           3338    3330      -8
get_dir                                              185     177      -8
expmeta                                              481     473      -8
cmdputs                                              405     397      -8
xstrcmp                                               12       -     -12
find_pair                                            187     167     -20
match_compare                                         25       -     -25
dir_strcmp                                            25       -     -25
glob2                                                 27       -     -27
glob3                                                 34       -     -34
glob1                                                256       -    -256
------------------------------------------------------------------------------
(add/remove: 2/6 grow/shrink: 3/8 up/down: 80/-439)          Total: -359 bytes
2008-03-02 12:51:26 +00:00
Denis Vlasenko
509697f00d msh: renames: ->words => ->op_words, space() => get_space()
msh: simplify glob0/glob1/glob2/glob3

get_space                                              -      26     +26
glob3                                                 35      34      -1
glob2                                                 28      27      -1
strsave                                               55      53      -2
globv                                                  4       -      -4
func                                                   4       -      -4
xstrcmp                                               25      12     -13
dodot                                                178     164     -14
rexecve                                              272     257     -15
space                                                 26       -     -26
glob1                                                292     256     -36
expand                                              2246    2209     -37
------------------------------------------------------------------------------
(add/remove: 1/3 grow/shrink: 0/8 up/down: 26/-153)          Total: -127 bytes
2008-03-02 12:49:39 +00:00
Denis Vlasenko
fe2188378c msh: fix for bug 846 ("break" didn't work second time)
msh: don't use floating point in "times" builtin
+4 bytes difference
2008-03-01 09:35:39 +00:00
Denis Vlasenko
574f2f4394 *: add optimization barrier to all "G trick" locations 2008-02-27 18:41:59 +00:00
Denis Vlasenko
400d8bb45e less,klogd,syslogd,nc,tcpudp: exit on signal by killing itself, not exit(1)
*: minor shrink
2008-02-24 13:36:01 +00:00
Denis Vlasenko
6aa74fcf5b ash: s/ckzmalloc/ckzalloc/ 2008-02-21 04:35:14 +00:00
Denis Vlasenko
838ffd5be2 ash: sprinkle a bit more of zeroed allocations. 2008-02-21 04:32:08 +00:00
Denis Vlasenko
e376d454bb libbb: introduce and use nonblock_safe_read(). Yay!
Our shells are immune from this nasty O_NONBLOCK now!

function                                             old     new   delta
nonblock_safe_read                                     -      78     +78
file_get                                             276     295     +19
generateMTFValues                                    428     435      +7
read_line_input                                     1776    1772      -4
preadbuffer                                          543     450     -93
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/2 up/down: 104/-97)             Total: 7 bytes
   text    data     bss     dec     hex filename
 615190     715   23924  639829   9c355 busybox_old
 615168     715   23924  639807   9c33f busybox_unstripped
2008-02-20 22:23:24 +00:00
Denis Vlasenko
597906c436 ash: introduce and use stzalloc and ckzalloc.
function                                             old     new   delta
stzalloc                                               -      29     +29
ckzalloc                                               -      29     +29
recordregion                                         108     102      -6
cmdlookup                                            158     152      -6
pipeline                                             188     181      -7
parseheredoc                                         135     128      -7
makename                                              42      35      -7
list                                                 355     348      -7
setvareq                                             221     212      -9
aliascmd                                             324     311     -13
pushfile                                              83      69     -14
readtoken1                                          2872    2849     -23
parse_command                                       1430    1391     -39
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/11 up/down: 58/-138)          Total: -80 bytes
   text    data     bss     dec     hex filename
 577227     706   23740  601673   92e49 busybox_old
 577147     706   23740  601593   92df9 busybox_unstripped
2008-02-20 16:38:54 +00:00
Denis Vlasenko
c12d51e94e ash: fix fallout from "A=1 B=$A; echo $B" code. 2008-02-19 23:31:05 +00:00
Denis Vlasenko
56244736ec whitespace fixes 2008-02-17 15:14:04 +00:00
Denis Vlasenko
25591c322c libbb: introduce bb_signals and bb_signals_recursive,
which sets same handler for many signals. sig_catch is nuked
(bb_signals_recursive is more descriptive name).
*: use them as appropriate. 

function                                             old     new   delta
bb_signals_recursive                                   -      95     +95
bb_signals                                             -      52     +52
run_command                                          258     273     +15
svlogd_main                                         1368    1377      +9
runsv_main                                          1746    1752      +6
runsvdir_main                                       1643    1646      +3
UNSPEC_print                                          64      66      +2
time_main                                           1128    1127      -1
...
resize_main                                          246     210     -36
sig_catch                                             63       -     -63
set_fatal_sighandler                                  85      14     -71
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 5/24 up/down: 182/-548)        Total: -366 bytes
2008-02-16 22:58:56 +00:00
Denis Vlasenko
284d0faed6 random s/short/int/
add_cmd                                             1189    1190      +1
xconnect_ftpdata                                     118     117      -1
data_align                                            86      84      -2
process_files                                       2101    2096      -5
forkexec                                            1345    1334     -11
2008-02-16 13:18:17 +00:00
Denis Vlasenko
0e6f661e23 ash: handle "A=1 A=2 B=$A; echo $B". closes bug 947. 2008-02-15 15:02:15 +00:00
Denis Vlasenko
94e87bc83d ash: explain why "set -o BOGUS" doesn't abort 2008-02-14 16:51:58 +00:00
Denis Vlasenko
28bf671d6d ash: make ash -c 'if set -o barfoo 2>/dev/null; then echo foo; else echo bar; fi' work
(fixes bug 1142)

function                                             old     new   delta
options                                              551     565     +14
ash_main                                            1397    1411     +14
setcmd                                                77      90     +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 41/0)               Total: 41 bytes
2008-02-14 15:01:47 +00:00
Denis Vlasenko
773f6710c1 typo fix 2008-02-14 10:31:18 +00:00
Denis Vlasenko
12c0622231 tar: do "short EOF" compat only if CONFIG_DESKTOP.
ash: add a comment about new minor bug
2008-02-14 08:52:30 +00:00
Denis Vlasenko
65eb550024 reinstate redir.tests with correct perms 2008-02-13 18:10:46 +00:00
Denis Vlasenko
81887e2342 ash: add a testcase for recently fixed signal bug 2008-02-13 18:09:56 +00:00
Denis Vlasenko
fee2d0c256 msh: stop trying to parse variables in "msh SCRIPT VAR=val param".
They should be passed as ordinary parameters.
2008-02-12 10:12:18 +00:00
Denis Vlasenko
7e497527ea msh: instead of fixing "ls | cd", "cd | ls" etc just disallow
builtins in pipes. They make no sense there anyway.
msh: shrink umask builtin.

function                                             old     new   delta
execute                                             2508    2509      +1
doset                                                326     317      -9
forkexec                                            1370    1345     -25
doumask                                              165     101     -64
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 1/-98)             Total: -97 bytes
2008-02-12 09:51:03 +00:00
Denis Vlasenko
e26b2783a5 ash: fix warning about _GNU_SOURCE being redefined, fix typo in comment. 2008-02-12 07:40:29 +00:00
Denis Vlasenko
648b44fd78 msh: shrink, mainly by using smallints
function                                             old     new   delta
synio                                                251     263     +12
filechar                                             310     315      +5
subgetc                                              781     785      +4
brkcontin                                            106     109      +3
...
yylex                                                981     976      -5
execute                                             2513    2508      -5
waitfor                                              321     315      -6
onintr                                               103      97      -6
doset                                                332     326      -6
doexec                                               186     180      -6
yyparse                                               65      57      -8
thenpart                                             135     126      -9
forkexec                                            1379    1370      -9
onecommand                                           457     433     -24
newtp                                                 52      28     -24
command                                             1086    1061     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/23 up/down: 27/-163)         Total: -136 bytes
2008-02-12 06:04:06 +00:00
Denis Vlasenko
a5f2cd30c9 msh: do not run pipes where last command is a builtin
msh: code shrink and some renames for better readability
2008-02-11 18:10:06 +00:00
Denis Vlasenko
83177991c8 hush: die_sllep needs restoring only if job control is on 2008-02-11 08:44:36 +00:00
Denis Vlasenko
08126f665d hush: close-on-exec interactive_fd 2008-02-11 08:39:11 +00:00
Denis Vlasenko
459a5ad410 hush: set CLOEXEC on script file being executed 2008-02-11 08:35:03 +00:00
Denis Vlasenko
4ecfcdcced hush: fix the comment 2008-02-11 08:32:31 +00:00
Denis Vlasenko
c04163a289 hush: reset die_sleep to 0 in child after fork 2008-02-11 08:30:53 +00:00
Denis Vlasenko
991a1da148 ash: fix "orwell bug" 1984. Testcase:
trap_handler() {
        echo trap
    }
    trap trap_handler USR1
    sleep 3600 &
    while true; do wait; done
2008-02-10 19:02:53 +00:00
Denis Vlasenko
0ef240d979 hush: small fixes to docs/testsuite 2008-02-10 16:00:30 +00:00
Denis Vlasenko
05743d7949 hush: reinstate cmd handling for NOMMU (with fat big warning).
hush: fix a case where none of pipe members could be started
  because of fork failure
hush: rename functions: xxx_real -> xxx
hush: try to add a bit more of vfork-friendliness
hush: add rudimentary design docs
hush: add TODO (newly discovered bug with globbing)
2008-02-10 12:10:08 +00:00
Denis Vlasenko
5c3d2b334a ash: readability enhancement, no code changes 2008-02-03 22:01:08 +00:00
Denis Vlasenko
6e602c4931 msh: also handle EOF/read errors correctly 2008-02-02 18:50:50 +00:00
Denis Vlasenko
80667e30fb msh: fix Ctrl-C handling with line editing 2008-02-02 18:35:55 +00:00
Denis Vlasenko
36fc3cd8bc ash: code readability enhancements, no real code changes 2008-01-29 09:23:49 +00:00
Denis Vlasenko
847fa779af *: tidy up usage of char **environ 2008-01-28 22:45:43 +00:00
Denis Vlasenko
d2c450ce81 hush: report [v]fork failures
hush: more correct handling of piping
config: add CONFIG_NOMMU
2008-01-08 20:32:12 +00:00
Denis Vlasenko
fb0eba706c libbb: introduce and use safe_waitpid (loops in EINTR)
*: use more approproate (shorter) versions of wait()

function                                             old     new   delta
safe_waitpid                                           -      48     +48
wait_any_nohang                                        -      17     +17
send_tree                                            365     369      +4
processorstop                                        432     435      +3
text_yank                                            110     108      -2
make_human_readable_str                              202     200      -2
crond_main                                          1368    1366      -2
handle_sigchld                                        49      43      -6
reapchild                                            166     159      -7
custom                                               260     250     -10
checkscript                                          191     177     -14
wait_nohang                                           17       -     -17
wait_pid                                              43       -     -43
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/7 up/down: 72/-103)           Total: -31 bytes
2008-01-02 19:55:04 +00:00
Mike Frysinger
08137c28c4 add expected output 2007-12-25 04:35:05 +00:00
Denis Vlasenko
3b4921674e hush: fixlet for NOMMU
update TODO_config_nommu
2007-12-24 14:26:57 +00:00
Denis Vlasenko
528a8b9769 cttyhack: trivial build fixlet 2007-12-22 19:57:28 +00:00
Denis Vlasenko
ee87ebf381 fix buglets found by randomconfig 2007-12-21 22:18:16 +00:00
Denis Vlasenko
c794c51a1a msh: reduce global data/bss usage
(add/remove: 1/5 grow/shrink: 28/6 up/down: 464/-394)          Total: 70 bytes
   text    data     bss     dec     hex filename
 778077     908    7568  786553   c0079 busybox_old
 778330     860    7408  786598   c00a6 busybox_unstripped
2007-12-16 17:21:29 +00:00
Denis Vlasenko
0163111325 ash: reduce global data/bss usage
(add/remove: 4/29 grow/shrink: 76/21 up/down: 1007/-1713)    Total: -706 bytes
   text    data     bss     dec     hex filename
 777206    1084    8976  787266   c0342 busybox_old
 778077     908    7568  786553   c0079 busybox_unstripped
2007-12-16 17:20:38 +00:00
Denis Vlasenko
d7e2e127a9 cttyhack: add missing ';'
init: remove pointless access() check
2007-12-10 08:40:29 +00:00
Denis Vlasenko
2afabe8b83 init: remove superfluous forks and messing up with argv[0]
cttyhack: add stealing of ctty
2007-12-10 07:06:04 +00:00
Denis Vlasenko
9cb220be9d lineedit: don't violate API if we do simple fgets
ash: cosmetic style fixes, no code changes
2007-12-09 10:03:28 +00:00
Denis Vlasenko
ab801874f8 attack the biggest stack users:
-mkfs_minix_main [busybox_unstripped]:                  4288
-mkfs_minix_main [busybox_unstripped]:                  4276
-grave [busybox_unstripped]:                            4260
(bzip2 users too - not listed)

price we pay in code size increase:
mainSort                                            2458    2515     +57
grave                                               1005    1058     +53
sendMTFValues                                       2177    2195     +18
BZ2_blockSort                                        122     125      +3
mkfs_minix_main                                     3070    3022     -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 131/-48)            Total: 83 bytes
2007-12-02 08:35:37 +00:00
Denis Vlasenko
1aa7e477b1 reorganize applet table. Eliminates pointers to names.
Should be a big win for libbusybox. busybox wins too:

   text    data     bss     dec     hex filename
 776524     929    9100  786553   c0079 busybox_old
 775903     929    9100  785932   bfe0c busybox_unstripped
2007-11-28 06:49:03 +00:00
Denis Vlasenko
ed270a5f32 ash: make code simpler, and do not do close(-1) - it's rude 2007-11-26 05:37:07 +00:00
Denis Vlasenko
fe5e23bf75 remove echo_main -> bb_echo indirection 2007-11-24 02:23:51 +00:00
Denis Vlasenko
c3c6659f12 hush: fix segfault in "echo $@" when we have no arguments 2007-11-24 00:22:42 +00:00
Denis Vlasenko
96702ca945 kill lash. "lash" builtin still exists, but it runs hush. 2007-11-23 23:28:55 +00:00
Denis Vlasenko
5bc593ccb8 hush: implement echo builtin
builtin_echo                                           -      36     +36
bltins                                               384     396     +12
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 48/0)               Total: 48 bytes
2007-11-23 21:20:21 +00:00
Denis Vlasenko
cccdc4e01a hush: fix $ expansion in redirections, add testcase for that 2007-11-23 21:08:38 +00:00
Denis Vlasenko
835068637e hush: implement test builtin 2007-11-23 13:11:42 +00:00
Denis Vlasenko
f962a0354e hush: plug memory leak 2007-11-23 12:50:54 +00:00
Denis Vlasenko
7d75a96b15 ash: fix bug where redirection of closed fd was leaving it open afterwards.
redirect                                             983    1024     +41
bb_echo                                              276     301     +25
popredir                                             118     132     +14
evalcommand                                         1163    1176     +13
bbunpack                                             358     366      +8
echocmd                                               13       5      -8
echo_main                                             13       5      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/2 up/down: 101/-16)            Total: 85 bytes
   text    data     bss     dec     hex filename
 774999     962    9236  785197   bfb2d busybox_old
 775084     962    9236  785282   bfb82 busybox_unstripped
2007-11-22 08:16:57 +00:00
Denis Vlasenko
a6899c3587 lash: fix compile-time warning 2007-11-15 17:47:45 +00:00
Denis Vlasenko
a59f435b5f ash: if tcgetattr(stdin) fails, don't mess with tcsetattr
ash: size-optimize ulimit's table of limits

   text    data     bss     dec     hex filename
 777345     974    9676  787995   c061b busybox_old
 777253     974    9676  787903   c05bf busybox_unstripped
2007-10-29 19:17:29 +00:00
Denis Vlasenko
037576d77b read_line_input: fix it to not do any fancy editing if echoing is disabled.
ash: make read handling both more correct and smaller

read_line_input                                     4037    4101     +64
input_backward                                       140     139      -1
readcmd                                             1079    1070      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 65/-10)             Total: 54 bytes
   text    data     bss     dec     hex filename
 777575    1000    9532  788107   c068b busybox_old
 777629    1000    9532  788161   c06c1 busybox_unstripped
2007-10-20 18:30:38 +00:00
Denis Vlasenko
0de37e10ed ash: use fdprintf, not dprintf.
*: trailing whitespace removed
2007-10-17 11:08:53 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
82d38dab91 get rid of global "struct bb_applet *current_applet" 2007-10-10 14:38:47 +00:00
Denis Vlasenko
41770226bb ash: revert "cat | jobs" fix, it causes more problems than good 2007-10-07 18:02:52 +00:00
Denis Vlasenko
0c97c9d437 'simple' error message functions by Loic Grenie <loic.grenie@gmail.com>.
263 bytes saved.
2007-10-01 11:58:38 +00:00
Denis Vlasenko
d65ea39ffc hush: fix glob() abuse. Code was making unfounded assumptions how
glob() works, and it broke horribly on specific uclibc config.
2007-10-01 10:02:25 +00:00
Denis Vlasenko
ff0976248a hush: int->smallint for flag vars; make some names more "greppable" 2007-10-01 10:00:45 +00:00
Denis Vlasenko
8412d7959a hush: feeble attempt at making it more NOMMU-friendly 2007-10-01 09:59:47 +00:00
Denis Vlasenko
a0898170d8 hush: stop doing manual acounting of open fd's, kernel can do it for us 2007-10-01 09:59:01 +00:00
Denis Vlasenko
96e1b38586 introduce and use close_on_exec_on(fd). -50 bytes. 2007-09-30 23:50:48 +00:00
Denis Vlasenko
6081868ee3 fix "if (p) free(p)" constructs 2007-09-28 22:07:23 +00:00
Denis Vlasenko
4daad9004d introduce bb_putchar(). saves ~1800 on uclibc (less on glibc). 2007-09-27 10:20:47 +00:00
Denis Vlasenko
46a530626d ash: fix prompt expansion (Natanael Copa <natanael.copa@gmail.com>) 2007-09-24 18:30:02 +00:00
Denis Vlasenko
818322b9b1 *: kill bb_get_last_path_component, replace with two functions
(one which strips trailing slash and one which does not)
wget: straighten out as a result of above change
   text    data     bss     dec     hex filename
   5056       1       0    5057    13c1 busybox.t4/networking/wget.o
   5022       0       0    5022    139e busybox.t5/networking/wget.o
2007-09-24 18:27:04 +00:00
Denis Vlasenko
7b70d78de8 ash: remove erroneously applied patch 2007-09-21 22:48:02 +00:00
Denis Vlasenko
f431017535 httpd: optional support for partial downloads 2007-09-21 22:35:18 +00:00
Denis Vlasenko
bcceb0c5a4 ash: s/int/smallint/. -60 bytes. 2007-09-21 18:06:20 +00:00
Denis Vlasenko
87f3b26b3a *: replace select-for-one descriptor with poll, it's smaller.
$ ./.cmk bloatcheck
function                                             old     new   delta
readit                                               406     364     -42
syslogd_main                                        1249    1206     -43
traceroute_main                                     4115    4060     -55
mysleep                                              112      45     -67
arpping                                              579     441    -138
tftp                                                1575    1182    -393
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-738)           Total: -738 bytes
   text    data     bss     dec     hex filename
 770580    1051   10764  782395   bf03b busybox_old
 769820    1051   10764  781635   bed43 busybox_unstripped
2007-09-07 13:43:28 +00:00
Denis Vlasenko
d37f22225b libbb,crond,lash: fix getopt32 (don't know how it managed to slip through)
*: fcntl(fd, F_GETFL) doesn't require third parameter at all.
2007-08-19 13:42:08 +00:00
Denis Vlasenko
fe7cd642b0 don't pass argc in getopt32, it's superfluous
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes
   text    data     bss     dec     hex filename
 773469    1058   11092  785619   bfcd3 busybox_old
 772644    1058   11092  784794   bf99a busybox_unstripped
2007-08-18 15:32:12 +00:00
Denis Vlasenko
6ca409e0e4 trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
  of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts

size saving: 0.5k
2007-08-12 20:58:27 +00:00
Denis Vlasenko
dee82b6b78 ash: comment non-obvious code part 2007-07-29 14:05:27 +00:00
Denis Vlasenko
b71c668c57 style fix (stray space before ';') 2007-07-21 15:08:09 +00:00
Denis Vlasenko
d4293c77f1 ash: fix SEGV in forkchild (jp can be NULL). here documents were affected. 2007-07-18 21:35:43 +00:00
Denis Vlasenko
bdc406d15d ash: make "jobs | cat" work like in bash (was giving empty output) 2007-07-15 01:13:25 +00:00
Denis Vlasenko
fcfaf2e18a ash: small size optimization
function                                             old     new   delta
makejob                                              263     270      +7
setjobctl                                            328     332      +4
jobscmd                                               96      94      -2
stoppedjobs                                           53      50      -3
jobctl                                                 4       1      -3
job_warning                                            4       1      -3
forkshell                                            644     641      -3
cmdloop                                              422     409     -13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/6 up/down: 11/-27)            Total: -16 bytes
   text    data     bss     dec     hex filename
 675392    2740   13968  692100   a8f84 busybox_old
 675380    2740   13968  692088   a8f78 busybox_unstripped
2007-07-14 18:45:37 +00:00
Denis Vlasenko
8fdc4b7b06 ash: recognize -l as --login equivalent; do not recognize +-login 2007-07-14 11:33:10 +00:00
Denis Vlasenko
40ba9984fd ash: fix for buglet in DEBUG code (Nguyen Thai Ngoc Duy <pclouds@gmail.com>) 2007-07-14 00:48:29 +00:00
Denis Vlasenko
1fc6238ffa devfsd: fix formatting (Tito <farmatito@tiscali.it>)
ash: fix SEGV if type has zero parameters
2007-06-25 22:55:34 +00:00
Denis Vlasenko
80b8b39899 Consolidate ARRAY_SIZE macro; remove one unneeded global var (walter harms <wharms@bfs.de>) 2007-06-25 10:55:35 +00:00
Denis Vlasenko
b304eadca8 test: shrink a bit
function                                             old     new   delta
test_main                                              5     434    +429
bb_test                                              473       -    -473
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 429/-473)          Total: -44 bytes
   text    data     bss     dec     hex filename
 735073    3028   14408  752509   b7b7d busybox_old
 735029    3028   14408  752465   b7b51 busybox_unstripped
2007-06-21 13:35:52 +00:00
Denis Vlasenko
ca525b4f24 *: BB_BANNER -> bb_banner (it is not a const or #define)!
correct_password: explain in detail why it is ok to use bb_banner
fsck_minix: make it print bb version, not it's own (outdated/irrelevant) one

Marginal size difference:
   text    data     bss     dec     hex filename
 679119    2700   15632  697451   aa46b busybox_old
 679091    2700   15632  697423   aa44f busybox_unstripped
2007-06-13 12:27:17 +00:00
Denis Vlasenko
d67cef2425 hush: fix read builtin to not read ahead past eol and to not use
insane amounts of stack. Testsuite updated.
2007-06-13 06:47:47 +00:00
Denis Vlasenko
f5f75c5e82 remove nearly-duplicate PATHs in several places
function                                             old     new   delta
bb_PATH_root_path                                      -      35     +35
varunset                                              60      58      -2
arith                                               2042    2033      -9
bb_default_root_login_path                            30       -     -30
.rodata                                           128794  128762     -32
which_main                                           152     117     -35
defpathvar                                            40       -     -40
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 0/4 up/down: 35/-148)          Total: -113 bytes
2007-06-12 22:35:19 +00:00
Denis Vlasenko
15611bb958 A few more string duplicates found & eliminated
# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 679693    2700   15632  698025   aa6a9 busybox_old
 679523    2700   15632  697855   aa5ff busybox_unstripped
2007-06-12 08:52:02 +00:00
Denis Vlasenko
bdbbb7ec49 make busybox --install work even if /proc/self/exe doesn't exist
# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 680095    2704   15648  698447   aa84f busybox_old
 680099    2704   15648  698451   aa853 busybox_unstripped
2007-06-08 15:02:55 +00:00
Denis Vlasenko
42bffbf360 hush: add missing dependencies (Maxime Bizon <mbizon@freebox.fr> (Freebox)) 2007-06-08 08:02:53 +00:00
Denis Vlasenko
fad2b86c9e use "glibc errno" trick not only for ash, but for entire busybox
(add/remove: 1/1 grow/shrink: 37/37 up/down: 139/-228)        Total: -89 bytes
2007-05-31 22:16:38 +00:00
Denis Vlasenko
27f79ff03d hush: trivial buglet found by randomconfig testing 2007-05-30 00:55:52 +00:00
Denis Vlasenko
4b924f3a5c whitespace fixes 2007-05-30 00:29:55 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
5a6aeddfa7 xpipe: introduce (saves ~170 bytes)
udhcp/signalpipe.c: use pipe instead of socketpair.
2007-05-26 16:44:20 +00:00
Denis Vlasenko
ba7cf260fd hush: fix 'echo abcsleep 5def' + Ctrl-Z and Ctrl-C bugs. +50 bytes of code. 2007-05-25 14:34:30 +00:00
Denis Vlasenko
0a83fc3984 hush: avoid duplicating HUSH_VERSION 2007-05-25 11:12:32 +00:00
Denis Vlasenko
201c72a8d6 hush: micro-optimization in new variable code 2007-05-25 10:00:36 +00:00
Denis Vlasenko
28c0f0f4fe hush: we can't do without variable->value member, saving 25 bytes of code
and some runtime memory. Rename few variables.
2007-05-25 02:46:01 +00:00
Denis Vlasenko
d76c049cc4 hush: rework variable storage and environment handling.
More that -100 bytes of code + memory leak plugged.
Added a testcase for it.
2007-05-25 02:16:25 +00:00
Denis Vlasenko
163a855731 hush: update README with yet another failure case 2007-05-24 13:52:46 +00:00
Denis Vlasenko
5a1437d835 hush: fix segfaulting syntax error in interactive hush 2007-05-24 13:22:47 +00:00
Denis Vlasenko
cd7f4d27a2 hush: improve 2 testsuite tests 2007-05-24 13:22:01 +00:00
Denis Vlasenko
2b6bbad4db hush: add 2 tests for correct syntax error reporting 2007-05-24 12:26:39 +00:00
Denis Vlasenko
b055001b6a hush: fix handling of unmatched ${name (without closing '}') -
was eating all remaining input, potentially megabytes.
nofork: save/restore die_jmp too
nofork: use -2222 instead of -111 as "special" return valur for zero
(-111 is used by some applets. -2222 won't fit in exitcode and thus safer)
2007-05-24 12:18:16 +00:00
Denis Vlasenko
90e485ce79 hush: make syntax error messages a bit more useful 2007-05-23 15:22:50 +00:00
Denis Vlasenko
1744cb1861 hush: prepare testsuite for new, fixed error message format 2007-05-23 15:16:41 +00:00
Denis Vlasenko
170435c575 hush: fix job control with eval /bin/external_prog
hush: fix parsing of unterminated "str with no EOL
hush: improved make_string() (smaller, faster, needs less RAM)
hush: renamed several functions
2007-05-23 13:01:10 +00:00
Denis Vlasenko
1a7358612f hush: fix a bit different instance of "No EOL" bug,
add testsuite for that. Expand another testsuite.
2007-05-23 00:32:25 +00:00
Denis Vlasenko
94dace3016 fix execute bit on hush-misc/shift.tests 2007-05-23 00:26:32 +00:00
Denis Vlasenko
0681033918 hush: add 3 CONFIG_xxx, allowing for smaller and less capable hush.
Minimal hush is ~9k now (lash is ~7k).
2007-05-21 23:30:54 +00:00
Denis Vlasenko
8805eeb44a shells: update README and testsuite. environment memory leak
needs to be fixed - and documented!
2007-05-21 10:19:48 +00:00
Denis Vlasenko
219e88d050 hush: using smallints where we can. save ~20 bytes in code and
some data storage at runtime.
2007-05-21 10:18:23 +00:00
Denis Vlasenko
004baba2d6 hush: fix shift + $0 bug; add testcase 2007-05-20 22:22:18 +00:00
Denis Vlasenko
262d765351 hush: trivial size optimization 2007-05-20 21:52:49 +00:00
Denis Vlasenko
14b5dd9943 hush: make process substitution configurable; add a testcase 2007-05-20 21:51:38 +00:00
Denis Vlasenko
46846e25a4 ash: implement type -p, costs less than 10 bytes
(patch by Mats Erik Andersson <mats.andersson64@comhem.se>)
2007-05-20 13:08:31 +00:00
Denis Vlasenko
6d709972cd cttyhack: new applet. 2007-05-18 09:45:36 +00:00
Denis Vlasenko
5b34083004 several *.c files:
move 'extern environ' up to the location of #includes
2007-05-17 23:02:14 +00:00
Denis Vlasenko
c8be5ee325 hush: do "struct globals" trick. hush.o data+bss = 0 bytes now.
+60 bytes to image, but -8000 bytes in bss.
2007-05-17 15:38:46 +00:00
Denis Vlasenko
b6a741ffa7 hush: consolidated variable expansion for assignments and "normal" one.
-435 bytes. Tested against testsuite.
2007-05-17 14:38:17 +00:00
Denis Vlasenko
96f67dc69d more compile fixes from randomconfig run 2007-05-17 13:02:41 +00:00
Denis Vlasenko
c666f71e3b hush: take care of several easy FIXMEs. -228 bytes. 2007-05-16 22:18:54 +00:00
Denis Vlasenko
831dcc439c hush: another microscopic typo fix 2007-05-16 15:05:36 +00:00
Denis Vlasenko
c29903221d hush: fix English in comment 2007-05-16 12:57:12 +00:00
Denis Vlasenko
3e7b0e6120 hush: simplify read builtin; fix set_local_var (misplaced 'goto skip;') 2007-05-16 12:52:15 +00:00
Denis Vlasenko
1f4cf517f5 hush: fix expansion of quoted $VAR, $* and $@ 2007-05-16 10:39:24 +00:00
Denis Vlasenko
8f6bdb42df hush: fix incorrect processing of echo "'$var'".
hush: rename map[] and MAP_xxx, making them easier to understand.
hush: move testcase (which now passes) from hush-bugs to hush-parsing
2007-05-16 09:36:55 +00:00
Denis Vlasenko
d6050949b8 hush: move testsuite files from hush-bugs to hush-parsing
(as these bugs are now fixed)
2007-05-14 22:09:52 +00:00
Denis Vlasenko
764d59d488 hush: more fixes to variable expansion, more testcases 2007-05-14 16:23:23 +00:00
Denis Vlasenko
03eb8bf6ce hush: move towards more correct variable expansion
hush: fix a few cases in FOR v IN ... construct
      unfortunately, code growth is big - ~600 bytes
2007-05-14 16:19:34 +00:00
Denis Vlasenko
602d13cba5 hush: fix '{ false; echo $?; }' bug.
hush: expand testsuite. variable expansion is still very broken
2007-05-13 18:34:53 +00:00
Denis Vlasenko
119b995437 hush: reinstate hush_test, add testcases for process subst 2007-05-11 12:57:35 +00:00
Denis Vlasenko
3e9aaae5dc hush: fix bug in interactive shell introduced yesterday
hush: fix `process subst` (2 bugs)
NB: will delete and re-add hush_test in order to change file modes
2007-05-11 12:56:43 +00:00
Denis Vlasenko
e0a336747c hush: fix "unterminated last line loops forever" bug
hush: add testsuite infrastructure
2007-05-10 23:06:55 +00:00
Denis Vlasenko
53079d494e hush: fix recent breakage (VAR=VAL stopped working) 2007-05-10 23:05:28 +00:00
Denis Vlasenko
2b54aaa9bf msh: fix obscure case with backticks and closed fd 1 2007-05-09 22:16:08 +00:00
Denis Vlasenko
92c0b8222e tail: fix SEGV on "tail -N"
config system: clarify PREFER_APPLETS/SH_STANDALONE effects in help text
2007-05-08 17:27:17 +00:00
Denis Vlasenko
21f0d4c55e hush: fix double-free in "echo TEST &" 2007-05-06 14:15:42 +00:00
Denis Vlasenko
dd4cb2b31e hush: stop generating extra empty pipes in parse stage. 2007-05-05 15:11:40 +00:00
Denis Vlasenko
a6c467f6d1 hush: preparatory patch for removing extra empty pipes generation
in parse stage. No real code change here.
2007-05-05 15:10:52 +00:00
Denis Vlasenko
ac0e5ab96a hush: fix "while true; do true; done" + ctrl-z 2007-05-04 21:37:27 +00:00
Denis Vlasenko
3349fc4da9 applets: fix compile-time warning 2007-05-04 14:54:36 +00:00
Denis Vlasenko
400c5b6fc6 hush: add parse tree debug print 2007-05-04 13:07:27 +00:00
Denis Vlasenko
e725bfe6e0 hush: fix "true | exit 3; echo $?" bug 2007-05-03 22:45:39 +00:00
Denis Vlasenko
f2fffd0014 hush: remove env builtin (it is buggy). Add comments 2007-05-02 23:39:04 +00:00
Denis Vlasenko
d01ff13454 hush: simplify debugging prints a little bit 2007-05-02 21:40:23 +00:00
Denis Vlasenko
4ac530c0ef hush: add debugging for tracing execution,
add FIXME for 'true | exit 3; echo $?' case
2007-05-02 15:35:45 +00:00
Denis Vlasenko
ef36ead370 hush: fix incorrect exitcodes without job control 2007-05-02 15:34:47 +00:00
Denis Vlasenko
f20de5bb42 ash,kill: use common code for kill applet/builtin
# make bloatcheck
function                                             old     new   delta
evaltreenr                                           644     654     +10
evaltree                                             644     654     +10
parse_conf                                          1440    1444      +4
dpkg_deb_main                                        426     429      +3
ed_main                                             3319    3321      +2
passwd_main                                         2093    2091      -2
kill_main                                            830     826      -4
singlemount                                         4609    4601      -8
find_command                                         962     954      -8
get_lcm                                              123     105     -18
.rodata                                           132243  132147     -96
killcmd                                              449     120    -329
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/7 up/down: 29/-465)          Total: -436 bytes

# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 723901    2940   27504  754345   b82a9 busybox_old
 723457    2940   27504  753901   b80ed busybox_unstripped
2007-04-29 23:42:54 +00:00
Denis Vlasenko
08c8c1d3b3 ash: fix infinite loop on exit if tty is not there anymore 2007-04-28 22:39:02 +00:00
Denis Vlasenko
e3f2f89891 hush: make job control and interactiveness configurable, part 2 2007-04-28 16:48:27 +00:00
Denis Vlasenko
b81b3df1fa hush: make job control and interactiveness configurable, part 1 2007-04-28 16:48:04 +00:00
Denis Vlasenko
0937be5fa6 hush: make hush properly detect EOF on stdin (even interactive one -
think about pty being destroyed) and exit.
2007-04-28 16:47:08 +00:00
Denis Vlasenko
b5eaabb322 hush: add Ctrl-C handling to nofork case 2007-04-28 16:45:59 +00:00
Denis Vlasenko
3ac0e00553 hush: better signal handling across ctrl-z 2007-04-28 16:45:22 +00:00
Denis Vlasenko
18e19f2b0d hush: fix nofork + ctrl-Z clobbering of globals 2007-04-28 16:43:18 +00:00
Denis Vlasenko
a6a1785a30 hush: add ctrl-Z handling for nofork'ed case 2007-04-28 16:42:11 +00:00
Denis Vlasenko
1359da6ac7 hush: make Ctrl-Z work (at least sometimes) 2007-04-21 23:27:30 +00:00
Denis Vlasenko
762d35c75f hust: add a comment 2007-04-21 17:28:51 +00:00
Denis Vlasenko
52881e9f23 hush: fix more backgrounding bugs. Plenty of them remains still. 2007-04-21 13:42:52 +00:00
Denis Vlasenko
2f1bb36a55 hush: explain why "pipe; exit $?" doesn't show correct exitcode 2007-04-21 10:01:14 +00:00
Denis Vlasenko
87cb2db703 hush: do not print message if killed by signal;
move some functions up before main()
2007-04-21 10:00:01 +00:00
Denis Vlasenko
54e7ffb3a4 hush: begin fixing non-functional job control 2007-04-21 00:03:36 +00:00
Denis Vlasenko
5f786c24e4 hush: small code shrink; style fixes 2007-04-20 08:35:45 +00:00
Denis Vlasenko
d1801a4430 dd: fix skip= parse error (spotted by Dirk Clemens <develop@cle-mens.de>) 2007-04-19 20:08:19 +00:00
Denis Vlasenko
05a6d9cbb2 doc: add README on shell job control 2007-04-19 17:26:34 +00:00
Denis Vlasenko
516a0ca2dc ps: add -o tty and -o rss support
1373      14      24    1411     583 busybox.t1/procps/ps.o
   1462      14      24    1500     5dc busybox.t2/procps/ps.o
2007-04-19 14:46:14 +00:00
Denis Vlasenko
55b2de71d7 hush: remove stray semicolon (should change nothing) 2007-04-18 17:21:28 +00:00
Denis Vlasenko
7d4c44e1b1 shells: remove few statics and duplicated code
(much more of the same remains, alas)
function                                             old     new   delta
doset                                                330     332      +2
warn                                                  53      51      -2
onecommand                                           463     461      -2
ioecho                                                40      38      -2
forkexec                                            1412    1410      -2
err                                                   81      79      -2
setdash                                               59      56      -3
flag                                                   4       -      -4
msh_main                                            1389    1384      -5
eval                                                 388     381      -7
subgetc                                              759     747     -12
static.local                                          14       -     -14
b_adduint                                             70      52     -18
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/10 up/down: 2/-73)            Total: -71 bytes
2007-04-16 22:34:39 +00:00
Denis Vlasenko
ac678ec2f1 style fixes, no code changes 2007-04-16 22:32:04 +00:00
Denis Vlasenko
e471275813 msh: style fixes
shell/README - a place to record things about busybox shells
2007-04-14 15:08:41 +00:00
Denis Vlasenko
5f9468e996 lineedit: nuke two unused variables and code which sets them
applets: do not even try to read config if run by real root
msh: use named constants (O_RDONLY etc) in open() instead of magic numbers,
     other minor code size reduction.
2007-04-14 13:22:09 +00:00
Denis Vlasenko
8a28e620ce lash: recognize and use NOFORK applets
lash,hush: fix kill buglet (didn't properly recognize ESRCH)
2007-04-14 11:16:29 +00:00
Denis Vlasenko
f5294e1f4c hush: use NOFORK applets as appropriate. Net reduction of code size. 2007-04-14 10:09:57 +00:00
Denis Vlasenko
16abcd90ae teach find_root_device to deal with /dev/ subdirs
(by "Kirill K. Smirnov" <lich@math.spbu.ru>)
2007-04-13 23:59:52 +00:00
Denis Vlasenko
fbf6dea5a2 hush: more style fixes. 2007-04-13 19:56:56 +00:00
Denis Vlasenko
f03dbeda90 hush: comment out and replace bug in set_local_var:
-       if (value == 0 && ++value == 0) {
+       /*if (value == 0 && ++value == 0) ??? -vda */
+       if (value == NULL || value[1] == '\0') {

Style fixes.
2007-04-13 19:55:50 +00:00
Denis Vlasenko
b636d8c18c shell/: add SUSv3 doc for fast & easy reference 2007-04-13 19:44:22 +00:00
Denis Vlasenko
b69f35effe lash: "forking" applets are actually can be treated the same way as "non-forked".
Also save a bit of space on trailing NULL array elements.
2007-04-12 17:10:45 +00:00
Denis Vlasenko
7cced6e574 fix realloc-of-non-malloced pointer, and reduce size while at it 2007-04-12 17:08:53 +00:00
Denis Vlasenko
831a20f512 pass a copy of argv[i] to NOFORK applets (they may permute it etc).
set/save/restore more shared global variables whan call one applet from another
2007-04-12 12:27:32 +00:00
Denis Vlasenko
51742f4bb0 style fixes. No code changes 2007-04-12 00:32:05 +00:00
Denis Vlasenko
50f7f446ec bb_full_fd_action: remove potential xmalloc from NOFORK path
cat: stop using stdio.h opens
libbb: introduce & use open[3]_or_warn
function                                             old     new   delta
open3_or_warn                                          -      54     +54
bb_cat                                               115     144     +29
open_or_warn                                           -      25     +25
unlzma                                              2404    2412      +8
chattr_main                                          334     339      +5
xstrtoul_range_sfx                                   251     255      +4
telnet_main                                         1514    1510      -4
static.opt                                             4       -      -4
qgravechar                                           122     118      -4
fuser_add_pid                                         61      54      -7
fuser_add_inode                                      154     147      -7
writeFileToTarball                                  1542    1534      -8
refresh                                             1156    1148      -8
do_show                                              856     846     -10
read_leases                                          212     200     -12
setup_redirects                                      236     222     -14
iproute_list_or_flush                               1582    1568     -14
read_config                                          427     411     -16
write_leases                                         284     264     -20
hash_file                                            338     318     -20
copy_file                                           1760    1740     -20
do_iproute                                          2610    2588     -22
bb_full_fd_action                                    320     269     -51
open_to_or_warn                                      103      49     -54
fuser_main                                          1660    1596     -64
.rodata                                           131160  131096     -64
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 4/19 up/down: 125/-423)        Total: -298 bytes
2007-04-11 23:20:53 +00:00
Denis Vlasenko
d7c8196c1b ash: fix kill -l (by Mats Erik Andersson <mats.andersson64@comhem.se>) 2007-04-11 20:43:31 +00:00
Denis Vlasenko
6398cf477d style fixes, no code changes. 2007-04-11 17:04:29 +00:00
Denis Vlasenko
e4f2d064b0 rename: run_applet_by_name -> run_applet_and_exit 2007-04-11 17:03:19 +00:00
Denis Vlasenko
80d14beae9 Rename two config options:
FEATURE_SH_STANDALONE_SHELL => FEATURE_SH_STANDALONE
FEATURE_EXEC_PREFER_APPLETS => FEATURE_PREFER_APPLETS
Make SH_STANDALONE depend on PREFER_APPLETS.
getopt.c: more randomconfig-induced fixes
2007-04-10 23:03:30 +00:00
Denis Vlasenko
335b63d8d1 make a few struct bb_applet members conditional
rename sllep_and_die -> xfunc_die
make fflush_stdout_and_exit NOFORK-safe
fix some buglets found by randomconfig
2007-04-10 21:38:30 +00:00
Denis Vlasenko
ff131b980d style fixes. No code changes. 2007-04-10 15:42:06 +00:00
Bernhard Reutner-Fischer
de17ece1db - use skip_non_whitespace() where appropriate 2007-04-10 09:38:35 +00:00
Denis Vlasenko
c44ab01b75 Improve STANDALONE_SHELL. "safe" applets are renamed NOEXEC applets
and now this fact is recorded in applets.h, not ash.c.

Several fixes to "--help + STANDALONE_SHELL" scenarios.

function                                             old     new   delta
run_current_applet_and_exit                            -     355    +355
arith                                               2064    2073      +9
refresh                                             1148    1156      +8
getopt32                                            1068    1073      +5
telnet_main                                         1510    1514      +4
md5_sha1_sum_main                                    565     566      +1
xstrtoul_range_sfx                                   255     251      -4
packed_usage                                       22523   22514      -9
tryexec                                              255     203     -52
static.safe_applets                                  152       -    -152
.rodata                                           131320  131128    -192
run_applet_by_name                                   869     506    -363
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 5/5 up/down: 382/-772)         Total: -390 bytes

./busybox ash -c 'i=20000; while test $i != 0; do touch z; i=$((i-1)); done'
runs more than twice as fast with STANDALONE_SHELL versus without.
2007-04-09 03:11:58 +00:00
Denis Vlasenko
95cb3263ae msh: smallish code shrinkage; cosmetics 2007-04-09 03:06:34 +00:00
Denis Vlasenko
240a1cfbbe add some missed statics on constant objects.
fix few #ifndef ENABLE_xxx

# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 677152    2920   18208  698280   aa7a8 busybox_old
 676420    2920   18208  697548   aa4cc busybox_unstripped
2007-04-08 16:07:02 +00:00
Bernhard Reutner-Fischer
febe3c4211 - sed -e "s/char[[:space:]]*\*[[:space:]]*argv\[\]/char **argv/g" 2007-04-04 20:52:03 +00:00
Denis Vlasenko
f443bffd3c lash: make -c work; crush buffer overrun and free of non-malloced ptr
(from Mats Erik Andersson <mats.andersson64@comhem.se>)
2007-03-31 11:08:50 +00:00
Denis Vlasenko
6fa8b8e17f lash: style cleanup 2007-03-31 11:07:30 +00:00
Denis Vlasenko
10457b90db make pidfile writing configurable.
[ui]toa_to_buf: change API. No users yet.
2007-03-27 22:01:31 +00:00
Denis Vlasenko
55f30b05ac inetd,ed,msh: data/bss reduction (in mss, more than 9k of it) 2007-03-24 22:42:29 +00:00
Denis Vlasenko
219d14d514 random style fixes (extra spaces deleted) 2007-03-24 15:40:16 +00:00
Denis Vlasenko
5b27fbe990 dc: use common_bufsiz1 for evaluation stack
msh: fix "underscore bug" (a_b=1111 didn't work)
dnsd: openlog(), so that applet's name is logged
2007-03-24 14:06:51 +00:00
Denis Vlasenko
7c139b4778 ash: fix signal handling 2007-03-21 20:17:27 +00:00
Denis Vlasenko
c86e052b81 fix accumulated whitespace and indentation damage 2007-03-20 11:30:28 +00:00
Denis Vlasenko
93ebd4f58d ash: popstackmark is reported trying to pop until NULL
is seen (which isn't possible), prevent this.
2007-03-13 20:55:36 +00:00
Mike Frysinger
67a32adbca add STANDALONE support 2007-03-09 08:25:24 +00:00
Denis Vlasenko
8e858e2700 clean up accumulated whitespace damage 2007-03-07 09:35:43 +00:00
Denis Vlasenko
9431e564aa ash: "here document" testcases 2007-03-05 21:08:29 +00:00
Denis Vlasenko
140644dc1c add ash testcases 2007-03-05 20:46:46 +00:00
Denis Vlasenko
1c660b4bd2 small ash testsuite, adapted from bash
(only a small part of it, actually)
2007-03-05 00:27:50 +00:00
Denis Vlasenko
3af3e5b4b0 ash: cosmetic improvements in error messages 2007-03-05 00:24:52 +00:00
Denis Vlasenko
29e31ddd81 ash: do not use "safe applets" in non-standalone shell 2007-03-03 23:12:17 +00:00
Denis Vlasenko
4222ae440a ash: replace xstrdup (shell shall not die)
grep: fix mis-indented block
2007-02-25 02:37:49 +00:00
Denis Vlasenko
5276402f2c ash: fix compile problems 2007-02-24 13:42:56 +00:00
Denis Vlasenko
f98dc4db7a ash: cleanup part 2.8 2007-02-23 21:11:02 +00:00
Denis Vlasenko
0dec6de38b ash: cleanup part 2.7 2007-02-23 21:10:47 +00:00
Denis Vlasenko
cc5715184b ash: cleanup part 2.6 2007-02-23 21:10:35 +00:00
Denis Vlasenko
2de3d9fbee ash: cleanup part 2.5 2007-02-23 21:10:23 +00:00
Denis Vlasenko
a89150733a ash: cleanup part 2.4 2007-02-23 21:10:06 +00:00
Denis Vlasenko
99eb8500c9 ash: cleanup part 2.3 2007-02-23 21:09:49 +00:00
Denis Vlasenko
fc06f2968b ash: cleanup part 2.2 2007-02-23 21:09:35 +00:00
Denis Vlasenko
5651bfc204 ash: starting second round of cleanups. #1 2007-02-23 21:08:58 +00:00
Denis Vlasenko
bc54cffc83 ash: cleanup part 9 2007-02-23 01:05:52 +00:00
Denis Vlasenko
4d2183bee1 ash: cleanup part 8 2007-02-23 01:05:38 +00:00
Denis Vlasenko
4fe15f3d9e ash: cleanup part 7 2007-02-23 01:05:26 +00:00
Denis Vlasenko
a6704933dd ash: cleanup part 6 2007-02-23 01:05:15 +00:00
Denis Vlasenko
5c67e3ed90 ash: cleanup part 5 2007-02-23 01:05:03 +00:00
Denis Vlasenko
fe1f00a7a7 ash: cleanup part 4 2007-02-23 01:04:50 +00:00
Denis Vlasenko
9650f36210 ash: cleanup part 3 2007-02-23 01:04:37 +00:00
Denis Vlasenko
aa74445514 ash: cleanup part 2 2007-02-23 01:04:22 +00:00
Denis Vlasenko
0c032a49b9 ash: cleanup part 1 2007-02-23 01:03:40 +00:00
Denis Vlasenko
a624c11d5e ash: move ash_main() and helpers to end of ash.c, more fuctions renamed,
superfluous casts from memory allocators removed
2007-02-19 22:45:43 +00:00
Denis Vlasenko
2da584fc4e ash: more renaming and style fixes 2007-02-19 22:44:05 +00:00
Denis Vlasenko
b012b10dbd ash: rearrange code to reduce forward references, rename some functions 2007-02-19 22:43:01 +00:00
Denis Vlasenko
e5570da2cf ash: tiny style fixes 2007-02-19 22:41:55 +00:00
Denis Vlasenko
5cedb75aa7 ash: de-obfuscate code, add 'static' keyword, etc. 2007-02-18 19:56:41 +00:00
Denis Vlasenko
131ae177a7 ash: convert #ifdef CONFIG_ to #if ENABLE_ 2007-02-18 13:00:19 +00:00
Denis Vlasenko
a0f82e928a ash: fix indentation and style. no code changes 2007-02-18 12:35:30 +00:00
Denis Vlasenko
6ca0444420 syslogd: fix "readpath bug" by using readlink instead
libbb: rename xgetcwd and xreadlink
2007-02-11 16:19:28 +00:00
Denis Vlasenko
d244c5eaf8 msh: fix my buglet 2007-02-09 17:30:14 +00:00
Denis Vlasenko
cf787cf3a5 find: support for ! 2007-02-04 17:11:25 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
4c97863109 assorted fixes for bugs found with randomconfig 2007-02-03 03:31:13 +00:00
Denis Vlasenko
1e3b068689 msh: cleaning up for -Wwrite-strings part #4 2007-02-01 01:43:54 +00:00
Denis Vlasenko
6b50f73171 msh: cleaning up for -Wwrite-strings part #3 2007-02-01 01:43:39 +00:00
Denis Vlasenko
489f93ebae msh: cleaning up for -Wwrite-strings part #2 2007-02-01 01:43:16 +00:00
Denis Vlasenko
00ccf95bc8 msh: cleaning up for -Wwrite-strings 2007-02-01 01:39:24 +00:00
Denis Vlasenko
71d8abf30c lash: -Wwrite-strings fixes 2007-01-30 22:44:07 +00:00
Denis Vlasenko
bb81c5831a hush: style fixes 2007-01-30 22:32:09 +00:00
Denis Vlasenko
c72c1ed932 hush: now it's -Wwrite-strings clean 2007-01-30 22:31:26 +00:00
Denis Vlasenko
0c886c65de hush: style fixes 2007-01-30 22:30:09 +00:00
Denis Vlasenko
15d78fb724 hust: -Wwrite-strings fixes 2007-01-30 22:28:21 +00:00
Bernhard Reutner-Fischer
eb10e17b7b - improve spelling 2007-01-29 23:56:13 +00:00
Denis Vlasenko
b6aae0f381 preparatory patch for -Wwrite-strings #2 2007-01-29 22:51:25 +00:00
Denis Vlasenko
703e20235a cleanups: unnecessary casts, unified const_1, eliminate cross-.c file
prototypes (heresy!), add spaces in places like "flags&NETSTAT_CONNECTED",
removed unused #defines, #ifdef -> #if, use uint32_t for ipv4 addrs.
2007-01-22 14:12:08 +00:00
Denis Vlasenko
95fef7071e move shell/cmdedit.c -> libbb/lineedit.c 2007-01-22 09:03:42 +00:00
Denis Vlasenko
38f6319421 cmdedit is not a 'command' editing anymore, it's just editing (generic),
so rename stuff accordingly.
2007-01-22 09:03:07 +00:00
Denis Vlasenko
253ce00296 cmdedit: fix breakage 2007-01-22 08:34:44 +00:00
Denis Vlasenko
b01b4e2a1f cmdedit.h: remove 2007-01-22 08:17:14 +00:00
Denis Vlasenko
6258fd3454 cmdedit: stop playing dirty games with atexit 2007-01-22 07:30:26 +00:00
Denis Vlasenko
8e1c71529c Convert cmdedit into more generic line input facility
(make history and completion optional at runtime).
Use it for fdisk, as an example.
Some unrelated fixes in fdisk are also here.
2007-01-22 07:21:38 +00:00
Denis Vlasenko
00cdbd8fc2 Introduce FEATURE_EDITING_FANCY_KEYS, so that user can disable
less-known keys (e.g. Ctrl-B/E/F)
2007-01-21 19:21:21 +00:00
Denis Vlasenko
5592fac308 cmdedit: more optimizations 2007-01-21 19:19:46 +00:00
Denis Vlasenko
47bdb3ac48 cmdedit: small optimizations 2007-01-21 19:18:59 +00:00
Denis Vlasenko
82b39e83ab sanitize cmdedit a bit (group functions by task etc) 2007-01-21 19:18:19 +00:00
Denis Vlasenko
2f0c0d0b88 Introduce FEATURE_EXEC_PREFER_APPLETS = "re-execute our own
executable if we asked to exec someting with argv[0] == known_applet"
Use it in init. Also respect PATH in init, remove explicit "/sbin" etc
from exec. Patch by Gabriel L. Somlo <somlo@cmu.edu>
2007-01-21 00:41:04 +00:00
Denis Vlasenko
9af7c9d6b6 openvt,getty,vfork_daemon_rexec,mount: tighten up fd cleanup code
(will close all fd's > 2 on daemonization now)
getty: fix "getty -" support, and also do not try to chown/chmod "-"
telnetd: fix "lost ctty" bug
Yet another attempt on saner function names:
bb_sanitize_server_stdio(0/1) -> bb_sanitize_stdio() + bb_daemonize();
2007-01-19 21:19:35 +00:00
Denis Vlasenko
7f0d7ae4f5 fix subtle bug inherited from dash 2007-01-18 01:12:57 +00:00
Denis Vlasenko
f7996f3b70 Trailing whitespace removal over entire tree 2007-01-11 17:20:00 +00:00
Denis Vlasenko
62a6983a81 execute "safe applets" exev if not standalone shell
(patch by "Eric Spakman" <E.Spakman@inter.nl.net>)
2007-01-10 00:24:50 +00:00
Denis Vlasenko
b2abef3e54 stty: fix width of a field for ppc32
sort: fix -u to match coreutils 6.3
msh: compile fix (my fault)
2007-01-01 18:18:04 +00:00
Denis Vlasenko
e27f15615f msh: double "static char line[LINELIM]" etc deleted.
massive amounts of assignments-in-ifs deleted
(some of which were VERY nasty)
2007-01-01 06:00:38 +00:00
Mike Frysinger
57ec574af7 * precision requires the argument be an integer, not size_t 2006-12-28 21:41:09 +00:00
Denis Vlasenko
8f27c34c28 ash: is_safe_applet mustn't affect disabled applets 2006-12-26 21:31:11 +00:00
Denis Vlasenko
666da5e2c6 merge post-1.3.0 fixes 2006-12-26 18:17:42 +00:00
Denis Vlasenko
bf0a201008 style fixes
last xcalloc replaced by xzalloc
2006-12-26 10:42:51 +00:00
Denis Vlasenko
0ee3999d13 random tiny size savings 2006-12-24 15:23:28 +00:00
Denis Vlasenko
f4dff77355 less: implement waiting for input using select(). Rather tricky business.
But we do not read entire input anymore up-front.
2006-12-24 07:14:17 +00:00
Denis Vlasenko
7e46cf748e #define FEATURE_GETUSERNAME_AND_HOMEDIR should be always #defined 2006-12-23 01:21:55 +00:00
Denis Vlasenko
4cccc03768 remove useless casts (type*) xzalloc(...) 2006-12-22 18:37:07 +00:00
Denis Vlasenko
afc9ff99fd removal of commented-out cruft 2006-12-22 00:45:27 +00:00
Denis Vlasenko
0a8a774179 cmdedit: reformat code a bit, no algorithm changes 2006-12-21 22:27:10 +00:00
Denis Vlasenko
d56b47f9a6 fix type character mixup in command completion 2006-12-21 22:24:46 +00:00
Denis Vlasenko
bf66fbc8e2 introduce LONE_CHAR (optimized strcmp with one-char string) 2006-12-21 13:23:14 +00:00
Denis Vlasenko
f58906b646 cmdedit: fix my bug, improve code a bit 2006-12-19 19:30:37 +00:00
Denis Vlasenko
7f1dc21a5d cmdedit: use qsort for sorting command completion results; style fixes 2006-12-19 01:10:25 +00:00
Denis Vlasenko
15b213ef5a su: make /etc/shells check configurable
ash: missing ';'
2006-12-19 00:20:20 +00:00
Denis Vlasenko
7cfecc4b36 xfuncs.c: dietlibc actually HAS fdprintf!
platform.h: define strchrnul for dietlibc
ash: stop using few non-standard functions
2006-12-18 22:32:45 +00:00
Denis Vlasenko
83e5d6f772 A bunch of defined(__GLIBC__) added. static-linking warning expanded 2006-12-18 21:49:06 +00:00
Denis Vlasenko
9f739445cd inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid] 2006-12-16 23:49:13 +00:00
Denis Vlasenko
097c324f59 fix remaining survivors of the return(a) cleanup 2006-11-27 16:59:15 +00:00
Denis Vlasenko
d9e15f2068 style cleanup: return(a) -> return a, part 2 2006-11-27 16:49:55 +00:00
Denis Vlasenko
079f8afa0a style cleanup: return(a) -> return a, part 1 2006-11-27 16:49:31 +00:00
Denis Vlasenko
d398ecab9d hunt down improper include <>, make mkswap output 4Gb+ friendly 2006-11-24 15:38:03 +00:00
Denis Vlasenko
fcdb00f735 httpd: LC_TIME locale _must_ be POSIX to httpd! We speak over the net! 2006-11-21 00:09:37 +00:00