From a2f18d950a1a94e22fec78ee2d57f5cd3542551a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 18 Dec 2020 04:12:51 +0100 Subject: help text tweaks function old new delta packed_usage 33570 33502 -68 Signed-off-by: Denys Vlasenko --- archival/ar.c | 59 +++++++++++++++++++++++++++------------------------ archival/bbunzip.c | 10 ++++----- archival/cpio.c | 2 +- archival/dpkg_deb.c | 2 +- coreutils/sort.c | 2 +- coreutils/timeout.c | 2 +- coreutils/uniq.c | 2 +- debianutils/which.c | 4 ++-- init/halt.c | 6 +++--- networking/ifupdown.c | 14 ++++++------ networking/ntpd.c | 2 +- networking/tunctl.c | 16 +++++++------- networking/wget.c | 13 ++++-------- util-linux/chrt.c | 2 +- util-linux/ionice.c | 8 +++---- util-linux/nsenter.c | 2 +- util-linux/setpriv.c | 2 +- util-linux/uevent.c | 2 +- util-linux/unshare.c | 6 +++--- 19 files changed, 77 insertions(+), 79 deletions(-) diff --git a/archival/ar.c b/archival/ar.c index af9793f23..71f949e79 100644 --- a/archival/ar.c +++ b/archival/ar.c @@ -48,16 +48,6 @@ //kbuild:lib-$(CONFIG_AR) += ar.o -//usage:#define ar_trivial_usage -//usage: "[-optxv] ARCHIVE FILES" -//usage:#define ar_full_usage "\n\n" -//usage: "Extract or list FILES from an ar archive\n" -//usage: "\n -o Preserve original dates" -//usage: "\n -p Extract to stdout" -//usage: "\n -t List" -//usage: "\n -x Extract" -//usage: "\n -v Verbose" - #include "libbb.h" #include "bb_archive.h" #include "ar_.h" @@ -220,23 +210,36 @@ static void FAST_FUNC header_verbose_list_ar(const file_header_t *file_header) ); } -#define AR_OPT_VERBOSE (1 << 0) -#define AR_OPT_PRESERVE_DATE (1 << 1) -/* "ar r" implies create, but warns about it. c suppresses warning. - * bbox accepts but ignores it: */ -#define AR_OPT_CREATE (1 << 2) - -#define AR_CMD_PRINT (1 << 3) -#define FIRST_CMD AR_CMD_PRINT -#define AR_CMD_LIST (1 << 4) -#define AR_CMD_EXTRACT (1 << 5) -#define AR_CMD_INSERT (1 << 6) +//usage:#define ar_trivial_usage +//usage: "x|p|t"IF_FEATURE_AR_CREATE("|r")" [-ov] ARCHIVE [FILE]..." +//usage:#define ar_full_usage "\n\n" +//usage: "Extract or list FILEs from an ar archive"IF_FEATURE_AR_CREATE(", or create it")"\n" +//usage: "\n x Extract" +//usage: "\n p Extract to stdout" +//usage: "\n t List" +//usage: IF_FEATURE_AR_CREATE( +//usage: "\n r Create" +//usage: ) +//usage: "\n -o Restore mtime" +//usage: "\n -v Verbose" int ar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int ar_main(int argc UNUSED_PARAM, char **argv) { archive_handle_t *archive_handle; unsigned opt, t; + enum { + OPT_VERBOSE = (1 << 0), + OPT_PRESERVE_DATE = (1 << 1), + /* "ar r" implies create, but warns about it. c suppresses warning. + * bbox accepts but ignores it: */ + OPT_CREATE = (1 << 2), + CMD_PRINT = (1 << 3), + FIRST_CMD = CMD_PRINT, + CMD_LIST = (1 << 4), + CMD_EXTRACT = (1 << 5), + CMD_INSERT = ((1 << 6) * ENABLE_FEATURE_AR_CREATE), + }; archive_handle = init_handle(); @@ -256,26 +259,26 @@ int ar_main(int argc UNUSED_PARAM, char **argv) if (t & (t-1)) /* more than one of p,t,x[,r] are specified */ bb_show_usage(); - if (opt & AR_CMD_PRINT) { + if (opt & CMD_PRINT) { archive_handle->action_data = data_extract_to_stdout; } - if (opt & AR_CMD_LIST) { + if (opt & CMD_LIST) { archive_handle->action_header = header_list; } - if (opt & AR_CMD_EXTRACT) { + if (opt & CMD_EXTRACT) { archive_handle->action_data = data_extract_all; } - if (opt & AR_OPT_PRESERVE_DATE) { + if (opt & OPT_PRESERVE_DATE) { archive_handle->ah_flags |= ARCHIVE_RESTORE_DATE; } - if (opt & AR_OPT_VERBOSE) { + if (opt & OPT_VERBOSE) { archive_handle->action_header = header_verbose_list_ar; } #if ENABLE_FEATURE_AR_CREATE archive_handle->ar__name = *argv; #endif archive_handle->src_fd = xopen(*argv++, - (opt & AR_CMD_INSERT) + (opt & CMD_INSERT) ? O_RDWR | O_CREAT : O_RDONLY ); @@ -287,7 +290,7 @@ int ar_main(int argc UNUSED_PARAM, char **argv) } #if ENABLE_FEATURE_AR_CREATE - if (opt & AR_CMD_INSERT) + if (opt & CMD_INSERT) return write_ar_archive(archive_handle); #endif diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 6244bce85..d639f307e 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c @@ -219,7 +219,7 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext) //usage:#define uncompress_trivial_usage //usage: "[-cf] [FILE]..." //usage:#define uncompress_full_usage "\n\n" -//usage: "Decompress .Z file[s]\n" +//usage: "Decompress FILEs (or stdin)\n" //usage: "\n -c Write to stdout" //usage: "\n -f Overwrite" @@ -461,7 +461,7 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) //usage:#define unlzma_trivial_usage //usage: "[-cfk] [FILE]..." //usage:#define unlzma_full_usage "\n\n" -//usage: "Decompress FILE (or stdin)\n" +//usage: "Decompress FILEs (or stdin)\n" //usage: "\n -c Write to stdout" //usage: "\n -f Force" //usage: "\n -k Keep input files" @@ -469,7 +469,7 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) //usage:#define lzma_trivial_usage //usage: "-d [-cfk] [FILE]..." //usage:#define lzma_full_usage "\n\n" -//usage: "Decompress FILE (or stdin)\n" +//usage: "Decompress FILEs (or stdin)\n" //usage: "\n -d Decompress" //usage: "\n -c Write to stdout" //usage: "\n -f Force" @@ -532,7 +532,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) //usage:#define unxz_trivial_usage //usage: "[-cfk] [FILE]..." //usage:#define unxz_full_usage "\n\n" -//usage: "Decompress FILE (or stdin)\n" +//usage: "Decompress FILEs (or stdin)\n" //usage: "\n -c Write to stdout" //usage: "\n -f Force" //usage: "\n -k Keep input files" @@ -541,7 +541,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) //usage:#define xz_trivial_usage //usage: "-d [-cfk] [FILE]..." //usage:#define xz_full_usage "\n\n" -//usage: "Decompress FILE (or stdin)\n" +//usage: "Decompress FILEs (or stdin)\n" //usage: "\n -d Decompress" //usage: "\n -c Write to stdout" //usage: "\n -f Force" diff --git a/archival/cpio.c b/archival/cpio.c index 94b4b8174..94303389e 100644 --- a/archival/cpio.c +++ b/archival/cpio.c @@ -68,7 +68,7 @@ //usage: "\n -H newc Archive format" //usage: ) //usage: "\n -d Make leading directories" -//usage: "\n -m Preserve mtime" +//usage: "\n -m Restore mtime" //usage: "\n -v Verbose" //usage: "\n -u Overwrite" //usage: "\n -F FILE Input (-t,-i,-p) or output (-o) file" diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index c2c4cbbcc..a5a80439d 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -28,7 +28,7 @@ //usage: "\n -f Print control fields" //usage: "\n -e Extract control files to DIR (default: ./DEBIAN)" //usage: "\n -x Extract files to DIR (no default)" -//usage: "\n -X Verbose -x" +//usage: "\n -X Verbose extract" //usage: //usage:#define dpkg_deb_example_usage //usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" diff --git a/coreutils/sort.c b/coreutils/sort.c index 07c327645..b194847d1 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -43,7 +43,7 @@ //usage:#define sort_trivial_usage //usage: "[-nru" -//usage: IF_FEATURE_SORT_BIG("gMcszbdfiokt] [-o FILE] [-k start[.offset][opts][,end[.offset][opts]] [-t CHAR") +//usage: IF_FEATURE_SORT_BIG("gMcszbdfiokt] [-o FILE] [-k START[.OFS][OPTS][,END[.OFS][OPTS]] [-t CHAR") //usage: "] [FILE]..." //usage:#define sort_full_usage "\n\n" //usage: "Sort lines of text\n" diff --git a/coreutils/timeout.c b/coreutils/timeout.c index 2a628b71d..8485e1e7d 100644 --- a/coreutils/timeout.c +++ b/coreutils/timeout.c @@ -41,7 +41,7 @@ //usage:#define timeout_trivial_usage //usage: "[-s SIG] SECS PROG ARGS" //usage:#define timeout_full_usage "\n\n" -//usage: "Runs PROG. Sends SIG to it if it is not gone in SECS seconds.\n" +//usage: "Run PROG. Send SIG to it if it is not gone in SECS seconds.\n" //usage: "Default SIG: TERM." #include "libbb.h" diff --git a/coreutils/uniq.c b/coreutils/uniq.c index 317f45531..e1594286f 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c @@ -20,7 +20,7 @@ /* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */ //usage:#define uniq_trivial_usage -//usage: "[-cdu][-f,s,w N] [INPUT [OUTPUT]]" +//usage: "[-cdui] [-f,s,w N] [INPUT [OUTPUT]]" //usage:#define uniq_full_usage "\n\n" //usage: "Discard duplicate lines\n" //usage: "\n -c Prefix lines by the number of occurrences" diff --git a/debianutils/which.c b/debianutils/which.c index 98876521f..b9f1b92fd 100644 --- a/debianutils/which.c +++ b/debianutils/which.c @@ -17,9 +17,9 @@ //kbuild:lib-$(CONFIG_WHICH) += which.o //usage:#define which_trivial_usage -//usage: "[COMMAND]..." +//usage: "COMMAND..." //usage:#define which_full_usage "\n\n" -//usage: "Locate a COMMAND" +//usage: "Locate COMMAND" //usage: //usage:#define which_example_usage //usage: "$ which login\n" diff --git a/init/halt.c b/init/halt.c index 2070eaa4d..fe3cb9e75 100644 --- a/init/halt.c +++ b/init/halt.c @@ -65,7 +65,7 @@ //kbuild:lib-$(CONFIG_REBOOT) += halt.o //usage:#define halt_trivial_usage -//usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]") +//usage: "[-d DELAY] [-nf"IF_FEATURE_WTMP("w")"]" //usage:#define halt_full_usage "\n\n" //usage: "Halt the system\n" //usage: "\n -d SEC Delay interval" @@ -76,7 +76,7 @@ //usage: ) //usage: //usage:#define poweroff_trivial_usage -//usage: "[-d DELAY] [-n] [-f]" +//usage: "[-d DELAY] [-nf]" //usage:#define poweroff_full_usage "\n\n" //usage: "Halt and shut off power\n" //usage: "\n -d SEC Delay interval" @@ -84,7 +84,7 @@ //usage: "\n -f Force (don't go through init)" //usage: //usage:#define reboot_trivial_usage -//usage: "[-d DELAY] [-n] [-f]" +//usage: "[-d DELAY] [-nf]" //usage:#define reboot_full_usage "\n\n" //usage: "Reboot the system\n" //usage: "\n -d SEC Delay interval" diff --git a/networking/ifupdown.c b/networking/ifupdown.c index fedf05aaf..737113dd4 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -113,30 +113,30 @@ //kbuild:lib-$(CONFIG_IFDOWN) += ifupdown.o //usage:#define ifup_trivial_usage -//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." +//usage: "[-n"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] -a | IFACE..." //usage:#define ifup_full_usage "\n\n" //usage: " -a Configure all interfaces" //usage: "\n -i FILE Use FILE instead of /etc/network/interfaces" -//usage: "\n -n Print out what would happen, but don't do it" +//usage: "\n -n Dry run" //usage: IF_FEATURE_IFUPDOWN_MAPPING( //usage: "\n (note: doesn't disable mappings)" //usage: "\n -m Don't run any mappings" //usage: ) //usage: "\n -v Print out what would happen before doing it" -//usage: "\n -f Force configuration" +//usage: "\n -f Force" //usage: //usage:#define ifdown_trivial_usage -//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." +//usage: "[-n"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] -a | IFACE..." //usage:#define ifdown_full_usage "\n\n" //usage: " -a Deconfigure all interfaces" -//usage: "\n -i FILE Use FILE for interface definitions" -//usage: "\n -n Print out what would happen, but don't do it" +//usage: "\n -i FILE Use FILE instead of /etc/network/interfaces" +//usage: "\n -n Dry run" //usage: IF_FEATURE_IFUPDOWN_MAPPING( //usage: "\n (note: doesn't disable mappings)" //usage: "\n -m Don't run any mappings" //usage: ) //usage: "\n -v Print out what would happen before doing it" -//usage: "\n -f Force deconfiguration" +//usage: "\n -f Force" #include #include "libbb.h" diff --git a/networking/ntpd.c b/networking/ntpd.c index 06f6017d0..5a540a391 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -77,7 +77,7 @@ //usage: IF_FEATURE_NTP_AUTH(" [-k KEYFILE] [-p [keyno:N:]PEER]...") //usage:#define ntpd_full_usage "\n\n" //usage: "NTP client/server\n" -//usage: "\n -d Verbose (may be repeated)" +//usage: "\n -d[d] Verbose" //usage: "\n -n Do not daemonize" //usage: "\n -q Quit after clock is set" //usage: "\n -N Run at high priority" diff --git a/networking/tunctl.c b/networking/tunctl.c index 0f010e196..97e6917aa 100644 --- a/networking/tunctl.c +++ b/networking/tunctl.c @@ -28,16 +28,16 @@ //kbuild:lib-$(CONFIG_TUNCTL) += tunctl.o //usage:#define tunctl_trivial_usage -//usage: "[-f device] ([-t name] | -d name)" IF_FEATURE_TUNCTL_UG(" [-u owner] [-g group] [-b]") +//usage: "[-f DEVICE] [-t NAME | -d NAME]" IF_FEATURE_TUNCTL_UG(" [-u USER] [-g GRP] [-b]") //usage:#define tunctl_full_usage "\n\n" -//usage: "Create or delete tun interfaces\n" -//usage: "\n -f name tun device (/dev/net/tun)" -//usage: "\n -t name Create iface 'name'" -//usage: "\n -d name Delete iface 'name'" +//usage: "Create or delete TUN/TAP interfaces\n" +//usage: "\n -f DEV TUN device (default /dev/net/tun)" +//usage: "\n -t NAME Create iface (default: tapN)" +//usage: "\n -d NAME Delete iface" //usage: IF_FEATURE_TUNCTL_UG( -//usage: "\n -u owner Set iface owner" -//usage: "\n -g group Set iface group" -//usage: "\n -b Brief output" +//usage: "\n -u USER Set iface owner" +//usage: "\n -g GRP Set iface group" +//usage: "\n -b Brief output" //usage: ) //usage: //usage:#define tunctl_example_usage diff --git a/networking/wget.c b/networking/wget.c index ff0df4ca0..e660c279c 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -128,19 +128,14 @@ //usage:#define wget_trivial_usage //usage: IF_FEATURE_WGET_LONG_OPTIONS( -//usage: "[-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]\n" -//usage: " [-o|--output-file FILE] [--header 'header: value'] [-Y|--proxy on/off]\n" -//usage: IF_FEATURE_WGET_OPENSSL( -//usage: " [--no-check-certificate]\n" -//usage: ) +//usage: "[-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header 'HEADER: VALUE'] [-Y on/off]\n" /* Since we ignore these opts, we don't show them in --help */ /* //usage: " [--no-cache] [--passive-ftp] [-t TRIES]" */ /* //usage: " [-nv] [-nc] [-nH] [-np]" */ -//usage: " [-P DIR] [-S|--server-response] [-U|--user-agent AGENT]" IF_FEATURE_WGET_TIMEOUT(" [-T SEC]") " URL..." +//usage: " "IF_FEATURE_WGET_OPENSSL("[--no-check-certificate] ")"[-P DIR] [-U AGENT]"IF_FEATURE_WGET_TIMEOUT(" [-T SEC]")" URL..." //usage: ) //usage: IF_NOT_FEATURE_WGET_LONG_OPTIONS( -//usage: "[-cq] [-O FILE] [-o FILE] [-Y on/off] [-P DIR] [-S] [-U AGENT]" -//usage: IF_FEATURE_WGET_TIMEOUT(" [-T SEC]") " URL..." +//usage: "[-cqS] [-O FILE] [-o LOGFILE] [-Y on/off] [-P DIR] [-U AGENT]"IF_FEATURE_WGET_TIMEOUT(" [-T SEC]")" URL..." //usage: ) //usage:#define wget_full_usage "\n\n" //usage: "Retrieve files via HTTP or FTP\n" @@ -158,7 +153,7 @@ //usage: "\n -T SEC Network read timeout is SEC seconds" //usage: ) //usage: "\n -O FILE Save to FILE ('-' for stdout)" -//usage: "\n -o FILE Log messages to FILE" +//usage: "\n -o LOGFILE Log messages to FILE" //usage: "\n -U STR Use STR for User-Agent header" //usage: "\n -Y on/off Use proxy" diff --git a/util-linux/chrt.c b/util-linux/chrt.c index 6e8f66741..a8701b55f 100644 --- a/util-linux/chrt.c +++ b/util-linux/chrt.c @@ -17,7 +17,7 @@ //kbuild:lib-$(CONFIG_CHRT) += chrt.o //usage:#define chrt_trivial_usage -//usage: "-m | -p [PRIO] PID | [-rfobi] PRIO PROG [ARGS]" +//usage: "-m | -p [PRIO] PID | [-rfobi] PRIO PROG ARGS" //usage:#define chrt_full_usage "\n\n" //usage: "Change scheduling priority and class for a process\n" //usage: "\n -m Show min/max priorities" diff --git a/util-linux/ionice.c b/util-linux/ionice.c index 40c04d5e0..c8fb1a777 100644 --- a/util-linux/ionice.c +++ b/util-linux/ionice.c @@ -18,11 +18,11 @@ //kbuild:lib-$(CONFIG_IONICE) += ionice.o //usage:#define ionice_trivial_usage -//usage: "[-c 1-3] [-n 0-7] [-p PID] [PROG]" +//usage: "[-c 1-3] [-n 0-7] [-p PID] [PROG ARGS]" //usage:#define ionice_full_usage "\n\n" //usage: "Change I/O priority and class\n" -//usage: "\n -c Class. 1:realtime 2:best-effort 3:idle" -//usage: "\n -n Priority" +//usage: "\n -c N Class. 1:realtime 2:best-effort 3:idle" +//usage: "\n -n N Priority" #include #include @@ -61,7 +61,7 @@ int ionice_main(int argc UNUSED_PARAM, char **argv) /* Defaults */ int ioclass = 0; int pri = 0; - int pid = 0; /* affect own porcess */ + int pid = 0; /* affect own process */ int opt; enum { OPT_n = 1, diff --git a/util-linux/nsenter.c b/util-linux/nsenter.c index 9cfbf21e4..e6339da2f 100644 --- a/util-linux/nsenter.c +++ b/util-linux/nsenter.c @@ -17,7 +17,7 @@ //kbuild:lib-$(CONFIG_NSENTER) += nsenter.o //usage:#define nsenter_trivial_usage -//usage: "[OPTIONS] [PROG [ARGS]]" +//usage: "[OPTIONS] [PROG ARGS]" //usage:#define nsenter_full_usage "\n" //usage: "\n -t PID Target process to get namespaces from" //usage: "\n -m[FILE] Enter mount namespace" diff --git a/util-linux/setpriv.c b/util-linux/setpriv.c index 1e4b201ed..6904cf019 100644 --- a/util-linux/setpriv.c +++ b/util-linux/setpriv.c @@ -47,7 +47,7 @@ //kbuild:lib-$(CONFIG_SETPRIV) += setpriv.o //usage:#define setpriv_trivial_usage -//usage: "[OPTIONS] PROG [ARGS]" +//usage: "[OPTIONS] PROG ARGS" //usage:#define setpriv_full_usage "\n\n" //usage: "Run PROG with different privilege settings\n" //usage: IF_FEATURE_SETPRIV_DUMP( diff --git a/util-linux/uevent.c b/util-linux/uevent.c index 015f1ee78..db11746d0 100644 --- a/util-linux/uevent.c +++ b/util-linux/uevent.c @@ -15,7 +15,7 @@ //kbuild:lib-$(CONFIG_UEVENT) += uevent.o //usage:#define uevent_trivial_usage -//usage: "[PROG [ARGS]]" +//usage: "[PROG ARGS]" //usage:#define uevent_full_usage "\n\n" //usage: "uevent runs PROG for every netlink notification." //usage: "\n""PROG's environment contains data passed from the kernel." diff --git a/util-linux/unshare.c b/util-linux/unshare.c index 2087413e8..68ccdd874 100644 --- a/util-linux/unshare.c +++ b/util-linux/unshare.c @@ -23,7 +23,7 @@ //kbuild:lib-$(CONFIG_UNSHARE) += unshare.o //usage:#define unshare_trivial_usage -//usage: "[OPTIONS] [PROG [ARGS]]" +//usage: "[OPTIONS] [PROG ARGS]" //usage:#define unshare_full_usage "\n" //usage: "\n -m,--mount[=FILE] Unshare mount namespace" //usage: "\n -u,--uts[=FILE] Unshare UTS namespace (hostname etc.)" @@ -31,8 +31,8 @@ //usage: "\n -n,--net[=FILE] Unshare network namespace" //usage: "\n -p,--pid[=FILE] Unshare PID namespace" //usage: "\n -U,--user[=FILE] Unshare user namespace" -//usage: "\n -f,--fork Fork before execing PROG" -//usage: "\n -r,--map-root-user Map current user to root (implies -U)" +//usage: "\n -f Fork before execing PROG" +//usage: "\n -r Map current user to root (implies -U)" //usage: "\n --mount-proc[=DIR] Mount /proc filesystem first (implies -m)" //usage: "\n --propagation slave|shared|private|unchanged" //usage: "\n Modify mount propagation in mount namespace" -- cgit v1.2.3