Commit Graph

1402 Commits

Author SHA1 Message Date
Denis Vlasenko
4e12b1a2a9 libbb: introduce and use xmalloc_ttyname (-32 in bss).
ash: small code shrink

   text    data     bss     dec     hex filename
 793669     504    7524  801697   c3ba1 busybox_old
 793659     504    7492  801655   c3b77 busybox_unstripped
2008-12-23 23:36:47 +00:00
Denis Vlasenko
a3ca7cf069 add a note that SO_BINDTODEVICE needs padded iface name on 2.6.26 2008-12-10 11:24:33 +00:00
Denis Vlasenko
517413f9af bb_info_msg: make it do atomic, unbuffered writes
udhcpc: fix a problem where we don't open listening socket fast enough

function                                             old     new   delta
bb_info_msg                                           70     126     +56
change_listen_mode                                    37      78     +41
udhcp_listen_socket                                  151     124     -27
udhcpc_main                                         2344    2285     -59
2008-12-10 11:16:47 +00:00
Denis Vlasenko
e53738558f *: fix SO_BINDTODEVICE. Kernel wants at least IFNAMSIZ bytes there. 2008-12-10 11:12:16 +00:00
Denis Vlasenko
d1a84a2880 libbb: move crypt_make_salt() to pw_encrypt.c, reuse
bin-to-ascii64 conversion which does not require an array.

function                                             old     new   delta
to64                                                  29      33      +4
to64_msb_first                                        63      62      -1
ascii64                                               65       -     -65
2008-12-07 01:16:34 +00:00
Denis Vlasenko
db12d1d733 Fix forgotten license comments 2008-12-07 00:52:58 +00:00
Denis Vlasenko
15437e3e2a libbb: add xgetgrnam too. ~0 code size change 2008-12-05 16:23:06 +00:00
Denis Vlasenko
d324e1b808 libbb/crypt: code shrink
function                                             old     new   delta
to64_msb_first                                         -      63     +63
des_crypt                                           1509    1338    -171
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 63/-171)          Total: -108 bytes
2008-12-04 15:29:35 +00:00
Denis Vlasenko
d7a805efaf libbb: introduce and use xgetpwnam. ~ -150 bytes. 2008-12-03 19:05:55 +00:00
Bernhard Reutner-Fischer
82b1429966 - add new applet mkpasswd(1)
function                                             old     new   delta
bb_ask                                                 -     355    +355
mkpasswd_main                                          -     296    +296
.rodata                                           121746  121847    +101
packed_usage                                       24632   24689     +57
static.methods                                         -      21     +21
gmatch                                               229     248     +19
bb_ask_stdin                                           -      11     +11
applet_names                                        1949    1958      +9
applet_main                                         1172    1176      +4
sulogin_main                                         503     505      +2
applet_nameofs                                       586     588      +2
sha256_hash                                          329     327      -2
correct_password                                     208     206      -2
parse_command                                       1442    1439      -3
get_cred_or_die                                      145     141      -4
passwd_main                                         1054    1044     -10
bb_askpass                                           348       -    -348
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 7/5 up/down: 877/-369)          Total: 508 bytes
2008-12-03 18:48:39 +00:00
Denis Vlasenko
0c68a874e7 libbb: password/group function helpers rewritten by Tito:
function                                             old     new   delta
xgetpwuid                                              -      27     +27
uid2uname_utoa                                         -      22     +22
gid2group_utoa                                         -      22     +22
uid2uname                                              -      18     +18
gid2group                                              -      18     +18
buffer_fill_and_print                                179     196     +17
print_user                                            12      24     +12
print_group                                           12      24     +12
get_cached                                            89      99     +10
...
print_common                                         134     120     -14
vlock_main                                           415     396     -19
logger_main                                          410     387     -23
crontab_main                                         642     609     -33
bb_getpwuid                                           42       -     -42
bb_getgrgid                                           42       -     -42
bb_getug                                              80       -     -80
------------------------------------------------------------------------------
(add/remove: 6/3 grow/shrink: 9/11 up/down: 187/-296)        Total: -109 bytes
2008-12-02 22:56:59 +00:00
Denis Vlasenko
360d9661b6 libbb: add strncpy_IFNAMSIZ
function                                             old     new   delta
...
udhcp_read_interface                                 225     220      -5
brctl_main                                          1151    1146      -5
add_interface                                        109     104      -5
ipaddr_list_or_flush                                2174    2167      -7
do_add_ioctl                                          88      80      -8
vconfig_main                                         249     240      -9
do_del_ioctl                                          78      68     -10
do_iplink                                           1186    1173     -13
do_if_fetch                                          766     753     -13
buffer_fill_and_print                                196     179     -17
parse_args                                          1709    1684     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/20 up/down: 11/-140)         Total: -129 bytes
2008-12-02 18:18:50 +00:00
Denis Vlasenko
61befda93b ash,hush: add TODO for rare build failure
*: remove some redundant includes
2008-11-25 01:36:03 +00:00
Denis Vlasenko
4240408b70 trim help text a bit 2008-11-24 13:42:24 +00:00
Denis Vlasenko
a9acbe6cad timeout: new applet. 370 bytes. by Roberto Foglietta. 2008-11-24 13:25:20 +00:00
Denis Vlasenko
3eb4466bf8 libbb: replace some memmove's with memcpy's (Ron (ron AT debian.org))
bb_dump_dump                                        2674    2611     -63
2008-11-16 22:21:23 +00:00
Denis Vlasenko
3470f9297e libbb: sha_crypt -123 bytes 2008-11-13 13:25:18 +00:00
Denis Vlasenko
6bd54d48f4 libbb/pw_encrypt_sha: -28 bytes 2008-11-13 12:55:11 +00:00
Denis Vlasenko
6b1e3d7e73 libbb: remove glibc-style bloat from sha_crypt. -1130 bytes.
cryptpw: add more difficult test vectors.
2008-11-13 12:23:46 +00:00
Denis Vlasenko
fd5a3d2812 gzip: fix gzip -dc case caused by using stale getopt state 2008-11-12 22:06:46 +00:00
Denis Vlasenko
618a3027ed du: fix "du /dir /dir" case
reset_ino_dev_hashtable                                -      84     +84
du                                                   388     376     -12
du_main                                              327     301     -26
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 84/-38)             Total: 46 bytes
2008-11-11 21:15:56 +00:00
Denis Vlasenko
e9b9a19ad3 libbb: disable a second md5 implementation which managed to creep in :)
function                                             old     new   delta
sha512_end                                           239     237      -2
sha256_end                                           162     160      -2
sha1_end                                             191     189      -2
md5_end                                              168     166      -2
__md5__magic                                           4       -      -4
md5_crypt                                            627     621      -6
static.S                                              16       -     -16
__md5_Init                                            42       -     -42
static.P                                              64       -     -64
__md5_Final                                          131       -    -131
__md5_Update                                         153       -    -153
static.C                                             268      12    -256
__md5_Transform                                      293       -    -293
------------------------------------------------------------------------------
(add/remove: 0/7 grow/shrink: 0/6 up/down: 0/-973)           Total: -973 bytes
2008-11-11 01:38:04 +00:00
Denis Vlasenko
2211d5268c libbb: add optionl support for SHA256/512 encrypted passwords
function                                             old     new   delta
sha_crypt                                              -    2423   +2423
cryptpw_main                                         128     183     +55
to64                                                   -      29     +29
pw_encrypt                                           974    1000     +26
str_rounds                                             -      11     +11
login_main                                          1532    1541      +9
packed_usage                                       25215   25200     -15
__md5_to64                                            29       -     -29
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 3/1 up/down: 2553/-44)         Total: 2509 bytes
2008-11-10 18:52:35 +00:00
Denis Vlasenko
56dceb9b77 sha256,sha512: new applets. +4.9kb
we will require sha256/512 code for new $5$ and $6$ style
 password hashes anyway, they are showing up already
 in people's /etc/passwd...
2008-11-10 13:32:50 +00:00
Denis Vlasenko
c028ec280a Typo fixes 2008-11-10 10:47:47 +00:00
Denis Vlasenko
0a009c3c6b libbb: constify some data in sha1. gcc is clever enough to do it itself,
thus no actual code changes. Also some pointless beautifuing crept in.
2008-11-10 09:51:15 +00:00
Denis Vlasenko
30e1ab691c libbb: add a TODO to support new SHA-based encrypted passwords 2008-11-07 13:36:46 +00:00
Denis Vlasenko
3854c5ddf4 runsvdir: alternative methon of supporting runsvdir-as-init. +66 bytes.
*: s/int/pid_t where appropriate
2008-11-06 22:39:57 +00:00
Denis Vlasenko
202ac504e1 *: code shrink by adding a wrapper around very common tcsetattr(0, TCSANOW, xx) op
function                                             old     new   delta
tcsetattr_stdin_TCSANOW                                -      14     +14
set_sane_term                                        116     113      -3
top_main                                            1277    1273      -4
make_new_session                                     421     415      -6
rawmode                                              133     126      -7
reset_term                                            18      10      -8
die                                                   43      35      -8
cookmode                                              62      54      -8
vlock_main                                           425     415     -10
read_line_input                                     3165    3155     -10
bb_askpass                                           357     347     -10
fsck_minix_main                                     3079    3065     -14
getty_main                                          2375    2332     -43
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/12 up/down: 14/-131)         Total: -117 bytes
2008-11-05 13:20:58 +00:00
Denis Vlasenko
391ffa19d1 nslookup: tiny shrink (-5 bytes); add comment about res_init
inet_common: cosmetics, no code changes
2008-11-04 21:44:28 +00:00
Denis Vlasenko
3c385cd706 lineedit: fix bug 5824: Since version 23530 with lineedit.c,
"fdisk" & "ed" can't work any more
2008-11-02 00:41:05 +00:00
Denis Vlasenko
f34cfff2f0 setup_environment: cd $HOME regardless of clear_env value. 2008-10-30 23:58:19 +00:00
Denis Vlasenko
7462b21dbe read_key is actually written by Rob, add him to copyright notice 2008-10-26 00:19:33 +00:00
Denis Vlasenko
bdd2d8f178 read_key: add comments how Shift and Meta keys looks like.
no code changes
2008-10-25 23:59:41 +00:00
Denis Vlasenko
5f6aaf39cf less: reuse former vi's key reading code. Improve SIGWINCH handling.
function                                             old     new   delta
less_main                                           2056    2097     +41
getch_nowait                                         248     273     +25
read_key                                             310     321     +11
static.esccmds                                        61      69      +8
count_lines                                           72      74      +2
less_gets                                            166     142     -24
less_getch                                           172      43    -129
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/5 up/down: 91/-170)           Total: -79 bytes
   text    data     bss     dec     hex filename
2008-10-25 23:27:29 +00:00
Denis Vlasenko
39b0135c59 libbb: add forgotten file from previous commit :( 2008-10-25 23:23:32 +00:00
Denis Vlasenko
0112ff5203 vi: move key reading routine out of vi into llbbb
function                                             old     new   delta
read_key                                               -     310    +310
....
static.esccmds                                       170      61    -109
readit                                               286      60    -226
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 9/10 up/down: 349/-367)         Total: -18 bytes
2008-10-25 23:23:00 +00:00
Denis Vlasenko
2d5bd807c0 build system cleanup: rename FEATURE_AWK_MATH to FEATURE_AWK_LIBM;
disable parsing test applet.
2008-10-24 10:49:49 +00:00
Denis Vlasenko
d1660cb9ad ash: fix a bug in standalone mode (corrupted getopt() state) 2008-10-20 07:52:33 +00:00
Denis Vlasenko
582dff0514 volume identification: abolish /proc/partitions and /proc/cdroms
scanning. It does not catch volume managers and such.
Adding even more cruft is bad, so I decided to simply
scan /dev/* for any block devices. See how much better
it finds devices now:

# ./busybox_old blkid
/dev/sda1: LABEL="/boot" UUID="7931e231-dcb4-4b6d-9301-f7354ae24061"
/dev/dm-0: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"
/dev/dm-1: UUID="edc2a920-ef83-437e-ba64-d3b6dc851267"
/dev/sdb1: UUID="6F84-ED0F"

# ./busybox blkid
/dev/sdb1: UUID="6F84-ED0F"
/dev/root: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"
/dev/dm-1: UUID="edc2a920-ef83-437e-ba64-d3b6dc851267"
/dev/dm-0: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"
/dev/sda1: LABEL="/boot" UUID="7931e231-dcb4-4b6d-9301-f7354ae24061"
/dev/mapper/VolGroup00-LogVol01: UUID="edc2a920-ef83-437e-ba64-d3b6dc851267"
/dev/mapper/VolGroup00-LogVol00: LABEL="Fedora-9-Live-x8" UUID="bb491e1e-1145-4f5b-b0ab-cbd2baf4f15a"

function                                             old     new   delta
static.drive_name_string                              12       -     -12
append_mount_options                                 205     190     -15
volume_id_open_node                                   37      18     -19
uuidcache_check_device                               485     257    -228
uuidcache_init                                       637      36    -601
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/4 up/down: 0/-875)           Total: -875 bytes
   text    data     bss     dec     hex filename
 792218     592    6648  799458   c32e2 busybox_old
 791260     592    6648  798500   c2f24 busybox_unstripped
2008-10-19 19:36:30 +00:00
Denis Vlasenko
3ab3d8a5cf libbb: do not reject floating point strings like ".15" 2008-10-18 19:18:51 +00:00
Denis Vlasenko
682ad3045c lineedit: fix problems with empty commands in history 2008-09-27 01:28:56 +00:00
Bernhard Reutner-Fischer
6c4dadefb6 - update my name. No obj-code changes ;) 2008-09-25 12:13:34 +00:00
Denis Vlasenko
17e7f04c8d top: optional SMP support by Vineet Gupta (vineetg76 AT gmail.com) 2008-09-25 10:48:06 +00:00
Denis Vlasenko
ea7c9b3366 whitespace fixes 2008-09-25 10:39:10 +00:00
Denis Vlasenko
248b4a77e7 libbb: document that we maybe will want to understand \e someday
(no code changes)
2008-09-19 23:43:59 +00:00
Denis Vlasenko
ba1315d0fb modutils/*: rewrite by Timo Teras <timo.teras AT iki.fi>
- a lot faster (linear algorithmic complexity, smaller memory foot print)
- a lot smaller (the old code was overly complicated)
- loading of aliases is now module-init-tools compliant
- blacklisting is done correctly (-b option added)
- module argument quoting done right
- depmod now correctly generates modules.symbols and modules.alias

add/remove: 16/21 grow/shrink: 4/6 up/down: 6930/-9316 Total: -2386 bytes
   text    data     bss     dec     hex filename
 806039     592    6680  813311   c68ff busybox_old
 803498     592    6676  810766   c5f0e busybox_unstripped
2008-09-13 14:59:38 +00:00
Denis Vlasenko
08ea11ab07 runsvd: shrink by Vladimir
*: use unified trivial signal handler

function                                             old     new   delta
record_signo                                           -      10     +10
process_stdin                                        433     443     +10
bbunpack                                             383     391      +8
wc_main                                              598     605      +7
conescape                                            293     296      +3
nmeter_main                                          670     672      +2
fallbackSort                                        1717    1719      +2
bb_got_signal                                          -       1      +1
microcom_main                                        713     712      -1
signalled                                              2       -      -2
pack_gzip                                           1661    1659      -2
evalvar                                             1376    1374      -2
compare_keys                                         737     735      -2
parse_command                                       1460    1456      -4
expand                                              1748    1744      -4
s_term                                                37      29      -8
s_hangup                                               8       -      -8
fgotsig                                               10       -     -10
find_pair                                            187     169     -18
signal_handler                                       190     170     -20
runsvdir_main                                       1701    1583    -118
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 6/10 up/down: 43/-199)         Total: -156 bytes
2008-09-11 19:51:11 +00:00
Bernhard Reutner-Fischer
4acb1b0793 - commentary typo fix 2008-09-05 11:46:43 +00:00
Denis Vlasenko
d66aa3c701 df: add support for more options, add some coreutils 6.10 compat.
by Bernhard Reutner-Fischer

function                                             old     new   delta
df_main                                              664     795    +131
packed_usage                                       24812   24862     +50
make_human_readable_str                              213     262     +49
static.ignored_mounts                                  -       8      +8
static.unit_chars                                      -       7      +7
static.zero_and_units                                  6       -      -6
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/0 up/down: 245/-6)            Total: 239 bytes
2008-08-28 22:42:52 +00:00
Denis Vlasenko
15f2fdb2b9 hexdump: fix SEGV in hexdump -e "" 2008-08-23 23:15:48 +00:00
Denis Vlasenko
e417be6697 getopt32: do not return pointer to alloca() areas 2008-08-20 23:03:38 +00:00
Denis Vlasenko
f31c3b677d linedit: fix use-after-free 2008-08-20 00:46:32 +00:00
Denis Vlasenko
4301616b27 libbb: getopt32() should not ever touch argv[0] (even read) 2008-08-20 00:15:42 +00:00
Denis Vlasenko
1c45a505eb libbb: fix mishandling of "all argv are opts" in getopt32()
function                                             old     new   delta
top_main                                            1100    1095      -5
getopt32                                            1398    1361     -37
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-42)             Total: -42 bytes
2008-08-20 00:12:22 +00:00
Denis Vlasenko
eb084779d7 libbb: use ptsname_r, it's smaller
function                                             old     new   delta
xgetpty                                               91      81     -10
ptsname                                               33       -     -33

   text    data     bss     dec     hex filename
 793828     592    6692  801112   c3958 busybox_old
 793796     592    6660  801048   c3918 busybox_unstripped
2008-08-17 12:47:19 +00:00
Denis Vlasenko
11152e30e3 mkdir: fix "uname 0222; mkdir foo/bar" case
(by Doug Graham <dgraham AT nortel.com>)

function                                             old     new   delta
bb_make_directory                                    291     280     -11
2008-08-15 19:18:35 +00:00
Denis Vlasenko
69f4f9a6f4 optimize config_read() (by Timo Teras <timo.teras AT iki.fi>)
function                                             old     new   delta
bb_get_chunk_with_continuation                         -     176    +176
find_pair                                            169     187     +18
...
process_stdin                                        443     433     -10
config_read                                          549     456     -93
bb_get_chunk_from_file                               139       7    -132
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 7/7 up/down: 215/-254)          Total: -39 bytes
2008-08-09 17:16:40 +00:00
Denis Vlasenko
3fd15e197e grep: option to use GNU regex matching instead of POSIX one.
This fixes problems with NULs in files being scanned, but
 costs +800 bytes. The same can be done to sed (TODO).
2008-08-09 16:15:14 +00:00
Denis Vlasenko
728161b556 fix bug 4464 for real. I am dumb. 2008-08-06 08:44:09 +00:00
Denis Vlasenko
2afd5ab62c *: use get_console_fd() as appropriate, and make it fail on open error -
get_console_fd_or_die().

function                                             old     new   delta
get_console_fd_or_die                                  -     163    +163
loadkmap_main                                        211     201     -10
loadfont_main                                        440     430     -10
dumpkmap_main                                        218     208     -10
kbd_mode_main                                        158     146     -12
setkeycodes_main                                     156     143     -13
get_console_fd                                       163       -    -163
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/5 up/down: 163/-218)          Total: -55 bytes
2008-08-05 23:32:27 +00:00
Denis Vlasenko
db29f5e73e libbb: fix thinko in latest xrealloc_vector change 2008-08-05 21:12:00 +00:00
Denis Vlasenko
ec73d30322 randomconfig fixes 2008-08-05 17:43:29 +00:00
Denis Vlasenko
e9ad84dfd4 *: refactor handling of archived files. "tar f file.tar.lzma" now works too.
function                                             old     new   delta
unpack_Z_stream                                        -    1229   +1229
open_zipped                                            -     176    +176
unpack_bz2_stream_prime                                -      60     +60
tar_main                                             642     677     +35
find_main                                            406     418     +12
sv_main                                             1222    1233     +11
decode_format_string                                 829     837      +8
cmp_main                                             641     649      +8
popstring                                            134     140      +6
filter_accept_list_reassign                          120     125      +5
parse_and_put_prompt                                 800     804      +4
passwd_main                                         1053    1049      -4
make_new_name_gunzip                                 119     114      -5
rpm_main                                            1688    1670     -18
prepare                                              302     283     -19
xmalloc_open_zipped_read_close                       135      61     -74
uncompress                                          1229       -   -1229
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 8/5 up/down: 1554/-1349)        Total: 205 bytes
2008-08-05 13:10:34 +00:00
Denis Vlasenko
855ff6f503 modprobe: use buffering line reads (fgets) instead of reads().
libbb: remove reads()

function                                             old     new   delta
include_conf_file_act                                961     980     +19
localcmd                                             282     284      +2
already_loaded                                       155     151      -4
in_cksum                                              58      53      -5
modprobe_main                                       1630    1624      -6
reads                                                129       -    -129
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/3 up/down: 21/-144)          Total: -123 bytes
2008-08-04 21:16:46 +00:00
Denis Vlasenko
27842288b3 libbb: make xrealloc_vector zero out the realloc'ed tail
function                                             old     new   delta
xrealloc_vector_helper                                51      76     +25
man_main                                             712     705      -7
act                                                  250     234     -16
create_list                                           91      70     -21
getopt_main                                          695     664     -31
load_dep_bb                                          281     248     -33
fileAction                                           744     709     -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/6 up/down: 25/-143)          Total: -118 bytes
2008-08-04 13:20:36 +00:00
Denis Vlasenko
2f86d13dff libbb: dump: do not use uninitialized memory. close bug 4364. 2008-07-29 00:00:14 +00:00
Denis Vlasenko
6e69e4237d netstat: optional -p support by L. Gabriel Somlo <somlo AT cmu.edu>
Without FEATURE_NETSTAT_PRG:
function                                             old     new   delta
recursive_action                                     416     425      +9
tcp_do_one                                           420     428      +8
udp_do_one                                           492     499      +7
raw_do_one                                           472     479      +7
expand                                              1697    1701      +4
netstat_main                                         489     492      +3
unix_do_one                                          486     488      +2
flags                                                  1       -      -1
qgravechar                                           109     106      -3
net_conn_line                                          4       -      -4
bbunpack                                             391     383      -8
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 7/2 up/down: 40/-16)             Total: 24 bytes

With FEATURE_NETSTAT_PRG:
file_act                                               -     213    +213
dir_act                                                -     192    +192
netstat_main                                         489     601    +112
prg_cache_get                                          -      50     +50
tcp_do_one                                           420     462     +42
udp_do_one                                           492     533     +41
raw_do_one                                           472     513     +41
unix_do_one                                          486     519     +33
recursive_action                                     416     425      +9
expand                                              1697    1701      +4
flags                                                  1       -      -1
qgravechar                                           109     106      -3
net_conn_line                                          4       -      -4
bbunpack                                             391     383      -8
packed_usage                                       24586   24572     -14
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 7/3 up/down: 737/-30)           Total: 707 bytes
2008-07-27 12:10:07 +00:00
Denis Vlasenko
084266ed52 fix several problems with config parser:
a bug where it underflows the string
 a bug where it never frees parser_t struct
make read_config() return 0 if parser is NULL,
 make config_close() accept and ignore NULL parser -
 eliminates many if() blocks
reverse the sense of parser bit flags - negative flags
 are harder to grok.
hexdump: revert the change to use config parser, it is BIGGER
 and also requires additional quirks in parser
*: explicitly use PARSER_NORMAL instead of 0

function                                             old     new   delta
login_main                                          1575    1596     +21
config_close                                          18      29     +11
bbunpack                                             383     391      +8
qgravechar                                           106     109      +3
rtnl_tab_initialize                                  121     117      -4
expand                                              1697    1693      -4
man_main                                             717     712      -5
nameif_main                                          674     668      -6
hexdump_main                                         597     591      -6
read_config                                          217     209      -8
dnsd_main                                           1478    1470      -8
sysctl_main                                          203     189     -14
config_open2                                          44      25     -19
make_device                                         1177    1141     -36
config_read                                          597     549     -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/11 up/down: 43/-158)         Total: -115 bytes
2008-07-26 23:08:31 +00:00
Denis Vlasenko
0f99d49ae6 *: conversion to config parser
function                                             old     new   delta
config_read                                          540     597     +57
config_open2                                          41      44      +3
rtnl_rtprot_initialize                                70      66      -4
rtnl_rttable_initialize                               78      73      -5
rtnl_rtscope_initialize                               88      83      -5
rtnl_rtrealm_initialize                               48      43      -5
rtnl_rtdsfield_initialize                             48      43      -5
process_module                                       566     560      -6
bbunpack                                             391     383      -8
rtnl_tab_initialize                                  279     121    -158
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/8 up/down: 60/-196)          Total: -136 bytes
2008-07-24 23:38:04 +00:00
Denis Vlasenko
49a5eba9ae s/othervise/otherwise/g 2008-07-23 08:41:08 +00:00
Denis Vlasenko
41660c5b2d another overlapping_strcpy 2008-07-22 20:25:24 +00:00
Denis Vlasenko
0f293b96dc fix all cases of strcpy on overlapping strings. 2008-07-22 20:16:55 +00:00
Bernhard Reutner-Fischer
3e8669f359 - wrap overlong lines (Cristian Ionescu-Idbohrn)
- s/\.  /. /g;# (me)
2008-07-22 18:27:53 +00:00
Denis Vlasenko
5415c856ea libbb: [x]fopen_for_{read,write} introduced and used.
(by Valdimir)

function                                             old     new   delta
config_open2                                           -      41     +41
config_read                                          507     542     +35
find_pair                                            169     187     +18
fopen_for_write                                        -      14     +14
fopen_for_read                                         -      14     +14
find_main                                            406     418     +12
xfopen_for_write                                       -      10     +10
xfopen_for_read                                        -      10     +10
popstring                                            134     140      +6
parse_inittab                                        396     401      +5
next_token                                           923     928      +5
pack_gzip                                           1659    1661      +2
bb__parsespent                                       117     119      +2
fallbackSort                                        1719    1717      -2
evalvar                                             1376    1374      -2
qrealloc                                              36      33      -3
...
...
...
...
singlemount                                         4579    4569     -10
process_stdin                                        443     433     -10
patch_main                                          1111    1101     -10
ifupdown_main                                       2175    2165     -10
file_action_grep                                      90      80     -10
uuidcache_init                                       649     637     -12
hush_main                                            797     785     -12
read_config                                          230     217     -13
dpkg_main                                           3835    3820     -15
read_line_input                                     3134    3110     -24
sysctl_main                                          232     203     -29
config_open                                           40      10     -30
WARN_BAD_LINE                                         44       -     -44
login_main                                          1714    1575    -139
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737)        Total: -563 bytes
2008-07-21 23:05:26 +00:00
Bernhard Reutner-Fischer
d73cbd31a2 - first pass to unify/cleanup uid handling (-236b)
This needs further love, alot of love.. Tito?
2008-07-21 14:41:33 +00:00
Denis Vlasenko
9b366f4136 libbb/parse_config.c: fix small buglet (by Vladimir) 2008-07-20 17:50:58 +00:00
Denis Vlasenko
b9bbc40f64 libbb: fix print_flags() [fix somehow is only in 1.11.1?) 2008-07-20 13:47:51 +00:00
Denis Vlasenko
4a717e0c19 libbb: fixes to config_read() by maintainer
sysctl: use config_read()

function                                             old     new   delta
sysctl_main                                          121     232    +111
config_read                                          478     502     +24
parse_main                                           239     241      +2
sysctl_preload_file_and_exit                         234       -    -234
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 3/0 up/down: 137/-234)          Total: -97 bytes
2008-07-20 13:01:56 +00:00
Denis Vlasenko
dcb3fcb042 libbb: config_read() update 2008-07-19 22:57:00 +00:00
Denis Vlasenko
2e157ddf9e libbb: updated config_parse() from Vladimir
function                                             old     new   delta
config_read                                          385     460     +75
runsvdir_main                                       1701    1716     +15
readit                                               331     338      +7
passwd_main                                         1049    1053      +4
parse_command                                       1504    1507      +3
decode_format_string                                 822     824      +2
bb__parsespent                                       117     119      +2
udhcp_get_option                                     221     222      +1
changepath                                           196     194      -2
parse_inittab                                        400     396      -4
nameif_main                                          683     679      -4
make_device                                         1176    1172      -4
config_open                                           48      40      -8
expand_main                                          698     689      -9
readcmd                                             1012    1002     -10
config_free_data                                      37      21     -16
SynchronizeFile                                      683     643     -40
sleep_main                                           474     362    -112
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/10 up/down: 109/-209)        Total: -100 bytes
2008-07-19 09:27:19 +00:00
Denis Vlasenko
bd28f6bf7f test: fix parser to prefer binop over unop, as coreutils does.
remove bogus workaround in main(). rename atrocious variables/functions.
 much expand testsuite.
libbb: fix --help to not affect "test --help"

function                                             old     new   delta
run_applet_no_and_exit                               421     440     +19
nexpr                                                817     825      +8
static.no_op                                           -       6      +6
test_main                                            397     257    -140
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 2/1 up/down: 104/-211)         Total: -107 bytes
2008-07-19 08:15:13 +00:00
Denis Vlasenko
f19817ddc2 libbb: fix bb_strtol[l]'s check for "-". Hopefully closes bug 4174
function                                             old     new   delta
bb_strtol                                             82      85      +3
handle_errors                                         75      66      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 3/-9)               Total: -6 bytes
2008-07-18 18:17:10 +00:00
Denis Vlasenko
3b3ca113ed pidof/killall: allow find_pid_by_name to find running
processes started as scripts_with_name_longer_than_15_bytes.sh
 closes bug 4054 (and is generally neat)
2008-07-17 18:39:36 +00:00
Denis Vlasenko
a474b68991 init: fix compile-time error; fix exiting on broken config file
parse_config: cosmetics
2008-07-17 17:58:44 +00:00
Bernhard Reutner-Fischer
54d50a0b47 - fix "noreduce" flag of config_read (didn't work at all, at least for me).
- convert init's inittab parsing to the new config parser:
function                                             old     new   delta
config_read                                          393     386      -7
static.actions                                        72      64      -8
.rodata                                           121772  121764      -8
parse_inittab                                        554     393    -161
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-184)           Total: -184 bytes
2008-07-17 14:00:42 +00:00
Bernhard Reutner-Fischer
679212836a - fix segfault in nameif with mactab file
(by fixing and shrink config parser)

function                                             old     new   delta
config_free_data                                       -      37     +37
config_open                                           43      48      +5
pack_gzip                                           1658    1660      +2
nameif_main                                          527     525      -2
SynchronizeFile                                      629     623      -6
make_device                                         1184    1176      -8
config_close                                          31      18     -13
config_read                                          431     393     -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/5 up/down: 44/-67)            Total: -23 bytes
2008-07-17 11:59:13 +00:00
Denis Vlasenko
416914fc61 bb_strtoXXX: close bug 4174 (potential use of buf[-1]) 2008-07-17 08:48:13 +00:00
Denis Vlasenko
fb1642f2ca fix up callsites of config_read to check for >= 0 2008-07-16 23:04:49 +00:00
Denis Vlasenko
c01340fe26 update of config file parser from Vladimir 2008-07-16 22:12:18 +00:00
Denis Vlasenko
55f7912dda libbb: get rid of statics in dump.c; code shrinks a lot too
function                                             old     new   delta
alloc_dumper                                           -      26     +26
hexdump_main                                         600     601      +1
static.done                                            1       -      -1
static.ateof                                           1       -      -1
bb_dump_vflag                                          1       -      -1
static.savp                                            4       -      -4
static.nextfs                                          4       -      -4
static.curp                                            4       -      -4
exitval                                                4       -      -4
endfu                                                  4       -      -4
bb_dump_length                                         4       -      -4
bb_dump_fshead                                         4       -      -4
bb_dump_blocksize                                      4       -      -4
_argv                                                  4       -      -4
bb_dump_add                                          365     358      -7
savaddress                                             8       -      -8
eaddress                                               8       -      -8
bb_dump_skip                                           8       -      -8
address                                                8       -      -8
bb_dump_dump                                        2748    2672     -76
next                                                 538     445     -93
------------------------------------------------------------------------------
(add/remove: 1/16 grow/shrink: 1/3 up/down: 27/-247)         Total: -220 bytes
   text	   data	    bss	    dec	    hex	filename
 789458	    607	   6764	 796829	  c289d	busybox_old
 789309	    601	   6696	 796606	  c27be	busybox_unstripped
2008-07-16 11:00:16 +00:00
Denis Vlasenko
bd9874db74 od,hexdump: fix bug where xrealloc may move pointer,
leaving other pointers dangling (bug 4104).
 + many style fixes in libbb/dump.c.
2008-07-16 07:22:14 +00:00
Denis Vlasenko
5e476bab9c libbb: document plans to speed up line-based input 2008-07-15 21:29:44 +00:00
Denis Vlasenko
e559e0a757 libbb: unified config parser (By Vladimir Dronnikov)
mdev: use it

function                                             old     new   delta
config_read                                            -     400    +400
config_open                                            -      43     +43
config_close                                           -       9      +9
qrealloc                                              33      36      +3
compare_keys                                         735     737      +2
xstrtoull_range_sfx                                  296     295      -1
qgravechar                                           109     106      -3
get_address                                          181     178      -3
next_token                                           928     923      -5
sv_main                                             1228    1222      -6
find_main                                            418     406     -12
next_field                                            32       -     -32
make_device                                         1269    1184     -85
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/7 up/down: 457/-147)          Total: 310 bytes
2008-07-15 21:09:30 +00:00
Denis Vlasenko
2132e02213 libbb: experimental faster string reading routines. 2008-07-15 10:33:12 +00:00
Denis Vlasenko
ad6d6ffcdc libbb: shrink print_login_issue (by Vladimir Dronnikov)
function                                             old     new   delta
print_login_issue                                    469     435     -34
2008-07-12 23:47:24 +00:00
Denis Vlasenko
adbb73bda7 sleep: if FANCY && DESKTOP, support fractional seconds, minutes,
hours and so on. It's coreutils compat. bloatcheck is atrocious :(

function                                             old     new   delta
sleep_main                                            71     362    +291
bb_strtod                                              -     127    +127
make_device                                         1269    1294     +25
getoptscmd                                           708     713      +5
switch_root_main                                     402     401      -1
display_speed                                         90      85      -5
show_entry                                           295     289      -6
parse_expr                                           841     833      -8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/4 up/down: 448/-20)           Total: 428 bytes
2008-07-12 17:05:14 +00:00
Denis Vlasenko
0e52541917 taskset: fix some careless code in both fancy and non-fancy cases.
-5 bytes for fancy, +5 for non-fancy
2008-07-11 13:57:08 +00:00
Denis Vlasenko
b6052724ff open_transformer: do not return fd, it does not change
libbb: adopt zipped read from modprobe-small

function                                             old     new   delta
getoptscmd                                           708     713      +5
qgravechar                                           106     109      +3
huft_build                                          1165    1168      +3
tr_main                                              474     472      -2
open_transformer                                      91      89      -2
evalvar                                             1376    1374      -2
rpm_main                                            1691    1688      -3
qrealloc                                              36      33      -3
get_header_tar_lzma                                   55      52      -3
get_header_tar_gz                                    100      97      -3
get_header_tar_bz2                                    55      52      -3
get_header_tar_Z                                      89      86      -3
find_main                                            418     406     -12
prepare                                              302     283     -19
xmalloc_open_zipped_read_close                       161     135     -26
xmalloc_read                                         248     199     -49
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/13 up/down: 11/-130)         Total: -119 bytes
2008-07-10 17:43:01 +00:00
Denis Vlasenko
96c45b0e0b libbb/mtab: fix xrealloc_vector fallout 2008-07-09 19:44:08 +00:00