Commit Graph

1111 Commits

Author SHA1 Message Date
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
1d10aaf116 passwd: fix bug: we are trying to update shadow even if user's record is in passwd!
getspnam is guilty, it lies that user record exists in shadow.
2007-07-27 11:22:34 +00:00
Denis Vlasenko
3734b946bf bb_getpwuid, bb_getgrgid: change order of arguments to more intuitive one;
comment thoroughly when they die and when they dont.
2007-07-27 11:20:10 +00:00
Denis Vlasenko
990d0f63ee Replace index_in_[sub]str_array with index_in_[sub]strings,
which scans thru "abc\0def\0123\0\0" type strings. Saves 250 bytes.

   text    data     bss     dec     hex filename
 781266    1328   11844  794438   c1f46 busybox_old
 781010    1328   11844  794182   c1e46 busybox_unstripped
2007-07-24 15:54:42 +00:00
Denis Vlasenko
1da77728d7 setfiles: small tweaks to usage text and code 2007-07-24 06:17:43 +00:00
Denis Vlasenko
bdc88fdc68 rework long option handling. saves ~1.2k
function                                             old     new   delta
tar_longopts                                           -     222    +222
static.udhcpc_longopts                                 -     192    +192
start_stop_daemon_longopts                             -     150    +150
getopt32                                            1045    1185    +140
static.wget_longopts                                   -     111    +111
static.od_longopts                                     -     105    +105
getopt_longopts                                        -      96     +96
install_longopts                                       -      67     +67
ipcalc_longopts                                        -      63     +63
static.hwclock_longopts                                -      54     +54
ftpgetput_longopts                                     -      52     +52
static.dumpleases_longopts                             -      32     +32
env_longopts                                           -      31     +31
runparts_longopts                                      -      30     +30
mv_longopts                                            -      24     +24
mkdir_longopts                                         -      19     +19
find_pair                                            164     180     +16
bb_null_long_options                                   -      16     +16
setconsole_longopts                                    -      10     +10
display_speed                                         91      98      +7
collect_blk                                          467     474      +7
show_color                                             4       1      -3
ls_main                                              913     904      -9
bb_default_long_options                               16       -     -16
ls_color_opt                                          32      10     -22
setconsole_long_options                               32       -     -32
arith                                               2077    2030     -47
mv_long_options                                       48       -     -48
mkdir_long_options                                    48       -     -48
env_long_options                                      48       -     -48
static.options                                       248     184     -64
runparts_long_options                                 80       -     -80
ftpgetput_long_options                                96       -     -96
static.hwclock_long_options                          112       -    -112
install_long_options                                 112       -    -112
static.long_options                                  144       -    -144
static.wget_long_options                             160       -    -160
longopts                                             160       -    -160
static.arg_options                                   304       -    -304
tar_long_options                                     320       -    -320
long_options                                         384       -    -384
------------------------------------------------------------------------------
(add/remove: 17/15 grow/shrink: 4/5 up/down: 1444/-2209)     Total: -765 bytes
   text    data     bss     dec     hex filename
 782618    1328   11900  795846   c24c6 busybox_old
 781354    1328   11900  794582   c1fd6 busybox_unstripped
2007-07-23 17:14:14 +00:00
Denis Vlasenko
397137b815 setfiles,restorecon: new SELinux applets by Yuichi Nakamura <ynakam@hitachisoft.jp> 2007-07-23 14:03:30 +00:00
Denis Vlasenko
b71c668c57 style fix (stray space before ';') 2007-07-21 15:08:09 +00:00
Denis Vlasenko
091965768d libbb: nuke BB_GETOPT_ERROR, always die if there are mutually exclusive options
find_pair                                            164     180     +16
passwd_main                                         1222    1230      +8
display_speed                                         91      96      +5
msh_main                                            1335    1339      +4
qrealloc                                              38      36      -2
refresh                                             1190    1182      -8
cut_main                                             543     532     -11
sendCgi                                             1807    1794     -13
getopt32                                            1063    1045     -18
arith                                               2077    2030     -47
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/6 up/down: 33/-99)            Total: -66 bytes
   text    data     bss     dec     hex filename
 781548    1168   11900  794616   c1ff8 busybox_old
 781452    1168   11900  794520   c1f98 busybox_unstripped
2007-07-21 13:27:44 +00:00
Denis Vlasenko
21d1014b5b chpasswd: new applet by Alexander Shishkin <virtuoso@slind.org> 2007-07-20 21:28:41 +00:00
Denis Vlasenko
b69e872229 Trim help text. With compressed help: -143 bytes
text    data     bss     dec     hex filename
 772572    1168   22680  796420   c2704 busybox_old
 772444    1168   22680  796292   c2684 busybox_unstripped
2007-07-18 21:57:24 +00:00
Denis Vlasenko
49a128a156 remove accumulated stray trailing whitespace 2007-07-17 21:42:59 +00:00
Denis Vlasenko
4652daace9 grep: implement -m MAX_MATCHES; fix help text
grep_file                                            771     822     +51
packed_usage                                       22573   22610     +37
.rodata                                           128058  128090     +32
grep_main                                            842     853     +11
max_matches                                            -       4      +4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 135/0)             Total: 135 bytes
2007-07-15 12:39:08 +00:00
Denis Vlasenko
fb79a2e2cf xioctl and friends by Tito <farmatito@tiscali.it>
function                                             old     new   delta
do_iptunnel                                          203     977    +774
process_dev                                         5328    5494    +166
ioctl_or_perror                                        -      54     +54
ioctl_or_perror_and_die                                -      51     +51
ioctl_alt_func                                         -      49     +49
bb_ioctl_or_warn                                       -      47     +47
do_add_ioctl                                         102     145     +43
bb_xioctl                                              -      39     +39
print_value_on_off                                     -      31     +31
get_lcm                                              105     123     +18
arp_main                                            2155    2167     +12
..................
zcip_main                                           1576    1566     -10
setlogcons_main                                       92      82     -10
dumpkmap_main                                        263     253     -10
do_get_ioctl                                          85      75     -10
setkeycodes_main                                     165     154     -11
write_table                                          244     232     -12
vconfig_main                                         318     306     -12
do_del_ioctl                                          93      81     -12
set_address                                           75      62     -13
maybe_set_utc                                         30      16     -14
loadfont_main                                        495     479     -16
slattach_main                                        712     695     -17
do_loadfont                                          191     174     -17
do_iplink                                           1155    1136     -19
getty_main                                          2583    2562     -21
fbset_main                                          2058    2035     -23
do_time                                              588     565     -23
xioctl                                                25       -     -25
read_rtc                                             186     160     -26
parse_conf                                          1299    1270     -29
udhcp_read_interface                                 269     239     -30
bb_ioctl                                              45       -     -45
bb_ioctl_alt                                          70       -     -70
bb_ioctl_on_off                                       78       -     -78
.rodata                                           129370  129018    -352
do_show                                              799       -    -799
------------------------------------------------------------------------------
(add/remove: 6/5 grow/shrink: 13/49 up/down: 1316/-1864)     Total: -548 bytes
   text	   data	    bss	    dec	    hex	filename
 675352	   2740	  13968	 692060	  a8f5c	busybox_old
 674804	   2740	  13968	 691512	  a8d38	busybox_unstripped
2007-07-14 22:07:14 +00:00
Denis Vlasenko
c540e75d74 fix applet order error 2007-07-06 16:57:06 +00:00
Denis Vlasenko
d166f83d74 md5_sha1_sum: fix mishandling when run as /bin/md5sum (with path)
chown/chgrp: completely match coreutils 6.8 wrt symlink handling

function                                             old     new   delta
recursive_action                                     411     422     +11
arith                                               2033    2042      +9
collect_blk                                          467     474      +7
dhcprelay_main                                      1122    1125      +3
fsck_main                                           1909    1911      +2
singlemount                                         4555    4547      -8
xmalloc_realpath                                      14       -     -14
get_lcm                                              123     105     -18
ed_main                                             3111    3084     -27
chown_main                                           217     183     -34
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 5/4 up/down: 32/-101)           Total: -69 bytes
   text    data     bss     dec     hex filename
 684132    2744   14000  700876   ab1cc busybox_old
 684060    2744   14000  700804   ab184 busybox_unstripped
2007-07-05 00:12:55 +00:00
Denis Vlasenko
c82b5108e1 udhcp: new config option "Rewrite the lease file at every new acknowledge"
(Mats Erik Andersson <mats@blue2net.com> (Blue2Net AB))
udhcp: consistently treat server_config.start/end IPs as host-order
       fix IP parsing for 64bit machines
       fix unsafe hton macro usage in read_opt()
       do not chdir("/") when daemonizing
       fix help text
2007-07-01 17:05:57 +00:00
Denis Vlasenko
98ebab8b76 top,ps: improve /proc/PID/cmdinfo reading code
function                                             old     new   delta
display_status                                         -    1231   +1231
read_cmdline                                           -     101    +101
parse_conf                                          1284    1303     +19
arith                                               2033    2042      +9
collect_blk                                          467     474      +7
fsck_main                                           1909    1911      +2
dhcprelay_main                                      1125    1122      -3
singlemount                                         4555    4547      -8
read_close                                            50      36     -14
get_lcm                                              123     105     -18
ed_main                                             3111    3084     -27
func_args                                             73      28     -45
procps_scan                                          732     658     -74
top_main                                            2187     899   -1288
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/8 up/down: 1369/-1477)       Total: -108 bytes
   text    data     bss     dec     hex filename
 676048    2744   13968  692760   a9218 busybox_old
 675940    2744   13968  692652   a91ac busybox_unstripped
2007-06-30 14:47:41 +00:00
Denis Vlasenko
dc757aa16c introduce and use bb_basename()
function                                             old     new   delta
bb_basename                                            -      26     +26
sv_main                                             1226    1225      -1
passwd_main                                         1985    1983      -2
showdirs                                             482     478      -4
sendCgi                                             1811    1807      -4
make_device                                         1354    1350      -4
handleIncoming                                      2443    2439      -4
func_name                                             82      78      -4
service_name                                        2292    2285      -7
main                                                 909     901      -8
cmp_main                                             555     547      -8
test_main                                            434     422     -12
act                                                  228     216     -12
find_pair                                            180     164     -16
rmmod_main                                           298     280     -18
find_pid_by_name                                     156     134     -22
modprobe_main                                       1606    1576     -30
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/16 up/down: 26/-156)         Total: -130 bytes
   text    data     bss     dec     hex filename
 734933    3028   14400  752361   b7ae9 busybox_old
 734801    3028   14400  752229   b7a65 busybox_unstripped
2007-06-30 08:04:05 +00:00
Denis Vlasenko
f7d07b1723 killall, pidof: use argv0 for process matching too
top: show cmdline, not comm field
(fixes problems with re-execed applets showing as processes with name "exe",
and not being found by pidof/killall by applet name)

function                                             old     new   delta
find_pid_by_name                                      98     156     +58
procps_scan                                          692     732     +40
top_main                                            2724    2762     +38
find_pair                                            164     180     +16
collect_int                                          114     123      +9
cmp_main                                             547     555      +8
collect_fork                                         112     119      +7
collect_ctx                                          112     119      +7
read_package_field                                   253     257      +4
passwd_main                                         1983    1985      +2
process_stdin                                        435     433      -2
xstrtoul_range_sfx                                   229     226      -3
get_next_block                                      1852    1849      -3
arith                                               2042    2033      -9
sv_main                                             1236    1226     -10
singlemount                                         4690    4672     -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 10/6 up/down: 189/-45)          Total: 144 bytes
   text    data     bss     dec     hex filename
 734789    3028   14400  752217   b7a59 busybox_old
 734933    3028   14400  752361   b7ae9 busybox_unstripped
2007-06-30 08:03:26 +00:00
Denis Vlasenko
e8240f19bd uuencode: shrink
function                                             old     new   delta
uuencode_main                                        427     337     -90
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-90)             Total: -90 bytes
   text    data     bss     dec     hex filename
 734981    3028   14400  752409   b7b19 busybox_old
 734889    3028   14400  752317   b7abd busybox_unstripped
2007-06-26 15:59:37 +00:00
Denis Vlasenko
80b8b39899 Consolidate ARRAY_SIZE macro; remove one unneeded global var (walter harms <wharms@bfs.de>) 2007-06-25 10:55:35 +00:00
Denis Vlasenko
198badafd8 pidof: size optimizations (-50 bytes) 2007-06-23 14:56:43 +00:00
Denis Vlasenko
b304eadca8 test: shrink a bit
function                                             old     new   delta
test_main                                              5     434    +429
bb_test                                              473       -    -473
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 429/-473)          Total: -44 bytes
   text    data     bss     dec     hex filename
 735073    3028   14408  752509   b7b7d busybox_old
 735029    3028   14408  752465   b7b51 busybox_unstripped
2007-06-21 13:35:52 +00:00
Bernhard Reutner-Fischer
9a33780152 - add ATTRIBUTE_UNUSED_RESULT for internal use 2007-06-21 10:39:20 +00:00
Denis Vlasenko
14923db72f slattach: new applet. 2007-06-20 15:23:03 +00:00
Denis Vlasenko
7510384107 do not do utime() on links, it acts on link targets, and we don't want that.
rename link_name to link_target, less confusing this way.
2007-06-20 14:49:47 +00:00
Denis Vlasenko
a19faf8bb7 find: -context support for SELinux (KaiGai Kohei <kaigai@kaigai.gr.jp>)
find: make it a bit smaller

function                                             old     new   delta
.rodata                                           129018  129050     +32
parse_params                                        1509    1346    -163
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 32/-163)          Total: -131 bytes
2007-06-19 22:22:57 +00:00
Denis Vlasenko
31789a81d5 top,ps: 'stringify' tty only when needed. -60 bytes. 2007-06-19 14:43:17 +00:00
Denis Vlasenko
6d9ea24611 networking/interface.c: huke remaining big statics; use malloc for INET[6]_rresolve
return value. Went thru callers and adjusted them - code got smaller too.

function                                             old     new   delta
ip_port_str                                            -     126    +126
INET6_rresolve                                       165     182     +17
static.cache                                          20      24      +4
route_main                                          2092    2091      -1
INET_sprint                                           61      59      -2
INET_nn                                                4       -      -4
INET6_sprint                                          59      53      -6
udp_do_one                                           518     508     -10
tcp_do_one                                           433     423     -10
raw_do_one                                           494     484     -10
traceroute_main                                     4117    4105     -12
INET_rresolve                                        334     321     -13
bb_displayroutes                                     494     456     -38
snprint_ip_port                                      244       -    -244
static.buff                                          264      16    -248
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/10 up/down: 147/-598)        Total: -451 bytes

size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 751073    3048   14688  768809   bbb29 busybox_old
 750873    3048   14440  768361   bb969 busybox_unstripped
2007-06-19 11:12:46 +00:00
Denis Vlasenko
1b16bdaebf networking/interface.c: reduce bss usage
function                                             old     new   delta
.rodata                                           158918  158950     +32
display_interfaces                                   133     153     +20
UNSPEC_print                                          56      68     +12
pr_ether                                              59      65      +6
static.proc_read                                       4       1      -3
interface_opt_a                                        4       1      -3
in_ether                                             139     136      -3
ifconfig_main                                       1296    1293      -3
if_readlist_proc                                     686     680      -6
ife_print                                           1350    1338     -12
do_if_print                                           46       -     -46
static.buff                                          369     264    -105
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/7 up/down: 70/-181)          Total: -111 bytes

# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 751073    3080   14800  768953   bbbb9 busybox_old
 751073    3048   14688  768809   bbb29 busybox_unstripped
2007-06-19 11:10:02 +00:00
Denis Vlasenko
bd7bb299c0 wget: use monotonic_sec instead of gettimeofday
zcip: use monotonic_us instead of gettimeofday
udhcpcd: simpler, shorter random_xid()

function                                             old     new   delta
monotonic_sec                                          -      41     +41
find_pair                                            164     180     +16
run_list_real                                       2018    2028     +10
cmp_main                                             547     555      +8
collect_ctx                                          112     119      +7
singlemount                                         4544    4549      +5
time_main                                           1124    1128      +4
static.start_sec                                       -       4      +4
static.lastupdate_sec                                  -       4      +4
sock                                                   -       4      +4
read_package_field                                   253     257      +4
pick                                                  38      40      +2
get_next_line                                        145     147      +2
count_lines                                           59      61      +2
process_stdin                                        435     433      -2
xstrtoul_range_sfx                                   229     226      -3
static.initialized                                     4       1      -3
dhcprelay_main                                      1125    1122      -3
catcher                                              380     377      -3
arping_main                                         1969    1966      -3
s                                                      8       4      -4
cfg                                                    4       -      -4
static.lastupdate                                      8       -      -8
start                                                  8       -      -8
random_xid                                            95      33     -62
.rodata                                           129114  129050     -64
zcip_main                                           1731    1576    -155
progressmeter                                       1035     867    -168
------------------------------------------------------------------------------
(add/remove: 4/3 grow/shrink: 10/11 up/down: 113/-490)       Total: -377 bytes
2007-06-17 23:40:26 +00:00
Denis Vlasenko
459be35234 hwclock: size optimizations
libbb/time.c: new file, introducing monotonic_us()
pscan, traceroute, arping: use it instead of gettimeofday
ping, zcip: TODO

function                                             old     new   delta
monotonic_us                                           -      89     +89
find_pair                                            164     180     +16
.rodata                                           129747  129763     +16
refresh                                             1144    1152      +8
............
timeout                                                8       4      -4
static.start                                           8       4      -4
last                                                   8       4      -4
parse_conf                                          1303    1284     -19
time_main                                           1149    1124     -25
gettimeofday_us                                       39       -     -39
arping_main                                         2042    1969     -73
hwclock_main                                         594     501     -93
catcher                                              485     380    -105
traceroute_main                                     4300    4117    -183
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 8/11 up/down: 157/-562)        Total: -405 bytes
2007-06-17 19:09:05 +00:00
Denis Vlasenko
ea9e798004 arping: -i should be -I 2007-06-17 00:36:57 +00:00
Denis Vlasenko
7b72fc1200 pscan: new applet (portscanner). ~1350 bytes. By Tito <farmatito@tiscali.it>
wget: lift 256 chars limitation on terminal width
2007-06-16 13:37:59 +00:00
Denis Vlasenko
53a0e97196 find: make -size match GNU find 2007-06-16 00:30:52 +00:00
Denis Vlasenko
b941129ccb find: add conditional support for -maxdepth and -regex
(needed for Linux 2.6.22-rc4 build)

-maxdepth:
# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 675622    2792   15728  694142   a977e busybox_old
 675770    2792   15728  694290   a9812 busybox_unstripped

-regex:
# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 675770    2792   15728  694290   a9812 busybox_old
 675894    2792   15728  694414   a988e busybox_unstripped
2007-06-15 23:43:11 +00:00
Denis Vlasenko
d786cc5966 fdisk: fix minor issues with help text 2007-06-15 21:17:21 +00:00
Denis Vlasenko
ca525b4f24 *: BB_BANNER -> bb_banner (it is not a const or #define)!
correct_password: explain in detail why it is ok to use bb_banner
fsck_minix: make it print bb version, not it's own (outdated/irrelevant) one

Marginal size difference:
   text    data     bss     dec     hex filename
 679119    2700   15632  697451   aa46b busybox_old
 679091    2700   15632  697423   aa44f busybox_unstripped
2007-06-13 12:27:17 +00:00
Denis Vlasenko
d67cef2425 hush: fix read builtin to not read ahead past eol and to not use
insane amounts of stack. Testsuite updated.
2007-06-13 06:47:47 +00:00
Denis Vlasenko
f5f75c5e82 remove nearly-duplicate PATHs in several places
function                                             old     new   delta
bb_PATH_root_path                                      -      35     +35
varunset                                              60      58      -2
arith                                               2042    2033      -9
bb_default_root_login_path                            30       -     -30
.rodata                                           128794  128762     -32
which_main                                           152     117     -35
defpathvar                                            40       -     -40
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 0/4 up/down: 35/-148)          Total: -113 bytes
2007-06-12 22:35:19 +00:00
Denis Vlasenko
f312e32662 login: make /etc/nologin support configurable. -240 bytes if not selected. 2007-06-12 22:04:57 +00:00
Denis Vlasenko
3ad5d0cbbe diff: shrink code (-85 bytes):
function                                             old     new   delta
fiddle_sum                                             8       -      -8
diffreg                                             2717    2690     -27
prepare                                              334     284     -50
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-85)             Total: -85 bytes

s/ATTRIBUTE_ALWAYS_INLINE/ALWAYS_INLINE/g
2007-06-12 20:54:54 +00:00
Denis Vlasenko
15611bb958 A few more string duplicates found & eliminated
# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 679693    2700   15632  698025   aa6a9 busybox_old
 679523    2700   15632  697855   aa5ff busybox_unstripped
2007-06-12 08:52:02 +00:00
Denis Vlasenko
bdbbb7ec49 make busybox --install work even if /proc/self/exe doesn't exist
# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 680095    2704   15648  698447   aa84f busybox_old
 680099    2704   15648  698451   aa853 busybox_unstripped
2007-06-08 15:02:55 +00:00
Denis Vlasenko
c14d39e83a rmp: add optional support for bz2 data. +50 bytes of code 2007-06-08 13:05:39 +00:00
Denis Vlasenko
0696b8aae8 ps: fix -Z (by Yuichi Nakamura <ynakam@hitachisoft.jp>) 2007-06-06 07:40:16 +00:00
Denis Vlasenko
5c51a7ca52 nc: make connecting to IPv4 from IPv6-enabled hosts easier
(was requiring -s <local addr>)
2007-06-05 20:08:11 +00:00
Denis Vlasenko
746204b1b8 uudecode: fix to base64 decode by Jorgen Cederlof <jcz@google.com>
improved help texts

# make bloatcheck
function                                             old     new   delta
.rodata                                           127000  127032     +32
packed_usage                                       22156   22151      -5
uudecode_main                                        360     348     -12
uuencode_main                                        490     468     -22
read_base64                                          283     254     -29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 32/-68)            Total: -36 bytes
2007-06-04 23:32:35 +00:00
Denis Vlasenko
74324c8666 Audit bb_common_bufsiz usage, add script which looks for misuse.
tr: stop using globals needlessly.
code: -103 bytes
2007-06-04 10:16:52 +00:00
Denis Vlasenko
9a7d38fe24 delete tons of extra #includes 2007-05-31 22:42:12 +00:00
Denis Vlasenko
fad2b86c9e use "glibc errno" trick not only for ash, but for entire busybox
(add/remove: 1/1 grow/shrink: 37/37 up/down: 139/-228)        Total: -89 bytes
2007-05-31 22:16:38 +00:00
Denis Vlasenko
4b924f3a5c whitespace fixes 2007-05-30 00:29:55 +00:00
Denis Vlasenko
5a6aeddfa7 xpipe: introduce (saves ~170 bytes)
udhcp/signalpipe.c: use pipe instead of socketpair.
2007-05-26 16:44:20 +00:00
Denis Vlasenko
b055001b6a hush: fix handling of unmatched ${name (without closing '}') -
was eating all remaining input, potentially megabytes.
nofork: save/restore die_jmp too
nofork: use -2222 instead of -111 as "special" return valur for zero
(-111 is used by some applets. -2222 won't fit in exitcode and thus safer)
2007-05-24 12:18:16 +00:00
Denis Vlasenko
6d709972cd cttyhack: new applet. 2007-05-18 09:45:36 +00:00
Denis Vlasenko
d46e6d1a55 fix trivial compile errors found by randomconfig run 2007-05-17 12:58:30 +00:00
Denis Vlasenko
418a7fb29b netstat: introduce -W: wide, ipv6-friendly output
netstat: shrink by ~500 bytes
(patch by Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>)
netstat: fix for bogus state value for raw sockets
2007-05-15 23:57:46 +00:00
Denis Vlasenko
7e84e539de cryptpw: new applet (a bit less than 3k added)
(by Thomas Lundquist <lists@zelow.no>)
2007-05-08 17:52:17 +00:00
Denis Vlasenko
734e5ebc93 fix -Werror compile 2007-05-04 21:38:14 +00:00
Denis Vlasenko
f20de5bb42 ash,kill: use common code for kill applet/builtin
# make bloatcheck
function                                             old     new   delta
evaltreenr                                           644     654     +10
evaltree                                             644     654     +10
parse_conf                                          1440    1444      +4
dpkg_deb_main                                        426     429      +3
ed_main                                             3319    3321      +2
passwd_main                                         2093    2091      -2
kill_main                                            830     826      -4
singlemount                                         4609    4601      -8
find_command                                         962     954      -8
get_lcm                                              123     105     -18
.rodata                                           132243  132147     -96
killcmd                                              449     120    -329
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/7 up/down: 29/-465)          Total: -436 bytes

# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 723901    2940   27504  754345   b82a9 busybox_old
 723457    2940   27504  753901   b80ed busybox_unstripped
2007-04-29 23:42:54 +00:00
Denis Vlasenko
18e19f2b0d hush: fix nofork + ctrl-Z clobbering of globals 2007-04-28 16:43:18 +00:00
Denis Vlasenko
8581863a1b procps: remove all global variables
text    data     bss     dec     hex filename
   1462      14      24    1500     5dc busybox.t2/procps/ps.o
   1484       0       0    1484     5cc busybox.t3/procps/ps.o
   3122       0     252    3374     d2e busybox.t1/procps/top.o
   3117       0       0    3117     c2d busybox.t3/procps/top.o
2007-04-19 14:47:11 +00:00
Denis Vlasenko
516a0ca2dc ps: add -o tty and -o rss support
1373      14      24    1411     583 busybox.t1/procps/ps.o
   1462      14      24    1500     5dc busybox.t2/procps/ps.o
2007-04-19 14:46:14 +00:00
Denis Vlasenko
ac678ec2f1 style fixes, no code changes 2007-04-16 22:32:04 +00:00
Denis Vlasenko
be1a9d4237 deluser: add optional support for removing users from groups
(by Tito <farmatito@tiscali.it>)
2007-04-15 08:43:23 +00:00
Denis Vlasenko
f5294e1f4c hush: use NOFORK applets as appropriate. Net reduction of code size. 2007-04-14 10:09:57 +00:00
Denis Vlasenko
16abcd90ae teach find_root_device to deal with /dev/ subdirs
(by "Kirill K. Smirnov" <lich@math.spbu.ru>)
2007-04-13 23:59:52 +00:00
Denis Vlasenko
87468857f6 style fixes 2007-04-13 23:22:00 +00:00
Denis Vlasenko
62f0479cf1 find: add support for -delete, -path (by Natanael Copa) 2007-04-13 10:00:12 +00:00
Denis Vlasenko
0de3c55b42 login: remove setpgrp call (makes it work from shell prompt again).
login: sanitize stdio descriptors (we are suid, need to be careful!)
shrink login and set_environment by ~100 bytes.
2007-04-12 12:31:02 +00:00
Bernhard Reutner-Fischer
b290889f02 - add xsendto and use where appropriate; shrink iplink; sanitize libiproute a bit.
-916 byte
2007-04-12 11:34:39 +00:00
Denis Vlasenko
50f7f446ec bb_full_fd_action: remove potential xmalloc from NOFORK path
cat: stop using stdio.h opens
libbb: introduce & use open[3]_or_warn
function                                             old     new   delta
open3_or_warn                                          -      54     +54
bb_cat                                               115     144     +29
open_or_warn                                           -      25     +25
unlzma                                              2404    2412      +8
chattr_main                                          334     339      +5
xstrtoul_range_sfx                                   251     255      +4
telnet_main                                         1514    1510      -4
static.opt                                             4       -      -4
qgravechar                                           122     118      -4
fuser_add_pid                                         61      54      -7
fuser_add_inode                                      154     147      -7
writeFileToTarball                                  1542    1534      -8
refresh                                             1156    1148      -8
do_show                                              856     846     -10
read_leases                                          212     200     -12
setup_redirects                                      236     222     -14
iproute_list_or_flush                               1582    1568     -14
read_config                                          427     411     -16
write_leases                                         284     264     -20
hash_file                                            338     318     -20
copy_file                                           1760    1740     -20
do_iproute                                          2610    2588     -22
bb_full_fd_action                                    320     269     -51
open_to_or_warn                                      103      49     -54
fuser_main                                          1660    1596     -64
.rodata                                           131160  131096     -64
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 4/19 up/down: 125/-423)        Total: -298 bytes
2007-04-11 23:20:53 +00:00
Denis Vlasenko
e4f2d064b0 rename: run_applet_by_name -> run_applet_and_exit 2007-04-11 17:03:19 +00:00
Denis Vlasenko
03fc408de6 fix typo in comment 2007-04-11 07:36:31 +00:00
Denis Vlasenko
473dae080a add more convenient defines for [NO]MMU:
"#ifndef BB_NOMMU" is a double negative
2007-04-11 07:04:23 +00:00
Denis Vlasenko
80d14beae9 Rename two config options:
FEATURE_SH_STANDALONE_SHELL => FEATURE_SH_STANDALONE
FEATURE_EXEC_PREFER_APPLETS => FEATURE_PREFER_APPLETS
Make SH_STANDALONE depend on PREFER_APPLETS.
getopt.c: more randomconfig-induced fixes
2007-04-10 23:03:30 +00:00
Denis Vlasenko
c6758a07c6 make compressed help code NOMMU- and NOFORK-friendly -
no forking anymore, bunzip2 unpack routine now does all it in memory.
2007-04-10 21:40:19 +00:00
Denis Vlasenko
335b63d8d1 make a few struct bb_applet members conditional
rename sllep_and_die -> xfunc_die
make fflush_stdout_and_exit NOFORK-safe
fix some buglets found by randomconfig
2007-04-10 21:38:30 +00:00
Bernhard Reutner-Fischer
f73cac8d3d - forgot this hunk that corrects the usage text of ip 2007-04-10 19:00:08 +00:00
Bernhard Reutner-Fischer
51f7ab6162 - add ATTRIBUTE_DEPRECATED for functions that should be removed in the future.
This is ment to provide means to point at cruft marked for cleanup.
2007-04-10 18:40:05 +00:00
Denis Vlasenko
99912ca733 audit small applets and mark some of them as NOFORK.
Put big scary warnings in relevant places.
2007-04-10 15:43:37 +00:00
Bernhard Reutner-Fischer
163516da3a - very minor shrinkage (-3b) 2007-04-10 14:16:19 +00:00
Bernhard Reutner-Fischer
8b1fab2879 - add prototype for str_tolower() 2007-04-10 09:38:07 +00:00
Denis Vlasenko
3f3aa2a57d make xfunctions optionally longjump instead of exit.
use it for making NOFORK more practical.
touch: make it a NOFORK applet
2007-04-09 21:35:07 +00:00
Denis Vlasenko
cd7001f705 factor out NOFORK/NOEXEC code from find. Use it for xargs too. 2007-04-09 21:32:30 +00:00
Denis Vlasenko
1b4b2cb20e xargs: shrink code, ~80 bytes
applets.h: +#undef APPLET_NOEXEC
2007-04-09 21:30:53 +00:00
Denis Vlasenko
7e754f12d3 Implement first instance of NOFORK applet - echo
find: use NOFORK/NOEXEC; small -exec buglet also eliminated
vfork_daemon_rexec: honor PREFER_APPLETS
echo: small size improvements

find -exec echo {} \; with PREFER_APPLETS=y runs 4 times faster
2007-04-09 13:04:50 +00:00
Denis Vlasenko
c44ab01b75 Improve STANDALONE_SHELL. "safe" applets are renamed NOEXEC applets
and now this fact is recorded in applets.h, not ash.c.

Several fixes to "--help + STANDALONE_SHELL" scenarios.

function                                             old     new   delta
run_current_applet_and_exit                            -     355    +355
arith                                               2064    2073      +9
refresh                                             1148    1156      +8
getopt32                                            1068    1073      +5
telnet_main                                         1510    1514      +4
md5_sha1_sum_main                                    565     566      +1
xstrtoul_range_sfx                                   255     251      -4
packed_usage                                       22523   22514      -9
tryexec                                              255     203     -52
static.safe_applets                                  152       -    -152
.rodata                                           131320  131128    -192
run_applet_by_name                                   869     506    -363
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 5/5 up/down: 382/-772)         Total: -390 bytes

./busybox ash -c 'i=20000; while test $i != 0; do touch z; i=$((i-1)); done'
runs more than twice as fast with STANDALONE_SHELL versus without.
2007-04-09 03:11:58 +00:00
Denis Vlasenko
32b633aa3f merge busybox.c into applets.c 2007-04-09 03:05:48 +00:00
Denis Vlasenko
786834bcee applets.h: de-obfuscate 2007-04-08 17:30:10 +00:00
Denis Vlasenko
8d9f495d68 getopt32: fix llist_t options ordering. llist_rev is not unused.
function                                             old     new   delta
tar_main                                             705     695     -10
sort_main                                            928     918     -10
decode_format_string                                 886     876     -10
run_parts_main                                       197     185     -12
ps_main                                              513     500     -13
wget_main                                           2764    2750     -14
awk_main                                            1014    1000     -14
od_main                                             2886    2866     -20
llist_rev                                             25       -     -25
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/8 up/down: 0/-128)           Total: -128 bytes
2007-04-08 15:08:42 +00:00
Denis Vlasenko
bbd695d801 find: fix handling of -prune
recursive_actions: uppercase flag constants
2007-04-08 10:52:28 +00:00
Denis Vlasenko
04c99ebb4f random small shrinkage and elimination of statics 2007-04-07 00:44:31 +00:00
Denis Vlasenko
bf295dd5b6 [u]mount: extend -t option (Roy Marples <uberlord@gentoo.org>) 2007-04-05 21:57:47 +00:00
Denis Vlasenko
1bb552b1d9 libbb: add xunlink()
patch: do not try to delete same file twice
2007-04-05 21:25:15 +00:00
Denis Vlasenko
2f7b923f5c find: improve usage text (Natanael Copa <natanael.copa@gmail.com>) 2007-04-05 21:01:06 +00:00
Denis Vlasenko
29fe7265b8 nc: port nc 1.10 to busybox 2007-04-05 20:26:28 +00:00
Bernhard Reutner-Fischer
00c2c4868a - clean up addgroup, fix adding users to existing groups and make it optional (Tito) 2007-04-05 13:16:39 +00:00
Bernhard Reutner-Fischer
2e75dcc80d - add -s|--spider which only checks if the file exists but does not download it's content.
Closes #1291
2007-04-05 10:31:47 +00:00