Commit Graph

671 Commits

Author SHA1 Message Date
Denys Vlasenko
40e7d25aca mkXXXX: unify [KBYTES] parameter handling (added it to mkswap)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-01 23:48:27 +01:00
Denys Vlasenko
d8528b8e56 ls: unicode fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-31 05:15:38 +01:00
Denys Vlasenko
9c3b84a304 ls: make it so that group never glues itself to file size
+ smaller enhancements: inode is long long; -h is a bit narrower; etc

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-18 01:55:00 +01:00
Denys Vlasenko
a40f0624db cp: fix -H handling
function                                             old     new   delta
copy_file                                           1495    1518     +23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-15 22:05:07 +01:00
Denys Vlasenko
f2c8aa6676 libbb: introduce and use monotonic_ms
function                                             old     new   delta
monotonic_ms                                           -      60     +60
process_stdin                                        433     443     +10
display_speed                                         85      90      +5
nmeter_main                                          672     674      +2
builtin_type                                         114     116      +2
bb__parsespent                                       117     119      +2
ifplugd_main                                        1110    1109      -1
acpid_main                                           441     440      -1
chat_main                                           1361    1359      -2
doCommands                                          2458    2449      -9
arpping                                              466     450     -16
run_command                                          268     234     -34
readcmd                                             1072    1034     -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/7 up/down: 81/-101)           Total: -20 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 12:52:30 +01:00
Denys Vlasenko
dc698bb038 *: make it easier to distinquish "struct tm", pointer to one, etc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-09 19:10:49 +01:00
Denys Vlasenko
a355da0775 *: make 2 more "int argc"'s unused; more saved if !DESKTOP
function                                             old     new   delta
sync_main                                             18      20      +2
tty_main                                              90      87      -3
iprule_list                                           83      79      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 13:16:08 +01:00
Denys Vlasenko
e992bae6f9 *: remove a few more cases of argc usage. -89 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-28 15:18:53 +01:00
Denys Vlasenko
b2e5fc35eb ntpd: and real handling for -N, show usage w/o options; trim text
function                                             old     new   delta
ntp_init                                             317     348     +31
bb_msg_you_must_be_root                                -      17     +17
xsocket                                               66      76     +10
changepath                                           195     194      -1
bb_msg_perm_denied_are_you_root                       35      34      -1
send_tree                                            355     353      -2
count_lines                                           74      72      -2
must_be_root                                          17       -     -17
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/4 up/down: 58/-23)             Total: 35 bytes
   text   data    bss    dec    hexfilename
 832873    441   7548 840862  cd49ebusybox_old
 832839    441   7548 840828  cd47cbusybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-25 14:52:47 +01:00
Denys Vlasenko
b1278a38bc ntpd: locally bind every peer socket. +22 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-24 16:03:47 +01:00
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
a7ccdeef39 libbb: added xfdopen_for_read/write
function                                             old     new   delta
xfdopen_helper                                         -      40     +40
logdir_open                                         1163    1184     +21
process_stdin                                        433     443     +10
xfdopen_for_write                                      -       9      +9
doCommands                                          2465    2474      +9
patch_main                                          1214    1222      +8
bbunpack                                             457     465      +8
xfdopen_for_read                                       -       7      +7
scan_tree                                            258     262      +4
xstrtoul_range_sfx                                   230     231      +1
sendmail_main                                        957     955      -2
passwd_main                                         1027    1023      -4
parse                                                969     964      -5
test_main                                            253     247      -6
sed_main                                             655     649      -6
dos2unix_main                                        437     429      -8
fbsplash_main                                        950     938     -12
handle_dir_common                                    371     354     -17
expand_vars_to_list                                 2197    2169     -28
update_passwd                                       1275    1246     -29
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 7/10 up/down: 117/-117)           Total: 0 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-15 23:28:11 +01:00
Bernhard Reutner-Fischer
cc8b6871a7 use utimes() rather than obsolescent utime()
utime is obsolescent in POSIX.1-2008, use utimes() for now.
Untested.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-11-14 23:35:00 +01:00
Magnus Damm
f5914992f3 wget: factor out progress bar code
Signed-off-by: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-08 16:34:43 +01:00
Denys Vlasenko
b57eee8beb libbb.h: remove two over-zealous RETURNS_MALLOC
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-04 17:54:17 +01:00
Denys Vlasenko
53283adb24 include/libbb.h: mark malloc-returning functions with GCC attribute
function                                             old     new   delta
ash_main                                            1336    1365     +29
readcmd                                             1062    1072     +10
add_split_dependencies                               707     717     +10
rtnl_talk                                            539     548      +9
normalize                                            165     174      +9
xmalloc_optname_optval                               583     590      +7
test_main                                            247     253      +6
insert_bg_job                                        366     371      +5
dname_enc                                            391     395      +4
nslookup_main                                        165     168      +3
ifplugd_main                                        1099    1102      +3
tftpd_main                                           493     495      +2
make_new_session                                     413     415      +2
localcmd                                             274     276      +2
date_main                                            696     698      +2
tee_main                                             317     318      +1
setvar                                               183     184      +1
hash_find                                            233     234      +1
xrtnl_dump_filter                                    400     399      -1
prepend_new_eth_table                                297     295      -2
unpack_Z_stream                                     1229    1226      -3
read_line_input                                     4823    4820      -3
do_load                                              523     520      -3
udhcp_run_script                                     669     665      -4
mkfs_vfat_main                                      1609    1605      -4
rtnl_rtprot_initialize                                70      65      -5
procps_scan                                         1842    1835      -7
read_opt                                             873     865      -8
ifupdown_main                                       2133    2125      -8
mkfs_ext2_main                                      2492    2482     -10
logread_main                                         503     492     -11
svlogd_main                                         1441    1429     -12
rewrite                                             1032    1018     -14
fbsplash_main                                        917     903     -14
str2sockaddr                                         431     405     -26
unpack_lzma_stream                                  2705    2677     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 18/18 up/down: 106/-163)        Total: -57 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 14:20:34 +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
Bernhard Reutner-Fischer
a48308701a add and use xopen_nonblocking (-18b)
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-27 17:17:34 +01:00
Denys Vlasenko
180f585ac3 read_key: remove handling for ctrl-up/down, we don't use that. -12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-26 00:59:59 +01:00
Denys Vlasenko
a17eeb847e lineedit: handle Ctrl-arrows
function                                             old     new   delta
read_line_input                                     4629    4824    +195
BB_isalnum                                             -      39     +39
BB_ispunct                                             -      35     +35
BB_isspace                                             -      31     +31
static.esccmds                                        69      93     +24
vi_word_motion                                       165     162      -3
vi_back_motion                                       204     198      -6
vi_end_motion                                        172     163      -9
bb_iswspace                                           28       -     -28
bb_iswpunct                                           32       -     -32
bb_iswalnum                                           37       -     -37
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 5/8 up/down: 334/-129)          Total: 205 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-25 23:50:56 +01:00
Denys Vlasenko
9d57a8073a libbb.h: tidy it up a bit. no code changes (verified)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23 14:24:44 +02:00
Denys Vlasenko
11c12c4720 fix isalnum and isxdigit. Unfortunately, +285 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23 13:57:24 +02:00
Denys Vlasenko
a7a1fd02cb eliminate all remaining users of ctype. ~600 byte large tables are gone.
function                                             old     new   delta
skip_thing                                           253     278     +25
find_range                                           497     508     +11
ask                                                  220     228      +8
...
setlocalenv                                           90      82      -8
bb_strtoll                                            84      76      -8
bb_strtol                                             85      77      -8
is_well_formed_var_name                               75      66      -9
expand                                               651     641     -10
endofname                                            104      92     -12
buffer_fill_and_print                                196     179     -17
isxdigit                                              18       -     -18
httpd_main                                           729     711     -18
__GI_isxdigit                                         18       -     -18
ispunct                                               20       -     -20
isalnum                                               20       -     -20
__GI_ispunct                                          20       -     -20
__GI_isalnum                                          20       -     -20
toupper                                               29       -     -29
tolower                                               29       -     -29
__GI_toupper                                          29       -     -29
__GI_tolower                                          29       -     -29
do_cmd                                              4454    4330    -124
------------------------------------------------------------------------------
(add/remove: 0/12 grow/shrink: 14/29 up/down: 81/-549)       Total: -468 bytes
   text	   data	    bss	    dec	    hex	filename
 823051	    445	   7548	 831044	  cae44	busybox_old
 821970	    441	   7548	 829959	  caa07	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23 13:05:03 +02:00
Denys Vlasenko
f2cbb03a37 *: optimize most of isXXXXX() macros
text    data     bss     dec     hex filename
 824164     453    6812  831429   cafc5 busybox_old
 823730     453    6812  830995   cae13 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23 03:16:08 +02:00
Denys Vlasenko
7b4cd6f7b0 libbb: smaller isdigit. -95 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23 02:22:03 +02:00
Denys Vlasenko
f125b6d341 *: use better isspace implementation
function                                             old     new   delta
asciifile                                             90     106     +16
expand                                               653     658      +5
skip_non_whitespace                                   21      25      +4
bb_iswspace                                           25      28      +3
readcmd                                             1071    1072      +1
find_range                                           496     497      +1
singlemount                                          772     771      -1
ifupdown_main                                       2134    2133      -1
edir                                                 370     369      -1
volume_id_set_label_string                            82      79      -3
trim                                                  85      82      -3
rtc_adjtime_is_utc                                   141     138      -3
rewrite                                             1039    1036      -3
do_cmd                                              4465    4462      -3
bb_dump_add                                          358     355      -3
awk_split                                            553     550      -3
fbset_main                                          1273    1268      -5
skip_thing                                           259     253      -6
get_trimmed_slice                                     46      39      -7
bb__parsegrent                                       245     238      -7
parse_file_cmd                                       116     108      -8
check                                               1532    1523      -9
bb__pgsreader                                        198     188     -10
dot_skip_over_ws                                      61      46     -15
colon                                               3032    3012     -20
if_readlist_proc                                     655     634     -21
normalize                                            193     165     -28
add_cmd                                             1162    1133     -29
get_key                                              528     476     -52
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/23 up/down: 30/-241)         Total: -211 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-22 19:41:45 +02:00
Denys Vlasenko
36df04837a randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-19 16:07:28 +02:00
Vladimir Dronnikov
db67a20595 move generate_uuid from mkswap to libbb
Signed-off-by: Vladimir Dronnikov <dronnikov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-15 09:24:25 +02:00
Denys Vlasenko
0bf44d00a4 libbb/human_readable.c: shrink; and reduce bss usage
also, move smart_ulltoaN there and comment usage locations

function                                             old     new   delta
static.unit_chars                                      7       9      +2
utoa_to_buf                                          110     108      -2
make_human_readable_str                              262     258      -4
fallbackSort                                        1723    1719      -4
static.fmt                                            97      92      -5
static.fmt_tenths                                     10       -     -10
static.str                                            21       4     -17
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/5 up/down: 2/-42)             Total: -40 bytes
   text    data     bss     dec     hex filename
 820981     453    6932  828366   ca3ce busybox_old
 820968     453    6916  828337   ca3b1 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-13 01:25:09 +02:00
Denys Vlasenko
dcd27abcc4 unpackers: check errors from close() too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-05 03:03:07 +02:00
Denys Vlasenko
8f7a6d294f find: -follow should not error out on dandling links
function                                             old     new   delta
recursive_action                                     425     465     +40
find_main                                            436     465     +29
test_main                                            247     253      +6
need_print                                             1       -      -1
doCommands                                          2523    2521      -2
compare_keys                                         737     735      -2
xdev_dev                                               4       -      -4
xdev_count                                             4       -      -4
recurse_flags                                          4       -      -4
mkfs_vfat_main                                      1609    1605      -4
actions                                                4       -      -4
fileAction                                           588     583      -5
------------------------------------------------------------------------------
(add/remove: 0/5 grow/shrink: 3/4 up/down: 75/-30)             Total: 45 bytes
   text	   data	    bss	    dec	    hex	filename
 822711	    450	   7684	 830845	  cad7d	busybox_old
 822773	    445	   7668	 830886	  cada6	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-29 11:07:04 +02:00
Denys Vlasenko
4ff1ce0639 ps: fix compile breakage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-22 11:21:48 +02:00
Denys Vlasenko
b410d4ada7 ps,top: add an option to show threads. +260 bytes of code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-19 22:29:42 +02:00
Denys Vlasenko
3a0f6f2328 fix read_cmdline API and a small buglet where "[comm]" may be too narrow
function                                             old     new   delta
func_args                                             25      26      +1
read_cmdline                                         119     114      -5
display_process_list                                1462    1447     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 1/-20)             Total: -19 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-12 00:15:34 +02:00
Denys Vlasenko
5370bfb123 documentation and typo fixes. By Dan Fandrich (dan AT coneharvesters.com)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 02:58:59 +02:00
Denys Vlasenko
90a9904e9e remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)
function                                             old     new   delta
logdirs_reopen                                      1310    1308      -2
read_line_input                                     4757    4753      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6)               Total: -6 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 02:36:23 +02:00
Denys Vlasenko
f2a8d5db9a fix duplicate FAST_FUNC FAST_FUNC
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-21 17:40:36 +02:00
Alexander Shishkin
e766f62132 make find_pid_by_name look at /proc/PID/exe too
function                                             old     new   delta
procps_scan                                         1642    1709     +67
find_pid_by_name                                     193     223     +30
free_procps_scan                                      29      37      +8

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-29 01:35:13 +02:00
Denys Vlasenko
6ae6426a74 fix mountpoint test to not prevemt mkfs_xxx from making image in any file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-18 16:22:26 +02:00
Denys Vlasenko
7aca89a7a3 touch: implement -d --date (our own testsuite needs that)
function                                             old     new   delta
static.uname_longopts                                  -     137    +137
touch_main                                           231     360    +129
static.touch_longopts                                  -      32     +32
validate_tm_time                                       -      28     +28
packed_usage                                       26616   26624      +8
date_main                                            687     686      -1
static.longopts                                      162       -    -162
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/1 up/down: 334/-163)          Total: 171 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-18 03:41:29 +02:00
Denys Vlasenko
73b71f381d date: factor out date parsing (in preparation for touch -d)
function                                             old     new   delta
parse_datestr                                          -     391    +391
sha512_process_block128                             1283    1310     +27
buffer_fill_and_print                                179     196     +17
nexpr                                                826     840     +14
unzip_main                                          1931    1939      +8
popstring                                            134     140      +6
qrealloc                                              33      36      +3
builtin_umask                                        121     123      +2
evalvar                                             1365    1363      -2
changepath                                           194     192      -2
do_compress                                         1698    1688     -10
hwclock_main                                         340     329     -11
cmdputs                                              414     402     -12
identify                                            4343    4329     -14
date_main                                           1186     687    -499
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 7/7 up/down: 468/-550)          Total: -82 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-18 03:40:35 +02:00
Denys Vlasenko
5c2e81bb67 fix a thinko in lineedit completion code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-16 14:14:34 +02:00
Mike Frysinger
52a426744e restore shadow.h independence
Commit ee5dce3365 made busybox require shadow.h from the toolchain even
if the config opted for the internal busybox implementation.  This makes
building with toolchains that lack shadow support impossible.  Since the
merge only saved us from duplicating a simple structure (whose ABI isn't
going to ever change), restore the logic for complete busybox shadow
independence by reverting that previous commit slightly.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-09 01:35:29 -04:00
Denys Vlasenko
09e63bb81f df: fix "df /"
also, clean up mount checks in mkfs/fsck.

function                                             old     new   delta
find_mount_point                                     243     261     +18
sha1_process_block64                                 497     510     +13
find_main                                            436     444      +8
display_speed                                         85      90      +5
df_main                                              795     793      -2
parse_command                                       1463    1460      -3
static.ignored_mounts                                  8       -      -8
mkfs_minix_main                                     2962    2937     -25
fsck_minix_main                                     3065    2970     -95
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/4 up/down: 44/-133)           Total: -89 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-05 04:50:36 +02:00
Denys Vlasenko
9b1b62adc4 Patches to enable FreeBSD build
platform.h: fix wrong check for endianness, fix lchown
aliasing to chown on uclibc.

Code seems to not be affected in my testing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-05 03:34:12 +02:00
Denys Vlasenko
fca70a8cce ps: conditionally support additional -o FIELDs
function                                             old     new   delta
procps_scan                                         1409    1642    +233
out_spec                                             220     300     +80
func_ruser                                             -      36     +36
func_rgroup                                            -      36     +36
func_group                                            13      49     +36
func_nice                                              -      29     +29
buffer_fill_and_print                                179     196     +17
send_tree                                            355     360      +5
mkfs_vfat_main                                      1604    1609      +5
display_speed                                         85      90      +5
scriptreplay_main                                    194     197      +3
find_out_spec                                         55      58      +3
changepath                                           192     195      +3
sha1_process_block64                                 497     484     -13
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 10/1 up/down: 491/-13)          Total: 478 bytes

Signed-off-by: David Krakov <krakov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-03 22:16:17 +02:00
Denys Vlasenko
f3b92d3856 getopt: FEATURE_GETOPT_LONG for -l; rename GETOPT_LONG to LONG_OPTS
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-19 12:10:38 +02:00
Denys Vlasenko
8f24f9812d stop using non-standard macro, use WEXITSTATUS instead
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-07 16:02:00 +02:00
Denys Vlasenko
4b7db4f2ca read_key: drop optimization where we read 3 bytes at once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-29 10:39:06 +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