Commit Graph

2274 Commits

Author SHA1 Message Date
Denys Vlasenko
5aeae36e2b libbb: fix compile failure if both ARG_MAX and _SC_ARG_MAX are defined
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25 15:39:27 +02:00
Bartosz Golaszewski
3ed81cf052 unit-tests: implement the unit-testing framework
This set of patches adds a simple unit-testing framework to Busybox

unit-tests: add some helper macros for unit-test framework implementation
unit-tests: implement the unit-testing framework
unit-tests: add basic documentation on writing the unit test cases
unit-tests: modify the Makefile 'test' target to run unit-tests too
unit-tests: add two example test cases
unit-tests: modify the existing strrstr test code to use the unit-test framework

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22 16:30:41 +02:00
Bartosz Golaszewski
5d2e409ef8 libbb: use a wrapper around sysconf(_SC_CLK_TCK) to save a few bytes
function                                             old     new   delta
bb_sc_clk_tck                                          -      10     +10
timescmd                                             118     113      -5
print_route                                         1763    1758      -5
mpstat_main                                         1288    1283      -5
iostat_main                                         1947    1942      -5
INET_setroute                                        879     871      -8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/5 up/down: 10/-28)            Total: -18 bytes
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22 14:01:13 +02:00
Denys Vlasenko
f92f1d0181 find: use sysconf(_SC_ARG_MAX) to determine the command-line size limit
The find utility uses a hardcoded value of 32 * 1024 as the limit of
the command-line length when calling 'find -exec ... {} +'. This results
in over 4 times more execve() calls than in coreutils' find.

This patch uses the limit defined in system headers.

Based on the patch by  Bartosz Golaszewski <bartekgola@gmail.com>.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22 13:54:40 +02:00
Denys Vlasenko
17f8418ea7 Add conditional support for -v / --verbose
With FEATURE_VERBOSE off, practically no size change.
With it on:

function                                             old     new   delta
remove_file                                          493     556     +63
install_main                                         719     765     +46
bb_make_directory                                    383     419     +36
rmdir_main                                           162     191     +29
copy_file                                           1516    1544     +28
mv_main                                              502     525     +23
cmp_main                                             677     693     +16
bbconfig_config_bz2                                 5264    5279     +15
mkdir_main                                           158     168     +10
install_longopts                                      66      76     +10
rm_main                                              167     175      +8
nexpr                                                840     846      +6
scan_tree                                            275     280      +5
fsck_main                                           1807    1811      +4
ed_main                                             2541    2545      +4
expand_one_var                                      1574    1575      +1
swap_on_off_main                                     420     418      -2
parse_command                                       1443    1440      -3
redirect                                            1279    1274      -5
do_load                                              946     918     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 16/4 up/down: 304/-38)          Total: 266 bytes

Based on the patch by Igor Živković.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-19 16:23:50 +02:00
Denys Vlasenko
e765b5ac34 libbb: rename execable -> executable. No code changes
English speakers complained that it sounded awfully broken.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02 17:15:58 +02:00
Denys Vlasenko
15a357e596 libbb: fix empty PATH components handling
function                                             old     new   delta
find_execable                                         81      86      +5
exists_execable                                       71      66      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02 17:08:29 +02:00
Denys Vlasenko
d8290c2ef0 libbb: fix thinko in rtc_xopen()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02 09:07:16 +02:00
Denys Vlasenko
528808fa7b libbb: make rtc_xopen try harder on EBUSY
function                                             old     new   delta
rtc_xopen                                             77     139     +62

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02 09:05:03 +02:00
Denys Vlasenko
fe33683c8b Fix compile failures
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02 07:18:55 +02:00
Denys Vlasenko
3dfe0ae5a8 libbb: make syslog level for bb_error_msg's configurable. use it in crond
function                                             old     new   delta
bb_verror_msg                                        380     386      +6
syslog_level                                           -       1      +1
crondlog                                             165     108     -57

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30 14:48:28 +02:00
Denys Vlasenko
eb9f485b07 libbb/obscure.c: code shrink. Suggested by Tito.
function                                             old     new   delta
string_checker                                        97      92      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-16 19:51:34 +02:00
Bernhard Reutner-Fischer
ad16741ccd libbb: provide usleep() fallback implementation
POSIX.1-2008 removed the usleep function, provide a fallback
implementaion using the recommended nanosleep().

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-13 16:37:57 +02:00
Denys Vlasenko
c50493854a libbb: fix a bad check for uclibc >= 0.9.31
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 20:53:40 +01:00
Denys Vlasenko
438b4ac286 script: make it work even if fd 0 is closed
Testcase:
script -q -c "echo hey" /dev/null 0>&-

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 12:34:53 +01:00
Denys Vlasenko
6f068904dc xargs: add support for -I and -i. Closes 493
function                                             old     new   delta
process_stdin_with_replace                             -     195    +195
xmalloc_substitute_string                              -     145    +145
xargs_main                                           808     884     +76
count_strstr                                           -      45     +45
packed_usage                                       29580   29571      -9
parse_params                                        1445    1416     -29
func_exec                                            285     138    -147
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 1/3 up/down: 461/-185)          Total: 276 bytes
   text	   data	    bss	    dec	    hex	filename
 922156	    932	  17692	 940780	  e5aec	busybox_old
 922440	    932	  17692	 941064	  e5c08	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 11:17:06 +01:00
Denys Vlasenko
83bc4332e7 du, copy_file: fix file matching on cramfs. Closes 5456
function                                             old     new   delta
is_in_ino_dev_hashtable                               88     108     +20
add_to_ino_dev_hashtable                             150     142      -8
reset_ino_dev_hashtable                               84      75      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 20/-17)              Total: 3 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-25 15:27:58 +01:00
Denys Vlasenko
12916b9220 libbb: trivial code shrink
function                                             old     new   delta
reset_ino_dev_hashtable                               84      74     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-25 15:09:01 +01:00
Denys Vlasenko
8ed9672660 libbb: don't die if crypt() returns NULL
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-09 14:38:03 +01:00
Mike Frysinger
f1999b5a9d appletlib: fix set-but-unused warning
When you build with FEATURE_INSTALLER disabled, you get a build
warning like so:

libbb/appletlib.c: In function 'busybox_main':
libbb/appletlib.c:691:7: warning: variable 'use_symbolic_links' set but
                                  not used [-Wunused-but-set-variable]
   int use_symbolic_links;
       ^

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-01-31 00:29:47 -05:00
Denys Vlasenko
fa6ab56353 libbb: if opening /dev/loopN returns ENXIO, don't try N++.
function                                             old     new   delta
set_loop                                             639     635      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-21 13:44:21 +01:00
Denys Vlasenko
3b394781b5 libbb: fix parsing of "10101010" date/time form
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-21 07:58:18 +01:00
Denys Vlasenko
79df481dc4 lineedit: fix trivial build failure
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-10 14:38:26 +01:00
Denys Vlasenko
96f92a1afa libbb: FreeBSD fix for B<num> baud rate constants not fitting into a short.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-08 15:25:20 +01:00
Denys Vlasenko
198b02f7dd fix failures found by randomconfig builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-31 23:22:36 +01:00
Michael Tokarev
9f4f60183b do not fail build if MAXSYMLINKS isn't defined
This is needed for, eg, hurd, which is known to have no constraints.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-16 03:41:30 +01:00
Denys Vlasenko
9b2a9f0210 fix assorted unused code and wrong format specs found by cppchekc (bug 6716)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29 16:43:33 +01:00
Denys Vlasenko
1a7256ac38 chpst: fix a bug where -U USER was using wrong USER (one from -u USER)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29 16:39:28 +01:00
Denys Vlasenko
259b3c047a sed: open input files sequentially to avoid EMFILE
Currently, sed pre-opens all files, which may cause EMFILE errors
on systems with low ulimit -n.  Change sed to open one file at a time.

function                                             old     new   delta
get_next_line                                        177     235     +58
sed_main                                             682     652     -30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 58/-30)             Total: 28 bytes

Based on the patch by Daniel Borca <dborca@yahoo.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-28 03:14:16 +01:00
Denys Vlasenko
cffe28ef87 libbb: add sketch of tentative 'better' passwd/group API
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-26 13:46:18 +01:00
Denys Vlasenko
8b59b2c13e libbb: move nuke_str() from passwd into libbb
function                                             old     new   delta
nuke_str                                               -      15     +15
ask_and_check_password_extended                      215     206      -9
init_main                                            781     771     -10
nuke_str                                              27       -     -27
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 15/-46)            Total: -31 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-19 13:36:45 +01:00
Denys Vlasenko
6ef7729112 comment tweak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-19 13:16:44 +01:00
Denys Vlasenko
9c1c605b1a sulogin: use common password-checking routine.
This needed some extensions correct_passwd() function,
which got renamed ask_and_check_password() to better describe what it does.

function                                             old     new   delta
ask_and_check_password_extended                        -     215    +215
ask_and_check_password                                 -      12     +12
vlock_main                                           394     397      +3
sulogin_main                                         494     326    -168
correct_password                                     207       -    -207
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/1 up/down: 230/-375)         Total: -145 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-19 13:09:06 +01:00
Ryan Mallon
5906a5c26c libbb: Add xsetegid(), xseteuid(), xopen_as_uid_gid() functions
Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-08 14:52:49 +02:00
Denys Vlasenko
a407cf74cc Make smart_ulltoa return pointer to end (allows for code shink in callers)
function                                             old     new   delta
smart_ulltoa5                                        405     408      +3
smart_ulltoa4                                        273     276      +3
list_table                                          1113    1114      +1
scale                                                 36      34      -2
put_lu                                                55      53      -2
ulltoa6_and_space                                     19      14      -5
powertop_main                                       1470    1461      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-06 12:53:14 +02:00
Denys Vlasenko
1b9ac21166 lineedit: use unicode_strwidth instead of unicode_strlen
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 16:13:05 +02:00
Denys Vlasenko
e66a56de23 lineedit: fix multi-line PS1 handling: calculate PS1 length from last \n
function                                             old     new   delta
parse_and_put_prompt                                 755     774     +19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-19 16:45:04 +02:00
Denys Vlasenko
7a18043a96 lineedit: improve Unicode handling (still buggy though)
function                                             old     new   delta
unicode_strlen                                         -      31     +31
read_line_input                                     3876    3879      +3
lineedit_read_key                                    255     246      -9
parse_and_put_prompt                                 785     755     -30
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/2 up/down: 34/-39)             Total: -5 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-19 16:44:05 +02:00
Denys Vlasenko
543efd7b4b libbb: code shrink
function                                             old     new   delta
xmalloc_ttyname                                       46      42      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-06 00:41:06 +02:00
Denys Vlasenko
982e87f2fb Whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-30 11:52:58 +02:00
Bartosz Golaszewski
79c618c411 Refactor catv. Move visible() from stty to libbb.
Fixes the following TODO:

  stty's visible() function and catv's guts are identical. Merge them into
  an appropriate libbb function.

Also makes catv behave exactly like coreutils' cat -v e.g. it'll print 'M-^I'
instead of 'M-   '.

function                                             old     new   delta
visible                                                -      70     +70
do_display                                           431     379     -52
catv_main                                            306     250     -56
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 70/-108)           Total: -38 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-30 06:29:42 +02:00
Bartosz Golaszewski
688a7e3f04 date: accept 'yyyy-mm-dd HH' and 'yyyy-mm-dd' date formats
function                                             old     new   delta
parse_datestr                                        794     885     +91

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-25 05:10:01 +02:00
Bartosz Golaszewski
c19be75d57 networking: code shrink
function                                             old     new   delta
in_ether                                               -     124    +124
hexchar2int                                           42       -     -42
ifconfig_main                                       1237    1106    -131
ether_input                                          141       -    -141
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/1 up/down: 124/-314)         Total: -190 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-25 04:39:04 +02:00
Denys Vlasenko
c72b43c2f0 Commonalize typical [b,]k,m suffix struct
function                                             old     new   delta
bkm_suffixes                                           -      32     +32
static.km_suffixes                                    24       -     -24
suffixes                                              32       -     -32
static.bkm                                            32       -     -32
head_tail_suffixes                                    32       -     -32
------------------------------------------------------------------------------
(add/remove: 2/6 grow/shrink: 0/0 up/down: 72/-160)           Total: -88 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-13 23:49:45 +02:00
Denys Vlasenko
d8f6d8c627 Call setlocale("") , not "C", if we want to set the default one
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-07 14:41:58 +02:00
Denys Vlasenko
2301d127a2 unicode: check $LC_CTYPE too to detect Unicode mode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-05 22:00:57 +02:00
Denys Vlasenko
3e7ecb179b unicode: check $LC_ALL to detect Unicode mode, not only $LANG
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-02 17:30:23 +02:00
Denys Vlasenko
59f46676a9 Move create_icmp[6]_socket to its only user, and simplify it
function                                             old     new   delta
run_applet_and_exit                                  711     714      +3
sendping_tail                                        239     236      -3
common_ping_main                                    1798    1770     -28
create_icmp_socket                                    65       -     -65
create_icmp6_socket                                   65       -     -65
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 1/2 up/down: 3/-161)           Total: -158 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-28 00:30:46 +02:00
Denys Vlasenko
1f5e81f8f8 md5/sha512: a better fix for strict aliasing warnings
The locations *are* well-aligned for direct stores
on any architecture.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-27 01:03:19 +02:00
Mike Frysinger
f6205c6ab7 md5/sha512: fix strict aliasing warnings
If the target can tolerate these issues, then gcc is smart enough
to generate the same code (x86_64 produces the same code).  If the
target can't, then it needs the memcpy anyways.

libbb/hash_md5_sha.c: In function 'common64_end':
libbb/hash_md5_sha.c:87:4: warning:
  dereferencing type-punned pointer will break strict-aliasing rules
    *(uint64_t *) (&ctx->wbuffer[64 - 8]) = t;
libbb/hash_md5_sha.c: In function 'sha512_end':
libbb/hash_md5_sha.c:886:4: warning:
  dereferencing type-punned pointer will break strict-aliasing rules
    *(uint64_t *) (&ctx->wbuffer[128 - 8]) = t;
libbb/hash_md5_sha.c:889:4: warning:
  dereferencing type-punned pointer will break strict-aliasing rules
    *(uint64_t *) (&ctx->wbuffer[128 - 16]) = t;

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-06-19 11:49:15 -04:00
Jonathan Liu
b6dc13c2d3 sulogin: allow system maintenance login if root password is empty
The current password checking is unable to distinguish between the user
entering an empty password or pressing Control-D. As a result, an empty
password always results in normal startup.

We modify bb_ask to return NULL if Control-D is pressed without entering
a password. The sulogin applet is then modified to only proceed to
normal startup if bb_ask returns NULL. This covers EOF with no password,
interrupt by timeout and ^C.

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-21 17:01:55 +02:00
Flemming Madsen
d96ffda62e ash,hush: history builtin
function                                             old     new   delta
show_history                                           -      39     +39
builtin_history                                        -      16     +16
historycmd                                             -      13     +13
bltins1                                              312     324     +12
builtintab                                           336     344      +8
popstring                                            134     140      +6
hush_main                                           1048    1046      -2
ash_main                                            1398    1396      -2
size_from_HISTFILESIZE                                44      40      -4
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 3/3 up/down: 94/-8)              Total: 86 bytes

Signed-off-by: Flemming Madsen <busybox@themadsens.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-04-07 18:47:24 +02:00
Denys Vlasenko
8172d054db lineedit: \W on "/bin" should show "bin", not "/bin"
function                                             old     new   delta
parse_and_put_prompt                                 793     785      -8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-29 13:21:53 +01:00
Denys Vlasenko
1d14569a66 lineedit: implement \T \t \A \@ prompts escapes, fix \W escape, drop \!
function                                             old     new   delta
parse_and_put_prompt                                 742     793     +51
read_line_input                                     3836    3826     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-29 13:10:23 +01:00
Denys Vlasenko
8f2cb7ab26 libbb: introduce and use strftime_[YYYYMMDD]HHMMSS()
function                                             old     new   delta
strftime_fmt                                           -      53     +53
strftime_YYYYMMDDHHMMSS                                -      12     +12
strftime_HHMMSS                                        -      12     +12
human_time                                            44      43      -1
fmtstr_t                                               9       -      -9
step_time                                            361     345     -16
watch_main                                           261     232     -29
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/3 up/down: 77/-55)             Total: 22 bytes
   text	   data	    bss	    dec	    hex	filename
 919203	    932	  17692	 937827	  e4f63	busybox_old
 919209	    932	  17692	 937833	  e4f69	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-29 12:30:33 +01:00
Denys Vlasenko
6c852bfcad lineedit: add handling of \H in prompt
Based on the patch by Arnaud Rébillout <rebillout@syscom.ch>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-28 13:20:12 +01:00
Denys Vlasenko
ef6747e290 hexdump: don't unconditionally limit the usable address range
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-27 15:15:33 +01:00
Mike Frysinger
af9e70b8cb readlink: uClibc supports automatic allocation too now
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-03-12 11:14:24 -04:00
Denys Vlasenko
efd0698f74 make --help return exitcode 0. Closes 5612
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-28 12:34:18 +01:00
Shawn J. Goff
46031da862 lineedit: initialize delptr
In vi mode, the 'p' and 'P' commands caused a segfault when nothing had
been put in the buffer yet because the delptr was not initialized.

Signed-off-by: Shawn J. Goff <shawn7400@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-27 18:30:05 +01:00
Denys Vlasenko
1961aea305 move endofname() to libbb
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-26 00:36:53 +01:00
Denys Vlasenko
272d85cc85 vasprintf: return -1 on strdup failure
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-10 23:03:38 +01:00
Denys Vlasenko
b5fc51198b vasprintf: do not use xmalloc, it will deadlock on OOM
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-07 16:06:54 +01:00
Denys Vlasenko
2cfcc9e9d7 sha3: code shrink
function                                             old     new   delta
sha3_hash                                            155     101     -54

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-20 00:38:09 +01:00
Denys Vlasenko
5d78355d5a code shrink
function                                             old     new   delta
applet_name_compare                                   36      31      -5
find_applet_by_name                                   43      25     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-17 11:02:43 +01:00
Denys Vlasenko
e4f0f26bad sha3: s/sha3_process_block76/sha3_process_block72/
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-16 12:23:23 +01:00
Denys Vlasenko
5368fe541c sha3: rename KeccakF->sha3_process_block76.
This brings the naming more in line with other hashes.
Pulled most statics and constants into it.
Also noticed that two byte arrays are 1 element too big.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-16 02:20:31 +01:00
Denys Vlasenko
970aa6b5bd sha3: cache ctx->bytes_queued
function                                             old     new   delta
sha3_hash                                            171     155     -16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 22:19:24 +01:00
Denys Vlasenko
8fb3ab528e sha3: remove two "small code" codepaths: I can't reproduce code size win on them anymore
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 22:07:48 +01:00
Denys Vlasenko
8e7312e12f sha3: tweak choice of a fast code path for 64-bit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 21:50:41 +01:00
Denys Vlasenko
5b7f50f372 sha3: cosmetic tweaks to various names, comments. No logic changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 19:52:30 +01:00
Denys Vlasenko
ac4100e103 sha3: code shrink
function                                             old     new   delta
KeccakF                                             1053    1078     +25
KeccakF_RoundConstants                               192      48    -144

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 16:27:39 +01:00
Denys Vlasenko
a55df27936 sha3: code shrink
function                                             old     new   delta
KeccakF                                             1064    1053     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 15:22:30 +01:00
Denys Vlasenko
07a54e21dd sha3: another speedup for SHA3_SMALL=0 case
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 14:47:05 +01:00
Denys Vlasenko
6830ade6aa whitespace fixes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 13:58:01 +01:00
Denys Vlasenko
30a8652fbf sha3: make size/speed optimization decision configurable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 01:12:26 +01:00
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Lauri Kasanen
b8173b603f sha3sum: new applet
function                                             old     new   delta
KeccakF                                                -     496    +496
KeccakF_RoundConstants                                 -     192    +192
sha3_hash                                              -     171    +171
sha3_end                                               -      40     +40
hash_file                                            274     299     +25
KeccakF_RotationConstants                              -      25     +25
KeccakF_PiLane                                         -      25     +25
packed_usage                                       29213   29232     +19
sha3_begin                                             -      18     +18
KeccakF_Mod5                                           -      10     +10
applet_names                                        2445    2453      +8
applet_main                                         1420    1424      +4
applet_nameofs                                       710     712      +2
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 9/7 up/down: 1049/-54)         Total: ~995 bytes

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 05:20:50 +01:00
Denys Vlasenko
fd77ea505e mark get_shell_name FAST_FUNC
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-10-03 09:42:21 +02:00
Denys Vlasenko
32711c4141 top/ps: argv0:"gdm-session-worker [pam/gdm-password]" == comm:"gdm-session-wor"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-10-02 11:31:37 +02:00
Denys Vlasenko
b2320370be lineedit: in !EDITING config, return -1 on fgets error
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-27 16:03:49 +02:00
Denys Vlasenko
c4f2d997a4 libbb: correctness/size tweaks in signal-related helpers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-27 13:20:34 +02:00
Denys Vlasenko
50157f3dec top: fix "last CPU" parsing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-06 12:43:22 +02:00
walter harms
d1d794fd48 refactor correct_password.c to avoid one if
Signed-off-by: walter harms <wharms@bfs.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-04 12:26:20 +02:00
Cliff Frey
4919565c15 lineedit: fix Alt-D when cursor==0
Signed-off-by: Cliff Frey <cliff@meraki.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-08-07 17:59:40 +02:00
Bradley M. Kuhn
0e941d5427 Simplify copyright/license notice that appears in the binary.
Existing copyright notice for binary would need to be longer to achieve
optimal accuracy.  This compromise punts to the source for full notices,
but does note the years of the copyrights and that there are many authors,
all licensing under GPLv2.

Signed-off-by: Bradley M. Kuhn <bkuhn@ebb.org>
Signed-off-by: Tony Sebro <tony@sfconservancy.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-26 13:17:06 +02:00
Pascal Bellard
70fc8c17e2 su: do not change to home dir unless -l
Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-12 13:21:02 +02:00
Denys Vlasenko
0ccae4d8b3 Add comments in keyboard escape sequences table
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-11 14:40:17 +02:00
Tias Guns
c9677ed83c libbb: add missing_syscalls.c: for now, only Android syscalls
Signed-off-by: Tias Guns <tias@ulyssis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-10 14:40:30 +02:00
Natanael Copa
02112d8ae3 unzip: ignore chmod errors
This makes unzip to FAT filesystems not exit with error.
This is similar to how the "normal" unzip works.

Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-28 01:29:15 +02:00
Denys Vlasenko
02b8b9b014 busybox: tweak help text and copyright year
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-14 23:52:57 +02:00
Simon B
44642d1ec1 ln: support -T and -v
function                                             old     new   delta
ln_main                                              445     524     +79
packed_usage                                       29182   29179      -3

Signed-off-by: Simon B <sburnet@hotmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-06 13:18:35 +02:00
Andreas Oberritter
556ac3633c get_linux_version_code: don't fail on Linux version strints like "3.0-foo"
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-05 17:47:23 +02:00
Ron Yorston
576b1d3c41 sendmail: use host rather than NIS domain name for HELO
According to RFC 5321 the argument to HELO "contains the fully-qualified
domain name of the SMTP client" or its IP address if no FQDN is available.
BusyBox sendmail uses the NIS domain name instead which, in many cases,
is likely to be the default "(none)". [vda: yes, I checked my machine
and its uts.domainname was indeed "(none)"]

Using the host name is more likely to satisfy the intent of the RFC while
allowing the otherwise unused safe_getdomainname function to be removed.

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-28 17:04:19 +02:00
Dennis Groenen
deee356a62 lineedit: histfile can get emptied when CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y
When CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is set to y, the histfile
will get cleared if the total amount of history lines is less than MAX_HISTORY.
Only if the histfile is not empty _and_ the amount of lines currently
in memory are equal to or greater than MAX_HISTORY, history saving will
work as expected with this feature enabled.

Output from defconfig + CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y:
$ echo "foo" > ~/.ash_history
$ ./busybox ash
~/busybox/a $ echo "bar" > /dev/null
~/busybox/a $ exit
$ cat ~/.ash_history
$

Output with the patch applied and same config as above:
$ echo "foo" > ~/.ash_history
$ ./busybox ash
~/busybox/b $ echo "bar" > /dev/null
~/busybox/b $ exit
$ cat ~/.ash_history
foo
echo "bar" > /dev/null
exit
$

Signed-off-by: Dennis Groenen <tj.groenen at gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-26 11:19:38 +02:00
Denys Vlasenko
56443cdbdd whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-20 15:07:22 +02:00
Denys Vlasenko
8cab66730a fix build breakage found by randconfig
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-20 14:48:00 +02:00
Denys Vlasenko
ba88826c66 busybox: tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-22 11:15:06 +01:00
Denys Vlasenko
0687a5b496 libbb: make xchroot do a chdir("/") after chroot
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-08 00:28:24 +01:00
Denys Vlasenko
59655077c5 preparatory cleanups for seamless uncompression improvements
unpack_gz_stream_with_info: fix buggy error check
man: fix possible accesses past the end of a string
move seamless uncompression helpers from read_printf.c to open_transformer.c

function                                             old     new   delta
show_manpage                                         153     212     +59
unpack_gz_stream_with_info                           520     539     +19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-06 16:23:50 +01:00
Denys Vlasenko
62c006d508 libbb/procps.c: make fast_strtoul_10() stop on '\n' too
This time for real :)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-28 11:16:21 +01:00
Denys Vlasenko
0b170e6a09 libbb/procps.c: make fast_strtoul_10() stop on '\n' too
This is needed for parsing /proc data on linux 2.4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-28 03:36:49 +01:00
Jonh Wendell
9106107a50 Make unix (local) sockets work without IPv6 enabled
The xsocket_type() function had an optional "family" argument
that was enabled only if IPv6 is enabled. In the case of the
function was called with a valid AF_UNIX argument, and IPv6 is
disabled, this argument was silently ignored.

This patch makes the "family" argument mandatory, while keeping
the old behavior i.e., if AF_UNSPEC is passed, we try first IPv6
(if it's enabled) and fallback to IPv4.

Also I changed all callers of xsocket_type() to reflect its new
interface.

Signed-off-by: Jonh Wendell <jonh.wendell@vexcorp.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-09 15:14:33 +01:00
Denys Vlasenko
9ec3cd400a tweak comment, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-02 11:29:43 +01:00
Javier Viguera
ce4f39ac7c find_mount_point: fix find_mount_point for char devices
This allows to find mount points of 'char' devices such as UBI volumes
which otherwise fail for example with 'df' command:

/ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root             72091984  12360980  56068924  18% /
devtmpfs                115236         4    115232   0% /dev
tmpfs                    28672        32     28640   0% /tmp
/dev/ubi0_0             360268     18348    341920   5% /tmp/mnt/userfs

/ # df /dev/ubi0_0
Filesystem           1K-blocks      Used Available Use% Mounted on
devtmpfs                115236         4    115232   0% /dev

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-18 01:49:11 +01:00
Denys Vlasenko
7ce209b9d4 shell_builtin_read: set cc[VMIN] to 1; lineedit: don't clear c_cc[VINTR]
First change fixes "read -n NUM". Apparently poll() won't report
data availability if cc[VMIN] > 1 until there are at least cc[VMIN] bytes.

function                                             old     new   delta
read_line_input                                     3885    3877      -8
shell_builtin_read                                  1097    1087     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18)             Total: -18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-15 22:58:06 +01:00
Denys Vlasenko
499597d6ef mdev: do not treat non-leading '#' chars as start of comment. Closes 4676
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-11 00:37:17 +01:00
Denys Vlasenko
ba65872950 libbb/bb_strtonum: always set end ptr, even on error return
function                                             old     new   delta
handle_errors                                         69      61      -8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-22 13:00:32 +01:00
Denys Vlasenko
f282c6b657 libbb: remove is_directory's argument which is always NULL
function                                             old     new   delta
send_cgi_and_exit                                    892     890      -2
ln_main                                              447     445      -2
handle_incoming_and_exit                            2784    2780      -4
is_directory                                          66      59      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/6 up/down: 2/-19)             Total: -15 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-18 03:27:46 +01:00
Denys Vlasenko
a0bef7cc27 hexdump: fix hexdump -n1 -ve '8/2 ""' SEGV. Closes 4478
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-18 02:47:35 +01:00
Peter Korsgaard
743edac6c8 bb_daemonize_or_rexec(): add flag to double-fork; use it in start-stop-daemon
Add a DAEMON_DOUBLE_FORK flag to make bb_daemonize double-fork so it isn't a
session leader, and hence doesn't get a controlling tty on Linux if a tty is
ever opened, similar to how libdaemon's daemon_fork or the big
start-stop-daemon does it - And use it in start-stop-daemon.

For details, see http://www.win.tue.nl/~aeb/linux/lk/lk-10.html#ss10.3

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-09 19:44:37 +01:00
Denys Vlasenko
c0cae52662 lineedit: fix build failure
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-04 01:09:09 +01:00
Denys Vlasenko
9ce09bc9cb lineedit: add support for M-b, M-f, M-d, M-Backspace
function                                             old     new   delta
ctrl_left                                              -      96     +96
ctrl_right                                             -      76     +76
static.esccmds                                        81      93     +12
read_line_input                                     3876    3885      +9
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 193/0)             Total: 193 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-03 13:28:22 +01:00
Denys Vlasenko
e6094d95b5 libbb: shrink base64 decoding a bit
function                                             old     new   delta
bb_uuenc_tbl_base64                                   67      66      -1
decode_base64                                        182     161     -21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-28 16:15:00 +02:00
Denys Vlasenko
73d249e704 whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-28 14:07:44 +02:00
Leonid Lisovskiy
328f27fe44 libbb: split decode_base64 off read_base64
function                                             old     new   delta
decode_base64                                          -     182    +182
read_base64                                          378     255    -123
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 182/-123)           Total: 59 bytes

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-28 13:59:55 +02:00
Denys Vlasenko
ec447c7f01 libbb.h: remove unused defines
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-24 04:06:18 +02:00
Denys Vlasenko
7449e18190 getty,login: tighten up handling of ctty, pgrp, and tty attr restoring on timeout
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-22 06:27:41 +02:00
Denys Vlasenko
d184a728cf rename archive.h to bb_archive.h. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-22 12:45:14 +02:00
Bernhard Reutner-Fischer
74b871febb Config: fix wording in help-text
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-09-13 14:59:06 +02:00
Denys Vlasenko
13e709c53f losetup: implement -r option. Closes 4033.
function                                             old     new   delta
packed_usage                                       28595   28633     +38
losetup_main                                         285     290      +5
singlemount                                          906     908      +2
set_loop                                             674     672      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-12 08:30:16 +02:00
Denys Vlasenko
dd1061b6a7 wget: URL-decode user:password before base64-encoding it into auth hdr. Closes 3625.
function                                             old     new   delta
percent_decode_in_place                                -     152    +152
parse_url                                            304     317     +13
handle_incoming_and_exit                            2795    2798      +3
httpd_main                                           763     760      -3
decodeString                                         152       -    -152
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 2/1 up/down: 168/-155)           Total: 13 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-11 21:04:02 +02:00
Denys Vlasenko
522041ee7b regularize options which control size/speed trade
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-10 13:25:57 +02:00
Denys Vlasenko
0d0260fd1e inet_cksum: big-endian fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-08 10:59:26 +02:00
Denys Vlasenko
9289935cfd Fix compile breakage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-07 22:19:46 +02:00
Baruch Siach
e8f36330d9 networking: consolidate the IP checksum code. -129 bytes.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-07 17:55:40 +02:00
Denys Vlasenko
e45af7ad17 lineedit: remove SAVE_HISTORY bit, ->hist_file can be used as indicator
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 16:15:24 +02:00
Denys Vlasenko
bede215cf1 lineedit: add support for history saving on exit
Based on the patch by Dennis Groenen <tj.groenen@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 16:12:33 +02:00
Denys Vlasenko
4840ae8a06 lineedit: fix atomic replace of history file; hush: fix $HISTFILE handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 15:28:03 +02:00
Denys Vlasenko
2390109dcb top: fix CPU% for thread display. Closes 4081
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-28 11:57:36 +02:00
Denys Vlasenko
24915117a2 Fixes for warnings in FreeBSD build
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-28 05:31:49 +02:00
Matthias Andree
1285437217 Fixes for FreeBSD build
Signed-off-by: Matthias Andree <mandree@freebsd.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-28 05:05:02 +02:00
Denys Vlasenko
d84b175cb6 Bump version to 1.19.0, update copyright year in help message
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-13 08:46:00 +02:00
Denys Vlasenko
b47b3ce1bd randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-10 00:51:29 +02:00
Denys Vlasenko
7485086f1e die_if_bad_username: tighten up a bit
function                                             old     new   delta
die_if_bad_username                                   77      97     +20

Based on patches from Tito.
The changes are:
better comments
we disallow '@' now - in practice such usernames will be unusable
use of the portable filename character set plus '$'
don't use isalnum as it allows non-ASCII letters in legacy 8-bit locales (pointed out by Rich Felker)
enforce maximum length of LOGIN_NAME_MAX (including NUL)
don't allow '$', '.', and '-' as first char
don't print the illegal char in error message as if it is a wide char it will be unreadable
print the position of the illegal character

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-09 04:05:13 +02:00
Denys Vlasenko
4e552a70ec less: optionally query terminal size via "ESC [ 6 n". Closes bug 2659.
+7 bytes is not selected, +100 if selected.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-25 15:18:20 +02:00
Denys Vlasenko
a669eca3a2 libbb/lineedit: implement optional Ctrl-R history search
function                                             old     new   delta
read_line_input                                     3433    3957    +524
load_string                                           77      90     +13
input_tab                                           1086    1069     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 537/-17)           Total: 520 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-11 07:36:59 +02:00
Denys Vlasenko
8f6ce094dc a few tweaks for bionic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08 08:34:28 +02:00
Denys Vlasenko
4dc35fb5b6 platform.h: tweaks for cygwin
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08 04:41:38 +02:00
Timo Teras
0a5b310067 platform.c: provide getline implementation
Signed-off-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-29 02:19:58 +02:00
Timo Teras
adcabf3235 parse_config: use getline. BIG speedup with glibc (~40%).
function                                             old     new   delta
config_read                                          559     604     +45
getline                                                -      23     +23
config_close                                          29      49     +20
find_pair                                            169     187     +18
showmode                                             330     338      +8
hash_find                                            233     234      +1
builtin_umask                                        133     132      -1
lzo1x_optimize                                      1434    1429      -5
test_main                                            253     247      -6
buffer_fill_and_print                                196     179     -17
create_J                                            1849    1826     -23
config_free_data                                      37       -     -37
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 5/5 up/down: 138/-89)            Total: 26 bytes

Signed-off-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-20 09:49:56 +02:00
Denys Vlasenko
5331e382f7 libbb/read_cmdline: prepend {comm} if different from argv0. Closes 3835.
function                                             old     new   delta
read_cmdline                                         114     233    +119

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-18 15:51:16 +02:00
Denys Vlasenko
12ac6287ee procps: remove PSSCAN_STAT define, users were using it incorrectly
Also contains small cleanups ps.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-18 15:49:47 +02:00
Denys Vlasenko
3a649363aa parse_config: make test applet easier to enable; fix its code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-18 09:23:09 +02:00
Denys Vlasenko
a1a448347e libbb: split bb_get_chunk_from_file and bb_get_chunk_with_continuation
This also moves bb_get_chunk_with_continuation into its sole user,
parse_config.c.
This allows to optimize both functions separately,
they need to be optimized for speed.
(this need was highlighted by slow modprobe caused in part by slow
bb_get_chunk_with_continuation in config parser).

function                                             old     new   delta
bb_get_chunk_from_file                                 7     130    +123
config_read                                          457     558    +101
bb_get_chunk_with_continuation                       194       -    -194
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/0 up/down: 224/-194)           Total: 30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-17 03:37:43 +02:00
Denys Vlasenko
fe86d6b636 appletlib.c: do not use PAGE_SIZE for malloc tweaking
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-03 21:39:42 +02:00
Dan Fandrich
2f5769151f only compile obscure.c when needed
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-03 20:28:14 +02:00
Denys Vlasenko
488dd70869 fix !ENABLE_FEATURE_GETOPT_LONG build. Closes 3775
When compiling with !ENABLE_FEATURE_GETOPT_LONG, busybox still tries
to include getopt.h which is not available; for example with uClibc
when !UCLIBC_HAS_GETOPT_LONG.  getopt.h is only required
for the _long set of functions.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-29 04:24:52 +02:00
Denys Vlasenko
b24ef035bd find: cater for libc w/o FNM_CASEFOLD
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-23 00:40:54 +02:00
Alexey Fomenko
232ebaa568 lineedit: fix rare SEGV; mark a few FIXMEs
Signed-off-by: Alexey Fomenko <ext-alexey.fomenko@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-20 04:26:29 +02:00
Cristian Ionescu-Idbohrn
ea137aa931 warning removal
Signed-off-by: Cristian Ionescu-Idbohrn <cii@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-20 03:52:36 +02:00
Denys Vlasenko
351fec332a busybox.conf: code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-16 14:30:26 +02:00
Denys Vlasenko
d83aff1aed busybox.conf: USER.GROUP is _optional_
function                                             old     new   delta
main                                                 785     809     +24

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-16 13:53:19 +02:00
Denys Vlasenko
3770b6b061 main: make busybox.conf mode handling less obscure
function                                             old     new   delta
static.mode_mask                                       -      20     +20
main                                                 782     785      +3
static.mode_chars                                     15      13      -2
run_applet_no_and_exit                               450     441      -9
mode_mask                                             24       -     -24
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/2 up/down: 41/-53)            Total: -12 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-16 13:19:25 +02:00
Denys Vlasenko
9be4702a30 main: free suid_config list after use
function                                             old     new   delta
run_applet_no_and_exit                               438     450     +12
ifupdown_main                                       2147    2149      +2
writeFileToTarball                                  1325    1326      +1
pidof_main                                           244     245      +1
last_main                                            896     897      +1
grep_main                                            779     780      +1
find_list_entry2                                     121     122      +1
tar_main                                             835     833      -2
llist_unlink                                          28      26      -2
llist_rev                                             23      21      -2
main                                                 791     782      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/4 up/down: 19/-15)              Total: 4 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-16 12:21:31 +02:00
Denys Vlasenko
4566e172eb simplify parsing of /etc/busybox.conf
function                                             old     new   delta
parse_config_file                                    799     667    -132

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-16 00:01:08 +02:00
Denys Vlasenko
60a9414cad fix "variable 'foo' set but not used" warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13 20:57:01 +02:00
Denys Vlasenko
12a432715f adduser: safe username passing to passwd/addgroup
passwd: support creating SHA passwords
random code shrink

function                                             old     new   delta
crypt_make_pw_salt                                     -      87     +87
adduser_main                                         883     904     +21
...
crypt_make_salt                                       99      89     -10
chpasswd_main                                        329     312     -17
packed_usage                                       28731   28691     -40
passwd_main                                         1070    1000     -70
cryptpw_main                                         310     224     -86
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/12 up/down: 154/-288)        Total: -134 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13 03:19:01 +02:00
Denys Vlasenko
80542bad2f hush: make read builtin interruptible.
function                                             old     new   delta
builtin_read                                         185     471    +286
check_and_run_traps                                  200     262     +62
nonblock_immune_read                                  73     119     +46
sigismember                                            -      44     +44
record_signal                                          -      21     +21
sigisemptyset                                          -      16     +16
...
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 7/5 up/down: 483/-46)           Total: 437 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:23:43 +02:00
Denys Vlasenko
80c5b6893d libbb: nonblock_safe_read->nonblock_immune_read, remove unused param of xmalloc_reads
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:21:10 +02:00
Denys Vlasenko
47061b4e9b straighten out dprintf/fdprintf mess; remove old "define lchown chown"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-17 23:14:19 +02:00
Denys Vlasenko
0288b27ad8 small fixes atop syslog config patch
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-16 20:15:14 +02:00
Marek Polacek
b0b8884009 Fix double words in comments. No code changes
Signed-off-by: Marek Polacek <mpolacek@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-16 17:33:43 +02:00
Denys Vlasenko
c13ee8c0f3 basename,dirname,freeramdisk,rx,raidautorun,runsv,chvt: skip "--" argument
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11 03:58:30 +02:00
Pere Orga
5bc8c005a8 move remaining help text from include/usage.src.h
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11 03:29:49 +02:00
Denys Vlasenko
ca18311d0a libbb: make set_nport accept pointer to sockaddr, not to len_and_sockaddr.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-07 17:52:20 +02:00
Denys Vlasenko
e3d8d077b7 small fix for HISTFILESIZE
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-31 14:39:38 +02:00
Denys Vlasenko
2c4de5b045 ash,hush: optional support for $HISTFILESIZE.
Based on patch from Alexey Fomenko (ext-alexey.fomenko AT nokia.com)

function                                             old     new   delta
size_from_HISTFILESIZE                                 -      44     +44
hush_main                                            998    1025     +27
ash_main                                            1348    1374     +26
read_line_input                                     3361    3372     +11
new_line_input_t                                      17      24      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-31 13:16:52 +02:00
Denys Vlasenko
353680aa46 lineedit: fixes for CONFIG_UNICODE_USING_LOCALE=y
function                                             old     new   delta
load_string                                           45      91     +46
save_string                                           40      82     +42
reinit_unicode                                        34      61     +27
BB_PUTCHAR                                            97     120     +23
init_unicode                                          17      37     +20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 158/0)             Total: 158 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-27 01:18:07 +01:00
Denys Vlasenko
20704f0662 ash,hush: recheck LANG before every line input
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-23 17:59:27 +01:00
Vitaly Magerya
7f4b769c42 don't call freeaddinfo(NULL)
Signed-off-by: Vitaly Magerya <vmagerya@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-22 20:14:26 +01:00
Denys Vlasenko
5c942713b7 busybox: fail if --install is not given an absolute path
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-12 06:08:28 +01:00
Denys Vlasenko
8345b2bd5e libbb: make warning go away
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-12 02:19:50 +01:00
Denys Vlasenko
f8416dc6f6 forgot to add libbb/get_shell_name.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-08 21:02:42 +01:00
Denys Vlasenko
bd74e3d8be libbb/login/su: do not sanitize shell name twice
function                                             old     new   delta
setup_environment                                    191     205     +14
login_main                                          1002     987     -15
su_main                                              474     458     -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 14/-31)            Total: -17 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-06 18:49:40 +01:00
Denys Vlasenko
4a2a86d5e7 improve --install operation in chroot jails
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-06 06:02:31 +01:00
Alexey Fomenko
ea6116ee59 libbb: remove dead code in getopt32. -7 bytes
Signed-off-by: Alexey Fomenko <ext-alexey.fomenko@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-01 19:25:49 +01:00
Denys Vlasenko
7d65abea09 libbb: make user/group name cache strings longer (~27 chars)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-01 16:27:13 +01:00
Denys Vlasenko
e3b1a1fd28 Replace "depends on PLATFORM_LINUX" with "select PLATFORM_LINUX"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-26 22:24:08 +01:00
Dan Fandrich
dc50676cce Move stpcpy replacement function into libbb
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-13 18:37:12 +01:00
Denys Vlasenko
0b8a7723c7 typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-12 01:56:25 +01:00
Denys Vlasenko
ab8d00d64f progress meter: fix bugs found in stall detection and unknown size logic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-11 19:09:30 +01:00
Denys Vlasenko
d55e139649 progress meter: move file name to bb_progress_t. +20 bytes
We were doing expensive unicode conversion on every update

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-11 18:56:13 +01:00
Denys Vlasenko
e52e67cb51 libbb/progress.c: make sure we never get negative ETA
function                                             old     new   delta
bb_progress_update                                   738     733      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-11 12:59:11 +01:00
Denys Vlasenko
838d4bb0cd progress meter: display >999 hours ETA correctly
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-10 23:35:52 +01:00
Denys Vlasenko
f836f01cc3 wget: shrink progress meter code; strink wget and add debug logging
function                                             old     new   delta
fgets_and_trim                                         -      73     +73
retrieve_file_data                                   367     349     -18
bb_progress_update                                   723     699     -24
wget_main                                           2220    2190     -30
ftpcmd                                               133      87     -46
gethdr                                               200     153     -47
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/5 up/down: 73/-165)           Total: -92 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-10 23:02:28 +01:00
Denys Vlasenko
805aa9fec9 progress bar: better overflow protection; more precise bar
function                                             old     new   delta
bb_progress_update                                   639     749    +110

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-10 14:25:51 +01:00
Denys Vlasenko
dee0fc9da1 save 10 bytes on strings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-10 10:01:49 +01:00
Denys Vlasenko
df4e16c9af wget: use FEATURE_COPYBUF_KB-sized buffer. Much faster for local transfers
function                                             old     new   delta
base64enc                                              -      53     +53
gethdr                                               190     200     +10
ftpcmd                                               129     133      +4
progress_meter                                       160     122     -38
retrieve_file_data                                   431     392     -39
base64enc_512                                         46       -     -46
wget_main                                           2456    2220    -236
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/3 up/down: 67/-359)          Total: -292 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-10 06:29:06 +01:00
Denys Vlasenko
66c5b12dbf ash: fix TMOUT not restoring tty attributes
function                                             old     new   delta
pgetc                                                420     500     +80
readtoken1                                          3202    3239     +37
read_line_input                                     3316    3337     +21
udhcpc_main                                         2610    2630     +20
file_get                                             266     272      +6
expandarg                                            958     963      +5
localcmd                                             257     259      +2
addLines                                              85      87      +2
read_line                                             94      95      +1
ed_main                                             2540    2541      +1
timed_out                                              1       -      -1
lineedit_read_key                                    256     255      -1
alrm_sighandler                                       44       -     -44
cmdloop                                              539     434    -105
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 10/2 up/down: 175/-151)          Total: 24 bytes
   text    data     bss     dec     hex filename
 887379     936   17200  905515   dd12b busybox_old
 887411     936   17192  905539   dd143 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-08 05:07:02 +01:00
Denys Vlasenko
c5d0f15dbd libbb: spawn should remove child which failed to exec
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-03 14:14:09 +01:00
Denys Vlasenko
b7c9fb27cb whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-03 00:05:48 +01:00
Denys Vlasenko
6307357eff move nofork_save_area from libbb.h to vfork_daemon_rexec.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-02 19:05:25 +01:00
Denys Vlasenko
c71b469f5d libbb: make BB_EXECVP/LP try to exec real binary if there's no /proc/self/exe
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-02 03:28:56 +01:00
Lauri Kasanen
55ae0e9238 df,find_mount_point: optionally don't ignore rootfs
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-31 06:27:35 +01:00
Denys Vlasenko
aa4f9a2fd8 libbb/copy_file.c: use smallints instead of signed chars
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-28 19:14:17 +01:00
Denys Vlasenko
8d0e0cdadf move utmp.h include to libbb.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 23:21:46 +01:00
Davide Cavalca
9b3b9790b3 add ENABLE_FEATURE_SYSTEMD and use it in syslogd
Signed-off-by: Davide Cavalca <davide@geexbox.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 02:26:03 +01:00
Denys Vlasenko
975c714183 nicer looking ifdef in libbb/makedev.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 23:53:12 +01:00
Chris Rees
6b1ce45598 FreeBSD compat for match_fstype
Signed-off-by: Chris Rees <utisoft@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 17:10:02 +01:00
Chris Rees
e22af94afb FreeBSD compat for makedev
Signed-off-by: Chris Rees <utisoft@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 17:07:40 +01:00
Chris Rees
e3c127d846 FreeBSD compat
Signed-off-by: Chris Rees <utisoft@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 17:04:59 +01:00
Denys Vlasenko
e9a40e3b91 libbb: make ndelay_no/off a bit more clever. +14 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 00:29:55 +01:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko
10ee20b58b libbb: better comment in parse_date
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-17 14:23:42 +01:00
Denys Vlasenko
dc7e5c46b0 libbb unicode: comment out usused function and unused parameter
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-11 13:08:28 +01:00
Denys Vlasenko
0f44c08560 libbb: progress indicator: use unicode support funcs instead of open-coding it
function                                             old     new   delta
bb_progress_update                                   729     641     -88

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-10 16:10:29 +01:00
Denys Vlasenko
84dba9c5bb tftp: fix bad interaction betweel poll() and alarm(). Closes bug 3061
This was breaking timeout handling.

function                                             old     new   delta
tftp_progress_update                                   -      45     +45
tftp_progress_done                                     -      32     +32
tftp_protocol                                       1839    1858     +19
tftp_progress_init                                     9      15      +6
tftp_main                                            298     286     -12
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/1 up/down: 102/-12)            Total: 90 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-10 12:51:44 +01:00
Denys Vlasenko
f42c7b8fc1 suppress "'fast_strtol_10' defined but not used" warning
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-07 13:51:16 +01:00
Denys Vlasenko
327d2885ec kill[all[5]],pkill: make signal list show signal numbers, and show RTMIN/MAX
function                                             old     new   delta
print_signames                                        31      64     +33
signals                                              224     231      +7

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-03 13:08:58 +01:00
Denys Vlasenko
7b276fc175 kill[all[5]],pkill: more correct, and smaller, SIGRTMIN/MAX code
function                                             old     new   delta
__libc_current_sigrtmin                                6       -      -6
__libc_current_sigrtmax                                6       -      -6
get_signum                                           339     295     -44
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 0/1 up/down: 0/-56)             Total: -56 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-03 12:51:13 +01:00
Denys Vlasenko
92ffe0571a date,touch: treat 2-digit years better (fit them into +-50 yrs around today)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-02 20:02:09 +01:00
Denys Vlasenko
2753aae0e8 libbb: optionally support RTMIN[+n] and RTMAX[-n] signal names
function                                             old     new   delta
get_signum                                           140     336    +196
__libc_allocate_rtsig                                  -      56     +56
__libc_current_sigrtmin                                -       6      +6
__libc_current_sigrtmax                                -       6      +6
current_rtmin                                          -       4      +4
current_rtmax                                          -       4      +4
bbconfig_config_bz2                                 4961    4962      +1
------------------------------------------------------------------------------
(add/remove: 6/0 grow/shrink: 2/0 up/down: 273/0)             Total: 273 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-30 01:17:03 +01:00
Denys Vlasenko
2272129a93 plug a DIR* leak on error path
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-28 10:25:03 +01:00
Lauri Kasanen
6578f2cf5b pstree: new applet. +1664 bytes
text    data     bss     dec     hex filename
 883379     936   17192  901507   dc183 busybox_old
 885043     936   17192  903171   dc803 busybox_unstripped

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-05 05:22:29 +01:00
Denys Vlasenko
a04440ccad typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-05 05:02:49 +01:00
Denys Vlasenko
8da415ef25 add if guards around include <malloc.h>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-05 01:30:14 +01:00
Denys Vlasenko
5dcc6606cb libbb/pw_encrypt_sha: forgot to move &ctx to 1st param here in sha hash rework
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-12-01 13:57:25 +01:00
Denys Vlasenko
0ab45da929 exclude the case of just "busybox" from previous commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-29 03:21:55 +01:00
Denys Vlasenko
8f0af3b001 if only one applet is enabled, make "busybox applet [params]" work as expected
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-29 02:55:35 +01:00
Denys Vlasenko
26777aa1c6 fixes for bugs discovered by randomconfig builds and tests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-22 23:49:10 +01:00
Denys Vlasenko
29ca159133 fix misspelling in comment
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-11-22 18:13:15 +01:00
Mike Shal
f3763033e4 lineedit: fix tab-completion of filenames with spaces
Using ash in busybox git version dea28e1e, tab completion doesn't seem
to work properly for filenames that have special characters (such as
spaces) in them. For example, with filenames "foo bar" and "foo zap",
typing "ls fo<TAB>" correctly expands to "ls foo\ ", but then
continuing to type "b<TAB>" will produce "ls foo\ bbar", which is not
correct (the 'b' is duplicated).

Signed-off-by: Mike Shal <marfey@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-22 03:49:18 +01:00
Wolfram Sang
2e9aeae4db lineedit: create history files with mode 0600
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-15 02:58:28 +01:00
Lauri Kasanen
2b662c5dec libbb: remove unused variable
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-13 23:16:05 +01:00
Denys Vlasenko
854738d39d type fix in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-03 02:48:43 +01:00
Denys Vlasenko
833d4e7f84 rename archival/libunarchive -> archival/libarchive; move bz/ into it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-03 02:38:31 +01:00
Denys Vlasenko
fb132e4737 whitespace cleanup
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Denys Vlasenko
6b3f0b0dab unicode: update unicode_width on !unicode branch too. Closes bug 2593
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-29 00:50:09 +02:00
Denys Vlasenko
caddfc8339 decompress_bunzip2: handle concatenated .bz2 files
function                                             old     new   delta
unpack_bz2_stream                                    207     307    +100
start_bunzip                                         199     209     +10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 110/0)             Total: 110 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 23:08:53 +02:00
Marek Polacek
7b18107384 *: use _exit() in sighandlers; showkey: do not use exit-thru-sighandler
While at it, make ESC sequences more readable; and removed check for
isatty(stdin) in reset. Code shrink:

   text    data     bss     dec     hex filename
 884771     936   17216  902923   dc70b busybox_old
 884723     936   17216  902875   dc6db busybox_unstripped

Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 21:34:56 +02:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
16cc80e989 crc32: cleanups, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 05:38:11 +02:00
Denys Vlasenko
9ce642f974 libbb: introduce and use common crc32 routine
function                                             old     new   delta
crc32_block_endian1                                    -      37     +37
crc32_block_endian0                                    -      34     +34
global_crc32_table                                     -       8      +8
file_read                                             82      87      +5
gzip_main                                            211     214      +3
xz_crc32                                              40      35      -5
crc32_table                                            8       -      -8
calculate_gunzip_crc                                  54      34     -20
lzo_crc32                                             54      25     -29
cksum_main                                           298     211     -87
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/4 up/down: 87/-149)           Total: -62 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-27 15:26:45 +02:00
Denys Vlasenko
a2d27a1919 libbb/process_escape_sequence.c: fix recently broken handling of \\
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-25 12:14:21 +02:00
Marek Polacek
b507cc3ace powertop: new applet
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-25 03:44:34 +02:00
Kevin Cernekee
ccb070450e fdisk: initial stab at GPT partition support
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-25 02:00:24 +02:00
Denys Vlasenko
03a5fe378e sha1: small tweak for clearer code, no logic changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 20:51:28 +02:00
Denys Vlasenko
f4c93ab304 sha1: use Rob's code, it's smaller and faster
function                                             old     new   delta
static.rconsts                                         -      16     +16
sha1_process_block64                                 460     298    -162
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 16/-162)          Total: -146 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 19:27:30 +02:00
Denys Vlasenko
2b299fed6a awk: fix breakage in last commit
While at it, made bb_process_escape_sequence faster (same size)

function                                             old     new   delta
nextchar                                              49      53      +4
bb_process_escape_sequence                           138     140      +2
next_token                                           838     839      +1
static.charmap                                        20      18      -2
is_assignment                                        143     135      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 7/-10)              Total: -3 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 01:58:04 +02:00
Denys Vlasenko
5360059131 libbb: introduce and use strcpy_and_process_escape_sequences
function                                             old     new   delta
strcpy_and_process_escape_sequences                    -      50     +50
bb_process_escape_sequence                           148     138     -10
printf_main                                          789     776     -13
getty_main                                          1897    1831     -66
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 50/-89)            Total: -39 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-23 21:06:06 +02:00
Alexander Shishkin
6722737ece *: introduce and use xmkstemp. -65 bytes.
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-22 13:27:16 +02:00
Denys Vlasenko
0016bcee37 klogd: do not log partial lines
function                                             old     new   delta
overlapping_strcpy                                    15      18      +3
klogd_main                                           438     436      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-19 23:07:49 +02:00
Denys Vlasenko
7ab94ca351 md5: remove outdated comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-19 02:33:39 +02:00
Denys Vlasenko
302ad1450e libbb/hash_md5_sha: use common ctx and code for md5 and sha1/256
function                                             old     new   delta
sha256_process_block64                               421     433     +12
md5_crypt                                            578     587      +9
md5_begin                                             43      50      +7
md5_hash                                              99      97      -2
sha1_end                                              85      82      -3
md5_end                                               36      31      -5
common64_end                                          93      86      -7
sha1_hash                                             97       -     -97

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-19 02:16:12 +02:00
Denys Vlasenko
c48a5c607d hash_md5_sha: use common finalization routine for MD5 and sha1/256. -15 bytes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 14:48:30 +02:00
Denys Vlasenko
b5aa1d95a1 libbb/hash_sha.c -> libbb/hash_md5_sha.c
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 13:47:47 +02:00
Denys Vlasenko
eb7fe6dbf5 libbb: move md5 and shaN into a common source file. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 13:46:07 +02:00
Denys Vlasenko
e08ef581af md5: length should be stored in *little-endian* order! fixing...
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 11:50:17 +02:00
Denys Vlasenko
9ff50b8697 *: deinline SWAP_xE64 on 32-bit CPUs. Wins !90 bytes both on 32 and 64 bits
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 11:40:26 +02:00
Denys Vlasenko
b102e12253 *: use SWAP_BE64 instead of open-coding it
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 11:39:47 +02:00
Denys Vlasenko
06f719fd79 libbb: rename hash source files. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 10:38:18 +02:00
Denys Vlasenko
c05387d5de *: replace xopen3 with xopen where makes sense
function                                             old     new   delta
uniq_main                                            421     416      -5
sort_main                                            803     798      -5
patch_main                                          2051    2046      -5
cpio_main                                            547     542      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-18 02:38:27 +02:00
Denys Vlasenko
b8d02597e3 md5: fix biuld failure on big-endian machines
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-17 23:01:32 +02:00
Denys Vlasenko
cfe114c4f3 md5: code shrink -5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-17 11:38:44 +02:00
Denys Vlasenko
f6dacc23ff bring md5 and sha1 names closer. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-17 03:21:51 +02:00
Denys Vlasenko
36ab585f68 md5: code shrink
function                                             old     new   delta
md5_end                                              125     104     -21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-17 03:00:36 +02:00
Denys Vlasenko
a971a192e8 shaN: code shrink
function                                             old     new   delta
init512_lo                                            32      40      +8
init256                                               32      40      +8
sha256_begin                                          42      28     -14
sha512_begin                                          81      53     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 16/-42)            Total: -26 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-17 01:35:16 +02:00
Denys Vlasenko
446c2349b6 whitespace fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-16 23:39:43 +02:00
Denys Vlasenko
4bc3b85894 sha512: inline rotr64
function                                             old     new   delta
sha1_process_block64                                 461     446     -15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-16 23:31:15 +02:00
Denys Vlasenko
273abcbf66 shaN: small code shrink
function                                             old     new   delta
sha512_hash                                          134     128      -6
sha1_hash                                            114     106      -8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-16 22:43:34 +02:00
Denys Vlasenko
1ac476bb85 md5: fix "fast" md5 broken by prev commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-16 21:34:36 +02:00
Denys Vlasenko
bcccad3531 md5: code shrink; and use 64-byte temp buf, not 128-byte.
function                                             old     new   delta
md5_hash                                             111     108      -3
md5_end                                              129     125      -4
md5_hash_block                                       459     454      -5
filter_rename_config                                 250     244      -6
md5_crypt                                            587     578      -9
popmaildir_main                                      828     816     -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-39)             Total: -39 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-16 20:46:35 +02:00
Denys Vlasenko
c0683acce8 *: pass md5/shaN context pointer as 1st arg, not last
function                                             old     new   delta
md5_hash_block                                       458     459      +1
filter_rename_config                                 252     250      -2
md5_crypt                                            591     587      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-16 20:45:27 +02:00
Denys Vlasenko
70186711f4 libbb/md5: code shrink
function                                             old     new   delta
md5_end                                              123     117      -6
md5_begin                                             49      42      -7
md5_hash                                             119     104     -15

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-16 01:08:32 +02:00
Denys Vlasenko
3d16098494 libbb/md5: small code shrink
function                                             old     new   delta
md5_end                                              151     123     -28

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-15 18:05:51 +02:00
Denys Vlasenko
d4d289acf5 tweaks to build system, mainly making menuconfig text and order clearer
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-12 04:18:05 +02:00
Dan Fandrich
63adf83814 fix build failure for pmap
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-19 17:13:21 +02:00
Denys Vlasenko
c8f9a8d3c0 move read_base64 to libbb/uuencode.c
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-16 18:10:04 +02:00
Denys Vlasenko
9fe98f701d libbb: merge mail and uudecode's base64 decoders
function                                             old     new   delta
read_base64                                            -     378    +378
uudecode_main                                        306     315      +9
parse                                                953     958      +5
read_stduu                                           250     254      +4
base64_main                                          217     219      +2
read_base64                                          358       -    -358
decode_base64                                        371       -    -371
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 4/0 up/down: 398/-729)         Total: -331 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-16 17:51:13 +02:00
Denys Vlasenko
99862cbfad hush: optional support for history saving
function                                             old     new   delta
hush_main                                            945     995     +50

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 17:34:13 +02:00
Denys Vlasenko
819cacfd45 busybox: add "busybox --list[-full]" to help text
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 16:17:37 +02:00
Denys Vlasenko
d55f599440 lineedit: do not hang on error, but return error indicator.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 18:40:53 +02:00
Denys Vlasenko
3926363214 lineedit: on tab completion, show filenames obly in all cases (bash compat)
function                                             old     new   delta
complete_cmd_dir_file                                731     730      -1

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 14:11:08 +02:00
Denys Vlasenko
76939e7b72 lineedit: allocate matchBuf only temporarily: saves MAX_LINELEN bytes
function                                             old     new   delta
input_tab                                           1027    1041     +14
build_match_prefix                                   590     562     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-28)            Total: -14 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 14:09:24 +02:00
Denys Vlasenko
ba0e103a66 lineedit: de-indent large block in input_tab. No logic changes.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 14:08:24 +02:00
Denys Vlasenko
a46e16ef52 lineedit: rename tmp -> chosen_match; small code shrink
function                                             old     new   delta
input_tab                                           1016    1012      -4

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 13:05:51 +02:00
Denys Vlasenko
9b56bf5416 lineedit: stop using permanent int_buf[] (16k!): allocate it
Now it is allocated temporarily only for the duretion of prefix generation,
and also we only allocate the needed size, not maximally possible.

function                                             old     new   delta
build_match_prefix                                   579     590     +11
remove_chunk                                          43      28     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 11/-15)             Total: -4 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 13:02:47 +02:00
Denys Vlasenko
81254ed387 lineedit: remove pos_buf[] array (up to 16k!); fix compat bugs
pos_buf is a strange hack, easy to do without it.
This also allows lines >32k long to be handled.
Also simplified match prefix generations and made behavior more like bash.

function                                             old     new   delta
remove_chunk                                           -      43     +43
collapse_pos                                          79       -     -79
build_match_prefix                                   804     579    -225
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 43/-304)          Total: -261 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 12:59:15 +02:00
Denys Vlasenko
3c460b005c lineedit: return prefix len from tab completion helpers
This kills horrific logic which deletes and re-adds prefix (!)

function                                             old     new   delta
complete_cmd_dir_file                                705     731     +26
complete_username                                    121     124      +3
input_tab                                           1041    1016     -25
build_match_prefix                                   838     804     -34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 29/-59)            Total: -30 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 12:56:36 +02:00
Denys Vlasenko
2679e3c8cc lineedit: clean up tab completion code (variable reuse, comments)
Noted bugs in behavior.
Added debugging machinery.
Decoupled variables reused for unrelated purposes: apparently,
when not forced to use liveness analysis, gcc fares better.

function                                             old     new   delta
complete_cmd_dir_file                                699     705      +6
collapse_pos                                          75      79      +4
build_match_prefix                                   892     838     -54
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 10/-54)            Total: -44 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 12:53:15 +02:00
Denys Vlasenko
57ea9b488b preparatory cleanup patch for tab completion fixes
renames and deinlines a few functions

function                                             old     new   delta
input_tab                                              -    1041   +1041
complete_cmd_dir_file                                  -     699    +699
complete_username                                      -     121    +121
username_completion                                  121       -    -121
read_line_input                                     5002    3313   -1689
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/1 up/down: 1861/-1810)         Total: 51 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 12:51:36 +02:00
Denys Vlasenko
7063e86d0d lineedit: small readability improvement (same code)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-02 12:44:39 +02:00
Denys Vlasenko
61a36af45d lineedit: fix completion with Unicode chars
function                                             old     new   delta
read_line_input                                     4966    5002     +36
bb_wcstombs                                          170     159     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 36/-11)             Total: 25 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-02 12:03:11 +02:00
Denys Vlasenko
b068bd7a41 lineedit: preparatory cleanup patch for Unicode completion fix
Some logic changes and function renames. The fix will follow this patch,
to mkae it distinct from cleanup.

function                                             old     new   delta
build_match_prefix                                     -     892    +892
username_completion                                    -     121    +121
read_line_input                                     4902    4966     +64
username_tab_completion                              235       -    -235
find_match                                           892       -    -892
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/0 up/down: 1077/-1127)        Total: -50 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-02 12:01:11 +02:00
Denys Vlasenko
7aa63042d0 libbb: xfunc_error_retval can be a byte
function                                             old     new   delta
xfunc_die                                             55      60      +5
log_and_exit                                          43      45      +2
hush_main                                            961     963      +2
xfunc_error_retval                                     4       1      -3
tty_main                                              87      84      -3
sv_main                                             1183    1180      -3
sort_main                                            804     801      -3
run_applet_no_and_exit                               440     437      -3
puts_maybe_newline                                   198     195      -3
nohup_main                                           228     225      -3
httpd_main                                           753     750      -3
get_header_tar                                      1496    1493      -3
fsck_minix_main                                     2972    2969      -3
expr_main                                            110     107      -3
cmp_main                                             641     638      -3
chat_main                                           1359    1356      -3
builtin_exit                                          48      45      -3
arping_main                                         1587    1584      -3
BB_EXECVP_or_die                                      47      44      -3
send_cgi_and_exit                                    901     895      -6
diff_main                                           1197    1191      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/18 up/down: 9/-60)            Total: -51 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-01 16:04:24 +02:00
Denys Vlasenko
0004e99493 better shared strings trick
text	   data	    bss	    dec	    hex	filename
 861980	    441	   7540	 869961	  d4649	busybox_old
 861914	    441	   7540	 869895	  d4607	busybox_unstripped

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-01 12:01:17 +02:00
Denys Vlasenko
8d3e225a2d libbb: add xfstat function
function                                             old     new   delta
xfstat                                                 -      25     +25
mkfs_ext2_main                                      2421    2423      +2
mkfs_reiser_main                                    1197    1194      -3
next                                                 312     307      -5
ar_main                                              533     522     -11
mkfs_minix_main                                     2938    2924     -14
mkfs_vfat_main                                      1511    1495     -16
writeTarFile                                         272     255     -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 27/-66)            Total: -39 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-31 12:42:06 +02:00
Alexander Shishkin
0834a6d3b9 pmap: new applet. +1k.
pmap is a tool used to look at processes' memory maps, normally found
in procps package. It provides more readable and easily sortable output
(one line per mapping) from  maps/smaps files in /proc/PID/.  This would
help in debugging memory usage issues, especially on devices where lots
of typing is not a viable option.

This patch does'n implement -d and -A command line options of GNU pmap,
since those are not that must have features and I was afraid of going
blind from looking at its code.

The implementation takes smaps scanning part out of procps_scan() function
and moves it into procps_read_smaps(), which does more detailed processing
of a single PID's smaps data.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-28 23:20:34 +02:00
Denys Vlasenko
e7b0a9e5bc patch: support "patch [FILE [PATCH]]" format
function                                             old     new   delta
xopen_stdin                                            -      15     +15
patch_main                                          2075    2041     -34

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-22 05:39:15 +02:00
Denys Vlasenko
fd27fa8309 libbb: fix fallout from last patch to obscure() (my mistake). +143 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-17 17:21:36 +02:00
Bob Dunlop
d71c770f05 libbb: shrink obscure()
function                                             old     new   delta
string_checker_helper                                 59      45     -14
string_checker                                       116      98     -18
obscure                                              367     204    -163
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-195)           Total: -195 bytes

Signed-off-by: Bob Dunlop <bob.dunlop@xyzzy.org.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-17 16:01:16 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
9768a82eb0 *: fix "see file License ..." - the file is named LICENSE (in uppercase)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 03:04:14 +02:00
Denys Vlasenko
c9b9750a0e libbb: factor out common code from mpstat/iostat
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 02:49:21 +02:00
Denys Vlasenko
7783248eaa *: s/xatoi_u/xatoi_positive/g - I got bored of mistyping xatoi_u as xatou_i
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-12 14:14:45 +02:00
Denys Vlasenko
d07b20ff14 rtc: remove useless code in "RTC is in UTC" detection
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-10 13:06:06 +02:00
Denys Vlasenko
da0df47f24 wget: fix ndelay_on call; progress bar: small shrink
function                                             old     new   delta
bb_progress_update                                   682     670     -12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-08 04:21:50 +02:00
Bradley M. Kuhn
c97131c2af wget: implement -T SEC; rework progress meter to not use signals (it was unsafe)
function                                             old     new   delta
retrieve_file_data                                   364     450     +86
bb_progress_update                                   615     682     +67
packed_usage                                       27406   27422     +16
wget_main                                           2440    2453     +13
static.wget_longopts                                 145     155     +10
progress_meter                                       199     159     -40
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/1 up/down: 192/-40)           Total: 152 bytes

Signed-off-by: Bradley M. Kuhn <bkuhn@ebb.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-08 02:51:20 +02:00
Denys Vlasenko
ba2dcccd79 *: trailing empty lines removed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:49:12 +02:00
Denys Vlasenko
451add4f23 lineedit: mostly revert recent wrong logic in "ask terminal" code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-25 00:06:41 +02:00
Jeremie Koenig
29885114a5 libbb: conditionalize AF_* usage in error reporting
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:46:47 +02:00
Jeremie Koenig
84b01d5afc mkdir: fix -p on FreeBSD
This patch is libbb.make_directory.diff from Debian kFreeBSD at:
http://svn.debian.org/viewsvn/d-i/people/slackydeb/kfreebsd/busybox/1.14/debian

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:46:28 +02:00
Jeremie Koenig
1d7266d3b5 mark Linux-specific configuration options
PLATFORM_LINUX is used as a dependency for applets or features
which require Linux-specific interfaces.

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:44:56 +02:00
Denys Vlasenko
55241fa2e0 lineedit: limit ASK_TERMINAL to the case when we can't find out the width
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-18 22:53:06 +02:00
Denys Vlasenko
b9e35dc15d lineedit: cosmetics, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-18 22:21:24 +02:00
Denys Vlasenko
5d26df6497 tweak defconfig
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-16 15:31:38 +02:00
Denys Vlasenko
9297dbc9d2 randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-05 21:37:12 +02:00
Denys Vlasenko
7e1bb4bc5c libbb: reduce number of *error_msg[_and_die].c files by four
No code changes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 17:16:44 +02:00
Pascal Bellard
926031b764 *: introduce and use xfork() and xvfork()
function                                             old     new   delta
launch_helper                                        170     169      -1
setup_heredoc                                        312     302     -10
handle_dir_common                                    367     354     -13
expand_vars_to_list                                 2456    2443     -13
open_transformer                                      89      74     -15
data_extract_to_command                              439     423     -16
do_ipaddr                                           1406    1389     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-85)             Total: -85 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 15:32:38 +02:00
Pascal Bellard
21e8e8da64 libbb: introduce and use BB_EXECVP_or_die()
function                                             old     new   delta
BB_EXECVP_or_die                                       -      47     +47
time_main                                           1042    1043      +1
chrt_main                                            371     364      -7
ionice_main                                          292     282     -10
setsid_main                                           69      56     -13
nohup_main                                           236     223     -13
cttyhack_main                                        266     253     -13
chroot_main                                           94      81     -13
chpst_main                                           746     733     -13
timeout_main                                         297     279     -18
taskset_main                                         541     522     -19
vfork_child                                           67      45     -22
parse                                                975     953     -22
lpd_main                                             770     748     -22
launch_helper                                        192     170     -22
tcpudpsvd_main                                      1810    1782     -28
nice_main                                            190     156     -34
env_main                                             242     206     -36
run_command                                          221     174     -47
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/17 up/down: 48/-352)         Total: -304 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 00:57:03 +02:00
Denys Vlasenko
5c296de390 fix compile breakage with "make -j"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-03 14:28:35 +02:00
Denys Vlasenko
cd0f6b0c93 consolidate xz format comment. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-01 10:38:10 +02:00
Denys Vlasenko
45f66167fe xz compression detection: avoid the need to seek
function                                             old     new   delta
unpack_unxz                                           12      67     +55
unpack_xz_stream                                    2357    2373     +16
xmalloc_read                                         197     199      +2
setup_unzip_on_fd                                    118      99     -19
rpm2cpio_main                                        222     203     -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 73/-38)             Total: 35 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-01 05:12:28 +02:00
Ladislav Michl
a73b87e934 *: s/"/bin/sh"/DEFAULT_SHELL, run_shell() API fix, remove unneeded strdup
function                                             old     new   delta
run_shell                                            157     166      +9
su_main                                              477     470      -7
sulogin_main                                         515     503     -12

Signed-off-by: Ladislav Michl <Ladislav.Michl@seznam.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-27 03:23:31 +02:00
Denys Vlasenko
1eaf7e76bf libbb/copyfd.c: fix the case of copy buffer <= 4kb
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 23:08:59 +02:00
Denys Vlasenko
d0a8a0d312 tar: fix --to-command wrt short writes
function                                             old     new   delta
bb_copyfd_exact_size                                  51      98     +47
bb_full_fd_action                                    362     394     +32
get_header_tar                                      1546    1558     +12
data_extract_to_command                              430     439      +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 100/0)             Total: 100 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 18:11:44 +02:00
Denys Vlasenko
894fa0ad62 fix breakage in compressed file detection
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 05:01:16 +02:00
Denys Vlasenko
63144be7ea universal parser: do not leak parser->data
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 04:00:52 +02:00
Denys Vlasenko
1fcbff2fac build system: do not rebuild ash and hush on any change to any .c file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 02:40:08 +02:00
Denys Vlasenko
41ddd9f606 *: make exec failure message more consistent
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-25 01:46:53 +02:00
Denys Vlasenko
dd8adde386 *: introduce and use bb_unsetenv_and_free
function                                             old     new   delta
bb_unsetenv_and_free                                   -      17     +17
tcpudpsvd_main                                      1819    1810      -9
safe_setenv                                           58      47     -11
udhcp_run_script                                     630     616     -14
make_device                                         1683    1663     -20
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/4 up/down: 17/-54)            Total: -37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-24 05:00:50 +02:00
Dan Fandrich
0635ddd8f7 Added code for nonstandard function strsep()
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-19 20:03:18 +02:00
Dan Fandrich
fdd7b566ec A few minor portability improvements
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-19 20:03:15 +02:00
Denys Vlasenko
b87c17cd16 *: stop defining _GNU_SOURCE in source files, it's in CFLAGS anyway
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 15:15:24 +02:00
Denys Vlasenko
ab60cd1382 utoa: shrink
function                                             old     new   delta
itoa_to_buf                                           20      23      +3
utoa_to_buf                                          117     101     -16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-10 10:54:44 +02:00
Denys Vlasenko
d70e0e995e *: add INSERTs to *.src files where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-08 12:15:11 +02:00
Denys Vlasenko
729ecb87bf bbconfig: make it independent from printf functions
function                                             old     new   delta
full_write2_str                                        -      25     +25
full_write1_str                                        -      25     +25
clear_main                                            21      20      -1
telnet_main                                         1488    1477     -11
getty_main                                          1932    1918     -14
full_write22_str                                      25       -     -25
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/3 up/down: 50/-51)             Total: -1 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-07 14:14:26 +02:00
Denys Vlasenko
19ced5c425 pipe_progress: make it independent of printf machinery
function                                             old     new   delta
bb_putchar_stderr                                      -      24     +24
ParseField                                           494     471     -23
progress_meter                                       212     188     -24
xargs_main                                           888     842     -46
pipe_progress_main                                   151     105     -46
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/4 up/down: 24/-139)          Total: -115 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 21:53:09 +02:00
Denys Vlasenko
2f32bf8be6 remove defconfig. Now "make defconfig" simply uses defaults from Config.in
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 04:14:28 +02:00
Denys Vlasenko
0e5ba0843b Remove requirement that include/applets.h must be sorted
First, I _again_ violated it - two xz-related applets are in wrong positions.
Second, planned in-applet help text thing will be so much easier without
this requirement...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-05 23:11:07 +02:00
Denys Vlasenko
da929a95aa mass renaming Kbuild -> Kbuild.src, Config.in -> Config.src
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04 20:10:51 +02:00
Denys Vlasenko
26b6ccf340 *: simplify checks for gz/bz2/xz magic
function                                             old     new   delta
send_tree                                            360     355      -5
rpm2cpio_main                                        249     220     -29
setup_unzip_on_fd                                    150     118     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-66)             Total: -66 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-02 14:14:48 +02:00
Tomas Heinrich
11bcf4b224 lineedit: fix column display for wide and combining chars in TAB completion
function                                             old     new   delta
unicode_strwidth                                       -      20     +20
read_line_input                                     4945    4953      +8
unicode_strlen                                        31       -     -31
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/0 up/down: 28/-31)             Total: -3 bytes

Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-01 08:33:18 +02:00
Denys Vlasenko
6948f210ed *: teach tar et. al. to understand .xz by heart
function                                             old     new   delta
unpack_xz_stream                                       -    4126   +4126
setup_unzip_on_fd                                     80     150     +70
open_zipped                                          113     131     +18
unpack_unxz                                            5      12      +7
send_tree                                            360     353      -7
unpack_xz_stream_stdin                              3953       -   -3953
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 3/1 up/down: 4221/-3960)        Total: 261 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-30 04:18:13 +02:00
Denys Vlasenko
92510141e2 losetup: support /dev/loop10 and higher. closes bug 1627
function                                             old     new   delta
query_loop                                            91      95      +4
losetup_main                                         288     285      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-19 00:39:17 +02:00
Denys Vlasenko
bbf1aa1eaf typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 12:33:13 +02:00
Denys Vlasenko
1118d9b213 lineedit: fix insertion deep inside line (*several lines* before end)
function                                             old     new   delta
input_backward                                       212     229     +17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 12:30:44 +02:00
Denys Vlasenko
9963fe36c2 lineedit: trivial simplifications. -7 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 04:05:53 +02:00
Denys Vlasenko
248c324f7c lineedit: fix moving backwards across lines with wide chars
function                                             old     new   delta
input_backward                                       212     208      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 00:45:44 +02:00
Denys Vlasenko
d9a3e89f50 consolidate ESC sequences
function                                             old     new   delta
bell                                                   2       -      -2
CMdown                                                 2       -      -2
Ceos                                                   4       -      -4
Ceol                                                   4       -      -4
CMup                                                   4       -      -4
SOs                                                    5       -      -5
SOn                                                    5       -      -5
CMrc                                                   9       -      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-16 23:42:13 +02:00
Denys Vlasenko
26e2c1db0d stop using LAST_SUPPORTED_WCHAR and CONFIG_LAST_SUPPORTED_WCHAR, it's confusing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-16 21:15:03 +02:00
Tomas Heinrich
b8909c52fe lineedit: partially fix wide and combining chars editing
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-16 20:46:53 +02:00
Denys Vlasenko
94043e8ad2 lineedit: change how cmdedit_set_out_char works
Rename two badly names functions, use "clear to end of screen"
to eliminate annoying problems with clearing wide/combining chars,
and such. Run tested.

function                                             old     new   delta
put_cur_glyph_and_inc_cursor                           -     124    +124
put_till_end_and_adv_cursor                            -      24     +24
input_delete                                         125     130      +5
Ceos                                                   5       4      -1
Ceol                                                   5       4      -1
input_end                                             24       -     -24
cmdedit_set_out_char                                 122       -    -122
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/2 up/down: 153/-148)            Total: 5 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-11 14:49:13 +02:00
Denys Vlasenko
bfa1b2e8e8 randomtest fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-11 03:53:57 +02:00
Denys Vlasenko
c2345fa2d4 add comment about xz format support
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-06 17:05:22 +02:00
Denys Vlasenko
27653adc8b rpm: code shrink. Now uses open_zipped's logic (factored out into setup_unzip_on_fd())
function                                             old     new   delta
setup_unzip_on_fd                                      -      80     +80
open_zipped                                          176     113     -63
rpm_main                                            1672    1355    -317
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 80/-380)          Total: -300 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-06 14:19:19 +00:00
Tomas Heinrich
a659b81dfa libbb/lineedit: add support for preserving "broken" (non-unicode) chars
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-29 13:43:39 +02:00
Denys Vlasenko
5f94346f73 date: support -d @SECONDS_SINCE_1970
function                                             old     new   delta
parse_datestr                                        647     721     +74

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-22 00:45:28 -04:00
Denys Vlasenko
5a7c72015c busybox --list option. +140 bytes. Rob wanted it.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-20 21:02:57 -04:00
Denys Vlasenko
c175c46647 vi: discover window size even on serial consoles. optional
function                                             old     new   delta
edit_file                                            671     761     +90
wh_helper                                              -      57     +57
query_screen_dimensions                               54      63      +9
ar_main                                              533     542      +9
refresh                                              767     773      +6
vi_main                                              242     243      +1
text_yank                                             56      54      -2
get_terminal_width_height                            180     135     -45
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/2 up/down: 172/-47)           Total: 125 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-18 22:09:30 -07:00
Denys Vlasenko
43b094b584 remove stdio from allnoconfig build
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-18 20:16:11 -07:00
Tomas Heinrich
0358daf447 read_key: fix buffer length calculation
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-16 16:26:08 -07:00
Denys Vlasenko
b9dd5ab6d9 loop: correct minor device number limit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-14 13:52:41 -07:00
Lauri Kasanen
375a8ef5ea mount: add an optional capability to create new /dev/loopN as needed
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-14 12:31:26 -07:00
Nguyễn Thái Ngọc Duy
125d0154e6 Exclude syslog code if FEATURE_SYSLOG is not set
syslog.h and syslog(...) may not exist in such configuration

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-09 14:34:28 +02:00
Denys Vlasenko
f8d8aa1cea libbb: add skip_dev_pfx()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-06 18:50:05 +02:00
Denys Vlasenko
f6916dbed4 telnetd: fill hostname field in utmp/wtmp records
function                                             old     new   delta
get_lsa                                                -     109    +109
make_new_session                                     438     504     +66
get_peer_lsa                                           -      10     +10
ftpd_main                                           2340    2267     -73
get_sock_lsa                                         101      10     -91
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/2 up/down: 185/-164)           Total: 21 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-06 17:43:29 +02:00
Denys Vlasenko
3a41611bc5 telnetd: write LOGIN/DEAD_PROCESS utmp records. Closes bug 1363
function                                             old     new   delta
write_new_utmp                                         -     253    +253
skip_dev_pfx                                           -      30     +30
handle_sigchld                                        42      72     +30
telnetd_main                                        1650    1673     +23
make_new_session                                     415     438     +23
...
login_main                                          1140    1148      +8
update_utmp                                          337     313     -24
write_wtmp                                           220     154     -66
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 11/6 up/down: 406/-115)         Total: ~291 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-05 22:10:38 +02:00
Denys Vlasenko
37f5bef63c libbb: split update_utmp from login/getty in preparation to use it for telnetd
function                                             old     new   delta
update_utent                                           -     339    +339
login_main                                          1498    1128    -370
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 339/-370)          Total: -31 bytes

function                                             old     new   delta
update_utmp                                          246     337     +91
login_main                                          1128    1140     +12
getty_main                                          1908    1918     +10
...
update_utent                                         339       -    -339
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 5/6 up/down: 119/-368)         Total: -249 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-05 03:18:40 +02:00
Denys Vlasenko
4836331924 libbb: factor out hex2bin() for infiniband address parser
function                                             old     new   delta
hex2bin                                                -     149    +149
in_ib                                                172      27    -145

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 15:29:32 +02:00
Denys Vlasenko
ccd1efc3c1 cosmetic fixes, no code changed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-03 15:39:47 +02:00
Denys Vlasenko
8a659f6ff9 libbb: make index_in_substrings return -1 on ambiguous matches
function                                             old     new   delta
index_in_substrings                                   67      93     +26

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-03 00:52:16 +02:00
Denys Vlasenko
5342c3f310 clean up redundant, commented-out and misplaced includes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-01 15:09:44 +02:00
Denys Vlasenko
1d448cff65 provide safe_gethostname() for non-linux systems
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-29 11:20:00 +02:00
Denys Vlasenko
3d0e7794eb libbb: locate PAGE_SIZE on Hurd
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-29 11:02:00 +02:00
Jérémie Koenig
fbedacfc8c Hurd compat fixes. Mostly dealing with absent PATH_MAX
Signed-off-by: Jérémie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 19:08:53 +01:00
Denys Vlasenko
19158a837d unicode: s/FEATURE_ASSUME_UNICODE/UNICODE_SUPPORT, add UNICODE_USING_LOCALE
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 14:06:56 +01:00
Tomas Heinrich
aa167556cd unicode: optional table for better handling of neutral bidi chars
Off:
function                                             old     new   delta
unicode_bidi_isrtl                                     -      55     +55
isrtl_str                                             51      65     +14
unicode_isrtl                                         55       -     -55
read_line_input                                     5003    4937     -66
------------------------------------------------------------------------------
(add/remove: 1/4 grow/shrink: 1/1 up/down: 69/-121)           Total: -52 bytes

On:
function                                             old     new   delta
static.neutral_b                                       -     320    +320
static.neutral_p                                       -     142    +142
unicode_bidi_isrtl                                     -      55     +55
unicode_bidi_is_neutral_wchar                          -      55     +55
isrtl_str                                             51      59      +8
unicode_isrtl                                         55       -     -55
read_line_input                                     5003    4937     -66
------------------------------------------------------------------------------
(add/remove: 4/4 grow/shrink: 1/1 up/down: 580/-121)          Total: 459 bytes

Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 13:13:24 +01:00
Denys Vlasenko
651a2697f7 *: merge some common strings
text   data    bss    dec    hexfilename
 838650   8009      0 846659  ceb43busybox_old
 838519   8009      0 846528  ceac0busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 16:25:17 +01:00
Alexander Shishkin
85dbf190c6 date,touch: accept Jan 7 00:00:00 2010 format
function                                             old     new   delta
parse_datestr                                        618     647     +29

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-22 18:22:33 +01:00
Denys Vlasenko
bcda0042e2 libbb/copyfd.c: don't mmap a largish buffer if we only want to copy a few kb
function                                             old     new   delta
bb_full_fd_action                                    283     295     +12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-19 14:34:30 +01:00
Denys Vlasenko
8531d76a15 *: code shrink and better "died from signal" reporting from wait4pid
function                                             old     new   delta
parse                                                964     967      +3
udhcp_run_script                                     670     665      -5
singlemount                                          911     906      -5
mount_it_now                                         360     355      -5
inotifyd_main                                        521     516      -5
xspawn                                                21       -     -21
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/4 up/down: 3/-41)             Total: -38 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-18 22:44:00 +01:00
Tomas Heinrich
c5c006c10c lineedit: first shot at optional unicode bidi input support
function                                             old     new   delta
read_line_input                                     4886    5003    +117
in_uint16_table                                        -      97     +97
in_interval_table                                      -      78     +78
static.rtl_b                                           -      68     +68
unicode_isrtl                                          -      55     +55
isrtl_str                                              -      51     +51
static.rtl_p                                           -      42     +42
unicode_conv_to_printable2                           633     477    -156
------------------------------------------------------------------------------
(add/remove: 6/0 grow/shrink: 1/1 up/down: 508/-156)          Total: 352 bytes

Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-18 18:35:37 +01:00
Denys Vlasenko
98f1dc12f1 libbb/loop: comment out u32 hack
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-18 14:38:21 +01:00
Denys Vlasenko
d46c36c74e libbb/getopt32.c: clear applet_long_options and opt_complementary after use
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-16 17:57:53 +01:00
Denys Vlasenko
58f108eb33 lineedit: fix another corner case with bad unicode input
function                                             old     new   delta
read_key                                             607     646     +39
readit                                                50      55      +5
getch_nowait                                         290     295      +5
hash_find                                            233     234      +1
xstrtoul_range_sfx                                   231     230      -1
passwd_main                                         1058    1056      -2
builtin_exit                                          45      43      -2
cmp_main                                             649     645      -4
lineedit_read_key                                    257     245     -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/5 up/down: 50/-21)             Total: 29 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 21:17:55 +01:00
Tomas Heinrich
d2b04050c0 lineedit: invalid unicode characters are replaced with CONFIG_SUBST_WCHAR
function                                             old     new   delta
read_key_ungets                                        -      50     +50
lineedit_read_key                                    223     252     +29

Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-09 14:09:24 +01:00
Denys Vlasenko
41d8134511 libbb/loop.c: move #include to its user, improve comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-08 23:10:23 +01:00
Denys Vlasenko
8cb40361c0 libbb/loop.c: use common fix_u32.h trick
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-06 20:50:29 +01:00
Denys Vlasenko
cbcc1236f8 tftp: do not show progress bar if we get error right away. +13 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-05 23:38:54 +01:00
Denys Vlasenko
44fbfa78ca libbb/loop.c: style and readability fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-05 13:20:28 +01:00
Denys Vlasenko
99069330a1 *: gethostname-related fixes
function                                             old     new   delta
hostname_main                                        218     231     +13
nfsmount                                            3541    3474     -67

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-27 19:38:19 +01:00
Denys Vlasenko
26ffe81188 su: move restricted_shell into su.c (the only user)
function                                             old     new   delta
su_main                                              448     468     +20
buffer_fill_and_print                                179     196     +17
scriptreplay_main                                    205     208      +3
localcmd                                             275     277      +2
hash_find                                            233     234      +1
devmem_main                                          469     463      -6
install_main                                         724     716      -8
setusershell                                          11       -     -11
find_pair                                            187     169     -18
restricted_shell                                      49       -     -49
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 5/3 up/down: 43/-92)            Total: -49 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-26 10:01:18 +01:00
Denys Vlasenko
fd686a262f setup_environment(): eliminate one parameter
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-26 09:52:45 +01:00
Bernhard Reutner-Fischer
99709ab033 crontab: use setup_environment
function                                             old     new   delta
setup_environment                                    184     198     +14
.rodata                                           131770  131747     -23
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-23)             Total: -9 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-02-26 09:31:40 +01:00
Denys Vlasenko
fb6e689554 libbb/md5.c: remove wrong comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-08 17:46:49 +01:00
Denys Vlasenko
cb7edc2661 adduser: copy /etc/skel to mew homes. +100 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-06 21:50:59 +01:00
Denys Vlasenko
0cd445f4d1 cosmetic fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-06 21:11:49 +01:00
Denys Vlasenko
6aca76d4d7 hexdump: fix "hexdump nonexistent_file" handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-06 13:53:21 +01:00
Denys Vlasenko
12ca080a1c *: eliminate more aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 18:41:18 +01:00
Denys Vlasenko
557deb1014 libbb: fix bb_ask() to operate on correct fd
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-03 12:17:06 +01:00
Denys Vlasenko
40e7d25aca mkXXXX: unify [KBYTES] parameter handling (added it to mkswap)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-01 23:48:27 +01:00
Denys Vlasenko
c8e18ca12c remove now-unneeded memset
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-01 13:45:04 +01:00
Denys Vlasenko
e936c6d1c5 make echo -e "foo\nfoo" | passwd USER work
Suggested by Michael Zhu (linuxsir320 AT gmail.com)

function                                             old     new   delta
bb_ask                                               333     340      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-01 04:55:30 +01:00
Denys Vlasenko
460f827644 better wording in Config
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-31 18:12:57 +01:00
Denys Vlasenko
b1edf20f18 unicode: exclude FDD0..FDEF range too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-31 16:34:37 +01:00
Denys Vlasenko
40e4e88a28 exclude more invalid unicode chars
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-31 16:04:30 +01:00
Denys Vlasenko
3d5b606931 ls: fix handling of broken unicode sequences
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-31 05:55:55 +01:00
Denys Vlasenko
d8528b8e56 ls: unicode fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-31 05:15:38 +01:00