oweals/busybox.git
17 years agos/#ifdef CONFIG_/#if ENABLE_/g
Denis Vlasenko [Mon, 13 Aug 2007 10:36:25 +0000 (10:36 -0000)]
s/#ifdef CONFIG_/#if ENABLE_/g

17 years agosyslogd,logread: get rid of head pointer, fix logread bug in the process
Denis Vlasenko [Sun, 12 Aug 2007 21:33:06 +0000 (21:33 -0000)]
syslogd,logread: get rid of head pointer, fix logread bug in the process

function                                             old     new   delta
logread_main                                         450     462     +12
syslogd_main                                        1246    1252      +6
shbuf                                                  -       4      +4
buf                                                   34      30      -4
packed_usage                                       22729   22724      -5
log_locally                                          957     767    -190
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/3 up/down: 22/-199)          Total: -177 bytes
   text    data     bss     dec     hex filename
 773886    1116   11316  786318   bff8e busybox_old
 773714    1116   11316  786146   bfee2 busybox_unstripped

17 years agohttpd: sendfile support
Denis Vlasenko [Sun, 12 Aug 2007 21:05:49 +0000 (21:05 -0000)]
httpd: sendfile support

17 years agofix out-of-source-tree build
Denis Vlasenko [Sun, 12 Aug 2007 20:59:07 +0000 (20:59 -0000)]
fix out-of-source-tree build

17 years agotrylink: produce even more info about final link stage
Denis Vlasenko [Sun, 12 Aug 2007 20:58:27 +0000 (20:58 -0000)]
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

17 years agohttpd: CGI Status: header fix
Denis Vlasenko [Sat, 11 Aug 2007 20:26:02 +0000 (20:26 -0000)]
httpd: CGI Status: header fix

17 years agohttpd: add support for Status: CGI header
Denis Vlasenko [Sat, 11 Aug 2007 20:20:43 +0000 (20:20 -0000)]
httpd: add support for Status: CGI header

17 years agohttpd: fix CGI handling bug (we were closing wrong fd).
Denis Vlasenko [Sat, 11 Aug 2007 20:20:02 +0000 (20:20 -0000)]
httpd: fix CGI handling bug (we were closing wrong fd).

17 years agols,ps,watch: measure terminal width on fd 0, not 1
Denis Vlasenko [Thu, 9 Aug 2007 08:27:24 +0000 (08:27 -0000)]
ls,ps,watch: measure terminal width on fd 0, not 1

17 years agostat: fix option -Z segv (bug 1454)
Denis Vlasenko [Thu, 9 Aug 2007 08:10:13 +0000 (08:10 -0000)]
stat: fix option -Z segv (bug 1454)

17 years agoudhcpd: fix bug: s/memcmp() != 0/memcmp() == 0/
Denis Vlasenko [Thu, 9 Aug 2007 08:04:05 +0000 (08:04 -0000)]
udhcpd: fix bug: s/memcmp() != 0/memcmp() == 0/
(by David Updegraff <dave@cray.com>)

17 years agobb_uudecode: now this is the more thorough fix... I hope...
Denis Vlasenko [Mon, 6 Aug 2007 15:49:12 +0000 (15:49 -0000)]
bb_uudecode: now this is the more thorough fix... I hope...

17 years agobb_uuencode: fix obscure case where we were using data past last byte of source
Denis Vlasenko [Mon, 6 Aug 2007 15:43:17 +0000 (15:43 -0000)]
bb_uuencode: fix obscure case where we were using data past last byte of source
(fixes testsuite failure)

bb_uuencode                                          154     160      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 6/0)                 Total: 6 bytes
   text    data     bss     dec     hex filename
 770284    1096   11228  782608   bf110 busybox_old
 770288    1096   11228  782612   bf114 busybox_unstripped

17 years agopatch: fix -p -1 handling
Denis Vlasenko [Mon, 6 Aug 2007 13:34:10 +0000 (13:34 -0000)]
patch: fix -p -1 handling
checkstack.pl: add blackfin (by Alex Landau <landau_alex@yahoo.com>)

17 years agocatv: catv without arguments was trying to use environ as argv.
Denis Vlasenko [Mon, 6 Aug 2007 12:28:24 +0000 (12:28 -0000)]
catv: catv without arguments was trying to use environ as argv.
(Alex Landau <landau_alex@yahoo.com>)

17 years agotrylink: s/&& exit 1/|| exit 1/ (spotted by Alex Landau <landau_alex@yahoo.com>)
Denis Vlasenko [Mon, 6 Aug 2007 12:18:01 +0000 (12:18 -0000)]
trylink: s/&& exit 1/|| exit 1/ (spotted by Alex Landau <landau_alex@yahoo.com>)

17 years agosed: fix 'q' command handling ("Nguyen Thai Ngoc Duy" <pclouds@gmail.com>)
Denis Vlasenko [Mon, 6 Aug 2007 03:41:08 +0000 (03:41 -0000)]
sed: fix 'q' command handling ("Nguyen Thai Ngoc Duy" <pclouds@gmail.com>)
     add testsuite entry for it. Fix applet order checker. Fix cmp yelling.
trylink: fix error file and map file generation
applets: fix applet order

17 years agoenv: micro-optimization
Denis Vlasenko [Mon, 6 Aug 2007 02:55:41 +0000 (02:55 -0000)]
env: micro-optimization
printenv: fix "printenv VAR1 VAR2" bug (wasn't printing VAR2)
(spotted by kalyanatejaswi balabhadrapatruni <kalyanatejaswi@yahoo.co.in>)

env_main                                             267     260      -7
printenv_main                                        147      75     -72
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-79)             Total: -79 bytes
   text    data     bss     dec     hex filename
 770336    1096   11228  782660   bf144 busybox_old
 770256    1096   11228  782580   bf0f4 busybox_unstripped

17 years agosetfiles:
Denis Vlasenko [Mon, 6 Aug 2007 02:36:35 +0000 (02:36 -0000)]
setfiles:
* Bug fix: -f option did not work.
* Using bb_simplify_path to remove extra slash for smaller code.
(by Yuichi Nakamura <ynakam@hitachisoft.jp>)

17 years agoless: add a bit more robustness in keyboard reading code
Denis Vlasenko [Fri, 3 Aug 2007 14:17:21 +0000 (14:17 -0000)]
less: add a bit more robustness in keyboard reading code

17 years agomount: print errno on NFS error (again)
Denis Vlasenko [Fri, 3 Aug 2007 14:16:24 +0000 (14:16 -0000)]
mount: print errno on NFS error (again)

17 years agosvlogd: fix timestamping; do not warn if config is missing
Denis Vlasenko [Fri, 3 Aug 2007 10:58:12 +0000 (10:58 -0000)]
svlogd: fix timestamping; do not warn if config is missing
sv: extend help text

17 years agottysize: update copyright
Denis Vlasenko [Fri, 3 Aug 2007 08:48:44 +0000 (08:48 -0000)]
ttysize: update copyright

17 years agoudhcp: slight shrink
Denis Vlasenko [Thu, 2 Aug 2007 22:31:05 +0000 (22:31 -0000)]
udhcp: slight shrink
udhcpd_main                                         1171    1208     +37
udhcpc_main                                         2363    2387     +24
dhcprelay_main                                      1145    1146      +1
dhcprelay_stopflag                                     4       1      -3
dhcprelay_signal_handler                              11       8      -3
client_background                                     46      42      -4
udhcp_read_interface                                 230     211     -19
udhcp_make_pidfile                                    76       -     -76
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 3/4 up/down: 62/-105)           Total: -43 bytes
   text    data     bss     dec     hex filename
 770052    1096   11228  782376   bf028 busybox_old
 769980    1096   11228  782304   befe0 busybox_unstripped

17 years agottysize: new applet. +200 bytes
Denis Vlasenko [Thu, 2 Aug 2007 22:23:47 +0000 (22:23 -0000)]
ttysize: new applet. +200 bytes

17 years agostart_stop_daemon: NOMMU fixes, round 2 by Alex Landau <landau_alex@yahoo.com>
Denis Vlasenko [Thu, 2 Aug 2007 10:14:29 +0000 (10:14 -0000)]
start_stop_daemon: NOMMU fixes, round 2 by Alex Landau <landau_alex@yahoo.com>
dhcpc: fixed "ifupdown + udhcpc_without_pidpile_creation" bug

17 years agopatch: fix bad line ending handling ("Nguyen Thai Ngoc Duy" <pclouds@gmail.com>)
Denis Vlasenko [Wed, 1 Aug 2007 23:30:54 +0000 (23:30 -0000)]
patch: fix bad line ending handling ("Nguyen Thai Ngoc Duy" <pclouds@gmail.com>)

17 years agostart_stop_daemon: NOMMU fix; smaller fixes
Denis Vlasenko [Tue, 31 Jul 2007 17:09:44 +0000 (17:09 -0000)]
start_stop_daemon: NOMMU fix; smaller fixes

17 years agoaddgroup: "disallow addgroup -g num user group"; make -g 0 work
Denis Vlasenko [Mon, 30 Jul 2007 12:32:37 +0000 (12:32 -0000)]
addgroup: "disallow addgroup -g num user group"; make -g 0 work
(Tito <farmatito@tiscali.it>)

17 years agodd: use unsigned printf specifier for # of blocks
Denis Vlasenko [Mon, 30 Jul 2007 10:58:09 +0000 (10:58 -0000)]
dd: use unsigned printf specifier for # of blocks

17 years agodd: fix newly introduced bug (introduced by me)
Denis Vlasenko [Sun, 29 Jul 2007 14:59:06 +0000 (14:59 -0000)]
dd: fix newly introduced bug (introduced by me)

17 years agointerface.c: code shrink (IIRC ~30 bytes)
Denis Vlasenko [Sun, 29 Jul 2007 14:17:48 +0000 (14:17 -0000)]
interface.c: code shrink (IIRC ~30 bytes)

17 years agoash: comment non-obvious code part
Denis Vlasenko [Sun, 29 Jul 2007 14:05:27 +0000 (14:05 -0000)]
ash: comment non-obvious code part

17 years agofix for suffix optimization (which was in previous commit)
Denis Vlasenko [Fri, 27 Jul 2007 15:30:39 +0000 (15:30 -0000)]
fix for suffix optimization (which was in previous commit)

17 years agomultiplier suffixes are short, store them directly in struct suffix_mult
Denis Vlasenko [Fri, 27 Jul 2007 15:06:25 +0000 (15:06 -0000)]
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

17 years agodd: fix bug where we assume count=INT_MAX when count is unspecified;
Denis Vlasenko [Fri, 27 Jul 2007 15:02:00 +0000 (15:02 -0000)]
dd: fix bug where we assume count=INT_MAX when count is unspecified;
shrink dd while at it

function                                             old     new   delta
dd_main                                             1453    1368     -85
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-85)             Total: -85 bytes
   text    data     bss     dec     hex filename
 669216    2668   13616  685500   a75bc busybox_old
 669128    2668   13616  685412   a7564 busybox_unstripped

17 years agopasswd: fix bug: we are trying to update shadow even if user's record is in passwd!
Denis Vlasenko [Fri, 27 Jul 2007 11:22:34 +0000 (11:22 -0000)]
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.

17 years agobb_getpwuid, bb_getgrgid: change order of arguments to more intuitive one;
Denis Vlasenko [Fri, 27 Jul 2007 11:20:10 +0000 (11:20 -0000)]
bb_getpwuid, bb_getgrgid: change order of arguments to more intuitive one;
comment thoroughly when they die and when they dont.

17 years agocal: small code shrink
Denis Vlasenko [Thu, 26 Jul 2007 11:12:51 +0000 (11:12 -0000)]
cal: small code shrink

17 years agosetfiles: small code size reduction (Yuichi Nakamura <ynakam@hitachisoft.jp>)
Denis Vlasenko [Wed, 25 Jul 2007 17:39:46 +0000 (17:39 -0000)]
setfiles: small code size reduction (Yuichi Nakamura <ynakam@hitachisoft.jp>)

17 years agops: fix non-desktop ps -ww -- thanks rockeychu
Denis Vlasenko [Wed, 25 Jul 2007 17:27:58 +0000 (17:27 -0000)]
ps: fix non-desktop ps -ww -- thanks rockeychu

17 years agogetopt32: fix getopt32 breakage (forgot to memset(0) it) -- thanks rockeychu
Denis Vlasenko [Wed, 25 Jul 2007 17:18:06 +0000 (17:18 -0000)]
getopt32: fix getopt32 breakage (forgot to memset(0) it) -- thanks rockeychu

17 years agoReplace index_in_[sub]str_array with index_in_[sub]strings,
Denis Vlasenko [Tue, 24 Jul 2007 15:54:42 +0000 (15:54 -0000)]
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

17 years agood: shrink a bit
Denis Vlasenko [Tue, 24 Jul 2007 12:28:03 +0000 (12:28 -0000)]
od: shrink a bit

verbose                                               12      13      +1
open_next_file                                       102      99      -3
limit_bytes_to_format                                  4       1      -3
ioerror                                                4       1      -3
flag_pseudo_start                                      4       1      -3
flag_dump_strings                                      4       1      -3
abbreviate_duplicate_blocks                            4       -      -4
check_and_close                                       96      90      -6
od_main                                             2988    2955     -33
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/7 up/down: 1/-58)             Total: -57 bytes
   text    data     bss     dec     hex filename
 781314    1328   11876  794518   c1f96 busybox_old
 781266    1328   11844  794438   c1f46 busybox_unstripped

17 years agosetfiles: small tweaks to usage text and code
Denis Vlasenko [Tue, 24 Jul 2007 06:17:43 +0000 (06:17 -0000)]
setfiles: small tweaks to usage text and code

17 years agozcip: remove stray seed48. It's the only thing which was pulling in
Denis Vlasenko [Mon, 23 Jul 2007 22:44:15 +0000 (22:44 -0000)]
zcip: remove stray seed48. It's the only thing which was pulling in
rand48 machinery:

zcip_main                                           1552    1537     -15
seed48                                                22       -     -22
__libc_drand48_data                                   24       -     -24
seed48_r                                              78       -     -78
__GI_seed48_r                                         78       -     -78
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 0/1 up/down: 0/-217)           Total: -217 bytes

17 years agoadd comment why preferred stack boundary is 4 on i386
Denis Vlasenko [Mon, 23 Jul 2007 21:05:06 +0000 (21:05 -0000)]
add comment why preferred stack boundary is 4 on i386

17 years agochpasswd: rename long options definition to match other applets. no code changes
Denis Vlasenko [Mon, 23 Jul 2007 18:49:16 +0000 (18:49 -0000)]
chpasswd: rename long options definition to match other applets. no code changes

17 years agogetopt32 must remain NOFORK-safe (no mallocs!). Using alloca and pretending
Denis Vlasenko [Mon, 23 Jul 2007 17:40:35 +0000 (17:40 -0000)]
getopt32 must remain NOFORK-safe (no mallocs!). Using alloca and pretending
stack is infinite. Unfortunately, +79 bytes.

17 years agorework long option handling. saves ~1.2k
Denis Vlasenko [Mon, 23 Jul 2007 17:14:14 +0000 (17:14 -0000)]
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

17 years agosetiles: cosmetics, no real code changes
Denis Vlasenko [Mon, 23 Jul 2007 14:05:02 +0000 (14:05 -0000)]
setiles: cosmetics, no real code changes

17 years agosetfiles,restorecon: new SELinux applets by Yuichi Nakamura <ynakam@hitachisoft.jp>
Denis Vlasenko [Mon, 23 Jul 2007 14:03:30 +0000 (14:03 -0000)]
setfiles,restorecon: new SELinux applets by Yuichi Nakamura <ynakam@hitachisoft.jp>

17 years agochpasswd: fix indentation
Denis Vlasenko [Sat, 21 Jul 2007 22:29:26 +0000 (22:29 -0000)]
chpasswd: fix indentation

17 years agostyle fix (stray space before ';')
Denis Vlasenko [Sat, 21 Jul 2007 15:08:09 +0000 (15:08 -0000)]
style fix (stray space before ';')

17 years agofix typo in last commit
Denis Vlasenko [Sat, 21 Jul 2007 15:07:22 +0000 (15:07 -0000)]
fix typo in last commit

17 years agoThree patches from FreeWRT people
Denis Vlasenko [Sat, 21 Jul 2007 14:57:54 +0000 (14:57 -0000)]
Three patches from FreeWRT people

17 years agochpasswd: fixes for shadow password handling
Denis Vlasenko [Sat, 21 Jul 2007 13:54:26 +0000 (13:54 -0000)]
chpasswd: fixes for shadow password handling

17 years agolibbb: nuke BB_GETOPT_ERROR, always die if there are mutually exclusive options
Denis Vlasenko [Sat, 21 Jul 2007 13:27:44 +0000 (13:27 -0000)]
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

17 years agochpasswd: fixes and code shrink
Denis Vlasenko [Sat, 21 Jul 2007 13:25:28 +0000 (13:25 -0000)]
chpasswd: fixes and code shrink
update_passwd                                        732     734      +2
chpasswd_main                                        318     292     -26
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-26)             Total: -24 bytes
   text    data     bss     dec     hex filename
 781564    1168   11900  794632   c2008 busybox_old
 781548    1168   11900  794616   c1ff8 busybox_unstripped

17 years agochpasswd: now with svn add
Denis Vlasenko [Fri, 20 Jul 2007 21:29:49 +0000 (21:29 -0000)]
chpasswd: now with svn add

17 years agochpasswd: new applet by Alexander Shishkin <virtuoso@slind.org>
Denis Vlasenko [Fri, 20 Jul 2007 21:28:41 +0000 (21:28 -0000)]
chpasswd: new applet by Alexander Shishkin <virtuoso@slind.org>

17 years agostray trailing tabs removed
Denis Vlasenko [Thu, 19 Jul 2007 22:50:47 +0000 (22:50 -0000)]
stray trailing tabs removed

17 years agoifup/ifdown: make location of ifstate configurable
Denis Vlasenko [Thu, 19 Jul 2007 21:49:30 +0000 (21:49 -0000)]
ifup/ifdown: make location of ifstate configurable

17 years agovi: comment out dead code
Denis Vlasenko [Wed, 18 Jul 2007 22:03:40 +0000 (22:03 -0000)]
vi: comment out dead code

17 years agoTrim help text. With compressed help: -143 bytes
Denis Vlasenko [Wed, 18 Jul 2007 21:57:24 +0000 (21:57 -0000)]
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

17 years agoash: fix SEGV in forkchild (jp can be NULL). here documents were affected.
Denis Vlasenko [Wed, 18 Jul 2007 21:35:43 +0000 (21:35 -0000)]
ash: fix SEGV in forkchild (jp can be NULL). here documents were affected.

17 years agofix unpacker testsuite to match actual output
Denis Vlasenko [Wed, 18 Jul 2007 18:47:13 +0000 (18:47 -0000)]
fix unpacker testsuite to match actual output

17 years agoawk: actually do "svn add" for testsuite
Denis Vlasenko [Wed, 18 Jul 2007 18:33:18 +0000 (18:33 -0000)]
awk: actually do "svn add" for testsuite

17 years agoawk: fix -F 'regex' bug (miscounted fields if last field is empty)
Denis Vlasenko [Wed, 18 Jul 2007 18:32:25 +0000 (18:32 -0000)]
awk: fix -F 'regex' bug (miscounted fields if last field is empty)

17 years agoawk: style fixes; remove one xstrdup/free pair; testsuite
Denis Vlasenko [Wed, 18 Jul 2007 18:31:11 +0000 (18:31 -0000)]
awk: style fixes; remove one xstrdup/free pair; testsuite

17 years agovi: style fixlet
Denis Vlasenko [Tue, 17 Jul 2007 23:22:49 +0000 (23:22 -0000)]
vi: style fixlet

17 years agofix typo in prev commit :(
Denis Vlasenko [Tue, 17 Jul 2007 23:19:28 +0000 (23:19 -0000)]
fix typo in prev commit :(

17 years agovi: s/argv[0]/applet_name/
Denis Vlasenko [Tue, 17 Jul 2007 23:18:26 +0000 (23:18 -0000)]
vi: s/argv[0]/applet_name/

17 years agovi: multiple fixes by Natanael Copa <natanael.copa@gmail.com>
Denis Vlasenko [Tue, 17 Jul 2007 23:14:07 +0000 (23:14 -0000)]
vi: multiple fixes by Natanael Copa <natanael.copa@gmail.com>
* the puzzling message on error is replaced with strerror(errno)
  so it should be even more detailed and smaller at the same time.
* merged code in edit_file() and code for ':edit <file>' in colon() into
  new func init_text_buffer(). Was horribly duplicate. Moved most of
  error/sanity checking to file_insert(). Result is that you get a proper
  validation (prevent reading /dev/*) and error messages for ':r <file>'
* renamed 'cfn' to 'current_filename' for improved readability
* merged smallint vi_readonly and readonly into bitfields into
  readonly_mode to save space.
* added text_size variable to keep track how big the text buffer is.
  This is used to fix a buffer overflow. To reproduce bug:
  ./busybox vi TODO
  :r Makefile
  vi segfaults due to no buffer checking is done at all. som redesign is
  needed here but i added a check in text_hole_make() to aviod the
  segfault at least.
* removed isblnk() and use isblank(3) instead.
* fixed compiler warning by displaying the return code for :!<command>
  This makes things bigger than needed but since the patch reduces the
  overall size... (see below)
* new func next_tabstop(int) merges some duplicate code. There are more
  cuplicode here but i couldnt find a good way to merge them.
* Fix *ANNOYING* placement of cursor on '\t' characters. To reproduce:
    echo -e "\thello" > file1
    ./busybox vi file1
  Try to insert some text at the beginning of line. Text will be inserted
  but cursor is blinking somewhere else. The patch should make busybox vi
  behave more like original vi(m). Costs a few bytes but its worth it
  imho.
* new_text() is moved into init_text_buffer()
* the previously added update_ro_status() was moved info file_insert due
  to duplication removal mentioned above.
function                                             old     new   delta
init_text_buffer                                       -     245    +245
file_insert                                          312     420    +108
next_tabstop                                           -      82     +82
text_hole_make                                       154     171     +17
do_cmd                                              5093    5100      +7
static.cmd_mode_indicator                              -       5      +5
refresh                                             1248    1253      +5
current_filename                                       -       4      +4
yank_delete                                          161     164      +3
what_reg                                              96      99      +3
end_cmd_q                                             78      81      +3
char_insert                                          440     442      +2
readonly_mode                                          -       1      +1
vi_readonly                                            1       -      -1
setops                                               154     153      -1
readonly                                               1       -      -1
vi_setops                                              4       1      -3
string_insert                                        161     158      -3
cfn                                                    4       -      -4
show_status_line                                     532     514     -18
readit                                               519     500     -19
move_to_col                                          161     138     -23
vi_main                                              495     433     -62
isblnk                                                75       -     -75
.rodata                                             4751    4655     -96
edit_file                                            892     787    -105
new_text                                             125       -    -125
update_ro_status                                     131       -    -131
colon                                               3848    3667    -181
------------------------------------------------------------------------------
(add/remove: 5/6 grow/shrink: 8/10 up/down: 485/-848)        Total: -363
bytes
   text    data     bss     dec     hex filename
  34751     873    4260   39884    9bcc busybox_old
  34439     877    4260   39576    9a98 busybox_unstripped

17 years agoifconfig: make it work with ifaces with ifnames > 255
Denis Vlasenko [Tue, 17 Jul 2007 22:53:05 +0000 (22:53 -0000)]
ifconfig: make it work with ifaces with ifnames > 255

17 years agoremove accumulated stray trailing whitespace
Denis Vlasenko [Tue, 17 Jul 2007 21:42:59 +0000 (21:42 -0000)]
remove accumulated stray trailing whitespace

17 years agoModify method of linking against libs. Now we fisrt try all
Denis Vlasenko [Tue, 17 Jul 2007 20:39:27 +0000 (20:39 -0000)]
Modify method of linking against libs. Now we fisrt try all
specified libs, and if it succeeds, we try to remove them
one-by-one. If link succeeds, then library is thrown out.
Should solve the problem with SELinux linking in libsepol
even when not needed.

17 years agofix discrepancy in GPL version number. Pointed out by "Marsh David" <dmarsh@bigw...
Denis Vlasenko [Mon, 16 Jul 2007 22:21:15 +0000 (22:21 -0000)]
fix discrepancy in GPL version number. Pointed out by "Marsh David" <dmarsh@bigw.com.au>

17 years agotop: nested function allows us to reuse some code
Denis Vlasenko [Sun, 15 Jul 2007 19:27:48 +0000 (19:27 -0000)]
top: nested function allows us to reuse some code
(not everyone likes them - but code does get smaller).

display_generic                                        -     761    +761
static.fmt_100percent_8                                -     111    +111
fmt_100percent_8                                     101       -    -101
display_status                                      1489     581    -908
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/1 up/down: 872/-1009)        Total: -137 bytes
   text    data     bss     dec     hex filename
 677020    3344   13936  694300   a981c busybox_old
 676876    3344   13936  694156   a978c busybox_unstripped

17 years agotop: make "100%" case less ugly, and shrink code while at it
Denis Vlasenko [Sun, 15 Jul 2007 19:25:01 +0000 (19:25 -0000)]
top: make "100%" case less ugly, and shrink code while at it
fmt_100percent_8                                       -     101    +101
.rodata                                           129185  129153     -32
display_status                                      1726    1489    -237
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 101/-269)         Total: -168 bytes
   text    data     bss     dec     hex filename
 677180    3344   13936  694460   a98bc busybox_old
 677020    3344   13936  694300   a981c busybox_unstripped

17 years agotop: simpler loadavg processing
Denis Vlasenko [Sun, 15 Jul 2007 19:23:38 +0000 (19:23 -0000)]
top: simpler loadavg processing
display_status                                      1787    1726     -61
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-61)             Total: -61 bytes
   text    data     bss     dec     hex filename
 677244    3344   13936  694524   a98fc busybox_old
 677180    3344   13936  694460   a98bc busybox_unstripped

17 years agotop: truncate usernames to 8 chars
Denis Vlasenko [Sun, 15 Jul 2007 17:07:58 +0000 (17:07 -0000)]
top: truncate usernames to 8 chars

17 years agogrep: implement -m MAX_MATCHES; fix help text
Denis Vlasenko [Sun, 15 Jul 2007 12:39:08 +0000 (12:39 -0000)]
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

17 years agogrep: fix buglets with context printing
Denis Vlasenko [Sun, 15 Jul 2007 12:38:18 +0000 (12:38 -0000)]
grep: fix buglets with context printing
print_line                                           152     170     +18
did_print_line                                         -       1      +1
grep_file                                            788     771     -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 19/-17)              Total: 2 bytes
   text    data     bss     dec     hex filename
 673368    2740   13968  690076   a879c busybox_old
 673368    2740   13968  690076   a879c busybox_unstripped

17 years agoash: make "jobs | cat" work like in bash (was giving empty output)
Denis Vlasenko [Sun, 15 Jul 2007 01:13:25 +0000 (01:13 -0000)]
ash: make "jobs | cat" work like in bash (was giving empty output)

17 years agoadduser: close /etc/{passwd,shadow} before calling passwd etc.
Denis Vlasenko [Sat, 14 Jul 2007 22:51:28 +0000 (22:51 -0000)]
adduser: close /etc/{passwd,shadow} before calling passwd etc.
Spotted by Natanael Copa <natanael.copa@gmail.com>

17 years agovi: make status line less confusing when we open non-readable files,
Denis Vlasenko [Sat, 14 Jul 2007 22:43:10 +0000 (22:43 -0000)]
vi: make status line less confusing when we open non-readable files,
require rood to use w! when saving non-writable files.
Patch by Natanael Copa <natanael.copa@gmail.com>

update_ro_status                                       -      73     +73
edit_file                                            819     822      +3
colon                                               3440    3425     -15
.rodata                                           128090  128058     -32
file_insert                                          288     235     -53
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/3 up/down: 76/-100)           Total: -24 bytes
   text    data     bss     dec     hex filename
 673344    2740   13968  690052   a8784 busybox_old
 673320    2740   13968  690028   a876c busybox_unstripped

17 years agoxioctl and friends by Tito <farmatito@tiscali.it>
Denis Vlasenko [Sat, 14 Jul 2007 22:07:14 +0000 (22:07 -0000)]
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

17 years agoash: small size optimization
Denis Vlasenko [Sat, 14 Jul 2007 18:45:37 +0000 (18:45 -0000)]
ash: small size optimization
function                                             old     new   delta
makejob                                              263     270      +7
setjobctl                                            328     332      +4
jobscmd                                               96      94      -2
stoppedjobs                                           53      50      -3
jobctl                                                 4       1      -3
job_warning                                            4       1      -3
forkshell                                            644     641      -3
cmdloop                                              422     409     -13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/6 up/down: 11/-27)            Total: -16 bytes
   text    data     bss     dec     hex filename
 675392    2740   13968  692100   a8f84 busybox_old
 675380    2740   13968  692088   a8f78 busybox_unstripped

17 years agoash: recognize -l as --login equivalent; do not recognize +-login
Denis Vlasenko [Sat, 14 Jul 2007 11:33:10 +0000 (11:33 -0000)]
ash: recognize -l as --login equivalent; do not recognize +-login

17 years agoash: fix for buglet in DEBUG code (Nguyen Thai Ngoc Duy <pclouds@gmail.com>)
Denis Vlasenko [Sat, 14 Jul 2007 00:48:29 +0000 (00:48 -0000)]
ash: fix for buglet in DEBUG code (Nguyen Thai Ngoc Duy <pclouds@gmail.com>)

17 years agoFAQ: add timezone Q
Denis Vlasenko [Fri, 13 Jul 2007 15:26:53 +0000 (15:26 -0000)]
FAQ: add timezone Q

17 years agonc: minor code shrink
Denis Vlasenko [Fri, 13 Jul 2007 12:37:31 +0000 (12:37 -0000)]
nc: minor code shrink

function                                             old     new   delta
dolisten                                             731     737      +6
tmtravel                                              32      21     -11
catch                                                 75      64     -11
oprint                                               272     229     -43
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 6/-65)             Total: -59 bytes
   text    data     bss     dec     hex filename
 676698    3340   13936  693974   a96d6 busybox_old
 676650    3340   13936  693926   a96a6 busybox_unstripped

17 years agoremove last source id
Mike Frysinger [Fri, 13 Jul 2007 05:03:46 +0000 (05:03 -0000)]
remove last source id

17 years agoadd support for --symbol-prefix/-P
Mike Frysinger [Fri, 13 Jul 2007 04:37:12 +0000 (04:37 -0000)]
add support for --symbol-prefix/-P

17 years agofix applet order error
Denis Vlasenko [Fri, 6 Jul 2007 16:57:06 +0000 (16:57 -0000)]
fix applet order error

17 years agomd5_sha1_sum: fix mishandling when run as /bin/md5sum (with path)
Denis Vlasenko [Thu, 5 Jul 2007 00:12:55 +0000 (00:12 -0000)]
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

17 years agoudhcp: many small fixes:
Denis Vlasenko [Tue, 3 Jul 2007 15:47:50 +0000 (15:47 -0000)]
udhcp: many small fixes:
* arpping(): smaller and even probably fixed
* lots of variables/params converted: ulong -> uint32_t
* uptime() nuked in favor of monotonic_sec()
* udhcp_get_packet(): only one "bad vendor", simplify

function                                             old     new   delta
reservedIp                                            36      35      -1
udhcpc_main                                         2462    2460      -2
addStaticLease                                        64      62      -2
static.broken_vendors                                 16       -     -16
uptime                                                19       -     -19
udhcpd_main                                         1273    1238     -35
udhcp_get_packet                                     223     184     -39
.rodata                                           144162  144106     -56
arpping                                              690     609     -81
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/7 up/down: 0/-251)           Total: -251 bytes
   text    data     bss     dec     hex filename
 734241    3028   14400  751669   b7835 busybox_old
 734005    3028   14400  751433   b7749 busybox_unstripped

17 years agocorrect_password: if password is 'x' or '*' and there is no shadow, use
Denis Vlasenko [Tue, 3 Jul 2007 10:28:46 +0000 (10:28 -0000)]
correct_password: if password is 'x' or '*' and there is no shadow, use
fake encrypted password 'aa' (which is guaranteed to fail password check).

17 years agoifupdown: kill -TERM is default, so drop -TERM
Denis Vlasenko [Tue, 3 Jul 2007 08:26:24 +0000 (08:26 -0000)]
ifupdown: kill -TERM is default, so drop -TERM
ifupdown: ferror() does not set errno, don't use perror
ifupdown: make netmask parsing smaller and more strict
(was accepting 255.0.255.0, 255.1234.0.0 etc...)

function                                             old     new   delta
count_bits                                            36       -     -36
execute                                             2573    2535     -38
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-74)             Total: -74 bytes
   text    data     bss     dec     hex filename
 684204    2744   14000  700948   ab214 busybox_old
 684132    2744   14000  700876   ab1cc busybox_unstripped