Commit Graph

317 Commits

Author SHA1 Message Date
Denys Vlasenko
63f4d32c98 sed: implement ",+N" range end
function                                             old     new   delta
add_cmd                                             1115    1173     +58
process_files                                       2226    2253     +27
sed_main                                             696     702      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 91/0)               Total: 91 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-17 14:24:55 +02:00
Denys Vlasenko
cd73871178 sed: fix "sed CMD -i nonexistent_file". Closes 7484
function                                             old     new   delta
sed_main                                             643     676     +33

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-10-05 02:44:34 +02:00
Denys Vlasenko
9caea2448e sed: fix a buglet in s///NUM handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-16 01:11:13 +02:00
David A. Wheeler
80a068d741 sed: accept s///i as a synonym for s///I ("ignore case")
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-18 16:23:49 +01:00
Denys Vlasenko
deb0769b26 sed: code shrink
function                                             old     new   delta
get_next_line                                        246     250      +4
sed_main                                             671     662      -9
add_input_file                                        47       -     -47
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 4/-56)             Total: -52 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-28 12:08:51 +01:00
Denys Vlasenko
259b3c047a sed: open input files sequentially to avoid EMFILE
Currently, sed pre-opens all files, which may cause EMFILE errors
on systems with low ulimit -n.  Change sed to open one file at a time.

function                                             old     new   delta
get_next_line                                        177     235     +58
sed_main                                             682     652     -30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 58/-30)             Total: 28 bytes

Based on the patch by Daniel Borca <dborca@yahoo.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-28 03:14:16 +01:00
Denys Vlasenko
73225b6d6e switch editors/* to embedded-in-source kbuild system
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-13 12:45:33 +01:00
Denys Vlasenko
c44539fcd3 sed: fix "sed clusternewline" testcase
function                                             old     new   delta
process_files                                       2197    2226     +29
flush_append                                          47      54      +7
get_next_line                                        184     189      +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 41/0)               Total: 41 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-30 14:25:22 +01:00
Denys Vlasenko
a82e32d9ce sed: document -E in help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-30 13:00:00 +01:00
Denys Vlasenko
9d46a7a9a4 sed: fix memory leak in 'r FILE' command
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-30 10:22:47 +01:00
David A. Wheeler
af0cdeedc6 sed: accept -E as a synonym for -r
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-29 00:52:48 +01:00
Denys Vlasenko
b0e9b72915 sed: fix matching of newlines by $
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-21 22:09:44 +02:00
Denys Vlasenko
40ab27a225 sed: remove now-redundant backslash-newline handling
4b0bb9e0fd added this code in 2007,
then in a2215b98f7 more general fix
was added.

function                                             old     new   delta
add_cmd_block                                         98      58     -40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-08 02:07:16 +02:00
Denys Vlasenko
e93d15613e sed: document where we are more liberal then GNU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-08 01:43:40 +02:00
Denys Vlasenko
6830ade6aa whitespace fixes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 13:58:01 +01:00
Mimi Li
37a79c092e sed: allow 'w' cmd to use two address form
function                                             old     new   delta
add_cmd                                             1101    1094      -7

Signed-off-by: Mimi Li <felloak@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-24 13:20:12 +02:00
Denys Vlasenko
1d7ad7a022 tweak help texts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-21 09:45:11 +02:00
Denys Vlasenko
37ca36a711 sed: yet another fix on top of zero length match code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-08 10:25:31 +02:00
Denys Vlasenko
84406e459b sed: fix breakage added by zero length match code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-07 16:34:57 +02:00
Denys Vlasenko
c35545a100 sed: code shrink
function                                             old     new   delta
process_files                                       2181    2173      -8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-04 14:45:09 +02:00
Denys Vlasenko
21f6fbf545 sed: fix zero chars match/replace
function                                             old     new   delta
process_files                                       2099    2181     +82

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-04 14:44:47 +02:00
Simon B
8c3439554a sed: support long opts and -iSFX
function                                             old     new   delta
static.sed_longopts                                    -      67     +67
sed_main                                             618     682     +64
packed_usage                                       29179   29236     +57
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 188/0)             Total: 188 bytes

Signed-off-by: Simon B <sburnet@hotmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-06 14:01:41 +02:00
Denys Vlasenko
b84dafb5e5 sed: slightly better fix for prev commit's problem
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-24 19:27:34 +02:00
Denys Vlasenko
e39afe1fbd sed: fix handling of s/// which has empty matches
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-24 19:21:16 +02:00
Denys Vlasenko
d29ae7e071 sed: fix possible case of signed char bug; expand debugging printouts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-15 20:06:03 +01:00
Denys Vlasenko
a221bc5f99 sed: better help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-13 18:40:22 +02:00
Denys Vlasenko
a7d6bb3b5d sed: fix range handling for sed -i. Closes 4069
function                                             old     new   delta
sed_main                                             606     618     +12
add_cmd                                             1099    1101      +2
process_files                                       2108    2099      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 14/-9)               Total: 5 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-16 13:29:34 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Pascal Bellard
d3e4be3ccb sed: shrink by 17 bytes
Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-05 00:26:37 +02:00
Denys Vlasenko
6a0abcc02f sed: support \r in s command
function                                             old     new   delta
copy_parsing_escapes                                  65      91     +26

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-03 00:52:22 +02:00
Denys Vlasenko
52d8370836 sed: code shrink
text    data     bss     dec     hex filename
 876354     493    7584  884431   d7ecf busybox_old
 876323     493    7584  884400   d7eb0 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-03 00:51:43 +02:00
Pere Orga
6a3e01d5a9 move help text from include/usage.src.h to debianutils/*.c e2fsprogs/*.c editors/*.c loginutils/*.c mailutils/*.c
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-03 01:33:55 +02:00
Denys Vlasenko
b7c9fb27cb whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-03 00:05:48 +01:00
Denys Vlasenko
fb132e4737 whitespace cleanup
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Alexander Shishkin
6722737ece *: introduce and use xmkstemp. -65 bytes.
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-22 13:27:16 +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
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
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
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
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
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
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
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
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