Commit Graph

93 Commits

Author SHA1 Message Date
Denys Vlasenko
79b021d738 tail: read only a portion of a file if it's huge. closes bug 551
function                                             old     new   delta
tail_main                                           1494    1526     +32
tail_read                                            125     129      +4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-10 03:16:18 +02:00
Denys Vlasenko
a43df64eec tail: fix "tail +N file_shorter_than_N"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-09 22:06:56 +02:00
Eric Lammerts
3b5a664440 tail: implement -F
function                                             old     new   delta
tail_main                                           1190    1494    +304

Signed-off-by: Eric Lammerts <busybox@lists.lammerts.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-22 00:31:27 +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
3603cd2808 tail: fix tail +N syntax not working. Closes bug 221. 2009-03-27 02:36:02 +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
69ca5a70fd tail: fix fallout from tail -c optimization 2008-03-23 03:28:40 +00:00
Denis Vlasenko
1d42665b6b *: shrink: use Vladimir's "o+" specifier instead of xatou(opt_param)
function                                             old     new   delta
getopt32                                            1370    1385     +15
sulogin_main                                         490     494      +4
realpath_main                                         84      86      +2
sleep_main                                            76      77      +1
mt_main                                              256     257      +1
printenv_main                                         75      74      -1
fdformat_main                                        546     545      -1
usleep_main                                           44      42      -2
setlogcons_main                                       77      75      -2
ed_main                                             2654    2649      -5
deallocvt_main                                        69      64      -5
addgroup_main                                        373     368      -5
mkfs_minix_main                                     2989    2982      -7
tail_main                                           1221    1213      -8
sv_main                                             1254    1241     -13
du_main                                              348     328     -20
tftp_main                                            325     302     -23
split_main                                           581     558     -23
nc_main                                             1000     977     -23
diff_main                                            891     868     -23
arping_main                                         1797    1770     -27
ls_main                                              893     847     -46
od_main                                             2797    2750     -47
readprofile_main                                    1944    1895     -49
tcpudpsvd_main                                      1973    1922     -51
udhcpc_main                                         2590    2513     -77
grep_main                                            824     722    -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/22 up/down: 23/-560)         Total: -537 bytes
   text    data     bss     dec     hex filename
 796973     658    7428  805059   c48c3 busybox_old
 796479     662    7420  804561   c46d1 busybox_unstripped
2008-03-17 09:09:09 +00:00
Denis Vlasenko
62a90cdd74 *: shrink by using [f]open_or_warn_stdin where appropriate
function                                             old     new   delta
lsattr_main                                           62     143     +81
open_or_warn_stdin                                     -      36     +36
fclose_if_not_stdin                                   20      47     +27
xfopen_stdin                                           -      20     +20
tac_main                                             336     356     +20
cksum_main                                           249     259     +10
bb_argv_dash                                           -       8      +8
su_main                                              448     455      +7
cmp_main                                             630     633      +3
passwd_main                                         1072    1074      +2
uudecode_main                                        317     315      -2
text_yank                                            110     108      -2
handle_incoming_and_exit                            2653    2651      -2
flags                                                  5       1      -4
write_leases                                         235     230      -5
fopen_or_warn_stdin                                   48      42      -6
fold_main                                            648     642      -6
static.argv_dash                                       8       -      -8
sum_main                                             142     128     -14
tail_main                                           1237    1221     -16
sed_main                                             711     695     -16
cmp_xfopen_input                                      17       -     -17
bb_cat                                               113      96     -17
catv_main                                            328     306     -22
strings_main                                         457     434     -23
hash_file                                            298     274     -24
sum_file                                             353     325     -28
sort_main                                            904     859     -45
expand_main                                          736     686     -50
cut_main                                            1116    1065     -51
md5_sha1_sum_main                                    549     493     -56
lsattr_args                                           90       -     -90
read_stduu                                           408     255    -153
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 7/20 up/down: 214/-657)        Total: -443 bytes
   text    data     bss     dec     hex filename
 797417     658    7428  805503   c4a7f busybox_old
 796973     658    7428  805059   c48c3 busybox_unstripped
2008-03-17 09:07:36 +00:00
Denis Vlasenko
e8419c90f1 tail: fix "tail -c 20 /dev/huge_disk" (was taking ages)
tail: a few variables renamed
wc: tiny optimization.
2008-02-19 00:38:10 +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
226002ea74 tail: sizeof(buf) is sizeof(char*)! must be BUFSIZ 2007-10-05 19:17:16 +00:00
Denis Vlasenko
368a12efc2 tail: work correctly on /proc files (Kazuo TAKADA <kztakada@sm.sony.co.jp>) 2007-10-02 10:17:56 +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
f868963c67 multiplier suffixes are short, store them directly in struct suffix_mult
function                                             old     new   delta
xstrtoul_range_sfx                                   226     217      -9
xstrtoull_range_sfx                                  291     280     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-20)             Total: -20 bytes
   text    data     bss     dec     hex filename
 669128    2668   13616  685412   a7564 busybox_old
 669108    2668   13616  685392   a7550 busybox_unstripped
2007-07-27 15:06:25 +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
92c0b8222e tail: fix SEGV on "tail -N"
config system: clarify PREFER_APPLETS/SH_STANDALONE effects in help text
2007-05-08 17:27:17 +00:00
Denis Vlasenko
ac678ec2f1 style fixes, no code changes 2007-04-16 22:32:04 +00:00
Bernhard Reutner-Fischer
d9c2d5fe4f - minor shrinkage
text    data     bss     dec     hex filename
   1431       0       4    1435     59b tail.o.orig
   1396       0       0    1396     574 tail.o
2007-04-04 20:29:15 +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
a41fdf331a preparatory patch for -Wwrite-strings #1 2007-01-29 22:51:00 +00:00
Bernhard Reutner-Fischer
84d2d493b4 - remove nested function. Saves ~30 bytes. 2007-01-24 21:38:10 +00:00
Bernhard Reutner-Fischer
8b1ae45037 - small size tweak 2007-01-20 21:31:21 +00:00
Denis Vlasenko
ace35eeb88 Remove networking/libiproute/linux/pkt_sched.h
(and networking/libiproute/linux/ since it become empty).
Style fixes.
2007-01-02 16:32:16 +00:00
Denis Vlasenko
e31f721e14 tail: -50 text bytes 2006-12-22 16:06:16 +00:00
Denis Vlasenko
0849207ce0 convert "negaite" config option into reversed (INCLUDE_SUSv2) 2006-12-22 13:56:36 +00:00
Denis Vlasenko
6910741067 tail: fix tail +N 2006-12-21 00:43:06 +00:00
Denis Vlasenko
b95636c52f remove casts from xmalloc() 2006-12-19 23:36:04 +00:00
Denis Vlasenko
83e5d6f772 A bunch of defined(__GLIBC__) added. static-linking warning expanded 2006-12-18 21:49:06 +00:00
Denis Vlasenko
9f739445cd inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid] 2006-12-16 23:49:13 +00:00
Denis Vlasenko
459903bd4e Provide our own isdigit macro. saves more than 400 bytes. 2006-11-27 14:44:18 +00:00
Denis Vlasenko
1385899416 attempt to regularize atoi mess. 2006-10-08 12:49:22 +00:00
Bernhard Reutner-Fischer
73561cc75a - pull from busybox_scratch: r15829:15850
Various fixes, cleanups and shrinkage:
saves 952 Bytes:
   text    data     bss     dec     hex filename
1087742   15853  790632 1894227  1ce753 ../busybox/busybox.old
1086790   15853  790632 1893275  1ce39b busybox
via:
# scripts/bloat-o-meter ../busybox/busybox_unstripped.old busybox_unstripped 
function                                             old     new   delta
ipcrm_main                                           756     822     +66
getval                                                 -      61     +61
maybe_set_utc                                          -      40     +40
udhcpc_main                                         2896    2912     +16
md5_hash_block                                       428     437      +9
opt                                                    8      16      +8
qgravechar                                           106     110      +4
make_bitmap                                          292     295      +3
inflate_unzip                                       2056    2059      +3
add_partition                                       1412    1414      +2
__parsespent                                         156     158      +2
qrealloc                                              41      42      +1
format                                                 -       1      +1
catv_main                                            313     314      +1
watch_main                                           293     292      -1
varunset                                              81      80      -1
part                                                   1       -      -1
check_if_skip                                        837     836      -1
start_stop_daemon_main                               840     837      -3
create_lost_and_found                                175     172      -3
supress_non_delimited_lines                            4       -      -4
static.l                                               4       -      -4
static.c                                               5       1      -4
bsd_sum_file                                         237     233      -4
eval2                                                338     332      -6
arithmetic_common                                    166     158      -8
cmpfunc                                               22       5     -17
cksum_main                                           294     275     -19
cmp_main                                             465     439     -26
dd_main                                             1535    1508     -27
rmmod_main                                           376     333     -43
cut_file                                             727     644     -83
ipcs_main                                           3809    3721     -88
cut_main                                             722     614    -108
date_main                                           1443    1263    -180
remove_ids                                           222       -    -222
------------------------------------------------------------------------------
(add/remove: 3/4 grow/shrink: 11/18 up/down: 217/-853)       Total: -636 bytes
2006-08-28 23:31:54 +00:00
Rob Landley
534374755d Cleaup read() and write() variants, plus a couple of new functions like
xlseek and fdlength() for the new mkswap.
2006-07-16 08:14:35 +00:00
Bernhard Reutner-Fischer
1b9d7c9aa9 - use bb_msg_{read,write}_error where appropriate.
text	   data	    bss	    dec	    hex	filename
 825015	   9100	 645216	1479331	 1692a3	busybox.old
 824919	   9100	 645216	1479235	 169243	busybox
2006-06-03 22:45:37 +00:00
Rob Landley
f8fd4db92f Move SUSv2 obsolete feature disabling to debug menu, invert meaning of
symbol (switched on to remove now: test your apps to make sure they _don't_
do this, because as some point we should just yank it), fixup head/tail/fold.

Also tweak "make allyesconfig" so anything starting with CONFIG_DEBUG gets
left switched off.  Possibly other things we want to put in the debug menu?
2006-01-30 01:30:39 +00:00
Bernhard Reutner-Fischer
9a14bd04f8 - Stephane Billiart writes:
Fix the compilation of head and tail.

  thanks!
2005-12-15 11:47:16 +00:00
Bernhard Reutner-Fischer
5816ccb190 - wrap label GET_COUNT in #if ENABLE_FEATURE_FANCY_applet to avoid warning
about unused label.
2005-12-13 10:48:45 +00:00
Glenn L McGrath
0bd0257fe0 Add build options to control SuS compatability, allows numeric
option handling to be disabled.
Defaults to enabled, so no changes in default behaviour
2005-12-11 03:09:05 +00:00
Rob Landley
58a651b2e5 Very minor tweak to tail. 2005-08-13 00:35:00 +00:00
Mike Frysinger
dbc049fda4 remove unused variable ret as reported by apgo in Bug 350 and touchup syntax along the way 2005-07-26 22:57:51 +00:00
Paul Fox
4905434b8a applying fix for:
0000265: tail -f should keep following files even if they
                    were truncated
2005-07-20 19:46:32 +00:00
Rob Landley
b9dfb8c03f Manuel points out that if printf needs a flush to act like dprintf, the result
is bigger.  Revert last patch.
2005-05-07 17:45:38 +00:00
Rob Landley
cce1ae2ce5 Shaun Jackman pointed out that dprintf(STDOUT_FILENO,...) is just a printf. 2005-05-07 07:53:16 +00:00
Glenn L McGrath
f86391e7d7 Patch from William Barsse to fix a segfault when multiple files are specified. 2004-09-30 00:24:21 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Glenn L McGrath
4ef5a84583 Move the tail -c option from FANCY_TAIL to the default tail, this makes
the default tail options conform to SUSv3, with the non-SUS
option all in FANCY_TAIL
2003-10-31 00:35:59 +00:00
Eric Andersen
b5b5ac3237 trivial fix to make sure we have sufficient arguments before
we mess with a possibly non-existant argv[1]
 -Erik
2003-03-28 16:54:14 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00