aboutsummaryrefslogtreecommitdiff
path: root/editors/sed.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * sed: support "-f -" idiomDenys Vlasenko2016-04-081-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | sed: drop \r when reading inputRon Yorston2016-03-161-0/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An upstream bug (https://bugs.busybox.net/show_bug.cgi?id=8791) reports: $ cat myfile a b c $ sed "s/\(.*\)/\1\1/" myfile a b c it should be: $ sed "s/\(.*\)/\1\1/" myfile aa bb cc This happened because busybox-w32 opens files in binary mode. Lines read by sed had trailing LFs removed but not trailing CRs. The CRs ended up in the matched strings and were output, thus giving the appearance that only one of the backreferences was printed. The same happens on Linux when a DOS file is processed by BusyBox sed or GNU sed. However, this behaviour is arguably incorrect on Windows. I've modified busybox-w32 to drop trailing CRs as well as LFs from input lines.
* sed: make 's///w FILE' actually write to FILE. Closes 8251Denys Vlasenko2016-01-241-4/+7
| | | | | | | function old new delta add_cmd 1167 1210 +43 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: more BUILD_BUG_ON conversionsDenys Vlasenko2015-10-131-5/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: implement ",+N" range endDenys Vlasenko2015-04-171-5/+36
| | | | | | | | | | | 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>
* sed: fix "sed CMD -i nonexistent_file". Closes 7484Denys Vlasenko2014-10-051-2/+6
| | | | | | | function old new delta sed_main 643 676 +33 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix a buglet in s///NUM handlingDenys Vlasenko2014-09-161-1/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: accept s///i as a synonym for s///I ("ignore case")David A. Wheeler2013-12-181-1/+2
| | | | | Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: code shrinkDenys Vlasenko2013-11-281-28/+21
| | | | | | | | | | | 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>
* sed: open input files sequentially to avoid EMFILEDenys Vlasenko2013-11-281-26/+34
| | | | | | | | | | | | | | | 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>
* switch editors/* to embedded-in-source kbuild systemDenys Vlasenko2013-11-131-0/+11
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix "sed clusternewline" testcaseDenys Vlasenko2013-10-301-67/+67
| | | | | | | | | | | 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>
* sed: document -E in help textDenys Vlasenko2013-10-301-3/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix memory leak in 'r FILE' commandDenys Vlasenko2013-10-301-4/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: accept -E as a synonym for -rDavid A. Wheeler2013-10-291-4/+10
| | | | | Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix matching of newlines by $Denys Vlasenko2013-07-211-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: remove now-redundant backslash-newline handlingDenys Vlasenko2013-07-081-16/+2
| | | | | | | | | | | 4b0bb9e0fd9ec06e9e61b1a1527ace99ea9fe571 added this code in 2007, then in a2215b98f7d65bc613b9c8f008d79672402c6a07 more general fix was added. function old new delta add_cmd_block 98 58 -40 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: document where we are more liberal then GNUDenys Vlasenko2013-07-081-0/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace fixes. no code changesDenys Vlasenko2013-01-151-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: allow 'w' cmd to use two address formMimi Li2012-07-241-5/+11
| | | | | | | | 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>
* tweak help textsDenys Vlasenko2012-06-211-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: yet another fix on top of zero length match codeDenys Vlasenko2012-06-081-5/+10
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix breakage added by zero length match codeDenys Vlasenko2012-06-071-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: code shrinkDenys Vlasenko2012-06-041-13/+15
| | | | | | | function old new delta process_files 2181 2173 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix zero chars match/replaceDenys Vlasenko2012-06-041-22/+42
| | | | | | | function old new delta process_files 2099 2181 +82 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: support long opts and -iSFXSimon B2012-05-061-5/+28
| | | | | | | | | | | | 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>
* sed: slightly better fix for prev commit's problemDenys Vlasenko2012-04-241-4/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix handling of s/// which has empty matchesDenys Vlasenko2012-04-241-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix possible case of signed char bug; expand debugging printoutsDenys Vlasenko2012-01-151-13/+25
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: better help textDenys Vlasenko2011-09-131-2/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix range handling for sed -i. Closes 4069Denys Vlasenko2011-08-161-28/+51
| | | | | | | | | | | 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>
* *: remove "Options:" string from help textsDenys Vlasenko2011-06-051-2/+1
| | | | | | | function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: shrink by 17 bytesPascal Bellard2011-05-051-3/+7
| | | | | Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: support \r in s commandDenys Vlasenko2011-05-031-1/+2
| | | | | | | function old new delta copy_parsing_escapes 65 91 +26 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: code shrinkDenys Vlasenko2011-05-031-54/+92
| | | | | | | | 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>
* move help text from include/usage.src.h to debianutils/*.c e2fsprogs/*.c ↵Pere Orga2011-04-031-0/+17
| | | | | | | editors/*.c loginutils/*.c mailutils/*.c Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace fixesDenys Vlasenko2011-02-031-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace cleanupDenys Vlasenko2010-10-291-3/+3
| | | | Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* *: introduce and use xmkstemp. -65 bytes.Alexander Shishkin2010-10-221-3/+1
| | | | | Signed-off-by: Alexander Shishkin <virtuoso@slind.org> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* *: make GNU licensing statement forms more regularDenys Vlasenko2010-08-161-1/+1
| | | | | | | 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>
* sed: make N command behave as in GNU sedDenys Vlasenko2010-08-161-3/+11
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix sed -i: unlike without -i, it does not forget rangesDenys Vlasenko2010-08-011-4/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: trivial code shrink -18 bytesDenys Vlasenko2010-06-191-3/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Revert "sed: trivial code shrink"Denys Vlasenko2010-06-191-6/+3
| | | | This reverts commit c2c7aa4b0d16049322ca2ebc69ca1093f6944e3a.
* sed: trivial code shrinkDenys Vlasenko2010-06-191-3/+6
| | | | | | | function old new delta sed_main 685 667 -18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* add a comment about sed and suid bitsDenys Vlasenko2010-06-181-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* typo fixDenys Vlasenko2010-06-041-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix a case when one-line range matches past lines. Closes bug 1867.Denys Vlasenko2010-06-041-15/+28
| | | | | | | | | | 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>
* sed: fix a command with multible trailing backslashesDenys Vlasenko2010-05-121-6/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix nested {} caseDenys Vlasenko2010-04-201-1/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>