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>
random: cosmetic tweaks in debug code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
hush: make "true" built-in

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>
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>
build system: for "find", use POSIX not operator (!) instead of -not

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>
ash: make "locak VAR" unset VAR (bash does that)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>
libbb: fix a bad check for uclibc >= 0.9.31

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
docs/new-applet-HOWTO.txt: tweak a bit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>
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>
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>
add discard option -d to swapon

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
wget: fix a case where progress bar isn't updated if writes are very slow

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>
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>
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>
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>