Commit Graph

747 Commits

Author SHA1 Message Date
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
Denys Vlasenko
d616ab6bbb reformime: do not require \r\n
function                                             old     new   delta
parse                                                958    1063    +105
packed_usage                                       28691   28712     +21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-22 03:46:33 +02:00
Cristian Ionescu-Idbohrn
9a296fbeab vi.c: remove warning: variable 'sp' set but not used
Signed-off-by: Cristian Ionescu-Idbohrn <cii@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-16 03:53:43 +02:00
Denys Vlasenko
60a9414cad fix "variable 'foo' set but not used" warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13 20:57:01 +02:00
Denys Vlasenko
80c5b6893d libbb: nonblock_safe_read->nonblock_immune_read, remove unused param of xmalloc_reads
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:21:10 +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
Marek Polacek
b0b8884009 Fix double words in comments. No code changes
Signed-off-by: Marek Polacek <mpolacek@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-16 17:33: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
Roman Borisov
95f5c52e6f diff: optimize diffing of files with the same metadata
Signed-off-by: Roman Borisov <ext-roman.borisov@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-27 23:24:09 +02:00
Denys Vlasenko
66c5b12dbf ash: fix TMOUT not restoring tty attributes
function                                             old     new   delta
pgetc                                                420     500     +80
readtoken1                                          3202    3239     +37
read_line_input                                     3316    3337     +21
udhcpc_main                                         2610    2630     +20
file_get                                             266     272      +6
expandarg                                            958     963      +5
localcmd                                             257     259      +2
addLines                                              85      87      +2
read_line                                             94      95      +1
ed_main                                             2540    2541      +1
timed_out                                              1       -      -1
lineedit_read_key                                    256     255      -1
alrm_sighandler                                       44       -     -44
cmdloop                                              539     434    -105
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 10/2 up/down: 175/-151)          Total: 24 bytes
   text    data     bss     dec     hex filename
 887379     936   17200  905515   dd12b busybox_old
 887411     936   17192  905539   dd143 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-08 05:07:02 +01:00
Denys Vlasenko
b7c9fb27cb whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-03 00:05:48 +01:00
Alexander Shishkin
f18a82d9b3 diff: return 1 when skipping directories with -r, but without -N
Diff in diffutils will return 1 in case -r option is specified without
-N something exists only in one of the directories.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-26 01:09:12 +01:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Rob Landley
8027a202a8 patch: fix "patch at the beginning" testcase failure
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-29 03:24:51 +01:00
Denys Vlasenko
7c6ed78aaa patch: remove out-of-file build machinery
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-22 03:15:21 +01:00
Denys Vlasenko
ac10b30070 cmp: with -s, do not report open errors
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-21 18:11:40 +01:00
Denys Vlasenko
400ff226c2 patch: simplify double list helpers
function                                             old     new   delta
dlist_free                                             -      29     +29
fail_hunk                                            130     132      +2
patch_main                                          1987    1982      -5
dlist_add                                             59      54      -5
TOY_llist_pop                                          9       -      -9
TOY_llist_free                                        54       -     -54
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 1/2 up/down: 31/-73)            Total: -42 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-21 05:54:28 +01:00
Denys Vlasenko
b82ae98ea4 patch: busyboxify by migrating from toybox to busybox helpers
function                                             old     new   delta
get_line                                              90     128     +38
bbconfig_config_bz2                                 4959    4965      +6
makedevs_main                                       1038    1035      -3
fail_hunk                                            133     130      -3
finish_oldfile                                       174     124     -50
patch_main                                          2066    1987     -79
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/4 up/down: 44/-135)           Total: -91 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-21 05:53:34 +01:00
Denys Vlasenko
fb132e4737 whitespace cleanup
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Rob Landley
d8205b39ab awk: reduce ifdef forest
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 03:27:22 +02:00
Denys Vlasenko
2b299fed6a awk: fix breakage in last commit
While at it, made bb_process_escape_sequence faster (same size)

function                                             old     new   delta
nextchar                                              49      53      +4
bb_process_escape_sequence                           138     140      +2
next_token                                           838     839      +1
static.charmap                                        20      18      -2
is_assignment                                        143     135      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 7/-10)              Total: -3 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 01:58:04 +02:00
Denys Vlasenko
6a0d7490ea awk: fix segfault on closing non-opened file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-23 21:02:15 +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
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