Commit Graph

11895 Commits

Author SHA1 Message Date
Denys Vlasenko
5b686cb8e6 hush: replace flag bytes in struct o_string with bit flags
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-08 13:44:34 +02:00
Denys Vlasenko
9b78255dca hush: remove unused enum typedef
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-08 13:33:26 +02:00
Denys Vlasenko
1fd3d94a6c hush: fix set -- q w e; (IFS='' echo "$*"; IFS=''; echo "$*"); echo "$*"
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-08 13:31:53 +02:00
Denys Vlasenko
b103fb10cf nc: show help text on bad parameters
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 18:41:56 +02:00
Denys Vlasenko
d55f599440 lineedit: do not hang on error, but return error indicator.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 18:40:53 +02:00
Denys Vlasenko
8b2f13d84d shell: unify endofname() in hush and ash
function                                             old     new   delta
builtin_umask                                        132     133      +1
changepath                                           195     194      -1
expand_and_evaluate_arith                             77      69      -8
ash_arith                                            143     135      -8
expand_one_var                                      1551    1515     -36
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 1/-53)             Total: -52 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 12:19:33 +02:00
Denys Vlasenko
27c56f1267 hush: a few relatively trivial simplifications
function                                             old     new   delta
helper_export_local                                  130     135      +5
set_vars_and_save_old                                 89      85      -4
expand_variables                                     147     141      -6
get_ptr_to_local_var                                  77      70      -7
get_local_var_value                                  171     164      -7
delete_finished_bg_job                                31      16     -15
hush_exit                                            101      84     -17
free_pipe_list                                        31      12     -19
check_and_run_traps                                  232     205     -27
free_pipe                                            205     130     -75
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/9 up/down: 5/-177)           Total: -172 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 09:56:34 +02:00
Denys Vlasenko
da463fb007 hush: style cleanups. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 09:53:50 +02:00
Denys Vlasenko
f38b912fcf Again fix license line format
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 17:41:46 +02:00
Denys Vlasenko
571c5ab768 blockdev: code shrink
function                                             old     new   delta
blockdev_main                                        292     255     -37

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 17:37:52 +02:00
Denys Vlasenko
a35dfe6200 blockdev: make "blockdev --rereadpt /dev/sda EXTRA_ARG" complain. +6 bytes.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 16:31:18 +02:00
Denys Vlasenko
3d4a8f8646 made 3 license strings to follow the usual form ("or later" bit is not changed!)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 16:22:25 +02:00
Denys Vlasenko
264bdadb2c blockdev: -2 bytes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 15:34:15 +02:00
Denys Vlasenko
b4e6b41934 tweak blockdev's help text
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 14:15:46 +02:00
Denys Vlasenko
b1560000c7 tweak udhcpd help text
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 13:39:59 +02:00
Sergey Naumov
289aff8623 blockdev: new applet
function                                             old     new   delta
blockdev_main                                          -     287    +287
bdcommands                                             -     160    +160
packed_usage                                       27203   27298     +95
applet_names                                        2297    2306      +9
applet_main                                         1352    1356      +4
applet_nameofs                                       676     678      +2
applet_install_loc                                   169     170      +1
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 5/0 up/down: 558/0)             Total: 558 bytes

Signed-off-by: Sergey Naumov <sknaumov@gmail.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 13:35:58 +02:00
Denys Vlasenko
605067b426 hush: revert a recent buggy change which resulted in two HUSH_VERSIONs
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 12:10:51 +02:00
Denys Vlasenko
83b900fb82 fix typo in comment
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 11:47:55 +02:00
Denys Vlasenko
c3adfacd22 hush: fix another corner case with backslashes in heredocs
function                                             old     new   delta
parse_stream                                        2395    2432     +37

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 11:46:03 +02:00
Denys Vlasenko
77b32ccbf2 hush: fix backslash and terminator handling in <<[-]["]heredoc["]
function                                             old     new   delta
parse_stream                                        2339    2395     +56
expand_pseudo_dquoted                                104     118     +14
parse_stream_dquoted                                 296     300      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 74/0)               Total: 74 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 11:27:32 +02:00
Denys Vlasenko
c49d2d9793 hush: fix globbing+backslashes in unquoted $var expansion
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 10:26:37 +02:00
Denys Vlasenko
d383b49aef hush: remove disabled CMD_SINGLEWORD_NOGLOB_COND, rename o_glob->perform_glob
+ other small tweaks to comments and such

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 10:22:13 +02:00
Denys Vlasenko
96f064d416 shell: remove lash and bbsh
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 10:18:21 +02:00
Denys Vlasenko
e09bff3341 runit_lib: remove/inline a few more things
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 19:28:29 +02:00
Dan Fandrich
8d789e4197 tar: add a test for extraction of read-only directory
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 16:16:46 +02:00
Cristian Ionescu-Idbohrn
6957d79bd6 remove redundant ENABLE_DESKTOP in procps/ps.c
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 15:49:37 +02:00
Denys Vlasenko
b36abf2dfc hush: big reordering: move parser functions to the beginning. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 14:50:59 +02:00
Denys Vlasenko
38292b68c9 hush: rename o_quoted to has_quoted_part; small code shrink
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 14:49:40 +02:00
Denys Vlasenko
f2dc20c2d5 hush: move variable expansion into a separate function. No logic changes
function                                             old     new   delta
expand_one_var                                         -    1551   +1551
expand_vars_to_list                                 2833    1175   -1658
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 1551/-1658)       Total: -107 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 14:48:11 +02:00
Denys Vlasenko
36f774a0cd hush: add support for ${var/pattern/repl}, conditional on bash compat
function                                             old     new   delta
expand_vars_to_list                                 2386    2833    +447
expand_string_to_string                               69     110     +41
parse_dollar                                         681     721     +40
hush_main                                            963     945     -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 528/-18)           Total: 510 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 14:47:58 +02:00
Denys Vlasenko
701e127f7d hush: optimize #[#] and %[%] for speed. size -2 bytes.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-04 21:21:07 +02:00
Denys Vlasenko
e298ce69ba hush: fix handling of backslashes in variable assignment
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-04 19:52:44 +02:00
Denys Vlasenko
8ae6e9be5c lzop: fix misordered "v=NULL; free(v)", small code shrink
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-04 19:46:52 +02:00
Denys Vlasenko
0d7cb4cc9e fix false positive in testsuite/tar.tests
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 17:22:56 +02:00
Dan Fandrich
eb2bf5b6bf Fix some test cases
The tar tests still don't pass, but at least now it's because of
a problem with Busybox and not the tests themselves.

Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 17:09:51 +02:00
Denys Vlasenko
2ab3acb274 ifupdown: %client%, not %clientid%
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 16:58:37 +02:00
Denys Vlasenko
3926363214 lineedit: on tab completion, show filenames obly in all cases (bash compat)
function                                             old     new   delta
complete_cmd_dir_file                                731     730      -1

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 14:11:08 +02:00
Denys Vlasenko
76939e7b72 lineedit: allocate matchBuf only temporarily: saves MAX_LINELEN bytes
function                                             old     new   delta
input_tab                                           1027    1041     +14
build_match_prefix                                   590     562     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-28)            Total: -14 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 14:09:24 +02:00
Denys Vlasenko
ba0e103a66 lineedit: de-indent large block in input_tab. No logic changes.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 14:08:24 +02:00
Denys Vlasenko
a46e16ef52 lineedit: rename tmp -> chosen_match; small code shrink
function                                             old     new   delta
input_tab                                           1016    1012      -4

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 13:05:51 +02:00
Denys Vlasenko
9b56bf5416 lineedit: stop using permanent int_buf[] (16k!): allocate it
Now it is allocated temporarily only for the duretion of prefix generation,
and also we only allocate the needed size, not maximally possible.

function                                             old     new   delta
build_match_prefix                                   579     590     +11
remove_chunk                                          43      28     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 11/-15)             Total: -4 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 13:02:47 +02:00
Denys Vlasenko
81254ed387 lineedit: remove pos_buf[] array (up to 16k!); fix compat bugs
pos_buf is a strange hack, easy to do without it.
This also allows lines >32k long to be handled.
Also simplified match prefix generations and made behavior more like bash.

function                                             old     new   delta
remove_chunk                                           -      43     +43
collapse_pos                                          79       -     -79
build_match_prefix                                   804     579    -225
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 43/-304)          Total: -261 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 12:59:15 +02:00
Denys Vlasenko
3c460b005c lineedit: return prefix len from tab completion helpers
This kills horrific logic which deletes and re-adds prefix (!)

function                                             old     new   delta
complete_cmd_dir_file                                705     731     +26
complete_username                                    121     124      +3
input_tab                                           1041    1016     -25
build_match_prefix                                   838     804     -34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 29/-59)            Total: -30 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 12:56:36 +02:00
Denys Vlasenko
2679e3c8cc lineedit: clean up tab completion code (variable reuse, comments)
Noted bugs in behavior.
Added debugging machinery.
Decoupled variables reused for unrelated purposes: apparently,
when not forced to use liveness analysis, gcc fares better.

function                                             old     new   delta
complete_cmd_dir_file                                699     705      +6
collapse_pos                                          75      79      +4
build_match_prefix                                   892     838     -54
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 10/-54)            Total: -44 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 12:53:15 +02:00
Denys Vlasenko
57ea9b488b preparatory cleanup patch for tab completion fixes
renames and deinlines a few functions

function                                             old     new   delta
input_tab                                              -    1041   +1041
complete_cmd_dir_file                                  -     699    +699
complete_username                                      -     121    +121
username_completion                                  121       -    -121
read_line_input                                     5002    3313   -1689
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/1 up/down: 1861/-1810)         Total: 51 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 12:51:36 +02:00
Denys Vlasenko
7063e86d0d lineedit: small readability improvement (same code)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-02 12:44:39 +02:00
Denys Vlasenko
61a36af45d lineedit: fix completion with Unicode chars
function                                             old     new   delta
read_line_input                                     4966    5002     +36
bb_wcstombs                                          170     159     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 36/-11)             Total: 25 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-02 12:03:11 +02:00
Denys Vlasenko
b068bd7a41 lineedit: preparatory cleanup patch for Unicode completion fix
Some logic changes and function renames. The fix will follow this patch,
to mkae it distinct from cleanup.

function                                             old     new   delta
build_match_prefix                                     -     892    +892
username_completion                                    -     121    +121
read_line_input                                     4902    4966     +64
username_tab_completion                              235       -    -235
find_match                                           892       -    -892
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/0 up/down: 1077/-1127)        Total: -50 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-02 12:01:11 +02:00
Denys Vlasenko
7aa63042d0 libbb: xfunc_error_retval can be a byte
function                                             old     new   delta
xfunc_die                                             55      60      +5
log_and_exit                                          43      45      +2
hush_main                                            961     963      +2
xfunc_error_retval                                     4       1      -3
tty_main                                              87      84      -3
sv_main                                             1183    1180      -3
sort_main                                            804     801      -3
run_applet_no_and_exit                               440     437      -3
puts_maybe_newline                                   198     195      -3
nohup_main                                           228     225      -3
httpd_main                                           753     750      -3
get_header_tar                                      1496    1493      -3
fsck_minix_main                                     2972    2969      -3
expr_main                                            110     107      -3
cmp_main                                             641     638      -3
chat_main                                           1359    1356      -3
builtin_exit                                          48      45      -3
arping_main                                         1587    1584      -3
BB_EXECVP_or_die                                      47      44      -3
send_cgi_and_exit                                    901     895      -6
diff_main                                           1197    1191      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/18 up/down: 9/-60)            Total: -51 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-01 16:04:24 +02:00
Denys Vlasenko
6f80fe71f0 uudecode,base64: code shrink
function                                             old     new   delta
read_base64                                          373     358     -15

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-01 13:24:05 +02:00