aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-03-22 15:41:00 +0000
committerRon Yorston <rmy@pobox.com>2012-03-22 15:41:00 +0000
commit1118c95535ea51961437089fc3dece5ab4ea7e1b (patch)
tree1515bd2376a6d6c5123791662307ce2ed90cdf36
parent0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2 (diff)
parent066f39956641300c1e5c6bfe6c11a115cea3e2cf (diff)
downloadbusybox-w32-1118c95535ea51961437089fc3dece5ab4ea7e1b.tar.gz
busybox-w32-1118c95535ea51961437089fc3dece5ab4ea7e1b.tar.bz2
busybox-w32-1118c95535ea51961437089fc3dece5ab4ea7e1b.zip
Merge commit '066f39956641300c1e5c6bfe6c11a115cea3e2cf' into merge
Conflicts: procps/ps.c
-rw-r--r--Config.in3
-rw-r--r--Makefile4
-rw-r--r--archival/ar.c1
-rw-r--r--archival/bbunzip.c7
-rw-r--r--archival/bzip2.c1
-rw-r--r--archival/cpio.c1
-rw-r--r--archival/dpkg.c1
-rw-r--r--archival/dpkg_deb.c1
-rw-r--r--archival/gzip.c1
-rw-r--r--archival/lzop.c6
-rw-r--r--archival/rpm.c1
-rw-r--r--archival/tar.c1
-rw-r--r--archival/unzip.c1
-rw-r--r--console-tools/kbd_mode.c1
-rw-r--r--console-tools/loadfont.c1
-rw-r--r--console-tools/openvt.c1
-rw-r--r--console-tools/setconsole.c1
-rw-r--r--console-tools/showkey.c1
-rw-r--r--coreutils/Config.src6
-rw-r--r--coreutils/Kbuild.src1
-rw-r--r--coreutils/cal.c1
-rw-r--r--coreutils/catv.c1
-rw-r--r--coreutils/chgrp.c1
-rw-r--r--coreutils/chmod.c1
-rw-r--r--coreutils/chown.c1
-rw-r--r--coreutils/comm.c1
-rw-r--r--coreutils/cp.c1
-rw-r--r--coreutils/cut.c1
-rw-r--r--coreutils/date.c1
-rw-r--r--coreutils/dd.c1
-rw-r--r--coreutils/df.c1
-rw-r--r--coreutils/dos2unix.c2
-rw-r--r--coreutils/du.c1
-rw-r--r--coreutils/echo.c1
-rw-r--r--coreutils/env.c1
-rw-r--r--coreutils/expand.c2
-rw-r--r--coreutils/fold.c1
-rw-r--r--coreutils/fsync.c1
-rw-r--r--coreutils/head.c1
-rw-r--r--coreutils/id.c78
-rw-r--r--coreutils/install.c1
-rw-r--r--coreutils/ln.c1
-rw-r--r--coreutils/ls.c32
-rw-r--r--coreutils/md5_sha1_sum.c4
-rw-r--r--coreutils/mkdir.c1
-rw-r--r--coreutils/mkfifo.c1
-rw-r--r--coreutils/mknod.c1
-rw-r--r--coreutils/mv.c1
-rw-r--r--coreutils/nice.c1
-rw-r--r--coreutils/readlink.c1
-rw-r--r--coreutils/rm.c1
-rw-r--r--coreutils/rmdir.c1
-rw-r--r--coreutils/seq.c1
-rw-r--r--coreutils/sort.c1
-rw-r--r--coreutils/split.c3
-rw-r--r--coreutils/stat.c1
-rw-r--r--coreutils/stty.c1
-rw-r--r--coreutils/sum.c1
-rw-r--r--coreutils/tail.c1
-rw-r--r--coreutils/tee.c1
-rw-r--r--coreutils/touch.c1
-rw-r--r--coreutils/tr.c1
-rw-r--r--coreutils/tty.c1
-rw-r--r--coreutils/uname.c1
-rw-r--r--coreutils/uniq.c1
-rw-r--r--coreutils/uudecode.c1
-rw-r--r--coreutils/uuencode.c1
-rw-r--r--coreutils/wc.c1
-rw-r--r--coreutils/who.c1
-rw-r--r--debianutils/mktemp.c1
-rw-r--r--debianutils/run_parts.c1
-rw-r--r--e2fsprogs/chattr.c1
-rw-r--r--e2fsprogs/fsck.c1
-rw-r--r--e2fsprogs/lsattr.c1
-rw-r--r--e2fsprogs/old_e2fsprogs/e2fsck.c1
-rw-r--r--editors/Config.src117
-rw-r--r--editors/Kbuild.src1
-rw-r--r--editors/awk.c3
-rw-r--r--editors/cmp.c1
-rw-r--r--editors/diff.c1
-rw-r--r--editors/patch.c17
-rw-r--r--editors/sed.c3
-rw-r--r--editors/vi.c229
-rw-r--r--findutils/find.c1
-rw-r--r--findutils/grep.c1
-rw-r--r--findutils/xargs.c1
-rw-r--r--include/applets.src.h2
-rw-r--r--include/libbb.h40
-rw-r--r--include/platform.h58
-rw-r--r--init/bootchartd.c1
-rw-r--r--init/halt.c7
-rw-r--r--libbb/Kbuild.src4
-rw-r--r--libbb/appletlib.c15
-rw-r--r--libbb/get_line_from_file.c42
-rw-r--r--libbb/parse_config.c140
-rw-r--r--libbb/platform.c29
-rw-r--r--libbb/procps.c44
-rw-r--r--loginutils/addgroup.c1
-rw-r--r--loginutils/adduser.c1
-rw-r--r--loginutils/chpasswd.c1
-rw-r--r--loginutils/cryptpw.c2
-rw-r--r--loginutils/getty.c1
-rw-r--r--loginutils/login.c1
-rw-r--r--loginutils/passwd.c1
-rw-r--r--loginutils/su.c1
-rw-r--r--loginutils/sulogin.c1
-rw-r--r--loginutils/vlock.c1
-rw-r--r--mailutils/makemime.c3
-rw-r--r--mailutils/popmaildir.c1
-rw-r--r--mailutils/reformime.c1
-rw-r--r--miscutils/adjtimex.c1
-rw-r--r--miscutils/beep.c3
-rw-r--r--miscutils/chrt.c1
-rw-r--r--miscutils/conspy.c1
-rw-r--r--miscutils/devfsd.c1
-rw-r--r--miscutils/eject.c1
-rw-r--r--miscutils/fbsplash.c3
-rw-r--r--miscutils/flash_eraseall.c1
-rw-r--r--miscutils/flashcp.c1
-rw-r--r--miscutils/hdparm.c3
-rw-r--r--miscutils/ionice.c1
-rw-r--r--miscutils/last.c1
-rw-r--r--miscutils/less.c1
-rw-r--r--miscutils/man.c3
-rw-r--r--miscutils/microcom.c1
-rw-r--r--miscutils/mountpoint.c1
-rw-r--r--miscutils/nandwrite.c2
-rw-r--r--miscutils/setserial.c6
-rw-r--r--miscutils/strings.c1
-rw-r--r--miscutils/taskset.c1
-rw-r--r--miscutils/time.c1
-rw-r--r--miscutils/ubi_tools.c10
-rw-r--r--miscutils/watchdog.c1
-rw-r--r--modutils/insmod.c1
-rw-r--r--modutils/modinfo.c3
-rw-r--r--modutils/modprobe-small.c5
-rw-r--r--modutils/modprobe.c46
-rw-r--r--modutils/rmmod.c1
-rw-r--r--networking/arp.c1
-rw-r--r--networking/arping.c1
-rw-r--r--networking/dnsd.c1
-rw-r--r--networking/ether-wake.c5
-rw-r--r--networking/ftpd.c1
-rw-r--r--networking/ftpgetput.c2
-rw-r--r--networking/hostname.c1
-rw-r--r--networking/httpd.c1
-rw-r--r--networking/ifconfig.c13
-rw-r--r--networking/ifenslave.c1
-rw-r--r--networking/ifplugd.c5
-rw-r--r--networking/ifupdown.c6
-rw-r--r--networking/inetd.c10
-rw-r--r--networking/interface.c9
-rw-r--r--networking/ip.c2
-rw-r--r--networking/ipcalc.c1
-rw-r--r--networking/isrv_identd.c1
-rw-r--r--networking/libiproute/iplink.c2
-rw-r--r--networking/libiproute/ll_proto.c6
-rw-r--r--networking/nameif.c29
-rw-r--r--networking/nc.c2
-rw-r--r--networking/nc_bloaty.c3
-rw-r--r--networking/netstat.c1
-rw-r--r--networking/ntpd.c1
-rw-r--r--networking/ping.c2
-rw-r--r--networking/pscan.c1
-rw-r--r--networking/route.c1
-rw-r--r--networking/slattach.c1
-rw-r--r--networking/tc.c20
-rw-r--r--networking/telnet.c1
-rw-r--r--networking/telnetd.c1
-rw-r--r--networking/tftp.c2
-rw-r--r--networking/traceroute.c2
-rw-r--r--networking/tunctl.c1
-rw-r--r--networking/udhcp/dhcpc.c17
-rw-r--r--networking/udhcp/dumpleases.c1
-rw-r--r--networking/udhcp/packet.c13
-rw-r--r--networking/udhcp/socket.c11
-rw-r--r--networking/vconfig.c1
-rw-r--r--networking/wget.c1
-rw-r--r--networking/whois.c1
-rw-r--r--networking/zcip.c5
-rw-r--r--printutils/lpr.c6
-rw-r--r--procps/fuser.c1
-rw-r--r--procps/iostat.c238
-rw-r--r--procps/kill.c3
-rw-r--r--procps/mpstat.c1
-rw-r--r--procps/pgrep.c4
-rw-r--r--procps/pidof.c2
-rw-r--r--procps/pmap.c16
-rw-r--r--procps/ps.c30
-rw-r--r--procps/pstree.c1
-rw-r--r--procps/renice.c1
-rw-r--r--procps/sysctl.c1
-rw-r--r--procps/watch.c1
-rw-r--r--runit/chpst.c2
-rw-r--r--scripts/defconfig.tig22
-rw-r--r--sysklogd/klogd.c1
-rw-r--r--sysklogd/logger.c1
-rw-r--r--sysklogd/logread.c1
-rw-r--r--sysklogd/syslogd.c1
-rwxr-xr-xtestsuite/parse.tests1
-rw-r--r--util-linux/acpid.c1
-rw-r--r--util-linux/blockdev.c3
-rw-r--r--util-linux/dmesg.c1
-rw-r--r--util-linux/fbset.c3
-rw-r--r--util-linux/fdformat.c1
-rw-r--r--util-linux/fdisk.c1
-rw-r--r--util-linux/flock.c1
-rw-r--r--util-linux/fsck_minix.c1
-rw-r--r--util-linux/getopt.c5
-rw-r--r--util-linux/hexdump.c1
-rw-r--r--util-linux/hwclock.c1
-rw-r--r--util-linux/ipcrm.c1
-rw-r--r--util-linux/ipcs.c14
-rw-r--r--util-linux/losetup.c3
-rw-r--r--util-linux/mkfs_minix.c1
-rw-r--r--util-linux/mkfs_reiser.c1
-rw-r--r--util-linux/mkfs_vfat.c1
-rw-r--r--util-linux/mkswap.c1
-rw-r--r--util-linux/mount.c1
-rw-r--r--util-linux/rdate.c1
-rw-r--r--util-linux/readprofile.c3
-rw-r--r--util-linux/script.c3
-rw-r--r--util-linux/swaponoff.c2
-rw-r--r--util-linux/switch_root.c1
-rw-r--r--util-linux/umount.c1
225 files changed, 804 insertions, 856 deletions
diff --git a/Config.in b/Config.in
index 597ceb02b..9edf28d79 100644
--- a/Config.in
+++ b/Config.in
@@ -704,9 +704,6 @@ config EFENCE
704 704
705endchoice 705endchoice
706 706
707### config PARSE
708### bool "Uniform config file parser debugging applet: parse"
709
710endmenu 707endmenu
711 708
712menu 'Installation Options ("make install" behavior)' 709menu 'Installation Options ("make install" behavior)'
diff --git a/Makefile b/Makefile
index 74c8b34f9..64f804623 100644
--- a/Makefile
+++ b/Makefile
@@ -965,10 +965,14 @@ CLEAN_FILES += busybox$(EXEEXT) busybox_unstripped* busybox.links \
965# Directories & files removed with 'make mrproper' 965# Directories & files removed with 'make mrproper'
966MRPROPER_DIRS += include/config include2 966MRPROPER_DIRS += include/config include2
967MRPROPER_FILES += .config .config.old include/asm .version .old_version \ 967MRPROPER_FILES += .config .config.old include/asm .version .old_version \
968 include/NUM_APPLETS.h \
968 include/autoconf.h \ 969 include/autoconf.h \
969 include/bbconfigopts.h \ 970 include/bbconfigopts.h \
971 include/bbconfigopts_bz2.h \
970 include/usage_compressed.h \ 972 include/usage_compressed.h \
971 include/applet_tables.h \ 973 include/applet_tables.h \
974 include/applets.h \
975 include/usage.h \
972 applets/usage \ 976 applets/usage \
973 .kernelrelease Module.symvers tags TAGS cscope* \ 977 .kernelrelease Module.symvers tags TAGS cscope* \
974 busybox_old 978 busybox_old
diff --git a/archival/ar.c b/archival/ar.c
index e7973af94..acad20ff2 100644
--- a/archival/ar.c
+++ b/archival/ar.c
@@ -21,7 +21,6 @@
21//usage: "[-o] [-v] [-p] [-t] [-x] ARCHIVE FILES" 21//usage: "[-o] [-v] [-p] [-t] [-x] ARCHIVE FILES"
22//usage:#define ar_full_usage "\n\n" 22//usage:#define ar_full_usage "\n\n"
23//usage: "Extract or list FILES from an ar archive\n" 23//usage: "Extract or list FILES from an ar archive\n"
24//usage: "\nOptions:"
25//usage: "\n -o Preserve original dates" 24//usage: "\n -o Preserve original dates"
26//usage: "\n -p Extract to stdout" 25//usage: "\n -p Extract to stdout"
27//usage: "\n -t List" 26//usage: "\n -t List"
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index f1829db05..0b0d84994 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -174,7 +174,6 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext)
174//usage: "[-cf] [FILE]..." 174//usage: "[-cf] [FILE]..."
175//usage:#define uncompress_full_usage "\n\n" 175//usage:#define uncompress_full_usage "\n\n"
176//usage: "Decompress .Z file[s]\n" 176//usage: "Decompress .Z file[s]\n"
177//usage: "\nOptions:"
178//usage: "\n -c Write to stdout" 177//usage: "\n -c Write to stdout"
179//usage: "\n -f Overwrite" 178//usage: "\n -f Overwrite"
180 179
@@ -234,7 +233,6 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
234//usage: "[-cft] [FILE]..." 233//usage: "[-cft] [FILE]..."
235//usage:#define gunzip_full_usage "\n\n" 234//usage:#define gunzip_full_usage "\n\n"
236//usage: "Decompress FILEs (or stdin)\n" 235//usage: "Decompress FILEs (or stdin)\n"
237//usage: "\nOptions:"
238//usage: "\n -c Write to stdout" 236//usage: "\n -c Write to stdout"
239//usage: "\n -f Force" 237//usage: "\n -f Force"
240//usage: "\n -t Test file integrity" 238//usage: "\n -t Test file integrity"
@@ -341,7 +339,6 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
341//usage: "[-cf] [FILE]..." 339//usage: "[-cf] [FILE]..."
342//usage:#define bunzip2_full_usage "\n\n" 340//usage:#define bunzip2_full_usage "\n\n"
343//usage: "Decompress FILEs (or stdin)\n" 341//usage: "Decompress FILEs (or stdin)\n"
344//usage: "\nOptions:"
345//usage: "\n -c Write to stdout" 342//usage: "\n -c Write to stdout"
346//usage: "\n -f Force" 343//usage: "\n -f Force"
347//usage:#define bzcat_trivial_usage 344//usage:#define bzcat_trivial_usage
@@ -382,7 +379,6 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv)
382//usage: "[-cf] [FILE]..." 379//usage: "[-cf] [FILE]..."
383//usage:#define unlzma_full_usage "\n\n" 380//usage:#define unlzma_full_usage "\n\n"
384//usage: "Decompress FILE (or stdin)\n" 381//usage: "Decompress FILE (or stdin)\n"
385//usage: "\nOptions:"
386//usage: "\n -c Write to stdout" 382//usage: "\n -c Write to stdout"
387//usage: "\n -f Force" 383//usage: "\n -f Force"
388//usage: 384//usage:
@@ -390,7 +386,6 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv)
390//usage: "-d [-cf] [FILE]..." 386//usage: "-d [-cf] [FILE]..."
391//usage:#define lzma_full_usage "\n\n" 387//usage:#define lzma_full_usage "\n\n"
392//usage: "Decompress FILE (or stdin)\n" 388//usage: "Decompress FILE (or stdin)\n"
393//usage: "\nOptions:"
394//usage: "\n -d Decompress" 389//usage: "\n -d Decompress"
395//usage: "\n -c Write to stdout" 390//usage: "\n -c Write to stdout"
396//usage: "\n -f Force" 391//usage: "\n -f Force"
@@ -404,7 +399,6 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv)
404//usage: "[-cf] [FILE]..." 399//usage: "[-cf] [FILE]..."
405//usage:#define unxz_full_usage "\n\n" 400//usage:#define unxz_full_usage "\n\n"
406//usage: "Decompress FILE (or stdin)\n" 401//usage: "Decompress FILE (or stdin)\n"
407//usage: "\nOptions:"
408//usage: "\n -c Write to stdout" 402//usage: "\n -c Write to stdout"
409//usage: "\n -f Force" 403//usage: "\n -f Force"
410//usage: 404//usage:
@@ -412,7 +406,6 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv)
412//usage: "-d [-cf] [FILE]..." 406//usage: "-d [-cf] [FILE]..."
413//usage:#define xz_full_usage "\n\n" 407//usage:#define xz_full_usage "\n\n"
414//usage: "Decompress FILE (or stdin)\n" 408//usage: "Decompress FILE (or stdin)\n"
415//usage: "\nOptions:"
416//usage: "\n -d Decompress" 409//usage: "\n -d Decompress"
417//usage: "\n -c Write to stdout" 410//usage: "\n -c Write to stdout"
418//usage: "\n -f Force" 411//usage: "\n -f Force"
diff --git a/archival/bzip2.c b/archival/bzip2.c
index cfaf5fe20..e39d7f704 100644
--- a/archival/bzip2.c
+++ b/archival/bzip2.c
@@ -11,7 +11,6 @@
11//usage: "[OPTIONS] [FILE]..." 11//usage: "[OPTIONS] [FILE]..."
12//usage:#define bzip2_full_usage "\n\n" 12//usage:#define bzip2_full_usage "\n\n"
13//usage: "Compress FILEs (or stdin) with bzip2 algorithm\n" 13//usage: "Compress FILEs (or stdin) with bzip2 algorithm\n"
14//usage: "\nOptions:"
15//usage: "\n -1..9 Compression level" 14//usage: "\n -1..9 Compression level"
16//usage: "\n -d Decompress" 15//usage: "\n -d Decompress"
17//usage: "\n -c Write to stdout" 16//usage: "\n -c Write to stdout"
diff --git a/archival/cpio.c b/archival/cpio.c
index c746a71fa..9674a046b 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -34,7 +34,6 @@
34//usage: IF_FEATURE_CPIO_P( 34//usage: IF_FEATURE_CPIO_P(
35//usage: "\n -p DIR Copy files to DIR" 35//usage: "\n -p DIR Copy files to DIR"
36//usage: ) 36//usage: )
37//usage: "\nOptions:"
38//usage: "\n -d Make leading directories" 37//usage: "\n -d Make leading directories"
39//usage: "\n -m Preserve mtime" 38//usage: "\n -m Preserve mtime"
40//usage: "\n -v Verbose" 39//usage: "\n -v Verbose"
diff --git a/archival/dpkg.c b/archival/dpkg.c
index 8899d1719..2a6a7b3bf 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -32,7 +32,6 @@
32//usage: "[-ilCPru] [-F OPT] PACKAGE" 32//usage: "[-ilCPru] [-F OPT] PACKAGE"
33//usage:#define dpkg_full_usage "\n\n" 33//usage:#define dpkg_full_usage "\n\n"
34//usage: "Install, remove and manage Debian packages\n" 34//usage: "Install, remove and manage Debian packages\n"
35//usage: "\nOptions:"
36//usage: IF_LONG_OPTS( 35//usage: IF_LONG_OPTS(
37//usage: "\n -i,--install Install the package" 36//usage: "\n -i,--install Install the package"
38//usage: "\n -l,--list List of installed packages" 37//usage: "\n -l,--list List of installed packages"
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 9e1e811ee..5d814d7ef 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -9,7 +9,6 @@
9//usage: "[-cefxX] FILE [argument" 9//usage: "[-cefxX] FILE [argument"
10//usage:#define dpkg_deb_full_usage "\n\n" 10//usage:#define dpkg_deb_full_usage "\n\n"
11//usage: "Perform actions on Debian packages (.debs)\n" 11//usage: "Perform actions on Debian packages (.debs)\n"
12//usage: "\nOptions:"
13//usage: "\n -c List contents of filesystem tree" 12//usage: "\n -c List contents of filesystem tree"
14//usage: "\n -e Extract control files to [argument] directory" 13//usage: "\n -e Extract control files to [argument] directory"
15//usage: "\n -f Display control field name starting with [argument]" 14//usage: "\n -f Display control field name starting with [argument]"
diff --git a/archival/gzip.c b/archival/gzip.c
index b2f9b2dc2..507f5b151 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -43,7 +43,6 @@ aa: 85.1% -- replaced with aa.gz
43//usage: "[-cfd] [FILE]..." 43//usage: "[-cfd] [FILE]..."
44//usage:#define gzip_full_usage "\n\n" 44//usage:#define gzip_full_usage "\n\n"
45//usage: "Compress FILEs (or stdin)\n" 45//usage: "Compress FILEs (or stdin)\n"
46//usage: "\nOptions:"
47//usage: "\n -d Decompress" 46//usage: "\n -d Decompress"
48//usage: "\n -c Write to stdout" 47//usage: "\n -c Write to stdout"
49//usage: "\n -f Force" 48//usage: "\n -f Force"
diff --git a/archival/lzop.c b/archival/lzop.c
index f4419910f..1326bd790 100644
--- a/archival/lzop.c
+++ b/archival/lzop.c
@@ -28,8 +28,7 @@
28//usage:#define lzop_trivial_usage 28//usage:#define lzop_trivial_usage
29//usage: "[-cfvd123456789CF] [FILE]..." 29//usage: "[-cfvd123456789CF] [FILE]..."
30//usage:#define lzop_full_usage "\n\n" 30//usage:#define lzop_full_usage "\n\n"
31//usage: "Options:" 31//usage: " -1..9 Compression level"
32//usage: "\n -1..9 Compression level"
33//usage: "\n -d Decompress" 32//usage: "\n -d Decompress"
34//usage: "\n -c Write to stdout" 33//usage: "\n -c Write to stdout"
35//usage: "\n -f Force" 34//usage: "\n -f Force"
@@ -46,8 +45,7 @@
46//usage:#define unlzop_trivial_usage 45//usage:#define unlzop_trivial_usage
47//usage: "[-cfvCF] [FILE]..." 46//usage: "[-cfvCF] [FILE]..."
48//usage:#define unlzop_full_usage "\n\n" 47//usage:#define unlzop_full_usage "\n\n"
49//usage: "Options:" 48//usage: " -c Write to stdout"
50//usage: "\n -c Write to stdout"
51//usage: "\n -f Force" 49//usage: "\n -f Force"
52//usage: "\n -v Verbose" 50//usage: "\n -v Verbose"
53//usage: "\n -F Don't store or verify checksum" 51//usage: "\n -F Don't store or verify checksum"
diff --git a/archival/rpm.c b/archival/rpm.c
index 98a45d9cc..8174f4869 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -14,7 +14,6 @@
14//usage: "\nCommands:" 14//usage: "\nCommands:"
15//usage: "\n -i Install package" 15//usage: "\n -i Install package"
16//usage: "\n -qp Query package" 16//usage: "\n -qp Query package"
17//usage: "\nOptions:"
18//usage: "\n -i Show information" 17//usage: "\n -i Show information"
19//usage: "\n -l List contents" 18//usage: "\n -l List contents"
20//usage: "\n -d List documents" 19//usage: "\n -d List documents"
diff --git a/archival/tar.c b/archival/tar.c
index fca2d068b..612b2119b 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -761,7 +761,6 @@ static void handle_SIGCHLD(int status)
761//usage: ) 761//usage: )
762//usage: "\n x Extract" 762//usage: "\n x Extract"
763//usage: "\n t List" 763//usage: "\n t List"
764//usage: "\nOptions:"
765//usage: "\n f Name of TARFILE ('-' for stdin/out)" 764//usage: "\n f Name of TARFILE ('-' for stdin/out)"
766//usage: "\n C Change to DIR before operation" 765//usage: "\n C Change to DIR before operation"
767//usage: "\n v Verbose" 766//usage: "\n v Verbose"
diff --git a/archival/unzip.c b/archival/unzip.c
index 52b0a6414..4fa729326 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -23,7 +23,6 @@
23//usage: "[-opts[modifiers]] FILE[.zip] [LIST] [-x XLIST] [-d DIR]" 23//usage: "[-opts[modifiers]] FILE[.zip] [LIST] [-x XLIST] [-d DIR]"
24//usage:#define unzip_full_usage "\n\n" 24//usage:#define unzip_full_usage "\n\n"
25//usage: "Extract files from ZIP archives\n" 25//usage: "Extract files from ZIP archives\n"
26//usage: "\nOptions:"
27//usage: "\n -l List archive contents (with -q for short form)" 26//usage: "\n -l List archive contents (with -q for short form)"
28//usage: "\n -n Never overwrite files (default)" 27//usage: "\n -n Never overwrite files (default)"
29//usage: "\n -o Overwrite" 28//usage: "\n -o Overwrite"
diff --git a/console-tools/kbd_mode.c b/console-tools/kbd_mode.c
index 221a9f782..138536721 100644
--- a/console-tools/kbd_mode.c
+++ b/console-tools/kbd_mode.c
@@ -13,7 +13,6 @@
13//usage: "[-a|k|s|u] [-C TTY]" 13//usage: "[-a|k|s|u] [-C TTY]"
14//usage:#define kbd_mode_full_usage "\n\n" 14//usage:#define kbd_mode_full_usage "\n\n"
15//usage: "Report or set the keyboard mode\n" 15//usage: "Report or set the keyboard mode\n"
16//usage: "\nOptions:"
17//usage: "\n -a Default (ASCII)" 16//usage: "\n -a Default (ASCII)"
18//usage: "\n -k Medium-raw (keyboard)" 17//usage: "\n -k Medium-raw (keyboard)"
19//usage: "\n -s Raw (scancode)" 18//usage: "\n -s Raw (scancode)"
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index 597519f91..9e887f256 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -23,7 +23,6 @@
23//usage: "FONT [-m MAPFILE] [-C TTY]" 23//usage: "FONT [-m MAPFILE] [-C TTY]"
24//usage:#define setfont_full_usage "\n\n" 24//usage:#define setfont_full_usage "\n\n"
25//usage: "Load a console font\n" 25//usage: "Load a console font\n"
26//usage: "\nOptions:"
27//usage: "\n -m MAPFILE Load console screen map" 26//usage: "\n -m MAPFILE Load console screen map"
28//usage: "\n -C TTY Affect TTY instead of /dev/tty" 27//usage: "\n -C TTY Affect TTY instead of /dev/tty"
29//usage: 28//usage:
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index de5cf93fe..e52356692 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -12,7 +12,6 @@
12//usage: "[-c N] [-sw] [PROG ARGS]" 12//usage: "[-c N] [-sw] [PROG ARGS]"
13//usage:#define openvt_full_usage "\n\n" 13//usage:#define openvt_full_usage "\n\n"
14//usage: "Start PROG on a new virtual terminal\n" 14//usage: "Start PROG on a new virtual terminal\n"
15//usage: "\nOptions:"
16//usage: "\n -c N Use specified VT" 15//usage: "\n -c N Use specified VT"
17//usage: "\n -s Switch to the VT" 16//usage: "\n -s Switch to the VT"
18/* //usage: "\n -l Run PROG as login shell (by prepending '-')" */ 17/* //usage: "\n -l Run PROG as login shell (by prepending '-')" */
diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c
index 771974ae3..c0051dcc8 100644
--- a/console-tools/setconsole.c
+++ b/console-tools/setconsole.c
@@ -12,7 +12,6 @@
12//usage: "[-r" IF_FEATURE_SETCONSOLE_LONG_OPTIONS("|--reset") "] [DEVICE]" 12//usage: "[-r" IF_FEATURE_SETCONSOLE_LONG_OPTIONS("|--reset") "] [DEVICE]"
13//usage:#define setconsole_full_usage "\n\n" 13//usage:#define setconsole_full_usage "\n\n"
14//usage: "Redirect system console output to DEVICE (default: /dev/tty)\n" 14//usage: "Redirect system console output to DEVICE (default: /dev/tty)\n"
15//usage: "\nOptions:"
16//usage: "\n -r Reset output to /dev/console" 15//usage: "\n -r Reset output to /dev/console"
17 16
18#include "libbb.h" 17#include "libbb.h"
diff --git a/console-tools/showkey.c b/console-tools/showkey.c
index 2c832c92c..69b785ec6 100644
--- a/console-tools/showkey.c
+++ b/console-tools/showkey.c
@@ -11,7 +11,6 @@
11//usage: "[-a | -k | -s]" 11//usage: "[-a | -k | -s]"
12//usage:#define showkey_full_usage "\n\n" 12//usage:#define showkey_full_usage "\n\n"
13//usage: "Show keys pressed\n" 13//usage: "Show keys pressed\n"
14//usage: "\nOptions:"
15//usage: "\n -a Display decimal/octal/hex values of the keys" 14//usage: "\n -a Display decimal/octal/hex values of the keys"
16//usage: "\n -k Display interpreted keycodes (default)" 15//usage: "\n -k Display interpreted keycodes (default)"
17//usage: "\n -s Display raw scan-codes" 16//usage: "\n -s Display raw scan-codes"
diff --git a/coreutils/Config.src b/coreutils/Config.src
index 2769aa07d..dcb5add8f 100644
--- a/coreutils/Config.src
+++ b/coreutils/Config.src
@@ -276,12 +276,6 @@ config HOSTID
276 hostid prints the numeric identifier (in hexadecimal) for 276 hostid prints the numeric identifier (in hexadecimal) for
277 the current host. 277 the current host.
278 278
279config ID
280 bool "id"
281 default y
282 help
283 id displays the current user and group ID names.
284
285config INSTALL 279config INSTALL
286 bool "install" 280 bool "install"
287 default y 281 default y
diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src
index 6a41c8318..0681e44b0 100644
--- a/coreutils/Kbuild.src
+++ b/coreutils/Kbuild.src
@@ -37,7 +37,6 @@ lib-$(CONFIG_FOLD) += fold.o
37lib-$(CONFIG_FSYNC) += fsync.o 37lib-$(CONFIG_FSYNC) += fsync.o
38lib-$(CONFIG_HEAD) += head.o 38lib-$(CONFIG_HEAD) += head.o
39lib-$(CONFIG_HOSTID) += hostid.o 39lib-$(CONFIG_HOSTID) += hostid.o
40lib-$(CONFIG_ID) += id.o
41lib-$(CONFIG_INSTALL) += install.o 40lib-$(CONFIG_INSTALL) += install.o
42#lib-$(CONFIG_LENGTH) += length.o 41#lib-$(CONFIG_LENGTH) += length.o
43lib-$(CONFIG_LN) += ln.o 42lib-$(CONFIG_LN) += ln.o
diff --git a/coreutils/cal.c b/coreutils/cal.c
index ef1c29bb9..b470ad968 100644
--- a/coreutils/cal.c
+++ b/coreutils/cal.c
@@ -21,7 +21,6 @@
21//usage: "[-jy] [[MONTH] YEAR]" 21//usage: "[-jy] [[MONTH] YEAR]"
22//usage:#define cal_full_usage "\n\n" 22//usage:#define cal_full_usage "\n\n"
23//usage: "Display a calendar\n" 23//usage: "Display a calendar\n"
24//usage: "\nOptions:"
25//usage: "\n -j Use julian dates" 24//usage: "\n -j Use julian dates"
26//usage: "\n -y Display the entire year" 25//usage: "\n -y Display the entire year"
27 26
diff --git a/coreutils/catv.c b/coreutils/catv.c
index 37c7ed2d1..214b4311a 100644
--- a/coreutils/catv.c
+++ b/coreutils/catv.c
@@ -14,7 +14,6 @@
14//usage: "[-etv] [FILE]..." 14//usage: "[-etv] [FILE]..."
15//usage:#define catv_full_usage "\n\n" 15//usage:#define catv_full_usage "\n\n"
16//usage: "Display nonprinting characters as ^x or M-x\n" 16//usage: "Display nonprinting characters as ^x or M-x\n"
17//usage: "\nOptions:"
18//usage: "\n -e End each line with $" 17//usage: "\n -e End each line with $"
19//usage: "\n -t Show tabs as ^I" 18//usage: "\n -t Show tabs as ^I"
20//usage: "\n -v Don't use ^x or M-x escapes" 19//usage: "\n -v Don't use ^x or M-x escapes"
diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c
index bc9608362..7076db62f 100644
--- a/coreutils/chgrp.c
+++ b/coreutils/chgrp.c
@@ -15,7 +15,6 @@
15//usage: "[-RhLHP"IF_DESKTOP("cvf")"]... GROUP FILE..." 15//usage: "[-RhLHP"IF_DESKTOP("cvf")"]... GROUP FILE..."
16//usage:#define chgrp_full_usage "\n\n" 16//usage:#define chgrp_full_usage "\n\n"
17//usage: "Change the group membership of each FILE to GROUP\n" 17//usage: "Change the group membership of each FILE to GROUP\n"
18//usage: "\nOptions:"
19//usage: "\n -R Recurse" 18//usage: "\n -R Recurse"
20//usage: "\n -h Affect symlinks instead of symlink targets" 19//usage: "\n -h Affect symlinks instead of symlink targets"
21//usage: "\n -L Traverse all symlinks to directories" 20//usage: "\n -L Traverse all symlinks to directories"
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index 0bcd6bb66..5ee45b942 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -19,7 +19,6 @@
19//usage:#define chmod_full_usage "\n\n" 19//usage:#define chmod_full_usage "\n\n"
20//usage: "Each MODE is one or more of the letters ugoa, one of the\n" 20//usage: "Each MODE is one or more of the letters ugoa, one of the\n"
21//usage: "symbols +-= and one or more of the letters rwxst\n" 21//usage: "symbols +-= and one or more of the letters rwxst\n"
22//usage: "\nOptions:"
23//usage: "\n -R Recurse" 22//usage: "\n -R Recurse"
24//usage: IF_DESKTOP( 23//usage: IF_DESKTOP(
25//usage: "\n -c List changed files" 24//usage: "\n -c List changed files"
diff --git a/coreutils/chown.c b/coreutils/chown.c
index c4c182d3c..bb166d8fe 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -14,7 +14,6 @@
14//usage: "[-RhLHP"IF_DESKTOP("cvf")"]... OWNER[<.|:>[GROUP]] FILE..." 14//usage: "[-RhLHP"IF_DESKTOP("cvf")"]... OWNER[<.|:>[GROUP]] FILE..."
15//usage:#define chown_full_usage "\n\n" 15//usage:#define chown_full_usage "\n\n"
16//usage: "Change the owner and/or group of each FILE to OWNER and/or GROUP\n" 16//usage: "Change the owner and/or group of each FILE to OWNER and/or GROUP\n"
17//usage: "\nOptions:"
18//usage: "\n -R Recurse" 17//usage: "\n -R Recurse"
19//usage: "\n -h Affect symlinks instead of symlink targets" 18//usage: "\n -h Affect symlinks instead of symlink targets"
20//usage: "\n -L Traverse all symlinks to directories" 19//usage: "\n -L Traverse all symlinks to directories"
diff --git a/coreutils/comm.c b/coreutils/comm.c
index 7da6b25f9..cd450950b 100644
--- a/coreutils/comm.c
+++ b/coreutils/comm.c
@@ -11,7 +11,6 @@
11//usage: "[-123] FILE1 FILE2" 11//usage: "[-123] FILE1 FILE2"
12//usage:#define comm_full_usage "\n\n" 12//usage:#define comm_full_usage "\n\n"
13//usage: "Compare FILE1 with FILE2\n" 13//usage: "Compare FILE1 with FILE2\n"
14//usage: "\nOptions:"
15//usage: "\n -1 Suppress lines unique to FILE1" 14//usage: "\n -1 Suppress lines unique to FILE1"
16//usage: "\n -2 Suppress lines unique to FILE2" 15//usage: "\n -2 Suppress lines unique to FILE2"
17//usage: "\n -3 Suppress lines common to both files" 16//usage: "\n -3 Suppress lines common to both files"
diff --git a/coreutils/cp.c b/coreutils/cp.c
index c35dc2872..f276d25d7 100644
--- a/coreutils/cp.c
+++ b/coreutils/cp.c
@@ -19,7 +19,6 @@
19//usage: "[OPTIONS] SOURCE DEST" 19//usage: "[OPTIONS] SOURCE DEST"
20//usage:#define cp_full_usage "\n\n" 20//usage:#define cp_full_usage "\n\n"
21//usage: "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY\n" 21//usage: "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY\n"
22//usage: "\nOptions:"
23//usage: "\n -a Same as -dpR" 22//usage: "\n -a Same as -dpR"
24//usage: IF_SELINUX( 23//usage: IF_SELINUX(
25//usage: "\n -c Preserve security context" 24//usage: "\n -c Preserve security context"
diff --git a/coreutils/cut.c b/coreutils/cut.c
index dfa1833b4..2c27b704f 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -13,7 +13,6 @@
13//usage: "[OPTIONS] [FILE]..." 13//usage: "[OPTIONS] [FILE]..."
14//usage:#define cut_full_usage "\n\n" 14//usage:#define cut_full_usage "\n\n"
15//usage: "Print selected fields from each input FILE to stdout\n" 15//usage: "Print selected fields from each input FILE to stdout\n"
16//usage: "\nOptions:"
17//usage: "\n -b LIST Output only bytes from LIST" 16//usage: "\n -b LIST Output only bytes from LIST"
18//usage: "\n -c LIST Output only characters from LIST" 17//usage: "\n -c LIST Output only characters from LIST"
19//usage: "\n -d CHAR Use CHAR instead of tab as the field delimiter" 18//usage: "\n -d CHAR Use CHAR instead of tab as the field delimiter"
diff --git a/coreutils/date.c b/coreutils/date.c
index 497031991..d90e620a0 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -98,7 +98,6 @@
98//usage: "[OPTIONS] [+FMT] [TIME]" 98//usage: "[OPTIONS] [+FMT] [TIME]"
99//usage:#define date_full_usage "\n\n" 99//usage:#define date_full_usage "\n\n"
100//usage: "Display time (using +FMT), or set time\n" 100//usage: "Display time (using +FMT), or set time\n"
101//usage: "\nOptions:"
102//usage: IF_NOT_LONG_OPTS( 101//usage: IF_NOT_LONG_OPTS(
103//usage: "\n [-s] TIME Set time to TIME" 102//usage: "\n [-s] TIME Set time to TIME"
104//usage: "\n -u Work in UTC (don't convert to local time)" 103//usage: "\n -u Work in UTC (don't convert to local time)"
diff --git a/coreutils/dd.c b/coreutils/dd.c
index e4b53c0af..f6869cb26 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -13,7 +13,6 @@
13//usage: " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync]") 13//usage: " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync]")
14//usage:#define dd_full_usage "\n\n" 14//usage:#define dd_full_usage "\n\n"
15//usage: "Copy a file with converting and formatting\n" 15//usage: "Copy a file with converting and formatting\n"
16//usage: "\nOptions:"
17//usage: "\n if=FILE Read from FILE instead of stdin" 16//usage: "\n if=FILE Read from FILE instead of stdin"
18//usage: "\n of=FILE Write to FILE instead of stdout" 17//usage: "\n of=FILE Write to FILE instead of stdout"
19//usage: "\n bs=N Read and write N bytes at a time" 18//usage: "\n bs=N Read and write N bytes at a time"
diff --git a/coreutils/df.c b/coreutils/df.c
index 518e856a2..846cb38ad 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -29,7 +29,6 @@
29//usage: "] [FILESYSTEM]..." 29//usage: "] [FILESYSTEM]..."
30//usage:#define df_full_usage "\n\n" 30//usage:#define df_full_usage "\n\n"
31//usage: "Print filesystem usage statistics\n" 31//usage: "Print filesystem usage statistics\n"
32//usage: "\nOptions:"
33//usage: "\n -P POSIX output format" 32//usage: "\n -P POSIX output format"
34//usage: "\n -k 1024-byte blocks (default)" 33//usage: "\n -k 1024-byte blocks (default)"
35//usage: IF_FEATURE_HUMAN_READABLE( 34//usage: IF_FEATURE_HUMAN_READABLE(
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c
index add1da666..e1fbe8538 100644
--- a/coreutils/dos2unix.c
+++ b/coreutils/dos2unix.c
@@ -17,7 +17,6 @@
17//usage:#define dos2unix_full_usage "\n\n" 17//usage:#define dos2unix_full_usage "\n\n"
18//usage: "Convert FILE in-place from DOS to Unix format.\n" 18//usage: "Convert FILE in-place from DOS to Unix format.\n"
19//usage: "When no file is given, use stdin/stdout.\n" 19//usage: "When no file is given, use stdin/stdout.\n"
20//usage: "\nOptions:"
21//usage: "\n -u dos2unix" 20//usage: "\n -u dos2unix"
22//usage: "\n -d unix2dos" 21//usage: "\n -d unix2dos"
23//usage: 22//usage:
@@ -26,7 +25,6 @@
26//usage:#define unix2dos_full_usage "\n\n" 25//usage:#define unix2dos_full_usage "\n\n"
27//usage: "Convert FILE in-place from Unix to DOS format.\n" 26//usage: "Convert FILE in-place from Unix to DOS format.\n"
28//usage: "When no file is given, use stdin/stdout.\n" 27//usage: "When no file is given, use stdin/stdout.\n"
29//usage: "\nOptions:"
30//usage: "\n -u dos2unix" 28//usage: "\n -u dos2unix"
31//usage: "\n -d unix2dos" 29//usage: "\n -d unix2dos"
32 30
diff --git a/coreutils/du.c b/coreutils/du.c
index 7a6662d1e..b8bbe3d9e 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -31,7 +31,6 @@
31//usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("1024") 31//usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("1024")
32//usage: IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("512") 32//usage: IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("512")
33//usage: " bytes.\n" 33//usage: " bytes.\n"
34//usage: "\nOptions:"
35//usage: "\n -a Show file sizes too" 34//usage: "\n -a Show file sizes too"
36//usage: "\n -L Follow all symlinks" 35//usage: "\n -L Follow all symlinks"
37//usage: "\n -H Follow symlinks on command line" 36//usage: "\n -H Follow symlinks on command line"
diff --git a/coreutils/echo.c b/coreutils/echo.c
index 0895e2940..9663894ec 100644
--- a/coreutils/echo.c
+++ b/coreutils/echo.c
@@ -28,7 +28,6 @@
28//usage:#define echo_full_usage "\n\n" 28//usage:#define echo_full_usage "\n\n"
29//usage: "Print the specified ARGs to stdout" 29//usage: "Print the specified ARGs to stdout"
30//usage: IF_FEATURE_FANCY_ECHO( "\n" 30//usage: IF_FEATURE_FANCY_ECHO( "\n"
31//usage: "\nOptions:"
32//usage: "\n -n Suppress trailing newline" 31//usage: "\n -n Suppress trailing newline"
33//usage: "\n -e Interpret backslash escapes (i.e., \\t=tab)" 32//usage: "\n -e Interpret backslash escapes (i.e., \\t=tab)"
34//usage: "\n -E Don't interpret backslash escapes (default)" 33//usage: "\n -E Don't interpret backslash escapes (default)"
diff --git a/coreutils/env.c b/coreutils/env.c
index 747c668da..807ef13e9 100644
--- a/coreutils/env.c
+++ b/coreutils/env.c
@@ -36,7 +36,6 @@
36//usage:#define env_full_usage "\n\n" 36//usage:#define env_full_usage "\n\n"
37//usage: "Print the current environment or run PROG after setting up\n" 37//usage: "Print the current environment or run PROG after setting up\n"
38//usage: "the specified environment\n" 38//usage: "the specified environment\n"
39//usage: "\nOptions:"
40//usage: "\n -, -i Start with an empty environment" 39//usage: "\n -, -i Start with an empty environment"
41//usage: "\n -u Remove variable from the environment" 40//usage: "\n -u Remove variable from the environment"
42 41
diff --git a/coreutils/expand.c b/coreutils/expand.c
index 73ab0ece3..25bbffc66 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -25,7 +25,6 @@
25//usage: "[-i] [-t N] [FILE]..." 25//usage: "[-i] [-t N] [FILE]..."
26//usage:#define expand_full_usage "\n\n" 26//usage:#define expand_full_usage "\n\n"
27//usage: "Convert tabs to spaces, writing to stdout\n" 27//usage: "Convert tabs to spaces, writing to stdout\n"
28//usage: "\nOptions:"
29//usage: IF_FEATURE_EXPAND_LONG_OPTIONS( 28//usage: IF_FEATURE_EXPAND_LONG_OPTIONS(
30//usage: "\n -i,--initial Don't convert tabs after non blanks" 29//usage: "\n -i,--initial Don't convert tabs after non blanks"
31//usage: "\n -t,--tabs=N Tabstops every N chars" 30//usage: "\n -t,--tabs=N Tabstops every N chars"
@@ -39,7 +38,6 @@
39//usage: "[-fa][-t N] [FILE]..." 38//usage: "[-fa][-t N] [FILE]..."
40//usage:#define unexpand_full_usage "\n\n" 39//usage:#define unexpand_full_usage "\n\n"
41//usage: "Convert spaces to tabs, writing to stdout\n" 40//usage: "Convert spaces to tabs, writing to stdout\n"
42//usage: "\nOptions:"
43//usage: IF_FEATURE_UNEXPAND_LONG_OPTIONS( 41//usage: IF_FEATURE_UNEXPAND_LONG_OPTIONS(
44//usage: "\n -a,--all Convert all blanks" 42//usage: "\n -a,--all Convert all blanks"
45//usage: "\n -f,--first-only Convert only leading blanks" 43//usage: "\n -f,--first-only Convert only leading blanks"
diff --git a/coreutils/fold.c b/coreutils/fold.c
index 3fe668512..0e7306377 100644
--- a/coreutils/fold.c
+++ b/coreutils/fold.c
@@ -14,7 +14,6 @@
14//usage: "[-bs] [-w WIDTH] [FILE]..." 14//usage: "[-bs] [-w WIDTH] [FILE]..."
15//usage:#define fold_full_usage "\n\n" 15//usage:#define fold_full_usage "\n\n"
16//usage: "Wrap input lines in each FILE (or stdin), writing to stdout\n" 16//usage: "Wrap input lines in each FILE (or stdin), writing to stdout\n"
17//usage: "\nOptions:"
18//usage: "\n -b Count bytes rather than columns" 17//usage: "\n -b Count bytes rather than columns"
19//usage: "\n -s Break at spaces" 18//usage: "\n -s Break at spaces"
20//usage: "\n -w Use WIDTH columns instead of 80" 19//usage: "\n -w Use WIDTH columns instead of 80"
diff --git a/coreutils/fsync.c b/coreutils/fsync.c
index 518c5642b..652a41c33 100644
--- a/coreutils/fsync.c
+++ b/coreutils/fsync.c
@@ -11,7 +11,6 @@
11//usage: "[-d] FILE..." 11//usage: "[-d] FILE..."
12//usage:#define fsync_full_usage "\n\n" 12//usage:#define fsync_full_usage "\n\n"
13//usage: "Write files' buffered blocks to disk\n" 13//usage: "Write files' buffered blocks to disk\n"
14//usage: "\nOptions:"
15//usage: "\n -d Avoid syncing metadata" 14//usage: "\n -d Avoid syncing metadata"
16 15
17#include "libbb.h" 16#include "libbb.h"
diff --git a/coreutils/head.c b/coreutils/head.c
index f49320ef4..ec4512765 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -16,7 +16,6 @@
16//usage:#define head_full_usage "\n\n" 16//usage:#define head_full_usage "\n\n"
17//usage: "Print first 10 lines of each FILE (or stdin) to stdout.\n" 17//usage: "Print first 10 lines of each FILE (or stdin) to stdout.\n"
18//usage: "With more than one FILE, precede each with a filename header.\n" 18//usage: "With more than one FILE, precede each with a filename header.\n"
19//usage: "\nOptions:"
20//usage: "\n -n N[kbm] Print first N lines" 19//usage: "\n -n N[kbm] Print first N lines"
21//usage: IF_FEATURE_FANCY_HEAD( 20//usage: IF_FEATURE_FANCY_HEAD(
22//usage: "\n -c N[kbm] Print first N bytes" 21//usage: "\n -c N[kbm] Print first N bytes"
diff --git a/coreutils/id.c b/coreutils/id.c
index 42ed4c749..399d25e34 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -15,11 +15,28 @@
15 * Added -G option Tito Ragusa (C) 2008 for SUSv3. 15 * Added -G option Tito Ragusa (C) 2008 for SUSv3.
16 */ 16 */
17 17
18//config:config ID
19//config: bool "id"
20//config: default y
21//config: help
22//config: id displays the current user and group ID names.
23
24//config:config GROUPS
25//config: bool "groups"
26//config: default y
27//config: help
28//config: Print the group names associated with current user id.
29
30//kbuild:lib-$(CONFIG_GROUPS) += id.o
31//kbuild:lib-$(CONFIG_ID) += id.o
32
33//applet:IF_GROUPS(APPLET_NOEXEC(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups))
34//applet:IF_ID( APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id ))
35
18//usage:#define id_trivial_usage 36//usage:#define id_trivial_usage
19//usage: "[OPTIONS] [USER]" 37//usage: "[OPTIONS] [USER]"
20//usage:#define id_full_usage "\n\n" 38//usage:#define id_full_usage "\n\n"
21//usage: "Print information about USER or the current user\n" 39//usage: "Print information about USER or the current user\n"
22//usage: "\nOptions:"
23//usage: IF_SELINUX( 40//usage: IF_SELINUX(
24//usage: "\n -Z Security context" 41//usage: "\n -Z Security context"
25//usage: ) 42//usage: )
@@ -33,6 +50,15 @@
33//usage: "$ id\n" 50//usage: "$ id\n"
34//usage: "uid=1000(andersen) gid=1000(andersen)\n" 51//usage: "uid=1000(andersen) gid=1000(andersen)\n"
35 52
53//usage:#define groups_trivial_usage
54//usage: "[USER]"
55//usage:#define groups_full_usage "\n\n"
56//usage: "Print the group memberships of USER or for the current process"
57//usage:
58//usage:#define groups_example_usage
59//usage: "$ groups\n"
60//usage: "andersen lp dialout cdrom floppy\n"
61
36#include "libbb.h" 62#include "libbb.h"
37 63
38/* This is a NOEXEC applet. Be very careful! */ 64/* This is a NOEXEC applet. Be very careful! */
@@ -91,7 +117,7 @@ static int print_user(uid_t id, const char *prefix)
91 117
92/* On error set *n < 0 and return >= 0 118/* On error set *n < 0 and return >= 0
93 * If *n is too small, update it and return < 0 119 * If *n is too small, update it and return < 0
94 * (ok to trash groups[] in both cases) 120 * (ok to trash groups[] in both cases)
95 * Otherwise fill in groups[] and return >= 0 121 * Otherwise fill in groups[] and return >= 0
96 */ 122 */
97static int get_groups(const char *username, gid_t rgid, gid_t *groups, int *n) 123static int get_groups(const char *username, gid_t rgid, gid_t *groups, int *n)
@@ -105,20 +131,19 @@ static int get_groups(const char *username, gid_t rgid, gid_t *groups, int *n)
105 m = getgrouplist(username, rgid, groups, n); 131 m = getgrouplist(username, rgid, groups, n);
106 /* I guess *n < 0 might indicate error. Anyway, 132 /* I guess *n < 0 might indicate error. Anyway,
107 * malloc'ing -1 bytes won't be good, so: */ 133 * malloc'ing -1 bytes won't be good, so: */
108 //if (*n < 0) 134 if (*n < 0)
109 // return 0; 135 return 0;
110 //return m; 136 return m;
111 //commented out here, happens below anyway
112 } else {
113 /* On error -1 is returned, which ends up in *n */
114 int nn = getgroups(*n, groups);
115 /* 0: nn <= *n, groups[] was big enough; -1 otherwise */
116 m = - (nn > *n);
117 *n = nn;
118 } 137 }
119 if (*n < 0) 138
120 return 0; /* error, don't return < 0! */ 139 *n = getgroups(*n, groups);
121 return m; 140 if (*n >= 0)
141 return *n;
142 /* Error */
143 if (errno == EINVAL) /* *n is too small? */
144 *n = getgroups(0, groups); /* get needed *n */
145 /* if *n >= 0, return -1 (got new *n), else return 0 (error): */
146 return -(*n >= 0);
122} 147}
123 148
124int id_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 149int id_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@@ -136,11 +161,22 @@ int id_main(int argc UNUSED_PARAM, char **argv)
136#if ENABLE_SELINUX 161#if ENABLE_SELINUX
137 security_context_t scontext = NULL; 162 security_context_t scontext = NULL;
138#endif 163#endif
139 /* Don't allow -n -r -nr -ug -rug -nug -rnug -uZ -gZ -GZ*/ 164
140 /* Don't allow more than one username */ 165 if (ENABLE_GROUPS && (!ENABLE_ID || applet_name[0] == 'g')) {
141 opt_complementary = "?1:u--g:g--u:G--u:u--G:g--G:G--g:r?ugG:n?ugG" 166 /* TODO: coreutils groups prepend "USER : " prefix,
167 * and accept many usernames. Example:
168 * # groups root root
169 * root : root
170 * root : root
171 */
172 opt = option_mask32 = getopt32(argv, "") | JUST_ALL_GROUPS | NAME_NOT_NUMBER;
173 } else {
174 /* Don't allow -n -r -nr -ug -rug -nug -rnug -uZ -gZ -GZ*/
175 /* Don't allow more than one username */
176 opt_complementary = "?1:u--g:g--u:G--u:u--G:g--G:G--g:r?ugG:n?ugG"
142 IF_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G"); 177 IF_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G");
143 opt = getopt32(argv, "rnugG" IF_SELINUX("Z")); 178 opt = getopt32(argv, "rnugG" IF_SELINUX("Z"));
179 }
144 180
145 username = argv[optind]; 181 username = argv[optind];
146 if (username) { 182 if (username) {
@@ -177,11 +213,11 @@ int id_main(int argc UNUSED_PARAM, char **argv)
177 /* We are supplying largish buffer, trying 213 /* We are supplying largish buffer, trying
178 * to not run get_groups() twice. That might be slow 214 * to not run get_groups() twice. That might be slow
179 * ("user database in remote SQL server" case) */ 215 * ("user database in remote SQL server" case) */
180 groups = xmalloc(64 * sizeof(gid_t)); 216 groups = xmalloc(64 * sizeof(groups[0]));
181 n = 64; 217 n = 64;
182 if (get_groups(username, rgid, groups, &n) < 0) { 218 if (get_groups(username, rgid, groups, &n) < 0) {
183 /* Need bigger buffer after all */ 219 /* Need bigger buffer after all */
184 groups = xrealloc(groups, n * sizeof(gid_t)); 220 groups = xrealloc(groups, n * sizeof(groups[0]));
185 get_groups(username, rgid, groups, &n); 221 get_groups(username, rgid, groups, &n);
186 } 222 }
187 if (n > 0) { 223 if (n > 0) {
diff --git a/coreutils/install.c b/coreutils/install.c
index fe5f26e79..445497f9a 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -11,7 +11,6 @@
11//usage: "[-cdDsp] [-o USER] [-g GRP] [-m MODE] [SOURCE]... DEST" 11//usage: "[-cdDsp] [-o USER] [-g GRP] [-m MODE] [SOURCE]... DEST"
12//usage:#define install_full_usage "\n\n" 12//usage:#define install_full_usage "\n\n"
13//usage: "Copy files and set attributes\n" 13//usage: "Copy files and set attributes\n"
14//usage: "\nOptions:"
15//usage: "\n -c Just copy (default)" 14//usage: "\n -c Just copy (default)"
16//usage: "\n -d Create directories" 15//usage: "\n -d Create directories"
17//usage: "\n -D Create leading target directories" 16//usage: "\n -D Create leading target directories"
diff --git a/coreutils/ln.c b/coreutils/ln.c
index 2da915a68..88a9a8f91 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -15,7 +15,6 @@
15//usage: "[OPTIONS] TARGET... LINK|DIR" 15//usage: "[OPTIONS] TARGET... LINK|DIR"
16//usage:#define ln_full_usage "\n\n" 16//usage:#define ln_full_usage "\n\n"
17//usage: "Create a link LINK or DIR/TARGET to the specified TARGET(s)\n" 17//usage: "Create a link LINK or DIR/TARGET to the specified TARGET(s)\n"
18//usage: "\nOptions:"
19//usage: "\n -s Make symlinks instead of hardlinks" 18//usage: "\n -s Make symlinks instead of hardlinks"
20//usage: "\n -f Remove existing destinations" 19//usage: "\n -f Remove existing destinations"
21//usage: "\n -n Don't dereference symlinks - treat like normal file" 20//usage: "\n -n Don't dereference symlinks - treat like normal file"
diff --git a/coreutils/ls.c b/coreutils/ls.c
index c967fd462..4abf84513 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -42,7 +42,6 @@
42//usage: IF_FEATURE_AUTOWIDTH(" [-w WIDTH]") " [FILE]..." 42//usage: IF_FEATURE_AUTOWIDTH(" [-w WIDTH]") " [FILE]..."
43//usage:#define ls_full_usage "\n\n" 43//usage:#define ls_full_usage "\n\n"
44//usage: "List directory contents\n" 44//usage: "List directory contents\n"
45//usage: "\nOptions:"
46//usage: "\n -1 One column output" 45//usage: "\n -1 One column output"
47//usage: "\n -a Include entries which start with ." 46//usage: "\n -a Include entries which start with ."
48//usage: "\n -A Like -a, but exclude . and .." 47//usage: "\n -A Like -a, but exclude . and .."
@@ -183,11 +182,10 @@ LIST_LONG = LIST_MODEBITS | LIST_NLINKS | LIST_ID_NAME | LIST_SIZE | \
183/* -Q GNU option, busybox always supports */ 182/* -Q GNU option, busybox always supports */
184/* -k SELinux option, busybox always supports (ignores if !SELinux) */ 183/* -k SELinux option, busybox always supports (ignores if !SELinux) */
185/* Std has -k which means "show sizes in kbytes" */ 184/* Std has -k which means "show sizes in kbytes" */
186/* -FLHRctur Std options, busybox optionally supports */ 185/* -LHRctur Std options, busybox optionally supports */
187/* -p Std option, busybox optionally supports */ 186/* -Fp Std options, busybox optionally supports */
188/* Not fully compatible - we show not only '/' but other chars too */
189/* -SXvhTw GNU options, busybox optionally supports */ 187/* -SXvhTw GNU options, busybox optionally supports */
190/* -T TABWIDTH is ignored (we don't use tabs on output) */ 188/* -T WIDTH Ignored (we don't use tabs on output) */
191/* -KZ SELinux mandated options, busybox optionally supports */ 189/* -KZ SELinux mandated options, busybox optionally supports */
192/* (coreutils 8.4 has no -K, remove it?) */ 190/* (coreutils 8.4 has no -K, remove it?) */
193/* -e I think we made this one up (looks similar to GNU --full-time) */ 191/* -e I think we made this one up (looks similar to GNU --full-time) */
@@ -884,19 +882,29 @@ static int sortcmp(const void *a, const void *b)
884 // instead of branch forest 882 // instead of branch forest
885 if (sort_opts == SORT_SIZE) { 883 if (sort_opts == SORT_SIZE) {
886 dif = (d2->dn_size - d1->dn_size); 884 dif = (d2->dn_size - d1->dn_size);
887 } else if (sort_opts == SORT_ATIME) { 885 } else
886 if (sort_opts == SORT_ATIME) {
888 dif = (d2->dn_atime - d1->dn_atime); 887 dif = (d2->dn_atime - d1->dn_atime);
889 } else if (sort_opts == SORT_CTIME) { 888 } else
889 if (sort_opts == SORT_CTIME) {
890 dif = (d2->dn_ctime - d1->dn_ctime); 890 dif = (d2->dn_ctime - d1->dn_ctime);
891 } else if (sort_opts == SORT_MTIME) { 891 } else
892 if (sort_opts == SORT_MTIME) {
892 dif = (d2->dn_mtime - d1->dn_mtime); 893 dif = (d2->dn_mtime - d1->dn_mtime);
893 } else if (sort_opts == SORT_DIR) { 894 } else
895 if (sort_opts == SORT_DIR) {
894 dif = S_ISDIR(d2->dn_mode) - S_ISDIR(d1->dn_mode); 896 dif = S_ISDIR(d2->dn_mode) - S_ISDIR(d1->dn_mode);
895 /* } else if (sort_opts == SORT_VERSION) { */ 897 } else
896 /* } else if (sort_opts == SORT_EXT) { */ 898#if defined(HAVE_STRVERSCMP) && HAVE_STRVERSCMP == 1
899 if (sort_opts == SORT_VERSION) {
900 dif = strverscmp(d1->name, d2->name);
901 } else
902#endif
903 if (sort_opts == SORT_EXT) {
904 dif = strcmp(strchrnul(d1->name, '.'), strchrnul(d2->name, '.'));
897 } 905 }
898 if (dif == 0) { 906 if (dif == 0) {
899 /* sort by name, or tie_breaker for other sorts */ 907 /* sort by name, use as tie breaker for other sorts */
900 if (ENABLE_LOCALE_SUPPORT) 908 if (ENABLE_LOCALE_SUPPORT)
901 dif = strcoll(d1->name, d2->name); 909 dif = strcoll(d1->name, d2->name);
902 else 910 else
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 050d46701..53fd4d1a8 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -12,7 +12,6 @@
12//usage:#define md5sum_full_usage "\n\n" 12//usage:#define md5sum_full_usage "\n\n"
13//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " MD5 checksums" 13//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " MD5 checksums"
14//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" 14//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n"
15//usage: "\nOptions:"
16//usage: "\n -c Check sums against given list" 15//usage: "\n -c Check sums against given list"
17//usage: "\n -s Don't output anything, status code shows success" 16//usage: "\n -s Don't output anything, status code shows success"
18//usage: "\n -w Warn about improperly formatted checksum lines" 17//usage: "\n -w Warn about improperly formatted checksum lines"
@@ -34,7 +33,6 @@
34//usage:#define sha1sum_full_usage "\n\n" 33//usage:#define sha1sum_full_usage "\n\n"
35//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums" 34//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums"
36//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" 35//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n"
37//usage: "\nOptions:"
38//usage: "\n -c Check sums against given list" 36//usage: "\n -c Check sums against given list"
39//usage: "\n -s Don't output anything, status code shows success" 37//usage: "\n -s Don't output anything, status code shows success"
40//usage: "\n -w Warn about improperly formatted checksum lines" 38//usage: "\n -w Warn about improperly formatted checksum lines"
@@ -46,7 +44,6 @@
46//usage:#define sha256sum_full_usage "\n\n" 44//usage:#define sha256sum_full_usage "\n\n"
47//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA256 checksums" 45//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA256 checksums"
48//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" 46//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n"
49//usage: "\nOptions:"
50//usage: "\n -c Check sums against given list" 47//usage: "\n -c Check sums against given list"
51//usage: "\n -s Don't output anything, status code shows success" 48//usage: "\n -s Don't output anything, status code shows success"
52//usage: "\n -w Warn about improperly formatted checksum lines" 49//usage: "\n -w Warn about improperly formatted checksum lines"
@@ -58,7 +55,6 @@
58//usage:#define sha512sum_full_usage "\n\n" 55//usage:#define sha512sum_full_usage "\n\n"
59//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA512 checksums" 56//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA512 checksums"
60//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" 57//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n"
61//usage: "\nOptions:"
62//usage: "\n -c Check sums against given list" 58//usage: "\n -c Check sums against given list"
63//usage: "\n -s Don't output anything, status code shows success" 59//usage: "\n -s Don't output anything, status code shows success"
64//usage: "\n -w Warn about improperly formatted checksum lines" 60//usage: "\n -w Warn about improperly formatted checksum lines"
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index e425bbe5e..a4429b1cb 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -23,7 +23,6 @@
23//usage: "[OPTIONS] DIRECTORY..." 23//usage: "[OPTIONS] DIRECTORY..."
24//usage:#define mkdir_full_usage "\n\n" 24//usage:#define mkdir_full_usage "\n\n"
25//usage: "Create DIRECTORY\n" 25//usage: "Create DIRECTORY\n"
26//usage: "\nOptions:"
27//usage: "\n -m MODE Mode" 26//usage: "\n -m MODE Mode"
28//usage: "\n -p No error if exists; make parent directories as needed" 27//usage: "\n -p No error if exists; make parent directories as needed"
29//usage: IF_SELINUX( 28//usage: IF_SELINUX(
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c
index 84d8d99dd..ef58325b3 100644
--- a/coreutils/mkfifo.c
+++ b/coreutils/mkfifo.c
@@ -14,7 +14,6 @@
14//usage: "[-m MODE] " IF_SELINUX("[-Z] ") "NAME" 14//usage: "[-m MODE] " IF_SELINUX("[-Z] ") "NAME"
15//usage:#define mkfifo_full_usage "\n\n" 15//usage:#define mkfifo_full_usage "\n\n"
16//usage: "Create named pipe\n" 16//usage: "Create named pipe\n"
17//usage: "\nOptions:"
18//usage: "\n -m MODE Mode (default a=rw)" 17//usage: "\n -m MODE Mode (default a=rw)"
19//usage: IF_SELINUX( 18//usage: IF_SELINUX(
20//usage: "\n -Z Set security context" 19//usage: "\n -Z Set security context"
diff --git a/coreutils/mknod.c b/coreutils/mknod.c
index 50dbd62e3..32d3659ac 100644
--- a/coreutils/mknod.c
+++ b/coreutils/mknod.c
@@ -13,7 +13,6 @@
13//usage: "[-m MODE] " IF_SELINUX("[-Z] ") "NAME TYPE MAJOR MINOR" 13//usage: "[-m MODE] " IF_SELINUX("[-Z] ") "NAME TYPE MAJOR MINOR"
14//usage:#define mknod_full_usage "\n\n" 14//usage:#define mknod_full_usage "\n\n"
15//usage: "Create a special file (block, character, or pipe)\n" 15//usage: "Create a special file (block, character, or pipe)\n"
16//usage: "\nOptions:"
17//usage: "\n -m MODE Creation mode (default a=rw)" 16//usage: "\n -m MODE Creation mode (default a=rw)"
18//usage: IF_SELINUX( 17//usage: IF_SELINUX(
19//usage: "\n -Z Set security context" 18//usage: "\n -Z Set security context"
diff --git a/coreutils/mv.c b/coreutils/mv.c
index 399f391b2..87f4cd5a5 100644
--- a/coreutils/mv.c
+++ b/coreutils/mv.c
@@ -21,7 +21,6 @@
21//usage: "or: mv [-fin] SOURCE... DIRECTORY" 21//usage: "or: mv [-fin] SOURCE... DIRECTORY"
22//usage:#define mv_full_usage "\n\n" 22//usage:#define mv_full_usage "\n\n"
23//usage: "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY\n" 23//usage: "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY\n"
24//usage: "\nOptions:"
25//usage: "\n -f Don't prompt before overwriting" 24//usage: "\n -f Don't prompt before overwriting"
26//usage: "\n -i Interactive, prompt before overwrite" 25//usage: "\n -i Interactive, prompt before overwrite"
27//usage: "\n -n Don't overwrite an existing file" 26//usage: "\n -n Don't overwrite an existing file"
diff --git a/coreutils/nice.c b/coreutils/nice.c
index 2763986e7..ce759916f 100644
--- a/coreutils/nice.c
+++ b/coreutils/nice.c
@@ -11,7 +11,6 @@
11//usage: "[-n ADJUST] [PROG ARGS]" 11//usage: "[-n ADJUST] [PROG ARGS]"
12//usage:#define nice_full_usage "\n\n" 12//usage:#define nice_full_usage "\n\n"
13//usage: "Change scheduling priority, run PROG\n" 13//usage: "Change scheduling priority, run PROG\n"
14//usage: "\nOptions:"
15//usage: "\n -n ADJUST Adjust priority by ADJUST" 14//usage: "\n -n ADJUST Adjust priority by ADJUST"
16 15
17#include <sys/resource.h> 16#include <sys/resource.h>
diff --git a/coreutils/readlink.c b/coreutils/readlink.c
index 1a0eca646..f7ad791ec 100644
--- a/coreutils/readlink.c
+++ b/coreutils/readlink.c
@@ -12,7 +12,6 @@
12//usage:#define readlink_full_usage "\n\n" 12//usage:#define readlink_full_usage "\n\n"
13//usage: "Display the value of a symlink" 13//usage: "Display the value of a symlink"
14//usage: IF_FEATURE_READLINK_FOLLOW( "\n" 14//usage: IF_FEATURE_READLINK_FOLLOW( "\n"
15//usage: "\nOptions:"
16//usage: "\n -f Canonicalize by following all symlinks" 15//usage: "\n -f Canonicalize by following all symlinks"
17//usage: "\n -n Don't add newline" 16//usage: "\n -n Don't add newline"
18//usage: "\n -v Verbose" 17//usage: "\n -v Verbose"
diff --git a/coreutils/rm.c b/coreutils/rm.c
index 8efd895cc..042fba162 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
@@ -19,7 +19,6 @@
19//usage: "[-irf] FILE..." 19//usage: "[-irf] FILE..."
20//usage:#define rm_full_usage "\n\n" 20//usage:#define rm_full_usage "\n\n"
21//usage: "Remove (unlink) FILEs\n" 21//usage: "Remove (unlink) FILEs\n"
22//usage: "\nOptions:"
23//usage: "\n -i Always prompt before removing" 22//usage: "\n -i Always prompt before removing"
24//usage: "\n -f Never prompt" 23//usage: "\n -f Never prompt"
25//usage: "\n -R,-r Recurse" 24//usage: "\n -R,-r Recurse"
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index 0dbd940a1..2840d1cfa 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -14,7 +14,6 @@
14//usage: "[OPTIONS] DIRECTORY..." 14//usage: "[OPTIONS] DIRECTORY..."
15//usage:#define rmdir_full_usage "\n\n" 15//usage:#define rmdir_full_usage "\n\n"
16//usage: "Remove DIRECTORY if it is empty\n" 16//usage: "Remove DIRECTORY if it is empty\n"
17//usage: "\nOptions:"
18//usage: IF_FEATURE_RMDIR_LONG_OPTIONS( 17//usage: IF_FEATURE_RMDIR_LONG_OPTIONS(
19//usage: "\n -p|--parents Include parents" 18//usage: "\n -p|--parents Include parents"
20//usage: "\n --ignore-fail-on-non-empty" 19//usage: "\n --ignore-fail-on-non-empty"
diff --git a/coreutils/seq.c b/coreutils/seq.c
index b600266fd..898619293 100644
--- a/coreutils/seq.c
+++ b/coreutils/seq.c
@@ -12,7 +12,6 @@
12//usage:#define seq_full_usage "\n\n" 12//usage:#define seq_full_usage "\n\n"
13//usage: "Print numbers from FIRST to LAST, in steps of INC.\n" 13//usage: "Print numbers from FIRST to LAST, in steps of INC.\n"
14//usage: "FIRST, INC default to 1.\n" 14//usage: "FIRST, INC default to 1.\n"
15//usage: "\nOptions:"
16//usage: "\n -w Pad to last with leading zeros" 15//usage: "\n -w Pad to last with leading zeros"
17//usage: "\n -s SEP String separator" 16//usage: "\n -s SEP String separator"
18 17
diff --git a/coreutils/sort.c b/coreutils/sort.c
index f709ea1b3..1df07285c 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -18,7 +18,6 @@
18//usage: "] [FILE]..." 18//usage: "] [FILE]..."
19//usage:#define sort_full_usage "\n\n" 19//usage:#define sort_full_usage "\n\n"
20//usage: "Sort lines of text\n" 20//usage: "Sort lines of text\n"
21//usage: "\nOptions:"
22//usage: IF_FEATURE_SORT_BIG( 21//usage: IF_FEATURE_SORT_BIG(
23//usage: "\n -b Ignore leading blanks" 22//usage: "\n -b Ignore leading blanks"
24//usage: "\n -c Check whether input is sorted" 23//usage: "\n -c Check whether input is sorted"
diff --git a/coreutils/split.c b/coreutils/split.c
index f0077077e..11e640442 100644
--- a/coreutils/split.c
+++ b/coreutils/split.c
@@ -13,8 +13,7 @@
13//usage:#define split_trivial_usage 13//usage:#define split_trivial_usage
14//usage: "[OPTIONS] [INPUT [PREFIX]]" 14//usage: "[OPTIONS] [INPUT [PREFIX]]"
15//usage:#define split_full_usage "\n\n" 15//usage:#define split_full_usage "\n\n"
16//usage: "Options:" 16//usage: " -b N[k|m] Split by N (kilo|mega)bytes"
17//usage: "\n -b N[k|m] Split by N (kilo|mega)bytes"
18//usage: "\n -l N Split by N lines" 17//usage: "\n -l N Split by N lines"
19//usage: "\n -a N Use N letters as suffix" 18//usage: "\n -a N Use N letters as suffix"
20//usage: 19//usage:
diff --git a/coreutils/stat.c b/coreutils/stat.c
index e85e51033..2797719dd 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -17,7 +17,6 @@
17//usage: "[OPTIONS] FILE..." 17//usage: "[OPTIONS] FILE..."
18//usage:#define stat_full_usage "\n\n" 18//usage:#define stat_full_usage "\n\n"
19//usage: "Display file (default) or filesystem status\n" 19//usage: "Display file (default) or filesystem status\n"
20//usage: "\nOptions:"
21//usage: IF_FEATURE_STAT_FORMAT( 20//usage: IF_FEATURE_STAT_FORMAT(
22//usage: "\n -c fmt Use the specified format" 21//usage: "\n -c fmt Use the specified format"
23//usage: ) 22//usage: )
diff --git a/coreutils/stty.c b/coreutils/stty.c
index af2347161..7f057ead2 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -26,7 +26,6 @@
26//usage:#define stty_full_usage "\n\n" 26//usage:#define stty_full_usage "\n\n"
27//usage: "Without arguments, prints baud rate, line discipline,\n" 27//usage: "Without arguments, prints baud rate, line discipline,\n"
28//usage: "and deviations from stty sane\n" 28//usage: "and deviations from stty sane\n"
29//usage: "\nOptions:"
30//usage: "\n -F DEVICE Open device instead of stdin" 29//usage: "\n -F DEVICE Open device instead of stdin"
31//usage: "\n -a Print all current settings in human-readable form" 30//usage: "\n -a Print all current settings in human-readable form"
32//usage: "\n -g Print in stty-readable form" 31//usage: "\n -g Print in stty-readable form"
diff --git a/coreutils/sum.c b/coreutils/sum.c
index 9e6b0c5b1..95110a6da 100644
--- a/coreutils/sum.c
+++ b/coreutils/sum.c
@@ -17,7 +17,6 @@
17//usage: "[-rs] [FILE]..." 17//usage: "[-rs] [FILE]..."
18//usage:#define sum_full_usage "\n\n" 18//usage:#define sum_full_usage "\n\n"
19//usage: "Checksum and count the blocks in a file\n" 19//usage: "Checksum and count the blocks in a file\n"
20//usage: "\nOptions:"
21//usage: "\n -r Use BSD sum algorithm (1K blocks)" 20//usage: "\n -r Use BSD sum algorithm (1K blocks)"
22//usage: "\n -s Use System V sum algorithm (512byte blocks)" 21//usage: "\n -s Use System V sum algorithm (512byte blocks)"
23 22
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 4b42ebc52..454c25936 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -29,7 +29,6 @@
29//usage:#define tail_full_usage "\n\n" 29//usage:#define tail_full_usage "\n\n"
30//usage: "Print last 10 lines of each FILE (or stdin) to stdout.\n" 30//usage: "Print last 10 lines of each FILE (or stdin) to stdout.\n"
31//usage: "With more than one FILE, precede each with a filename header.\n" 31//usage: "With more than one FILE, precede each with a filename header.\n"
32//usage: "\nOptions:"
33//usage: "\n -f Print data as file grows" 32//usage: "\n -f Print data as file grows"
34//usage: IF_FEATURE_FANCY_TAIL( 33//usage: IF_FEATURE_FANCY_TAIL(
35//usage: "\n -s SECONDS Wait SECONDS between reads with -f" 34//usage: "\n -s SECONDS Wait SECONDS between reads with -f"
diff --git a/coreutils/tee.c b/coreutils/tee.c
index 3e3164e70..48cc0508f 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -14,7 +14,6 @@
14//usage: "[-ai] [FILE]..." 14//usage: "[-ai] [FILE]..."
15//usage:#define tee_full_usage "\n\n" 15//usage:#define tee_full_usage "\n\n"
16//usage: "Copy stdin to each FILE, and also to stdout\n" 16//usage: "Copy stdin to each FILE, and also to stdout\n"
17//usage: "\nOptions:"
18//usage: "\n -a Append to the given FILEs, don't overwrite" 17//usage: "\n -a Append to the given FILEs, don't overwrite"
19//usage: "\n -i Ignore interrupt signals (SIGINT)" 18//usage: "\n -i Ignore interrupt signals (SIGINT)"
20//usage: 19//usage:
diff --git a/coreutils/touch.c b/coreutils/touch.c
index c51fb70ca..0f980fd7b 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -34,7 +34,6 @@
34//usage: "[-c]" IF_DESKTOP(" [-d DATE] [-r FILE]") " FILE [FILE]..." 34//usage: "[-c]" IF_DESKTOP(" [-d DATE] [-r FILE]") " FILE [FILE]..."
35//usage:#define touch_full_usage "\n\n" 35//usage:#define touch_full_usage "\n\n"
36//usage: "Update the last-modified date on the given FILE[s]\n" 36//usage: "Update the last-modified date on the given FILE[s]\n"
37//usage: "\nOptions:"
38//usage: "\n -c Don't create files" 37//usage: "\n -c Don't create files"
39//usage: IF_DESKTOP( 38//usage: IF_DESKTOP(
40//usage: "\n -d DT Date/time to use" 39//usage: "\n -d DT Date/time to use"
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 2f14a414f..e67948a36 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -51,7 +51,6 @@
51//usage: "[-cds] STRING1 [STRING2]" 51//usage: "[-cds] STRING1 [STRING2]"
52//usage:#define tr_full_usage "\n\n" 52//usage:#define tr_full_usage "\n\n"
53//usage: "Translate, squeeze, or delete characters from stdin, writing to stdout\n" 53//usage: "Translate, squeeze, or delete characters from stdin, writing to stdout\n"
54//usage: "\nOptions:"
55//usage: "\n -c Take complement of STRING1" 54//usage: "\n -c Take complement of STRING1"
56//usage: "\n -d Delete input characters coded STRING1" 55//usage: "\n -d Delete input characters coded STRING1"
57//usage: "\n -s Squeeze multiple output characters of STRING2 into one character" 56//usage: "\n -s Squeeze multiple output characters of STRING2 into one character"
diff --git a/coreutils/tty.c b/coreutils/tty.c
index 67399cbf3..45175054e 100644
--- a/coreutils/tty.c
+++ b/coreutils/tty.c
@@ -15,7 +15,6 @@
15//usage:#define tty_full_usage "\n\n" 15//usage:#define tty_full_usage "\n\n"
16//usage: "Print file name of stdin's terminal" 16//usage: "Print file name of stdin's terminal"
17//usage: IF_INCLUDE_SUSv2( "\n" 17//usage: IF_INCLUDE_SUSv2( "\n"
18//usage: "\nOptions:"
19//usage: "\n -s Print nothing, only return exit status" 18//usage: "\n -s Print nothing, only return exit status"
20//usage: ) 19//usage: )
21//usage: 20//usage:
diff --git a/coreutils/uname.c b/coreutils/uname.c
index 775c450df..3809835a4 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -52,7 +52,6 @@
52//usage: "[-amnrspv]" 52//usage: "[-amnrspv]"
53//usage:#define uname_full_usage "\n\n" 53//usage:#define uname_full_usage "\n\n"
54//usage: "Print system information\n" 54//usage: "Print system information\n"
55//usage: "\nOptions:"
56//usage: "\n -a Print all" 55//usage: "\n -a Print all"
57//usage: "\n -m The machine (hardware) type" 56//usage: "\n -m The machine (hardware) type"
58//usage: "\n -n Hostname" 57//usage: "\n -n Hostname"
diff --git a/coreutils/uniq.c b/coreutils/uniq.c
index 6e764d8a4..9208d34ec 100644
--- a/coreutils/uniq.c
+++ b/coreutils/uniq.c
@@ -14,7 +14,6 @@
14//usage: "[-cdu][-f,s,w N] [INPUT [OUTPUT]]" 14//usage: "[-cdu][-f,s,w N] [INPUT [OUTPUT]]"
15//usage:#define uniq_full_usage "\n\n" 15//usage:#define uniq_full_usage "\n\n"
16//usage: "Discard duplicate lines\n" 16//usage: "Discard duplicate lines\n"
17//usage: "\nOptions:"
18//usage: "\n -c Prefix lines by the number of occurrences" 17//usage: "\n -c Prefix lines by the number of occurrences"
19//usage: "\n -d Only print duplicate lines" 18//usage: "\n -d Only print duplicate lines"
20//usage: "\n -u Only print unique lines" 19//usage: "\n -u Only print unique lines"
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index 47a155ecb..6ecfe6cef 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -158,7 +158,6 @@ int uudecode_main(int argc UNUSED_PARAM, char **argv)
158//usage: "[-d] [FILE]" 158//usage: "[-d] [FILE]"
159//usage:#define base64_full_usage "\n\n" 159//usage:#define base64_full_usage "\n\n"
160//usage: "Base64 encode or decode FILE to standard output" 160//usage: "Base64 encode or decode FILE to standard output"
161//usage: "\nOptions:"
162//usage: "\n -d Decode data" 161//usage: "\n -d Decode data"
163////usage: "\n -w COL Wrap lines at COL (default 76, 0 disables)" 162////usage: "\n -w COL Wrap lines at COL (default 76, 0 disables)"
164////usage: "\n -i When decoding, ignore non-alphabet characters" 163////usage: "\n -i When decoding, ignore non-alphabet characters"
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c
index b4cd0a9e6..84a489a11 100644
--- a/coreutils/uuencode.c
+++ b/coreutils/uuencode.c
@@ -12,7 +12,6 @@
12//usage: "[-m] [INFILE] STORED_FILENAME" 12//usage: "[-m] [INFILE] STORED_FILENAME"
13//usage:#define uuencode_full_usage "\n\n" 13//usage:#define uuencode_full_usage "\n\n"
14//usage: "Uuencode a file to stdout\n" 14//usage: "Uuencode a file to stdout\n"
15//usage: "\nOptions:"
16//usage: "\n -m Use base64 encoding per RFC1521" 15//usage: "\n -m Use base64 encoding per RFC1521"
17//usage: 16//usage:
18//usage:#define uuencode_example_usage 17//usage:#define uuencode_example_usage
diff --git a/coreutils/wc.c b/coreutils/wc.c
index 6e22c66c8..a410e407a 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -64,7 +64,6 @@
64//usage: 64//usage:
65//usage:#define wc_full_usage "\n\n" 65//usage:#define wc_full_usage "\n\n"
66//usage: "Count lines, words, and bytes for each FILE (or stdin)\n" 66//usage: "Count lines, words, and bytes for each FILE (or stdin)\n"
67//usage: "\nOptions:"
68//usage: "\n -c Count bytes" 67//usage: "\n -c Count bytes"
69//usage: IF_UNICODE_SUPPORT( 68//usage: IF_UNICODE_SUPPORT(
70//usage: "\n -m Count characters" 69//usage: "\n -m Count characters"
diff --git a/coreutils/who.c b/coreutils/who.c
index ec385bf95..9f37f65fd 100644
--- a/coreutils/who.c
+++ b/coreutils/who.c
@@ -22,7 +22,6 @@
22//usage: "[-a]" 22//usage: "[-a]"
23//usage:#define who_full_usage "\n\n" 23//usage:#define who_full_usage "\n\n"
24//usage: "Show who is logged on\n" 24//usage: "Show who is logged on\n"
25//usage: "\nOptions:"
26//usage: "\n -a Show all" 25//usage: "\n -a Show all"
27 26
28#include "libbb.h" 27#include "libbb.h"
diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c
index f4961af59..007cb1c5b 100644
--- a/debianutils/mktemp.c
+++ b/debianutils/mktemp.c
@@ -37,7 +37,6 @@
37//usage: "Create a temporary file with name based on TEMPLATE and print its name.\n" 37//usage: "Create a temporary file with name based on TEMPLATE and print its name.\n"
38//usage: "TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).\n" 38//usage: "TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).\n"
39//usage: "Without TEMPLATE, -t tmp.XXXXXX is assumed.\n" 39//usage: "Without TEMPLATE, -t tmp.XXXXXX is assumed.\n"
40//usage: "\nOptions:"
41//usage: "\n -d Make directory, not file" 40//usage: "\n -d Make directory, not file"
42////usage: "\n -q Fail silently on errors" - we ignore this opt 41////usage: "\n -q Fail silently on errors" - we ignore this opt
43//usage: "\n -t Prepend base directory name to TEMPLATE" 42//usage: "\n -t Prepend base directory name to TEMPLATE"
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c
index 0c2302696..65cbfc338 100644
--- a/debianutils/run_parts.c
+++ b/debianutils/run_parts.c
@@ -34,7 +34,6 @@
34//usage: "[-t] "IF_FEATURE_RUN_PARTS_FANCY("[-l] ")"[-a ARG] [-u MASK] DIRECTORY" 34//usage: "[-t] "IF_FEATURE_RUN_PARTS_FANCY("[-l] ")"[-a ARG] [-u MASK] DIRECTORY"
35//usage:#define run_parts_full_usage "\n\n" 35//usage:#define run_parts_full_usage "\n\n"
36//usage: "Run a bunch of scripts in DIRECTORY\n" 36//usage: "Run a bunch of scripts in DIRECTORY\n"
37//usage: "\nOptions:"
38//usage: "\n -t Print what would be run, but don't actually run anything" 37//usage: "\n -t Print what would be run, but don't actually run anything"
39//usage: "\n -a ARG Pass ARG as argument for every program" 38//usage: "\n -a ARG Pass ARG as argument for every program"
40//usage: "\n -u MASK Set the umask to MASK before running every program" 39//usage: "\n -u MASK Set the umask to MASK before running every program"
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c
index b1c77faad..f1cc8389f 100644
--- a/e2fsprogs/chattr.c
+++ b/e2fsprogs/chattr.c
@@ -39,7 +39,6 @@
39//usage: "\n S Write file contents synchronously" 39//usage: "\n S Write file contents synchronously"
40//usage: "\n t Disable tail-merging of partial blocks with other files" 40//usage: "\n t Disable tail-merging of partial blocks with other files"
41//usage: "\n u Allow file to be undeleted" 41//usage: "\n u Allow file to be undeleted"
42//usage: "\nOptions:"
43//usage: "\n -R Recurse" 42//usage: "\n -R Recurse"
44//usage: "\n -v Set the file's version/generation number" 43//usage: "\n -v Set the file's version/generation number"
45 44
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index fcbdb5989..4b2f774f5 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -38,7 +38,6 @@
38//usage: "[-ANPRTV] [-C FD] [-t FSTYPE] [FS_OPTS] [BLOCKDEV]..." 38//usage: "[-ANPRTV] [-C FD] [-t FSTYPE] [FS_OPTS] [BLOCKDEV]..."
39//usage:#define fsck_full_usage "\n\n" 39//usage:#define fsck_full_usage "\n\n"
40//usage: "Check and repair filesystems\n" 40//usage: "Check and repair filesystems\n"
41//usage: "\nOptions:"
42//usage: "\n -A Walk /etc/fstab and check all filesystems" 41//usage: "\n -A Walk /etc/fstab and check all filesystems"
43//usage: "\n -N Don't execute, just show what would be done" 42//usage: "\n -N Don't execute, just show what would be done"
44//usage: "\n -P With -A, check filesystems in parallel" 43//usage: "\n -P With -A, check filesystems in parallel"
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c
index 964e8d026..1312fe754 100644
--- a/e2fsprogs/lsattr.c
+++ b/e2fsprogs/lsattr.c
@@ -22,7 +22,6 @@
22//usage: "[-Radlv] [FILE]..." 22//usage: "[-Radlv] [FILE]..."
23//usage:#define lsattr_full_usage "\n\n" 23//usage:#define lsattr_full_usage "\n\n"
24//usage: "List file attributes on an ext2 fs\n" 24//usage: "List file attributes on an ext2 fs\n"
25//usage: "\nOptions:"
26//usage: "\n -R Recurse" 25//usage: "\n -R Recurse"
27//usage: "\n -a Don't hide entries starting with ." 26//usage: "\n -a Don't hide entries starting with ."
28//usage: "\n -d List directory entries instead of contents" 27//usage: "\n -d List directory entries instead of contents"
diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c
index ad4ff348b..8fffa7f20 100644
--- a/e2fsprogs/old_e2fsprogs/e2fsck.c
+++ b/e2fsprogs/old_e2fsprogs/e2fsck.c
@@ -37,7 +37,6 @@
37//usage: "[-E extended-options] device" 37//usage: "[-E extended-options] device"
38//usage:#define e2fsck_full_usage "\n\n" 38//usage:#define e2fsck_full_usage "\n\n"
39//usage: "Check ext2/ext3 file system\n" 39//usage: "Check ext2/ext3 file system\n"
40//usage: "\nOptions:"
41//usage: "\n -p Automatic repair (no questions)" 40//usage: "\n -p Automatic repair (no questions)"
42//usage: "\n -n Make no changes to the filesystem" 41//usage: "\n -n Make no changes to the filesystem"
43//usage: "\n -y Assume 'yes' to all questions" 42//usage: "\n -y Assume 'yes' to all questions"
diff --git a/editors/Config.src b/editors/Config.src
index 201ee6eb9..af1e1de5e 100644
--- a/editors/Config.src
+++ b/editors/Config.src
@@ -67,123 +67,6 @@ config SED
67 sed is used to perform text transformations on a file 67 sed is used to perform text transformations on a file
68 or input from a pipeline. 68 or input from a pipeline.
69 69
70config VI
71 bool "vi"
72 default y
73 help
74 'vi' is a text editor. More specifically, it is the One True
75 text editor <grin>. It does, however, have a rather steep
76 learning curve. If you are not already comfortable with 'vi'
77 you may wish to use something else.
78
79config FEATURE_VI_MAX_LEN
80 int "Maximum screen width in vi"
81 range 256 16384
82 default 4096
83 depends on VI
84 help
85 Contrary to what you may think, this is not eating much.
86 Make it smaller than 4k only if you are very limited on memory.
87
88config FEATURE_VI_8BIT
89 bool "Allow vi to display 8-bit chars (otherwise shows dots)"
90 default n
91 depends on VI
92 help
93 If your terminal can display characters with high bit set,
94 you may want to enable this. Note: vi is not Unicode-capable.
95 If your terminal combines several 8-bit bytes into one character
96 (as in Unicode mode), this will not work properly.
97
98config FEATURE_VI_COLON
99 bool "Enable \":\" colon commands (no \"ex\" mode)"
100 default y
101 depends on VI
102 help
103 Enable a limited set of colon commands for vi. This does not
104 provide an "ex" mode.
105
106config FEATURE_VI_YANKMARK
107 bool "Enable yank/put commands and mark cmds"
108 default y
109 depends on VI
110 help
111 This will enable you to use yank and put, as well as mark in
112 busybox vi.
113
114config FEATURE_VI_SEARCH
115 bool "Enable search and replace cmds"
116 default y
117 depends on VI
118 help
119 Select this if you wish to be able to do search and replace in
120 busybox vi.
121
122config FEATURE_VI_USE_SIGNALS
123 bool "Catch signals"
124 default y
125 depends on VI
126 help
127 Selecting this option will make busybox vi signal aware. This will
128 make busybox vi support SIGWINCH to deal with Window Changes, catch
129 Ctrl-Z and Ctrl-C and alarms.
130
131config FEATURE_VI_DOT_CMD
132 bool "Remember previous cmd and \".\" cmd"
133 default y
134 depends on VI
135 help
136 Make busybox vi remember the last command and be able to repeat it.
137
138config FEATURE_VI_READONLY
139 bool "Enable -R option and \"view\" mode"
140 default y
141 depends on VI
142 help
143 Enable the read-only command line option, which allows the user to
144 open a file in read-only mode.
145
146config FEATURE_VI_SETOPTS
147 bool "Enable set-able options, ai ic showmatch"
148 default y
149 depends on VI
150 help
151 Enable the editor to set some (ai, ic, showmatch) options.
152
153config FEATURE_VI_SET
154 bool "Support for :set"
155 default y
156 depends on VI
157 help
158 Support for ":set".
159
160config FEATURE_VI_WIN_RESIZE
161 bool "Handle window resize"
162 default y
163 depends on VI
164 help
165 Make busybox vi behave nicely with terminals that get resized.
166
167config FEATURE_VI_ASK_TERMINAL
168 bool "Use 'tell me cursor position' ESC sequence to measure window"
169 default y
170 depends on VI
171 help
172 If terminal size can't be retrieved and $LINES/$COLUMNS are not set,
173 this option makes vi perform a last-ditch effort to find it:
174 vi positions cursor to 999,999 and asks terminal to report real
175 cursor position using "ESC [ 6 n" escape sequence, then reads stdin.
176
177 This is not clean but helps a lot on serial lines and such.
178
179config FEATURE_VI_OPTIMIZE_CURSOR
180 bool "Optimize cursor movement"
181 default y
182 depends on VI
183 help
184 This will make the cursor movement faster, but requires more memory
185 and it makes the applet a tiny bit larger.
186
187config FEATURE_ALLOW_EXEC 70config FEATURE_ALLOW_EXEC
188 bool "Allow vi and awk to execute shell commands" 71 bool "Allow vi and awk to execute shell commands"
189 default y 72 default y
diff --git a/editors/Kbuild.src b/editors/Kbuild.src
index 2f23ae12f..8888cba12 100644
--- a/editors/Kbuild.src
+++ b/editors/Kbuild.src
@@ -12,4 +12,3 @@ lib-$(CONFIG_CMP) += cmp.o
12lib-$(CONFIG_DIFF) += diff.o 12lib-$(CONFIG_DIFF) += diff.o
13lib-$(CONFIG_ED) += ed.o 13lib-$(CONFIG_ED) += ed.o
14lib-$(CONFIG_SED) += sed.o 14lib-$(CONFIG_SED) += sed.o
15lib-$(CONFIG_VI) += vi.o
diff --git a/editors/awk.c b/editors/awk.c
index 9d38b1f88..7685546e5 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -10,8 +10,7 @@
10//usage:#define awk_trivial_usage 10//usage:#define awk_trivial_usage
11//usage: "[OPTIONS] [AWK_PROGRAM] [FILE]..." 11//usage: "[OPTIONS] [AWK_PROGRAM] [FILE]..."
12//usage:#define awk_full_usage "\n\n" 12//usage:#define awk_full_usage "\n\n"
13//usage: "Options:" 13//usage: " -v VAR=VAL Set variable"
14//usage: "\n -v VAR=VAL Set variable"
15//usage: "\n -F SEP Use SEP as field separator" 14//usage: "\n -F SEP Use SEP as field separator"
16//usage: "\n -f FILE Read program from FILE" 15//usage: "\n -f FILE Read program from FILE"
17 16
diff --git a/editors/cmp.c b/editors/cmp.c
index 3a0f5aa4f..fbe6b9753 100644
--- a/editors/cmp.c
+++ b/editors/cmp.c
@@ -14,7 +14,6 @@
14//usage: "[-l] [-s] FILE1 [FILE2" IF_DESKTOP(" [SKIP1 [SKIP2]]") "]" 14//usage: "[-l] [-s] FILE1 [FILE2" IF_DESKTOP(" [SKIP1 [SKIP2]]") "]"
15//usage:#define cmp_full_usage "\n\n" 15//usage:#define cmp_full_usage "\n\n"
16//usage: "Compare FILE1 with FILE2 (or stdin)\n" 16//usage: "Compare FILE1 with FILE2 (or stdin)\n"
17//usage: "\nOptions:"
18//usage: "\n -l Write the byte numbers (decimal) and values (octal)" 17//usage: "\n -l Write the byte numbers (decimal) and values (octal)"
19//usage: "\n for all differing bytes" 18//usage: "\n for all differing bytes"
20//usage: "\n -s Quiet" 19//usage: "\n -s Quiet"
diff --git a/editors/diff.c b/editors/diff.c
index 8b1e92783..8c0a31f47 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -81,7 +81,6 @@
81//usage:#define diff_full_usage "\n\n" 81//usage:#define diff_full_usage "\n\n"
82//usage: "Compare files line by line and output the differences between them.\n" 82//usage: "Compare files line by line and output the differences between them.\n"
83//usage: "This implementation supports unified diffs only.\n" 83//usage: "This implementation supports unified diffs only.\n"
84//usage: "\nOptions:"
85//usage: "\n -a Treat all files as text" 84//usage: "\n -a Treat all files as text"
86//usage: "\n -b Ignore changes in the amount of whitespace" 85//usage: "\n -b Ignore changes in the amount of whitespace"
87//usage: "\n -B Ignore changes whose lines are all blank" 86//usage: "\n -B Ignore changes whose lines are all blank"
diff --git a/editors/patch.c b/editors/patch.c
index 6d3f319b0..ec5b8e7ad 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -15,22 +15,23 @@
15 * -D define wrap #ifdef and #ifndef around changes 15 * -D define wrap #ifdef and #ifndef around changes
16 * -o outfile output here instead of in place 16 * -o outfile output here instead of in place
17 * -r rejectfile write rejected hunks to this file 17 * -r rejectfile write rejected hunks to this file
18 * --dry-run (regression!)
18 * 19 *
19 * -f force (no questions asked) 20 * -f force (no questions asked)
20 * -F fuzz (number, default 2) 21 * -F fuzz (number, default 2)
21 * [file] which file to patch 22 * [file] which file to patch
22 */ 23 */
23 24
24//applet:IF_PATCH(APPLET(patch, BB_DIR_USR_BIN, BB_SUID_DROP))
25
26//kbuild:lib-$(CONFIG_PATCH) += patch.o
27
28//config:config PATCH 25//config:config PATCH
29//config: bool "patch" 26//config: bool "patch"
30//config: default y 27//config: default y
31//config: help 28//config: help
32//config: Apply a unified diff formatted patch. 29//config: Apply a unified diff formatted patch.
33 30
31//applet:IF_PATCH(APPLET(patch, BB_DIR_USR_BIN, BB_SUID_DROP))
32
33//kbuild:lib-$(CONFIG_PATCH) += patch.o
34
34//usage:#define patch_trivial_usage 35//usage:#define patch_trivial_usage
35//usage: "[OPTIONS] [ORIGFILE [PATCHFILE]]" 36//usage: "[OPTIONS] [ORIGFILE [PATCHFILE]]"
36//usage:#define patch_full_usage "\n\n" 37//usage:#define patch_full_usage "\n\n"
@@ -39,7 +40,7 @@
39//usage: "\n -i,--input DIFF Read DIFF instead of stdin" 40//usage: "\n -i,--input DIFF Read DIFF instead of stdin"
40//usage: "\n -R,--reverse Reverse patch" 41//usage: "\n -R,--reverse Reverse patch"
41//usage: "\n -N,--forward Ignore already applied patches" 42//usage: "\n -N,--forward Ignore already applied patches"
42//usage: "\n --dry-run Don't actually change files" 43/*usage: "\n --dry-run Don't actually change files" - TODO */
43//usage: "\n -E,--remove-empty-files Remove output files if they become empty" 44//usage: "\n -E,--remove-empty-files Remove output files if they become empty"
44//usage: ) 45//usage: )
45//usage: IF_NOT_LONG_OPTS( 46//usage: IF_NOT_LONG_OPTS(
@@ -49,6 +50,8 @@
49//usage: "\n -N Ignore already applied patches" 50//usage: "\n -N Ignore already applied patches"
50//usage: "\n -E Remove output files if they become empty" 51//usage: "\n -E Remove output files if they become empty"
51//usage: ) 52//usage: )
53/* -u "interpret as unified diff" is supported but not documented: this info is not useful for --help */
54/* -x "debug" is supported but does nothing */
52//usage: 55//usage:
53//usage:#define patch_example_usage 56//usage:#define patch_example_usage
54//usage: "$ patch -p1 < example.diff\n" 57//usage: "$ patch -p1 < example.diff\n"
@@ -130,8 +133,8 @@ struct globals {
130#define FLAG_INPUT (1 << 3) 133#define FLAG_INPUT (1 << 3)
131#define FLAG_IGNORE (1 << 4) 134#define FLAG_IGNORE (1 << 4)
132#define FLAG_RMEMPTY (1 << 5) 135#define FLAG_RMEMPTY (1 << 5)
133//non-standard: 136/* Enable this bit and use -x for debug output: */
134#define FLAG_DEBUG (1 << 6) 137#define FLAG_DEBUG (0 << 6)
135 138
136// Dispose of a line of input, either by writing it out or discarding it. 139// Dispose of a line of input, either by writing it out or discarding it.
137 140
diff --git a/editors/sed.c b/editors/sed.c
index 99e56ff52..5c4e9cc3b 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -59,8 +59,7 @@
59//usage:#define sed_trivial_usage 59//usage:#define sed_trivial_usage
60//usage: "[-efinr] SED_CMD [FILE]..." 60//usage: "[-efinr] SED_CMD [FILE]..."
61//usage:#define sed_full_usage "\n\n" 61//usage:#define sed_full_usage "\n\n"
62//usage: "Options:" 62//usage: " -e CMD Add CMD to sed commands to be executed"
63//usage: "\n -e CMD Add CMD to sed commands to be executed"
64//usage: "\n -f FILE Add FILE contents to sed commands to be executed" 63//usage: "\n -f FILE Add FILE contents to sed commands to be executed"
65//usage: "\n -i Edit files in-place (else sends result to stdout)" 64//usage: "\n -i Edit files in-place (else sends result to stdout)"
66//usage: "\n -n Suppress automatic printing of pattern space" 65//usage: "\n -n Suppress automatic printing of pattern space"
diff --git a/editors/vi.c b/editors/vi.c
index 9d74acc91..deb471d04 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -21,11 +21,138 @@
21 * An "ex" line oriented mode- maybe using "cmdedit" 21 * An "ex" line oriented mode- maybe using "cmdedit"
22 */ 22 */
23 23
24//config:config VI
25//config: bool "vi"
26//config: default y
27//config: help
28//config: 'vi' is a text editor. More specifically, it is the One True
29//config: text editor <grin>. It does, however, have a rather steep
30//config: learning curve. If you are not already comfortable with 'vi'
31//config: you may wish to use something else.
32//config:
33//config:config FEATURE_VI_MAX_LEN
34//config: int "Maximum screen width in vi"
35//config: range 256 16384
36//config: default 4096
37//config: depends on VI
38//config: help
39//config: Contrary to what you may think, this is not eating much.
40//config: Make it smaller than 4k only if you are very limited on memory.
41//config:
42//config:config FEATURE_VI_8BIT
43//config: bool "Allow vi to display 8-bit chars (otherwise shows dots)"
44//config: default n
45//config: depends on VI
46//config: help
47//config: If your terminal can display characters with high bit set,
48//config: you may want to enable this. Note: vi is not Unicode-capable.
49//config: If your terminal combines several 8-bit bytes into one character
50//config: (as in Unicode mode), this will not work properly.
51//config:
52//config:config FEATURE_VI_COLON
53//config: bool "Enable \":\" colon commands (no \"ex\" mode)"
54//config: default y
55//config: depends on VI
56//config: help
57//config: Enable a limited set of colon commands for vi. This does not
58//config: provide an "ex" mode.
59//config:
60//config:config FEATURE_VI_YANKMARK
61//config: bool "Enable yank/put commands and mark cmds"
62//config: default y
63//config: depends on VI
64//config: help
65//config: This will enable you to use yank and put, as well as mark in
66//config: busybox vi.
67//config:
68//config:config FEATURE_VI_SEARCH
69//config: bool "Enable search and replace cmds"
70//config: default y
71//config: depends on VI
72//config: help
73//config: Select this if you wish to be able to do search and replace in
74//config: busybox vi.
75//config:
76//config:config FEATURE_VI_REGEX_SEARCH
77//config: bool "Enable regex in search and replace"
78//config: default n # Uses GNU regex, which may be unavailable. FIXME
79//config: depends on FEATURE_VI_SEARCH
80//config: help
81//config: Use extended regex search.
82//config:
83//config:config FEATURE_VI_USE_SIGNALS
84//config: bool "Catch signals"
85//config: default y
86//config: depends on VI
87//config: help
88//config: Selecting this option will make busybox vi signal aware. This will
89//config: make busybox vi support SIGWINCH to deal with Window Changes, catch
90//config: Ctrl-Z and Ctrl-C and alarms.
91//config:
92//config:config FEATURE_VI_DOT_CMD
93//config: bool "Remember previous cmd and \".\" cmd"
94//config: default y
95//config: depends on VI
96//config: help
97//config: Make busybox vi remember the last command and be able to repeat it.
98//config:
99//config:config FEATURE_VI_READONLY
100//config: bool "Enable -R option and \"view\" mode"
101//config: default y
102//config: depends on VI
103//config: help
104//config: Enable the read-only command line option, which allows the user to
105//config: open a file in read-only mode.
106//config:
107//config:config FEATURE_VI_SETOPTS
108//config: bool "Enable set-able options, ai ic showmatch"
109//config: default y
110//config: depends on VI
111//config: help
112//config: Enable the editor to set some (ai, ic, showmatch) options.
113//config:
114//config:config FEATURE_VI_SET
115//config: bool "Support for :set"
116//config: default y
117//config: depends on VI
118//config: help
119//config: Support for ":set".
120//config:
121//config:config FEATURE_VI_WIN_RESIZE
122//config: bool "Handle window resize"
123//config: default y
124//config: depends on VI
125//config: help
126//config: Make busybox vi behave nicely with terminals that get resized.
127//config:
128//config:config FEATURE_VI_ASK_TERMINAL
129//config: bool "Use 'tell me cursor position' ESC sequence to measure window"
130//config: default y
131//config: depends on VI
132//config: help
133//config: If terminal size can't be retrieved and $LINES/$COLUMNS are not set,
134//config: this option makes vi perform a last-ditch effort to find it:
135//config: vi positions cursor to 999,999 and asks terminal to report real
136//config: cursor position using "ESC [ 6 n" escape sequence, then reads stdin.
137//config:
138//config: This is not clean but helps a lot on serial lines and such.
139//config:
140//config:config FEATURE_VI_OPTIMIZE_CURSOR
141//config: bool "Optimize cursor movement"
142//config: default y
143//config: depends on VI
144//config: help
145//config: This will make the cursor movement faster, but requires more memory
146//config: and it makes the applet a tiny bit larger.
147
148//applet:IF_VI(APPLET(vi, BB_DIR_BIN, BB_SUID_DROP))
149
150//kbuild:lib-$(CONFIG_VI) += vi.o
151
24//usage:#define vi_trivial_usage 152//usage:#define vi_trivial_usage
25//usage: "[OPTIONS] [FILE]..." 153//usage: "[OPTIONS] [FILE]..."
26//usage:#define vi_full_usage "\n\n" 154//usage:#define vi_full_usage "\n\n"
27//usage: "Edit FILE\n" 155//usage: "Edit FILE\n"
28//usage: "\nOptions:"
29//usage: IF_FEATURE_VI_COLON( 156//usage: IF_FEATURE_VI_COLON(
30//usage: "\n -c Initial command to run ($EXINIT also available)" 157//usage: "\n -c Initial command to run ($EXINIT also available)"
31//usage: ) 158//usage: )
@@ -35,6 +162,10 @@
35//usage: "\n -H Short help regarding available features" 162//usage: "\n -H Short help regarding available features"
36 163
37#include "libbb.h" 164#include "libbb.h"
165/* Should be after libbb.h: on some systems regex.h needs sys/types.h: */
166#if ENABLE_FEATURE_VI_REGEX_SEARCH
167# include <regex.h>
168#endif
38 169
39/* the CRASHME code is unmaintained, and doesn't currently build */ 170/* the CRASHME code is unmaintained, and doesn't currently build */
40#define ENABLE_FEATURE_VI_CRASHME 0 171#define ENABLE_FEATURE_VI_CRASHME 0
@@ -53,9 +184,9 @@
53 184
54/* 0x9b is Meta-ESC */ 185/* 0x9b is Meta-ESC */
55#if ENABLE_FEATURE_VI_8BIT 186#if ENABLE_FEATURE_VI_8BIT
56#define Isprint(c) ((unsigned char)(c) >= ' ' && (c) != 0x7f && (unsigned char)(c) != 0x9b) 187# define Isprint(c) ((unsigned char)(c) >= ' ' && (c) != 0x7f && (unsigned char)(c) != 0x9b)
57#else 188#else
58#define Isprint(c) ((unsigned char)(c) >= ' ' && (unsigned char)(c) < 0x7f) 189# define Isprint(c) ((unsigned char)(c) >= ' ' && (unsigned char)(c) < 0x7f)
59#endif 190#endif
60 191
61#endif 192#endif
@@ -367,7 +498,6 @@ static void Hit_Return(void);
367 498
368#if ENABLE_FEATURE_VI_SEARCH 499#if ENABLE_FEATURE_VI_SEARCH
369static char *char_search(char *, const char *, int, int); // search for pattern starting at p 500static char *char_search(char *, const char *, int, int); // search for pattern starting at p
370static int mycmp(const char *, const char *, int); // string cmp based in "ignorecase"
371#endif 501#endif
372#if ENABLE_FEATURE_VI_COLON 502#if ENABLE_FEATURE_VI_COLON
373static char *get_one_address(char *, int *); // get colon addr, if present 503static char *get_one_address(char *, int *); // get colon addr, if present
@@ -1562,48 +1692,16 @@ static char *new_screen(int ro, int co)
1562} 1692}
1563 1693
1564#if ENABLE_FEATURE_VI_SEARCH 1694#if ENABLE_FEATURE_VI_SEARCH
1565static int mycmp(const char *s1, const char *s2, int len) 1695
1566{ 1696# if ENABLE_FEATURE_VI_REGEX_SEARCH
1567 if (ENABLE_FEATURE_VI_SETOPTS && ignorecase) {
1568 return strncasecmp(s1, s2, len);
1569 }
1570 return strncmp(s1, s2, len);
1571}
1572 1697
1573// search for pattern starting at p 1698// search for pattern starting at p
1574static char *char_search(char *p, const char *pat, int dir, int range) 1699static char *char_search(char *p, const char *pat, int dir, int range)
1575{ 1700{
1576#ifndef REGEX_SEARCH
1577 char *start, *stop;
1578 int len;
1579
1580 len = strlen(pat);
1581 if (dir == FORWARD) {
1582 stop = end - 1; // assume range is p - end-1
1583 if (range == LIMITED)
1584 stop = next_line(p); // range is to next line
1585 for (start = p; start < stop; start++) {
1586 if (mycmp(start, pat, len) == 0) {
1587 return start;
1588 }
1589 }
1590 } else if (dir == BACK) {
1591 stop = text; // assume range is text - p
1592 if (range == LIMITED)
1593 stop = prev_line(p); // range is to prev line
1594 for (start = p - len; start >= stop; start--) {
1595 if (mycmp(start, pat, len) == 0) {
1596 return start;
1597 }
1598 }
1599 }
1600 // pattern not found
1601 return NULL;
1602#else /* REGEX_SEARCH */
1603 char *q; 1701 char *q;
1604 struct re_pattern_buffer preg; 1702 struct re_pattern_buffer preg;
1605 int i; 1703 int i;
1606 int size, range; 1704 int size;
1607 1705
1608 re_syntax_options = RE_SYNTAX_POSIX_EXTENDED; 1706 re_syntax_options = RE_SYNTAX_POSIX_EXTENDED;
1609 preg.translate = 0; 1707 preg.translate = 0;
@@ -1626,7 +1724,7 @@ static char *char_search(char *p, const char *pat, int dir, int range)
1626 // RANGE could be negative if we are searching backwards 1724 // RANGE could be negative if we are searching backwards
1627 range = q - p; 1725 range = q - p;
1628 1726
1629 q = re_compile_pattern(pat, strlen(pat), &preg); 1727 q = (char *)re_compile_pattern(pat, strlen(pat), (struct re_pattern_buffer *)&preg);
1630 if (q != 0) { 1728 if (q != 0) {
1631 // The pattern was not compiled 1729 // The pattern was not compiled
1632 status_line_bold("bad search pattern: \"%s\": %s", pat, q); 1730 status_line_bold("bad search pattern: \"%s\": %s", pat, q);
@@ -1660,8 +1758,53 @@ static char *char_search(char *p, const char *pat, int dir, int range)
1660 p = p - i; 1758 p = p - i;
1661 } 1759 }
1662 return p; 1760 return p;
1663#endif /* REGEX_SEARCH */
1664} 1761}
1762
1763# else
1764
1765# if ENABLE_FEATURE_VI_SETOPTS
1766static int mycmp(const char *s1, const char *s2, int len)
1767{
1768 if (ignorecase) {
1769 return strncasecmp(s1, s2, len);
1770 }
1771 return strncmp(s1, s2, len);
1772}
1773# else
1774# define mycmp strncmp
1775# endif
1776
1777static char *char_search(char *p, const char *pat, int dir, int range)
1778{
1779 char *start, *stop;
1780 int len;
1781
1782 len = strlen(pat);
1783 if (dir == FORWARD) {
1784 stop = end - 1; // assume range is p - end-1
1785 if (range == LIMITED)
1786 stop = next_line(p); // range is to next line
1787 for (start = p; start < stop; start++) {
1788 if (mycmp(start, pat, len) == 0) {
1789 return start;
1790 }
1791 }
1792 } else if (dir == BACK) {
1793 stop = text; // assume range is text - p
1794 if (range == LIMITED)
1795 stop = prev_line(p); // range is to prev line
1796 for (start = p - len; start >= stop; start--) {
1797 if (mycmp(start, pat, len) == 0) {
1798 return start;
1799 }
1800 }
1801 }
1802 // pattern not found
1803 return NULL;
1804}
1805
1806# endif
1807
1665#endif /* FEATURE_VI_SEARCH */ 1808#endif /* FEATURE_VI_SEARCH */
1666 1809
1667static char *char_insert(char *p, char c) // insert the char c at 'p' 1810static char *char_insert(char *p, char c) // insert the char c at 'p'
@@ -2023,8 +2166,8 @@ static void show_help(void)
2023 "\n\tNamed buffers with \"x" 2166 "\n\tNamed buffers with \"x"
2024#endif 2167#endif
2025#if ENABLE_FEATURE_VI_READONLY 2168#if ENABLE_FEATURE_VI_READONLY
2026 "\n\tReadonly if vi is called as \"view\"" 2169 //not implemented: "\n\tReadonly if vi is called as \"view\""
2027 "\n\tReadonly with -R command line arg" 2170 //redundant: usage text says this too: "\n\tReadonly with -R command line arg"
2028#endif 2171#endif
2029#if ENABLE_FEATURE_VI_SET 2172#if ENABLE_FEATURE_VI_SET
2030 "\n\tSome colon mode commands with \':\'" 2173 "\n\tSome colon mode commands with \':\'"
diff --git a/findutils/find.c b/findutils/find.c
index 050d6373e..babcda0ed 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -236,7 +236,6 @@
236//usage: "Search for files and perform actions on them.\n" 236//usage: "Search for files and perform actions on them.\n"
237//usage: "First failed action stops processing of current file.\n" 237//usage: "First failed action stops processing of current file.\n"
238//usage: "Defaults: PATH is current directory, action is '-print'\n" 238//usage: "Defaults: PATH is current directory, action is '-print'\n"
239//usage: "\nOptions:"
240//usage: "\n -follow Follow symlinks" 239//usage: "\n -follow Follow symlinks"
241//usage: IF_FEATURE_FIND_XDEV( 240//usage: IF_FEATURE_FIND_XDEV(
242//usage: "\n -xdev Don't descend directories on other filesystems" 241//usage: "\n -xdev Don't descend directories on other filesystems"
diff --git a/findutils/grep.c b/findutils/grep.c
index f746210d2..fa3b8a3a9 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -72,7 +72,6 @@
72//usage: "PATTERN/-e PATTERN.../-f FILE [FILE]..." 72//usage: "PATTERN/-e PATTERN.../-f FILE [FILE]..."
73//usage:#define grep_full_usage "\n\n" 73//usage:#define grep_full_usage "\n\n"
74//usage: "Search for PATTERN in FILEs (or stdin)\n" 74//usage: "Search for PATTERN in FILEs (or stdin)\n"
75//usage: "\nOptions:"
76//usage: "\n -H Add 'filename:' prefix" 75//usage: "\n -H Add 'filename:' prefix"
77//usage: "\n -h Do not add 'filename:' prefix" 76//usage: "\n -h Do not add 'filename:' prefix"
78//usage: "\n -n Add 'line_no:' prefix" 77//usage: "\n -n Add 'line_no:' prefix"
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 967737133..0d1bb43fc 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -349,7 +349,6 @@ static int xargs_ask_confirmation(void)
349//usage: "[OPTIONS] [PROG ARGS]" 349//usage: "[OPTIONS] [PROG ARGS]"
350//usage:#define xargs_full_usage "\n\n" 350//usage:#define xargs_full_usage "\n\n"
351//usage: "Run PROG on every item given by stdin\n" 351//usage: "Run PROG on every item given by stdin\n"
352//usage: "\nOptions:"
353//usage: IF_FEATURE_XARGS_SUPPORT_CONFIRMATION( 352//usage: IF_FEATURE_XARGS_SUPPORT_CONFIRMATION(
354//usage: "\n -p Ask user whether to run each command" 353//usage: "\n -p Ask user whether to run each command"
355//usage: ) 354//usage: )
diff --git a/include/applets.src.h b/include/applets.src.h
index 133f376a3..2d55ffec7 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -180,7 +180,6 @@ IF_HOSTID(APPLET_NOFORK(hostid, hostid, BB_DIR_USR_BIN, BB_SUID_DROP, hostid))
180IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP)) 180IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP))
181IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) 181IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
182IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP)) 182IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP))
183IF_ID(APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id))
184IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP)) 183IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP))
185IF_IFUPDOWN(APPLET_ODDNAME(ifdown, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifdown)) 184IF_IFUPDOWN(APPLET_ODDNAME(ifdown, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifdown))
186IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP)) 185IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP))
@@ -400,7 +399,6 @@ IF_USLEEP(APPLET_NOFORK(usleep, usleep, BB_DIR_BIN, BB_SUID_DROP, usleep))
400IF_UUDECODE(APPLET(uudecode, BB_DIR_USR_BIN, BB_SUID_DROP)) 399IF_UUDECODE(APPLET(uudecode, BB_DIR_USR_BIN, BB_SUID_DROP))
401IF_UUENCODE(APPLET(uuencode, BB_DIR_USR_BIN, BB_SUID_DROP)) 400IF_UUENCODE(APPLET(uuencode, BB_DIR_USR_BIN, BB_SUID_DROP))
402IF_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP)) 401IF_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP))
403IF_VI(APPLET(vi, BB_DIR_BIN, BB_SUID_DROP))
404/* Needs to be run by root or be suid root - needs to change uid and gid: */ 402/* Needs to be run by root or be suid root - needs to change uid and gid: */
405IF_VLOCK(APPLET(vlock, BB_DIR_USR_BIN, BB_SUID_REQUIRE)) 403IF_VLOCK(APPLET(vlock, BB_DIR_USR_BIN, BB_SUID_REQUIRE))
406IF_VOLNAME(APPLET(volname, BB_DIR_USR_BIN, BB_SUID_DROP)) 404IF_VOLNAME(APPLET(volname, BB_DIR_USR_BIN, BB_SUID_DROP))
diff --git a/include/libbb.h b/include/libbb.h
index ac5722c89..363fe53df 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -173,6 +173,30 @@ int sysinfo(struct sysinfo* info);
173# include "mingw.h" 173# include "mingw.h"
174#endif 174#endif
175 175
176/* Busybox does not use threads, we can speed up stdio. */
177#ifdef HAVE_UNLOCKED_STDIO
178# undef getc
179# define getc(stream) getc_unlocked(stream)
180# undef getchar
181# define getchar() getchar_unlocked()
182# undef putc
183# define putc(c, stream) putc_unlocked(c, stream)
184# undef putchar
185# define putchar(c) putchar_unlocked(c)
186# undef fgetc
187# define fgetc(stream) getc_unlocked(stream)
188# undef fputc
189# define fputc(c, stream) putc_unlocked(c, stream)
190#endif
191/* Above functions are required by POSIX.1-2008, below ones are extensions */
192#ifdef HAVE_UNLOCKED_LINE_OPS
193# undef fgets
194# define fgets(s, n, stream) fgets_unlocked(s, n, stream)
195# undef fputs
196# define fputs(s, stream) fputs_unlocked(s, stream)
197#endif
198
199
176/* Make all declarations hidden (-fvisibility flag only affects definitions) */ 200/* Make all declarations hidden (-fvisibility flag only affects definitions) */
177/* (don't include system headers after this until corresponding pop!) */ 201/* (don't include system headers after this until corresponding pop!) */
178PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 202PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
@@ -743,8 +767,12 @@ extern void xclose(int fd) FAST_FUNC;
743/* Reads and prints to stdout till eof, then closes FILE. Exits on error: */ 767/* Reads and prints to stdout till eof, then closes FILE. Exits on error: */
744extern void xprint_and_close_file(FILE *file) FAST_FUNC; 768extern void xprint_and_close_file(FILE *file) FAST_FUNC;
745 769
770/* Reads a line from a text file, up to a newline or NUL byte, inclusive.
771 * Returns malloc'ed char*. If end is NULL '\n' isn't considered
772 * end of line. If end isn't NULL, length of the chunk is stored in it.
773 * Returns NULL if EOF/error.
774 */
746extern char *bb_get_chunk_from_file(FILE *file, int *end) FAST_FUNC; 775extern char *bb_get_chunk_from_file(FILE *file, int *end) FAST_FUNC;
747extern char *bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno) FAST_FUNC;
748/* Reads up to (and including) TERMINATING_STRING: */ 776/* Reads up to (and including) TERMINATING_STRING: */
749extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string) FAST_FUNC RETURNS_MALLOC; 777extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string) FAST_FUNC RETURNS_MALLOC;
750/* Same, with limited max size, and returns the length (excluding NUL): */ 778/* Same, with limited max size, and returns the length (excluding NUL): */
@@ -1196,8 +1224,9 @@ enum {
1196}; 1224};
1197typedef struct parser_t { 1225typedef struct parser_t {
1198 FILE *fp; 1226 FILE *fp;
1199 char *line;
1200 char *data; 1227 char *data;
1228 char *line, *nline;
1229 size_t line_alloc, nline_alloc;
1201 int lineno; 1230 int lineno;
1202} parser_t; 1231} parser_t;
1203parser_t* config_open(const char *filename) FAST_FUNC; 1232parser_t* config_open(const char *filename) FAST_FUNC;
@@ -1560,13 +1589,6 @@ enum {
1560 PSSCAN_NICE = (1 << 20) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS, 1589 PSSCAN_NICE = (1 << 20) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS,
1561 PSSCAN_RUIDGID = (1 << 21) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS, 1590 PSSCAN_RUIDGID = (1 << 21) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS,
1562 PSSCAN_TASKS = (1 << 22) * ENABLE_FEATURE_SHOW_THREADS, 1591 PSSCAN_TASKS = (1 << 22) * ENABLE_FEATURE_SHOW_THREADS,
1563 /* These are all retrieved from proc/NN/stat in one go: */
1564 PSSCAN_STAT = PSSCAN_PPID | PSSCAN_PGID | PSSCAN_SID
1565 /**/ | PSSCAN_COMM | PSSCAN_STATE
1566 /**/ | PSSCAN_VSZ | PSSCAN_RSS
1567 /**/ | PSSCAN_STIME | PSSCAN_UTIME | PSSCAN_START_TIME
1568 /**/ | PSSCAN_TTY | PSSCAN_NICE
1569 /**/ | PSSCAN_CPU
1570}; 1592};
1571//procps_status_t* alloc_procps_scan(void) FAST_FUNC; 1593//procps_status_t* alloc_procps_scan(void) FAST_FUNC;
1572void free_procps_scan(procps_status_t* sp) FAST_FUNC; 1594void free_procps_scan(procps_status_t* sp) FAST_FUNC;
diff --git a/include/platform.h b/include/platform.h
index 48e256aa0..319ef4a9e 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -349,8 +349,8 @@ typedef unsigned smalluint;
349 349
350/* ---- Who misses what? ------------------------------------ */ 350/* ---- Who misses what? ------------------------------------ */
351 351
352/* Assume all these functions exist by default. Platforms where it is not 352/* Assume all these functions and header files exist by default.
353 * true will #undef them below. 353 * Platforms where it is not true will #undef them below.
354 */ 354 */
355#define HAVE_CLEARENV 1 355#define HAVE_CLEARENV 1
356#define HAVE_FDATASYNC 1 356#define HAVE_FDATASYNC 1
@@ -365,10 +365,24 @@ typedef unsigned smalluint;
365#define HAVE_STRCHRNUL 1 365#define HAVE_STRCHRNUL 1
366#define HAVE_STRSEP 1 366#define HAVE_STRSEP 1
367#define HAVE_STRSIGNAL 1 367#define HAVE_STRSIGNAL 1
368#define HAVE_STRVERSCMP 1
368#define HAVE_VASPRINTF 1 369#define HAVE_VASPRINTF 1
370#define HAVE_UNLOCKED_STDIO 1
371#define HAVE_UNLOCKED_LINE_OPS 1
372#define HAVE_GETLINE 1
373#define HAVE_XTABS 1
369#define HAVE_MNTENT_H 1 374#define HAVE_MNTENT_H 1
375#define HAVE_NET_ETHERNET_H 1
370#define HAVE_SYS_STATFS_H 1 376#define HAVE_SYS_STATFS_H 1
371#define HAVE_XTABS 1 377
378#if defined(__UCLIBC_MAJOR__)
379# if __UCLIBC_MAJOR__ == 0 \
380 && ( __UCLIBC_MINOR__ < 9 \
381 || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 31) \
382 )
383# undef HAVE_STRVERSCMP
384# endif
385#endif
372 386
373#if defined(__dietlibc__) 387#if defined(__dietlibc__)
374# undef HAVE_STRCHRNUL 388# undef HAVE_STRCHRNUL
@@ -383,13 +397,17 @@ typedef unsigned smalluint;
383# undef HAVE_STRCASESTR 397# undef HAVE_STRCASESTR
384# undef HAVE_STRCHRNUL 398# undef HAVE_STRCHRNUL
385# undef HAVE_STRSIGNAL 399# undef HAVE_STRSIGNAL
400# undef HAVE_STRVERSCMP
386# undef HAVE_VASPRINTF 401# undef HAVE_VASPRINTF
402# undef HAVE_UNLOCKED_STDIO
403# undef HAVE_UNLOCKED_LINE_OPS
387# undef HAVE_MNTENT_H 404# undef HAVE_MNTENT_H
388# undef HAVE_SYS_STATFS_H 405# undef HAVE_SYS_STATFS_H
389#endif 406#endif
390 407
391#if defined(__WATCOMC__) 408#if defined(__WATCOMC__)
392# undef HAVE_DPRINTF 409# undef HAVE_DPRINTF
410# undef HAVE_GETLINE
393# undef HAVE_MEMRCHR 411# undef HAVE_MEMRCHR
394# undef HAVE_MKDTEMP 412# undef HAVE_MKDTEMP
395# undef HAVE_SETBIT 413# undef HAVE_SETBIT
@@ -398,30 +416,51 @@ typedef unsigned smalluint;
398# undef HAVE_STRCHRNUL 416# undef HAVE_STRCHRNUL
399# undef HAVE_STRSEP 417# undef HAVE_STRSEP
400# undef HAVE_STRSIGNAL 418# undef HAVE_STRSIGNAL
419# undef HAVE_STRVERSCMP
401# undef HAVE_VASPRINTF 420# undef HAVE_VASPRINTF
421# undef HAVE_UNLOCKED_STDIO
422# undef HAVE_UNLOCKED_LINE_OPS
423# undef HAVE_NET_ETHERNET_H
402#endif 424#endif
403 425
404#if defined(__FreeBSD__) 426/* These BSD-derived OSes share many similarities */
405# undef HAVE_STRCHRNUL
406#endif
407
408#if (defined __digital__ && defined __unix__) \ 427#if (defined __digital__ && defined __unix__) \
409 || defined __APPLE__ \ 428 || defined __APPLE__ \
410 || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ 429 || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__
411# undef HAVE_CLEARENV 430# undef HAVE_CLEARENV
412# undef HAVE_FDATASYNC 431# undef HAVE_FDATASYNC
432# undef HAVE_GETLINE
413# undef HAVE_MNTENT_H 433# undef HAVE_MNTENT_H
414# undef HAVE_PTSNAME_R 434# undef HAVE_PTSNAME_R
415# undef HAVE_SYS_STATFS_H 435# undef HAVE_SYS_STATFS_H
416# undef HAVE_SIGHANDLER_T 436# undef HAVE_SIGHANDLER_T
437# undef HAVE_STRVERSCMP
417# undef HAVE_XTABS 438# undef HAVE_XTABS
418# undef HAVE_DPRINTF 439# undef HAVE_DPRINTF
419#endif 440#endif
420 441
442#if defined(__FreeBSD__)
443# undef HAVE_STRCHRNUL
444#endif
445
446#if defined(__NetBSD__)
447# define HAVE_GETLINE 1 /* Recent NetBSD versions have getline() */
448#endif
449
421#if defined(__digital__) && defined(__unix__) 450#if defined(__digital__) && defined(__unix__)
422# undef HAVE_STPCPY 451# undef HAVE_STPCPY
423#endif 452#endif
424 453
454#if defined(ANDROID)
455# undef HAVE_DPRINTF
456# undef HAVE_GETLINE
457# undef HAVE_STPCPY
458# undef HAVE_STRCHRNUL
459# undef HAVE_STRVERSCMP
460# undef HAVE_UNLOCKED_LINE_OPS
461# undef HAVE_NET_ETHERNET_H
462#endif
463
425/* 464/*
426 * Now, define prototypes for all the functions defined in platform.c 465 * Now, define prototypes for all the functions defined in platform.c
427 * These must come after all the HAVE_* macros are defined (or not) 466 * These must come after all the HAVE_* macros are defined (or not)
@@ -475,4 +514,9 @@ extern char *strsep(char **stringp, const char *delim) FAST_FUNC;
475extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; 514extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC;
476#endif 515#endif
477 516
517#ifndef HAVE_GETLINE
518#include <stdio.h> /* for FILE */
519extern ssize_t getline(char **lineptr, size_t *n, FILE *stream) FAST_FUNC;
520#endif
521
478#endif 522#endif
diff --git a/init/bootchartd.c b/init/bootchartd.c
index 009e2690c..5f6121fa4 100644
--- a/init/bootchartd.c
+++ b/init/bootchartd.c
@@ -327,7 +327,6 @@ static void finalize(char *tempdir, const char *prog)
327//usage: "start [PROG ARGS]|stop|init" 327//usage: "start [PROG ARGS]|stop|init"
328//usage:#define bootchartd_full_usage "\n\n" 328//usage:#define bootchartd_full_usage "\n\n"
329//usage: "Create /var/log/bootchart.tgz with boot chart data\n" 329//usage: "Create /var/log/bootchart.tgz with boot chart data\n"
330//usage: "\nOptions:"
331//usage: "\nstart: start background logging; with PROG, run PROG, then kill logging with USR1" 330//usage: "\nstart: start background logging; with PROG, run PROG, then kill logging with USR1"
332//usage: "\nstop: send USR1 to all bootchartd processes" 331//usage: "\nstop: send USR1 to all bootchartd processes"
333//usage: "\ninit: start background logging; stop when getty/xdm is seen (for init scripts)" 332//usage: "\ninit: start background logging; stop when getty/xdm is seen (for init scripts)"
diff --git a/init/halt.c b/init/halt.c
index a84a72747..1aac0faf9 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -43,7 +43,6 @@
43//usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]") 43//usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]")
44//usage:#define halt_full_usage "\n\n" 44//usage:#define halt_full_usage "\n\n"
45//usage: "Halt the system\n" 45//usage: "Halt the system\n"
46//usage: "\nOptions:"
47//usage: "\n -d SEC Delay interval" 46//usage: "\n -d SEC Delay interval"
48//usage: "\n -n Do not sync" 47//usage: "\n -n Do not sync"
49//usage: "\n -f Force (don't go through init)" 48//usage: "\n -f Force (don't go through init)"
@@ -55,7 +54,6 @@
55//usage: "[-d DELAY] [-n] [-f]" 54//usage: "[-d DELAY] [-n] [-f]"
56//usage:#define poweroff_full_usage "\n\n" 55//usage:#define poweroff_full_usage "\n\n"
57//usage: "Halt and shut off power\n" 56//usage: "Halt and shut off power\n"
58//usage: "\nOptions:"
59//usage: "\n -d SEC Delay interval" 57//usage: "\n -d SEC Delay interval"
60//usage: "\n -n Do not sync" 58//usage: "\n -n Do not sync"
61//usage: "\n -f Force (don't go through init)" 59//usage: "\n -f Force (don't go through init)"
@@ -64,7 +62,6 @@
64//usage: "[-d DELAY] [-n] [-f]" 62//usage: "[-d DELAY] [-n] [-f]"
65//usage:#define reboot_full_usage "\n\n" 63//usage:#define reboot_full_usage "\n\n"
66//usage: "Reboot the system\n" 64//usage: "Reboot the system\n"
67//usage: "\nOptions:"
68//usage: "\n -d SEC Delay interval" 65//usage: "\n -d SEC Delay interval"
69//usage: "\n -n Do not sync" 66//usage: "\n -n Do not sync"
70//usage: "\n -f Force (don't go through init)" 67//usage: "\n -f Force (don't go through init)"
@@ -157,11 +154,13 @@ int halt_main(int argc UNUSED_PARAM, char **argv)
157 /* runlevels: 154 /* runlevels:
158 * 0 == shutdown 155 * 0 == shutdown
159 * 6 == reboot */ 156 * 6 == reboot */
160 rc = execlp(CONFIG_TELINIT_PATH, 157 execlp(CONFIG_TELINIT_PATH,
161 CONFIG_TELINIT_PATH, 158 CONFIG_TELINIT_PATH,
162 which == 2 ? "6" : "0", 159 which == 2 ? "6" : "0",
163 (char *)NULL 160 (char *)NULL
164 ); 161 );
162 perror_msg_and_die("can't execute '%s'",
163 CONFIG_TELINIT_PATH);
165 } 164 }
166 } 165 }
167 } else { 166 } else {
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index d110a3265..fcab184e0 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -57,9 +57,7 @@ lib-y += hash_md5_sha.o
57#lib-y += hash_md5prime.o 57#lib-y += hash_md5prime.o
58lib-y += messages.o 58lib-y += messages.o
59lib-y += mode_string.o 59lib-y += mode_string.o
60lib-y += obscure.o
61lib-y += parse_mode.o 60lib-y += parse_mode.o
62lib-y += parse_config.o
63lib-y += perror_msg.o 61lib-y += perror_msg.o
64lib-y += perror_nomsg.o 62lib-y += perror_nomsg.o
65lib-y += perror_nomsg_and_die.o 63lib-y += perror_nomsg_and_die.o
@@ -138,7 +136,7 @@ lib-$(CONFIG_ADDUSER) += update_passwd.o
138lib-$(CONFIG_DELGROUP) += update_passwd.o 136lib-$(CONFIG_DELGROUP) += update_passwd.o
139lib-$(CONFIG_DELUSER) += update_passwd.o 137lib-$(CONFIG_DELUSER) += update_passwd.o
140 138
141lib-$(CONFIG_PASSWD) += pw_encrypt.o update_passwd.o 139lib-$(CONFIG_PASSWD) += pw_encrypt.o update_passwd.o obscure.o
142lib-$(CONFIG_CHPASSWD) += pw_encrypt.o update_passwd.o 140lib-$(CONFIG_CHPASSWD) += pw_encrypt.o update_passwd.o
143lib-$(CONFIG_CRYPTPW) += pw_encrypt.o 141lib-$(CONFIG_CRYPTPW) += pw_encrypt.o
144lib-$(CONFIG_SULOGIN) += pw_encrypt.o 142lib-$(CONFIG_SULOGIN) += pw_encrypt.o
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index d4025b9c7..b824b4775 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -34,17 +34,6 @@
34# include <malloc.h> /* for mallopt */ 34# include <malloc.h> /* for mallopt */
35#endif 35#endif
36 36
37/* Try to pull in PAGE_SIZE */
38#ifdef __linux__
39# include <sys/user.h>
40#endif
41#ifdef __GNU__ /* Hurd */
42# include <mach/vm_param.h>
43#endif
44#ifndef PAGE_SIZE
45# define PAGE_SIZE (4*1024) /* guess */
46#endif
47
48 37
49/* Declare <applet>_main() */ 38/* Declare <applet>_main() */
50#define PROTOTYPES 39#define PROTOTYPES
@@ -788,13 +777,13 @@ int main(int argc UNUSED_PARAM, char **argv)
788 * to keep before releasing to the OS 777 * to keep before releasing to the OS
789 * Default is way too big: 256k 778 * Default is way too big: 256k
790 */ 779 */
791 mallopt(M_TRIM_THRESHOLD, 2 * PAGE_SIZE); 780 mallopt(M_TRIM_THRESHOLD, 8 * 1024);
792#endif 781#endif
793#ifdef M_MMAP_THRESHOLD 782#ifdef M_MMAP_THRESHOLD
794 /* M_MMAP_THRESHOLD is the request size threshold for using mmap() 783 /* M_MMAP_THRESHOLD is the request size threshold for using mmap()
795 * Default is too big: 256k 784 * Default is too big: 256k
796 */ 785 */
797 mallopt(M_MMAP_THRESHOLD, 8 * PAGE_SIZE - 256); 786 mallopt(M_MMAP_THRESHOLD, 32 * 1024 - 256);
798#endif 787#endif
799 788
800#if !BB_MMU 789#if !BB_MMU
diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c
index 9be10687b..a98dd35eb 100644
--- a/libbb/get_line_from_file.c
+++ b/libbb/get_line_from_file.c
@@ -11,45 +11,24 @@
11 11
12#include "libbb.h" 12#include "libbb.h"
13 13
14/* This function reads an entire line from a text file, up to a newline 14char* FAST_FUNC bb_get_chunk_from_file(FILE *file, int *end)
15 * or NUL byte, inclusive. It returns a malloc'ed char * which
16 * must be free'ed by the caller. If end is NULL '\n' isn't considered
17 * end of line. If end isn't NULL, length of the chunk is stored in it.
18 * If lineno is not NULL, *lineno is incremented for each line,
19 * and also trailing '\' is recognized as line continuation.
20 *
21 * Returns NULL if EOF/error. */
22char* FAST_FUNC bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno)
23{ 15{
24 int ch; 16 int ch;
25 int idx = 0; 17 unsigned idx = 0;
26 char *linebuf = NULL; 18 char *linebuf = NULL;
27 int linebufsz = 0;
28 19
29 while ((ch = getc(file)) != EOF) { 20 while ((ch = getc(file)) != EOF) {
30 /* grow the line buffer as necessary */ 21 /* grow the line buffer as necessary */
31 if (idx >= linebufsz) { 22 if (!(idx & 0xff))
32 linebufsz += 256; 23 linebuf = xrealloc(linebuf, idx + 0x100);
33 linebuf = xrealloc(linebuf, linebufsz);
34 }
35 linebuf[idx++] = (char) ch; 24 linebuf[idx++] = (char) ch;
36 if (!ch) 25 if (ch == '\0')
26 break;
27 if (end && ch == '\n')
37 break; 28 break;
38 if (end && ch == '\n') {
39 if (lineno == NULL)
40 break;
41 (*lineno)++;
42 if (idx < 2 || linebuf[idx-2] != '\\')
43 break;
44 idx -= 2;
45 }
46 } 29 }
47 if (end) { 30 if (end)
48 *end = idx; 31 *end = idx;
49 /* handle corner case when the file is not ended with '\n' */
50 if (ch == EOF && lineno != NULL)
51 (*lineno)++;
52 }
53 if (linebuf) { 32 if (linebuf) {
54 // huh, does fgets discard prior data on error like this? 33 // huh, does fgets discard prior data on error like this?
55 // I don't think so.... 34 // I don't think so....
@@ -63,11 +42,6 @@ char* FAST_FUNC bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno
63 return linebuf; 42 return linebuf;
64} 43}
65 44
66char* FAST_FUNC bb_get_chunk_from_file(FILE *file, int *end)
67{
68 return bb_get_chunk_with_continuation(file, end, NULL);
69}
70
71/* Get line, including trailing \n if any */ 45/* Get line, including trailing \n if any */
72char* FAST_FUNC xmalloc_fgets(FILE *file) 46char* FAST_FUNC xmalloc_fgets(FILE *file)
73{ 47{
diff --git a/libbb/parse_config.c b/libbb/parse_config.c
index 4b0236028..cf5ba4deb 100644
--- a/libbb/parse_config.c
+++ b/libbb/parse_config.c
@@ -8,11 +8,27 @@
8 * Also for use in uClibc (http://uclibc.org/) licensed under LGPLv2.1 or later. 8 * Also for use in uClibc (http://uclibc.org/) licensed under LGPLv2.1 or later.
9 */ 9 */
10 10
11/* 11/* Uncomment to enable test applet */
12////config:config PARSE
13////config: bool "Uniform config file parser debugging applet: parse"
14////config: default n
15////config: help
16////config: Typical usage of parse API:
17////config: char *t[3];
18////config: parser_t *p = config_open(filename);
19////config: while (config_read(p, t, 3, 0, delimiters, flags)) { // 1..3 tokens
20////config: bb_error_msg("TOKENS: '%s''%s''%s'", t[0], t[1], t[2]);
21////config: }
22////config: config_close(p);
23
24////applet:IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP))
25
26//kbuild:lib-y += parse_config.o
27
12//usage:#define parse_trivial_usage 28//usage:#define parse_trivial_usage
13//usage: "[-n MAXTOKENS] [-m MINTOKENS] [-d DELIMS] [-f FLAGS] FILE..." 29//usage: "[-x] [-n MAXTOKENS] [-m MINTOKENS] [-d DELIMS] [-f FLAGS] FILE..."
14//usage:#define parse_full_usage "" 30//usage:#define parse_full_usage "\n\n"
15*/ 31//usage: " -x Suppress output (for benchmarking)"
16 32
17#include "libbb.h" 33#include "libbb.h"
18 34
@@ -21,52 +37,34 @@ int parse_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
21int parse_main(int argc UNUSED_PARAM, char **argv) 37int parse_main(int argc UNUSED_PARAM, char **argv)
22{ 38{
23 const char *delims = "# \t"; 39 const char *delims = "# \t";
40 char **t;
24 unsigned flags = PARSE_NORMAL; 41 unsigned flags = PARSE_NORMAL;
25 int mintokens = 0, ntokens = 128; 42 int mintokens = 0, ntokens = 128;
43 unsigned noout;
26 44
27 opt_complementary = "-1:n+:m+:f+"; 45 opt_complementary = "-1:n+:m+:f+";
28 getopt32(argv, "n:m:d:f:", &ntokens, &mintokens, &delims, &flags); 46 noout = 1 & getopt32(argv, "xn:m:d:f:", &ntokens, &mintokens, &delims, &flags);
29 //argc -= optind; 47 //argc -= optind;
30 argv += optind; 48 argv += optind;
49
50 t = xmalloc(sizeof(t[0]) * ntokens);
31 while (*argv) { 51 while (*argv) {
52 int n;
32 parser_t *p = config_open(*argv); 53 parser_t *p = config_open(*argv);
33 if (p) { 54 while ((n = config_read(p, t, ntokens, mintokens, delims, flags)) != 0) {
34 int n; 55 if (!noout) {
35 char **t = xmalloc(sizeof(char *) * ntokens);
36 while ((n = config_read(p, t, ntokens, mintokens, delims, flags)) != 0) {
37 for (int i = 0; i < n; ++i) 56 for (int i = 0; i < n; ++i)
38 printf("[%s]", t[i]); 57 printf("[%s]", t[i]);
39 puts(""); 58 puts("");
40 } 59 }
41 config_close(p);
42 } 60 }
61 config_close(p);
43 argv++; 62 argv++;
44 } 63 }
45 return EXIT_SUCCESS; 64 return EXIT_SUCCESS;
46} 65}
47#endif 66#endif
48 67
49/*
50
51Typical usage:
52
53----- CUT -----
54 char *t[3]; // tokens placeholder
55 parser_t *p = config_open(filename);
56 if (p) {
57 // parse line-by-line
58 while (config_read(p, t, 3, 0, delimiters, flags)) { // 1..3 tokens
59 // use tokens
60 bb_error_msg("TOKENS: [%s][%s][%s]", t[0], t[1], t[2]);
61 }
62 ...
63 // free parser
64 config_close(p);
65 }
66----- CUT -----
67
68*/
69
70parser_t* FAST_FUNC config_open2(const char *filename, FILE* FAST_FUNC (*fopen_func)(const char *path)) 68parser_t* FAST_FUNC config_open2(const char *filename, FILE* FAST_FUNC (*fopen_func)(const char *path))
71{ 69{
72 FILE* fp; 70 FILE* fp;
@@ -85,25 +83,58 @@ parser_t* FAST_FUNC config_open(const char *filename)
85 return config_open2(filename, fopen_or_warn_stdin); 83 return config_open2(filename, fopen_or_warn_stdin);
86} 84}
87 85
88static void config_free_data(parser_t *parser)
89{
90 free(parser->line);
91 parser->line = NULL;
92 if (PARSE_KEEP_COPY) { /* compile-time constant */
93 free(parser->data);
94 parser->data = NULL;
95 }
96}
97
98void FAST_FUNC config_close(parser_t *parser) 86void FAST_FUNC config_close(parser_t *parser)
99{ 87{
100 if (parser) { 88 if (parser) {
101 config_free_data(parser); 89 if (PARSE_KEEP_COPY) /* compile-time constant */
90 free(parser->data);
102 fclose(parser->fp); 91 fclose(parser->fp);
92 free(parser->line);
93 free(parser->nline);
103 free(parser); 94 free(parser);
104 } 95 }
105} 96}
106 97
98/* This function reads an entire line from a text file,
99 * up to a newline, exclusive.
100 * Trailing '\' is recognized as line continuation.
101 * Returns -1 if EOF/error.
102 */
103static int get_line_with_continuation(parser_t *parser)
104{
105 ssize_t len, nlen;
106 char *line;
107
108 len = getline(&parser->line, &parser->line_alloc, parser->fp);
109 if (len <= 0)
110 return len;
111
112 line = parser->line;
113 for (;;) {
114 parser->lineno++;
115 if (line[len - 1] == '\n')
116 len--;
117 if (len == 0 || line[len - 1] != '\\')
118 break;
119 len--;
120
121 nlen = getline(&parser->nline, &parser->nline_alloc, parser->fp);
122 if (nlen <= 0)
123 break;
124
125 if (parser->line_alloc < len + nlen + 1) {
126 parser->line_alloc = len + nlen + 1;
127 line = parser->line = xrealloc(line, parser->line_alloc);
128 }
129 memcpy(&line[len], parser->nline, nlen);
130 len += nlen;
131 }
132
133 line[len] = '\0';
134 return len;
135}
136
137
107/* 138/*
1080. If parser is NULL return 0. 1390. If parser is NULL return 0.
1091. Read a line from config file. If nothing to read then return 0. 1401. Read a line from config file. If nothing to read then return 0.
@@ -132,27 +163,22 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, unsigned flags, const
132{ 163{
133 char *line; 164 char *line;
134 int ntokens, mintokens; 165 int ntokens, mintokens;
135 int t, len; 166 int t;
167
168 if (!parser)
169 return 0;
136 170
137 ntokens = (uint8_t)flags; 171 ntokens = (uint8_t)flags;
138 mintokens = (uint8_t)(flags >> 8); 172 mintokens = (uint8_t)(flags >> 8);
139 173
140 if (parser == NULL) 174 again:
141 return 0;
142
143again:
144 memset(tokens, 0, sizeof(tokens[0]) * ntokens); 175 memset(tokens, 0, sizeof(tokens[0]) * ntokens);
145 config_free_data(parser);
146 176
147 /* Read one line (handling continuations with backslash) */ 177 /* Read one line (handling continuations with backslash) */
148 line = bb_get_chunk_with_continuation(parser->fp, &len, &parser->lineno); 178 if (get_line_with_continuation(parser) < 0)
149 if (line == NULL)
150 return 0; 179 return 0;
151 parser->line = line;
152 180
153 /* Strip trailing line-feed if any */ 181 line = parser->line;
154 if (len && line[len-1] == '\n')
155 line[len-1] = '\0';
156 182
157 /* Skip token in the start of line? */ 183 /* Skip token in the start of line? */
158 if (flags & PARSE_TRIM) 184 if (flags & PARSE_TRIM)
@@ -161,8 +187,10 @@ again:
161 if (line[0] == '\0' || line[0] == delims[0]) 187 if (line[0] == '\0' || line[0] == delims[0])
162 goto again; 188 goto again;
163 189
164 if (flags & PARSE_KEEP_COPY) 190 if (flags & PARSE_KEEP_COPY) {
191 free(parser->data);
165 parser->data = xstrdup(line); 192 parser->data = xstrdup(line);
193 }
166 194
167 /* Tokenize the line */ 195 /* Tokenize the line */
168 t = 0; 196 t = 0;
@@ -208,8 +236,6 @@ again:
208 parser->lineno, t, mintokens); 236 parser->lineno, t, mintokens);
209 if (flags & PARSE_MIN_DIE) 237 if (flags & PARSE_MIN_DIE)
210 xfunc_die(); 238 xfunc_die();
211 if (flags & PARSE_KEEP_COPY)
212 free(parser->data);
213 goto again; 239 goto again;
214 } 240 }
215 241
diff --git a/libbb/platform.c b/libbb/platform.c
index c594dcb4a..3cb41347f 100644
--- a/libbb/platform.c
+++ b/libbb/platform.c
@@ -158,3 +158,32 @@ char* FAST_FUNC stpcpy(char *p, const char *to_add)
158 return p; 158 return p;
159} 159}
160#endif 160#endif
161
162#ifndef HAVE_GETLINE
163ssize_t FAST_FUNC getline(char **lineptr, size_t *n, FILE *stream)
164{
165 int ch;
166 char *line = *lineptr;
167 size_t alloced = *n;
168 size_t len = 0;
169
170 do {
171 ch = fgetc(stream);
172 if (ch == EOF)
173 break;
174 if (len + 1 >= alloced) {
175 alloced += alloced/4 + 64;
176 line = xrealloc(line, alloced);
177 }
178 line[len++] = ch;
179 } while (ch != '\n');
180
181 if (len == 0)
182 return -1;
183
184 line[len] = '\0';
185 *lineptr = line;
186 *n = alloced;
187 return len;
188}
189#endif
diff --git a/libbb/procps.c b/libbb/procps.c
index 58772d4e9..b5582edfa 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -358,7 +358,14 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
358 sp->gid = sb.st_gid; 358 sp->gid = sb.st_gid;
359 } 359 }
360 360
361 if (flags & PSSCAN_STAT) { 361 /* These are all retrieved from proc/NN/stat in one go: */
362 if (flags & (PSSCAN_PPID | PSSCAN_PGID | PSSCAN_SID
363 | PSSCAN_COMM | PSSCAN_STATE
364 | PSSCAN_VSZ | PSSCAN_RSS
365 | PSSCAN_STIME | PSSCAN_UTIME | PSSCAN_START_TIME
366 | PSSCAN_TTY | PSSCAN_NICE
367 | PSSCAN_CPU)
368 ) {
362 char *cp, *comm1; 369 char *cp, *comm1;
363 int tty; 370 int tty;
364#if !ENABLE_FEATURE_FAST_TOP 371#if !ENABLE_FEATURE_FAST_TOP
@@ -562,18 +569,47 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
562void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm) 569void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm)
563{ 570{
564 int sz; 571 int sz;
565 char filename[sizeof("/proc//cmdline") + sizeof(int)*3]; 572 char filename[sizeof("/proc/%u/cmdline") + sizeof(int)*3];
566 573
567 sprintf(filename, "/proc/%u/cmdline", pid); 574 sprintf(filename, "/proc/%u/cmdline", pid);
568 sz = open_read_close(filename, buf, col - 1); 575 sz = open_read_close(filename, buf, col - 1);
569 if (sz > 0) { 576 if (sz > 0) {
577 const char *base;
578 int comm_len;
579
570 buf[sz] = '\0'; 580 buf[sz] = '\0';
571 while (--sz >= 0 && buf[sz] == '\0') 581 while (--sz >= 0 && buf[sz] == '\0')
572 continue; 582 continue;
573 do { 583 base = bb_basename(buf); /* before we replace argv0's NUL with space */
584 while (sz >= 0) {
574 if ((unsigned char)(buf[sz]) < ' ') 585 if ((unsigned char)(buf[sz]) < ' ')
575 buf[sz] = ' '; 586 buf[sz] = ' ';
576 } while (--sz >= 0); 587 sz--;
588 }
589
590 /* If comm differs from argv0, prepend "{comm} ".
591 * It allows to see thread names set by prctl(PR_SET_NAME).
592 */
593 if (base[0] == '-') /* "-sh" (login shell)? */
594 base++;
595 comm_len = strlen(comm);
596 /* Why compare up to comm_len, not COMM_LEN-1?
597 * Well, some processes rewrite argv, and use _spaces_ there
598 * while rewriting. (KDE is observed to do it).
599 * I prefer to still treat argv0 "process foo bar"
600 * as 'equal' to comm "process".
601 */
602 if (strncmp(base, comm, comm_len) != 0) {
603 comm_len += 3;
604 if (col > comm_len)
605 memmove(buf + comm_len, buf, col - comm_len);
606 snprintf(buf, col, "{%s}", comm);
607 if (col <= comm_len)
608 return;
609 buf[comm_len - 1] = ' ';
610 buf[col - 1] = '\0';
611 }
612
577 } else { 613 } else {
578 snprintf(buf, col, "[%s]", comm); 614 snprintf(buf, col, "[%s]", comm);
579 } 615 }
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index 2d6736f1a..b37270ff0 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -14,7 +14,6 @@
14//usage: "[-g GID] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP" 14//usage: "[-g GID] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP"
15//usage:#define addgroup_full_usage "\n\n" 15//usage:#define addgroup_full_usage "\n\n"
16//usage: "Add a group " IF_FEATURE_ADDUSER_TO_GROUP("or add a user to a group") "\n" 16//usage: "Add a group " IF_FEATURE_ADDUSER_TO_GROUP("or add a user to a group") "\n"
17//usage: "\nOptions:"
18//usage: "\n -g GID Group id" 17//usage: "\n -g GID Group id"
19//usage: "\n -S Create a system group" 18//usage: "\n -S Create a system group"
20 19
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index 47c674bf4..1d082c876 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -12,7 +12,6 @@
12//usage: "[OPTIONS] USER" 12//usage: "[OPTIONS] USER"
13//usage:#define adduser_full_usage "\n\n" 13//usage:#define adduser_full_usage "\n\n"
14//usage: "Add a user\n" 14//usage: "Add a user\n"
15//usage: "\nOptions:"
16//usage: "\n -h DIR Home directory" 15//usage: "\n -h DIR Home directory"
17//usage: "\n -g GECOS GECOS field" 16//usage: "\n -g GECOS GECOS field"
18//usage: "\n -s SHELL Login shell" 17//usage: "\n -s SHELL Login shell"
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c
index f4718c829..2262b792a 100644
--- a/loginutils/chpasswd.c
+++ b/loginutils/chpasswd.c
@@ -11,7 +11,6 @@
11//usage: IF_LONG_OPTS("[--md5|--encrypted]") IF_NOT_LONG_OPTS("[-m|-e]") 11//usage: IF_LONG_OPTS("[--md5|--encrypted]") IF_NOT_LONG_OPTS("[-m|-e]")
12//usage:#define chpasswd_full_usage "\n\n" 12//usage:#define chpasswd_full_usage "\n\n"
13//usage: "Read user:password from stdin and update /etc/passwd\n" 13//usage: "Read user:password from stdin and update /etc/passwd\n"
14//usage: "\nOptions:"
15//usage: IF_LONG_OPTS( 14//usage: IF_LONG_OPTS(
16//usage: "\n -e,--encrypted Supplied passwords are in encrypted form" 15//usage: "\n -e,--encrypted Supplied passwords are in encrypted form"
17//usage: "\n -m,--md5 Use MD5 encryption instead of DES" 16//usage: "\n -m,--md5 Use MD5 encryption instead of DES"
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c
index b25a39ac9..b244f55e3 100644
--- a/loginutils/cryptpw.c
+++ b/loginutils/cryptpw.c
@@ -15,7 +15,6 @@
15/* We do support -s, we just don't mention it */ 15/* We do support -s, we just don't mention it */
16//usage:#define cryptpw_full_usage "\n\n" 16//usage:#define cryptpw_full_usage "\n\n"
17//usage: "Crypt PASSWORD using crypt(3)\n" 17//usage: "Crypt PASSWORD using crypt(3)\n"
18//usage: "\nOptions:"
19//usage: IF_LONG_OPTS( 18//usage: IF_LONG_OPTS(
20//usage: "\n -P,--password-fd=N Read password from fd N" 19//usage: "\n -P,--password-fd=N Read password from fd N"
21/* //usage: "\n -s,--stdin Use stdin; like -P0" */ 20/* //usage: "\n -s,--stdin Use stdin; like -P0" */
@@ -35,7 +34,6 @@
35/* We do support -s, we just don't mention it */ 34/* We do support -s, we just don't mention it */
36//usage:#define mkpasswd_full_usage "\n\n" 35//usage:#define mkpasswd_full_usage "\n\n"
37//usage: "Crypt PASSWORD using crypt(3)\n" 36//usage: "Crypt PASSWORD using crypt(3)\n"
38//usage: "\nOptions:"
39//usage: IF_LONG_OPTS( 37//usage: IF_LONG_OPTS(
40//usage: "\n -P,--password-fd=N Read password from fd N" 38//usage: "\n -P,--password-fd=N Read password from fd N"
41/* //usage: "\n -s,--stdin Use stdin; like -P0" */ 39/* //usage: "\n -s,--stdin Use stdin; like -P0" */
diff --git a/loginutils/getty.c b/loginutils/getty.c
index dfa15b3da..62456651b 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -105,7 +105,6 @@ struct globals {
105//usage: "[OPTIONS] BAUD_RATE[,BAUD_RATE]... TTY [TERMTYPE]" 105//usage: "[OPTIONS] BAUD_RATE[,BAUD_RATE]... TTY [TERMTYPE]"
106//usage:#define getty_full_usage "\n\n" 106//usage:#define getty_full_usage "\n\n"
107//usage: "Open a tty, prompt for a login name, then invoke /bin/login\n" 107//usage: "Open a tty, prompt for a login name, then invoke /bin/login\n"
108//usage: "\nOptions:"
109//usage: "\n -h Enable hardware RTS/CTS flow control" 108//usage: "\n -h Enable hardware RTS/CTS flow control"
110//usage: "\n -L Set CLOCAL (ignore Carrier Detect state)" 109//usage: "\n -L Set CLOCAL (ignore Carrier Detect state)"
111//usage: "\n -m Get baud rate from modem's CONNECT status message" 110//usage: "\n -m Get baud rate from modem's CONNECT status message"
diff --git a/loginutils/login.c b/loginutils/login.c
index f2563dc09..2f7b9b212 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -7,7 +7,6 @@
7//usage: "[-p] [-h HOST] [[-f] USER]" 7//usage: "[-p] [-h HOST] [[-f] USER]"
8//usage:#define login_full_usage "\n\n" 8//usage:#define login_full_usage "\n\n"
9//usage: "Begin a new session on the system\n" 9//usage: "Begin a new session on the system\n"
10//usage: "\nOptions:"
11//usage: "\n -f Don't authenticate (user already authenticated)" 10//usage: "\n -f Don't authenticate (user already authenticated)"
12//usage: "\n -h Name of the remote host" 11//usage: "\n -h Name of the remote host"
13//usage: "\n -p Preserve environment" 12//usage: "\n -p Preserve environment"
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index b3ce646f1..1cfafaec3 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -8,7 +8,6 @@
8//usage:#define passwd_full_usage "\n\n" 8//usage:#define passwd_full_usage "\n\n"
9//usage: "Change USER's password (default: current user)" 9//usage: "Change USER's password (default: current user)"
10//usage: "\n" 10//usage: "\n"
11//usage: "\nOptions:"
12//usage: "\n -a ALG Encryption method" 11//usage: "\n -a ALG Encryption method"
13//usage: "\n -d Set password to ''" 12//usage: "\n -d Set password to ''"
14//usage: "\n -l Lock (disable) account" 13//usage: "\n -l Lock (disable) account"
diff --git a/loginutils/su.c b/loginutils/su.c
index 72dd0f06f..57ea738f4 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -12,7 +12,6 @@
12//usage: "[OPTIONS] [-] [USER]" 12//usage: "[OPTIONS] [-] [USER]"
13//usage:#define su_full_usage "\n\n" 13//usage:#define su_full_usage "\n\n"
14//usage: "Run shell under USER (by default, root)\n" 14//usage: "Run shell under USER (by default, root)\n"
15//usage: "\nOptions:"
16//usage: "\n -,-l Clear environment, run shell as login shell" 15//usage: "\n -,-l Clear environment, run shell as login shell"
17//usage: "\n -p,-m Do not set new $HOME, $SHELL, $USER, $LOGNAME" 16//usage: "\n -p,-m Do not set new $HOME, $SHELL, $USER, $LOGNAME"
18//usage: "\n -c CMD Command to pass to 'sh -c'" 17//usage: "\n -c CMD Command to pass to 'sh -c'"
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
index 28edf067c..bd2b09eed 100644
--- a/loginutils/sulogin.c
+++ b/loginutils/sulogin.c
@@ -9,7 +9,6 @@
9//usage: "[-t N] [TTY]" 9//usage: "[-t N] [TTY]"
10//usage:#define sulogin_full_usage "\n\n" 10//usage:#define sulogin_full_usage "\n\n"
11//usage: "Single user login\n" 11//usage: "Single user login\n"
12//usage: "\nOptions:"
13//usage: "\n -t N Timeout" 12//usage: "\n -t N Timeout"
14 13
15#include "libbb.h" 14#include "libbb.h"
diff --git a/loginutils/vlock.c b/loginutils/vlock.c
index efad63ff3..75af9390e 100644
--- a/loginutils/vlock.c
+++ b/loginutils/vlock.c
@@ -19,7 +19,6 @@
19//usage: "[-a]" 19//usage: "[-a]"
20//usage:#define vlock_full_usage "\n\n" 20//usage:#define vlock_full_usage "\n\n"
21//usage: "Lock a virtual terminal. A password is required to unlock.\n" 21//usage: "Lock a virtual terminal. A password is required to unlock.\n"
22//usage: "\nOptions:"
23//usage: "\n -a Lock all VTs" 22//usage: "\n -a Lock all VTs"
24 23
25#include "libbb.h" 24#include "libbb.h"
diff --git a/mailutils/makemime.c b/mailutils/makemime.c
index 628619bb8..4dc53a3b2 100644
--- a/mailutils/makemime.c
+++ b/mailutils/makemime.c
@@ -132,12 +132,11 @@ Content-Transfer-Encoding: 7bit
132//usage:#define makemime_full_usage "\n\n" 132//usage:#define makemime_full_usage "\n\n"
133//usage: "Create multipart MIME-encoded message from FILEs\n" 133//usage: "Create multipart MIME-encoded message from FILEs\n"
134/* //usage: "Transfer encoding is base64, disposition is inline (not attachment)\n" */ 134/* //usage: "Transfer encoding is base64, disposition is inline (not attachment)\n" */
135//usage: "\nOptions:"
136//usage: "\n -o FILE Output. Default: stdout" 135//usage: "\n -o FILE Output. Default: stdout"
137//usage: "\n -a HDR Add header. Examples:" 136//usage: "\n -a HDR Add header. Examples:"
138//usage: "\n \"From: user@host.org\", \"Date: `date -R`\"" 137//usage: "\n \"From: user@host.org\", \"Date: `date -R`\""
139//usage: "\n -c CT Content type. Default: text/plain" 138//usage: "\n -c CT Content type. Default: text/plain"
140//usage: "\n -C CS Charset. Default: " CONFIG_FEATURE_MIME_CHARSET 139//usage: "\n -C CS Charset. Default: " CONFIG_FEATURE_MIME_CHARSET
141/* //usage: "\n -e ENC Transfer encoding. Ignored. base64 is assumed" */ 140/* //usage: "\n -e ENC Transfer encoding. Ignored. base64 is assumed" */
142//usage: "\n" 141//usage: "\n"
143//usage: "\nOther options are silently ignored" 142//usage: "\nOther options are silently ignored"
diff --git a/mailutils/popmaildir.c b/mailutils/popmaildir.c
index c9d22aa28..62030331e 100644
--- a/mailutils/popmaildir.c
+++ b/mailutils/popmaildir.c
@@ -16,7 +16,6 @@
16//usage: "[OPTIONS] MAILDIR [CONN_HELPER ARGS]" 16//usage: "[OPTIONS] MAILDIR [CONN_HELPER ARGS]"
17//usage:#define popmaildir_full_usage "\n\n" 17//usage:#define popmaildir_full_usage "\n\n"
18//usage: "Fetch content of remote mailbox to local maildir\n" 18//usage: "Fetch content of remote mailbox to local maildir\n"
19//usage: "\nOptions:"
20/* //usage: "\n -b Binary mode. Ignored" */ 19/* //usage: "\n -b Binary mode. Ignored" */
21/* //usage: "\n -d Debug. Ignored" */ 20/* //usage: "\n -d Debug. Ignored" */
22/* //usage: "\n -m Show used memory. Ignored" */ 21/* //usage: "\n -m Show used memory. Ignored" */
diff --git a/mailutils/reformime.c b/mailutils/reformime.c
index aa5e3b1c0..5e28ef729 100644
--- a/mailutils/reformime.c
+++ b/mailutils/reformime.c
@@ -234,7 +234,6 @@ static int parse(const char *boundary, char **argv)
234//usage: "[OPTIONS]" 234//usage: "[OPTIONS]"
235//usage:#define reformime_full_usage "\n\n" 235//usage:#define reformime_full_usage "\n\n"
236//usage: "Parse MIME-encoded message on stdin\n" 236//usage: "Parse MIME-encoded message on stdin\n"
237//usage: "\nOptions:"
238//usage: "\n -x PREFIX Extract content of MIME sections to files" 237//usage: "\n -x PREFIX Extract content of MIME sections to files"
239//usage: "\n -X PROG ARGS Filter content of MIME sections through PROG" 238//usage: "\n -X PROG ARGS Filter content of MIME sections through PROG"
240//usage: "\n Must be the last option" 239//usage: "\n Must be the last option"
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index e1edbbebc..98b6ccfbf 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -15,7 +15,6 @@
15//usage: "[-q] [-o OFF] [-f FREQ] [-p TCONST] [-t TICK]" 15//usage: "[-q] [-o OFF] [-f FREQ] [-p TCONST] [-t TICK]"
16//usage:#define adjtimex_full_usage "\n\n" 16//usage:#define adjtimex_full_usage "\n\n"
17//usage: "Read and optionally set system timebase parameters. See adjtimex(2)\n" 17//usage: "Read and optionally set system timebase parameters. See adjtimex(2)\n"
18//usage: "\nOptions:"
19//usage: "\n -q Quiet" 18//usage: "\n -q Quiet"
20//usage: "\n -o OFF Time offset, microseconds" 19//usage: "\n -o OFF Time offset, microseconds"
21//usage: "\n -f FREQ Frequency adjust, integer kernel units (65536 is 1ppm)" 20//usage: "\n -f FREQ Frequency adjust, integer kernel units (65536 is 1ppm)"
diff --git a/miscutils/beep.c b/miscutils/beep.c
index c7699ffe1..910e03e1b 100644
--- a/miscutils/beep.c
+++ b/miscutils/beep.c
@@ -11,8 +11,7 @@
11//usage:#define beep_trivial_usage 11//usage:#define beep_trivial_usage
12//usage: "-f FREQ -l LEN -d DELAY -r COUNT -n" 12//usage: "-f FREQ -l LEN -d DELAY -r COUNT -n"
13//usage:#define beep_full_usage "\n\n" 13//usage:#define beep_full_usage "\n\n"
14//usage: "Options:" 14//usage: " -f Frequency in Hz"
15//usage: "\n -f Frequency in Hz"
16//usage: "\n -l Length in ms" 15//usage: "\n -l Length in ms"
17//usage: "\n -d Delay in ms" 16//usage: "\n -d Delay in ms"
18//usage: "\n -r Repetitions" 17//usage: "\n -r Repetitions"
diff --git a/miscutils/chrt.c b/miscutils/chrt.c
index 7e40b9f13..91b5397c4 100644
--- a/miscutils/chrt.c
+++ b/miscutils/chrt.c
@@ -10,7 +10,6 @@
10//usage: "[-prfom] [PRIO] [PID | PROG ARGS]" 10//usage: "[-prfom] [PRIO] [PID | PROG ARGS]"
11//usage:#define chrt_full_usage "\n\n" 11//usage:#define chrt_full_usage "\n\n"
12//usage: "Change scheduling priority and class for a process\n" 12//usage: "Change scheduling priority and class for a process\n"
13//usage: "\nOptions:"
14//usage: "\n -p Operate on PID" 13//usage: "\n -p Operate on PID"
15//usage: "\n -r Set SCHED_RR class" 14//usage: "\n -r Set SCHED_RR class"
16//usage: "\n -f Set SCHED_FIFO class" 15//usage: "\n -f Set SCHED_FIFO class"
diff --git a/miscutils/conspy.c b/miscutils/conspy.c
index 90ef91c5c..433c3e829 100644
--- a/miscutils/conspy.c
+++ b/miscutils/conspy.c
@@ -30,7 +30,6 @@
30//usage: "A text-mode VNC like program for Linux virtual consoles." 30//usage: "A text-mode VNC like program for Linux virtual consoles."
31//usage: "\nTo exit, quickly press ESC 3 times." 31//usage: "\nTo exit, quickly press ESC 3 times."
32//usage: "\n" 32//usage: "\n"
33//usage: "\nOptions:"
34//usage: "\n -v Don't send keystrokes to the console" 33//usage: "\n -v Don't send keystrokes to the console"
35//usage: "\n -c Create missing devices in /dev" 34//usage: "\n -c Create missing devices in /dev"
36//usage: "\n -s Open a SHELL session" 35//usage: "\n -s Open a SHELL session"
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index 706276015..6493fe4f1 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -58,7 +58,6 @@
58//usage: "mntpnt [-v]" IF_DEVFSD_FG_NP("[-fg][-np]") 58//usage: "mntpnt [-v]" IF_DEVFSD_FG_NP("[-fg][-np]")
59//usage:#define devfsd_full_usage "\n\n" 59//usage:#define devfsd_full_usage "\n\n"
60//usage: "Manage devfs permissions and old device name symlinks\n" 60//usage: "Manage devfs permissions and old device name symlinks\n"
61//usage: "\nOptions:"
62//usage: "\n mntpnt The mount point where devfs is mounted" 61//usage: "\n mntpnt The mount point where devfs is mounted"
63//usage: "\n -v Print the protocol version numbers for devfsd" 62//usage: "\n -v Print the protocol version numbers for devfsd"
64//usage: "\n and the kernel-side protocol version and exit" 63//usage: "\n and the kernel-side protocol version and exit"
diff --git a/miscutils/eject.c b/miscutils/eject.c
index 184ccc5d7..a20e04b7f 100644
--- a/miscutils/eject.c
+++ b/miscutils/eject.c
@@ -17,7 +17,6 @@
17//usage: "[-t] [-T] [DEVICE]" 17//usage: "[-t] [-T] [DEVICE]"
18//usage:#define eject_full_usage "\n\n" 18//usage:#define eject_full_usage "\n\n"
19//usage: "Eject DEVICE or default /dev/cdrom\n" 19//usage: "Eject DEVICE or default /dev/cdrom\n"
20//usage: "\nOptions:"
21//usage: IF_FEATURE_EJECT_SCSI( 20//usage: IF_FEATURE_EJECT_SCSI(
22//usage: "\n -s SCSI device" 21//usage: "\n -s SCSI device"
23//usage: ) 22//usage: )
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
index c761a88ca..51ba4729e 100644
--- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c
@@ -24,8 +24,7 @@
24//usage:#define fbsplash_trivial_usage 24//usage:#define fbsplash_trivial_usage
25//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" 25//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]"
26//usage:#define fbsplash_full_usage "\n\n" 26//usage:#define fbsplash_full_usage "\n\n"
27//usage: "Options:" 27//usage: " -s Image"
28//usage: "\n -s Image"
29//usage: "\n -c Hide cursor" 28//usage: "\n -c Hide cursor"
30//usage: "\n -d Framebuffer device (default /dev/fb0)" 29//usage: "\n -d Framebuffer device (default /dev/fb0)"
31//usage: "\n -i Config file (var=value):" 30//usage: "\n -i Config file (var=value):"
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c
index 33803f87d..0598371d5 100644
--- a/miscutils/flash_eraseall.c
+++ b/miscutils/flash_eraseall.c
@@ -14,7 +14,6 @@
14//usage: "[-jq] MTD_DEVICE" 14//usage: "[-jq] MTD_DEVICE"
15//usage:#define flash_eraseall_full_usage "\n\n" 15//usage:#define flash_eraseall_full_usage "\n\n"
16//usage: "Erase an MTD device\n" 16//usage: "Erase an MTD device\n"
17//usage: "\nOptions:"
18//usage: "\n -j Format the device for jffs2" 17//usage: "\n -j Format the device for jffs2"
19//usage: "\n -q Don't display progress messages" 18//usage: "\n -q Don't display progress messages"
20 19
diff --git a/miscutils/flashcp.c b/miscutils/flashcp.c
index e4bb3a902..790f9c01f 100644
--- a/miscutils/flashcp.c
+++ b/miscutils/flashcp.c
@@ -11,7 +11,6 @@
11//usage: "-v FILE MTD_DEVICE" 11//usage: "-v FILE MTD_DEVICE"
12//usage:#define flashcp_full_usage "\n\n" 12//usage:#define flashcp_full_usage "\n\n"
13//usage: "Copy an image to MTD device\n" 13//usage: "Copy an image to MTD device\n"
14//usage: "\nOptions:"
15//usage: "\n -v Verbose" 14//usage: "\n -v Verbose"
16 15
17#include "libbb.h" 16#include "libbb.h"
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 7608408dd..f30e7dec6 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -15,8 +15,7 @@
15//usage:#define hdparm_trivial_usage 15//usage:#define hdparm_trivial_usage
16//usage: "[OPTIONS] [DEVICE]" 16//usage: "[OPTIONS] [DEVICE]"
17//usage:#define hdparm_full_usage "\n\n" 17//usage:#define hdparm_full_usage "\n\n"
18//usage: "Options:" 18//usage: " -a Get/set fs readahead"
19//usage: "\n -a Get/set fs readahead"
20//usage: "\n -A Set drive read-lookahead flag (0/1)" 19//usage: "\n -A Set drive read-lookahead flag (0/1)"
21//usage: "\n -b Get/set bus state (0 == off, 1 == on, 2 == tristate)" 20//usage: "\n -b Get/set bus state (0 == off, 1 == on, 2 == tristate)"
22//usage: "\n -B Set Advanced Power Management setting (1-255)" 21//usage: "\n -B Set Advanced Power Management setting (1-255)"
diff --git a/miscutils/ionice.c b/miscutils/ionice.c
index 2bc83c5eb..bd300605f 100644
--- a/miscutils/ionice.c
+++ b/miscutils/ionice.c
@@ -11,7 +11,6 @@
11//usage: "[-c 1-3] [-n 0-7] [-p PID] [PROG]" 11//usage: "[-c 1-3] [-n 0-7] [-p PID] [PROG]"
12//usage:#define ionice_full_usage "\n\n" 12//usage:#define ionice_full_usage "\n\n"
13//usage: "Change I/O priority and class\n" 13//usage: "Change I/O priority and class\n"
14//usage: "\nOptions:"
15//usage: "\n -c Class. 1:realtime 2:best-effort 3:idle" 14//usage: "\n -c Class. 1:realtime 2:best-effort 3:idle"
16//usage: "\n -n Priority" 15//usage: "\n -n Priority"
17 16
diff --git a/miscutils/last.c b/miscutils/last.c
index 27f5a35ce..d52780374 100644
--- a/miscutils/last.c
+++ b/miscutils/last.c
@@ -12,7 +12,6 @@
12//usage:#define last_full_usage "\n\n" 12//usage:#define last_full_usage "\n\n"
13//usage: "Show listing of the last users that logged into the system" 13//usage: "Show listing of the last users that logged into the system"
14//usage: IF_FEATURE_LAST_FANCY( "\n" 14//usage: IF_FEATURE_LAST_FANCY( "\n"
15//usage: "\nOptions:"
16/* //usage: "\n -H Show header line" */ 15/* //usage: "\n -H Show header line" */
17//usage: "\n -W Display with no host column truncation" 16//usage: "\n -W Display with no host column truncation"
18//usage: "\n -f FILE Read from FILE instead of /var/log/wtmp" 17//usage: "\n -f FILE Read from FILE instead of /var/log/wtmp"
diff --git a/miscutils/less.c b/miscutils/less.c
index 77fd5a8de..46024f9f7 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -25,7 +25,6 @@
25//usage: "[-EMNmh~I?] [FILE]..." 25//usage: "[-EMNmh~I?] [FILE]..."
26//usage:#define less_full_usage "\n\n" 26//usage:#define less_full_usage "\n\n"
27//usage: "View FILE (or stdin) one screenful at a time\n" 27//usage: "View FILE (or stdin) one screenful at a time\n"
28//usage: "\nOptions:"
29//usage: "\n -E Quit once the end of a file is reached" 28//usage: "\n -E Quit once the end of a file is reached"
30//usage: "\n -M,-m Display status line with line numbers" 29//usage: "\n -M,-m Display status line with line numbers"
31//usage: "\n and percentage through the file" 30//usage: "\n and percentage through the file"
diff --git a/miscutils/man.c b/miscutils/man.c
index 2c6b25ceb..3bf7e84b6 100644
--- a/miscutils/man.c
+++ b/miscutils/man.c
@@ -7,8 +7,7 @@
7//usage: "[-aw] [MANPAGE]..." 7//usage: "[-aw] [MANPAGE]..."
8//usage:#define man_full_usage "\n\n" 8//usage:#define man_full_usage "\n\n"
9//usage: "Format and display manual page\n" 9//usage: "Format and display manual page\n"
10//usage: "\nOptions:" 10//usage: "\n -a Display all pages"
11//usage: "\n -a Display all pages"
12//usage: "\n -w Show page locations" 11//usage: "\n -w Show page locations"
13 12
14#include "libbb.h" 13#include "libbb.h"
diff --git a/miscutils/microcom.c b/miscutils/microcom.c
index edaeb6fa5..5e29a1acd 100644
--- a/miscutils/microcom.c
+++ b/miscutils/microcom.c
@@ -12,7 +12,6 @@
12//usage: "[-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY" 12//usage: "[-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY"
13//usage:#define microcom_full_usage "\n\n" 13//usage:#define microcom_full_usage "\n\n"
14//usage: "Copy bytes for stdin to TTY and from TTY to stdout\n" 14//usage: "Copy bytes for stdin to TTY and from TTY to stdout\n"
15//usage: "\nOptions:"
16//usage: "\n -d Wait up to DELAY ms for TTY output before sending every" 15//usage: "\n -d Wait up to DELAY ms for TTY output before sending every"
17//usage: "\n next byte to it" 16//usage: "\n next byte to it"
18//usage: "\n -t Exit if both stdin and TTY are silent for TIMEOUT ms" 17//usage: "\n -t Exit if both stdin and TTY are silent for TIMEOUT ms"
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c
index a1a5b396a..7041f7c59 100644
--- a/miscutils/mountpoint.c
+++ b/miscutils/mountpoint.c
@@ -13,7 +13,6 @@
13//usage: "[-q] <[-dn] DIR | -x DEVICE>" 13//usage: "[-q] <[-dn] DIR | -x DEVICE>"
14//usage:#define mountpoint_full_usage "\n\n" 14//usage:#define mountpoint_full_usage "\n\n"
15//usage: "Check if the directory is a mountpoint\n" 15//usage: "Check if the directory is a mountpoint\n"
16//usage: "\nOptions:"
17//usage: "\n -q Quiet" 16//usage: "\n -q Quiet"
18//usage: "\n -d Print major/minor device number of the filesystem" 17//usage: "\n -d Print major/minor device number of the filesystem"
19//usage: "\n -n Print device name of the filesystem" 18//usage: "\n -n Print device name of the filesystem"
diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c
index c7fbe7d9c..768aed116 100644
--- a/miscutils/nandwrite.c
+++ b/miscutils/nandwrite.c
@@ -32,7 +32,6 @@
32//usage: "[-p] [-s ADDR] MTD_DEVICE [FILE]" 32//usage: "[-p] [-s ADDR] MTD_DEVICE [FILE]"
33//usage:#define nandwrite_full_usage "\n\n" 33//usage:#define nandwrite_full_usage "\n\n"
34//usage: "Write to the specified MTD device\n" 34//usage: "Write to the specified MTD device\n"
35//usage: "\nOptions:"
36//usage: "\n -p Pad to page size" 35//usage: "\n -p Pad to page size"
37//usage: "\n -s ADDR Start address" 36//usage: "\n -s ADDR Start address"
38 37
@@ -40,7 +39,6 @@
40//usage: "[-o] [-b] [-s ADDR] [-f FILE] MTD_DEVICE" 39//usage: "[-o] [-b] [-s ADDR] [-f FILE] MTD_DEVICE"
41//usage:#define nanddump_full_usage "\n\n" 40//usage:#define nanddump_full_usage "\n\n"
42//usage: "Dump the sepcified MTD device\n" 41//usage: "Dump the sepcified MTD device\n"
43//usage: "\nOptions:"
44//usage: "\n -o Omit oob data" 42//usage: "\n -o Omit oob data"
45//usage: "\n -b Omit bad block from the dump" 43//usage: "\n -b Omit bad block from the dump"
46//usage: "\n -s ADDR Start address" 44//usage: "\n -s ADDR Start address"
diff --git a/miscutils/setserial.c b/miscutils/setserial.c
index 2951b987d..26902a273 100644
--- a/miscutils/setserial.c
+++ b/miscutils/setserial.c
@@ -212,9 +212,9 @@ struct serial_struct {
212//usage:#define setserial_trivial_usage 212//usage:#define setserial_trivial_usage
213//usage: "[-gabGvzV] DEVICE [PARAMETER [ARG]]..." 213//usage: "[-gabGvzV] DEVICE [PARAMETER [ARG]]..."
214//usage:#define setserial_full_usage "\n\n" 214//usage:#define setserial_full_usage "\n\n"
215//usage: "Request or set Linux serial port information\n\n" 215//usage: "Request or set Linux serial port information\n"
216//usage: "Options:\n" 216//usage: "\n"
217//usage: " -g Interpret parameters as list of devices for reporting" 217//usage: " -g Interpret parameters as list of devices for reporting\n"
218//usage: " -a Print all available information\n" 218//usage: " -a Print all available information\n"
219//usage: " -b Print summary information\n" 219//usage: " -b Print summary information\n"
220//usage: " -G Print in form which can be fed back\n" 220//usage: " -G Print in form which can be fed back\n"
diff --git a/miscutils/strings.c b/miscutils/strings.c
index 6e8b9aefc..9f5018244 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -11,7 +11,6 @@
11//usage: "[-afo] [-n LEN] [FILE]..." 11//usage: "[-afo] [-n LEN] [FILE]..."
12//usage:#define strings_full_usage "\n\n" 12//usage:#define strings_full_usage "\n\n"
13//usage: "Display printable strings in a binary file\n" 13//usage: "Display printable strings in a binary file\n"
14//usage: "\nOptions:"
15//usage: "\n -a Scan whole file (default)" 14//usage: "\n -a Scan whole file (default)"
16//usage: "\n -f Precede strings with filenames" 15//usage: "\n -f Precede strings with filenames"
17//usage: "\n -n LEN At least LEN characters form a string (default 4)" 16//usage: "\n -n LEN At least LEN characters form a string (default 4)"
diff --git a/miscutils/taskset.c b/miscutils/taskset.c
index 77fc8643d..4a9e3230d 100644
--- a/miscutils/taskset.c
+++ b/miscutils/taskset.c
@@ -10,7 +10,6 @@
10//usage: "[-p] [MASK] [PID | PROG ARGS]" 10//usage: "[-p] [MASK] [PID | PROG ARGS]"
11//usage:#define taskset_full_usage "\n\n" 11//usage:#define taskset_full_usage "\n\n"
12//usage: "Set or get CPU affinity\n" 12//usage: "Set or get CPU affinity\n"
13//usage: "\nOptions:"
14//usage: "\n -p Operate on an existing PID" 13//usage: "\n -p Operate on an existing PID"
15//usage: 14//usage:
16//usage:#define taskset_example_usage 15//usage:#define taskset_example_usage
diff --git a/miscutils/time.c b/miscutils/time.c
index dcd89f8fc..945f15f0d 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -13,7 +13,6 @@
13//usage: "[-v] PROG ARGS" 13//usage: "[-v] PROG ARGS"
14//usage:#define time_full_usage "\n\n" 14//usage:#define time_full_usage "\n\n"
15//usage: "Run PROG, display resource usage when it exits\n" 15//usage: "Run PROG, display resource usage when it exits\n"
16//usage: "\nOptions:"
17//usage: "\n -v Verbose" 16//usage: "\n -v Verbose"
18 17
19#include "libbb.h" 18#include "libbb.h"
diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c
index fc7f38c5d..2a426dbdc 100644
--- a/miscutils/ubi_tools.c
+++ b/miscutils/ubi_tools.c
@@ -81,7 +81,6 @@
81//usage: "-m MTD_NUM [-d UBI_NUM] UBI_CTRL_DEV" 81//usage: "-m MTD_NUM [-d UBI_NUM] UBI_CTRL_DEV"
82//usage:#define ubiattach_full_usage "\n\n" 82//usage:#define ubiattach_full_usage "\n\n"
83//usage: "Attach MTD device to UBI\n" 83//usage: "Attach MTD device to UBI\n"
84//usage: "\nOptions:"
85//usage: "\n -m MTD_NUM MTD device number to attach" 84//usage: "\n -m MTD_NUM MTD device number to attach"
86//usage: "\n -d UBI_NUM UBI device number to assign" 85//usage: "\n -d UBI_NUM UBI device number to assign"
87//usage: 86//usage:
@@ -89,14 +88,12 @@
89//usage: "-d UBI_NUM UBI_CTRL_DEV" 88//usage: "-d UBI_NUM UBI_CTRL_DEV"
90//usage:#define ubidetach_full_usage "\n\n" 89//usage:#define ubidetach_full_usage "\n\n"
91//usage: "Detach MTD device from UBI\n" 90//usage: "Detach MTD device from UBI\n"
92//usage: "\nOptions:"
93//usage: "\n -d UBI_NUM UBI device number" 91//usage: "\n -d UBI_NUM UBI device number"
94//usage: 92//usage:
95//usage:#define ubimkvol_trivial_usage 93//usage:#define ubimkvol_trivial_usage
96//usage: "UBI_DEVICE -N NAME -s SIZE" 94//usage: "UBI_DEVICE -N NAME -s SIZE"
97//usage:#define ubimkvol_full_usage "\n\n" 95//usage:#define ubimkvol_full_usage "\n\n"
98//usage: "Create UBI volume\n" 96//usage: "Create UBI volume\n"
99//usage: "\nOptions:"
100//usage: "\n -a ALIGNMENT Volume alignment (default 1)" 97//usage: "\n -a ALIGNMENT Volume alignment (default 1)"
101//usage: "\n -n VOLID Volume ID, if not specified, it" 98//usage: "\n -n VOLID Volume ID, if not specified, it"
102//usage: "\n will be assigned automatically" 99//usage: "\n will be assigned automatically"
@@ -108,14 +105,12 @@
108//usage: "UBI_DEVICE -n VOLID" 105//usage: "UBI_DEVICE -n VOLID"
109//usage:#define ubirmvol_full_usage "\n\n" 106//usage:#define ubirmvol_full_usage "\n\n"
110//usage: "Remove UBI volume\n" 107//usage: "Remove UBI volume\n"
111//usage: "\nOptions:"
112//usage: "\n -n VOLID Volume ID" 108//usage: "\n -n VOLID Volume ID"
113//usage: 109//usage:
114//usage:#define ubirsvol_trivial_usage 110//usage:#define ubirsvol_trivial_usage
115//usage: "UBI_DEVICE -n VOLID -s SIZE" 111//usage: "UBI_DEVICE -n VOLID -s SIZE"
116//usage:#define ubirsvol_full_usage "\n\n" 112//usage:#define ubirsvol_full_usage "\n\n"
117//usage: "Resize UBI volume\n" 113//usage: "Resize UBI volume\n"
118//usage: "\nOptions:"
119//usage: "\n -n VOLID Volume ID to resize" 114//usage: "\n -n VOLID Volume ID to resize"
120//usage: "\n -s SIZE Size in bytes" 115//usage: "\n -s SIZE Size in bytes"
121//usage: 116//usage:
@@ -123,9 +118,8 @@
123//usage: "UBI_DEVICE [IMG_FILE]" 118//usage: "UBI_DEVICE [IMG_FILE]"
124//usage:#define ubiupdatevol_full_usage "\n\n" 119//usage:#define ubiupdatevol_full_usage "\n\n"
125//usage: "Update UBI volume\n" 120//usage: "Update UBI volume\n"
126//usage: "\nOptions:" 121//usage: "\n -t Truncate UBI volume"
127//usage: "\n -t Truncate UBI volume" 122//usage: "\n -s SIZE Bytes in input (if reading stdin)"
128//usage: "\n -s SIZE Bytes in input (if reading stdin)"
129 123
130 124
131int ubi_tools_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 125int ubi_tools_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index b24dd4b82..ee28dc30d 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -13,7 +13,6 @@
13//usage: "[-t N[ms]] [-T N[ms]] [-F] DEV" 13//usage: "[-t N[ms]] [-T N[ms]] [-F] DEV"
14//usage:#define watchdog_full_usage "\n\n" 14//usage:#define watchdog_full_usage "\n\n"
15//usage: "Periodically write to watchdog device DEV\n" 15//usage: "Periodically write to watchdog device DEV\n"
16//usage: "\nOptions:"
17//usage: "\n -T N Reboot after N seconds if not reset (default 60)" 16//usage: "\n -T N Reboot after N seconds if not reset (default 60)"
18//usage: "\n -t N Reset every N seconds (default 30)" 17//usage: "\n -t N Reset every N seconds (default 30)"
19//usage: "\n -F Run in foreground" 18//usage: "\n -F Run in foreground"
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 94e4e2863..887d9f2a3 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -23,7 +23,6 @@
23//usage:#define insmod_full_usage "\n\n" 23//usage:#define insmod_full_usage "\n\n"
24//usage: "Load the specified kernel modules into the kernel" 24//usage: "Load the specified kernel modules into the kernel"
25//usage: IF_FEATURE_2_4_MODULES( "\n" 25//usage: IF_FEATURE_2_4_MODULES( "\n"
26//usage: "\nOptions:"
27//usage: "\n -f Force module to load into the wrong kernel version" 26//usage: "\n -f Force module to load into the wrong kernel version"
28//usage: "\n -k Make module autoclean-able" 27//usage: "\n -k Make module autoclean-able"
29//usage: "\n -v Verbose" 28//usage: "\n -v Verbose"
diff --git a/modutils/modinfo.c b/modutils/modinfo.c
index db134bd00..410b6fbe4 100644
--- a/modutils/modinfo.c
+++ b/modutils/modinfo.c
@@ -108,8 +108,7 @@ static void modinfo(const char *path, const char *version,
108//usage:#define modinfo_trivial_usage 108//usage:#define modinfo_trivial_usage
109//usage: "[-adlp0] [-F keyword] MODULE" 109//usage: "[-adlp0] [-F keyword] MODULE"
110//usage:#define modinfo_full_usage "\n\n" 110//usage:#define modinfo_full_usage "\n\n"
111//usage: "Options:" 111//usage: " -a Shortcut for '-F author'"
112//usage: "\n -a Shortcut for '-F author'"
113//usage: "\n -d Shortcut for '-F description'" 112//usage: "\n -d Shortcut for '-F description'"
114//usage: "\n -l Shortcut for '-F license'" 113//usage: "\n -l Shortcut for '-F license'"
115//usage: "\n -p Shortcut for '-F parm'" 114//usage: "\n -p Shortcut for '-F parm'"
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index 2a69eb513..f5b283b47 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -711,7 +711,6 @@ The following options are useful for people managing distributions:
711//usage:#define insmod_full_usage "\n\n" 711//usage:#define insmod_full_usage "\n\n"
712//usage: "Load the specified kernel modules into the kernel" 712//usage: "Load the specified kernel modules into the kernel"
713//usage: IF_FEATURE_2_4_MODULES( "\n" 713//usage: IF_FEATURE_2_4_MODULES( "\n"
714//usage: "\nOptions:"
715//usage: "\n -f Force module to load into the wrong kernel version" 714//usage: "\n -f Force module to load into the wrong kernel version"
716//usage: "\n -k Make module autoclean-able" 715//usage: "\n -k Make module autoclean-able"
717//usage: "\n -v Verbose" 716//usage: "\n -v Verbose"
@@ -727,7 +726,6 @@ The following options are useful for people managing distributions:
727//usage: "[-wfa] [MODULE]..." 726//usage: "[-wfa] [MODULE]..."
728//usage:#define rmmod_full_usage "\n\n" 727//usage:#define rmmod_full_usage "\n\n"
729//usage: "Unload kernel modules\n" 728//usage: "Unload kernel modules\n"
730//usage: "\nOptions:"
731//usage: "\n -w Wait until the module is no longer used" 729//usage: "\n -w Wait until the module is no longer used"
732//usage: "\n -f Force unload" 730//usage: "\n -f Force unload"
733//usage: "\n -a Remove all unused modules (recursively)" 731//usage: "\n -a Remove all unused modules (recursively)"
@@ -738,8 +736,7 @@ The following options are useful for people managing distributions:
738//usage:#define modprobe_trivial_usage 736//usage:#define modprobe_trivial_usage
739//usage: "[-qfwrsv] MODULE [symbol=value]..." 737//usage: "[-qfwrsv] MODULE [symbol=value]..."
740//usage:#define modprobe_full_usage "\n\n" 738//usage:#define modprobe_full_usage "\n\n"
741//usage: "Options:" 739//usage: " -r Remove MODULE (stacks) or do autoclean"
742//usage: "\n -r Remove MODULE (stacks) or do autoclean"
743//usage: "\n -q Quiet" 740//usage: "\n -q Quiet"
744//usage: "\n -v Verbose" 741//usage: "\n -v Verbose"
745//usage: "\n -f Force" 742//usage: "\n -f Force"
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 7ae459826..c1a1828d7 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -89,8 +89,7 @@
89//usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]" 89//usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]"
90//usage: " MODULE [symbol=value]..." 90//usage: " MODULE [symbol=value]..."
91//usage:#define modprobe_full_usage "\n\n" 91//usage:#define modprobe_full_usage "\n\n"
92//usage: "Options:" 92//usage: " -a Load multiple MODULEs"
93//usage: "\n -a Load multiple MODULEs"
94//usage: "\n -l List (MODULE is a pattern)" 93//usage: "\n -l List (MODULE is a pattern)"
95//usage: "\n -r Remove MODULE (stacks) or do autoclean" 94//usage: "\n -r Remove MODULE (stacks) or do autoclean"
96//usage: "\n -q Quiet" 95//usage: "\n -q Quiet"
@@ -158,20 +157,21 @@ struct module_entry { /* I'll call it ME. */
158 llist_t *deps; /* strings. modules we depend on */ 157 llist_t *deps; /* strings. modules we depend on */
159}; 158};
160 159
160#define DB_HASH_SIZE 256
161
161struct globals { 162struct globals {
162 llist_t *db; /* MEs of all modules ever seen (caching for speed) */
163 llist_t *probes; /* MEs of module(s) requested on cmdline */ 163 llist_t *probes; /* MEs of module(s) requested on cmdline */
164 char *cmdline_mopts; /* module options from cmdline */ 164 char *cmdline_mopts; /* module options from cmdline */
165 int num_unresolved_deps; 165 int num_unresolved_deps;
166 /* bool. "Did we have 'symbol:FOO' requested on cmdline?" */ 166 /* bool. "Did we have 'symbol:FOO' requested on cmdline?" */
167 smallint need_symbols; 167 smallint need_symbols;
168 struct utsname uts; 168 struct utsname uts;
169 llist_t *db[DB_HASH_SIZE]; /* MEs of all modules ever seen (caching for speed) */
169} FIX_ALIASING; 170} FIX_ALIASING;
170#define G (*(struct globals*)&bb_common_bufsiz1) 171#define G (*ptr_to_globals)
171#define INIT_G() do { } while (0) 172#define INIT_G() do { \
172struct BUG_G_too_big { 173 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
173 char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1]; 174} while (0)
174};
175 175
176 176
177static int read_config(const char *path); 177static int read_config(const char *path);
@@ -191,14 +191,26 @@ static char *gather_options_str(char *opts, const char *append)
191 return opts; 191 return opts;
192} 192}
193 193
194/* These three functions called many times, optimizing for speed.
195 * Users reported minute-long delays when they runn iptables repeatedly
196 * (iptables use modprobe to install needed kernel modules).
197 */
194static struct module_entry *helper_get_module(const char *module, int create) 198static struct module_entry *helper_get_module(const char *module, int create)
195{ 199{
196 char modname[MODULE_NAME_LEN]; 200 char modname[MODULE_NAME_LEN];
197 struct module_entry *e; 201 struct module_entry *e;
198 llist_t *l; 202 llist_t *l;
203 unsigned i;
204 unsigned hash;
199 205
200 filename2modname(module, modname); 206 filename2modname(module, modname);
201 for (l = G.db; l != NULL; l = l->link) { 207
208 hash = 0;
209 for (i = 0; modname[i]; i++)
210 hash = ((hash << 5) + hash) + modname[i];
211 hash %= DB_HASH_SIZE;
212
213 for (l = G.db[hash]; l; l = l->link) {
202 e = (struct module_entry *) l->data; 214 e = (struct module_entry *) l->data;
203 if (strcmp(e->modname, modname) == 0) 215 if (strcmp(e->modname, modname) == 0)
204 return e; 216 return e;
@@ -208,15 +220,15 @@ static struct module_entry *helper_get_module(const char *module, int create)
208 220
209 e = xzalloc(sizeof(*e)); 221 e = xzalloc(sizeof(*e));
210 e->modname = xstrdup(modname); 222 e->modname = xstrdup(modname);
211 llist_add_to(&G.db, e); 223 llist_add_to(&G.db[hash], e);
212 224
213 return e; 225 return e;
214} 226}
215static struct module_entry *get_or_add_modentry(const char *module) 227static ALWAYS_INLINE struct module_entry *get_or_add_modentry(const char *module)
216{ 228{
217 return helper_get_module(module, 1); 229 return helper_get_module(module, 1);
218} 230}
219static struct module_entry *get_modentry(const char *module) 231static ALWAYS_INLINE struct module_entry *get_modentry(const char *module)
220{ 232{
221 return helper_get_module(module, 0); 233 return helper_get_module(module, 0);
222} 234}
@@ -276,7 +288,7 @@ static int FAST_FUNC config_file_action(const char *filename,
276 continue; 288 continue;
277 filename2modname(tokens[1], wildcard); 289 filename2modname(tokens[1], wildcard);
278 290
279 for (l = G.probes; l != NULL; l = l->link) { 291 for (l = G.probes; l; l = l->link) {
280 m = (struct module_entry *) l->data; 292 m = (struct module_entry *) l->data;
281 if (fnmatch(wildcard, m->modname, 0) != 0) 293 if (fnmatch(wildcard, m->modname, 0) != 0)
282 continue; 294 continue;
@@ -378,7 +390,6 @@ static char *parse_and_add_kcmdline_module_options(char *options, const char *mo
378static int do_modprobe(struct module_entry *m) 390static int do_modprobe(struct module_entry *m)
379{ 391{
380 int rc, first; 392 int rc, first;
381 llist_t *l;
382 393
383 if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) { 394 if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) {
384 if (!(option_mask32 & INSMOD_OPT_SILENT)) 395 if (!(option_mask32 & INSMOD_OPT_SILENT))
@@ -391,8 +402,11 @@ static int do_modprobe(struct module_entry *m)
391 if (!(option_mask32 & OPT_REMOVE)) 402 if (!(option_mask32 & OPT_REMOVE))
392 m->deps = llist_rev(m->deps); 403 m->deps = llist_rev(m->deps);
393 404
394 for (l = m->deps; l != NULL; l = l->link) 405 if (0) {
395 DBG("dep: %s", l->data); 406 llist_t *l;
407 for (l = m->deps; l; l = l->link)
408 DBG("dep: %s", l->data);
409 }
396 410
397 first = 1; 411 first = 1;
398 rc = 0; 412 rc = 0;
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index 65a4911cd..4a4a91982 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -15,7 +15,6 @@
15//usage: "[-wfa] [MODULE]..." 15//usage: "[-wfa] [MODULE]..."
16//usage:#define rmmod_full_usage "\n\n" 16//usage:#define rmmod_full_usage "\n\n"
17//usage: "Unload kernel modules\n" 17//usage: "Unload kernel modules\n"
18//usage: "\nOptions:"
19//usage: "\n -w Wait until the module is no longer used" 18//usage: "\n -w Wait until the module is no longer used"
20//usage: "\n -f Force unload" 19//usage: "\n -f Force unload"
21//usage: "\n -a Remove all unused modules (recursively)" 20//usage: "\n -a Remove all unused modules (recursively)"
diff --git a/networking/arp.c b/networking/arp.c
index 3f68f5cf7..696c402e0 100644
--- a/networking/arp.c
+++ b/networking/arp.c
@@ -21,7 +21,6 @@
21//usage: "\n[-v] [-H HWTYPE] [-i IF] -Ds HOSTNAME IFACE [netmask MASK] pub" 21//usage: "\n[-v] [-H HWTYPE] [-i IF] -Ds HOSTNAME IFACE [netmask MASK] pub"
22//usage:#define arp_full_usage "\n\n" 22//usage:#define arp_full_usage "\n\n"
23//usage: "Manipulate ARP cache\n" 23//usage: "Manipulate ARP cache\n"
24//usage: "\nOptions:"
25//usage: "\n -a Display (all) hosts" 24//usage: "\n -a Display (all) hosts"
26//usage: "\n -s Set new ARP entry" 25//usage: "\n -s Set new ARP entry"
27//usage: "\n -d Delete a specified entry" 26//usage: "\n -d Delete a specified entry"
diff --git a/networking/arping.c b/networking/arping.c
index 357dcaaf0..a4421edcb 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -10,7 +10,6 @@
10//usage: "[-fqbDUA] [-c CNT] [-w TIMEOUT] [-I IFACE] [-s SRC_IP] DST_IP" 10//usage: "[-fqbDUA] [-c CNT] [-w TIMEOUT] [-I IFACE] [-s SRC_IP] DST_IP"
11//usage:#define arping_full_usage "\n\n" 11//usage:#define arping_full_usage "\n\n"
12//usage: "Send ARP requests/replies\n" 12//usage: "Send ARP requests/replies\n"
13//usage: "\nOptions:"
14//usage: "\n -f Quit on first ARP reply" 13//usage: "\n -f Quit on first ARP reply"
15//usage: "\n -q Quiet" 14//usage: "\n -q Quiet"
16//usage: "\n -b Keep broadcasting, don't go unicast" 15//usage: "\n -b Keep broadcasting, don't go unicast"
diff --git a/networking/dnsd.c b/networking/dnsd.c
index 65eae9670..d80306d3d 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -21,7 +21,6 @@
21//usage: "[-dvs] [-c CONFFILE] [-t TTL_SEC] [-p PORT] [-i ADDR]" 21//usage: "[-dvs] [-c CONFFILE] [-t TTL_SEC] [-p PORT] [-i ADDR]"
22//usage:#define dnsd_full_usage "\n\n" 22//usage:#define dnsd_full_usage "\n\n"
23//usage: "Small static DNS server daemon\n" 23//usage: "Small static DNS server daemon\n"
24//usage: "\nOptions:"
25//usage: "\n -c FILE Config file" 24//usage: "\n -c FILE Config file"
26//usage: "\n -t SEC TTL" 25//usage: "\n -t SEC TTL"
27//usage: "\n -p PORT Listen on PORT" 26//usage: "\n -p PORT Listen on PORT"
diff --git a/networking/ether-wake.c b/networking/ether-wake.c
index 7bb9aa5a7..6a88279f4 100644
--- a/networking/ether-wake.c
+++ b/networking/ether-wake.c
@@ -70,18 +70,15 @@
70//usage: "Send a magic packet to wake up sleeping machines.\n" 70//usage: "Send a magic packet to wake up sleeping machines.\n"
71//usage: "MAC must be a station address (00:11:22:33:44:55) or\n" 71//usage: "MAC must be a station address (00:11:22:33:44:55) or\n"
72//usage: "a hostname with a known 'ethers' entry.\n" 72//usage: "a hostname with a known 'ethers' entry.\n"
73//usage: "\nOptions:"
74//usage: "\n -b Send wake-up packet to the broadcast address" 73//usage: "\n -b Send wake-up packet to the broadcast address"
75//usage: "\n -i iface Interface to use (default eth0)" 74//usage: "\n -i iface Interface to use (default eth0)"
76//usage: "\n -p pass Append four or six byte password PW to the packet" 75//usage: "\n -p pass Append four or six byte password PW to the packet"
77 76
77#include "libbb.h"
78#include <netpacket/packet.h> 78#include <netpacket/packet.h>
79#include <net/ethernet.h>
80#include <netinet/ether.h> 79#include <netinet/ether.h>
81#include <linux/if.h> 80#include <linux/if.h>
82 81
83#include "libbb.h"
84
85/* Note: PF_INET, SOCK_DGRAM, IPPROTO_UDP would allow SIOCGIFHWADDR to 82/* Note: PF_INET, SOCK_DGRAM, IPPROTO_UDP would allow SIOCGIFHWADDR to
86 * work as non-root, but we need SOCK_PACKET to specify the Ethernet 83 * work as non-root, but we need SOCK_PACKET to specify the Ethernet
87 * destination address. 84 * destination address.
diff --git a/networking/ftpd.c b/networking/ftpd.c
index fae634ec4..e38138c0a 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -22,7 +22,6 @@
22//usage: " 21 stream tcp nowait root ftpd ftpd /files/to/serve\n" 22//usage: " 21 stream tcp nowait root ftpd ftpd /files/to/serve\n"
23//usage: "It also can be ran from tcpsvd:\n" 23//usage: "It also can be ran from tcpsvd:\n"
24//usage: " tcpsvd -vE 0.0.0.0 21 ftpd /files/to/serve\n" 24//usage: " tcpsvd -vE 0.0.0.0 21 ftpd /files/to/serve\n"
25//usage: "\nOptions:"
26//usage: "\n -w Allow upload" 25//usage: "\n -w Allow upload"
27//usage: "\n -v Log errors to stderr. -vv: verbose log" 26//usage: "\n -v Log errors to stderr. -vv: verbose log"
28//usage: "\n -S Log errors to syslog. -SS: verbose log" 27//usage: "\n -S Log errors to syslog. -SS: verbose log"
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index f63df55f4..abdf94c45 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -17,7 +17,6 @@
17//usage: "[OPTIONS] HOST [LOCAL_FILE] REMOTE_FILE" 17//usage: "[OPTIONS] HOST [LOCAL_FILE] REMOTE_FILE"
18//usage:#define ftpget_full_usage "\n\n" 18//usage:#define ftpget_full_usage "\n\n"
19//usage: "Retrieve a remote file via FTP\n" 19//usage: "Retrieve a remote file via FTP\n"
20//usage: "\nOptions:"
21//usage: IF_FEATURE_FTPGETPUT_LONG_OPTIONS( 20//usage: IF_FEATURE_FTPGETPUT_LONG_OPTIONS(
22//usage: "\n -c,--continue Continue previous transfer" 21//usage: "\n -c,--continue Continue previous transfer"
23//usage: "\n -v,--verbose Verbose" 22//usage: "\n -v,--verbose Verbose"
@@ -37,7 +36,6 @@
37//usage: "[OPTIONS] HOST [REMOTE_FILE] LOCAL_FILE" 36//usage: "[OPTIONS] HOST [REMOTE_FILE] LOCAL_FILE"
38//usage:#define ftpput_full_usage "\n\n" 37//usage:#define ftpput_full_usage "\n\n"
39//usage: "Store a local file on a remote machine via FTP\n" 38//usage: "Store a local file on a remote machine via FTP\n"
40//usage: "\nOptions:"
41//usage: IF_FEATURE_FTPGETPUT_LONG_OPTIONS( 39//usage: IF_FEATURE_FTPGETPUT_LONG_OPTIONS(
42//usage: "\n -v,--verbose Verbose" 40//usage: "\n -v,--verbose Verbose"
43//usage: "\n -u,--username Username" 41//usage: "\n -u,--username Username"
diff --git a/networking/hostname.c b/networking/hostname.c
index 49a3e89bb..5f663908c 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -14,7 +14,6 @@
14//usage: "[OPTIONS] [HOSTNAME | -F FILE]" 14//usage: "[OPTIONS] [HOSTNAME | -F FILE]"
15//usage:#define hostname_full_usage "\n\n" 15//usage:#define hostname_full_usage "\n\n"
16//usage: "Get or set hostname or DNS domain name\n" 16//usage: "Get or set hostname or DNS domain name\n"
17//usage: "\nOptions:"
18//usage: "\n -s Short" 17//usage: "\n -s Short"
19//usage: "\n -i Addresses for the hostname" 18//usage: "\n -i Addresses for the hostname"
20//usage: "\n -d DNS domain name" 19//usage: "\n -d DNS domain name"
diff --git a/networking/httpd.c b/networking/httpd.c
index d77342a2a..ba5eebad5 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -107,7 +107,6 @@
107//usage: "or httpd -d/-e" IF_FEATURE_HTTPD_AUTH_MD5("/-m") " STRING" 107//usage: "or httpd -d/-e" IF_FEATURE_HTTPD_AUTH_MD5("/-m") " STRING"
108//usage:#define httpd_full_usage "\n\n" 108//usage:#define httpd_full_usage "\n\n"
109//usage: "Listen for incoming HTTP requests\n" 109//usage: "Listen for incoming HTTP requests\n"
110//usage: "\nOptions:"
111//usage: "\n -i Inetd mode" 110//usage: "\n -i Inetd mode"
112//usage: "\n -f Don't daemonize" 111//usage: "\n -f Don't daemonize"
113//usage: "\n -v[v] Verbose" 112//usage: "\n -v[v] Verbose"
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 220b02126..b6604f5d1 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -30,7 +30,6 @@
30//usage: IF_FEATURE_IFCONFIG_STATUS("[-a]") " interface [address]" 30//usage: IF_FEATURE_IFCONFIG_STATUS("[-a]") " interface [address]"
31//usage:#define ifconfig_full_usage "\n\n" 31//usage:#define ifconfig_full_usage "\n\n"
32//usage: "Configure a network interface\n" 32//usage: "Configure a network interface\n"
33//usage: "\nOptions:"
34//usage: "\n" 33//usage: "\n"
35//usage: IF_FEATURE_IPV6( 34//usage: IF_FEATURE_IPV6(
36//usage: " [add ADDRESS[/PREFIXLEN]]\n") 35//usage: " [add ADDRESS[/PREFIXLEN]]\n")
@@ -47,18 +46,14 @@
47//usage: " [mem_start NN] [io_addr NN] [irq NN]\n") 46//usage: " [mem_start NN] [io_addr NN] [irq NN]\n")
48//usage: " [up|down] ..." 47//usage: " [up|down] ..."
49 48
49#include "libbb.h"
50#include "inet_common.h"
50#include <net/if.h> 51#include <net/if.h>
51#include <net/if_arp.h> 52#include <net/if_arp.h>
52#include <netinet/in.h> 53#include <netinet/in.h>
53#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 54#ifdef HAVE_NET_ETHERNET_H
54#include <netpacket/packet.h> 55# include <net/ethernet.h>
55#include <net/ethernet.h>
56#else
57#include <sys/types.h>
58#include <netinet/if_ether.h>
59#endif 56#endif
60#include "libbb.h"
61#include "inet_common.h"
62 57
63#if ENABLE_FEATURE_IFCONFIG_SLIP 58#if ENABLE_FEATURE_IFCONFIG_SLIP
64# include <net/if_slip.h> 59# include <net/if_slip.h>
diff --git a/networking/ifenslave.c b/networking/ifenslave.c
index 208623e7d..ae7719f52 100644
--- a/networking/ifenslave.c
+++ b/networking/ifenslave.c
@@ -102,7 +102,6 @@
102//usage: "[-cdf] MASTER_IFACE SLAVE_IFACE..." 102//usage: "[-cdf] MASTER_IFACE SLAVE_IFACE..."
103//usage:#define ifenslave_full_usage "\n\n" 103//usage:#define ifenslave_full_usage "\n\n"
104//usage: "Configure network interfaces for parallel routing\n" 104//usage: "Configure network interfaces for parallel routing\n"
105//usage: "\nOptions:"
106//usage: "\n -c,--change-active Change active slave" 105//usage: "\n -c,--change-active Change active slave"
107//usage: "\n -d,--detach Remove slave interface from bonding device" 106//usage: "\n -d,--detach Remove slave interface from bonding device"
108//usage: "\n -f,--force Force, even if interface is not Ethernet" 107//usage: "\n -f,--force Force, even if interface is not Ethernet"
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index 421611aae..d8358cdfd 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -11,7 +11,6 @@
11//usage: "[OPTIONS]" 11//usage: "[OPTIONS]"
12//usage:#define ifplugd_full_usage "\n\n" 12//usage:#define ifplugd_full_usage "\n\n"
13//usage: "Network interface plug detection daemon\n" 13//usage: "Network interface plug detection daemon\n"
14//usage: "\nOptions:"
15//usage: "\n -n Don't daemonize" 14//usage: "\n -n Don't daemonize"
16//usage: "\n -s Don't log to syslog" 15//usage: "\n -s Don't log to syslog"
17//usage: "\n -i IFACE Interface" 16//usage: "\n -i IFACE Interface"
@@ -38,7 +37,9 @@
38#include <linux/if.h> 37#include <linux/if.h>
39#include <linux/mii.h> 38#include <linux/mii.h>
40#include <linux/ethtool.h> 39#include <linux/ethtool.h>
41#include <net/ethernet.h> 40#ifdef HAVE_NET_ETHERNET_H
41# include <net/ethernet.h>
42#endif
42#include <linux/netlink.h> 43#include <linux/netlink.h>
43#include <linux/rtnetlink.h> 44#include <linux/rtnetlink.h>
44#include <linux/sockios.h> 45#include <linux/sockios.h>
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index b48abb7dc..382033038 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -20,8 +20,7 @@
20//usage:#define ifup_trivial_usage 20//usage:#define ifup_trivial_usage
21//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." 21//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..."
22//usage:#define ifup_full_usage "\n\n" 22//usage:#define ifup_full_usage "\n\n"
23//usage: "Options:" 23//usage: " -a De/configure all interfaces automatically"
24//usage: "\n -a De/configure all interfaces automatically"
25//usage: "\n -i FILE Use FILE for interface definitions" 24//usage: "\n -i FILE Use FILE for interface definitions"
26//usage: "\n -n Print out what would happen, but don't do it" 25//usage: "\n -n Print out what would happen, but don't do it"
27//usage: IF_FEATURE_IFUPDOWN_MAPPING( 26//usage: IF_FEATURE_IFUPDOWN_MAPPING(
@@ -34,8 +33,7 @@
34//usage:#define ifdown_trivial_usage 33//usage:#define ifdown_trivial_usage
35//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." 34//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..."
36//usage:#define ifdown_full_usage "\n\n" 35//usage:#define ifdown_full_usage "\n\n"
37//usage: "Options:" 36//usage: " -a De/configure all interfaces automatically"
38//usage: "\n -a De/configure all interfaces automatically"
39//usage: "\n -i FILE Use FILE for interface definitions" 37//usage: "\n -i FILE Use FILE for interface definitions"
40//usage: "\n -n Print out what would happen, but don't do it" 38//usage: "\n -n Print out what would happen, but don't do it"
41//usage: IF_FEATURE_IFUPDOWN_MAPPING( 39//usage: IF_FEATURE_IFUPDOWN_MAPPING(
diff --git a/networking/inetd.c b/networking/inetd.c
index 58ae089d1..873fd9528 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -158,10 +158,9 @@
158//usage: "[-fe] [-q N] [-R N] [CONFFILE]" 158//usage: "[-fe] [-q N] [-R N] [CONFFILE]"
159//usage:#define inetd_full_usage "\n\n" 159//usage:#define inetd_full_usage "\n\n"
160//usage: "Listen for network connections and launch programs\n" 160//usage: "Listen for network connections and launch programs\n"
161//usage: "\nOptions:"
162//usage: "\n -f Run in foreground" 161//usage: "\n -f Run in foreground"
163//usage: "\n -e Log to stderr" 162//usage: "\n -e Log to stderr"
164//usage: "\n -q N Socket listen queue (default: 128)" 163//usage: "\n -q N Socket listen queue (default: 128)"
165//usage: "\n -R N Pause services after N connects/min" 164//usage: "\n -R N Pause services after N connects/min"
166//usage: "\n (default: 0 - disabled)" 165//usage: "\n (default: 0 - disabled)"
167 166
@@ -171,8 +170,11 @@
171#include "libbb.h" 170#include "libbb.h"
172 171
173#if ENABLE_FEATURE_INETD_RPC 172#if ENABLE_FEATURE_INETD_RPC
174#include <rpc/rpc.h> 173# if defined(__UCLIBC__) && ! defined(__UCLIBC_HAS_RPC__)
175#include <rpc/pmap_clnt.h> 174# error "You need to build uClibc with UCLIBC_HAS_RPC for NFS support"
175# endif
176# include <rpc/rpc.h>
177# include <rpc/pmap_clnt.h>
176#endif 178#endif
177 179
178#if !BB_MMU 180#if !BB_MMU
diff --git a/networking/interface.c b/networking/interface.c
index bea54c180..79c322ec0 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -30,15 +30,14 @@
30 * 20001008 - Bernd Eckenfels, Patch from RH for setting mtu 30 * 20001008 - Bernd Eckenfels, Patch from RH for setting mtu
31 * (default AF was wrong) 31 * (default AF was wrong)
32 */ 32 */
33
34#include "libbb.h"
35#include "inet_common.h"
33#include <net/if.h> 36#include <net/if.h>
34#include <net/if_arp.h> 37#include <net/if_arp.h>
35#ifndef __UCLIBC__ 38#ifdef HAVE_NET_ETHERNET_H
36# include <net/ethernet.h> 39# include <net/ethernet.h>
37#else
38# include <linux/if_ether.h>
39#endif 40#endif
40#include "libbb.h"
41#include "inet_common.h"
42 41
43#if ENABLE_FEATURE_HWIB 42#if ENABLE_FEATURE_HWIB
44/* #include <linux/if_infiniband.h> */ 43/* #include <linux/if_infiniband.h> */
diff --git a/networking/ip.c b/networking/ip.c
index 98d583325..fb2f5e2da 100644
--- a/networking/ip.c
+++ b/networking/ip.c
@@ -55,7 +55,7 @@
55//usage:#define iproute_full_usage "\n\n" 55//usage:#define iproute_full_usage "\n\n"
56//usage: "iproute { list | flush } SELECTOR\n" 56//usage: "iproute { list | flush } SELECTOR\n"
57//usage: "iproute get ADDRESS [from ADDRESS iif STRING]\n" 57//usage: "iproute get ADDRESS [from ADDRESS iif STRING]\n"
58//usage: " [oif STRING] [tos TOS]\n" 58//usage: " [oif STRING] [tos TOS]\n"
59//usage: "iproute { add | del | change | append | replace | monitor } ROUTE\n" 59//usage: "iproute { add | del | change | append | replace | monitor } ROUTE\n"
60//usage: " SELECTOR := [root PREFIX] [match PREFIX] [proto RTPROTO]\n" 60//usage: " SELECTOR := [root PREFIX] [match PREFIX] [proto RTPROTO]\n"
61//usage: " ROUTE := [TYPE] PREFIX [tos TOS] [proto RTPROTO]\n" 61//usage: " ROUTE := [TYPE] PREFIX [tos TOS] [proto RTPROTO]\n"
diff --git a/networking/ipcalc.c b/networking/ipcalc.c
index f96c73912..3c8b8bfc9 100644
--- a/networking/ipcalc.c
+++ b/networking/ipcalc.c
@@ -16,7 +16,6 @@
16//usage: "[OPTIONS] ADDRESS[[/]NETMASK] [NETMASK]" 16//usage: "[OPTIONS] ADDRESS[[/]NETMASK] [NETMASK]"
17//usage:#define ipcalc_full_usage "\n\n" 17//usage:#define ipcalc_full_usage "\n\n"
18//usage: "Calculate IP network settings from a IP address\n" 18//usage: "Calculate IP network settings from a IP address\n"
19//usage: "\nOptions:"
20//usage: IF_FEATURE_IPCALC_LONG_OPTIONS( 19//usage: IF_FEATURE_IPCALC_LONG_OPTIONS(
21//usage: "\n -b,--broadcast Display calculated broadcast address" 20//usage: "\n -b,--broadcast Display calculated broadcast address"
22//usage: "\n -n,--network Display calculated network address" 21//usage: "\n -n,--network Display calculated network address"
diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c
index 199e11225..a41405c33 100644
--- a/networking/isrv_identd.c
+++ b/networking/isrv_identd.c
@@ -11,7 +11,6 @@
11//usage: "[-fiw] [-b ADDR] [STRING]" 11//usage: "[-fiw] [-b ADDR] [STRING]"
12//usage:#define fakeidentd_full_usage "\n\n" 12//usage:#define fakeidentd_full_usage "\n\n"
13//usage: "Provide fake ident (auth) service\n" 13//usage: "Provide fake ident (auth) service\n"
14//usage: "\nOptions:"
15//usage: "\n -f Run in foreground" 14//usage: "\n -f Run in foreground"
16//usage: "\n -i Inetd mode" 15//usage: "\n -i Inetd mode"
17//usage: "\n -w Inetd 'wait' mode" 16//usage: "\n -w Inetd 'wait' mode"
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index 82ab979a5..bad2017fe 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -7,7 +7,7 @@
7#include <net/if.h> 7#include <net/if.h>
8#include <net/if_packet.h> 8#include <net/if_packet.h>
9#include <netpacket/packet.h> 9#include <netpacket/packet.h>
10#include <net/ethernet.h> 10#include <netinet/if_ether.h>
11 11
12#include "ip_common.h" /* #include "libbb.h" is inside */ 12#include "ip_common.h" /* #include "libbb.h" is inside */
13#include "rt_names.h" 13#include "rt_names.h"
diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c
index 04925ecf6..7aac8364d 100644
--- a/networking/libiproute/ll_proto.c
+++ b/networking/libiproute/ll_proto.c
@@ -12,11 +12,7 @@
12#include "rt_names.h" 12#include "rt_names.h"
13#include "utils.h" 13#include "utils.h"
14 14
15#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 15#include <netinet/if_ether.h>
16#include <net/ethernet.h>
17#else
18#include <linux/if_ether.h>
19#endif
20 16
21#if !ENABLE_WERROR 17#if !ENABLE_WERROR
22#warning de-bloat 18#warning de-bloat
diff --git a/networking/nameif.c b/networking/nameif.c
index 78719edac..5d7e8f9a4 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -61,7 +61,6 @@
61//usage: "\n [mac=]XX:XX:XX:XX:XX:XX" 61//usage: "\n [mac=]XX:XX:XX:XX:XX:XX"
62//usage: ) 62//usage: )
63//usage: "\n" 63//usage: "\n"
64//usage: "\nOptions:"
65//usage: "\n -c FILE Configuration file (default: /etc/mactab)" 64//usage: "\n -c FILE Configuration file (default: /etc/mactab)"
66//usage: "\n -s Log to syslog" 65//usage: "\n -s Log to syslog"
67//usage: 66//usage:
@@ -122,20 +121,20 @@ struct ethtool_drvinfo {
122}; 121};
123 122
124struct ethtool_cmd { 123struct ethtool_cmd {
125 __u32 cmd; 124 uint32_t cmd;
126 __u32 supported; /* Features this interface supports */ 125 uint32_t supported; /* Features this interface supports */
127 __u32 advertising; /* Features this interface advertises */ 126 uint32_t advertising; /* Features this interface advertises */
128 __u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ 127 uint16_t speed; /* The forced speed, 10Mb, 100Mb, gigabit */
129 __u8 duplex; /* Duplex, half or full */ 128 uint8_t duplex; /* Duplex, half or full */
130 __u8 port; /* Which connector port */ 129 uint8_t port; /* Which connector port */
131 __u8 phy_address; 130 uint8_t phy_address;
132 __u8 transceiver; /* Which transceiver to use */ 131 uint8_t transceiver; /* Which transceiver to use */
133 __u8 autoneg; /* Enable or disable autonegotiation */ 132 uint8_t autoneg; /* Enable or disable autonegotiation */
134 __u32 maxtxpkt; /* Tx pkts before generating tx int */ 133 uint32_t maxtxpkt; /* Tx pkts before generating tx int */
135 __u32 maxrxpkt; /* Rx pkts before generating rx int */ 134 uint32_t maxrxpkt; /* Rx pkts before generating rx int */
136 __u16 speed_hi; 135 uint16_t speed_hi;
137 __u16 reserved2; 136 uint16_t reserved2;
138 __u32 reserved[3]; 137 uint32_t reserved[3];
139}; 138};
140 139
141#define ETHTOOL_GSET 0x00000001 /* Get settings. */ 140#define ETHTOOL_GSET 0x00000001 /* Get settings. */
diff --git a/networking/nc.c b/networking/nc.c
index 31d450dda..1b32e3aa3 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -49,7 +49,7 @@
49//usage:#if !ENABLE_NC_110_COMPAT 49//usage:#if !ENABLE_NC_110_COMPAT
50//usage: 50//usage:
51//usage:#if ENABLE_NC_SERVER || ENABLE_NC_EXTRA 51//usage:#if ENABLE_NC_SERVER || ENABLE_NC_EXTRA
52//usage:#define NC_OPTIONS_STR "\n\nOptions:" 52//usage:#define NC_OPTIONS_STR "\n"
53//usage:#else 53//usage:#else
54//usage:#define NC_OPTIONS_STR 54//usage:#define NC_OPTIONS_STR
55//usage:#endif 55//usage:#endif
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c
index 29f99e76b..1daad1358 100644
--- a/networking/nc_bloaty.c
+++ b/networking/nc_bloaty.c
@@ -60,8 +60,7 @@
60//usage: "nc [OPTIONS] -l -p PORT [HOST] [PORT] - listen" 60//usage: "nc [OPTIONS] -l -p PORT [HOST] [PORT] - listen"
61//usage: ) 61//usage: )
62//usage:#define nc_full_usage "\n\n" 62//usage:#define nc_full_usage "\n\n"
63//usage: "Options:" 63//usage: " -e PROG Run PROG after connect (must be last)"
64//usage: "\n -e PROG Run PROG after connect (must be last)"
65//usage: IF_NC_SERVER( 64//usage: IF_NC_SERVER(
66//usage: "\n -l Listen mode, for inbound connects" 65//usage: "\n -l Listen mode, for inbound connects"
67//usage: ) 66//usage: )
diff --git a/networking/netstat.c b/networking/netstat.c
index 356fb53cb..9c239579f 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -21,7 +21,6 @@
21//usage: "[-"IF_ROUTE("r")"al] [-tuwx] [-en"IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]" 21//usage: "[-"IF_ROUTE("r")"al] [-tuwx] [-en"IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]"
22//usage:#define netstat_full_usage "\n\n" 22//usage:#define netstat_full_usage "\n\n"
23//usage: "Display networking information\n" 23//usage: "Display networking information\n"
24//usage: "\nOptions:"
25//usage: IF_ROUTE( 24//usage: IF_ROUTE(
26//usage: "\n -r Routing table" 25//usage: "\n -r Routing table"
27//usage: ) 26//usage: )
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 165673a1e..206af00c7 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -32,7 +32,6 @@
32//usage: "[-dnqNw"IF_FEATURE_NTPD_SERVER("l")"] [-S PROG] [-p PEER]..." 32//usage: "[-dnqNw"IF_FEATURE_NTPD_SERVER("l")"] [-S PROG] [-p PEER]..."
33//usage:#define ntpd_full_usage "\n\n" 33//usage:#define ntpd_full_usage "\n\n"
34//usage: "NTP client/server\n" 34//usage: "NTP client/server\n"
35//usage: "\nOptions:"
36//usage: "\n -d Verbose" 35//usage: "\n -d Verbose"
37//usage: "\n -n Do not daemonize" 36//usage: "\n -n Do not daemonize"
38//usage: "\n -q Quit after clock is set" 37//usage: "\n -q Quit after clock is set"
diff --git a/networking/ping.c b/networking/ping.c
index 7a9c2d1f0..d75747984 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -73,7 +73,6 @@
73//usage: "[OPTIONS] HOST" 73//usage: "[OPTIONS] HOST"
74//usage:# define ping_full_usage "\n\n" 74//usage:# define ping_full_usage "\n\n"
75//usage: "Send ICMP ECHO_REQUEST packets to network hosts\n" 75//usage: "Send ICMP ECHO_REQUEST packets to network hosts\n"
76//usage: "\nOptions:"
77//usage: "\n -4,-6 Force IP or IPv6 name resolution" 76//usage: "\n -4,-6 Force IP or IPv6 name resolution"
78//usage: "\n -c CNT Send only CNT pings" 77//usage: "\n -c CNT Send only CNT pings"
79//usage: "\n -s SIZE Send SIZE data bytes in packets (default:56)" 78//usage: "\n -s SIZE Send SIZE data bytes in packets (default:56)"
@@ -90,7 +89,6 @@
90//usage: "[OPTIONS] HOST" 89//usage: "[OPTIONS] HOST"
91//usage:# define ping6_full_usage "\n\n" 90//usage:# define ping6_full_usage "\n\n"
92//usage: "Send ICMP ECHO_REQUEST packets to network hosts\n" 91//usage: "Send ICMP ECHO_REQUEST packets to network hosts\n"
93//usage: "\nOptions:"
94//usage: "\n -c CNT Send only CNT pings" 92//usage: "\n -c CNT Send only CNT pings"
95//usage: "\n -s SIZE Send SIZE data bytes in packets (default:56)" 93//usage: "\n -s SIZE Send SIZE data bytes in packets (default:56)"
96//usage: "\n -I IFACE/IP Use interface or IP address as source" 94//usage: "\n -I IFACE/IP Use interface or IP address as source"
diff --git a/networking/pscan.c b/networking/pscan.c
index 5595148fc..28005ad57 100644
--- a/networking/pscan.c
+++ b/networking/pscan.c
@@ -10,7 +10,6 @@
10//usage: "[-cb] [-p MIN_PORT] [-P MAX_PORT] [-t TIMEOUT] [-T MIN_RTT] HOST" 10//usage: "[-cb] [-p MIN_PORT] [-P MAX_PORT] [-t TIMEOUT] [-T MIN_RTT] HOST"
11//usage:#define pscan_full_usage "\n\n" 11//usage:#define pscan_full_usage "\n\n"
12//usage: "Scan a host, print all open ports\n" 12//usage: "Scan a host, print all open ports\n"
13//usage: "\nOptions:"
14//usage: "\n -c Show closed ports too" 13//usage: "\n -c Show closed ports too"
15//usage: "\n -b Show blocked ports too" 14//usage: "\n -b Show blocked ports too"
16//usage: "\n -p Scan from this port (default 1)" 15//usage: "\n -p Scan from this port (default 1)"
diff --git a/networking/route.c b/networking/route.c
index 6699a1c32..b7b5a02e6 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -29,7 +29,6 @@
29//usage: "[{add|del|delete}]" 29//usage: "[{add|del|delete}]"
30//usage:#define route_full_usage "\n\n" 30//usage:#define route_full_usage "\n\n"
31//usage: "Edit kernel routing tables\n" 31//usage: "Edit kernel routing tables\n"
32//usage: "\nOptions:"
33//usage: "\n -n Don't resolve names" 32//usage: "\n -n Don't resolve names"
34//usage: "\n -e Display other/more information" 33//usage: "\n -e Display other/more information"
35//usage: "\n -A inet" IF_FEATURE_IPV6("{6}") " Select address family" 34//usage: "\n -A inet" IF_FEATURE_IPV6("{6}") " Select address family"
diff --git a/networking/slattach.c b/networking/slattach.c
index d1221b11a..a500da6d0 100644
--- a/networking/slattach.c
+++ b/networking/slattach.c
@@ -17,7 +17,6 @@
17//usage: "[-cehmLF] [-s SPEED] [-p PROTOCOL] DEVICE" 17//usage: "[-cehmLF] [-s SPEED] [-p PROTOCOL] DEVICE"
18//usage:#define slattach_full_usage "\n\n" 18//usage:#define slattach_full_usage "\n\n"
19//usage: "Attach network interface(s) to serial line(s)\n" 19//usage: "Attach network interface(s) to serial line(s)\n"
20//usage: "\nOptions:"
21//usage: "\n -p PROT Set protocol (slip, cslip, slip6, clisp6 or adaptive)" 20//usage: "\n -p PROT Set protocol (slip, cslip, slip6, clisp6 or adaptive)"
22//usage: "\n -s SPD Set line speed" 21//usage: "\n -s SPD Set line speed"
23//usage: "\n -e Exit after initializing device" 22//usage: "\n -e Exit after initializing device"
diff --git a/networking/tc.c b/networking/tc.c
index e9848a86b..1574353a5 100644
--- a/networking/tc.c
+++ b/networking/tc.c
@@ -58,10 +58,10 @@
58 58
59struct globals { 59struct globals {
60 int filter_ifindex; 60 int filter_ifindex;
61 __u32 filter_qdisc; 61 uint32_t filter_qdisc;
62 __u32 filter_parent; 62 uint32_t filter_parent;
63 __u32 filter_prio; 63 uint32_t filter_prio;
64 __u32 filter_proto; 64 uint32_t filter_proto;
65} FIX_ALIASING; 65} FIX_ALIASING;
66#define G (*(struct globals*)&bb_common_bufsiz1) 66#define G (*(struct globals*)&bb_common_bufsiz1)
67struct BUG_G_too_big { 67struct BUG_G_too_big {
@@ -94,8 +94,8 @@ static char* print_tc_classid(uint32_t cid)
94} 94}
95 95
96/* Get a qdisc handle. Return 0 on success, !0 otherwise. */ 96/* Get a qdisc handle. Return 0 on success, !0 otherwise. */
97static int get_qdisc_handle(__u32 *h, const char *str) { 97static int get_qdisc_handle(uint32_t *h, const char *str) {
98 __u32 maj; 98 uint32_t maj;
99 char *p; 99 char *p;
100 100
101 maj = TC_H_UNSPEC; 101 maj = TC_H_UNSPEC;
@@ -113,8 +113,8 @@ static int get_qdisc_handle(__u32 *h, const char *str) {
113} 113}
114 114
115/* Get class ID. Return 0 on success, !0 otherwise. */ 115/* Get class ID. Return 0 on success, !0 otherwise. */
116static int get_tc_classid(__u32 *h, const char *str) { 116static int get_tc_classid(uint32_t *h, const char *str) {
117 __u32 maj, min; 117 uint32_t maj, min;
118 char *p; 118 char *p;
119 119
120 maj = TC_H_ROOT; 120 maj = TC_H_ROOT;
@@ -513,7 +513,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
513 if (obj == OBJ_filter) 513 if (obj == OBJ_filter)
514 filter_parent = TC_H_ROOT; 514 filter_parent = TC_H_ROOT;
515 } else if (arg == ARG_parent) { 515 } else if (arg == ARG_parent) {
516 __u32 handle; 516 uint32_t handle;
517 if (msg.tcm_parent) 517 if (msg.tcm_parent)
518 duparg(*argv, "parent"); 518 duparg(*argv, "parent");
519 if (get_tc_classid(&handle, *argv)) 519 if (get_tc_classid(&handle, *argv))
@@ -530,7 +530,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
530 *slash = '\0'; 530 *slash = '\0';
531 */ 531 */
532 msg.tcm_handle = get_u32(*argv, "handle"); 532 msg.tcm_handle = get_u32(*argv, "handle");
533 /* if (slash) {if (get_u32(__u32 &mask, slash+1, NULL)) inv mask; addattr32(n, MAX_MSG, TCA_FW_MASK, mask); */ 533 /* if (slash) {if (get_u32(uint32_t &mask, slash+1, NULL)) inv mask; addattr32(n, MAX_MSG, TCA_FW_MASK, mask); */
534 } else if (arg == ARG_classid && obj == OBJ_class && cmd == CMD_change){ 534 } else if (arg == ARG_classid && obj == OBJ_class && cmd == CMD_change){
535 } else if (arg == ARG_pref || arg == ARG_prio) { /* filter::list */ 535 } else if (arg == ARG_pref || arg == ARG_prio) { /* filter::list */
536 if (filter_prio) 536 if (filter_prio)
diff --git a/networking/telnet.c b/networking/telnet.c
index 1f0d85107..6dd0de53a 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -26,7 +26,6 @@
26//usage: "[-a] [-l USER] HOST [PORT]" 26//usage: "[-a] [-l USER] HOST [PORT]"
27//usage:#define telnet_full_usage "\n\n" 27//usage:#define telnet_full_usage "\n\n"
28//usage: "Connect to telnet server\n" 28//usage: "Connect to telnet server\n"
29//usage: "\nOptions:"
30//usage: "\n -a Automatic login with $USER variable" 29//usage: "\n -a Automatic login with $USER variable"
31//usage: "\n -l USER Automatic login as USER" 30//usage: "\n -l USER Automatic login as USER"
32//usage: 31//usage:
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 4404064fc..33020f1b4 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -26,7 +26,6 @@
26//usage:#define telnetd_full_usage "\n\n" 26//usage:#define telnetd_full_usage "\n\n"
27//usage: "Handle incoming telnet connections" 27//usage: "Handle incoming telnet connections"
28//usage: IF_NOT_FEATURE_TELNETD_STANDALONE(" via inetd") "\n" 28//usage: IF_NOT_FEATURE_TELNETD_STANDALONE(" via inetd") "\n"
29//usage: "\nOptions:"
30//usage: "\n -l LOGIN Exec LOGIN on connect" 29//usage: "\n -l LOGIN Exec LOGIN on connect"
31//usage: "\n -f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue" 30//usage: "\n -f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue"
32//usage: "\n -K Close connection as soon as login exits" 31//usage: "\n -K Close connection as soon as login exits"
diff --git a/networking/tftp.c b/networking/tftp.c
index 648441016..17485a527 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -23,7 +23,6 @@
23//usage: "[OPTIONS] HOST [PORT]" 23//usage: "[OPTIONS] HOST [PORT]"
24//usage:#define tftp_full_usage "\n\n" 24//usage:#define tftp_full_usage "\n\n"
25//usage: "Transfer a file from/to tftp server\n" 25//usage: "Transfer a file from/to tftp server\n"
26//usage: "\nOptions:"
27//usage: "\n -l FILE Local FILE" 26//usage: "\n -l FILE Local FILE"
28//usage: "\n -r FILE Remote FILE" 27//usage: "\n -r FILE Remote FILE"
29//usage: IF_FEATURE_TFTP_GET( 28//usage: IF_FEATURE_TFTP_GET(
@@ -46,7 +45,6 @@
46//usage: " 69 dgram udp nowait root tftpd tftpd -l /files/to/serve\n" 45//usage: " 69 dgram udp nowait root tftpd tftpd -l /files/to/serve\n"
47//usage: "It also can be ran from udpsvd:\n" 46//usage: "It also can be ran from udpsvd:\n"
48//usage: " udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve\n" 47//usage: " udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve\n"
49//usage: "\nOptions:"
50//usage: "\n -r Prohibit upload" 48//usage: "\n -r Prohibit upload"
51//usage: "\n -c Allow file creation via upload" 49//usage: "\n -c Allow file creation via upload"
52//usage: "\n -u Access files as USER" 50//usage: "\n -u Access files as USER"
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 85181ab8d..c32103519 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -216,7 +216,6 @@
216//usage: " [-z PAUSE_MSEC] HOST [BYTES]" 216//usage: " [-z PAUSE_MSEC] HOST [BYTES]"
217//usage:#define traceroute_full_usage "\n\n" 217//usage:#define traceroute_full_usage "\n\n"
218//usage: "Trace the route to HOST\n" 218//usage: "Trace the route to HOST\n"
219//usage: "\nOptions:"
220//usage: IF_TRACEROUTE6( 219//usage: IF_TRACEROUTE6(
221//usage: "\n -4,-6 Force IP or IPv6 name resolution" 220//usage: "\n -4,-6 Force IP or IPv6 name resolution"
222//usage: ) 221//usage: )
@@ -242,7 +241,6 @@
242//usage: " HOST [BYTES]" 241//usage: " HOST [BYTES]"
243//usage:#define traceroute6_full_usage "\n\n" 242//usage:#define traceroute6_full_usage "\n\n"
244//usage: "Trace the route to HOST\n" 243//usage: "Trace the route to HOST\n"
245//usage: "\nOptions:"
246//usage: "\n -d Set SO_DEBUG options to socket" 244//usage: "\n -d Set SO_DEBUG options to socket"
247//usage: "\n -n Print numeric addresses" 245//usage: "\n -n Print numeric addresses"
248//usage: "\n -r Bypass routing tables, send directly to HOST" 246//usage: "\n -r Bypass routing tables, send directly to HOST"
diff --git a/networking/tunctl.c b/networking/tunctl.c
index 8cb733b68..3a0870eb5 100644
--- a/networking/tunctl.c
+++ b/networking/tunctl.c
@@ -14,7 +14,6 @@
14//usage: "[-f device] ([-t name] | -d name)" IF_FEATURE_TUNCTL_UG(" [-u owner] [-g group] [-b]") 14//usage: "[-f device] ([-t name] | -d name)" IF_FEATURE_TUNCTL_UG(" [-u owner] [-g group] [-b]")
15//usage:#define tunctl_full_usage "\n\n" 15//usage:#define tunctl_full_usage "\n\n"
16//usage: "Create or delete tun interfaces\n" 16//usage: "Create or delete tun interfaces\n"
17//usage: "\nOptions:"
18//usage: "\n -f name tun device (/dev/net/tun)" 17//usage: "\n -f name tun device (/dev/net/tun)"
19//usage: "\n -t name Create iface 'name'" 18//usage: "\n -t name Create iface 'name'"
20//usage: "\n -d name Delete iface 'name'" 19//usage: "\n -d name Delete iface 'name'"
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 510c3a1d0..4d755e6b8 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -25,14 +25,8 @@
25#include "dhcpd.h" 25#include "dhcpd.h"
26#include "dhcpc.h" 26#include "dhcpc.h"
27 27
28#include <asm/types.h> 28#include <netinet/if_ether.h>
29#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) 29#include <netpacket/packet.h>
30# include <netpacket/packet.h>
31# include <net/ethernet.h>
32#else
33# include <linux/if_packet.h>
34# include <linux/if_ether.h>
35#endif
36#include <linux/filter.h> 30#include <linux/filter.h>
37 31
38/* struct client_config_t client_config is in bb_common_bufsiz1 */ 32/* struct client_config_t client_config is in bb_common_bufsiz1 */
@@ -1134,8 +1128,11 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1134 client_config.no_default_options = 1; 1128 client_config.no_default_options = 1;
1135 while (list_O) { 1129 while (list_O) {
1136 char *optstr = llist_pop(&list_O); 1130 char *optstr = llist_pop(&list_O);
1137 unsigned n = udhcp_option_idx(optstr); 1131 unsigned n = bb_strtou(optstr, NULL, 0);
1138 n = dhcp_optflags[n].code; 1132 if (errno || n > 254) {
1133 n = udhcp_option_idx(optstr);
1134 n = dhcp_optflags[n].code;
1135 }
1139 client_config.opt_mask[n >> 3] |= 1 << (n & 7); 1136 client_config.opt_mask[n >> 3] |= 1 << (n & 7);
1140 } 1137 }
1141 while (list_x) { 1138 while (list_x) {
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
index ec07192c1..64cd73ec7 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -7,7 +7,6 @@
7//usage: "[-r|-a] [-f LEASEFILE]" 7//usage: "[-r|-a] [-f LEASEFILE]"
8//usage:#define dumpleases_full_usage "\n\n" 8//usage:#define dumpleases_full_usage "\n\n"
9//usage: "Display DHCP leases granted by udhcpd\n" 9//usage: "Display DHCP leases granted by udhcpd\n"
10//usage: "\nOptions:"
11//usage: IF_LONG_OPTS( 10//usage: IF_LONG_OPTS(
12//usage: "\n -f,--file=FILE Lease file" 11//usage: "\n -f,--file=FILE Lease file"
13//usage: "\n -r,--remaining Show remaining time" 12//usage: "\n -r,--remaining Show remaining time"
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 2b7528cc7..66b42c5e1 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -6,18 +6,11 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include <netinet/in.h>
10#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
11# include <netpacket/packet.h>
12# include <net/ethernet.h>
13#else
14# include <asm/types.h>
15# include <linux/if_packet.h>
16# include <linux/if_ether.h>
17#endif
18
19#include "common.h" 9#include "common.h"
20#include "dhcpd.h" 10#include "dhcpd.h"
11#include <netinet/in.h>
12#include <netinet/if_ether.h>
13#include <netpacket/packet.h>
21 14
22void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type) 15void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type)
23{ 16{
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 39f1cec54..a5220ba74 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -22,17 +22,8 @@
22 * along with this program; if not, write to the Free Software 22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */ 24 */
25#include <net/if.h>
26#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
27# include <netpacket/packet.h>
28# include <net/ethernet.h>
29#else
30# include <asm/types.h>
31# include <linux/if_packet.h>
32# include <linux/if_ether.h>
33#endif
34
35#include "common.h" 25#include "common.h"
26#include <net/if.h>
36 27
37int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac) 28int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac)
38{ 29{
diff --git a/networking/vconfig.c b/networking/vconfig.c
index 4fa341ac3..48b45d9af 100644
--- a/networking/vconfig.c
+++ b/networking/vconfig.c
@@ -13,7 +13,6 @@
13//usage: "COMMAND [OPTIONS]" 13//usage: "COMMAND [OPTIONS]"
14//usage:#define vconfig_full_usage "\n\n" 14//usage:#define vconfig_full_usage "\n\n"
15//usage: "Create and remove virtual ethernet devices\n" 15//usage: "Create and remove virtual ethernet devices\n"
16//usage: "\nOptions:"
17//usage: "\n add [interface-name] [vlan_id]" 16//usage: "\n add [interface-name] [vlan_id]"
18//usage: "\n rem [vlan-name]" 17//usage: "\n rem [vlan-name]"
19//usage: "\n set_flag [interface-name] [flag-num] [0 | 1]" 18//usage: "\n set_flag [interface-name] [flag-num] [0 | 1]"
diff --git a/networking/wget.c b/networking/wget.c
index 5f6e8155f..eca673a86 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -22,7 +22,6 @@
22//usage: ) 22//usage: )
23//usage:#define wget_full_usage "\n\n" 23//usage:#define wget_full_usage "\n\n"
24//usage: "Retrieve files via HTTP or FTP\n" 24//usage: "Retrieve files via HTTP or FTP\n"
25//usage: "\nOptions:"
26//usage: "\n -s Spider mode - only check file existence" 25//usage: "\n -s Spider mode - only check file existence"
27//usage: "\n -c Continue retrieval of aborted transfer" 26//usage: "\n -c Continue retrieval of aborted transfer"
28//usage: "\n -q Quiet" 27//usage: "\n -q Quiet"
diff --git a/networking/whois.c b/networking/whois.c
index 4eab9e5fe..bf330334a 100644
--- a/networking/whois.c
+++ b/networking/whois.c
@@ -24,7 +24,6 @@
24//usage: "[-h SERVER] [-p PORT] NAME..." 24//usage: "[-h SERVER] [-p PORT] NAME..."
25//usage:#define whois_full_usage "\n\n" 25//usage:#define whois_full_usage "\n\n"
26//usage: "Query WHOIS info about NAME\n" 26//usage: "Query WHOIS info about NAME\n"
27//usage: "\nOptions:"
28//usage: "\n -h,-p Server to query" 27//usage: "\n -h,-p Server to query"
29 28
30#include "libbb.h" 29#include "libbb.h"
diff --git a/networking/zcip.c b/networking/zcip.c
index 7250fb2fd..8a35eca5d 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -27,7 +27,6 @@
27//usage: "[OPTIONS] IFACE SCRIPT" 27//usage: "[OPTIONS] IFACE SCRIPT"
28//usage:#define zcip_full_usage "\n\n" 28//usage:#define zcip_full_usage "\n\n"
29//usage: "Manage a ZeroConf IPv4 link-local address\n" 29//usage: "Manage a ZeroConf IPv4 link-local address\n"
30//usage: "\nOptions:"
31//usage: "\n -f Run in foreground" 30//usage: "\n -f Run in foreground"
32//usage: "\n -q Quit after obtaining address" 31//usage: "\n -q Quit after obtaining address"
33//usage: "\n -r 169.254.x.x Request this address first" 32//usage: "\n -r 169.254.x.x Request this address first"
@@ -36,14 +35,12 @@
36//usage: "\nWith no -q, runs continuously monitoring for ARP conflicts," 35//usage: "\nWith no -q, runs continuously monitoring for ARP conflicts,"
37//usage: "\nexits only on I/O errors (link down etc)" 36//usage: "\nexits only on I/O errors (link down etc)"
38 37
38#include "libbb.h"
39#include <netinet/ether.h> 39#include <netinet/ether.h>
40#include <net/ethernet.h>
41#include <net/if.h> 40#include <net/if.h>
42#include <net/if_arp.h> 41#include <net/if_arp.h>
43#include <linux/if_packet.h>
44#include <linux/sockios.h> 42#include <linux/sockios.h>
45 43
46#include "libbb.h"
47#include <syslog.h> 44#include <syslog.h>
48 45
49/* We don't need more than 32 bits of the counter */ 46/* We don't need more than 32 bits of the counter */
diff --git a/printutils/lpr.c b/printutils/lpr.c
index f8ee9a11b..fc6bca9e8 100644
--- a/printutils/lpr.c
+++ b/printutils/lpr.c
@@ -17,8 +17,7 @@
17/* -C CLASS exists too, not shown. 17/* -C CLASS exists too, not shown.
18 * CLASS is supposed to be printed on banner page, if one is requested */ 18 * CLASS is supposed to be printed on banner page, if one is requested */
19//usage:#define lpr_full_usage "\n\n" 19//usage:#define lpr_full_usage "\n\n"
20//usage: "Options:" 20//usage: " -P lp service to connect to (else uses $PRINTER)"
21//usage: "\n -P lp service to connect to (else uses $PRINTER)"
22//usage: "\n -m Send mail on completion" 21//usage: "\n -m Send mail on completion"
23//usage: "\n -h Print banner page too" 22//usage: "\n -h Print banner page too"
24//usage: "\n -V Verbose" 23//usage: "\n -V Verbose"
@@ -26,8 +25,7 @@
26//usage:#define lpq_trivial_usage 25//usage:#define lpq_trivial_usage
27//usage: "[-P queue[@host[:port]]] [-U USERNAME] [-d JOBID]... [-fs]" 26//usage: "[-P queue[@host[:port]]] [-U USERNAME] [-d JOBID]... [-fs]"
28//usage:#define lpq_full_usage "\n\n" 27//usage:#define lpq_full_usage "\n\n"
29//usage: "Options:" 28//usage: " -P lp service to connect to (else uses $PRINTER)"
30//usage: "\n -P lp service to connect to (else uses $PRINTER)"
31//usage: "\n -d Delete jobs" 29//usage: "\n -d Delete jobs"
32//usage: "\n -f Force any waiting job to be printed" 30//usage: "\n -f Force any waiting job to be printed"
33//usage: "\n -s Short display" 31//usage: "\n -s Short display"
diff --git a/procps/fuser.c b/procps/fuser.c
index 8d63a7313..05b52abb1 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -11,7 +11,6 @@
11//usage: "[OPTIONS] FILE or PORT/PROTO" 11//usage: "[OPTIONS] FILE or PORT/PROTO"
12//usage:#define fuser_full_usage "\n\n" 12//usage:#define fuser_full_usage "\n\n"
13//usage: "Find processes which use FILEs or PORTs\n" 13//usage: "Find processes which use FILEs or PORTs\n"
14//usage: "\nOptions:"
15//usage: "\n -m Find processes which use same fs as FILEs" 14//usage: "\n -m Find processes which use same fs as FILEs"
16//usage: "\n -4,-6 Search only IPv4/IPv6 space" 15//usage: "\n -4,-6 Search only IPv4/IPv6 space"
17//usage: "\n -s Don't display PIDs" 16//usage: "\n -s Don't display PIDs"
diff --git a/procps/iostat.c b/procps/iostat.c
index cd233c72f..978d23430 100644
--- a/procps/iostat.c
+++ b/procps/iostat.c
@@ -7,23 +7,24 @@
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10//applet:IF_IOSTAT(APPLET(iostat, BB_DIR_BIN, BB_SUID_DROP))
11
12//kbuild:lib-$(CONFIG_IOSTAT) += iostat.o
13
14//config:config IOSTAT 10//config:config IOSTAT
15//config: bool "iostat" 11//config: bool "iostat"
16//config: default y 12//config: default y
17//config: help 13//config: help
18//config: Report CPU and I/O statistics 14//config: Report CPU and I/O statistics
19 15
16//applet:IF_IOSTAT(APPLET(iostat, BB_DIR_BIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_IOSTAT) += iostat.o
19
20#include "libbb.h" 20#include "libbb.h"
21#include <sys/utsname.h> /* Need struct utsname */ 21#include <sys/utsname.h> /* struct utsname */
22 22
23//#define debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__) 23//#define debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
24#define debug(fmt, ...) ((void)0) 24#define debug(fmt, ...) ((void)0)
25 25
26#define MAX_DEVICE_NAME 12 26#define MAX_DEVICE_NAME 12
27#define MAX_DEVICE_NAME_STR "12"
27 28
28#if 1 29#if 1
29typedef unsigned long long cputime_t; 30typedef unsigned long long cputime_t;
@@ -64,21 +65,27 @@ typedef struct {
64 cputime_t itv; 65 cputime_t itv;
65} stats_cpu_pair_t; 66} stats_cpu_pair_t;
66 67
67struct stats_dev { 68typedef struct {
68 char dname[MAX_DEVICE_NAME];
69 unsigned long long rd_sectors; 69 unsigned long long rd_sectors;
70 unsigned long long wr_sectors; 70 unsigned long long wr_sectors;
71 unsigned long rd_ops; 71 unsigned long rd_ops;
72 unsigned long wr_ops; 72 unsigned long wr_ops;
73}; 73} stats_dev_data_t;
74
75typedef struct stats_dev {
76 struct stats_dev *next;
77 char dname[MAX_DEVICE_NAME + 1];
78 stats_dev_data_t prev_data;
79 stats_dev_data_t curr_data;
80} stats_dev_t;
74 81
75/* Globals. Sort by size and access frequency. */ 82/* Globals. Sort by size and access frequency. */
76struct globals { 83struct globals {
77 smallint show_all; 84 smallint show_all;
78 unsigned total_cpus; /* Number of CPUs */ 85 unsigned total_cpus; /* Number of CPUs */
79 unsigned clk_tck; /* Number of clock ticks per second */ 86 unsigned clk_tck; /* Number of clock ticks per second */
80 llist_t *dev_list; /* List of devices entered on the command line */ 87 llist_t *dev_name_list; /* List of devices entered on the command line */
81 struct stats_dev *saved_stats_dev; 88 stats_dev_t *stats_dev_list;
82 struct tm tmtime; 89 struct tm tmtime;
83 struct { 90 struct {
84 const char *str; 91 const char *str;
@@ -114,7 +121,7 @@ static ALWAYS_INLINE int this_is_smp(void)
114 121
115static void print_header(void) 122static void print_header(void)
116{ 123{
117 char buf[16]; 124 char buf[32];
118 struct utsname uts; 125 struct utsname uts;
119 126
120 uname(&uts); /* never fails */ 127 uname(&uts); /* never fails */
@@ -136,7 +143,7 @@ static void get_localtime(struct tm *ptm)
136 143
137static void print_timestamp(void) 144static void print_timestamp(void)
138{ 145{
139 char buf[20]; 146 char buf[64];
140 /* %x: date representation for the current locale */ 147 /* %x: date representation for the current locale */
141 /* %X: time representation for the current locale */ 148 /* %X: time representation for the current locale */
142 strftime(buf, sizeof(buf), "%x %X", &G.tmtime); 149 strftime(buf, sizeof(buf), "%x %X", &G.tmtime);
@@ -162,18 +169,22 @@ static cputime_t get_smp_uptime(void)
162static void get_cpu_statistics(stats_cpu_t *sc) 169static void get_cpu_statistics(stats_cpu_t *sc)
163{ 170{
164 FILE *fp; 171 FILE *fp;
165 char buf[1024], *ibuf = buf + 4; 172 char buf[1024];
166 173
167 fp = xfopen_for_read("/proc/stat"); 174 fp = xfopen_for_read("/proc/stat");
168 175
169 memset(sc, 0, sizeof(*sc)); 176 memset(sc, 0, sizeof(*sc));
170 177
171 while (fgets(buf, sizeof(buf), fp)) { 178 while (fgets(buf, sizeof(buf), fp)) {
172 /* Does the line starts with "cpu "? */ 179 int i;
180 char *ibuf;
181
182 /* Does the line start with "cpu "? */
173 if (!starts_with_cpu(buf) || buf[3] != ' ') { 183 if (!starts_with_cpu(buf) || buf[3] != ' ') {
174 continue; 184 continue;
175 } 185 }
176 for (int i = STATS_CPU_USER; i <= STATS_CPU_GUEST; i++) { 186 ibuf = buf + 4;
187 for (i = STATS_CPU_USER; i <= STATS_CPU_GUEST; i++) {
177 ibuf = skip_whitespace(ibuf); 188 ibuf = skip_whitespace(ibuf);
178 sscanf(ibuf, "%"FMT_DATA"u", &sc->vector[i]); 189 sscanf(ibuf, "%"FMT_DATA"u", &sc->vector[i]);
179 if (i != STATS_CPU_GUEST) { 190 if (i != STATS_CPU_GUEST) {
@@ -233,7 +244,7 @@ static void print_stats_cpu_struct(stats_cpu_pair_t *stats)
233{ 244{
234 cputime_t *p = stats->prev->vector; 245 cputime_t *p = stats->prev->vector;
235 cputime_t *c = stats->curr->vector; 246 cputime_t *c = stats->curr->vector;
236 printf(" %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f\n", 247 printf(" %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
237 percent_value(p[STATS_CPU_USER] , c[STATS_CPU_USER] , stats->itv), 248 percent_value(p[STATS_CPU_USER] , c[STATS_CPU_USER] , stats->itv),
238 percent_value(p[STATS_CPU_NICE] , c[STATS_CPU_NICE] , stats->itv), 249 percent_value(p[STATS_CPU_NICE] , c[STATS_CPU_NICE] , stats->itv),
239 percent_value(p[STATS_CPU_SYSTEM] + p[STATS_CPU_SOFTIRQ] + p[STATS_CPU_IRQ], 250 percent_value(p[STATS_CPU_SYSTEM] + p[STATS_CPU_SOFTIRQ] + p[STATS_CPU_IRQ],
@@ -244,36 +255,40 @@ static void print_stats_cpu_struct(stats_cpu_pair_t *stats)
244 ); 255 );
245} 256}
246 257
247static void print_stats_dev_struct(const struct stats_dev *p, 258static void cpu_report(stats_cpu_pair_t *stats)
248 const struct stats_dev *c, cputime_t itv)
249{ 259{
260 /* Always print a header */
261 puts("avg-cpu: %user %nice %system %iowait %steal %idle");
262
263 /* Print current statistics */
264 print_stats_cpu_struct(stats);
265}
266
267static void print_stats_dev_struct(stats_dev_t *stats_dev, cputime_t itv)
268{
269 stats_dev_data_t *p = &stats_dev->prev_data;
270 stats_dev_data_t *c = &stats_dev->curr_data;
250 if (option_mask32 & OPT_z) 271 if (option_mask32 & OPT_z)
251 if (p->rd_ops == c->rd_ops && p->wr_ops == c->wr_ops) 272 if (p->rd_ops == c->rd_ops && p->wr_ops == c->wr_ops)
252 return; 273 return;
253 274
254 printf("%-13s %8.2f %12.2f %12.2f %10llu %10llu \n", c->dname, 275 printf("%-13s %8.2f %12.2f %12.2f %10llu %10llu\n",
255 percent_value(p->rd_ops + p->wr_ops , 276 stats_dev->dname,
256 /**/ c->rd_ops + c->wr_ops , itv), 277 percent_value(p->rd_ops + p->wr_ops, c->rd_ops + c->wr_ops, itv),
257 percent_value(p->rd_sectors, c->rd_sectors, itv) / G.unit.div, 278 percent_value(p->rd_sectors, c->rd_sectors, itv) / G.unit.div,
258 percent_value(p->wr_sectors, c->wr_sectors, itv) / G.unit.div, 279 percent_value(p->wr_sectors, c->wr_sectors, itv) / G.unit.div,
259 (c->rd_sectors - p->rd_sectors) / G.unit.div, 280 (c->rd_sectors - p->rd_sectors) / G.unit.div,
260 (c->wr_sectors - p->wr_sectors) / G.unit.div); 281 (c->wr_sectors - p->wr_sectors) / G.unit.div
261} 282 );
262
263static void cpu_report(stats_cpu_pair_t *stats)
264{
265 /* Always print a header */
266 puts("avg-cpu: %user %nice %system %iowait %steal %idle");
267
268 /* Print current statistics */
269 print_stats_cpu_struct(stats);
270} 283}
271 284
272static void print_devstat_header(void) 285static void print_devstat_header(void)
273{ 286{
274 printf("Device:%15s%6s%s/s%6s%s/s%6s%s%6s%s\n", "tps", 287 printf("Device:%15s%6s%s/s%6s%s/s%6s%s%6s%s\n",
288 "tps",
275 G.unit.str, "_read", G.unit.str, "_wrtn", 289 G.unit.str, "_read", G.unit.str, "_wrtn",
276 G.unit.str, "_read", G.unit.str, "_wrtn"); 290 G.unit.str, "_read", G.unit.str, "_wrtn"
291 );
277} 292}
278 293
279/* 294/*
@@ -285,61 +300,81 @@ static int is_partition(const char *dev)
285 return ((dev[0] - 's') | (dev[1] - 'd') | (dev[2] - 'a')) == 0 && isdigit(dev[3]); 300 return ((dev[0] - 's') | (dev[1] - 'd') | (dev[2] - 'a')) == 0 && isdigit(dev[3]);
286} 301}
287 302
303static stats_dev_t *stats_dev_find_or_new(const char *dev_name)
304{
305 stats_dev_t **curr = &G.stats_dev_list;
306
307 while (*curr != NULL) {
308 if (strcmp((*curr)->dname, dev_name) == 0)
309 return *curr;
310 curr = &(*curr)->next;
311 }
312
313 *curr = xzalloc(sizeof(stats_dev_t));
314 strncpy((*curr)->dname, dev_name, MAX_DEVICE_NAME);
315 return *curr;
316}
317
318static void stats_dev_free(stats_dev_t *stats_dev)
319{
320 if (stats_dev) {
321 stats_dev_free(stats_dev->next);
322 free(stats_dev);
323 }
324}
325
288static void do_disk_statistics(cputime_t itv) 326static void do_disk_statistics(cputime_t itv)
289{ 327{
328 char buf[128];
329 char dev_name[MAX_DEVICE_NAME + 1];
330 unsigned long long rd_sec_or_dummy;
331 unsigned long long wr_sec_or_dummy;
332 stats_dev_data_t *curr_data;
333 stats_dev_t *stats_dev;
290 FILE *fp; 334 FILE *fp;
291 int rc; 335 int rc;
292 int i = 0;
293 char buf[128];
294 unsigned major, minor;
295 unsigned long wr_ops, dummy; /* %*lu for suppress the conversion wouldn't work */
296 unsigned long long rd_sec_or_wr_ops;
297 unsigned long long rd_sec_or_dummy, wr_sec_or_dummy, wr_sec;
298 struct stats_dev sd;
299 336
300 fp = xfopen_for_read("/proc/diskstats"); 337 fp = xfopen_for_read("/proc/diskstats");
301
302 /* Read and possibly print stats from /proc/diskstats */ 338 /* Read and possibly print stats from /proc/diskstats */
303 while (fgets(buf, sizeof(buf), fp)) { 339 while (fgets(buf, sizeof(buf), fp)) {
304 rc = sscanf(buf, "%u %u %s %lu %llu %llu %llu %lu %lu %llu %lu %lu %lu %lu", 340 sscanf(buf, "%*s %*s %"MAX_DEVICE_NAME_STR"s", dev_name);
305 &major, &minor, sd.dname, &sd.rd_ops, 341 if (G.dev_name_list) {
306 &rd_sec_or_dummy, &rd_sec_or_wr_ops, &wr_sec_or_dummy, 342 /* Is device name in list? */
307 &wr_ops, &dummy, &wr_sec, &dummy, &dummy, &dummy, &dummy); 343 if (!llist_find_str(G.dev_name_list, dev_name))
308 344 continue;
309 switch (rc) { 345 } else if (is_partition(dev_name)) {
310 case 14: 346 continue;
311 sd.wr_ops = wr_ops;
312 sd.rd_sectors = rd_sec_or_wr_ops;
313 sd.wr_sectors = wr_sec;
314 break;
315 case 7:
316 sd.rd_sectors = rd_sec_or_dummy;
317 sd.wr_ops = (unsigned long)rd_sec_or_wr_ops;
318 sd.wr_sectors = wr_sec_or_dummy;
319 break;
320 default:
321 break;
322 } 347 }
323 348
324 if (!G.dev_list && !is_partition(sd.dname)) { 349 stats_dev = stats_dev_find_or_new(dev_name);
325 /* User didn't specify device */ 350 curr_data = &stats_dev->curr_data;
326 if (!G.show_all && !sd.rd_ops && !sd.wr_ops) { 351
327 /* Don't print unused device */ 352 rc = sscanf(buf, "%*s %*s %*s %lu %llu %llu %llu %lu %*s %llu",
328 continue; 353 &curr_data->rd_ops,
329 } 354 &rd_sec_or_dummy,
330 print_stats_dev_struct(&G.saved_stats_dev[i], &sd, itv); 355 &curr_data->rd_sectors,
331 G.saved_stats_dev[i] = sd; 356 &wr_sec_or_dummy,
332 i++; 357 &curr_data->wr_ops,
333 } else { 358 &curr_data->wr_sectors);
334 /* Is device in device list? */ 359 if (rc != 6) {
335 if (llist_find_str(G.dev_list, sd.dname)) { 360 curr_data->rd_sectors = rd_sec_or_dummy;
336 /* Print current statistics */ 361 curr_data->wr_sectors = wr_sec_or_dummy;
337 print_stats_dev_struct(&G.saved_stats_dev[i], &sd, itv); 362 //curr_data->rd_ops = ;
338 G.saved_stats_dev[i] = sd; 363 curr_data->wr_ops = (unsigned long)curr_data->rd_sectors;
339 i++;
340 } else
341 continue;
342 } 364 }
365
366 if (!G.dev_name_list /* User didn't specify device */
367 && !G.show_all
368 && curr_data->rd_ops == 0
369 && curr_data->wr_ops == 0
370 ) {
371 /* Don't print unused device */
372 continue;
373 }
374
375 /* Print current statistics */
376 print_stats_dev_struct(stats_dev, itv);
377 stats_dev->prev_data = *curr_data;
343 } 378 }
344 379
345 fclose(fp); 380 fclose(fp);
@@ -354,40 +389,10 @@ static void dev_report(cputime_t itv)
354 do_disk_statistics(itv); 389 do_disk_statistics(itv);
355} 390}
356 391
357static unsigned get_number_of_devices(void)
358{
359 FILE *fp;
360 char buf[128];
361 int rv;
362 unsigned n = 0;
363 unsigned long rd_ops, wr_ops;
364 char dname[MAX_DEVICE_NAME];
365
366 fp = xfopen_for_read("/proc/diskstats");
367
368 while (fgets(buf, sizeof(buf), fp)) {
369 rv = sscanf(buf, "%*d %*d %s %lu %*u %*u %*u %lu",
370 dname, &rd_ops, &wr_ops);
371 if (rv == 2 || is_partition(dname))
372 /* A partition */
373 continue;
374 if (!rd_ops && !wr_ops) {
375 /* Unused device */
376 if (!G.show_all)
377 continue;
378 }
379 n++;
380 }
381
382 fclose(fp);
383 return n;
384}
385
386//usage:#define iostat_trivial_usage 392//usage:#define iostat_trivial_usage
387//usage: "[-c] [-d] [-t] [-z] [-k|-m] [ALL|BLOCKDEV...] [INTERVAL [COUNT]]" 393//usage: "[-c] [-d] [-t] [-z] [-k|-m] [ALL|BLOCKDEV...] [INTERVAL [COUNT]]"
388//usage:#define iostat_full_usage "\n\n" 394//usage:#define iostat_full_usage "\n\n"
389//usage: "Report CPU and I/O statistics\n" 395//usage: "Report CPU and I/O statistics\n"
390//usage: "\nOptions:"
391//usage: "\n -c Show CPU utilization" 396//usage: "\n -c Show CPU utilization"
392//usage: "\n -d Show device utilization" 397//usage: "\n -d Show device utilization"
393//usage: "\n -t Print current time" 398//usage: "\n -t Print current time"
@@ -398,7 +403,7 @@ static unsigned get_number_of_devices(void)
398int iostat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 403int iostat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
399int iostat_main(int argc UNUSED_PARAM, char **argv) 404int iostat_main(int argc UNUSED_PARAM, char **argv)
400{ 405{
401 int opt, dev_num; 406 int opt;
402 unsigned interval; 407 unsigned interval;
403 int count; 408 int count;
404 stats_cpu_t stats_data[2]; 409 stats_cpu_t stats_data[2];
@@ -427,14 +432,12 @@ int iostat_main(int argc UNUSED_PARAM, char **argv)
427 argv += optind; 432 argv += optind;
428 433
429 /* Store device names into device list */ 434 /* Store device names into device list */
430 dev_num = 0;
431 while (*argv && !isdigit(*argv[0])) { 435 while (*argv && !isdigit(*argv[0])) {
432 if (strcmp(*argv, "ALL") != 0) { 436 if (strcmp(*argv, "ALL") != 0) {
433 /* If not ALL, save device name */ 437 /* If not ALL, save device name */
434 char *dev_name = skip_dev_pfx(*argv); 438 char *dev_name = skip_dev_pfx(*argv);
435 if (!llist_find_str(G.dev_list, dev_name)) { 439 if (!llist_find_str(G.dev_name_list, dev_name)) {
436 llist_add_to(&G.dev_list, dev_name); 440 llist_add_to(&G.dev_name_list, dev_name);
437 dev_num++;
438 } 441 }
439 } else { 442 } else {
440 G.show_all = 1; 443 G.show_all = 1;
@@ -454,13 +457,6 @@ int iostat_main(int argc UNUSED_PARAM, char **argv)
454 count = xatoi_positive(*argv); 457 count = xatoi_positive(*argv);
455 } 458 }
456 459
457 /* Allocate space for device stats */
458 if (opt & OPT_d) {
459 G.saved_stats_dev = xzalloc(sizeof(G.saved_stats_dev[0]) *
460 (dev_num ? dev_num : get_number_of_devices())
461 );
462 }
463
464 if (opt & OPT_m) { 460 if (opt & OPT_m) {
465 G.unit.str = " MB"; 461 G.unit.str = " MB";
466 G.unit.div = 2048; 462 G.unit.div = 2048;
@@ -530,8 +526,8 @@ int iostat_main(int argc UNUSED_PARAM, char **argv)
530 } 526 }
531 527
532 if (ENABLE_FEATURE_CLEAN_UP) { 528 if (ENABLE_FEATURE_CLEAN_UP) {
533 llist_free(G.dev_list, NULL); 529 llist_free(G.dev_name_list, NULL);
534 free(G.saved_stats_dev); 530 stats_dev_free(G.stats_dev_list);
535 free(&G); 531 free(&G);
536 } 532 }
537 533
diff --git a/procps/kill.c b/procps/kill.c
index fa79ce2e7..8aa0eb3e2 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -12,7 +12,6 @@
12//usage: "[-l] [-SIG] PID..." 12//usage: "[-l] [-SIG] PID..."
13//usage:#define kill_full_usage "\n\n" 13//usage:#define kill_full_usage "\n\n"
14//usage: "Send a signal (default: TERM) to given PIDs\n" 14//usage: "Send a signal (default: TERM) to given PIDs\n"
15//usage: "\nOptions:"
16//usage: "\n -l List all signal names and numbers" 15//usage: "\n -l List all signal names and numbers"
17/* //usage: "\n -s SIG Yet another way of specifying SIG" */ 16/* //usage: "\n -s SIG Yet another way of specifying SIG" */
18//usage: 17//usage:
@@ -30,7 +29,6 @@
30//usage: "[-l] [-q] [-SIG] PROCESS_NAME..." 29//usage: "[-l] [-q] [-SIG] PROCESS_NAME..."
31//usage:#define killall_full_usage "\n\n" 30//usage:#define killall_full_usage "\n\n"
32//usage: "Send a signal (default: TERM) to given processes\n" 31//usage: "Send a signal (default: TERM) to given processes\n"
33//usage: "\nOptions:"
34//usage: "\n -l List all signal names and numbers" 32//usage: "\n -l List all signal names and numbers"
35/* //usage: "\n -s SIG Yet another way of specifying SIG" */ 33/* //usage: "\n -s SIG Yet another way of specifying SIG" */
36//usage: "\n -q Don't complain if no processes were killed" 34//usage: "\n -q Don't complain if no processes were killed"
@@ -42,7 +40,6 @@
42//usage: "[-l] [-SIG] [-o PID]..." 40//usage: "[-l] [-SIG] [-o PID]..."
43//usage:#define killall5_full_usage "\n\n" 41//usage:#define killall5_full_usage "\n\n"
44//usage: "Send a signal (default: TERM) to all processes outside current session\n" 42//usage: "Send a signal (default: TERM) to all processes outside current session\n"
45//usage: "\nOptions:"
46//usage: "\n -l List all signal names and numbers" 43//usage: "\n -l List all signal names and numbers"
47//usage: "\n -o PID Don't signal this PID" 44//usage: "\n -o PID Don't signal this PID"
48/* //usage: "\n -s SIG Yet another way of specifying SIG" */ 45/* //usage: "\n -s SIG Yet another way of specifying SIG" */
diff --git a/procps/mpstat.c b/procps/mpstat.c
index da8f34dab..aa5a5c73f 100644
--- a/procps/mpstat.c
+++ b/procps/mpstat.c
@@ -844,7 +844,6 @@ static int get_irqcpu_nr(const char *f, int max_irqs)
844//usage: "[-A] [-I SUM|CPU|ALL|SCPU] [-u] [-P num|ALL] [INTERVAL [COUNT]]" 844//usage: "[-A] [-I SUM|CPU|ALL|SCPU] [-u] [-P num|ALL] [INTERVAL [COUNT]]"
845//usage:#define mpstat_full_usage "\n\n" 845//usage:#define mpstat_full_usage "\n\n"
846//usage: "Per-processor statistics\n" 846//usage: "Per-processor statistics\n"
847//usage: "\nOptions:"
848//usage: "\n -A Same as -I ALL -u -P ALL" 847//usage: "\n -A Same as -I ALL -u -P ALL"
849//usage: "\n -I SUM|CPU|ALL|SCPU Report interrupt statistics" 848//usage: "\n -I SUM|CPU|ALL|SCPU Report interrupt statistics"
850//usage: "\n -P num|ALL Processor to monitor" 849//usage: "\n -P num|ALL Processor to monitor"
diff --git a/procps/pgrep.c b/procps/pgrep.c
index 902a3a75e..dc7ffff48 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -11,7 +11,6 @@
11//usage: "[-flnovx] [-s SID|-P PPID|PATTERN]" 11//usage: "[-flnovx] [-s SID|-P PPID|PATTERN]"
12//usage:#define pgrep_full_usage "\n\n" 12//usage:#define pgrep_full_usage "\n\n"
13//usage: "Display process(es) selected by regex PATTERN\n" 13//usage: "Display process(es) selected by regex PATTERN\n"
14//usage: "\nOptions:"
15//usage: "\n -l Show command name too" 14//usage: "\n -l Show command name too"
16//usage: "\n -f Match against entire command line" 15//usage: "\n -f Match against entire command line"
17//usage: "\n -n Show the newest process only" 16//usage: "\n -n Show the newest process only"
@@ -25,7 +24,6 @@
25//usage: "[-l|-SIGNAL] [-fnovx] [-s SID|-P PPID|PATTERN]" 24//usage: "[-l|-SIGNAL] [-fnovx] [-s SID|-P PPID|PATTERN]"
26//usage:#define pkill_full_usage "\n\n" 25//usage:#define pkill_full_usage "\n\n"
27//usage: "Send a signal to process(es) selected by regex PATTERN\n" 26//usage: "Send a signal to process(es) selected by regex PATTERN\n"
28//usage: "\nOptions:"
29//usage: "\n -l List all signals" 27//usage: "\n -l List all signals"
30//usage: "\n -f Match against entire command line" 28//usage: "\n -f Match against entire command line"
31//usage: "\n -n Signal the newest process only" 29//usage: "\n -n Signal the newest process only"
@@ -130,7 +128,7 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
130 bb_show_usage(); 128 bb_show_usage();
131 129
132 if (argv[0]) 130 if (argv[0])
133 xregcomp(&re_buffer, argv[0], 0); 131 xregcomp(&re_buffer, argv[0], REG_EXTENDED | REG_NOSUB);
134 132
135 matched_pid = 0; 133 matched_pid = 0;
136 cmd_last = NULL; 134 cmd_last = NULL;
diff --git a/procps/pidof.c b/procps/pidof.c
index e102a31c6..6d7b59109 100644
--- a/procps/pidof.c
+++ b/procps/pidof.c
@@ -10,7 +10,7 @@
10//usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT) 10//usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT)
11//usage:#define pidof_trivial_usage 11//usage:#define pidof_trivial_usage
12//usage: "[OPTIONS] [NAME]..." 12//usage: "[OPTIONS] [NAME]..."
13//usage:#define USAGE_PIDOF "\n\nOptions:" 13//usage:#define USAGE_PIDOF "\n"
14//usage:#else 14//usage:#else
15//usage:#define pidof_trivial_usage 15//usage:#define pidof_trivial_usage
16//usage: "[NAME]..." 16//usage: "[NAME]..."
diff --git a/procps/pmap.c b/procps/pmap.c
index 7f7f391b9..fd995a54d 100644
--- a/procps/pmap.c
+++ b/procps/pmap.c
@@ -8,22 +8,22 @@
8 * for details. 8 * for details.
9 */ 9 */
10 10
11//applet:IF_PMAP(APPLET(pmap, BB_DIR_USR_BIN, BB_SUID_DROP))
12//kbuild:lib-$(CONFIG_PMAP) += pmap.o
13
14//config:config PMAP 11//config:config PMAP
15//config: bool "pmap" 12//config: bool "pmap"
16//config: default y 13//config: default y
17//config: help 14//config: help
18//config: Display processes' memory mappings. 15//config: Display processes' memory mappings.
19 16
17//applet:IF_PMAP(APPLET(pmap, BB_DIR_USR_BIN, BB_SUID_DROP))
18//kbuild:lib-$(CONFIG_PMAP) += pmap.o
19
20//usage:#define pmap_trivial_usage 20//usage:#define pmap_trivial_usage
21//usage: "[-x][-q] PID" 21//usage: "[-xq] PID"
22//usage:#define pmap_full_usage "\n\n" 22//usage:#define pmap_full_usage "\n\n"
23//usage: "Display detailed precesses' memory usage\n" 23//usage: "Display detailed process memory usage"
24//usage: "\nOptions:" 24//usage: "\n"
25//usage: "\n -x show details" 25//usage: "\n -x Show details"
26//usage: "\n -q quiet" 26//usage: "\n -q Quiet"
27 27
28#include "libbb.h" 28#include "libbb.h"
29 29
diff --git a/procps/ps.c b/procps/ps.c
index 41e1b1e87..41124279d 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -15,7 +15,6 @@
15//usage: "[-o COL1,COL2=HEADER]" IF_FEATURE_SHOW_THREADS(" [-T]") 15//usage: "[-o COL1,COL2=HEADER]" IF_FEATURE_SHOW_THREADS(" [-T]")
16//usage:#define ps_full_usage "\n\n" 16//usage:#define ps_full_usage "\n\n"
17//usage: "Show list of processes\n" 17//usage: "Show list of processes\n"
18//usage: "\nOptions:"
19//usage: "\n -o COL1,COL2=HEADER Select columns for display" 18//usage: "\n -o COL1,COL2=HEADER Select columns for display"
20//usage: IF_FEATURE_SHOW_THREADS( 19//usage: IF_FEATURE_SHOW_THREADS(
21//usage: "\n -T Show threads" 20//usage: "\n -T Show threads"
@@ -26,7 +25,7 @@
26//usage:#if !ENABLE_SELINUX && !ENABLE_FEATURE_PS_WIDE 25//usage:#if !ENABLE_SELINUX && !ENABLE_FEATURE_PS_WIDE
27//usage:#define USAGE_PS "\nThis version of ps accepts no options" 26//usage:#define USAGE_PS "\nThis version of ps accepts no options"
28//usage:#else 27//usage:#else
29//usage:#define USAGE_PS "\nOptions:" 28//usage:#define USAGE_PS ""
30//usage:#endif 29//usage:#endif
31//usage: 30//usage:
32//usage:#define ps_trivial_usage 31//usage:#define ps_trivial_usage
@@ -88,15 +87,6 @@ enum { MAX_WIDTH = 2*1024 };
88 * TIME The cumulative execution time for the process 87 * TIME The cumulative execution time for the process
89 * CMD The command name; the full command line is shown with -f 88 * CMD The command name; the full command line is shown with -f
90 */ 89 */
91#if ENABLE_SELINUX
92# define SELINUX_O_PREFIX "label,"
93# define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args")
94#elif ENABLE_PLATFORM_MINGW32
95# define DEFAULT_O_STR ("pid,comm")
96#else
97# define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args")
98#endif
99
100typedef struct { 90typedef struct {
101 uint16_t width; 91 uint16_t width;
102 char name6[6]; 92 char name6[6];
@@ -116,7 +106,6 @@ struct globals {
116 unsigned kernel_HZ; 106 unsigned kernel_HZ;
117 unsigned long long seconds_since_boot; 107 unsigned long long seconds_since_boot;
118#endif 108#endif
119 char default_o[sizeof(DEFAULT_O_STR)];
120} FIX_ALIASING; 109} FIX_ALIASING;
121#define G (*(struct globals*)&bb_common_bufsiz1) 110#define G (*(struct globals*)&bb_common_bufsiz1)
122#define out (G.out ) 111#define out (G.out )
@@ -127,7 +116,6 @@ struct globals {
127#define terminal_width (G.terminal_width ) 116#define terminal_width (G.terminal_width )
128#define kernel_HZ (G.kernel_HZ ) 117#define kernel_HZ (G.kernel_HZ )
129#define seconds_since_boot (G.seconds_since_boot) 118#define seconds_since_boot (G.seconds_since_boot)
130#define default_o (G.default_o )
131#define INIT_G() do { } while (0) 119#define INIT_G() do { } while (0)
132 120
133#if ENABLE_FEATURE_PS_TIME 121#if ENABLE_FEATURE_PS_TIME
@@ -253,7 +241,7 @@ static void func_comm(char *buf, int size, const procps_status_t *ps)
253 safe_strncpy(buf, ps->comm, size+1); 241 safe_strncpy(buf, ps->comm, size+1);
254} 242}
255 243
256static void func_stat(char *buf, int size, const procps_status_t *ps) 244static void func_state(char *buf, int size, const procps_status_t *ps)
257{ 245{
258 safe_strncpy(buf, ps->state, size+1); 246 safe_strncpy(buf, ps->state, size+1);
259} 247}
@@ -404,7 +392,7 @@ static const ps_out_t out_spec[] = {
404 { 6 , "tty" ,"TT" ,func_tty ,PSSCAN_TTY }, 392 { 6 , "tty" ,"TT" ,func_tty ,PSSCAN_TTY },
405 { 4 , "vsz" ,"VSZ" ,func_vsz ,PSSCAN_VSZ }, 393 { 4 , "vsz" ,"VSZ" ,func_vsz ,PSSCAN_VSZ },
406/* Not mandated, but useful: */ 394/* Not mandated, but useful: */
407 { 4 , "stat" ,"STAT" ,func_stat ,PSSCAN_STAT }, 395 { 4 , "stat" ,"STAT" ,func_state ,PSSCAN_STATE },
408 { 4 , "rss" ,"RSS" ,func_rss ,PSSCAN_RSS }, 396 { 4 , "rss" ,"RSS" ,func_rss ,PSSCAN_RSS },
409#endif 397#endif
410#if ENABLE_SELINUX 398#if ENABLE_SELINUX
@@ -542,11 +530,21 @@ static void format_process(const procps_status_t *ps)
542 printf("%.*s\n", terminal_width, buffer); 530 printf("%.*s\n", terminal_width, buffer);
543} 531}
544 532
533#if ENABLE_SELINUX
534# define SELINUX_O_PREFIX "label,"
535# define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args")
536#elif ENABLE_PLATFORM_MINGW32
537# define DEFAULT_O_STR ("pid,comm")
538#else
539# define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args")
540#endif
541
545int ps_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 542int ps_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
546int ps_main(int argc UNUSED_PARAM, char **argv) 543int ps_main(int argc UNUSED_PARAM, char **argv)
547{ 544{
548 procps_status_t *p; 545 procps_status_t *p;
549 llist_t* opt_o = NULL; 546 llist_t* opt_o = NULL;
547 char default_o[sizeof(DEFAULT_O_STR)];
550 int opt; 548 int opt;
551 enum { 549 enum {
552 OPT_Z = (1 << 0), 550 OPT_Z = (1 << 0),
@@ -584,7 +582,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv)
584 parse_o(llist_pop(&opt_o)); 582 parse_o(llist_pop(&opt_o));
585 } while (opt_o); 583 } while (opt_o);
586 } else { 584 } else {
587 /* Below: parse_o() needs char*, NOT const char*... */ 585 /* Below: parse_o() needs char*, NOT const char*, can't give it default_o */
588#if ENABLE_SELINUX 586#if ENABLE_SELINUX
589 if (!(opt & OPT_Z) || !is_selinux_enabled()) { 587 if (!(opt & OPT_Z) || !is_selinux_enabled()) {
590 /* no -Z or no SELinux: do not show LABEL */ 588 /* no -Z or no SELinux: do not show LABEL */
diff --git a/procps/pstree.c b/procps/pstree.c
index 16649cfaa..8ba30795d 100644
--- a/procps/pstree.c
+++ b/procps/pstree.c
@@ -24,7 +24,6 @@
24//usage: "[-p] [PID|USER]" 24//usage: "[-p] [PID|USER]"
25//usage:#define pstree_full_usage "\n\n" 25//usage:#define pstree_full_usage "\n\n"
26//usage: "Display process tree, optionally start from USER or PID\n" 26//usage: "Display process tree, optionally start from USER or PID\n"
27//usage: "\nOptions:"
28//usage: "\n -p Show pids" 27//usage: "\n -p Show pids"
29 28
30#include "libbb.h" 29#include "libbb.h"
diff --git a/procps/renice.c b/procps/renice.c
index 067c8f75a..77f400a1d 100644
--- a/procps/renice.c
+++ b/procps/renice.c
@@ -23,7 +23,6 @@
23//usage: "{{-n INCREMENT} | PRIORITY} [[-p | -g | -u] ID...]" 23//usage: "{{-n INCREMENT} | PRIORITY} [[-p | -g | -u] ID...]"
24//usage:#define renice_full_usage "\n\n" 24//usage:#define renice_full_usage "\n\n"
25//usage: "Change scheduling priority for a running process\n" 25//usage: "Change scheduling priority for a running process\n"
26//usage: "\nOptions:"
27//usage: "\n -n Adjust current nice value (smaller is faster)" 26//usage: "\n -n Adjust current nice value (smaller is faster)"
28//usage: "\n -p Process id(s) (default)" 27//usage: "\n -p Process id(s) (default)"
29//usage: "\n -g Process group id(s)" 28//usage: "\n -g Process group id(s)"
diff --git a/procps/sysctl.c b/procps/sysctl.c
index f36548f87..cb3b6a25a 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -15,7 +15,6 @@
15//usage: "[OPTIONS] [VALUE]..." 15//usage: "[OPTIONS] [VALUE]..."
16//usage:#define sysctl_full_usage "\n\n" 16//usage:#define sysctl_full_usage "\n\n"
17//usage: "Configure kernel parameters at runtime\n" 17//usage: "Configure kernel parameters at runtime\n"
18//usage: "\nOptions:"
19//usage: "\n -n Don't print key names" 18//usage: "\n -n Don't print key names"
20//usage: "\n -e Don't warn about unknown keys" 19//usage: "\n -e Don't warn about unknown keys"
21//usage: "\n -w Change sysctl setting" 20//usage: "\n -w Change sysctl setting"
diff --git a/procps/watch.c b/procps/watch.c
index e289bf8cb..36af1cca7 100644
--- a/procps/watch.c
+++ b/procps/watch.c
@@ -15,7 +15,6 @@
15//usage: "[-n SEC] [-t] PROG ARGS" 15//usage: "[-n SEC] [-t] PROG ARGS"
16//usage:#define watch_full_usage "\n\n" 16//usage:#define watch_full_usage "\n\n"
17//usage: "Run PROG periodically\n" 17//usage: "Run PROG periodically\n"
18//usage: "\nOptions:"
19//usage: "\n -n Loop period in seconds (default 2)" 18//usage: "\n -n Loop period in seconds (default 2)"
20//usage: "\n -t Don't print header" 19//usage: "\n -t Don't print header"
21//usage: 20//usage:
diff --git a/runit/chpst.c b/runit/chpst.c
index 63da4797f..185706089 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -34,7 +34,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34//usage: " [-p N] [-f BYTES] [-c BYTES] PROG ARGS" 34//usage: " [-p N] [-f BYTES] [-c BYTES] PROG ARGS"
35//usage:#define chpst_full_usage "\n\n" 35//usage:#define chpst_full_usage "\n\n"
36//usage: "Change the process state, run PROG\n" 36//usage: "Change the process state, run PROG\n"
37//usage: "\nOptions:"
38//usage: "\n -u USER[:GRP] Set uid and gid" 37//usage: "\n -u USER[:GRP] Set uid and gid"
39//usage: "\n -U USER[:GRP] Set $UID and $GID in environment" 38//usage: "\n -U USER[:GRP] Set $UID and $GID in environment"
40//usage: "\n -e DIR Set environment variables as specified by files" 39//usage: "\n -e DIR Set environment variables as specified by files"
@@ -76,7 +75,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
76//usage: " PROG ARGS" 75//usage: " PROG ARGS"
77//usage:#define softlimit_full_usage "\n\n" 76//usage:#define softlimit_full_usage "\n\n"
78//usage: "Set soft resource limits, then run PROG\n" 77//usage: "Set soft resource limits, then run PROG\n"
79//usage: "\nOptions:"
80//usage: "\n -a BYTES Limit total size of all segments" 78//usage: "\n -a BYTES Limit total size of all segments"
81//usage: "\n -m BYTES Same as -d BYTES -s BYTES -l BYTES -a BYTES" 79//usage: "\n -m BYTES Same as -d BYTES -s BYTES -l BYTES -a BYTES"
82//usage: "\n -d BYTES Limit data segment" 80//usage: "\n -d BYTES Limit data segment"
diff --git a/scripts/defconfig.tig b/scripts/defconfig.tig
index e19217f08..430587d27 100644
--- a/scripts/defconfig.tig
+++ b/scripts/defconfig.tig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Busybox version: 1.19.0.git 3# Busybox version: 1.19.0.git
4# Thu Mar 22 15:00:34 2012 4# Thu Mar 22 15:35:30 2012
5# 5#
6CONFIG_HAVE_DOT_CONFIG=y 6CONFIG_HAVE_DOT_CONFIG=y
7# CONFIG_PLATFORM_POSIX is not set 7# CONFIG_PLATFORM_POSIX is not set
@@ -175,6 +175,8 @@ CONFIG_DATE=y
175CONFIG_FEATURE_DATE_ISOFMT=y 175CONFIG_FEATURE_DATE_ISOFMT=y
176# CONFIG_FEATURE_DATE_NANO is not set 176# CONFIG_FEATURE_DATE_NANO is not set
177CONFIG_FEATURE_DATE_COMPAT=y 177CONFIG_FEATURE_DATE_COMPAT=y
178# CONFIG_ID is not set
179# CONFIG_GROUPS is not set
178CONFIG_TEST=y 180CONFIG_TEST=y
179CONFIG_FEATURE_TEST_64=y 181CONFIG_FEATURE_TEST_64=y
180CONFIG_TOUCH=y 182CONFIG_TOUCH=y
@@ -219,7 +221,6 @@ CONFIG_FOLD=y
219CONFIG_HEAD=y 221CONFIG_HEAD=y
220CONFIG_FEATURE_FANCY_HEAD=y 222CONFIG_FEATURE_FANCY_HEAD=y
221# CONFIG_HOSTID is not set 223# CONFIG_HOSTID is not set
222# CONFIG_ID is not set
223# CONFIG_INSTALL is not set 224# CONFIG_INSTALL is not set
224# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set 225# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
225# CONFIG_LN is not set 226# CONFIG_LN is not set
@@ -351,20 +352,13 @@ CONFIG_WHICH=y
351# Editors 352# Editors
352# 353#
353# CONFIG_PATCH is not set 354# CONFIG_PATCH is not set
354CONFIG_AWK=y
355# CONFIG_FEATURE_AWK_LIBM is not set
356CONFIG_CMP=y
357CONFIG_DIFF=y
358CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
359CONFIG_FEATURE_DIFF_DIR=y
360CONFIG_ED=y
361CONFIG_SED=y
362CONFIG_VI=y 355CONFIG_VI=y
363CONFIG_FEATURE_VI_MAX_LEN=4096 356CONFIG_FEATURE_VI_MAX_LEN=4096
364# CONFIG_FEATURE_VI_8BIT is not set 357# CONFIG_FEATURE_VI_8BIT is not set
365CONFIG_FEATURE_VI_COLON=y 358CONFIG_FEATURE_VI_COLON=y
366CONFIG_FEATURE_VI_YANKMARK=y 359CONFIG_FEATURE_VI_YANKMARK=y
367CONFIG_FEATURE_VI_SEARCH=y 360CONFIG_FEATURE_VI_SEARCH=y
361# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
368# CONFIG_FEATURE_VI_USE_SIGNALS is not set 362# CONFIG_FEATURE_VI_USE_SIGNALS is not set
369CONFIG_FEATURE_VI_DOT_CMD=y 363CONFIG_FEATURE_VI_DOT_CMD=y
370CONFIG_FEATURE_VI_READONLY=y 364CONFIG_FEATURE_VI_READONLY=y
@@ -373,6 +367,14 @@ CONFIG_FEATURE_VI_SET=y
373CONFIG_FEATURE_VI_WIN_RESIZE=y 367CONFIG_FEATURE_VI_WIN_RESIZE=y
374CONFIG_FEATURE_VI_ASK_TERMINAL=y 368CONFIG_FEATURE_VI_ASK_TERMINAL=y
375# CONFIG_FEATURE_VI_OPTIMIZE_CURSOR is not set 369# CONFIG_FEATURE_VI_OPTIMIZE_CURSOR is not set
370CONFIG_AWK=y
371# CONFIG_FEATURE_AWK_LIBM is not set
372CONFIG_CMP=y
373CONFIG_DIFF=y
374CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
375CONFIG_FEATURE_DIFF_DIR=y
376CONFIG_ED=y
377CONFIG_SED=y
376CONFIG_FEATURE_ALLOW_EXEC=y 378CONFIG_FEATURE_ALLOW_EXEC=y
377 379
378# 380#
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index 27995e570..efa0e537a 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -21,7 +21,6 @@
21//usage: "[-c N] [-n]" 21//usage: "[-c N] [-n]"
22//usage:#define klogd_full_usage "\n\n" 22//usage:#define klogd_full_usage "\n\n"
23//usage: "Kernel logger\n" 23//usage: "Kernel logger\n"
24//usage: "\nOptions:"
25//usage: "\n -c N Print to console messages more urgent than prio N (1-8)" 24//usage: "\n -c N Print to console messages more urgent than prio N (1-8)"
26//usage: "\n -n Run in foreground" 25//usage: "\n -n Run in foreground"
27 26
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index 0fabd97ca..5a7027731 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -11,7 +11,6 @@
11//usage: "[OPTIONS] [MESSAGE]" 11//usage: "[OPTIONS] [MESSAGE]"
12//usage:#define logger_full_usage "\n\n" 12//usage:#define logger_full_usage "\n\n"
13//usage: "Write MESSAGE (or stdin) to syslog\n" 13//usage: "Write MESSAGE (or stdin) to syslog\n"
14//usage: "\nOptions:"
15//usage: "\n -s Log to stderr as well as the system log" 14//usage: "\n -s Log to stderr as well as the system log"
16//usage: "\n -t TAG Log using the specified tag (defaults to user name)" 15//usage: "\n -t TAG Log using the specified tag (defaults to user name)"
17//usage: "\n -p PRIO Priority (numeric or facility.level pair)" 16//usage: "\n -p PRIO Priority (numeric or facility.level pair)"
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index ae0b2194b..993956904 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -13,7 +13,6 @@
13//usage: "[-f]" 13//usage: "[-f]"
14//usage:#define logread_full_usage "\n\n" 14//usage:#define logread_full_usage "\n\n"
15//usage: "Show messages in syslogd's circular buffer\n" 15//usage: "Show messages in syslogd's circular buffer\n"
16//usage: "\nOptions:"
17//usage: "\n -f Output data as log grows" 16//usage: "\n -f Output data as log grows"
18 17
19#include "libbb.h" 18#include "libbb.h"
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index c5c2a2e86..2f0ca6ac5 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -20,7 +20,6 @@
20//usage: IF_NOT_FEATURE_SYSLOGD_CFG( 20//usage: IF_NOT_FEATURE_SYSLOGD_CFG(
21//usage: "(this version of syslogd ignores /etc/syslog.conf)\n" 21//usage: "(this version of syslogd ignores /etc/syslog.conf)\n"
22//usage: ) 22//usage: )
23//usage: "\nOptions:"
24//usage: "\n -n Run in foreground" 23//usage: "\n -n Run in foreground"
25//usage: "\n -O FILE Log to FILE (default:/var/log/messages)" 24//usage: "\n -O FILE Log to FILE (default:/var/log/messages)"
26//usage: "\n -l N Log only messages more urgent than prio N (1-8)" 25//usage: "\n -l N Log only messages more urgent than prio N (1-8)"
diff --git a/testsuite/parse.tests b/testsuite/parse.tests
index 9899b73bf..904e1a17a 100755
--- a/testsuite/parse.tests
+++ b/testsuite/parse.tests
@@ -96,6 +96,7 @@ cat >$FILE.res <<EOF
96[option][dns][129.219.13.81] 96[option][dns][129.219.13.81]
97[option][domain][local] 97[option][domain][local]
98[option][lease][864000] 98[option][lease][864000]
99[option][0x08][01020304]
99EOF 100EOF
100 101
101testing "parse udhcpd.conf from examples" \ 102testing "parse udhcpd.conf from examples" \
diff --git a/util-linux/acpid.c b/util-linux/acpid.c
index 4b7e5cacb..2f27cfd1c 100644
--- a/util-linux/acpid.c
+++ b/util-linux/acpid.c
@@ -11,7 +11,6 @@
11//usage: "[-d] [-c CONFDIR] [-l LOGFILE] [-a ACTIONFILE] [-M MAPFILE] [-e PROC_EVENT_FILE] [-p PIDFILE]" 11//usage: "[-d] [-c CONFDIR] [-l LOGFILE] [-a ACTIONFILE] [-M MAPFILE] [-e PROC_EVENT_FILE] [-p PIDFILE]"
12//usage:#define acpid_full_usage "\n\n" 12//usage:#define acpid_full_usage "\n\n"
13//usage: "Listen to ACPI events and spawn specific helpers on event arrival\n" 13//usage: "Listen to ACPI events and spawn specific helpers on event arrival\n"
14//usage: "\nOptions:"
15//usage: "\n -c DIR Config directory [/etc/acpi]" 14//usage: "\n -c DIR Config directory [/etc/acpi]"
16//usage: "\n -d Don't daemonize, (implies -f)" 15//usage: "\n -d Don't daemonize, (implies -f)"
17//usage: "\n -e FILE /proc event file [/proc/acpi/event]" 16//usage: "\n -e FILE /proc event file [/proc/acpi/event]"
diff --git a/util-linux/blockdev.c b/util-linux/blockdev.c
index 4aed02982..e25e529db 100644
--- a/util-linux/blockdev.c
+++ b/util-linux/blockdev.c
@@ -19,8 +19,7 @@
19//usage:#define blockdev_trivial_usage 19//usage:#define blockdev_trivial_usage
20//usage: "OPTION BLOCKDEV" 20//usage: "OPTION BLOCKDEV"
21//usage:#define blockdev_full_usage "\n\n" 21//usage:#define blockdev_full_usage "\n\n"
22//usage: "Options:" 22//usage: " --setro Set ro"
23//usage: "\n --setro Set ro"
24//usage: "\n --setrw Set rw" 23//usage: "\n --setrw Set rw"
25//usage: "\n --getro Get ro" 24//usage: "\n --getro Get ro"
26//usage: "\n --getss Get sector size" 25//usage: "\n --getss Get sector size"
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 412bf024b..6505da54b 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -13,7 +13,6 @@
13//usage: "[-c] [-n LEVEL] [-s SIZE]" 13//usage: "[-c] [-n LEVEL] [-s SIZE]"
14//usage:#define dmesg_full_usage "\n\n" 14//usage:#define dmesg_full_usage "\n\n"
15//usage: "Print or control the kernel ring buffer\n" 15//usage: "Print or control the kernel ring buffer\n"
16//usage: "\nOptions:"
17//usage: "\n -c Clear ring buffer after printing" 16//usage: "\n -c Clear ring buffer after printing"
18//usage: "\n -n LEVEL Set console logging level" 17//usage: "\n -n LEVEL Set console logging level"
19//usage: "\n -s SIZE Buffer size" 18//usage: "\n -s SIZE Buffer size"
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 3be342481..196c2aa24 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -385,7 +385,7 @@ int fbset_main(int argc, char **argv)
385 OPT_CHANGE = (1 << 0), 385 OPT_CHANGE = (1 << 0),
386 OPT_SHOW = (1 << 1), 386 OPT_SHOW = (1 << 1),
387 OPT_READMODE = (1 << 2), 387 OPT_READMODE = (1 << 2),
388 OPT_ALL = (1 << 9), 388 OPT_ALL = (1 << 3),
389 }; 389 };
390 struct fb_var_screeninfo var_old, var_set; 390 struct fb_var_screeninfo var_old, var_set;
391 int fh, i; 391 int fh, i;
@@ -490,6 +490,7 @@ int fbset_main(int argc, char **argv)
490 if (!read_mode_db(&var_old, modefile, mode)) { 490 if (!read_mode_db(&var_old, modefile, mode)) {
491 bb_error_msg_and_die("unknown video mode '%s'", mode); 491 bb_error_msg_and_die("unknown video mode '%s'", mode);
492 } 492 }
493 options |= OPT_CHANGE;
493#endif 494#endif
494 } 495 }
495 496
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index bf7098e71..2f0854a30 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -9,7 +9,6 @@
9//usage: "[-n] DEVICE" 9//usage: "[-n] DEVICE"
10//usage:#define fdformat_full_usage "\n\n" 10//usage:#define fdformat_full_usage "\n\n"
11//usage: "Format floppy disk\n" 11//usage: "Format floppy disk\n"
12//usage: "\nOptions:"
13//usage: "\n -n Don't verify after format" 12//usage: "\n -n Don't verify after format"
14 13
15#include "libbb.h" 14#include "libbb.h"
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index f4fd4d31d..b86b13bdc 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -18,7 +18,6 @@
18//usage: "[-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK" 18//usage: "[-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK"
19//usage:#define fdisk_full_usage "\n\n" 19//usage:#define fdisk_full_usage "\n\n"
20//usage: "Change partition table\n" 20//usage: "Change partition table\n"
21//usage: "\nOptions:"
22//usage: "\n -u Start and End are in sectors (instead of cylinders)" 21//usage: "\n -u Start and End are in sectors (instead of cylinders)"
23//usage: "\n -l Show partition table for each DISK, then exit" 22//usage: "\n -l Show partition table for each DISK, then exit"
24//usage: IF_FEATURE_FDISK_BLKSIZE( 23//usage: IF_FEATURE_FDISK_BLKSIZE(
diff --git a/util-linux/flock.c b/util-linux/flock.c
index 8fecb54d4..e9be4eee9 100644
--- a/util-linux/flock.c
+++ b/util-linux/flock.c
@@ -8,7 +8,6 @@
8//usage: "[-sxun] FD|{FILE [-c] PROG ARGS}" 8//usage: "[-sxun] FD|{FILE [-c] PROG ARGS}"
9//usage:#define flock_full_usage "\n\n" 9//usage:#define flock_full_usage "\n\n"
10//usage: "[Un]lock file descriptor, or lock FILE, run PROG\n" 10//usage: "[Un]lock file descriptor, or lock FILE, run PROG\n"
11//usage: "\nOptions:"
12//usage: "\n -s Shared lock" 11//usage: "\n -s Shared lock"
13//usage: "\n -x Exclusive lock (default)" 12//usage: "\n -x Exclusive lock (default)"
14//usage: "\n -u Unlock FD" 13//usage: "\n -u Unlock FD"
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index b53c97248..1508ecb03 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -91,7 +91,6 @@
91//usage: "[-larvsmf] BLOCKDEV" 91//usage: "[-larvsmf] BLOCKDEV"
92//usage:#define fsck_minix_full_usage "\n\n" 92//usage:#define fsck_minix_full_usage "\n\n"
93//usage: "Check MINIX filesystem\n" 93//usage: "Check MINIX filesystem\n"
94//usage: "\nOptions:"
95//usage: "\n -l List all filenames" 94//usage: "\n -l List all filenames"
96//usage: "\n -r Perform interactive repairs" 95//usage: "\n -r Perform interactive repairs"
97//usage: "\n -a Perform automatic repairs" 96//usage: "\n -a Perform automatic repairs"
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 85ff76189..c45edf8ca 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -34,9 +34,8 @@
34//usage:#define getopt_trivial_usage 34//usage:#define getopt_trivial_usage
35//usage: "[OPTIONS]" 35//usage: "[OPTIONS]"
36//usage:#define getopt_full_usage "\n\n" 36//usage:#define getopt_full_usage "\n\n"
37//usage: "Options:"
38//usage: IF_LONG_OPTS( 37//usage: IF_LONG_OPTS(
39//usage: "\n -a,--alternative Allow long options starting with single -" 38//usage: " -a,--alternative Allow long options starting with single -"
40//usage: "\n -l,--longoptions=longopts Long options to be recognized" 39//usage: "\n -l,--longoptions=longopts Long options to be recognized"
41//usage: "\n -n,--name=progname The name under which errors are reported" 40//usage: "\n -n,--name=progname The name under which errors are reported"
42//usage: "\n -o,--options=optstring Short options to be recognized" 41//usage: "\n -o,--options=optstring Short options to be recognized"
@@ -47,7 +46,7 @@
47//usage: "\n -u,--unquoted Don't quote the output" 46//usage: "\n -u,--unquoted Don't quote the output"
48//usage: ) 47//usage: )
49//usage: IF_NOT_LONG_OPTS( 48//usage: IF_NOT_LONG_OPTS(
50//usage: "\n -a Allow long options starting with single -" 49//usage: " -a Allow long options starting with single -"
51//usage: "\n -l longopts Long options to be recognized" 50//usage: "\n -l longopts Long options to be recognized"
52//usage: "\n -n progname The name under which errors are reported" 51//usage: "\n -n progname The name under which errors are reported"
53//usage: "\n -o optstring Short options to be recognized" 52//usage: "\n -o optstring Short options to be recognized"
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index 1f5d57d74..9a312f95c 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -13,7 +13,6 @@
13//usage: "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..." 13//usage: "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..."
14//usage:#define hexdump_full_usage "\n\n" 14//usage:#define hexdump_full_usage "\n\n"
15//usage: "Display FILEs (or stdin) in a user specified format\n" 15//usage: "Display FILEs (or stdin) in a user specified format\n"
16//usage: "\nOptions:"
17//usage: "\n -b One-byte octal display" 16//usage: "\n -b One-byte octal display"
18//usage: "\n -c One-byte character display" 17//usage: "\n -c One-byte character display"
19//usage: "\n -C Canonical hex+ASCII, 16 bytes per line" 18//usage: "\n -C Canonical hex+ASCII, 16 bytes per line"
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 54e97e5bb..ee68be8c5 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -263,7 +263,6 @@ static void set_system_clock_timezone(int utc)
263//usage: ) 263//usage: )
264//usage:#define hwclock_full_usage "\n\n" 264//usage:#define hwclock_full_usage "\n\n"
265//usage: "Query and set hardware clock (RTC)\n" 265//usage: "Query and set hardware clock (RTC)\n"
266//usage: "\nOptions:"
267//usage: "\n -r Show hardware clock time" 266//usage: "\n -r Show hardware clock time"
268//usage: "\n -s Set system time from hardware clock" 267//usage: "\n -s Set system time from hardware clock"
269//usage: "\n -w Set hardware clock from system time" 268//usage: "\n -w Set hardware clock from system time"
diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c
index bdd019f6f..274050cdf 100644
--- a/util-linux/ipcrm.c
+++ b/util-linux/ipcrm.c
@@ -13,7 +13,6 @@
13//usage:#define ipcrm_full_usage "\n\n" 13//usage:#define ipcrm_full_usage "\n\n"
14//usage: "Upper-case options MQS remove an object by shmkey value.\n" 14//usage: "Upper-case options MQS remove an object by shmkey value.\n"
15//usage: "Lower-case options remove an object by shmid value.\n" 15//usage: "Lower-case options remove an object by shmid value.\n"
16//usage: "\nOptions:"
17//usage: "\n -mM Remove memory segment after last detach" 16//usage: "\n -mM Remove memory segment after last detach"
18//usage: "\n -qQ Remove message queue" 17//usage: "\n -qQ Remove message queue"
19//usage: "\n -sS Remove semaphore" 18//usage: "\n -sS Remove semaphore"
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c
index 33035c62e..ee7df5e33 100644
--- a/util-linux/ipcs.c
+++ b/util-linux/ipcs.c
@@ -55,11 +55,11 @@
55#define SHM_INFO 14 55#define SHM_INFO 14
56struct shm_info { 56struct shm_info {
57 int used_ids; 57 int used_ids;
58 ulong shm_tot; /* total allocated shm */ 58 unsigned long shm_tot; /* total allocated shm */
59 ulong shm_rss; /* total resident shm */ 59 unsigned long shm_rss; /* total resident shm */
60 ulong shm_swp; /* total swapped shm */ 60 unsigned long shm_swp; /* total swapped shm */
61 ulong swap_attempts; 61 unsigned long swap_attempts;
62 ulong swap_successes; 62 unsigned long swap_successes;
63}; 63};
64#endif 64#endif
65 65
@@ -267,7 +267,7 @@ static NOINLINE void do_sem(void)
267 struct passwd *pw; 267 struct passwd *pw;
268 union semun arg; 268 union semun arg;
269 269
270 arg.array = (ushort *) (void *) &seminfo; 270 arg.array = (unsigned short *) (void *) &seminfo;
271 maxid = semctl(0, 0, SEM_INFO, arg); 271 maxid = semctl(0, 0, SEM_INFO, arg);
272 if (maxid < 0) { 272 if (maxid < 0) {
273 printf("kernel not configured for %s\n", "semaphores"); 273 printf("kernel not configured for %s\n", "semaphores");
@@ -277,7 +277,7 @@ static NOINLINE void do_sem(void)
277 switch (format) { 277 switch (format) {
278 case LIMITS: 278 case LIMITS:
279 printf("------ Semaphore %s --------\n", "Limits"); 279 printf("------ Semaphore %s --------\n", "Limits");
280 arg.array = (ushort *) (void *) &seminfo; /* damn union */ 280 arg.array = (unsigned short *) (void *) &seminfo; /* damn union */
281 if ((semctl(0, 0, IPC_INFO, arg)) < 0) 281 if ((semctl(0, 0, IPC_INFO, arg)) < 0)
282 return; 282 return;
283 printf("max number of arrays = %d\n" 283 printf("max number of arrays = %d\n"
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index 7e11e292d..9b7c49f50 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -12,8 +12,7 @@
12//usage: " losetup -d LOOPDEV - disassociate\n" 12//usage: " losetup -d LOOPDEV - disassociate\n"
13//usage: " losetup [-f] - show" 13//usage: " losetup [-f] - show"
14//usage:#define losetup_full_usage "\n\n" 14//usage:#define losetup_full_usage "\n\n"
15//usage: "Options:" 15//usage: " -o OFS Start OFS bytes into FILE"
16//usage: "\n -o OFS Start OFS bytes into FILE"
17//usage: "\n -f Show first free loop device" 16//usage: "\n -f Show first free loop device"
18//usage: 17//usage:
19//usage:#define losetup_notes_usage 18//usage:#define losetup_notes_usage
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index a8bc4b80d..59d7d23d4 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -67,7 +67,6 @@
67//usage: "[-c | -l FILE] [-nXX] [-iXX] BLOCKDEV [KBYTES]" 67//usage: "[-c | -l FILE] [-nXX] [-iXX] BLOCKDEV [KBYTES]"
68//usage:#define mkfs_minix_full_usage "\n\n" 68//usage:#define mkfs_minix_full_usage "\n\n"
69//usage: "Make a MINIX filesystem\n" 69//usage: "Make a MINIX filesystem\n"
70//usage: "\nOptions:"
71//usage: "\n -c Check device for bad blocks" 70//usage: "\n -c Check device for bad blocks"
72//usage: "\n -n [14|30] Maximum length of filenames" 71//usage: "\n -n [14|30] Maximum length of filenames"
73//usage: "\n -i INODES Number of inodes for the filesystem" 72//usage: "\n -i INODES Number of inodes for the filesystem"
diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c
index 463ae1e2a..b4efb9e9f 100644
--- a/util-linux/mkfs_reiser.c
+++ b/util-linux/mkfs_reiser.c
@@ -11,7 +11,6 @@
11//usage: "[-f] [-l LABEL] BLOCKDEV [4K-BLOCKS]" 11//usage: "[-f] [-l LABEL] BLOCKDEV [4K-BLOCKS]"
12//usage:#define mkfs_reiser_full_usage "\n\n" 12//usage:#define mkfs_reiser_full_usage "\n\n"
13//usage: "Make a ReiserFS V3 filesystem\n" 13//usage: "Make a ReiserFS V3 filesystem\n"
14//usage: "\nOptions:"
15//usage: "\n -f Force" 14//usage: "\n -f Force"
16//usage: "\n -l LBL Volume label" 15//usage: "\n -l LBL Volume label"
17 16
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index e83ae7510..7d81ed06d 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -18,7 +18,6 @@
18*/ 18*/
19//usage:#define mkfs_vfat_full_usage "\n\n" 19//usage:#define mkfs_vfat_full_usage "\n\n"
20//usage: "Make a FAT32 filesystem\n" 20//usage: "Make a FAT32 filesystem\n"
21//usage: "\nOptions:"
22/* //usage: "\n -c Check device for bad blocks" */ 21/* //usage: "\n -c Check device for bad blocks" */
23//usage: "\n -v Verbose" 22//usage: "\n -v Verbose"
24/* //usage: "\n -I Allow to use entire disk device (e.g. /dev/hda)" */ 23/* //usage: "\n -I Allow to use entire disk device (e.g. /dev/hda)" */
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index ef6932c6c..b5d2c49b6 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -10,7 +10,6 @@
10//usage: "[-L LBL] BLOCKDEV [KBYTES]" 10//usage: "[-L LBL] BLOCKDEV [KBYTES]"
11//usage:#define mkswap_full_usage "\n\n" 11//usage:#define mkswap_full_usage "\n\n"
12//usage: "Prepare BLOCKDEV to be used as swap partition\n" 12//usage: "Prepare BLOCKDEV to be used as swap partition\n"
13//usage: "\nOptions:"
14//usage: "\n -L LBL Label" 13//usage: "\n -L LBL Label"
15 14
16#include "libbb.h" 15#include "libbb.h"
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 6a154e2b2..05e532cda 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -21,7 +21,6 @@
21//usage: "[OPTIONS] [-o OPTS] DEVICE NODE" 21//usage: "[OPTIONS] [-o OPTS] DEVICE NODE"
22//usage:#define mount_full_usage "\n\n" 22//usage:#define mount_full_usage "\n\n"
23//usage: "Mount a filesystem. Filesystem autodetection requires /proc.\n" 23//usage: "Mount a filesystem. Filesystem autodetection requires /proc.\n"
24//usage: "\nOptions:"
25//usage: "\n -a Mount all filesystems in fstab" 24//usage: "\n -a Mount all filesystems in fstab"
26//usage: IF_FEATURE_MOUNT_FAKE( 25//usage: IF_FEATURE_MOUNT_FAKE(
27//usage: IF_FEATURE_MTAB_SUPPORT( 26//usage: IF_FEATURE_MTAB_SUPPORT(
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 628df0da7..1f36d8f37 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -12,7 +12,6 @@
12//usage: "[-sp] HOST" 12//usage: "[-sp] HOST"
13//usage:#define rdate_full_usage "\n\n" 13//usage:#define rdate_full_usage "\n\n"
14//usage: "Get and possibly set the system date and time from a remote HOST\n" 14//usage: "Get and possibly set the system date and time from a remote HOST\n"
15//usage: "\nOptions:"
16//usage: "\n -s Set the system date and time (default)" 15//usage: "\n -s Set the system date and time (default)"
17//usage: "\n -p Print the date and time" 16//usage: "\n -p Print the date and time"
18 17
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index 7b7aa7c9f..4ed801137 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -35,8 +35,7 @@
35//usage:#define readprofile_trivial_usage 35//usage:#define readprofile_trivial_usage
36//usage: "[OPTIONS]" 36//usage: "[OPTIONS]"
37//usage:#define readprofile_full_usage "\n\n" 37//usage:#define readprofile_full_usage "\n\n"
38//usage: "Options:" 38//usage: " -m mapfile (Default: /boot/System.map)"
39//usage: "\n -m mapfile (Default: /boot/System.map)"
40//usage: "\n -p profile (Default: /proc/profile)" 39//usage: "\n -p profile (Default: /proc/profile)"
41//usage: "\n -M NUM Set the profiling multiplier to NUM" 40//usage: "\n -M NUM Set the profiling multiplier to NUM"
42//usage: "\n -i Print only info about the sampling step" 41//usage: "\n -i Print only info about the sampling step"
diff --git a/util-linux/script.c b/util-linux/script.c
index 26f16ebf5..8fb991d15 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -14,8 +14,7 @@
14//usage:#define script_trivial_usage 14//usage:#define script_trivial_usage
15//usage: "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]" 15//usage: "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]"
16//usage:#define script_full_usage "\n\n" 16//usage:#define script_full_usage "\n\n"
17//usage: "Options:" 17//usage: " -a Append output"
18//usage: "\n -a Append output"
19//usage: "\n -c PROG Run PROG, not shell" 18//usage: "\n -c PROG Run PROG, not shell"
20//usage: "\n -f Flush output after each write" 19//usage: "\n -f Flush output after each write"
21//usage: "\n -q Quiet" 20//usage: "\n -q Quiet"
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index b7cf69833..dbefa4cf2 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -11,7 +11,6 @@
11//usage: "[-a]" IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]" 11//usage: "[-a]" IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]"
12//usage:#define swapon_full_usage "\n\n" 12//usage:#define swapon_full_usage "\n\n"
13//usage: "Start swapping on DEVICE\n" 13//usage: "Start swapping on DEVICE\n"
14//usage: "\nOptions:"
15//usage: "\n -a Start swapping on all swap devices" 14//usage: "\n -a Start swapping on all swap devices"
16//usage: IF_FEATURE_SWAPON_PRI( 15//usage: IF_FEATURE_SWAPON_PRI(
17//usage: "\n -p PRI Set swap device priority" 16//usage: "\n -p PRI Set swap device priority"
@@ -21,7 +20,6 @@
21//usage: "[-a] [DEVICE]" 20//usage: "[-a] [DEVICE]"
22//usage:#define swapoff_full_usage "\n\n" 21//usage:#define swapoff_full_usage "\n\n"
23//usage: "Stop swapping on DEVICE\n" 22//usage: "Stop swapping on DEVICE\n"
24//usage: "\nOptions:"
25//usage: "\n -a Stop swapping on all swap devices" 23//usage: "\n -a Stop swapping on all swap devices"
26 24
27#include "libbb.h" 25#include "libbb.h"
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index 7794de18d..db6ae3542 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -12,7 +12,6 @@
12//usage: "Free initramfs and switch to another root fs:\n" 12//usage: "Free initramfs and switch to another root fs:\n"
13//usage: "chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /,\n" 13//usage: "chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /,\n"
14//usage: "execute NEW_INIT. PID must be 1. NEW_ROOT must be a mountpoint.\n" 14//usage: "execute NEW_INIT. PID must be 1. NEW_ROOT must be a mountpoint.\n"
15//usage: "\nOptions:"
16//usage: "\n -c DEV Reopen stdio to DEV after switch" 15//usage: "\n -c DEV Reopen stdio to DEV after switch"
17 16
18#include <sys/vfs.h> 17#include <sys/vfs.h>
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 1e576ca4e..5b716c688 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -12,7 +12,6 @@
12//usage: "[OPTIONS] FILESYSTEM|DIRECTORY" 12//usage: "[OPTIONS] FILESYSTEM|DIRECTORY"
13//usage:#define umount_full_usage "\n\n" 13//usage:#define umount_full_usage "\n\n"
14//usage: "Unmount file systems\n" 14//usage: "Unmount file systems\n"
15//usage: "\nOptions:"
16//usage: IF_FEATURE_UMOUNT_ALL( 15//usage: IF_FEATURE_UMOUNT_ALL(
17//usage: "\n -a Unmount all file systems" IF_FEATURE_MTAB_SUPPORT(" in /etc/mtab") 16//usage: "\n -a Unmount all file systems" IF_FEATURE_MTAB_SUPPORT(" in /etc/mtab")
18//usage: ) 17//usage: )