Commit Graph

802 Commits

Author SHA1 Message Date
Lukas Huba
08187356d7 patch: implement -E option
Signed-off-by: Lukas Huba <Huba.Lukas@centrum.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-21 00:43:00 +02:00
Denys Vlasenko
e7599d1cc7 revert last change (wrong author)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-21 00:42:15 +02:00
Gilles Espinasse
f0c7e0c8d5 patch: implement -E option
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-21 00:39:46 +02:00
Denys Vlasenko
c05387d5de *: replace xopen3 with xopen where makes sense
function                                             old     new   delta
uniq_main                                            421     416      -5
sort_main                                            803     798      -5
patch_main                                          2051    2046      -5
cpio_main                                            547     542      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-18 02:38:27 +02:00
Denys Vlasenko
28458c64db awk: code shrink
function                                             old     new   delta
fsrealloc                                            112     107      -5
next_token                                           862     844     -18

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-05 16:49:03 +02:00
Denys Vlasenko
d527e0c81d awk: 00.123 is not a octal constant; neither is 009.123. fixing this
function                                             old     new   delta
my_strtod                                             80     113     +33

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-05 13:22:11 +02:00
Denys Vlasenko
cacb2cd281 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-05 00:13:02 +02:00
Rob Landley
9d113cac42 patch: tweaks
1) Eliminate spurious warnings about possibly reduced hunks.  Instead only
note a possible location if we don't find a non-reversed place to apply it.
(Otherwise, hunks that move code forward around within a file look reversed at
the removal site.)

2) Open the source file read-only, so we can apply patches to read-only files.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-04 00:49:48 +02:00
Marek Polacek
7dd61e3772 *: s/perror/bb_simple_perror_msg/g
function                                             old     new   delta
readLines                                            448     446      -2
doCommands                                          2449    2438     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-13)             Total: -13 bytes

Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 17:06:43 +02:00
Denys Vlasenko
25b4755302 typo fix in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-30 01:19:47 +02:00
Denys Vlasenko
e7b0a9e5bc patch: support "patch [FILE [PATCH]]" format
function                                             old     new   delta
xopen_stdin                                            -      15     +15
patch_main                                          2075    2041     -34

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-22 05:39:15 +02:00
Denys Vlasenko
cda815996b patch: fix -N regression
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-17 01:31:40 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
0d555fc951 sed: make N command behave as in GNU sed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 16:26:33 +02:00
Denys Vlasenko
a4160e15ec patch: add -N and a test for it (fails for now)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 01:33:57 +02:00
Denys Vlasenko
6373bb7740 patch: move closer to toybox code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-13 16:41:15 +02:00
Rob Landley
760d0ebbe5 patch: deal with ommitted ",len" in hunk headers (default len to 1)
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-13 16:40:21 +02:00
Rob Landley
1bbc0cd7f2 patch: replace it with toybox's implementation
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-13 15:50:26 +02:00
Denys Vlasenko
2e284a40bc sed: fix sed -i: unlike without -i, it does not forget ranges
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-01 04:14:46 +02:00
Denys Vlasenko
c5fb0ada9b vi: fix "ask terminal" code
function                                             old     new   delta
edit_file                                            761     793     +32
refresh                                              773     780      +7
query_screen_dimensions                               63      54      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-21 12:39:42 +02:00
Denys Vlasenko
75703eb8d5 diff: make diff -r much less eager to recurse into directories
function                                             old     new   delta
skip_dir                                              44     120     +76
diff_main                                           1175    1185     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-10 16:25:47 +02:00
Denys Vlasenko
32a6baeefa diff: cosmetic change on top of last commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-09 19:44:38 +02:00
Matheus Izvekov
61f5f7823c diff: fix "diff dir1 dir2/". Closes bug 2203
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-09 19:40:00 +02:00
Denys Vlasenko
243d1757d7 remove some dead assignments, add a TODO comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 04:26:55 +02:00
Denys Vlasenko
eb08b6ed5c sed: trivial code shrink -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-19 17:51:06 +02:00
Denys Vlasenko
e329089c62 Revert "sed: trivial code shrink"
This reverts commit c2c7aa4b0d.
2010-06-19 17:50:23 +02:00
Denys Vlasenko
c2c7aa4b0d sed: trivial code shrink
function                                             old     new   delta
sed_main                                             685     667     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-19 17:47:46 +02:00
Denys Vlasenko
3b727ccb70 add a comment about sed and suid bits
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 02:12:56 +02:00
Denys Vlasenko
d70e0e995e *: add INSERTs to *.src files where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-08 12:15:11 +02:00
Denys Vlasenko
2f32bf8be6 remove defconfig. Now "make defconfig" simply uses defaults from Config.in
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 04:14:28 +02:00
Denys Vlasenko
da929a95aa mass renaming Kbuild -> Kbuild.src, Config.in -> Config.src
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04 20:10:51 +02:00
Denys Vlasenko
c46792492f typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04 01:31:48 +02:00
Denys Vlasenko
bf5f99ffb2 sed: fix a case when one-line range matches past lines. Closes bug 1867.
function                                             old     new   delta
process_files                                       2096    2107     +11
add_cmd                                             1142    1132     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 11/-10)              Total: 1 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04 01:29:52 +02:00
Denys Vlasenko
9f82d0be61 vi: fix "set ic" command; code shrink while at it. closes bug 1765
function                                             old     new   delta
colon                                               2970    2848    -122

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-19 01:54:37 +02:00
Denys Vlasenko
d9a3e89f50 consolidate ESC sequences
function                                             old     new   delta
bell                                                   2       -      -2
CMdown                                                 2       -      -2
Ceos                                                   4       -      -4
Ceol                                                   4       -      -4
CMup                                                   4       -      -4
SOs                                                    5       -      -5
SOn                                                    5       -      -5
CMrc                                                   9       -      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-16 23:42:13 +02:00
Denys Vlasenko
a2215b98f7 sed: fix a command with multible trailing backslashes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-12 01:49:04 +02:00
Denys Vlasenko
94043e8ad2 lineedit: change how cmdedit_set_out_char works
Rename two badly names functions, use "clear to end of screen"
to eliminate annoying problems with clearing wide/combining chars,
and such. Run tested.

function                                             old     new   delta
put_cur_glyph_and_inc_cursor                           -     124    +124
put_till_end_and_adv_cursor                            -      24     +24
input_delete                                         125     130      +5
Ceos                                                   5       4      -1
Ceol                                                   5       4      -1
input_end                                             24       -     -24
cmdedit_set_out_char                                 122       -    -122
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/2 up/down: 153/-148)            Total: 5 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-11 14:49:13 +02:00
Denys Vlasenko
920185c69a cmp: remove history comment. it is more natural to keep it in source control
The comment was:

* Mar 16, 2003      Manuel Novoa III   (mjn3@codepoet.org)
*
* Original version majorly reworked for SUSv3 compliance, bug fixes, and
* size optimizations.  Changes include:
* 1) Now correctly distinguishes between errors and actual file differences.
* 2) Proper handling of '-' args.
* 3) Actual error checking of i/o.
* 4) Accept SUSv3 -l option.  Note that we use the slightly nicer gnu format
*    in the '-l' case.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-26 14:04:29 +02:00
Rob Landley
0c1ba443c8 cmp: ifdefectomy
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-26 14:01:14 +02:00
Denys Vlasenko
f2c16edf99 sed: fix nested {} case
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-20 04:00:03 -04:00
Denys Vlasenko
96a1833231 sed: fix c cmd
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-19 22:36:07 -04:00
Denys Vlasenko
c175c46647 vi: discover window size even on serial consoles. optional
function                                             old     new   delta
edit_file                                            671     761     +90
wh_helper                                              -      57     +57
query_screen_dimensions                               54      63      +9
ar_main                                              533     542      +9
refresh                                              767     773      +6
vi_main                                              242     243      +1
text_yank                                             56      54      -2
get_terminal_width_height                            180     135     -45
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/2 up/down: 172/-47)           Total: 125 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-18 22:09:30 -07:00
Denys Vlasenko
def4783a8a vi: remove superfluous check on filename == ""
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-18 20:39:41 -07:00
Denys Vlasenko
04cecd5e61 vi: code shrink
function                                             old     new   delta
vi_main                                              250     242      -8
colon                                               2980    2970     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18)             Total: -18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-16 22:13:55 -07:00
Denys Vlasenko
2bb651ae10 vi: code shrink; save/restore errno in signal handlers
function                                             old     new   delta
query_screen_dimensions                                -      54     +54
suspend_sig                                           50      64     +14
cont_sig                                              65      66      +1
catch_sig                                             42      32     -10
winch_sig                                             88      60     -28
edit_file                                            719     671     -48
refresh                                              848     767     -81
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/4 up/down: 69/-167)           Total: -98 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-16 20:55:52 -07:00
Denys Vlasenko
7379cd1ca1 awk: add comment about fixing bug 1333
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 01:48:12 +02:00
Denys Vlasenko
fab288cf0b awk: don't append bogus data after NUL in sub(); shrink
also renamed variables to more sensible names

function                                             old     new   delta
mk_re_node                                            56      49      -7
awk_sub                                              601     591     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 01:17:30 +02:00
Denys Vlasenko
35fdb1bc9c vi: fix NUM + "$" handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 16:10:14 +01:00
Denys Vlasenko
f9782ffc45 awk: code shrink
function                                             old     new   delta
evaluate                                            3550    3487     -63

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 21:32:13 +01:00
Denys Vlasenko
c6ba997978 awk: code shrink
function                                             old     new   delta
hash_find                                            233     234      +1
evaluate                                            3899    3550    -349

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 21:05:09 +01:00
Denys Vlasenko
7b81db1379 awk: style fixes
function                                             old     new   delta
hash_find                                            234     233      -1
awk_printf                                           457     453      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 21:04:47 +01:00
Denys Vlasenko
39fe4d1599 awk: code shrink
function                                             old     new   delta
exec_builtin                                        1538    1489     -49

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 16:57:06 +01:00
Denys Vlasenko
58f108eb33 lineedit: fix another corner case with bad unicode input
function                                             old     new   delta
read_key                                             607     646     +39
readit                                                50      55      +5
getch_nowait                                         290     295      +5
hash_find                                            233     234      +1
xstrtoul_range_sfx                                   231     230      -1
passwd_main                                         1058    1056      -2
builtin_exit                                          45      43      -2
cmp_main                                             649     645      -4
lineedit_read_key                                    257     245     -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/5 up/down: 50/-21)             Total: 29 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 21:17:55 +01:00
Denys Vlasenko
b0a57abb79 awk: code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 12:44:25 +01:00
Denys Vlasenko
6ebdf7aa7b awk: code shrink; style fixes
function                                             old     new   delta
next_token                                           932     862     -70

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 12:41:55 +01:00
Denys Vlasenko
da62b09ab1 awk: be more paranoid when freeing loop variable; make code less obfuscated
function                                             old     new   delta
nvfree                                               149     170     +21
next_token                                           928     932      +4
getvar_i                                              95      94      -1
skip_spaces                                           51      45      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 25/-7)              Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 12:13:18 +01:00
Denys Vlasenko
c9955f23a2 awk: simple code shrink
function                                             old     new   delta
awk_getline                                          710     724     +14
awk_printf                                           455     457      +2
hash_find                                            234     233      -1
qrealloc                                              33      31      -2
handle_special                                       499     482     -17
awk_sub                                              641     601     -40
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/4 up/down: 16/-60)            Total: -44 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-10 19:21:54 +01:00
Denys Vlasenko
3cb60c3973 awk: fix the case where nested "for" loops with the same variable misbehave
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-10 19:20:32 +01:00
Alexander Shishkin
d03cd3be24 awk: skip whitespace between array name and subscript
It is supported in both mawk and gawk and there are actually scripts
out there that use this "flexibility".

function                                             old     new   delta
next_token                                          1144    1152      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 8/0)                 Total: 8 bytes

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-26 08:48:56 +01:00
Denys Vlasenko
3dbc5a9742 awk: remove wrong comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-05 14:54:22 +01:00
Denys Vlasenko
98a4c7cf3d *: suppress ~60% of "aliased warnings" on gcc-4.4.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 15:00:15 +01:00
Dan Fandrich
1821d188ca diff: more compiler compat fixes. no code changes
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 04:04:56 +01:00
Dan Fandrich
f111b67100 diff: make code more portable
function                                             old     new   delta
create_J                                            1835    1849     +14
diffreg                                             1268    1255     -13

Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 00:10:30 +01:00
Denys Vlasenko
6b9f163353 *: style fixes. no code changes (verified with objdump)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-28 02:24:24 +01:00
Denys Vlasenko
3581c62515 whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-25 13:39:24 +01:00
Denys Vlasenko
8b8d32ea56 patch: accept and ignore -g NUM
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-22 05:10:33 +01:00
Matheus Izvekov
6f99c91e43 diff: fix flag -B, cleanups and a couple more tests V2
function                                             old     new   delta
diffreg                                             1157    1268    +111
uni_range                                             51       -     -51

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-22 04:20:16 +01:00
Denys Vlasenko
feadfe742a patch: add more long opts; but remove -g for now
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-22 04:17:07 +01:00
Denys Vlasenko
94ca6943bc *: small code shrinks and compile fix for unicode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:51:09 +01:00
Matheus Izvekov
2e5fa4a69d patch: ignore flag -g. +22 bytes
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:46:39 +01:00
Matheus Izvekov
94a6fd1eeb diff: don't exit in case we can't open input files. -2 bytes
>>From d4cf19d20596bca797d58563f4404cf6a4932977 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 23:27:56 -0200
Subject: [PATCH] diff: don't exit in case we can't open input files

This prevents recursion being aborted due to failures to open files.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:46:14 +01:00
Matheus Izvekov
404f14407c diff: don't use FILE_and_pos_t where it's not needed. -31 bytes
>>From 3ead41fc3cbdd904e478ff7a710f5960c8ed4288 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 22:14:46 -0200
Subject: [PATCH] diff: don't use FILE_and_pos_t where it's not needed. -31 bytes

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:46:01 +01:00
Matheus Izvekov
4de4cb6b9b diff: correct handling of labels. -10 bytes
>>From 05eeb173f0431b4fbed7684d7a9cea42f747f63e Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 20:33:55 -0200
Subject: [PATCH] diff: correct handling of labels

This fixes an issue where diff would apply labels to files in the
inverse order, when using -L or --label.
This fixes it in order to be compatible with gnu diff.
It also makes it not an error to specify more than one label.
The behavior for such cases is that they override the label for the new
file.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:45:45 +01:00
Matheus Izvekov
b32aa0c274 diff: support long options
>>From 7b74284ebe6222cb714c37cdbb94633965f29e9b Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 18:36:52 -0200
Subject: [PATCH] diff: support long options

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:45:23 +01:00
Matheus Izvekov
fe1ce2e43e diff: implement flag -B (Ignore changes whose lines are all blank)
>>From 7c3ce93213590bd0592435dc27d1272d0fd3309b Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 15:52:31 -0200
Subject: [PATCH] diff: implement flag -B (Ignore changes whose lines are all blank)

function                                             old     new   delta
diffreg                                             1196    1240     +44
.rodata                                             6538    6561     +23
packed_usage                                         457     478     +21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 88/0)               Total: 88 bytes
   text	   data	    bss	    dec	    hex	filename
  70123	    733	   8576	  79432	  13648	busybox_old
  70190	    733	   8576	  79499	  1368b	busybox_unstripped

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:45:05 +01:00
Matheus Izvekov
b7a044043c diff: honor flag -i (ignore case differences)
>>From 503a1e1d2597f7cdf86a9ea39ebd2aee050ca759 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 18 Jan 2010 14:06:26 -0200
Subject: [PATCH] diff: honor flag -i (ignore case differences)

function                                             old     new   delta
read_token                                           157     178     +21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 21/0)               Total: 21 bytes
   text	   data	    bss	    dec	    hex	filename
  70102	    733	   8576	  79411	  13633	busybox_old
  70123	    733	   8576	  79432	  13648	busybox_unstripped

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-20 02:44:44 +01:00
Denys Vlasenko
9e0879a1cb diff: add NOINLINE
function                                             old     new   delta
create_J                                               -    1805   +1805
diffreg                                             3159    1176   -1983
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 1805/-1983)       Total: -178 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-18 06:15:57 +01:00
Denys Vlasenko
032bf65533 diff: defeat gcc's optimization
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-18 05:22:34 +01:00
Matheus Izvekov
d4a7728dc3 diff: rewrite. much smaller and more correct
function                                             old     new   delta
diffreg                                             1815    3156   +1341
diff_main                                            860    1194    +334
read_token                                             -     161    +161
skip_dir                                               -      44     +44
seek_ft                                                -      31     +31
fetch                                                362     392     +30
line_compar                                            -      21     +21
add_to_dirlist                                        65      61      -4
print_only                                            16       -     -16
skipline                                              51       -     -51
newcand                                               85       -     -85
asciifile                                             89       -     -89
print_status                                         178      73    -105
make_temp                                            148       -    -148
files_differ                                         168       -    -168
get_recursive_dirlist                                182       -    -182
sort                                                 226       -    -226
prepare                                              283       -    -283
change                                               283       -    -283
do_diff                                              416       -    -416
dump_unified_vec                                     457       -    -457
check                                               1512     595    -917
------------------------------------------------------------------------------
(add/remove: 4/12 grow/shrink: 3/3 up/down: 1962/-3430)     Total: -1468 bytes

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-18 04:57:17 +01:00
Denys Vlasenko
9037787eae *: fix places where we were still using malloc/realloc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-08 09:07:50 +01:00
Denys Vlasenko
a3aa3e3095 wget: check for close success; fix chunked; do not bother to send QUIT to ftp
Also, random fixes to use %u for unsigned quantities. -14 bytes in wget.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-11 12:36:10 +01:00
Denys Vlasenko
1284774d60 awk: fix an incorrect casting to string (bug 725). -44 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-30 01:15:04 +01:00
Denys Vlasenko
cdeda16ee4 awk: preparatory patch, no essential code changes. -13 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-30 01:14:16 +01:00
Denys Vlasenko
c270454f8f fix fallout from isprint() changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-20 19:14:19 +01:00
Denys Vlasenko
8684cbb5cc libbb: robustify isXXXX(). +39 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-18 11:34:43 +01:00
Denys Vlasenko
a7ccdeef39 libbb: added xfdopen_for_read/write
function                                             old     new   delta
xfdopen_helper                                         -      40     +40
logdir_open                                         1163    1184     +21
process_stdin                                        433     443     +10
xfdopen_for_write                                      -       9      +9
doCommands                                          2465    2474      +9
patch_main                                          1214    1222      +8
bbunpack                                             457     465      +8
xfdopen_for_read                                       -       7      +7
scan_tree                                            258     262      +4
xstrtoul_range_sfx                                   230     231      +1
sendmail_main                                        957     955      -2
passwd_main                                         1027    1023      -4
parse                                                969     964      -5
test_main                                            253     247      -6
sed_main                                             655     649      -6
dos2unix_main                                        437     429      -8
fbsplash_main                                        950     938     -12
handle_dir_common                                    371     354     -17
expand_vars_to_list                                 2197    2169     -28
update_passwd                                       1275    1246     -29
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 7/10 up/down: 117/-117)           Total: 0 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-15 23:28:11 +01:00
Denys Vlasenko
5799248976 sed: on output file, set not only mode, but owner too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13 09:09:07 +01:00
Denys Vlasenko
6331cf059c *: use "can't" instead of "cannot"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13 09:08:27 +01:00
Denys Vlasenko
8131eea3dc *: introduce and use ffulsh_all()
function                                             old     new   delta
buffer_fill_and_print                                179     196     +17
fflush_all                                             -       9      +9
spawn                                                 87      92      +5
rtcwake_main                                         455     453      -2
...
alarm_intr                                            93      84      -9
readcmd                                             1072    1062     -10
bb_ask                                               345     333     -12
more_main                                            845     832     -13
flush_stdout_stderr                                   42      23     -19
xfflush_stdout                                        27       -     -27
flush_stderr                                          30       -     -30
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397)         Total: -366 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 14:19:51 +01:00
Denys Vlasenko
b87d972817 patch: add Rob's version for reference, it may handle fuzz and offsets
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-25 00:39:51 +02:00
Denys Vlasenko
17c838bc6d patch: add longopts, --dry-run, add one more test
function                                             old     new   delta
patch_main                                          1110    1214    +104
static.patch_longopts                                  -      47     +47
packed_usage                                       26738   26761     +23
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 174/0)             Total: 174 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-24 17:11:55 +02:00
Denys Vlasenko
56b3eec162 small optimizations of toupper/tolower
function                                             old     new   delta
in_ib                                                191     172     -19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23 13:03:59 +02:00
Denys Vlasenko
c0dab37d0a *: remove last function calls to isspace
function                                             old     new   delta
xstrtoul_range_sfx                                   232     231      -1
xstrtoull_range_sfx                                  295     293      -2
trim                                                  82      80      -2
trim_trailing_spaces_and_print                        57      52      -5
isspace                                               18       -     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-22 22:28:08 +02:00
Denys Vlasenko
6935ec9c0b networking/interface.c: tiny code shrink
function                                             old     new   delta
if_readlist_proc                                     634     631      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-22 19:42:26 +02:00
Denys Vlasenko
adf922ec28 *: a few more NOINLINEs
function                                             old     new   delta
print_linkinfo                                         -     815    +815
do_msg                                                 -     783    +783
INET_setroute                                          -     757    +757
varvalue                                               -     746    +746
do_sem                                                 -     637    +637
inflate_codes                                          -     617    +617
INET6_setroute                                         -     491    +491
edir                                                   -     370    +370
sync_cursor                                            -     298    +298
update_utmp                                            -     246    +246
searchLines                                            -     165    +165
setup_alarm                                            -     144    +144
may_wakeup                                             -     101    +101
getNum                                               566     371    -195
refresh                                             1166     848    -318
rtcwake_main                                         809     479    -330
getty_main                                          2396    1921    -475
chpst_main                                          1373     746    -627
inflate_unzip_internal                              1335     567    -768
evalvar                                             1384     612    -772
ipaddr_list_or_flush                                2160    1246    -914
route_main                                          1585     245   -1340
ipcs_main                                           2523    1049   -1474
------------------------------------------------------------------------------
(add/remove: 13/0 grow/shrink: 0/10 up/down: 6170/-7213)    Total: -1043 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-08 14:35:37 +02:00
Denys Vlasenko
7bb346f23c *: use {i,u}toa() where appropriate
function                                             old     new   delta
startservice                                         377     363     -14
setari_u                                              54      40     -14
ash_main                                            1375    1361     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-42)             Total: -42 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-06 22:09:50 +02:00
Denys Vlasenko
606291beab *: more portability fixes by Dan Fandrich
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23 23:15:43 +02:00
Denys Vlasenko
11c8238d1b sed: fix bug 623 (SEGV on some sed commands)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-22 03:02:21 +02:00
Denys Vlasenko
bc3e9479c2 awk: fix typo in prev commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-21 04:16:00 +02:00
Leonid Lisovskiy
46a0be5304 awk: implement mktime
function                                             old     new   delta
exec_builtin                                           -    1466   +1466
do_mktime                                              -     116    +116
tokenlist                                            441     448      +7
tokeninfo                                            396     400      +4
evaluate                                            5395    3755   -1640
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/1 up/down: 1593/-1640)        Total: -47 bytes

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-21 04:08:08 +02:00
Denys Vlasenko
d8dd25a2a7 diff: debug macros; one trivial size optimization
function                                             old     new   delta
diffreg                                             1781    1815     +34
isqrt                                                 64       -     -64
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 34/-64)            Total: -30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-21 01:23:19 +02:00
Denys Vlasenko
3e02050314 diff: fix bug 613 (diff -ub segfaults)
function                                             old     new   delta
dump_unified_vec                                     435     457     +22
diff_main                                            855     860      +5
diffreg                                             1786    1781      -5
do_diff                                              428     416     -12
change                                               325     283     -42
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/3 up/down: 27/-59)            Total: -32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-21 01:22:18 +02:00
Denys Vlasenko
d069e5398d a few more GCC-isms removed
text    data     bss     dec     hex filename
 824641     458    6956  832055   cb237 busybox_old
 824631     458    6956  832045   cb22d busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-09 23:12:10 +02:00
Denys Vlasenko
90a9904e9e remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)
function                                             old     new   delta
logdirs_reopen                                      1310    1308      -2
read_line_input                                     4757    4753      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6)               Total: -6 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 02:36:23 +02:00
Denys Vlasenko
d7874ed1d4 patch: support -N. By Olivier Duclos (olivier.duclos AT gmail.com)
function                                             old     new   delta
packed_usage                                       26646   26656     +10
patch_main                                          1101    1110      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-20 23:33:19 +02:00
Denys Vlasenko
f210cff601 sed: fix " echo /usr/lib | sed 's,\(^/\|\)[^/][^/]*,..,g' " bug
function                                             old     new   delta
process_files                                       2102    2091     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-17 01:35:04 +02:00
Denys Vlasenko
8e96b5b531 sed: simpler fix for recent GNU compat stuff (by Rob Landley)
function                                             old     new   delta
process_files                                       2120    2102     -18

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-14 01:02:57 +02:00
Denys Vlasenko
ae68f1133f sed: deal with peculiar behavior of '2d;2,1p' in GNU sed
function                                             old     new   delta
process_files                                       2173    2120     -53

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-10 11:55:20 +02:00
Denys Vlasenko
b22bbfffec fix dependencies of FEATURE_GETOPT_LONG
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-04 16:50:43 +02:00
Denys Vlasenko
8bca3e20b9 sed: fix handling of 1d;1,3p and 1d;1,REGEXp
function                                             old     new   delta
process_files                                       2084    2173     +89

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-30 19:19:37 +02:00
Denys Vlasenko
6548edd430 vi: do not accept uppercase comments (compat). Closes bug 397.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-15 12:44:11 +02:00
Denys Vlasenko
38d9072b2c diff: tiny compat tweak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-09 12:55:13 +02:00
Denys Vlasenko
e424423a7b awk: put at least one NUL between $n. Hopefully closes 337.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-18 23:50:03 +02:00
Denys Vlasenko
020f40693a line editing: add an option to emit ESC [ 6 n and use results
This makes line editing able to recognize case when
cursor was not at the beginning of the line. It may also
be adapted later to find out display size (serial line users
would love it).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-17 16:44:54 +02:00
Denis Vlasenko
5e34ff29bc *: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
2009-04-21 11:09:40 +00:00
Denis Vlasenko
c7cc5a9432 mdev: Rob's #if forest removal
*: remove superfluous conts in "f(type *const param)"
2009-04-19 01:27:20 +00:00
Denis Vlasenko
67b5eeb933 awk: fix long field separators case. By Ian Wienand (ianw AT vmware.com) 2009-04-12 13:54:13 +00:00
Denis Vlasenko
3266aa9ec2 trailing whitespace removal 2009-04-01 11:24:04 +00:00
Denis Vlasenko
7a6766428e awk: fix compat issue found by gpm build
function                                             old     new   delta
as_regex                                             105     131     +26
hash_find                                            247     233     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 26/-14)             Total: 12 bytes
2009-03-15 22:20:31 +00:00
Denis Vlasenko
9aa5c652e9 unzip: fix thinko with le/be conv and size (closes bug 129)
awk: make "struct global" hack more robust wrt alignment (closes bug 131)
2009-02-26 11:21:04 +00:00
Denis Vlasenko
41d5ebee17 awk: in BEGIN section $0 should be "", not "0". 2009-01-25 01:00:15 +00:00
Denis Vlasenko
00d8417631 vi: speedup and code shrink (Walter Harms)
networking/interface.c: silence warning (Vladimir)
wget: more robust EINTR detection
2008-11-24 07:34:42 +00:00
Denis Vlasenko
4c83025ea6 diff: emit /dev/null if diff -rN diffs a file against /dev/null
function                                             old     new   delta
diffreg                                             1782    1786      +4
2008-11-23 14:40:00 +00:00
Denis Vlasenko
4ae1e13d3f vi: fix several instances of major goof: when text grows, text[]
might get reallocated! We were keeping around pointers to old place...

function                                             old     new   delta
colon                                               3017    3037     +20
char_insert                                          336     354     +18
stupid_insert                                         18      24      +6
string_insert                                         89      94      +5
do_cmd                                              4461    4465      +4
file_insert                                          328     329      +1
text_hole_make                                       134     120     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/1 up/down: 54/-14)             Total: 40 bytes
2008-11-19 13:25:14 +00:00
Denis Vlasenko
202ac504e1 *: code shrink by adding a wrapper around very common tcsetattr(0, TCSANOW, xx) op
function                                             old     new   delta
tcsetattr_stdin_TCSANOW                                -      14     +14
set_sane_term                                        116     113      -3
top_main                                            1277    1273      -4
make_new_session                                     421     415      -6
rawmode                                              133     126      -7
reset_term                                            18      10      -8
die                                                   43      35      -8
cookmode                                              62      54      -8
vlock_main                                           425     415     -10
read_line_input                                     3165    3155     -10
bb_askpass                                           357     347     -10
fsck_minix_main                                     3079    3065     -14
getty_main                                          2375    2332     -43
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/12 up/down: 14/-131)         Total: -117 bytes
2008-11-05 13:20:58 +00:00
Denis Vlasenko
31d58e58d2 randomconfig fixes 2008-10-29 13:16:28 +00:00
Denis Vlasenko
c3a9dc8ac5 vi: fix uninitialized last_search_pattern (bug 5794) 2008-10-29 00:58:04 +00:00
Denis Vlasenko
5f6aaf39cf less: reuse former vi's key reading code. Improve SIGWINCH handling.
function                                             old     new   delta
less_main                                           2056    2097     +41
getch_nowait                                         248     273     +25
read_key                                             310     321     +11
static.esccmds                                        61      69      +8
count_lines                                           72      74      +2
less_gets                                            166     142     -24
less_getch                                           172      43    -129
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/5 up/down: 91/-170)           Total: -79 bytes
   text    data     bss     dec     hex filename
2008-10-25 23:27:29 +00:00
Denis Vlasenko
0112ff5203 vi: move key reading routine out of vi into llbbb
function                                             old     new   delta
read_key                                               -     310    +310
....
static.esccmds                                       170      61    -109
readit                                               286      60    -226
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 9/10 up/down: 349/-367)         Total: -18 bytes
2008-10-25 23:23:00 +00:00
Denis Vlasenko
2d5bd807c0 build system cleanup: rename FEATURE_AWK_MATH to FEATURE_AWK_LIBM;
disable parsing test applet.
2008-10-24 10:49:49 +00:00
Denis Vlasenko
37890e2f37 awk: fix typo in atan2 code. closes bug 5594. 2008-10-21 12:59:34 +00:00
Denis Vlasenko
4c9e9c4314 vi: handle chars 0x80, 0x81... correctly 2008-10-20 08:59:03 +00:00
Denis Vlasenko
078323010b dc: conditionalize parts which require libm 2008-10-20 08:43:10 +00:00
Denis Vlasenko
582dff0514 volume identification: abolish /proc/partitions and /proc/cdroms
scanning. It does not catch volume managers and such.
Adding even more cruft is bad, so I decided to simply
scan /dev/* for any block devices. See how much better
it finds devices now:

# ./busybox_old blkid
/dev/sda1: LABEL="/boot" UUID="7931e231-dcb4-4b6d-9301-f7354ae24061"
/dev/dm-0: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"
/dev/dm-1: UUID="edc2a920-ef83-437e-ba64-d3b6dc851267"
/dev/sdb1: UUID="6F84-ED0F"

# ./busybox blkid
/dev/sdb1: UUID="6F84-ED0F"
/dev/root: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"
/dev/dm-1: UUID="edc2a920-ef83-437e-ba64-d3b6dc851267"
/dev/dm-0: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"
/dev/sda1: LABEL="/boot" UUID="7931e231-dcb4-4b6d-9301-f7354ae24061"
/dev/mapper/VolGroup00-LogVol01: UUID="edc2a920-ef83-437e-ba64-d3b6dc851267"
/dev/mapper/VolGroup00-LogVol00: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"

function                                             old     new   delta
static.drive_name_string                              12       -     -12
append_mount_options                                 205     190     -15
volume_id_open_node                                   37      18     -19
uuidcache_check_device                               485     257    -228
uuidcache_init                                       637      36    -601
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/4 up/down: 0/-875)           Total: -875 bytes
   text    data     bss     dec     hex filename
 792218     592    6648  799458   c32e2 busybox_old
 791260     592    6648  798500   c2f24 busybox_unstripped
2008-10-19 19:36:30 +00:00
Rob Landley
4bdeaaf556 Comment and whitespace tweaks. 2008-10-19 04:21:21 +00:00
Denis Vlasenko
e3742f4217 vi: explain why reading 4 chars is unsafe 2008-10-18 19:37:41 +00:00
Denis Vlasenko
1dfeeeb651 vi: whitespace fix 2008-10-18 19:04:37 +00:00
Denis Vlasenko
8ef801b40c vi: a few trivial optimizations to keyboard reading code; bump timeout to 50s.
function                                             old     new   delta
edit_file                                            901     912     +11
count_lines                                           74      72      -2
readit                                               306     289     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 11/-19)             Total: -8 bytes
2008-10-16 09:46:07 +00:00
Rob Landley
7960ea8918 Confirmed that on Linux the serial interrupt takes precedence over the timer
interrupt, so we don't need to worry about scheduler delays.  This means the
delay can be trimmed down to 25 miliseconds.  Add comment while at it.
2008-10-16 06:34:10 +00:00
Denis Vlasenko
d44c1535ae vi: fix bizarre formatting. no code changes 2008-10-14 12:59:42 +00:00
Denis Vlasenko
ded6ad34ed fix recurring "last_cmd overrun", fix [del] handling in insert mode 2008-10-14 12:26:30 +00:00
Denis Vlasenko
267e16c74a vi: trivial size optimization -65 bytes 2008-10-14 10:34:41 +00:00
Denis Vlasenko
25497c1d92 vi: reinstate timeout of 300 ms 2008-10-14 10:25:05 +00:00
Denis Vlasenko
5373fbcd11 vi: add comments to Rob's algorithm of reading and matching ESC sequences
(nice work btw!)
2008-10-14 10:09:56 +00:00
Rob Landley
5e38cd910a Escape sequences sent over serial links don't come in as a block, so poll
needs to pause a bit to make sure the next character has time to come in.
2008-10-14 08:44:09 +00:00
Rob Landley
988dd5549b Clean up editors/vi.c:readit() so it only does readahead when actually
parsing an escape sequence.  (This mitigates but doesn't fully fix the
the "cursoring around the file deletes data under qemu" bug, presumably due
to "\033[D" being treated as three separate characters.)
2008-10-14 01:42:33 +00:00
Denis Vlasenko
30cfdf90ce crontab: do not destroy STDIN_FILENO, editor may need it (crontab -e)
vi: deal with EOF/error on stdin and with input NULs

function                                             old     new   delta
crontab_main                                         623     642     +19
edit_file                                            901     906      +5
readit                                               331     318     -13
2008-09-21 15:29:29 +00:00
Denis Vlasenko
665eaff3b1 awk: add a comment 2008-09-05 04:59:02 +00:00
Denis Vlasenko
a2e1eea189 awk: improve nadling of negative numbers in bitwise ops;
fix handling of octal costants. add test for it

function                                             old     new   delta
getvar_i_int                                           -      93     +93
my_strtod                                              -      84     +84
qrealloc                                              33      36      +3
getvar_i                                              99      95      -4
next_token                                           979     919     -60
evaluate                                            6359    5627    -732
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/3 up/down: 180/-796)         Total: -616 bytes
2008-09-02 09:00:23 +00:00
Denis Vlasenko
7cbcd1cbf4 awk: bitwise ops cast oprands and results to unsigned long,
not signed. closes 4774.
2008-08-28 23:16:58 +00:00
Denis Vlasenko
996a61475a awk: support hex constants 2008-08-28 22:59:23 +00:00
Denis Vlasenko
0f293b96dc fix all cases of strcpy on overlapping strings. 2008-07-22 20:16:55 +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
Denis Vlasenko
7b54dc788c vi: using array data after it fell out of scope is stupid. 2008-07-17 21:32:32 +00:00
Denis Vlasenko
deeed59de0 libbb: introduce and use xrealloc_vector
function                                             old     new   delta
xrealloc_vector_helper                                 -      51     +51
create_list                                           84      99     +15
getopt_main                                          690     695      +5
passwd_main                                         1049    1053      +4
get_cached                                            85      89      +4
msh_main                                            1377    1380      +3
add_match                                             42      41      -1
read_lines                                           720     718      -2
grave                                               1068    1066      -2
fill_match_lines                                     143     141      -2
add_to_dirlist                                        67      65      -2
add_input_file                                        49      47      -2
act                                                  252     250      -2
fsck_main                                           2252    2246      -6
man_main                                             765     757      -8
bb_internal_initgroups                               228     220      -8
cut_main                                            1052    1041     -11
add_edge_to_node                                      55      43     -12
dpkg_main                                           3851    3835     -16
ifupdown_main                                       2202    2178     -24
sort_main                                            838     812     -26
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/15 up/down: 82/-124)          Total: -42 bytes
2008-07-08 05:14:36 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
8ae5b28b4b awk: another smallish code shrink 2008-07-02 22:47:49 +00:00
Denis Vlasenko
e0a7fc54eb uname,individual: fix improper printf usage
uname,awk: small code shrink

function                                             old     new   delta
uname_main                                           175     166      -9
nvalloc                                              167     157     -10
evaluate                                            6381    6370     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-30)             Total: -30 bytes
2008-07-02 11:14:59 +00:00
Denis Vlasenko
3bb2bbd684 awk: fix a case with multiple -f options. simplify -f file reading.
function                                             old     new   delta
parse_expr                                           833     841      +8
qrealloc                                              33      36      +3
next_input_file                                      203     198      -5
afopen                                                22       -     -22
ftello                                                41       -     -41
ftell                                                 41       -     -41
__GI_ftell                                            41       -     -41
awk_main                                            1002     944     -58
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 2/2 up/down: 11/-208)          Total: -197 bytes
   text    data     bss     dec     hex filename
 804232     610    6804  811646   c627e busybox_old
 804120     610    6804  811534   c620e busybox_unstripped
2008-07-01 01:57:36 +00:00
Denis Vlasenko
d699544205 vi: fix vda's thinko 2008-06-27 04:06:13 +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
9092f754bd print_flags: fix trivial thinko
vi: fix reversed checks for underflow
2008-06-26 22:40:02 +00:00
Denis Vlasenko
f5d8c90d73 style fixes, no code changes 2008-06-26 14:32:57 +00:00
Denis Vlasenko
70685bd022 vi: fix yet another vda's thinko 2008-06-24 14:10:41 +00:00
Denis Vlasenko
cc3f20b9bd fix breakage found by randomconfig 2008-06-23 22:31:52 +00:00
Denis Vlasenko
e3eae0d445 vi: fix obvious thinko's 2008-06-22 16:38:53 +00:00
Denis Vlasenko
2a210e5df2 vi: fix vda's breakage (by Cristian Ionescu-Idbohrn) 2008-06-22 13:20:42 +00:00
Denis Vlasenko
3387538bbe vi: small code shrink
function                                             old     new   delta
file_insert                                          328     329      +1
colon                                               3067    3064      -3
string_insert                                         93      89      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 1/-7)               Total: -6 bytes
2008-06-21 20:31:50 +00:00
Denis Vlasenko
b175946ba4 vi: fix the bug where vi never grows the edit buffer.
vi: do G trick on it

function                                             old     new   delta
place_cursor                                         264     276     +12
next_tabstop                                          22      34     +12
mycmp                                                 44      52      +8
status_line                                           34      40      +6
yank_delete                                           89      92      +3
what_reg                                              34      37      +3
suspend_sig                                           63      66      +3
find_range                                           493     496      +3
redraw                                               104     106      +2
cont_sig                                              63      65      +2
Indicate_Error                                        59      61      +2
status_line_bold                                      71      72      +1
file_insert                                          327     328      +1
vi_setops                                              1       -      -1
...
cmdcnt                                                 4       -      -4
chars_to_parse                                         4       -      -4
ccol                                                   4       -      -4
dot_scroll                                            88      79      -9
stupid_insert                                         28      18     -10
winch_sig                                            102      91     -11
char_insert                                          353     336     -17
readit                                               354     336     -18
get_one_char                                         128     110     -18
init_text_buffer                                     171     152     -19
text_hole_delete                                     132     112     -20
edit_file                                            940     918     -22
get_input_line                                       198     168     -30
show_status_line                                     449     408     -41
colon                                               3112    3067     -45
vi_main                                              312     250     -62
refresh                                             1077     974    -103
do_cmd                                              4818    4483    -335
------------------------------------------------------------------------------
(add/remove: 0/38 grow/shrink: 13/20 up/down: 58/-889)       Total: -831 bytes
   text    data     bss     dec     hex filename
 809566     612    7044  817222   c7846 busybox_old
 808794     611    6924  816329   c74c9 busybox_unstripped

   text    data     bss     dec     hex filename
  18888       1     122   19011    4a43 busybox.t8/editors/vi.o
  18116       0       0   18116    46c4 busybox.t9/editors/vi.o
2008-06-20 20:20:54 +00:00
Denis Vlasenko
d50dda8c35 *: use llist_pop for traverse-and-free list operation
function                                             old     new   delta
append_file_list_to_list                             109     111      +2
udhcpc_main                                         2414    2413      -1
run_parts_main                                       325     324      -1
od_main                                             2324    2323      -1
getopt_main                                          709     707      -2
env_main                                             253     251      -2
sed_main                                             659     656      -3
ps_main                                              522     519      -3
traceroute_main                                     3960    3954      -6
sort_main                                            844     838      -6
diff_main                                            866     858      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/10 up/down: 2/-33)            Total: -31 bytes
2008-06-15 05:40:56 +00:00
Denis Vlasenko
a05c0716c2 grep: make "-f -" work (+ testsuite)
diff: small code shrink

function                                             old     new   delta
grep_main                                            722     714      -8
diffreg                                             1825    1793     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-40)             Total: -40 bytes
2008-06-07 05:19:31 +00:00
Bernhard Reutner-Fischer
5e25ddb7d3 - use STD*_FILENO some more. No object-code changes 2008-05-19 09:48:17 +00:00
Denis Vlasenko
5599502a55 more -Wall warning fixes. -Wall is enabled now. 2008-05-18 22:28:26 +00:00
Denis Vlasenko
77ad97f199 more -Wall warning fixes from Cristian Ionescu-Idbohrn.
This time it resulted in small code changes:

function                                             old     new   delta
nexpr                                                820     828      +8
tail_main                                           1200    1202      +2
wrapf                                                166     167      +1
parse_mount_options                                  227     209     -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 11/-18)             Total: -7 bytes
2008-05-13 02:27:31 +00:00
Denis Vlasenko
8abae88410 vi: do not truncate file to zero length. closes bug 2944.
function                                             old     new   delta
file_write                                            98     104      +6
2008-05-03 11:35:59 +00:00
Denis Vlasenko
c4523c2b3d fix a few stray unguarded strdup's 2008-03-28 02:24:59 +00:00
Denis Vlasenko
8ee649a02e *: more uniform naming: s/xmalloc_getline/xmalloc_fgetline/ 2008-03-26 20:04:27 +00:00
Denis Vlasenko
08ec67bc62 patch: add support for -R. ~ +110 byte. By Pascal Bellard <pascal.bellard AT ads-lu.com>
fbsplash: new applet by Michele Sanges <michele.sanges AT otomelara.it

function                                             old     new   delta
fbsplash_main                                          -    1525   +1525
fb_drawfullrectangle                                   -     118    +118
static.param_value                                     -     100    +100
packed_usage                                       23776   23872     +96
applet_names                                        1843    1852      +9
applet_main                                         1120    1124      +4
read_line_input                                     3156    3158      +2
applet_nameofs                                       560     562      +2
applet_install_loc                                   140     141      +1
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 6/0 up/down: 1857/0)           Total: 1857 bytes
   text    data     bss     dec     hex filename
 799233     641    7380  807254   c5156 busybox_old
 801202     641    7380  809223   c5907 busybox_unstripped
2008-03-26 13:32:30 +00:00
Denis Vlasenko
cc2965fd23 patch: fix vda's thinko: we need to open new_filename.orig, always!
plug memory leak; add testsuite

patch_main                                          1009     988     -21
2008-03-25 14:15:39 +00:00
Denis Vlasenko
dccfe05e17 diff: improve comments (no code chages) 2008-03-24 18:40:32 +00:00
Denis Vlasenko
64a76d7b44 patch: support for patches without dates and generated with -U1; shrink
function                                             old     new   delta
extract_filename                                       -      92     +92
extract_filename_and_free_line                        70       -     -70
patch_main                                          1096    1009     -87
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 92/-157)           Total: -65 bytes
2008-03-24 18:18:03 +00:00
Denis Vlasenko
c4c2cd44d2 diff: exclude D_EMPTY code if there is no support for -r
function                                             old     new   delta
diffreg                                             1808    1825     +17
files_differ                                         189     166     -23
2008-03-24 16:55:13 +00:00
Denis Vlasenko
e9d67a81c8 diff: fix small bug; don't make a copy for "/dev/null" case 2008-03-24 16:28:47 +00:00
Denis Vlasenko
7fe0ebac5f diff: reordering and renaming of variables
function                                             old     new   delta
diff_main                                            843     848      +5
get_recursive_dirlist                                177     180      +3
add_to_dirlist                                        64      66      +2
change                                               329     326      -3
files_differ                                         182     176      -6
diffreg                                             1823    1808     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/3 up/down: 10/-24)            Total: -14 bytes
2008-03-24 16:19:21 +00:00
Denis Vlasenko
73132b9c12 diff: make a few variables local
function                                             old     new   delta
diffreg                                             1844    1823     -21
2008-03-24 15:04:24 +00:00
Denis Vlasenko
04211fd204 diff: make it work on pipes etc (needed for kernel compile)
function                                             old     new   delta
get_recursive_dirlist                                  -     177    +177
make_temp                                              -     144    +144
diffreg                                             1818    1844     +26
files_differ                                         175     182      +7
diff_main                                            842     843      +1
get_dir                                              177       -    -177
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/0 up/down: 355/-177)          Total: 178 bytes
2008-03-24 14:44:59 +00:00
Denis Vlasenko
dc1cbf839d diff: shrink
function                                             old     new   delta
check                                                678    1607    +929
files_differ                                           -     175    +175
do_diff                                              436     433      -3
asciifile                                             94      90      -4
print_only                                            23      16      -7
diff_main                                            868     842     -26
prepare                                              339     301     -38
print_status                                         316     178    -138
diffreg                                             2993    1818   -1175
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/7 up/down: 1104/-1391)       Total: -287 bytes
2008-03-24 14:44:20 +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
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
2a7a451391 patch: don't trash permissions of patched file 2008-03-18 01:38:04 +00:00
Paul Fox
2724fa9d8a remove alarm() calls which were functioning as a primitive
watchdog function, presumably to catch infinite loop bugs. 
(control-C can do the same thing, and the alarms were too short in
any case.)  also, switch to sigsetjmp/siglongjmp in order to allow
repeated use of control-C -- otherwise it works once, then not again.
2008-03-17 15:28:07 +00:00
Denis Vlasenko
1d42665b6b *: shrink: use Vladimir's "o+" specifier instead of xatou(opt_param)
function                                             old     new   delta
getopt32                                            1370    1385     +15
sulogin_main                                         490     494      +4
realpath_main                                         84      86      +2
sleep_main                                            76      77      +1
mt_main                                              256     257      +1
printenv_main                                         75      74      -1
fdformat_main                                        546     545      -1
usleep_main                                           44      42      -2
setlogcons_main                                       77      75      -2
ed_main                                             2654    2649      -5
deallocvt_main                                        69      64      -5
addgroup_main                                        373     368      -5
mkfs_minix_main                                     2989    2982      -7
tail_main                                           1221    1213      -8
sv_main                                             1254    1241     -13
du_main                                              348     328     -20
tftp_main                                            325     302     -23
split_main                                           581     558     -23
nc_main                                             1000     977     -23
diff_main                                            891     868     -23
arping_main                                         1797    1770     -27
ls_main                                              893     847     -46
od_main                                             2797    2750     -47
readprofile_main                                    1944    1895     -49
tcpudpsvd_main                                      1973    1922     -51
udhcpc_main                                         2590    2513     -77
grep_main                                            824     722    -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/22 up/down: 23/-560)         Total: -537 bytes
   text    data     bss     dec     hex filename
 796973     658    7428  805059   c48c3 busybox_old
 796479     662    7420  804561   c46d1 busybox_unstripped
2008-03-17 09:09:09 +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
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
Paul Fox
35e9c5d83a fixups to vi usage, and move the initial redraw() past the
execution of commands supplied by -c or EXINIT, so their
effect is displayed correctly.
2008-03-06 16:26:12 +00:00
Paul Fox
c51fc7bed6 fixed the "dot" (i.e. '.') command, to properly re-init its
buffer between commands, not recalculate its length all the time,
and to not reallocate its fixed-length buffer frequently.

fixed the 'c', 'd', and 'y' commands to properly handle both motions
that are just part of a line, and those that are multiline.  for
instance, now "c%" and "2cw" work correctly, whether the motions span
lines or not.

added some permissble motions for 'c', 'd', and 'y':  namely 'h',
'l', SPACE, BS, and DEL
2008-03-06 01:34:23 +00:00
Paul Fox
4917c11432 fix vi's '?' and '/' commands to correctly set a new direction
when reusing a previous search pattern.  previously only 'n' and 'N'
reversed directions properly.
2008-03-05 16:44:02 +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