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
Denys Vlasenko
3fa97af7cc
ash,hush: set $HOSTNAME is bash compat. Closes 7028
...
function old new delta
hush_main 1056 1128 +72
ash_main 1442 1487 +45
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-15 11:43:29 +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
69b114fb8a
less: fix bugs discovered with "git log -p | less -m" on kernel tree
...
function old new delta
read_lines 685 733 +48
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-13 16:02:59 +02:00
Denys Vlasenko
32afd3aa60
vi: some simplifications
...
function old new delta
file_insert 301 315 +14
init_text_buffer 179 171 -8
colon 2889 2878 -11
file_size 37 - -37
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 14/-56) Total: -42 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-05 22:57:46 +02:00
Denys Vlasenko
e7430867a8
vi: clear undo buffer when we change to another file
...
function old new delta
init_text_buffer 156 190 +34
undo_push 360 382 +22
count_lines 74 72 -2
undo_pop 246 222 -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 56/-26) Total: 30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-03 12:47:48 +02:00
Denys Vlasenko
2c51202aec
vi: undo code shrink
...
function old new delta
undo_push 414 395 -19
do_cmd 4803 4761 -42
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-03 01:45:05 +02:00
Jody Bruchon
a8d6f9bee4
vi: undo support for vi with intermediate queuing
...
function old new delta
undo_push - 411 +411
undo_pop - 288 +288
do_cmd 4160 4426 +266
char_insert 363 483 +120
undo_queue_commit - 61 +61
text_hole_delete 108 163 +55
string_insert 94 127 +33
colon 2864 2882 +18
yank_delete 92 101 +9
vi_main 273 280 +7
dot_scroll 88 93 +5
dot_right 29 34 +5
dot_prev 20 25 +5
dot_next 20 25 +5
dot_left 24 29 +5
dot_end 20 25 +5
dot_begin 20 25 +5
init_text_buffer 154 156 +2
text_hole_make 145 142 -3
file_insert 333 318 -15
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 15/2 up/down: 1305/-18) Total: 1287 bytes
(without queuing it's ~870 bytes)
Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-02 13:49:26 +02:00
Drew Moseley
7537406edd
build system: specify '-nostldlib' when linking to .o files
...
For certain cross build scenarios the LD variable is overridden
to use the gcc executive to ensure all the target tuning parameters
are used. In these cases, the executive errors out as shown below
but since this step is only linking to a .o file the standard libs
are not needed.
$ make LD=gcc applets/built-in.o
LD applets/built-in.o
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
make[1]: *** [applets/built-in.o] Error 1
make: *** [applets_dir] Error 2
Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-02 12:12:46 +02:00
Tito Ragusa
c9a67133d6
swapon/swapoff: -a returns 0 on ignored errors
...
Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-01 09:51:27 +02:00
Tito Ragusa
a3f326cd66
swapon/swapoff: size reduction, cleanup, fixes, improvements
...
1) real swapon/swapoff handles also devices on the commandline with -a;
2) xstat(device) in swap_enable_disable aborts on error when cycling through
fstab so some devices are not handled;
3) duplicated code for ENABLE_FEATURE_SWAPON_DISCARD and
ENABLE_FEATURE_SWAPON_PRI was moved to functions.
4) silence some error messages with -a;
5) minor cleanups and code refactoring reduced the size as per bloat-check:
6) I also added support for /proc/swaps handling to swapoff:
"When the -a flag is given, swapping is disabled on all known swap devices
and files (as found in /proc/swaps or /etc/fstab)."
So now swapoff first cycles through /proc/swaps and then through fstab
to swapoff all devices.
function old new delta
set_discard_flag - 106 +106
swap_enable_disable 147 238 +91
set_priority_flag - 79 +79
retrieve_file_data 470 467 -3
swap_on_off_main 638 418 -220
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/2 up/down: 276/-223) Total: 53 bytes
Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-31 16:39:26 +02:00
Denys Vlasenko
faa9e94db6
wget: fix a case where progress bar isn't updated if writes are very slow
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-27 16:50:29 +01:00
Matt Whitlock
0a53b203f9
add discard option -d to swapon
...
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:23 +01:00
Matt Whitlock
b9bbd4ddf6
fix interaction of -a and -p options in swapon
...
Swap entries in /etc/fstab inherit the priority specified on the command line unless they have 'pri' in their mount options.
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:22 +01:00
Matt Whitlock
c3a27b0bfd
avoid calling bb_strtou twice in MIN macro expansion
...
Also, the maximum allowable value of swap priority is technically SWAP_FLAG_PRIO_MASK >> SWAP_FLAG_PRIO_SHIFT.
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:22 +01:00
Denys Vlasenko
504fe45f35
ntpd: add optional support for /etc/ntp.conf
...
function old new delta
add_peers - 98 +98
packed_usage 29470 29511 +41
ntp_init 407 428 +21
pw_encrypt 14 27 +13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 173/0) Total: 173 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:34:51 +01:00
Denys Vlasenko
f332617fbd
docs/new-applet-HOWTO.txt: tweak a bit
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-17 15:06:29 +01: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
Bartosz Golaszewski
9dbe4d0547
docs: update new-applet-HOWTO.txt
...
This patch adds some information about the gen_build_files.sh script and how
it allows to keep the Kbuild, Config.in etc. declarations in .c files.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 18:47:44 +01:00
Denys Vlasenko
109ee5d336
ash: make "locak VAR" unset VAR (bash does that)
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 18:41:11 +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
29f3526048
build system: for "find", use POSIX not operator (!) instead of -not
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 12:05:58 +01:00
Romain Naour
0e3334c8d8
su: add a delay if the password is incorrect
...
Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 11:18:19 +01:00
Denys Vlasenko
ac03a40cba
ash,hush: fix a thinko about 2^64-1 factorization
...
function old new delta
next_random 113 119 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-15 09:25:46 +01:00
Denys Vlasenko
2bba591991
hush: make "true" built-in
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-14 12:43:57 +01:00
Denys Vlasenko
f93187512d
random: cosmetic tweaks in debug code
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-13 13:03:27 +01:00
Denys Vlasenko
fb183076a3
ash,hush: improve randomness of $RANDOM, add easy-ish way to test it
...
function old new delta
next_random 68 113 +45
change_random 103 121 +18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-13 12:52:43 +01:00
Denys Vlasenko
69f9567de2
shuf: trim help text
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:41:53 +01:00
Denys Vlasenko
102f0d0d07
shuf: do not use strings for -i RANGE case
...
function old new delta
shuf_main 482 496 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:32:39 +01:00
Bartosz Golaszewski
190693ced1
shuf: improve help text
...
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:07:35 +01:00
Bartosz Golaszewski
58adbb5505
shuf: fix a segfault on 'shuf -e'
...
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 11:46:03 +01:00
Denys Vlasenko
0ed5f7aacd
use [s]rand(), not [s]random()
...
rand() is the most standard C library function,
and on uclibc they are the same. I guess
they are the same in most todays' libc...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-05 18:58:15 +01:00
Denys Vlasenko
2cdcb1082c
shuf: new applet
...
function old new delta
shuf_main - 478 +478
packed_usage 29571 29719 +148
applet_names 2460 2465 +5
applet_main 1428 1432 +4
applet_nameofs 714 716 +2
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/0 up/down: 637/0) Total: 637 bytes
Based on the code by Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-05 18:56:20 +01:00
Denys Vlasenko
30f17e9556
man: default to ascii
...
Default to ascii instead of latin1. Otherwise man pages can be displayed
incorrectly. E.g. bullets show as "<B7>".
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-03 15:14:26 +01:00
Denys Vlasenko
ecd8c3affc
ip link: add support for "address ETHADDR". Closes 4862
...
function old new delta
do_iplink 2175 2289 +114
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-01 17:38:41 +01:00
Denys Vlasenko
81071e6872
unlzma: add comments about possible bug from BZ 2689
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-28 15:42:10 +01:00
Denys Vlasenko
2108a6f0b5
unlzma: move some variables in "more local" scope
...
No code changes as verified by objdump
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-28 15:05:43 +01:00
Denys Vlasenko
e2318bbad7
udhcpc: ignore NAKs from "wrong" servers. Closes 4267
...
function old new delta
udhcpc_main 2716 2814 +98
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 18:15:50 +01:00
Denys Vlasenko
fca0ee5959
ls: make "ls -s DIR" show total too. Clases 4946
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 15:40:26 +01:00
Denys Vlasenko
3795266841
xargs: fix compilation breakage
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 15:02:36 +01:00
Denys Vlasenko
83e49ade57
grep: fix -w match if first match isn't a word, but second is. Closes 4520
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 14:56:12 +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
6885e49ba5
find: code shrink
...
function old new delta
func_exec 306 285 -21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-26 15:27:10 +01:00
Denys Vlasenko
c472898eaa
nc: fix option bit positions. Closes 6926
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-26 13:58:59 +01:00
Denys Vlasenko
589051b565
hwclock: fix setting of tz_minuteswest. Closes 5414
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-25 17:52:10 +01:00
Denys Vlasenko
18b699c30f
build system: remove a dead link from Config help text
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-25 17:31:22 +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
6554d03735
sysctl: do not error out showing write-only data. Closes 6386
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-24 17:28:43 +01:00
Denys Vlasenko
a2796223cb
wget: fix comment
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-24 17:20:40 +01:00