Commit Graph

76 Commits

Author SHA1 Message Date
Denis Vlasenko
24f824edb3 less: fix somewhat elusive case when less gets stuck in search mode
function                                             old     new   delta
read_lines                                           719     730     +11
goto_match                                           141     116     -25
2008-04-13 08:32:51 +00:00
Denis Vlasenko
cf7cf62204 *: s/BB_SIGS_FATAL/BB_FATAL_SIGS/ (latter proved easier to remember)
top: fix "top </dev/null" case (by Cristian Ionescu-Idbohrn)
2008-03-19 19:38:46 +00:00
Denis Vlasenko
107fe7c081 less: improve search when data is not supplied fast enough by stdin -
now will try reading for 1-2 seconds before declaring that there is no match.
This fixes a very common annoyance with long manpages.

function                                             old     new   delta
read_lines                                           653     719     +66
buffer_down                                           28      83     +55
goto_match                                           140     141      +1
cap_cur_fline                                         72       -     -72
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 3/0 up/down: 122/-72)            Total: 50 bytes
   text    data     bss     dec     hex filename
 798734     661    7428  806823   c4fa7 busybox_old
 798768     661    7428  806857   c4fc9 busybox_unstripped
2008-03-17 08:38:45 +00:00
Denis Vlasenko
574f2f4394 *: add optimization barrier to all "G trick" locations 2008-02-27 18:41:59 +00:00
Denis Vlasenko
b78d1c045f less: shrink 2008-02-24 19:18:18 +00:00
Denis Vlasenko
400d8bb45e less,klogd,syslogd,nc,tcpudp: exit on signal by killing itself, not exit(1)
*: minor shrink
2008-02-24 13:36:01 +00:00
Denis Vlasenko
d553faf5a5 less: small shrink 2008-02-23 12:22:17 +00:00
Denis Vlasenko
d2172c04e6 less: make it a bit more resistant against statusline corruption.
less: "examine" command will not bomb out on bad file name now

less_main                                           1663    1694     +31
examine_file                                          87     114     +27
less_getch                                           138     160     +22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 80/0)               Total: 80 bytes
   text    data     bss     dec     hex filename
 798368     740    7484  806592   c4ec0 busybox_old
 798470     740    7484  806694   c4f26 busybox_unstripped
2008-02-23 11:54:37 +00:00
Denis Vlasenko
33196372be less: update line input so that it doesn't interfere with
screen update. Makes "man bash", [enter], [/],
<enter search pattern>, [enter] more usable - manpage
draws as you enter the pattern! Yay!!
less: fix bug where backspace wasn't actually deleting chars
less: "examine file with empty name" doesn't abort anymore.
libbb: add "all fatal signals" mask.

getch_nowait                                           -     207    +207
status_print                                           -     105    +105
examine_file                                          64      87     +23
move_cursor                                            -      16     +16
m_status_print                                       185     195     +10
less_main                                           1656    1663      +7
decode_format_string                                 790     795      +5
test_main                                            403     405      +2
process0_stdin                                       247     249      +2
passwd_main                                         1070    1072      +2
less_gets                                            196     178     -18
buffer_print                                         169      71     -98
less_getch                                           362     138    -224
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 7/3 up/down: 379/-340)           Total: 39 bytes
   text    data     bss     dec     hex filename
 798329     740    7484  806553   c4e99 busybox_old
 798368     740    7484  806592   c4ec0 busybox_unstripped
2008-02-23 01:25:38 +00:00
Denis Vlasenko
25591c322c libbb: introduce bb_signals and bb_signals_recursive,
which sets same handler for many signals. sig_catch is nuked
(bb_signals_recursive is more descriptive name).
*: use them as appropriate. 

function                                             old     new   delta
bb_signals_recursive                                   -      95     +95
bb_signals                                             -      52     +52
run_command                                          258     273     +15
svlogd_main                                         1368    1377      +9
runsv_main                                          1746    1752      +6
runsvdir_main                                       1643    1646      +3
UNSPEC_print                                          64      66      +2
time_main                                           1128    1127      -1
...
resize_main                                          246     210     -36
sig_catch                                             63       -     -63
set_fatal_sighandler                                  85      14     -71
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 5/24 up/down: 182/-548)        Total: -366 bytes
2008-02-16 22:58:56 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
78e2d4e361 less: make 'f' page forward 2007-09-27 17:11:48 +00:00
Denis Vlasenko
4daad9004d introduce bb_putchar(). saves ~1800 on uclibc (less on glibc). 2007-09-27 10:20:47 +00:00
Denis Vlasenko
fe7cd642b0 don't pass argc in getopt32, it's superfluous
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes
   text    data     bss     dec     hex filename
 773469    1058   11092  785619   bfcd3 busybox_old
 772644    1058   11092  784794   bf99a busybox_unstripped
2007-08-18 15:32:12 +00:00
Denis Vlasenko
6ca409e0e4 trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
  of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts

size saving: 0.5k
2007-08-12 20:58:27 +00:00
Denis Vlasenko
46340e398e less: add a bit more robustness in keyboard reading code 2007-08-03 14:17:21 +00:00
Denis Vlasenko
fdcfa2aba7 less: less <HUGEFILE + [End] busy loops, fix it 2007-05-31 23:55:39 +00:00
Denis Vlasenko
342b0ab945 less: forgot trivial #if ENABLE_xxxx 2007-05-31 23:06:18 +00:00
Denis Vlasenko
c2f011aa03 more: stop using bss
# make && make bloatcheck
function                                             old     new   delta
gotsig                                                86     107     +21
more_main                                            777     781      +4
cin_fileno                                             4       -      -4
set_tty_to_initial_mode                               25       -     -25
new_settings                                         120      60     -60
initial_settings                                     120      60     -60
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/2 up/down: 25/-149)          Total: -124 bytes
2007-05-31 21:31:56 +00:00
Denis Vlasenko
22a9a3c6f8 less: fix very obscure memory corruption bug 2007-05-31 15:56:10 +00:00
Denis Vlasenko
a1d24a0b6e less: stop using data/bss. Code got smaller too.
# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 700719    2896   17880  721495   b0257 busybox_old
 700547    2832   17432  720811   affab busybox_unstripped
# size */*/less.o
   text    data     bss     dec     hex filename
   6861      50     344    7255    1c57 busybox.t0/miscutils/less.o
   6657       0       0    6657    1a01 busybox.t1/miscutils/less.o
2007-05-31 15:55:03 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
8465a99ce7 less: fix case when regex search finds nothing 2007-05-09 18:32:54 +00:00
Denis Vlasenko
c86e052b81 fix accumulated whitespace and indentation damage 2007-03-20 11:30:28 +00:00
Denis Vlasenko
4eb8b936cb more: do not mess with "/dev/console" (!);
fill whole 1st screen (was "screen sans one line");
    fall back to cat if redirected or no ctty
less: fall back to cat if no ctty (was exiting)
resize: cosmetics
2007-03-10 16:32:14 +00:00
Denis Vlasenko
f5a157615d less: handle yet another Home/End key sequence; expand a comment 2007-03-09 08:55:23 +00:00
Denis Vlasenko
a1c631278b less: make '/' (regex search) scan input if no matches are found
in input taken so far.
2007-03-08 18:12:01 +00:00
Denis Vlasenko
18d6fc1a50 less: yet another attempt to make search better 2007-03-08 17:52:36 +00:00
Denis Vlasenko
5c1de36702 less: fix 'n'ext match: sometimes was going to 999999th line 2007-03-08 16:44:32 +00:00
Denis Vlasenko
8e858e2700 clean up accumulated whitespace damage 2007-03-07 09:35:43 +00:00
Denis Vlasenko
b30418ac19 less: support xterm's home/end; improve forward search 2007-02-14 20:49:14 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
50ddabc859 less: fix <tab><backspace> buglet 2006-12-31 19:36:01 +00:00
Denis Vlasenko
95b307103a less: interpret backspace.
less is officially declared PAGER-capable! ;)
(this includes viewing of manpages)
2006-12-31 19:23:31 +00:00
Denis Vlasenko
806116b234 fixes from Yann E. MORIN <yann.morin.1998@anciens.enib.fr> 2006-12-31 12:14:16 +00:00
Denis Vlasenko
3bba545a54 done a dozen of randconfig test. guess what? ALL failed...
these are resulting fixes
2006-12-30 17:57:03 +00:00
Denis Vlasenko
5a4f0994b0 less: fix regexp search '/' on large files 2006-12-25 01:23:02 +00:00
Denis Vlasenko
7cea262273 small stupid changes. no code changes 2006-12-24 07:30:09 +00:00
Denis Vlasenko
f4dff77355 less: implement waiting for input using select(). Rather tricky business.
But we do not read entire input anymore up-front.
2006-12-24 07:14:17 +00:00
Denis Vlasenko
f1282a8792 less: a few fixes for cases where we overflow status line 2006-12-21 17:03:20 +00:00
Denis Vlasenko
f65d1338dc less: restore TAB display (was showing as inverse I after prev changes :) 2006-12-21 15:23:45 +00:00
Denis Vlasenko
d51d14e36f less: "(null)" is a bit strange. "standard input" is better :) 2006-12-21 13:57:37 +00:00
Denis Vlasenko
e147a72173 less: how many different kinds of status line we need, three?!
small fixes. [prev commit also added control char filtering
on input (e.g. regexp input, filename input for 'E' etc)]
2006-12-21 13:26:54 +00:00
Denis Vlasenko
e865e81d34 less: stop dying on bad regexps, quietly pipe data w/o
user interaction if stdout is not a tty.
size optimizations
2006-12-21 13:24:58 +00:00
Denis Vlasenko
3f3190e34c less: total cleanup and bugfix.
Doesn't die horribly on binary files anymore.
In fact, they _100%_ work now. Control chars
are in reverse video, including DEL and that idiocy of VT-10x,
Meta-ESC [inventor of which should be prohibited from reproducing].
Regex search is fixed also. When you specify search ('/' key),
control chars turn into dots (unhighlighted),
and found occurrences highlighted instead. This is reversible.
Memory management fixed (was leaky as hell) and optimized.
Linewrapping fixed and thoroughly tested.
Max buffer size made configurable.
~ 600 bytes saved.
2006-12-21 00:22:03 +00:00
Denis Vlasenko
9a7cef930f less: somewhat buggy applet, but nice. Muchly reduced
xstrdup'ing and memory consumption. Made linewrap saner.
regex matching code was awful - still buggy, but not as
leaky as before. Made buffer size configurable. Killed
several static and on-stack buffers. Hopefully eliminated
staircase effect on Ctrl-C (unable to reproduce).
2006-12-20 02:46:48 +00:00
Bernhard Reutner-Fischer
882e60c442 - shrink less.
01a: svn version
01b: merge past_eof and inp_stdin into flags.
01c: merge match_backwards into flags.
01d: add handling of <HOME> and <END> keys, remove set_tty_raw, use fflush_stdout_and_exit
01e: rewrite special-key handling to be smaller.
01f: changing the format saves 4 bytes (alot of places would benefit from this)
   text    data     bss     dec     hex filename
   9034       8     648    9690    25da less.o.01a
   9023       8     640    9671    25c7 less.o.01b
   9027       8     636    9671    25c7 less.o.01c
   9068       8     636    9712    25f0 less.o.01d
   8990       8     636    9634    25a2 less.o.01e
   8986       8     636    9630    259e less.o.01f
2006-12-04 16:04:50 +00:00
Denis Vlasenko
f0ed376eda remove bb_printf and the like 2006-10-26 23:21:47 +00:00
Denis Vlasenko
e1a0d486e4 message string changes, mostly for consistency, also -32 bytes in .rodata 2006-10-20 13:28:22 +00:00
Denis Vlasenko
67b23e6043 getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
2006-10-03 21:00:06 +00:00