Commit Graph

726 Commits

Author SHA1 Message Date
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
7985bc109e awk: fix length(array)
function                                             old     new   delta
evaluate                                            3526    3548     +22

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-12 04:51:54 +02:00
Bernhard Reutner-Fischer
a060a1ad96 awk: Fix handling of functions with empty body
ammend b79a0fef99 to properly
handle functions defined in another scope.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-31 21:51:14 +02: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
1390a010b6 awk: use "long long" as integer type, not "int"
Testcase:
awk "BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}"
2147483647 2147483647 0 2147483648 2147483648 0

(last three values weren't showing right)

function                                             old     new   delta
evaluate                                            3444    3458     +14
fmt_num                                              221     230      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-20 21:23:01 +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
264f37363d vi: make regexp search case-insensitive if ":set ignorecase" is active
Reported by Dan Moinescu <dan@moinescu.net>.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-04-21 15:51:41 +02:00
Denys Vlasenko
9e7c002182 vi: code shrink
function                                             old     new   delta
status_line_bold_errno                                 -      32     +32
colon                                               2891    2873     -18
file_insert                                          354     313     -41
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 32/-59)            Total: -27 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15 02:17:29 +01:00
Ron Yorston
cb5aa725df vi: fix adjustment of buffer on partial file read
The second argument to text_hole_delete was incorrect: it should
be a pointer to the end of the hole.

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15 02:10:07 +01:00
Bernhard Reutner-Fischer
b79a0fef99 awk: Fix handling of functions with empty body
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-13 09:47:07 +01:00
Denys Vlasenko
778794d1dd *: reuse more strings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-22 10:13:52 +01: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
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +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
df8066a78c awk: fix FS assignment behavior. Closes 5108
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-11 01:27:15 +02:00
Denys Vlasenko
ea664dde87 awk: make -F STR interpret escape sequences. Closes 5126
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-22 18:41:01 +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
d3dff879f0 vi: save/restore screen upon invocation
function                                             old     new   delta
vi_main                                              253     273     +20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-11 13:53:26 +02:00
Denys Vlasenko
04b52892ed vi: nuke FEATURE_VI_OPTIMIZE_CURSOR
It is not Unicode safe, it is not saving much of I/O, and it's large:

function                                             old     new   delta
vi_main                                              255     253      -2
go_bottom_and_clear_to_eol                            28      26      -2
do_cmd                                              4194    4182     -12
show_status_line                                     388     374     -14
strncat                                               39       -     -39
__GI_strncat                                          39       -     -39
refresh                                              774     724     -50
place_cursor                                         276      83    -193
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 0/6 up/down: 0/-351)           Total: -351 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-11 13:51:38 +02:00
Denys Vlasenko
605f2641d8 vi: do not set autoindent by default
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-11 01:53:33 +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
Dennis Groenen
c0657e0d0a vi: add ":prev" command support
function                                             old     new   delta
colon                                               2844    2891     +47
vi_main                                              243     255     +12
text_yank                                             54      56      +2
refresh                                              780     774      -6

Signed-off-by: Dennis Groenen <tj.groenen@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-31 14:12:38 +01:00
Denys Vlasenko
800a9a056a vi: move mark[i] pointers if text[] moves after realloc
While at it, optimized :s/find/repl/ a bit

function                                             old     new   delta
text_hole_make                                       120     150     +30
colon                                               2848    2844      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-31 14:10:26 +01:00
Denys Vlasenko
6e8861b5f1 *: better comments on termios manipulations. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-15 23:00:13 +01: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
1fd7129bc6 vi: fix [end] key handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-28 04:55:48 +01:00
Rob Landley
39ec6a2ad5 patch: make -p count path components, not slashes (think /blah//thing)
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-10 19:59:38 +02: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
7b46d11582 awk: fix a SEGV
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-11 00:30:56 +02:00
Denys Vlasenko
202a1b9284 awk: fix define name collision with BSD headers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-10 04:51:09 +02:00
Denys Vlasenko
12e154f0cf vi: prevent unlimited recursion in do_cmd(). Closes 4153
function                                             old     new   delta
do_cmd                                              4284    4194     -90

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-09 12:35:49 +02:00
Denys Vlasenko
f65c5f5c54 awk: next_input_file can return NULL, don't SEGV in this case.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-07 20:01:39 +02:00
Rob Landley
c5f7847659 patch: make it able to create files (again)
I broke patch's ability to create files in November, and nobody noticed in
the ensuing 11 months.  Sigh.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-22 04:58:32 +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
4e552a70ec less: optionally query terminal size via "ESC [ 6 n". Closes bug 2659.
+7 bytes is not selected, +100 if selected.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-25 15:18:20 +02:00
Denys Vlasenko
14bd16ac56 more tweak for bionic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08 08:49:40 +02:00
Denys Vlasenko
066f399566 vi: tweak regex.h include
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-03 03:19:43 +02:00
Walter Harms
b9ba580917 vi: fix regex search, make it selectable in config
function                                             old     new   delta
char_search                                          134     214     +80
find_pair                                            187     169     -18
mycmp                                                 37       -     -37

Signed-off-by: Walter Harms <wharms@bfs.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-27 02:59:37 +02:00
Denys Vlasenko
416e978ce8 diff: disable debug code; remove unsupported --dry-run from help text
function                                             old     new   delta
packed_usage                                       28623   28602     -21
do_line                                              121      91     -30
patch_main                                          2086    1923    -163
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-214)           Total: -214 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-19 01:40:31 +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