Commit Graph

177 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
3266aa9ec2 trailing whitespace removal 2009-04-01 11:24:04 +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
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
4c9e9c4314 vi: handle chars 0x80, 0x81... correctly 2008-10-20 08:59:03 +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
7b54dc788c vi: using array data after it fell out of scope is stupid. 2008-07-17 21:32:32 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +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
70685bd022 vi: fix yet another vda's thinko 2008-06-24 14:10:41 +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
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
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
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
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