From 353680aa46dc91ecfd80dd19db131de7aa90bd22 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 27 Mar 2011 01:18:07 +0100 Subject: lineedit: fixes for CONFIG_UNICODE_USING_LOCALE=y function old new delta load_string 45 91 +46 save_string 40 82 +42 reinit_unicode 34 61 +27 BB_PUTCHAR 97 120 +23 init_unicode 17 37 +20 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/0 up/down: 158/0) Total: 158 bytes Signed-off-by: Denys Vlasenko --- libbb/lineedit.c | 107 ++++++++++++++++++++++++++++++++----------------------- libbb/unicode.c | 7 ++-- 2 files changed, 66 insertions(+), 48 deletions(-) diff --git a/libbb/lineedit.c b/libbb/lineedit.c index afd28b75c..b7a2b31dc 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -204,65 +204,82 @@ static void deinit_S(void) #if ENABLE_UNICODE_SUPPORT static size_t load_string(const char *src, int maxsize) { - ssize_t len = mbstowcs(command_ps, src, maxsize - 1); - if (len < 0) - len = 0; - command_ps[len] = BB_NUL; - return len; + if (unicode_status == UNICODE_ON) { + ssize_t len = mbstowcs(command_ps, src, maxsize - 1); + if (len < 0) + len = 0; + command_ps[len] = BB_NUL; + return len; + } else { + unsigned i = 0; + while ((command_ps[i] = src[i]) != 0) + i++; + return i; + } } static unsigned save_string(char *dst, unsigned maxsize) { + if (unicode_status == UNICODE_ON) { # if !ENABLE_UNICODE_PRESERVE_BROKEN - ssize_t len = wcstombs(dst, command_ps, maxsize - 1); - if (len < 0) - len = 0; - dst[len] = '\0'; - return len; + ssize_t len = wcstombs(dst, command_ps, maxsize - 1); + if (len < 0) + len = 0; + dst[len] = '\0'; + return len; # else - unsigned dstpos = 0; - unsigned srcpos = 0; + unsigned dstpos = 0; + unsigned srcpos = 0; - maxsize--; - while (dstpos < maxsize) { - wchar_t wc; - int n = srcpos; + maxsize--; + while (dstpos < maxsize) { + wchar_t wc; + int n = srcpos; - /* Convert up to 1st invalid byte (or up to end) */ - while ((wc = command_ps[srcpos]) != BB_NUL - && !unicode_is_raw_byte(wc) - ) { + /* Convert up to 1st invalid byte (or up to end) */ + while ((wc = command_ps[srcpos]) != BB_NUL + && !unicode_is_raw_byte(wc) + ) { + srcpos++; + } + command_ps[srcpos] = BB_NUL; + n = wcstombs(dst + dstpos, command_ps + n, maxsize - dstpos); + if (n < 0) /* should not happen */ + break; + dstpos += n; + if (wc == BB_NUL) /* usually is */ + break; + + /* We do have invalid byte here! */ + command_ps[srcpos] = wc; /* restore it */ srcpos++; + if (dstpos == maxsize) + break; + dst[dstpos++] = (char) wc; } - command_ps[srcpos] = BB_NUL; - n = wcstombs(dst + dstpos, command_ps + n, maxsize - dstpos); - if (n < 0) /* should not happen */ - break; - dstpos += n; - if (wc == BB_NUL) /* usually is */ - break; - - /* We do have invalid byte here! */ - command_ps[srcpos] = wc; /* restore it */ - srcpos++; - if (dstpos == maxsize) - break; - dst[dstpos++] = (char) wc; - } - dst[dstpos] = '\0'; - return dstpos; + dst[dstpos] = '\0'; + return dstpos; # endif + } else { + unsigned i = 0; + while ((dst[i] = command_ps[i]) != 0) + i++; + return i; + } } /* I thought just fputwc(c, stdout) would work. But no... */ static void BB_PUTCHAR(wchar_t c) { - char buf[MB_CUR_MAX + 1]; - mbstate_t mbst = { 0 }; - ssize_t len; - - len = wcrtomb(buf, c, &mbst); - if (len > 0) { - buf[len] = '\0'; - fputs(buf, stdout); + if (unicode_status == UNICODE_ON) { + char buf[MB_CUR_MAX + 1]; + mbstate_t mbst = { 0 }; + ssize_t len = wcrtomb(buf, c, &mbst); + if (len > 0) { + buf[len] = '\0'; + fputs(buf, stdout); + } + } else { + /* In this case, c is always one byte */ + putchar(c); } } # if ENABLE_UNICODE_COMBINING_WCHARS || ENABLE_UNICODE_WIDE_WCHARS diff --git a/libbb/unicode.c b/libbb/unicode.c index d01efd9a2..99dc1dfa6 100644 --- a/libbb/unicode.c +++ b/libbb/unicode.c @@ -23,12 +23,13 @@ uint8_t unicode_status; /* Unicode support using libc locale support. */ -void FAST_FUNC reinit_unicode(const char *LANG UNUSED_PARAM) +void FAST_FUNC reinit_unicode(const char *LANG) { static const char unicode_0x394[] = { 0xce, 0x94, 0 }; size_t width; -//TODO: call setlocale(LC_ALL, LANG) here? +//TODO: avoid repeated calls by caching last string? + setlocale(LC_ALL, (LANG && LANG[0]) ? LANG : "C"); /* In unicode, this is a one character string */ // can use unicode_strlen(string) too, but otherwise unicode_strlen() is unused @@ -39,7 +40,7 @@ void FAST_FUNC reinit_unicode(const char *LANG UNUSED_PARAM) void FAST_FUNC init_unicode(void) { if (unicode_status == UNICODE_UNKNOWN) - reinit_unicode(NULL /*getenv("LANG")*/); + reinit_unicode(getenv("LANG")); } #else -- cgit v1.2.3-55-g6feb From a9e5c43b8b9b5d18b6aae08452fe2a3a46a248b4 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 27 Mar 2011 16:15:02 +0200 Subject: pstree: fix "warning: 'handle_thread' defined but not used" Signed-off-by: Denys Vlasenko --- procps/pstree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/procps/pstree.c b/procps/pstree.c index 4cd8cb458..16649cfaa 100644 --- a/procps/pstree.c +++ b/procps/pstree.c @@ -339,12 +339,14 @@ static void dump_by_user(PROC *current, uid_t uid) dump_by_user(walk->child, uid); } +#if ENABLE_FEATURE_SHOW_THREADS static void handle_thread(const char *comm, pid_t pid, pid_t ppid, uid_t uid) { char threadname[COMM_LEN + 2]; sprintf(threadname, "{%.*s}", COMM_LEN - 2, comm); add_proc(threadname, pid, ppid, uid/*, 1*/); } +#endif static void mread_proc(void) { -- cgit v1.2.3-55-g6feb From 700fbc308dd1f2e063180786cddfcc4abd6c10c0 Mon Sep 17 00:00:00 2001 From: Vitaly Magerya Date: Sun, 27 Mar 2011 22:33:13 +0200 Subject: wget: --post-data=STR should not encode STR, should send it verbatim This matches GNU Wget 1.12 behavior. Signed-off-by: Vitaly Magerya Signed-off-by: Denys Vlasenko --- networking/wget.c | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/networking/wget.c b/networking/wget.c index c22a76b97..2f89c8f7f 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -344,44 +344,6 @@ static char *gethdr(FILE *fp) return hdrval; } -#if ENABLE_FEATURE_WGET_LONG_OPTIONS -static char *URL_escape(const char *str) -{ - /* URL encode, see RFC 2396 */ - char *dst; - char *res = dst = xmalloc(strlen(str) * 3 + 1); - unsigned char c; - - while (1) { - c = *str++; - if (c == '\0' - /* || strchr("!&'()*-.=_~", c) - more code */ - || c == '!' - || c == '&' - || c == '\'' - || c == '(' - || c == ')' - || c == '*' - || c == '-' - || c == '.' - || c == '=' - || c == '_' - || c == '~' - || (c >= '0' && c <= '9') - || ((c|0x20) >= 'a' && (c|0x20) <= 'z') - ) { - *dst++ = c; - if (c == '\0') - return res; - } else { - *dst++ = '%'; - *dst++ = bb_hexdigits_upcase[c >> 4]; - *dst++ = bb_hexdigits_upcase[c & 0xf]; - } - } -} -#endif - static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_sockaddr *lsa) { FILE *sfp; @@ -716,15 +678,13 @@ static void download_one_url(const char *url) fputs(G.extra_headers, sfp); if (option_mask32 & WGET_OPT_POST_DATA) { - char *estr = URL_escape(G.post_data); fprintf(sfp, "Content-Type: application/x-www-form-urlencoded\r\n" "Content-Length: %u\r\n" "\r\n" "%s", - (int) strlen(estr), estr + (int) strlen(G.post_data), G.post_data ); - free(estr); } else #endif { -- cgit v1.2.3-55-g6feb From 1f4447b2d439e6f11d95746bb5f611c353305859 Mon Sep 17 00:00:00 2001 From: Pere Orga Date: Sun, 27 Mar 2011 22:40:30 +0200 Subject: move help text from include/usage.src.h to archival/*.c Signed-off-by: Pere Orga Signed-off-by: Denys Vlasenko --- archival/ar.c | 11 +++ archival/bbunzip.c | 76 +++++++++++++++++++ archival/bzip2.c | 10 +++ archival/dpkg.c | 28 +++++++ archival/dpkg_deb.c | 15 ++++ archival/gzip.c | 16 ++++ archival/lzop.c | 27 +++++++ archival/rpm.c | 13 ++++ archival/rpm2cpio.c | 6 ++ archival/unzip.c | 13 ++++ include/usage.src.h | 210 ---------------------------------------------------- 11 files changed, 215 insertions(+), 210 deletions(-) diff --git a/archival/ar.c b/archival/ar.c index a2e3306ac..f5a379fb8 100644 --- a/archival/ar.c +++ b/archival/ar.c @@ -17,6 +17,17 @@ * http://www.unix-systems.org/single_unix_specification_v2/xcu/ar.html */ +//usage:#define ar_trivial_usage +//usage: "[-o] [-v] [-p] [-t] [-x] ARCHIVE FILES" +//usage:#define ar_full_usage "\n\n" +//usage: "Extract or list FILES from an ar archive\n" +//usage: "\nOptions:" +//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 "archive.h" #include "ar.h" diff --git a/archival/bbunzip.c b/archival/bbunzip.c index c4cc5d821..734c9b269 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c @@ -167,6 +167,15 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext) * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define uncompress_trivial_usage +//usage: "[-cf] [FILE]..." +//usage:#define uncompress_full_usage "\n\n" +//usage: "Decompress .Z file[s]\n" +//usage: "\nOptions:" +//usage: "\n -c Write to stdout" +//usage: "\n -f Overwrite" + #if ENABLE_UNCOMPRESS static IF_DESKTOP(long long) int FAST_FUNC unpack_uncompress(unpack_info_t *info UNUSED_PARAM) @@ -218,6 +227,28 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv) * See the license_msg below and the file COPYING for the software license. * See the file algorithm.doc for the compression algorithms and file formats. */ + +//usage:#define gunzip_trivial_usage +//usage: "[-cft] [FILE]..." +//usage:#define gunzip_full_usage "\n\n" +//usage: "Decompress FILEs (or stdin)\n" +//usage: "\nOptions:" +//usage: "\n -c Write to stdout" +//usage: "\n -f Force" +//usage: "\n -t Test file integrity" +//usage: +//usage:#define gunzip_example_usage +//usage: "$ ls -la /tmp/BusyBox*\n" +//usage: "-rw-rw-r-- 1 andersen andersen 557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz\n" +//usage: "$ gunzip /tmp/BusyBox-0.43.tar.gz\n" +//usage: "$ ls -la /tmp/BusyBox*\n" +//usage: "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n" +//usage: +//usage:#define zcat_trivial_usage +//usage: "FILE" +//usage:#define zcat_full_usage "\n\n" +//usage: "Decompress to stdout" + #if ENABLE_GUNZIP static char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM) @@ -344,6 +375,51 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define unlzma_trivial_usage +//usage: "[-cf] [FILE]..." +//usage:#define unlzma_full_usage "\n\n" +//usage: "Decompress FILE (or stdin)\n" +//usage: "\nOptions:" +//usage: "\n -c Write to stdout" +//usage: "\n -f Force" +//usage: +//usage:#define lzma_trivial_usage +//usage: "-d [-cf] [FILE]..." +//usage:#define lzma_full_usage "\n\n" +//usage: "Decompress FILE (or stdin)\n" +//usage: "\nOptions:" +//usage: "\n -d Decompress" +//usage: "\n -c Write to stdout" +//usage: "\n -f Force" +//usage: +//usage:#define lzcat_trivial_usage +//usage: "FILE" +//usage:#define lzcat_full_usage "\n\n" +//usage: "Decompress to stdout" +//usage: +//usage:#define unxz_trivial_usage +//usage: "[-cf] [FILE]..." +//usage:#define unxz_full_usage "\n\n" +//usage: "Decompress FILE (or stdin)\n" +//usage: "\nOptions:" +//usage: "\n -c Write to stdout" +//usage: "\n -f Force" +//usage: +//usage:#define xz_trivial_usage +//usage: "-d [-cf] [FILE]..." +//usage:#define xz_full_usage "\n\n" +//usage: "Decompress FILE (or stdin)\n" +//usage: "\nOptions:" +//usage: "\n -d Decompress" +//usage: "\n -c Write to stdout" +//usage: "\n -f Force" +//usage: +//usage:#define xzcat_trivial_usage +//usage: "FILE" +//usage:#define xzcat_full_usage "\n\n" +//usage: "Decompress to stdout" + #if ENABLE_UNLZMA static IF_DESKTOP(long long) int FAST_FUNC unpack_unlzma(unpack_info_t *info UNUSED_PARAM) diff --git a/archival/bzip2.c b/archival/bzip2.c index ab08ffc1a..cfaf5fe20 100644 --- a/archival/bzip2.c +++ b/archival/bzip2.c @@ -7,6 +7,16 @@ * about bzip2 library code. */ +//usage:#define bzip2_trivial_usage +//usage: "[OPTIONS] [FILE]..." +//usage:#define bzip2_full_usage "\n\n" +//usage: "Compress FILEs (or stdin) with bzip2 algorithm\n" +//usage: "\nOptions:" +//usage: "\n -1..9 Compression level" +//usage: "\n -d Decompress" +//usage: "\n -c Write to stdout" +//usage: "\n -f Force" + #include "libbb.h" #include "archive.h" diff --git a/archival/dpkg.c b/archival/dpkg.c index c37ae3349..f8e349d09 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -28,6 +28,34 @@ * */ +//usage:#define dpkg_trivial_usage +//usage: "[-ilCPru] [-F OPT] PACKAGE" +//usage:#define dpkg_full_usage "\n\n" +//usage: "Install, remove and manage Debian packages\n" +//usage: "\nOptions:" +//usage: IF_LONG_OPTS( +//usage: "\n -i,--install Install the package" +//usage: "\n -l,--list List of installed packages" +//usage: "\n --configure Configure an unpackaged package" +//usage: "\n -P,--purge Purge all files of a package" +//usage: "\n -r,--remove Remove all but the configuration files for a package" +//usage: "\n --unpack Unpack a package, but don't configure it" +//usage: "\n --force-depends Ignore dependency problems" +//usage: "\n --force-confnew Overwrite existing config files when installing" +//usage: "\n --force-confold Keep old config files when installing" +//usage: ) +//usage: IF_NOT_LONG_OPTS( +//usage: "\n -i Install the package" +//usage: "\n -l List of installed packages" +//usage: "\n -C Configure an unpackaged package" +//usage: "\n -P Purge all files of a package" +//usage: "\n -r Remove all but the configuration files for a package" +//usage: "\n -u Unpack a package, but don't configure it" +//usage: "\n -F depends Ignore dependency problems" +//usage: "\n -F confnew Overwrite existing config files when installing" +//usage: "\n -F confold Keep old config files when installing" +//usage: ) + #include "libbb.h" #include #include "archive.h" diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index aee7b4cf5..9e1e811ee 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -4,6 +4,21 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define dpkg_deb_trivial_usage +//usage: "[-cefxX] FILE [argument" +//usage:#define dpkg_deb_full_usage "\n\n" +//usage: "Perform actions on Debian packages (.debs)\n" +//usage: "\nOptions:" +//usage: "\n -c List contents of filesystem tree" +//usage: "\n -e Extract control files to [argument] directory" +//usage: "\n -f Display control field name starting with [argument]" +//usage: "\n -x Extract packages filesystem tree to directory" +//usage: "\n -X Verbose extract" +//usage: +//usage:#define dpkg_deb_example_usage +//usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" + #include "libbb.h" #include "archive.h" diff --git a/archival/gzip.c b/archival/gzip.c index 38c5ae7fd..7686e1adb 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -39,6 +39,22 @@ gzip: bogus: No such file or directory aa: 85.1% -- replaced with aa.gz */ +//usage:#define gzip_trivial_usage +//usage: "[-cfd] [FILE]..." +//usage:#define gzip_full_usage "\n\n" +//usage: "Compress FILEs (or stdin)\n" +//usage: "\nOptions:" +//usage: "\n -d Decompress" +//usage: "\n -c Write to stdout" +//usage: "\n -f Force" +//usage: +//usage:#define gzip_example_usage +//usage: "$ ls -la /tmp/busybox*\n" +//usage: "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/busybox.tar\n" +//usage: "$ gzip /tmp/busybox.tar\n" +//usage: "$ ls -la /tmp/busybox*\n" +//usage: "-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/busybox.tar.gz\n" + #include "libbb.h" #include "archive.h" diff --git a/archival/lzop.c b/archival/lzop.c index 62455c313..f4419910f 100644 --- a/archival/lzop.c +++ b/archival/lzop.c @@ -25,6 +25,33 @@ "Minimalized" for busybox by Alain Knaff */ +//usage:#define lzop_trivial_usage +//usage: "[-cfvd123456789CF] [FILE]..." +//usage:#define lzop_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -1..9 Compression level" +//usage: "\n -d Decompress" +//usage: "\n -c Write to stdout" +//usage: "\n -f Force" +//usage: "\n -v Verbose" +//usage: "\n -F Don't store or verify checksum" +//usage: "\n -C Also write checksum of compressed block" +//usage: +//usage:#define lzopcat_trivial_usage +//usage: "[-vCF] [FILE]..." +//usage:#define lzopcat_full_usage "\n\n" +//usage: " -v Verbose" +//usage: "\n -F Don't store or verify checksum" +//usage: +//usage:#define unlzop_trivial_usage +//usage: "[-cfvCF] [FILE]..." +//usage:#define unlzop_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -c Write to stdout" +//usage: "\n -f Force" +//usage: "\n -v Verbose" +//usage: "\n -F Don't store or verify checksum" + #include "libbb.h" #include "archive.h" #include "liblzo_interface.h" diff --git a/archival/rpm.c b/archival/rpm.c index 380226f9b..98a45d9cc 100644 --- a/archival/rpm.c +++ b/archival/rpm.c @@ -7,6 +7,19 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define rpm_trivial_usage +//usage: "-i PACKAGE.rpm; rpm -qp[ildc] PACKAGE.rpm" +//usage:#define rpm_full_usage "\n\n" +//usage: "Manipulate RPM packages\n" +//usage: "\nCommands:" +//usage: "\n -i Install package" +//usage: "\n -qp Query package" +//usage: "\nOptions:" +//usage: "\n -i Show information" +//usage: "\n -l List contents" +//usage: "\n -d List documents" +//usage: "\n -c List config files" + #include "libbb.h" #include "archive.h" #include "rpm.h" diff --git a/archival/rpm2cpio.c b/archival/rpm2cpio.c index ce8cd2c2c..ff4a0d1b0 100644 --- a/archival/rpm2cpio.c +++ b/archival/rpm2cpio.c @@ -6,6 +6,12 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define rpm2cpio_trivial_usage +//usage: "package.rpm" +//usage:#define rpm2cpio_full_usage "\n\n" +//usage: "Output a cpio archive of the rpm file" + #include "libbb.h" #include "archive.h" #include "rpm.h" diff --git a/archival/unzip.c b/archival/unzip.c index 5d62c08cb..52b0a6414 100644 --- a/archival/unzip.c +++ b/archival/unzip.c @@ -19,6 +19,19 @@ * Zip64 + other methods */ +//usage:#define unzip_trivial_usage +//usage: "[-opts[modifiers]] FILE[.zip] [LIST] [-x XLIST] [-d DIR]" +//usage:#define unzip_full_usage "\n\n" +//usage: "Extract files from ZIP archives\n" +//usage: "\nOptions:" +//usage: "\n -l List archive contents (with -q for short form)" +//usage: "\n -n Never overwrite files (default)" +//usage: "\n -o Overwrite" +//usage: "\n -p Send output to stdout" +//usage: "\n -q Quiet" +//usage: "\n -x XLST Exclude these files" +//usage: "\n -d DIR Extract files into DIR" + #include "libbb.h" #include "archive.h" diff --git a/include/usage.src.h b/include/usage.src.h index d07b408a6..69b8da272 100644 --- a/include/usage.src.h +++ b/include/usage.src.h @@ -74,17 +74,6 @@ INSERT "\n -t TICK Microseconds per tick, usually 10000" \ "\n -p TCONST" \ -#define ar_trivial_usage \ - "[-o] [-v] [-p] [-t] [-x] ARCHIVE FILES" -#define ar_full_usage "\n\n" \ - "Extract or list FILES from an ar archive\n" \ - "\nOptions:" \ - "\n -o Preserve original dates" \ - "\n -p Extract to stdout" \ - "\n -t List" \ - "\n -x Extract" \ - "\n -v Verbose" \ - #define arp_trivial_usage \ "\n[-vn] [-H HWTYPE] [-i IF] -a [HOSTNAME]" \ "\n[-v] [-i IF] -d HOSTNAME [pub]" \ @@ -179,90 +168,9 @@ INSERT "\n stp BRIDGE [1/yes/on|0/no/off] STP on/off" \ ) \ -#define bzip2_trivial_usage \ - "[OPTIONS] [FILE]..." -#define bzip2_full_usage "\n\n" \ - "Compress FILEs (or stdin) with bzip2 algorithm\n" \ - "\nOptions:" \ - "\n -1..9 Compression level" \ - "\n -d Decompress" \ - "\n -c Write to stdout" \ - "\n -f Force" \ - #define busybox_notes_usage \ "Hello world!\n" -#define lzop_trivial_usage \ - "[-cfvd123456789CF] [FILE]..." -#define lzop_full_usage "\n\n" \ - "Options:" \ - "\n -1..9 Compression level" \ - "\n -d Decompress" \ - "\n -c Write to stdout" \ - "\n -f Force" \ - "\n -v Verbose" \ - "\n -F Don't store or verify checksum" \ - "\n -C Also write checksum of compressed block" \ - -#define lzopcat_trivial_usage \ - "[-vCF] [FILE]..." -#define lzopcat_full_usage "\n\n" \ - " -v Verbose" \ - "\n -F Don't store or verify checksum" \ - -#define unlzop_trivial_usage \ - "[-cfvCF] [FILE]..." -#define unlzop_full_usage "\n\n" \ - "Options:" \ - "\n -c Write to stdout" \ - "\n -f Force" \ - "\n -v Verbose" \ - "\n -F Don't store or verify checksum" \ - -#define unlzma_trivial_usage \ - "[-cf] [FILE]..." -#define unlzma_full_usage "\n\n" \ - "Decompress FILE (or stdin)\n" \ - "\nOptions:" \ - "\n -c Write to stdout" \ - "\n -f Force" \ - -#define lzma_trivial_usage \ - "-d [-cf] [FILE]..." -#define lzma_full_usage "\n\n" \ - "Decompress FILE (or stdin)\n" \ - "\nOptions:" \ - "\n -d Decompress" \ - "\n -c Write to stdout" \ - "\n -f Force" \ - -#define lzcat_trivial_usage \ - "FILE" -#define lzcat_full_usage "\n\n" \ - "Decompress to stdout" - -#define unxz_trivial_usage \ - "[-cf] [FILE]..." -#define unxz_full_usage "\n\n" \ - "Decompress FILE (or stdin)\n" \ - "\nOptions:" \ - "\n -c Write to stdout" \ - "\n -f Force" \ - -#define xz_trivial_usage \ - "-d [-cf] [FILE]..." -#define xz_full_usage "\n\n" \ - "Decompress FILE (or stdin)\n" \ - "\nOptions:" \ - "\n -d Decompress" \ - "\n -c Write to stdout" \ - "\n -f Force" \ - -#define xzcat_trivial_usage \ - "FILE" -#define xzcat_full_usage "\n\n" \ - "Decompress to stdout" - #define cal_trivial_usage \ "[-jy] [[MONTH] YEAR]" #define cal_full_usage "\n\n" \ @@ -861,48 +769,6 @@ INSERT "\n -u dos2unix" \ "\n -d unix2dos" \ -#define dpkg_trivial_usage \ - "[-ilCPru] [-F OPT] PACKAGE" -#define dpkg_full_usage "\n\n" \ - "Install, remove and manage Debian packages\n" \ - "\nOptions:" \ - IF_LONG_OPTS( \ - "\n -i,--install Install the package" \ - "\n -l,--list List of installed packages" \ - "\n --configure Configure an unpackaged package" \ - "\n -P,--purge Purge all files of a package" \ - "\n -r,--remove Remove all but the configuration files for a package" \ - "\n --unpack Unpack a package, but don't configure it" \ - "\n --force-depends Ignore dependency problems" \ - "\n --force-confnew Overwrite existing config files when installing" \ - "\n --force-confold Keep old config files when installing" \ - ) \ - IF_NOT_LONG_OPTS( \ - "\n -i Install the package" \ - "\n -l List of installed packages" \ - "\n -C Configure an unpackaged package" \ - "\n -P Purge all files of a package" \ - "\n -r Remove all but the configuration files for a package" \ - "\n -u Unpack a package, but don't configure it" \ - "\n -F depends Ignore dependency problems" \ - "\n -F confnew Overwrite existing config files when installing" \ - "\n -F confold Keep old config files when installing" \ - ) - -#define dpkg_deb_trivial_usage \ - "[-cefxX] FILE [argument]" -#define dpkg_deb_full_usage "\n\n" \ - "Perform actions on Debian packages (.debs)\n" \ - "\nOptions:" \ - "\n -c List contents of filesystem tree" \ - "\n -e Extract control files to [argument] directory" \ - "\n -f Display control field name starting with [argument]" \ - "\n -x Extract packages filesystem tree to directory" \ - "\n -X Verbose extract" \ - -#define dpkg_deb_example_usage \ - "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" - #define du_trivial_usage \ "[-aHLdclsx" IF_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..." #define du_full_usage "\n\n" \ @@ -1377,38 +1243,6 @@ INSERT #define getsebool_full_usage "\n\n" \ " -a Show all selinux booleans" -#define gunzip_trivial_usage \ - "[-cft] [FILE]..." -#define gunzip_full_usage "\n\n" \ - "Decompress FILEs (or stdin)\n" \ - "\nOptions:" \ - "\n -c Write to stdout" \ - "\n -f Force" \ - "\n -t Test file integrity" \ - -#define gunzip_example_usage \ - "$ ls -la /tmp/BusyBox*\n" \ - "-rw-rw-r-- 1 andersen andersen 557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz\n" \ - "$ gunzip /tmp/BusyBox-0.43.tar.gz\n" \ - "$ ls -la /tmp/BusyBox*\n" \ - "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n" - -#define gzip_trivial_usage \ - "[-cfd] [FILE]..." -#define gzip_full_usage "\n\n" \ - "Compress FILEs (or stdin)\n" \ - "\nOptions:" \ - "\n -d Decompress" \ - "\n -c Write to stdout" \ - "\n -f Force" \ - -#define gzip_example_usage \ - "$ ls -la /tmp/busybox*\n" \ - "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/busybox.tar\n" \ - "$ gzip /tmp/busybox.tar\n" \ - "$ ls -la /tmp/busybox*\n" \ - "-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/busybox.tar.gz\n" - #define hdparm_trivial_usage \ "[OPTIONS] [DEVICE]" #define hdparm_full_usage "\n\n" \ @@ -2945,24 +2779,6 @@ INSERT "\n -e Display other/more information" \ "\n -A inet" IF_FEATURE_IPV6("{6}") " Select address family" \ -#define rpm_trivial_usage \ - "-i PACKAGE.rpm; rpm -qp[ildc] PACKAGE.rpm" -#define rpm_full_usage "\n\n" \ - "Manipulate RPM packages\n" \ - "\nCommands:" \ - "\n -i Install package" \ - "\n -qp Query package" \ - "\nOptions:" \ - "\n -i Show information" \ - "\n -l List contents" \ - "\n -d List documents" \ - "\n -c List config files" \ - -#define rpm2cpio_trivial_usage \ - "package.rpm" -#define rpm2cpio_full_usage "\n\n" \ - "Output a cpio archive of the rpm file" - #define rtcwake_trivial_usage \ "[-a | -l | -u] [-d DEV] [-m MODE] [-s SEC | -t TIME]" #define rtcwake_full_usage "\n\n" \ @@ -3899,14 +3715,6 @@ INSERT "$ uname -a\n" \ "Linux debian 2.4.23 #2 Tue Dec 23 17:09:10 MST 2003 i686 GNU/Linux\n" -#define uncompress_trivial_usage \ - "[-cf] [FILE]..." -#define uncompress_full_usage "\n\n" \ - "Decompress .Z file[s]\n" \ - "\nOptions:" \ - "\n -c Write to stdout" \ - "\n -f Overwrite" \ - #define unexpand_trivial_usage \ "[-fa][-t N] [FILE]..." #define unexpand_full_usage "\n\n" \ @@ -3941,19 +3749,6 @@ INSERT "b\n" \ "c\n" -#define unzip_trivial_usage \ - "[-opts[modifiers]] FILE[.zip] [LIST] [-x XLIST] [-d DIR]" -#define unzip_full_usage "\n\n" \ - "Extract files from ZIP archives\n" \ - "\nOptions:" \ - "\n -l List archive contents (with -q for short form)" \ - "\n -n Never overwrite files (default)" \ - "\n -o Overwrite" \ - "\n -p Send output to stdout" \ - "\n -q Quiet" \ - "\n -x XLST Exclude these files" \ - "\n -d DIR Extract files into DIR" \ - #define uptime_trivial_usage \ "" #define uptime_full_usage "\n\n" \ @@ -4087,11 +3882,6 @@ INSERT #define whoami_full_usage "\n\n" \ "Print the user name associated with the current effective user id" -#define zcat_trivial_usage \ - "FILE" -#define zcat_full_usage "\n\n" \ - "Decompress to stdout" - #define zcip_trivial_usage \ "[OPTIONS] IFACE SCRIPT" #define zcip_full_usage "\n\n" \ -- cgit v1.2.3-55-g6feb From 95f5c52e6f823c710be807fb86c8b2fafec8a334 Mon Sep 17 00:00:00 2001 From: Roman Borisov Date: Sun, 27 Mar 2011 23:24:09 +0200 Subject: diff: optimize diffing of files with the same metadata Signed-off-by: Roman Borisov Signed-off-by: Denys Vlasenko --- editors/diff.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/editors/diff.c b/editors/diff.c index ca4a4eae7..3719bb49f 100644 --- a/editors/diff.c +++ b/editors/diff.c @@ -952,6 +952,31 @@ int diff_main(int argc UNUSED_PARAM, char **argv) if (gotstdin && (S_ISDIR(stb[0].st_mode) || S_ISDIR(stb[1].st_mode))) bb_error_msg_and_die("can't compare stdin to a directory"); + /* Compare metadata to check if the files are the same physical file. + * + * Comment from diffutils source says: + * POSIX says that two files are identical if st_ino and st_dev are + * the same, but many file systems incorrectly assign the same (device, + * inode) pair to two distinct files, including: + * GNU/Linux NFS servers that export all local file systems as a + * single NFS file system, if a local device number (st_dev) exceeds + * 255, or if a local inode number (st_ino) exceeds 16777215. + */ + if (ENABLE_DESKTOP + && stb[0].st_ino == stb[1].st_ino + && stb[0].st_dev == stb[1].st_dev + && stb[0].st_size == stb[1].st_size + && stb[0].st_mtime == stb[1].st_mtime + && stb[0].st_ctime == stb[1].st_ctime + && stb[0].st_mode == stb[1].st_mode + && stb[0].st_nlink == stb[1].st_nlink + && stb[0].st_uid == stb[1].st_uid + && stb[0].st_gid == stb[1].st_gid + ) { + /* files are physically the same; no need to compare them */ + return STATUS_SAME; + } + if (S_ISDIR(stb[0].st_mode) && S_ISDIR(stb[1].st_mode)) { #if ENABLE_FEATURE_DIFF_DIR diffdir(file, s_start); -- cgit v1.2.3-55-g6feb From 95755181b828cccaa833d7b8d1d47174b7b360b7 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Fri, 25 Mar 2011 13:38:52 +0100 Subject: httpd: don't send error messages with gzip encoding If CONFIG_FEATURE_HTTPD_GZIP is enabled and request contained 'Accept-Encoding: gzip', then errors were sent with 'Content-Encoding: gzip' even though they aren't. Fix it by clearing content_gzip before sending the headers. Signed-off-by: Peter Korsgaard Signed-off-by: Denys Vlasenko --- networking/httpd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/networking/httpd.c b/networking/httpd.c index b8113a843..9c1aa2a6f 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -1065,6 +1065,7 @@ static void send_headers(int responseNum) static void send_headers_and_exit(int responseNum) NORETURN; static void send_headers_and_exit(int responseNum) { + IF_FEATURE_HTTPD_GZIP(content_gzip = 0;) send_headers(responseNum); log_and_exit(); } -- cgit v1.2.3-55-g6feb From 4a2aecb53a193916a40594f7c40eab86fedd8f8e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 28 Mar 2011 00:59:16 +0200 Subject: mesg: operate on stdin, not on stderr (compat) Signed-off-by: Denys Vlasenko --- init/mesg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/mesg.c b/init/mesg.c index 8489e621c..45c13b8e0 100644 --- a/init/mesg.c +++ b/init/mesg.c @@ -60,17 +60,17 @@ int mesg_main(int argc UNUSED_PARAM, char **argv) bb_show_usage(); } - if (!isatty(STDERR_FILENO)) + if (!isatty(STDIN_FILENO)) bb_error_msg_and_die("not a tty"); - xfstat(STDERR_FILENO, &sb, "stderr"); + xfstat(STDIN_FILENO, &sb, "stderr"); if (c == 0) { puts((sb.st_mode & (S_IWGRP|S_IWOTH)) ? "is y" : "is n"); return EXIT_SUCCESS; } m = (c == 'y') ? sb.st_mode | S_IWGRP_OR_S_IWOTH : sb.st_mode & ~(S_IWGRP|S_IWOTH); - if (fchmod(STDERR_FILENO, m) != 0) + if (fchmod(STDIN_FILENO, m) != 0) bb_perror_nomsg_and_die(); return EXIT_SUCCESS; } -- cgit v1.2.3-55-g6feb From 6ec1510f719ad7463d76eea9284428cc605d6b38 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 28 Mar 2011 01:23:38 +0200 Subject: applet_tables: do not include libbb.h, that header ir for target builds ...and applets/applet_tables.c is built on *host*. Signed-off-by: Denys Vlasenko --- applets/applet_tables.c | 10 ++++++++-- include/applet_metadata.h | 30 ++++++++++++++++++++++++++++++ include/busybox.h | 25 ++----------------------- 3 files changed, 40 insertions(+), 25 deletions(-) create mode 100644 include/applet_metadata.h diff --git a/applets/applet_tables.c b/applets/applet_tables.c index 32dcdb73d..3859d7326 100644 --- a/applets/applet_tables.c +++ b/applets/applet_tables.c @@ -7,13 +7,19 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - +#include +#include +#include #include #include #include +#include + +#undef ARRAY_SIZE +#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0]))) #include "../include/autoconf.h" -#include "../include/busybox.h" +#include "../include/applet_metadata.h" struct bb_applet { const char *name; diff --git a/include/applet_metadata.h b/include/applet_metadata.h new file mode 100644 index 000000000..566ef3517 --- /dev/null +++ b/include/applet_metadata.h @@ -0,0 +1,30 @@ +/* vi: set sw=4 ts=4: */ +/* + * Licensed under GPLv2 or later, see file LICENSE in this source tree. + */ +#ifndef APPLET_METADATA_H +#define APPLET_METADATA_H 1 + +/* Note: can be included by both host and target builds! */ + +/* order matters: used as index into "install_dir[]" in appletlib.c */ +typedef enum bb_install_loc_t { + BB_DIR_ROOT = 0, + BB_DIR_BIN, + BB_DIR_SBIN, +#if ENABLE_INSTALL_NO_USR + BB_DIR_USR_BIN = BB_DIR_BIN, + BB_DIR_USR_SBIN = BB_DIR_SBIN, +#else + BB_DIR_USR_BIN, + BB_DIR_USR_SBIN, +#endif +} bb_install_loc_t; + +typedef enum bb_suid_t { + BB_SUID_DROP = 0, + BB_SUID_MAYBE, + BB_SUID_REQUIRE +} bb_suid_t; + +#endif diff --git a/include/busybox.h b/include/busybox.h index be06817e3..315ef8f26 100644 --- a/include/busybox.h +++ b/include/busybox.h @@ -1,37 +1,16 @@ /* vi: set sw=4 ts=4: */ /* - * Busybox main internal header file - * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ #ifndef BUSYBOX_H #define BUSYBOX_H 1 #include "libbb.h" +/* BB_DIR_foo and BB_SUID_bar constants: */ +#include "applet_metadata.h" PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN -/* order matters: used as index into "install_dir[]" in appletlib.c */ -typedef enum bb_install_loc_t { - BB_DIR_ROOT = 0, - BB_DIR_BIN, - BB_DIR_SBIN, -#if ENABLE_INSTALL_NO_USR - BB_DIR_USR_BIN = BB_DIR_BIN, - BB_DIR_USR_SBIN = BB_DIR_SBIN, -#else - BB_DIR_USR_BIN, - BB_DIR_USR_SBIN, -#endif -} bb_install_loc_t; - -typedef enum bb_suid_t { - BB_SUID_DROP = 0, - BB_SUID_MAYBE, - BB_SUID_REQUIRE -} bb_suid_t; - - /* Defined in appletlib.c (by including generated applet_tables.h) */ /* Keep in sync with applets/applet_tables.c! */ extern const char applet_names[]; -- cgit v1.2.3-55-g6feb From 55068c478ee8e8c058b0c9e37ce0ca57612c95b1 Mon Sep 17 00:00:00 2001 From: Pere Orga Date: Sun, 27 Mar 2011 23:42:28 +0200 Subject: move help text from include/usage.src.h to console-tools/*.c Signed-off-by: Pere Orga Signed-off-by: Denys Vlasenko --- console-tools/chvt.c | 6 +++ console-tools/clear.c | 6 +++ console-tools/deallocvt.c | 5 ++ console-tools/dumpkmap.c | 8 ++++ console-tools/fgconsole.c | 5 ++ console-tools/kbd_mode.c | 12 +++++ console-tools/loadfont.c | 10 ++++ console-tools/loadkmap.c | 10 ++++ console-tools/openvt.c | 13 ++++++ console-tools/reset.c | 5 ++ console-tools/resize.c | 6 +++ console-tools/setconsole.c | 7 +++ console-tools/setkeycodes.c | 12 +++++ console-tools/setlogcons.c | 5 ++ console-tools/showkey.c | 9 ++++ include/usage.src.h | 111 -------------------------------------------- 16 files changed, 119 insertions(+), 111 deletions(-) diff --git a/console-tools/chvt.c b/console-tools/chvt.c index 07e58c3b8..b9c974f4a 100644 --- a/console-tools/chvt.c +++ b/console-tools/chvt.c @@ -6,6 +6,12 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define chvt_trivial_usage +//usage: "N" +//usage:#define chvt_full_usage "\n\n" +//usage: "Change the foreground virtual terminal to /dev/ttyN" + #include "libbb.h" int chvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/console-tools/clear.c b/console-tools/clear.c index dcb9bfb02..ac22b787e 100644 --- a/console-tools/clear.c +++ b/console-tools/clear.c @@ -6,6 +6,12 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define clear_trivial_usage +//usage: "" +//usage:#define clear_full_usage "\n\n" +//usage: "Clear screen" + #include "libbb.h" int clear_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index 6a1d13d14..b131c0a64 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c @@ -10,6 +10,11 @@ /* no options, no getopt */ +//usage:#define deallocvt_trivial_usage +//usage: "[N]" +//usage:#define deallocvt_full_usage "\n\n" +//usage: "Deallocate unused virtual terminal /dev/ttyN" + #include "libbb.h" /* From */ diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c index 301a90674..6b923d2d4 100644 --- a/console-tools/dumpkmap.c +++ b/console-tools/dumpkmap.c @@ -9,6 +9,14 @@ */ /* no options, no getopt */ +//usage:#define dumpkmap_trivial_usage +//usage: "> keymap" +//usage:#define dumpkmap_full_usage "\n\n" +//usage: "Print a binary keyboard translation table to stdout" +//usage: +//usage:#define dumpkmap_example_usage +//usage: "$ dumpkmap > keymap\n" + #include "libbb.h" /* From */ diff --git a/console-tools/fgconsole.c b/console-tools/fgconsole.c index e2dba4860..54355bee6 100644 --- a/console-tools/fgconsole.c +++ b/console-tools/fgconsole.c @@ -7,6 +7,11 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define fgconsole_trivial_usage +//usage: "" +//usage:#define fgconsole_full_usage "\n\n" +//usage: "Get active console" + #include "libbb.h" /* From */ diff --git a/console-tools/kbd_mode.c b/console-tools/kbd_mode.c index 1481d0dbb..221a9f782 100644 --- a/console-tools/kbd_mode.c +++ b/console-tools/kbd_mode.c @@ -8,6 +8,18 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define kbd_mode_trivial_usage +//usage: "[-a|k|s|u] [-C TTY]" +//usage:#define kbd_mode_full_usage "\n\n" +//usage: "Report or set the keyboard mode\n" +//usage: "\nOptions:" +//usage: "\n -a Default (ASCII)" +//usage: "\n -k Medium-raw (keyboard)" +//usage: "\n -s Raw (scancode)" +//usage: "\n -u Unicode (utf-8)" +//usage: "\n -C TTY Affect TTY instead of /dev/tty" + #include "libbb.h" #include diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 079626c20..588322b05 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c @@ -9,6 +9,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define loadfont_trivial_usage +//usage: "< font" +//usage:#define loadfont_full_usage "\n\n" +//usage: "Load a console font from stdin" +/* //usage: "\n -C TTY Affect TTY instead of /dev/tty" */ +//usage: +//usage:#define loadfont_example_usage +//usage: "$ loadfont < /etc/i18n/fontname\n" + #include "libbb.h" #include diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c index 2d1c9e284..bcffe16b1 100644 --- a/console-tools/loadkmap.c +++ b/console-tools/loadkmap.c @@ -6,6 +6,16 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define loadkmap_trivial_usage +//usage: "< keymap" +//usage:#define loadkmap_full_usage "\n\n" +//usage: "Load a binary keyboard translation table from stdin\n" +/* //usage: "\n -C TTY Affect TTY instead of /dev/tty" */ +//usage: +//usage:#define loadkmap_example_usage +//usage: "$ loadkmap < /etc/i18n/lang-keymap\n" + #include "libbb.h" #define BINARY_KEYMAP_MAGIC "bkeymap" diff --git a/console-tools/openvt.c b/console-tools/openvt.c index 56f50c6cd..de5cf93fe 100644 --- a/console-tools/openvt.c +++ b/console-tools/openvt.c @@ -8,6 +8,19 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define openvt_trivial_usage +//usage: "[-c N] [-sw] [PROG ARGS]" +//usage:#define openvt_full_usage "\n\n" +//usage: "Start PROG on a new virtual terminal\n" +//usage: "\nOptions:" +//usage: "\n -c N Use specified VT" +//usage: "\n -s Switch to the VT" +/* //usage: "\n -l Run PROG as login shell (by prepending '-')" */ +//usage: "\n -w Wait for PROG to exit" +//usage: +//usage:#define openvt_example_usage +//usage: "openvt 2 /bin/ash\n" + #include #include "libbb.h" diff --git a/console-tools/reset.c b/console-tools/reset.c index a23e4f408..65940bdec 100644 --- a/console-tools/reset.c +++ b/console-tools/reset.c @@ -11,6 +11,11 @@ /* BTW, which "standard" package has this utility? It doesn't seem * to be ncurses, coreutils, console-tools... then what? */ +//usage:#define reset_trivial_usage +//usage: "" +//usage:#define reset_full_usage "\n\n" +//usage: "Reset the screen" + #include "libbb.h" #define ESC "\033" diff --git a/console-tools/resize.c b/console-tools/resize.c index ee0728b71..4b0d63a03 100644 --- a/console-tools/resize.c +++ b/console-tools/resize.c @@ -7,6 +7,12 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ /* no options, no getopt */ + +//usage:#define resize_trivial_usage +//usage: "" +//usage:#define resize_full_usage "\n\n" +//usage: "Resize the screen" + #include "libbb.h" #define ESC "\033" diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c index 87265baf8..59c83361c 100644 --- a/console-tools/setconsole.c +++ b/console-tools/setconsole.c @@ -8,6 +8,13 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define setconsole_trivial_usage +//usage: "[-r" IF_FEATURE_SETCONSOLE_LONG_OPTIONS("|--reset") "] [DEVICE]" +//usage:#define setconsole_full_usage "\n\n" +//usage: "Redirect system console output to DEVICE (default: /dev/tty)\n" +//usage: "\nOptions:" +//usage: "\n -r Reset output to /dev/console" + #include "libbb.h" int setconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c index ca8cd21c2..a6a7c2374 100644 --- a/console-tools/setkeycodes.c +++ b/console-tools/setkeycodes.c @@ -8,6 +8,18 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define setkeycodes_trivial_usage +//usage: "SCANCODE KEYCODE..." +//usage:#define setkeycodes_full_usage "\n\n" +//usage: "Set entries into the kernel's scancode-to-keycode map,\n" +//usage: "allowing unusual keyboards to generate usable keycodes.\n\n" +//usage: "SCANCODE may be either xx or e0xx (hexadecimal),\n" +//usage: "and KEYCODE is given in decimal." +//usage: +//usage:#define setkeycodes_example_usage +//usage: "$ setkeycodes e030 127\n" + #include "libbb.h" /* From */ diff --git a/console-tools/setlogcons.c b/console-tools/setlogcons.c index 52d2608aa..83a895407 100644 --- a/console-tools/setlogcons.c +++ b/console-tools/setlogcons.c @@ -9,6 +9,11 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define setlogcons_trivial_usage +//usage: "N" +//usage:#define setlogcons_full_usage "\n\n" +//usage: "Redirect the kernel output to console N (0 for current)" + #include "libbb.h" int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/console-tools/showkey.c b/console-tools/showkey.c index 06df68bfd..2c832c92c 100644 --- a/console-tools/showkey.c +++ b/console-tools/showkey.c @@ -7,6 +7,15 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define showkey_trivial_usage +//usage: "[-a | -k | -s]" +//usage:#define showkey_full_usage "\n\n" +//usage: "Show keys pressed\n" +//usage: "\nOptions:" +//usage: "\n -a Display decimal/octal/hex values of the keys" +//usage: "\n -k Display interpreted keycodes (default)" +//usage: "\n -s Display raw scan-codes" + #include "libbb.h" #include diff --git a/include/usage.src.h b/include/usage.src.h index 69b8da272..c1720b5f1 100644 --- a/include/usage.src.h +++ b/include/usage.src.h @@ -403,21 +403,11 @@ INSERT "# ls -l /bin/ls\n" \ "-rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls*\n" -#define chvt_trivial_usage \ - "N" -#define chvt_full_usage "\n\n" \ - "Change the foreground virtual terminal to /dev/ttyN" - #define cksum_trivial_usage \ "FILES..." #define cksum_full_usage "\n\n" \ "Calculate the CRC32 checksums of FILES" -#define clear_trivial_usage \ - "" -#define clear_full_usage "\n\n" \ - "Clear screen" - #define cmp_trivial_usage \ "[-l] [-s] FILE1 [FILE2" IF_DESKTOP(" [SKIP1 [SKIP2]]") "]" #define cmp_full_usage "\n\n" \ @@ -614,11 +604,6 @@ INSERT "4+0 records in\n" \ "4+0 records out\n" -#define deallocvt_trivial_usage \ - "[N]" -#define deallocvt_full_usage "\n\n" \ - "Deallocate unused virtual terminal /dev/ttyN" - #define delgroup_trivial_usage \ IF_FEATURE_DEL_USER_FROM_GROUP("[USER] ")"GROUP" #define delgroup_full_usage "\n\n" \ @@ -806,13 +791,6 @@ INSERT "104 ./docs\n" \ "2417 .\n" -#define dumpkmap_trivial_usage \ - "> keymap" -#define dumpkmap_full_usage "\n\n" \ - "Print a binary keyboard translation table to stdout" -#define dumpkmap_example_usage \ - "$ dumpkmap > keymap\n" - #define dumpleases_trivial_usage \ "[-r|-a] [-f LEASEFILE]" #define dumpleases_full_usage "\n\n" \ @@ -1037,11 +1015,6 @@ INSERT "\n -H HEADS" \ "\n -S SECTORS" \ -#define fgconsole_trivial_usage \ - "" -#define fgconsole_full_usage "\n\n" \ - "Get active console" - #define findfs_trivial_usage \ "LABEL=label or UUID=uuid" #define findfs_full_usage "\n\n" \ @@ -1712,17 +1685,6 @@ INSERT " [[i|o]seq] [[i|o]key KEY] [[i|o]csum]\n" \ " [ttl TTL] [tos TOS] [[no]pmtudisc] [dev PHYS_DEV]" \ -#define kbd_mode_trivial_usage \ - "[-a|k|s|u] [-C TTY]" -#define kbd_mode_full_usage "\n\n" \ - "Report or set the keyboard mode\n" \ - "\nOptions:" \ - "\n -a Default (ASCII)" \ - "\n -k Medium-raw (keyboard)" \ - "\n -s Raw (scancode)" \ - "\n -u Unicode (utf-8)" \ - "\n -C TTY Affect TTY instead of /dev/tty" \ - #define kill_trivial_usage \ "[-l] [-SIG] PID..." #define kill_full_usage "\n\n" \ @@ -1822,24 +1784,6 @@ INSERT #define load_policy_trivial_usage NOUSAGE_STR #define load_policy_full_usage "" -#define loadfont_trivial_usage \ - "< font" -#define loadfont_full_usage "\n\n" \ - "Load a console font from stdin" \ -/* "\n -C TTY Affect TTY instead of /dev/tty" */ \ - -#define loadfont_example_usage \ - "$ loadfont < /etc/i18n/fontname\n" - -#define loadkmap_trivial_usage \ - "< keymap" -#define loadkmap_full_usage "\n\n" \ - "Load a binary keyboard translation table from stdin\n" \ -/* "\n -C TTY Affect TTY instead of /dev/tty" */ \ - -#define loadkmap_example_usage \ - "$ loadkmap < /etc/i18n/lang-keymap\n" - #define logger_trivial_usage \ "[OPTIONS] [MESSAGE]" #define logger_full_usage "\n\n" \ @@ -2405,19 +2349,6 @@ INSERT "Write an unambiguous representation, octal bytes by default, of FILE\n" \ "(or stdin) to stdout" -#define openvt_trivial_usage \ - "[-c N] [-sw] [PROG ARGS]" -#define openvt_full_usage "\n\n" \ - "Start PROG on a new virtual terminal\n" \ - "\nOptions:" \ - "\n -c N Use specified VT" \ - "\n -s Switch to the VT" \ -/* "\n -l Run PROG as login shell (by prepending '-')" */ \ - "\n -w Wait for PROG to exit" \ - -#define openvt_example_usage \ - "openvt 2 /bin/ash\n" - /* #define parse_trivial_usage \ "[-n MAXTOKENS] [-m MINTOKENS] [-d DELIMS] [-f FLAGS] FILE..." @@ -2704,16 +2635,6 @@ INSERT #define scriptreplay_full_usage "\n\n" \ "Play back typescripts, using timing information" -#define reset_trivial_usage \ - "" -#define reset_full_usage "\n\n" \ - "Reset the screen" - -#define resize_trivial_usage \ - "" -#define resize_full_usage "\n\n" \ - "Resize the screen" - #define restorecon_trivial_usage \ "[-iFnRv] [-e EXCLUDEDIR]... [-o FILE] [-f FILE]" #define restorecon_full_usage "\n\n" \ @@ -2926,13 +2847,6 @@ INSERT " -v Verbose" \ "\n -b Display current state of booleans" \ -#define setconsole_trivial_usage \ - "[-r" IF_FEATURE_SETCONSOLE_LONG_OPTIONS("|--reset") "] [DEVICE]" -#define setconsole_full_usage "\n\n" \ - "Redirect system console output to DEVICE (default: /dev/tty)\n" \ - "\nOptions:" \ - "\n -r Reset output to /dev/console" \ - #define setenforce_trivial_usage \ "[Enforcing | Permissive | 1 | 0]" #define setenforce_full_usage "" @@ -2972,22 +2886,6 @@ INSERT #define setfont_example_usage \ "$ setfont -m koi8-r /etc/i18n/fontname\n" -#define setkeycodes_trivial_usage \ - "SCANCODE KEYCODE..." -#define setkeycodes_full_usage "\n\n" \ - "Set entries into the kernel's scancode-to-keycode map,\n" \ - "allowing unusual keyboards to generate usable keycodes.\n\n" \ - "SCANCODE may be either xx or e0xx (hexadecimal),\n" \ - "and KEYCODE is given in decimal." \ - -#define setkeycodes_example_usage \ - "$ setkeycodes e030 127\n" - -#define setlogcons_trivial_usage \ - "N" -#define setlogcons_full_usage "\n\n" \ - "Redirect the kernel output to console N (0 for current)" - #define setsebool_trivial_usage \ "boolean value" @@ -3012,15 +2910,6 @@ INSERT "\n -f FILE Read from FILE instead of /var/log/wtmp" \ ) -#define showkey_trivial_usage \ - "[-a | -k | -s]" -#define showkey_full_usage "\n\n" \ - "Show keys pressed\n" \ - "\nOptions:" \ - "\n -a Display decimal/octal/hex values of the keys" \ - "\n -k Display interpreted keycodes (default)" \ - "\n -s Display raw scan-codes" \ - #define slattach_trivial_usage \ "[-cehmLF] [-s SPEED] [-p PROTOCOL] DEVICE" #define slattach_full_usage "\n\n" \ -- cgit v1.2.3-55-g6feb From 0e89fd9c39655fe721dd8a7a09a6c532f4255c42 Mon Sep 17 00:00:00 2001 From: Nuno Lucas Date: Mon, 28 Mar 2011 15:30:59 +0200 Subject: fbsplash: Add support for 24 and 32 bit color depth function old new delta fb_drawprogressbar 372 447 +75 fb_pixel_value - 50 +50 fb_write_pixel - 47 +47 fbsplash_main 889 920 +31 fb_drawfullrectangle 101 131 +30 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/0 up/down: 233/0) Total: 233 bytes Signed-off-by: Nuno Lucas Signed-off-by: Denys Vlasenko --- miscutils/fbsplash.c | 117 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 73 insertions(+), 44 deletions(-) diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c index 150992343..770e70026 100644 --- a/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c @@ -27,10 +27,6 @@ /* If you want logging messages on /tmp/fbsplash.log... */ #define DEBUG 0 -#define BYTES_PER_PIXEL 2 - -typedef unsigned short DATA; - struct globals { #if DEBUG bool bdebug_messages; // enable/disable logging @@ -41,6 +37,7 @@ struct globals { const char *image_filename; struct fb_var_screeninfo scr_var; struct fb_fix_screeninfo scr_fix; + unsigned bytes_per_pixel; }; #define G (*ptr_to_globals) #define INIT_G() do { \ @@ -67,7 +64,7 @@ struct globals { /** - * Open and initialize the framebuffer device + * Open and initialize the framebuffer device * \param *strfb_device pointer to framebuffer device */ static void fb_open(const char *strfb_device) @@ -78,62 +75,98 @@ static void fb_open(const char *strfb_device) xioctl(fbfd, FBIOGET_VSCREENINFO, &G.scr_var); xioctl(fbfd, FBIOGET_FSCREENINFO, &G.scr_fix); - if (G.scr_var.bits_per_pixel != 16) - bb_error_msg_and_die("only 16 bpp is supported"); + if (G.scr_var.bits_per_pixel < 16 || G.scr_var.bits_per_pixel > 32) + bb_error_msg_and_die("unsupported %u bpp", (int)G.scr_var.bits_per_pixel); + G.bytes_per_pixel = (G.scr_var.bits_per_pixel + 7) >> 3; // map the device in memory G.addr = mmap(NULL, - G.scr_var.xres * G.scr_var.yres_virtual - * BYTES_PER_PIXEL /*(G.scr_var.bits_per_pixel / 8)*/, + G.scr_var.xres * G.scr_var.yres * G.bytes_per_pixel, PROT_WRITE, MAP_SHARED, fbfd, 0); if (G.addr == MAP_FAILED) bb_perror_msg_and_die("mmap"); // point to the start of the visible screen - G.addr += G.scr_var.yoffset * G.scr_fix.line_length + G.scr_var.xoffset * BYTES_PER_PIXEL; + G.addr += G.scr_var.yoffset * G.scr_fix.line_length + G.scr_var.xoffset * G.bytes_per_pixel; close(fbfd); } /** - * Draw hollow rectangle on framebuffer + * Return pixel value of the passed RGB color + */ +static unsigned fb_pixel_value(unsigned r, unsigned g, unsigned b) +{ + if (G.bytes_per_pixel == 2) { + r >>= 3; // 5-bit red + g >>= 2; // 6-bit green + b >>= 3; // 5-bit blue + return b + (g << 5) + (r << (5+6)); + } + // RGB 888 + return b + (g << 8) + (r << 16); +} + +/** + * Draw pixel on framebuffer + */ +static void fb_write_pixel(unsigned char *addr, unsigned pixel) +{ + switch (G.bytes_per_pixel) { + case 2: + *(uint16_t *)addr = pixel; + break; + case 4: + *(uint32_t *)addr = pixel; + break; + default: // 24 bits per pixel + addr[0] = pixel; + addr[1] = pixel >> 8; + addr[2] = pixel >> 16; + } +} + + +/** + * Draw hollow rectangle on framebuffer */ static void fb_drawrectangle(void) { int cnt; - DATA thispix; - DATA *ptr1, *ptr2; + unsigned thispix; + unsigned char *ptr1, *ptr2; unsigned char nred = G.nbar_colr/2; unsigned char ngreen = G.nbar_colg/2; unsigned char nblue = G.nbar_colb/2; - nred >>= 3; // 5-bit red - ngreen >>= 2; // 6-bit green - nblue >>= 3; // 5-bit blue - thispix = nblue + (ngreen << 5) + (nred << (5+6)); + thispix = fb_pixel_value(nred, ngreen, nblue); // horizontal lines - ptr1 = (DATA*)(G.addr + (G.nbar_posy * G.scr_var.xres + G.nbar_posx) * BYTES_PER_PIXEL); - ptr2 = (DATA*)(G.addr + ((G.nbar_posy + G.nbar_height - 1) * G.scr_var.xres + G.nbar_posx) * BYTES_PER_PIXEL); + ptr1 = G.addr + (G.nbar_posy * G.scr_var.xres + G.nbar_posx) * G.bytes_per_pixel; + ptr2 = G.addr + ((G.nbar_posy + G.nbar_height - 1) * G.scr_var.xres + G.nbar_posx) * G.bytes_per_pixel; cnt = G.nbar_width - 1; do { - *ptr1++ = thispix; - *ptr2++ = thispix; + fb_write_pixel(ptr1, thispix); + fb_write_pixel(ptr2, thispix); + ptr1 += G.bytes_per_pixel; + ptr2 += G.bytes_per_pixel; } while (--cnt >= 0); // vertical lines - ptr1 = (DATA*)(G.addr + (G.nbar_posy * G.scr_var.xres + G.nbar_posx) * BYTES_PER_PIXEL); - ptr2 = (DATA*)(G.addr + (G.nbar_posy * G.scr_var.xres + G.nbar_posx + G.nbar_width - 1) * BYTES_PER_PIXEL); + ptr1 = G.addr + (G.nbar_posy * G.scr_var.xres + G.nbar_posx) * G.bytes_per_pixel; + ptr2 = G.addr + (G.nbar_posy * G.scr_var.xres + G.nbar_posx + G.nbar_width - 1) * G.bytes_per_pixel; cnt = G.nbar_height - 1; do { - *ptr1 = thispix; ptr1 += G.scr_var.xres; - *ptr2 = thispix; ptr2 += G.scr_var.xres; + fb_write_pixel(ptr1, thispix); + fb_write_pixel(ptr2, thispix); + ptr1 += G.scr_var.xres * G.bytes_per_pixel; + ptr2 += G.scr_var.xres * G.bytes_per_pixel; } while (--cnt >= 0); } /** - * Draw filled rectangle on framebuffer + * Draw filled rectangle on framebuffer * \param nx1pos,ny1pos upper left position * \param nx2pos,ny2pos down right position * \param nred,ngreen,nblue rgb color @@ -142,21 +175,19 @@ static void fb_drawfullrectangle(int nx1pos, int ny1pos, int nx2pos, int ny2pos, unsigned char nred, unsigned char ngreen, unsigned char nblue) { int cnt1, cnt2, nypos; - DATA thispix; - DATA *ptr; + unsigned thispix; + unsigned char *ptr; - nred >>= 3; // 5-bit red - ngreen >>= 2; // 6-bit green - nblue >>= 3; // 5-bit blue - thispix = nblue + (ngreen << 5) + (nred << (5+6)); + thispix = fb_pixel_value(nred, ngreen, nblue); cnt1 = ny2pos - ny1pos; nypos = ny1pos; do { - ptr = (DATA*)(G.addr + (nypos * G.scr_var.xres + nx1pos) * BYTES_PER_PIXEL); + ptr = G.addr + (nypos * G.scr_var.xres + nx1pos) * G.bytes_per_pixel; cnt2 = nx2pos - nx1pos; do { - *ptr++ = thispix; + fb_write_pixel(ptr, thispix); + ptr += G.bytes_per_pixel; } while (--cnt2 >= 0); nypos++; @@ -165,7 +196,7 @@ static void fb_drawfullrectangle(int nx1pos, int ny1pos, int nx2pos, int ny2pos, /** - * Draw a progress bar on framebuffer + * Draw a progress bar on framebuffer * \param percent percentage of loading */ static void fb_drawprogressbar(unsigned percent) @@ -215,7 +246,7 @@ static void fb_drawprogressbar(unsigned percent) /** - * Draw image from PPM file + * Draw image from PPM file */ static void fb_drawimage(void) { @@ -276,18 +307,16 @@ static void fb_drawimage(void) height = G.scr_var.yres; for (j = 0; j < height; j++) { unsigned char *pixel; - DATA *src; + unsigned char *src; if (fread(pixline, 1, line_size, theme_file) != line_size) bb_error_msg_and_die("bad PPM file '%s'", G.image_filename); pixel = pixline; - src = (DATA *)(G.addr + j * G.scr_fix.line_length); + src = G.addr + j * G.scr_fix.line_length; for (i = 0; i < width; i++) { - unsigned thispix; - thispix = (((unsigned)pixel[0] << 8) & 0xf800) - | (((unsigned)pixel[1] << 3) & 0x07e0) - | (((unsigned)pixel[2] >> 3)); - *src++ = thispix; + unsigned thispix = fb_pixel_value(pixel[0], pixel[1], pixel[2]); + fb_write_pixel(src, thispix); + src += G.bytes_per_pixel; pixel += 3; } } @@ -297,7 +326,7 @@ static void fb_drawimage(void) /** - * Parse configuration file + * Parse configuration file * \param *cfg_filename name of the configuration file */ static void init(const char *cfg_filename) -- cgit v1.2.3-55-g6feb From cecbc986112cdd5ce95d15221979edf4281f5f7f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 30 Mar 2011 18:54:52 +0200 Subject: hush: fix source1.tests function old new delta parse_and_run_stream 95 139 +44 static_get 22 25 +3 file_get 260 263 +3 builtin_umask 133 132 -1 parse_stream 2442 2425 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/2 up/down: 50/-18) Total: 32 bytes Signed-off-by: Denys Vlasenko --- shell/hush.c | 64 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/shell/hush.c b/shell/hush.c index e4c3a7d77..a47652470 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -445,8 +445,6 @@ enum { /* Used for initialization: o_string foo = NULL_O_STRING; */ #define NULL_O_STRING { NULL } -/* I can almost use ordinary FILE*. Is open_memstream() universally - * available? Where is it documented? */ typedef struct in_str { const char *p; /* eof_flag=1: last char in ->p is really an EOF */ @@ -455,6 +453,7 @@ typedef struct in_str { #if ENABLE_HUSH_INTERACTIVE smallint promptmode; /* 0: PS1, 1: PS2 */ #endif + int last_char; FILE *file; int (*get) (struct in_str *) FAST_FUNC; int (*peek) (struct in_str *) FAST_FUNC; @@ -1077,22 +1076,22 @@ static void die_if_script(unsigned lineno, const char *fmt, ...) xfunc_die(); } -static void syntax_error(unsigned lineno, const char *msg) +static void syntax_error(unsigned lineno UNUSED_PARAM, const char *msg) { if (msg) - die_if_script(lineno, "syntax error: %s", msg); + bb_error_msg("syntax error: %s", msg); else - die_if_script(lineno, "syntax error", NULL); + bb_error_msg("syntax error"); } -static void syntax_error_at(unsigned lineno, const char *msg) +static void syntax_error_at(unsigned lineno UNUSED_PARAM, const char *msg) { - die_if_script(lineno, "syntax error at '%s'", msg); + bb_error_msg("syntax error at '%s'", msg); } -static void syntax_error_unterm_str(unsigned lineno, const char *s) +static void syntax_error_unterm_str(unsigned lineno UNUSED_PARAM, const char *s) { - die_if_script(lineno, "syntax error: unterminated %s", s); + bb_error_msg("syntax error: unterminated %s", s); } static void syntax_error_unterm_ch(unsigned lineno, char ch) @@ -1101,12 +1100,12 @@ static void syntax_error_unterm_ch(unsigned lineno, char ch) syntax_error_unterm_str(lineno, msg); } -static void syntax_error_unexpected_ch(unsigned lineno, int ch) +static void syntax_error_unexpected_ch(unsigned lineno UNUSED_PARAM, int ch) { char msg[2]; msg[0] = ch; msg[1] = '\0'; - die_if_script(lineno, "syntax error: unexpected %s", ch == EOF ? "EOF" : msg); + bb_error_msg("syntax error: unexpected %s", ch == EOF ? "EOF" : msg); } #if HUSH_DEBUG < 2 @@ -1843,6 +1842,7 @@ static int FAST_FUNC static_get(struct in_str *i) int ch = *i->p; if (ch != '\0') { i->p++; + i->last_char = ch; return ch; } return EOF; @@ -1964,6 +1964,7 @@ static int FAST_FUNC file_get(struct in_str *i) do ch = fgetc(i->file); while (ch == '\0'); } debug_printf("file_get: got '%c' %d\n", ch, ch); + i->last_char = ch; return ch; } @@ -4008,7 +4009,7 @@ static int encode_string(o_string *as_string, * Scan input until EOF or end_trigger char. * Return a list of pipes to execute, or NULL on EOF * or if end_trigger character is met. - * On syntax error, exit is shell is not interactive, + * On syntax error, exit if shell is not interactive, * reset parsing machinery and start parsing anew, * or return ERR_PTR. */ @@ -4037,8 +4038,6 @@ static struct pipe *parse_stream(char **pstring, * here we should use blank chars as separators, not $IFS */ - reset: /* we come back here only on syntax errors in interactive shell */ - if (MAYBE_ASSIGNMENT != 0) dest.o_assignment = MAYBE_ASSIGNMENT; initialize_context(&ctx); @@ -4532,20 +4531,17 @@ static struct pipe *parse_stream(char **pstring, } while (HAS_KEYWORDS && pctx); /* Free text, clear all dest fields */ o_free(&dest); + + G.last_exitcode = 1; /* If we are not in top-level parse, we return, * our caller will propagate error. */ - if (end_trigger != ';') { #if !BB_MMU - if (pstring) - *pstring = NULL; + if (pstring) + *pstring = NULL; #endif - debug_leave(); - return ERR_PTR; - } - /* Discard cached input, force prompt */ - input->p = NULL; - goto reset; + debug_leave(); + return ERR_PTR; } } @@ -5550,8 +5546,24 @@ static void parse_and_run_stream(struct in_str *inp, int end_trigger) inp->promptmode = 0; /* PS1 */ #endif pipe_list = parse_stream(NULL, inp, end_trigger); - if (!pipe_list) { /* EOF */ - if (empty) + if (!pipe_list || pipe_list == ERR_PTR) { /* EOF/error */ + /* If we are in "big" script + * (not in `cmd` or something similar)... + */ + if (pipe_list == ERR_PTR && end_trigger == ';') { + /* Discard cached input (rest of line) */ + int ch = inp->last_char; + while (ch != EOF && ch != '\n') { + //bb_error_msg("Discarded:'%c'", ch); + ch = i_getch(inp); + } + /* Force prompt */ + inp->p = NULL; + /* This stream isn't empty */ + empty = 0; + continue; + } + if (!pipe_list && empty) G.last_exitcode = 0; break; } @@ -8630,8 +8642,6 @@ static int FAST_FUNC builtin_source(char **argv) #endif save_and_replace_G_args(&sv, argv); -//TODO: syntax errors in sourced file should never abort the "calling" script. -//Try: bash -c '. ./bad_file; echo YES' parse_and_run_file(input); fclose(input); -- cgit v1.2.3-55-g6feb From a439fa93f64e6eb34f0633d00d203b4267d58521 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 30 Mar 2011 19:11:46 +0200 Subject: hush: remove outdated comments Signed-off-by: Denys Vlasenko --- shell/hush.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/shell/hush.c b/shell/hush.c index a47652470..e698e6c52 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -4529,13 +4529,9 @@ static struct pipe *parse_stream(char **pstring, } IF_HAS_KEYWORDS(pctx = p2;) } while (HAS_KEYWORDS && pctx); - /* Free text, clear all dest fields */ - o_free(&dest); + o_free(&dest); G.last_exitcode = 1; - /* If we are not in top-level parse, we return, - * our caller will propagate error. - */ #if !BB_MMU if (pstring) *pstring = NULL; -- cgit v1.2.3-55-g6feb From 2c4de5b045a79db73052d5b865474a00c9a87e99 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 31 Mar 2011 13:16:52 +0200 Subject: ash,hush: optional support for $HISTFILESIZE. Based on patch from Alexey Fomenko (ext-alexey.fomenko AT nokia.com) function old new delta size_from_HISTFILESIZE - 44 +44 hush_main 998 1025 +27 ash_main 1348 1374 +26 read_line_input 3361 3372 +11 new_line_input_t 17 24 +7 Signed-off-by: Denys Vlasenko --- include/libbb.h | 4 +++- libbb/Config.src | 5 +++-- libbb/lineedit.c | 44 +++++++++++++++++++++++++++++--------------- shell/Config.src | 10 ++++++++++ shell/ash.c | 9 ++++++--- shell/hush.c | 4 ++++ 6 files changed, 55 insertions(+), 21 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index c371e35f2..f2f3313b4 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1373,8 +1373,9 @@ void read_key_ungets(char *buffer, const char *str, unsigned len) FAST_FUNC; #if ENABLE_FEATURE_EDITING /* It's NOT just ENABLEd or disabled. It's a number: */ -# ifdef CONFIG_FEATURE_EDITING_HISTORY +# if defined CONFIG_FEATURE_EDITING_HISTORY && CONFIG_FEATURE_EDITING_HISTORY > 0 # define MAX_HISTORY (CONFIG_FEATURE_EDITING_HISTORY + 0) +unsigned size_from_HISTFILESIZE(const char *hp); # else # define MAX_HISTORY 0 # endif @@ -1384,6 +1385,7 @@ typedef struct line_input_t { # if MAX_HISTORY int cnt_history; int cur_history; + int max_history; /* must never be <= 0 */ # if ENABLE_FEATURE_EDITING_SAVEHISTORY unsigned cnt_history_in_file; const char *hist_file; diff --git a/libbb/Config.src b/libbb/Config.src index a25af23b4..0ea8f43ab 100644 --- a/libbb/Config.src +++ b/libbb/Config.src @@ -80,11 +80,12 @@ config FEATURE_EDITING_VI config FEATURE_EDITING_HISTORY int "History size" - range 0 99999 + # Don't allow way too big values here, code uses fixed "char *history[N]" struct member + range 0 9999 default 255 depends on FEATURE_EDITING help - Specify command history size. + Specify command history size (0 - disable). config FEATURE_EDITING_SAVEHISTORY bool "History saving" diff --git a/libbb/lineedit.c b/libbb/lineedit.c index b7a2b31dc..095ccfbef 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -1243,12 +1243,26 @@ line_input_t* FAST_FUNC new_line_input_t(int flags) { line_input_t *n = xzalloc(sizeof(*n)); n->flags = flags; + n->max_history = MAX_HISTORY; return n; } #if MAX_HISTORY > 0 +unsigned size_from_HISTFILESIZE(const char *hp) +{ + int size = MAX_HISTORY; + if (hp) { + size = atoi(hp); + if (size <= 0) + return 1; + if (size > MAX_HISTORY) + return MAX_HISTORY; + } + return size; +} + static void save_command_ps_at_cur_history(void) { if (command_ps[0] != BB_NUL) { @@ -1339,7 +1353,7 @@ static void load_history(line_input_t *st_parm) temp_h[idx] = line; st_parm->cnt_history_in_file++; idx++; - if (idx == MAX_HISTORY) + if (idx == st_parm->max_history) idx = 0; } fclose(fp); @@ -1348,18 +1362,18 @@ static void load_history(line_input_t *st_parm) if (st_parm->cnt_history_in_file) { while (temp_h[idx] == NULL) { idx++; - if (idx == MAX_HISTORY) + if (idx == st_parm->max_history) idx = 0; } } /* copy temp_h[] to st_parm->history[] */ - for (i = 0; i < MAX_HISTORY;) { + for (i = 0; i < st_parm->max_history;) { line = temp_h[idx]; if (!line) break; idx++; - if (idx == MAX_HISTORY) + if (idx == st_parm->max_history) idx = 0; line_len = strlen(line); if (line_len >= MAX_LINELEN) @@ -1390,7 +1404,7 @@ static void save_history(char *str) /* did we write so much that history file needs trimming? */ state->cnt_history_in_file++; - if (state->cnt_history_in_file > MAX_HISTORY * 4) { + if (state->cnt_history_in_file > state->max_history * 4) { char *new_name; line_input_t *st_temp; @@ -1436,20 +1450,20 @@ static void remember_in_history(char *str) if (i && strcmp(state->history[i-1], str) == 0) return; - free(state->history[MAX_HISTORY]); /* redundant, paranoia */ - state->history[MAX_HISTORY] = NULL; /* redundant, paranoia */ + free(state->history[state->max_history]); /* redundant, paranoia */ + state->history[state->max_history] = NULL; /* redundant, paranoia */ /* If history[] is full, remove the oldest command */ - /* we need to keep history[MAX_HISTORY] empty, hence >=, not > */ - if (i >= MAX_HISTORY) { + /* we need to keep history[state->max_history] empty, hence >=, not > */ + if (i >= state->max_history) { free(state->history[0]); - for (i = 0; i < MAX_HISTORY-1; i++) + for (i = 0; i < state->max_history-1; i++) state->history[i] = state->history[i+1]; - /* i == MAX_HISTORY-1 */ + /* i == state->max_history-1 */ } - /* i <= MAX_HISTORY-1 */ + /* i <= state->max_history-1 */ state->history[i++] = xstrdup(str); - /* i <= MAX_HISTORY */ + /* i <= state->max_history */ state->cur_history = i; state->cnt_history = i; # if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY @@ -1970,7 +1984,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman maxsize = MAX_LINELEN; S.maxsize = maxsize; - /* With null flags, no other fields are ever used */ + /* With zero flags, no other fields are ever used */ state = st ? st : (line_input_t*) &const_int_0; #if MAX_HISTORY > 0 # if ENABLE_FEATURE_EDITING_SAVEHISTORY @@ -2022,7 +2036,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman #endif #if 0 - for (i = 0; i <= MAX_HISTORY; i++) + for (i = 0; i <= state->max_history; i++) bb_error_msg("history[%d]:'%s'", i, state->history[i]); bb_error_msg("cur_history:%d cnt_history:%d", state->cur_history, state->cnt_history); #endif diff --git a/shell/Config.src b/shell/Config.src index e96c21620..b31e62dda 100644 --- a/shell/Config.src +++ b/shell/Config.src @@ -136,4 +136,14 @@ config FEATURE_SH_NOFORK This feature is relatively new. Use with care. Report bugs to project mailing list. +config FEATURE_SH_HISTFILESIZE + bool "Use $HISTFILESIZE" + default y + depends on HUSH || ASH + help + This option makes busybox shells to use $HISTFILESIZE variable + to set shell history size. Note that its max value is capped + by "History size" setting in library tuning section. + + endmenu diff --git a/shell/ash.c b/shell/ash.c index 1520c5ae5..11ba9774a 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -13143,10 +13143,9 @@ int ash_main(int argc UNUSED_PARAM, char **argv) #if ENABLE_FEATURE_EDITING_SAVEHISTORY if (iflag) { const char *hp = lookupvar("HISTFILE"); - - if (hp == NULL) { + if (!hp) { hp = lookupvar("HOME"); - if (hp != NULL) { + if (hp) { char *defhp = concat_path_file(hp, ".ash_history"); setvar("HISTFILE", defhp, 0); free(defhp); @@ -13195,6 +13194,10 @@ int ash_main(int argc UNUSED_PARAM, char **argv) const char *hp = lookupvar("HISTFILE"); if (hp) line_input_state->hist_file = hp; +# if ENABLE_FEATURE_SH_HISTFILESIZE + hp = lookupvar("HISTFILESIZE"); + line_input_state->max_history = size_from_HISTFILESIZE(hp); +# endif } #endif state4: /* XXX ??? - why isn't this before the "if" statement */ diff --git a/shell/hush.c b/shell/hush.c index e698e6c52..d3e957c2f 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -7614,6 +7614,10 @@ int hush_main(int argc, char **argv) //set_local_var(xasprintf("HISTFILE=%s", ...)); } } +# if ENABLE_FEATURE_SH_HISTFILESIZE + hp = get_local_var_value("HISTFILESIZE"); + G.line_input_state->max_history = size_from_HISTFILESIZE(hp); +# endif } # endif #endif -- cgit v1.2.3-55-g6feb From e3d8d077b7d2e51fed03dc20267eadbe38903b2a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 31 Mar 2011 14:39:38 +0200 Subject: small fix for HISTFILESIZE Signed-off-by: Denys Vlasenko --- libbb/lineedit.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 095ccfbef..0563e6d01 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -1412,6 +1412,7 @@ static void save_history(char *str) * load them */ st_temp = new_line_input_t(state->flags); st_temp->hist_file = state->hist_file; + st_temp->max_history = state->max_history; load_history(st_temp); /* write out temp file and replace hist_file atomically */ -- cgit v1.2.3-55-g6feb From 34425389e09353a8dacdd6b23a62553f699c544c Mon Sep 17 00:00:00 2001 From: Pere Orga Date: Thu, 31 Mar 2011 14:43:25 +0200 Subject: move help text from include/usage.src.h to coreutils/*.c Signed-off-by: Pere Orga Signed-off-by: Denys Vlasenko --- coreutils/basename.c | 13 + coreutils/cal.c | 9 + coreutils/cat.c | 9 + coreutils/catv.c | 9 + coreutils/chgrp.c | 23 + coreutils/chmod.c | 23 + coreutils/chown.c | 26 ++ coreutils/chroot.c | 13 + coreutils/cksum.c | 6 + coreutils/comm.c | 9 + coreutils/cp.c | 18 + coreutils/cut.c | 18 + coreutils/dd.c | 33 ++ coreutils/df.c | 35 ++ coreutils/dirname.c | 11 + coreutils/dos2unix.c | 18 + coreutils/du.c | 37 ++ coreutils/echo.c | 21 + coreutils/env.c | 9 + coreutils/expand.c | 31 ++ coreutils/expr.c | 35 ++ coreutils/false.c | 10 + coreutils/fold.c | 10 + coreutils/fsync.c | 8 + coreutils/head.c | 20 + coreutils/hostid.c | 5 + coreutils/id.c | 18 + coreutils/install.c | 18 + coreutils/ln.c | 16 + coreutils/logname.c | 9 + coreutils/md5_sha1_sum.c | 58 +++ coreutils/mkdir.c | 19 + coreutils/mkfifo.c | 10 + coreutils/mknod.c | 18 + coreutils/nice.c | 7 + coreutils/nohup.c | 8 + coreutils/od.c | 5 + coreutils/printenv.c | 6 + coreutils/printf.c | 10 + coreutils/pwd.c | 9 + coreutils/readlink.c | 12 + coreutils/realpath.c | 5 + coreutils/rm.c | 12 + coreutils/rmdir.c | 16 + coreutils/seq.c | 10 + coreutils/sleep.c | 15 + coreutils/sort.c | 48 +++ coreutils/split.c | 13 + coreutils/stat.c | 61 +++ coreutils/stty.c | 11 + coreutils/sum.c | 8 + coreutils/sync.c | 5 + coreutils/tac.c | 5 + coreutils/tail.c | 25 ++ coreutils/tee.c | 13 + coreutils/test.c | 23 + coreutils/tr.c | 13 + coreutils/true.c | 10 + coreutils/tty.c | 13 + coreutils/uname.c | 17 + coreutils/uniq.c | 18 + coreutils/usleep.c | 9 + coreutils/uudecode.c | 12 + coreutils/uuencode.c | 14 + coreutils/who.c | 7 + coreutils/whoami.c | 5 + include/usage.src.h | 1055 ---------------------------------------------- 67 files changed, 1070 insertions(+), 1055 deletions(-) diff --git a/coreutils/basename.c b/coreutils/basename.c index d44124741..177e023cd 100644 --- a/coreutils/basename.c +++ b/coreutils/basename.c @@ -28,6 +28,19 @@ //config: leaving just the filename itself. Enable this option if you wish //config: to enable the 'basename' utility. +//usage:#define basename_trivial_usage +//usage: "FILE [SUFFIX]" +//usage:#define basename_full_usage "\n\n" +//usage: "Strip directory path and .SUFFIX from FILE\n" +//usage: +//usage:#define basename_example_usage +//usage: "$ basename /usr/local/bin/foo\n" +//usage: "foo\n" +//usage: "$ basename /usr/local/bin/\n" +//usage: "bin\n" +//usage: "$ basename /foo/bar.txt .txt\n" +//usage: "bar" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/cal.c b/coreutils/cal.c index f18c16120..ef1c29bb9 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c @@ -16,6 +16,15 @@ * * Major size reduction... over 50% (>1.5k) on i386. */ + +//usage:#define cal_trivial_usage +//usage: "[-jy] [[MONTH] YEAR]" +//usage:#define cal_full_usage "\n\n" +//usage: "Display a calendar\n" +//usage: "\nOptions:" +//usage: "\n -j Use julian dates" +//usage: "\n -y Display the entire year" + #include "libbb.h" #include "unicode.h" diff --git a/coreutils/cat.c b/coreutils/cat.c index 922549828..00c38d486 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c @@ -22,6 +22,15 @@ //config: cat is used to concatenate files and print them to the standard //config: output. Enable this option if you wish to enable the 'cat' utility. +//usage:#define cat_trivial_usage +//usage: "[FILE]..." +//usage:#define cat_full_usage "\n\n" +//usage: "Concatenate FILEs and print them to stdout" +//usage: +//usage:#define cat_example_usage +//usage: "$ cat /proc/uptime\n" +//usage: "110716.72 17.67" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/catv.c b/coreutils/catv.c index f92d93d24..37c7ed2d1 100644 --- a/coreutils/catv.c +++ b/coreutils/catv.c @@ -10,6 +10,15 @@ /* See "Cat -v considered harmful" at * http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */ +//usage:#define catv_trivial_usage +//usage: "[-etv] [FILE]..." +//usage:#define catv_full_usage "\n\n" +//usage: "Display nonprinting characters as ^x or M-x\n" +//usage: "\nOptions:" +//usage: "\n -e End each line with $" +//usage: "\n -t Show tabs as ^I" +//usage: "\n -v Don't use ^x or M-x escapes" + #include "libbb.h" int catv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c index 58f78e736..bc9608362 100644 --- a/coreutils/chgrp.c +++ b/coreutils/chgrp.c @@ -11,6 +11,29 @@ /* BB_AUDIT GNU defects - unsupported long options. */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/chgrp.html */ +//usage:#define chgrp_trivial_usage +//usage: "[-RhLHP"IF_DESKTOP("cvf")"]... GROUP FILE..." +//usage:#define chgrp_full_usage "\n\n" +//usage: "Change the group membership of each FILE to GROUP\n" +//usage: "\nOptions:" +//usage: "\n -R Recurse" +//usage: "\n -h Affect symlinks instead of symlink targets" +//usage: "\n -L Traverse all symlinks to directories" +//usage: "\n -H Traverse symlinks on command line only" +//usage: "\n -P Don't traverse symlinks (default)" +//usage: IF_DESKTOP( +//usage: "\n -c List changed files" +//usage: "\n -v Verbose" +//usage: "\n -f Hide errors" +//usage: ) +//usage: +//usage:#define chgrp_example_usage +//usage: "$ ls -l /tmp/foo\n" +//usage: "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n" +//usage: "$ chgrp root /tmp/foo\n" +//usage: "$ ls -l /tmp/foo\n" +//usage: "-r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo\n" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/chmod.c b/coreutils/chmod.c index f07a49bd3..0bcd6bb66 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c @@ -14,6 +14,29 @@ /* BB_AUDIT GNU defects - unsupported long options. */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/chmod.html */ +//usage:#define chmod_trivial_usage +//usage: "[-R"IF_DESKTOP("cvf")"] MODE[,MODE]... FILE..." +//usage:#define chmod_full_usage "\n\n" +//usage: "Each MODE is one or more of the letters ugoa, one of the\n" +//usage: "symbols +-= and one or more of the letters rwxst\n" +//usage: "\nOptions:" +//usage: "\n -R Recurse" +//usage: IF_DESKTOP( +//usage: "\n -c List changed files" +//usage: "\n -v List all files" +//usage: "\n -f Hide errors" +//usage: ) +//usage: +//usage:#define chmod_example_usage +//usage: "$ ls -l /tmp/foo\n" +//usage: "-rw-rw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n" +//usage: "$ chmod u+x /tmp/foo\n" +//usage: "$ ls -l /tmp/foo\n" +//usage: "-rwxrw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo*\n" +//usage: "$ chmod 444 /tmp/foo\n" +//usage: "$ ls -l /tmp/foo\n" +//usage: "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/chown.c b/coreutils/chown.c index 282deccfb..c4c182d3c 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c @@ -10,6 +10,32 @@ /* BB_AUDIT SUSv3 defects - none? */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */ +//usage:#define chown_trivial_usage +//usage: "[-RhLHP"IF_DESKTOP("cvf")"]... OWNER[<.|:>[GROUP]] FILE..." +//usage:#define chown_full_usage "\n\n" +//usage: "Change the owner and/or group of each FILE to OWNER and/or GROUP\n" +//usage: "\nOptions:" +//usage: "\n -R Recurse" +//usage: "\n -h Affect symlinks instead of symlink targets" +//usage: "\n -L Traverse all symlinks to directories" +//usage: "\n -H Traverse symlinks on command line only" +//usage: "\n -P Don't traverse symlinks (default)" +//usage: IF_DESKTOP( +//usage: "\n -c List changed files" +//usage: "\n -v List all files" +//usage: "\n -f Hide errors" +//usage: ) +//usage: +//usage:#define chown_example_usage +//usage: "$ ls -l /tmp/foo\n" +//usage: "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n" +//usage: "$ chown root /tmp/foo\n" +//usage: "$ ls -l /tmp/foo\n" +//usage: "-r--r--r-- 1 root andersen 0 Apr 12 18:25 /tmp/foo\n" +//usage: "$ chown root.root /tmp/foo\n" +//usage: "ls -l /tmp/foo\n" +//usage: "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/chroot.c b/coreutils/chroot.c index 5ac2e890e..ab8beb023 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c @@ -9,6 +9,19 @@ /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ +//usage:#define chroot_trivial_usage +//usage: "NEWROOT [PROG ARGS]" +//usage:#define chroot_full_usage "\n\n" +//usage: "Run PROG with root directory set to NEWROOT" +//usage: +//usage:#define chroot_example_usage +//usage: "$ ls -l /bin/ls\n" +//usage: "lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /BusyBox\n" +//usage: "# mount /dev/hdc1 /mnt -t minix\n" +//usage: "# chroot /mnt\n" +//usage: "# ls -l /bin/ls\n" +//usage: "-rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls*\n" + #include "libbb.h" int chroot_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/coreutils/cksum.c b/coreutils/cksum.c index 53fb87a78..ac0b0c319 100644 --- a/coreutils/cksum.c +++ b/coreutils/cksum.c @@ -6,6 +6,12 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define cksum_trivial_usage +//usage: "FILES..." +//usage:#define cksum_full_usage "\n\n" +//usage: "Calculate the CRC32 checksums of FILES" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/comm.c b/coreutils/comm.c index c04da1896..7da6b25f9 100644 --- a/coreutils/comm.c +++ b/coreutils/comm.c @@ -7,6 +7,15 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define comm_trivial_usage +//usage: "[-123] FILE1 FILE2" +//usage:#define comm_full_usage "\n\n" +//usage: "Compare FILE1 with FILE2\n" +//usage: "\nOptions:" +//usage: "\n -1 Suppress lines unique to FILE1" +//usage: "\n -2 Suppress lines unique to FILE2" +//usage: "\n -3 Suppress lines common to both files" + #include "libbb.h" #define COMM_OPT_1 (1 << 0) diff --git a/coreutils/cp.c b/coreutils/cp.c index ab17b39a6..337054d7b 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c @@ -15,6 +15,24 @@ * Size reduction. */ +//usage:#define cp_trivial_usage +//usage: "[OPTIONS] SOURCE DEST" +//usage:#define cp_full_usage "\n\n" +//usage: "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY\n" +//usage: "\nOptions:" +//usage: "\n -a Same as -dpR" +//usage: IF_SELINUX( +//usage: "\n -c Preserve security context" +//usage: ) +//usage: "\n -R,-r Recurse" +//usage: "\n -d,-P Preserve symlinks (default if -R)" +//usage: "\n -L Follow all symlinks" +//usage: "\n -H Follow symlinks on command line" +//usage: "\n -p Preserve file attributes if possible" +//usage: "\n -f Overwrite" +//usage: "\n -i Prompt before overwrite" +//usage: "\n -l,-s Create (sym)links" + #include "libbb.h" #include "libcoreutils/coreutils.h" diff --git a/coreutils/cut.c b/coreutils/cut.c index 38cd32c77..dfa1833b4 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -9,6 +9,24 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define cut_trivial_usage +//usage: "[OPTIONS] [FILE]..." +//usage:#define cut_full_usage "\n\n" +//usage: "Print selected fields from each input FILE to stdout\n" +//usage: "\nOptions:" +//usage: "\n -b LIST Output only bytes from LIST" +//usage: "\n -c LIST Output only characters from LIST" +//usage: "\n -d CHAR Use CHAR instead of tab as the field delimiter" +//usage: "\n -s Output only the lines containing delimiter" +//usage: "\n -f N Print only these fields" +//usage: "\n -n Ignored" +//usage: +//usage:#define cut_example_usage +//usage: "$ echo \"Hello world\" | cut -f 1 -d ' '\n" +//usage: "Hello\n" +//usage: "$ echo \"Hello world\" | cut -f 2 -d ' '\n" +//usage: "world\n" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/dd.c b/coreutils/dd.c index 9973a145b..8a2eaed72 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -8,6 +8,39 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define dd_trivial_usage +//usage: "[if=FILE] [of=FILE] " IF_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n" +//usage: " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync]") +//usage:#define dd_full_usage "\n\n" +//usage: "Copy a file with converting and formatting\n" +//usage: "\nOptions:" +//usage: "\n if=FILE Read from FILE instead of stdin" +//usage: "\n of=FILE Write to FILE instead of stdout" +//usage: "\n bs=N Read and write N bytes at a time" +//usage: IF_FEATURE_DD_IBS_OBS( +//usage: "\n ibs=N Read N bytes at a time" +//usage: ) +//usage: IF_FEATURE_DD_IBS_OBS( +//usage: "\n obs=N Write N bytes at a time" +//usage: ) +//usage: "\n count=N Copy only N input blocks" +//usage: "\n skip=N Skip N input blocks" +//usage: "\n seek=N Skip N output blocks" +//usage: IF_FEATURE_DD_IBS_OBS( +//usage: "\n conv=notrunc Don't truncate output file" +//usage: "\n conv=noerror Continue after read errors" +//usage: "\n conv=sync Pad blocks with zeros" +//usage: "\n conv=fsync Physically write data out before finishing" +//usage: ) +//usage: "\n" +//usage: "\nNumbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024)," +//usage: "\nMD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)" +//usage: +//usage:#define dd_example_usage +//usage: "$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4\n" +//usage: "4+0 records in\n" +//usage: "4+0 records out\n" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/df.c b/coreutils/df.c index 70fd1f4fd..518e856a2 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -22,6 +22,41 @@ * Implement -P and -B; better coreutils compat; cleanup */ +//usage:#define df_trivial_usage +//usage: "[-Pk" +//usage: IF_FEATURE_HUMAN_READABLE("mh") +//usage: IF_FEATURE_DF_FANCY("ai] [-B SIZE") +//usage: "] [FILESYSTEM]..." +//usage:#define df_full_usage "\n\n" +//usage: "Print filesystem usage statistics\n" +//usage: "\nOptions:" +//usage: "\n -P POSIX output format" +//usage: "\n -k 1024-byte blocks (default)" +//usage: IF_FEATURE_HUMAN_READABLE( +//usage: "\n -m 1M-byte blocks" +//usage: "\n -h Human readable (e.g. 1K 243M 2G)" +//usage: ) +//usage: IF_FEATURE_DF_FANCY( +//usage: "\n -a Show all filesystems" +//usage: "\n -i Inodes" +//usage: "\n -B SIZE Blocksize" +//usage: ) +//usage: +//usage:#define df_example_usage +//usage: "$ df\n" +//usage: "Filesystem 1K-blocks Used Available Use% Mounted on\n" +//usage: "/dev/sda3 8690864 8553540 137324 98% /\n" +//usage: "/dev/sda1 64216 36364 27852 57% /boot\n" +//usage: "$ df /dev/sda3\n" +//usage: "Filesystem 1K-blocks Used Available Use% Mounted on\n" +//usage: "/dev/sda3 8690864 8553540 137324 98% /\n" +//usage: "$ POSIXLY_CORRECT=sure df /dev/sda3\n" +//usage: "Filesystem 512B-blocks Used Available Use% Mounted on\n" +//usage: "/dev/sda3 17381728 17107080 274648 98% /\n" +//usage: "$ POSIXLY_CORRECT=yep df -P /dev/sda3\n" +//usage: "Filesystem 512-blocks Used Available Capacity Mounted on\n" +//usage: "/dev/sda3 17381728 17107080 274648 98% /\n" + #include #include #include "libbb.h" diff --git a/coreutils/dirname.c b/coreutils/dirname.c index 246946ed0..101067c90 100644 --- a/coreutils/dirname.c +++ b/coreutils/dirname.c @@ -10,6 +10,17 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */ +//usage:#define dirname_trivial_usage +//usage: "FILENAME" +//usage:#define dirname_full_usage "\n\n" +//usage: "Strip non-directory suffix from FILENAME" +//usage: +//usage:#define dirname_example_usage +//usage: "$ dirname /tmp/foo\n" +//usage: "/tmp\n" +//usage: "$ dirname /tmp/foo/\n" +//usage: "/tmp\n" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index eab8110dc..df2376bea 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c @@ -12,6 +12,24 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define dos2unix_trivial_usage +//usage: "[-ud] [FILE]" +//usage:#define dos2unix_full_usage "\n\n" +//usage: "Convert FILE in-place from DOS to Unix format.\n" +//usage: "When no file is given, use stdin/stdout.\n" +//usage: "\nOptions:" +//usage: "\n -u dos2unix" +//usage: "\n -d unix2dos" +//usage: +//usage:#define unix2dos_trivial_usage +//usage: "[-ud] [FILE]" +//usage:#define unix2dos_full_usage "\n\n" +//usage: "Convert FILE in-place from Unix to DOS format.\n" +//usage: "When no file is given, use stdin/stdout.\n" +//usage: "\nOptions:" +//usage: "\n -u dos2unix" +//usage: "\n -d unix2dos" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/du.c b/coreutils/du.c index cc3c78433..7a6662d1e 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -23,6 +23,43 @@ * 4) Fixed busybox bug #1284 involving long overflow with human_readable. */ +//usage:#define du_trivial_usage +//usage: "[-aHLdclsx" IF_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..." +//usage:#define du_full_usage "\n\n" +//usage: "Summarize disk space used for each FILE and/or directory.\n" +//usage: "Disk space is printed in units of " +//usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("1024") +//usage: IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("512") +//usage: " bytes.\n" +//usage: "\nOptions:" +//usage: "\n -a Show file sizes too" +//usage: "\n -L Follow all symlinks" +//usage: "\n -H Follow symlinks on command line" +//usage: "\n -d N Limit output to directories (and files with -a) of depth < N" +//usage: "\n -c Show grand total" +//usage: "\n -l Count sizes many times if hard linked" +//usage: "\n -s Display only a total for each argument" +//usage: "\n -x Skip directories on different filesystems" +//usage: IF_FEATURE_HUMAN_READABLE( +//usage: "\n -h Sizes in human readable format (e.g., 1K 243M 2G )" +//usage: "\n -m Sizes in megabytes" +//usage: ) +//usage: "\n -k Sizes in kilobytes" +//usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(" (default)") +//usage: +//usage:#define du_example_usage +//usage: "$ du\n" +//usage: "16 ./CVS\n" +//usage: "12 ./kernel-patches/CVS\n" +//usage: "80 ./kernel-patches\n" +//usage: "12 ./tests/CVS\n" +//usage: "36 ./tests\n" +//usage: "12 ./scripts/CVS\n" +//usage: "16 ./scripts\n" +//usage: "12 ./docs/CVS\n" +//usage: "104 ./docs\n" +//usage: "2417 .\n" + #include "libbb.h" enum { diff --git a/coreutils/echo.c b/coreutils/echo.c index 72e18c161..0895e2940 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c @@ -23,6 +23,27 @@ * The previous version did not allow 4-digit octals. */ +//usage:#define echo_trivial_usage +//usage: IF_FEATURE_FANCY_ECHO("[-neE] ") "[ARG]..." +//usage:#define echo_full_usage "\n\n" +//usage: "Print the specified ARGs to stdout" +//usage: IF_FEATURE_FANCY_ECHO( "\n" +//usage: "\nOptions:" +//usage: "\n -n Suppress trailing newline" +//usage: "\n -e Interpret backslash escapes (i.e., \\t=tab)" +//usage: "\n -E Don't interpret backslash escapes (default)" +//usage: ) +//usage: +//usage:#define echo_example_usage +//usage: "$ echo \"Erik is cool\"\n" +//usage: "Erik is cool\n" +//usage: IF_FEATURE_FANCY_ECHO("$ echo -e \"Erik\\nis\\ncool\"\n" +//usage: "Erik\n" +//usage: "is\n" +//usage: "cool\n" +//usage: "$ echo \"Erik\\nis\\ncool\"\n" +//usage: "Erik\\nis\\ncool\n") + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/env.c b/coreutils/env.c index d64a71439..747c668da 100644 --- a/coreutils/env.c +++ b/coreutils/env.c @@ -31,6 +31,15 @@ /* This is a NOEXEC applet. Be very careful! */ +//usage:#define env_trivial_usage +//usage: "[-iu] [-] [name=value]... [PROG ARGS]" +//usage:#define env_full_usage "\n\n" +//usage: "Print the current environment or run PROG after setting up\n" +//usage: "the specified environment\n" +//usage: "\nOptions:" +//usage: "\n -, -i Start with an empty environment" +//usage: "\n -u Remove variable from the environment" + #include "libbb.h" #if ENABLE_FEATURE_ENV_LONG_OPTIONS diff --git a/coreutils/expand.c b/coreutils/expand.c index 7491b717a..73ab0ece3 100644 --- a/coreutils/expand.c +++ b/coreutils/expand.c @@ -20,6 +20,37 @@ * * Caveat: this versions of expand and unexpand don't accept tab lists. */ + +//usage:#define expand_trivial_usage +//usage: "[-i] [-t N] [FILE]..." +//usage:#define expand_full_usage "\n\n" +//usage: "Convert tabs to spaces, writing to stdout\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_EXPAND_LONG_OPTIONS( +//usage: "\n -i,--initial Don't convert tabs after non blanks" +//usage: "\n -t,--tabs=N Tabstops every N chars" +//usage: ) +//usage: IF_NOT_FEATURE_EXPAND_LONG_OPTIONS( +//usage: "\n -i Don't convert tabs after non blanks" +//usage: "\n -t Tabstops every N chars" +//usage: ) + +//usage:#define unexpand_trivial_usage +//usage: "[-fa][-t N] [FILE]..." +//usage:#define unexpand_full_usage "\n\n" +//usage: "Convert spaces to tabs, writing to stdout\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_UNEXPAND_LONG_OPTIONS( +//usage: "\n -a,--all Convert all blanks" +//usage: "\n -f,--first-only Convert only leading blanks" +//usage: "\n -t,--tabs=N Tabstops every N chars" +//usage: ) +//usage: IF_NOT_FEATURE_UNEXPAND_LONG_OPTIONS( +//usage: "\n -a Convert all blanks" +//usage: "\n -f Convert only leading blanks" +//usage: "\n -t N Tabstops every N chars" +//usage: ) + #include "libbb.h" #include "unicode.h" diff --git a/coreutils/expr.c b/coreutils/expr.c index 04d783f2b..24e75b556 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c @@ -25,6 +25,41 @@ /* no getopt needed */ +//usage:#define expr_trivial_usage +//usage: "EXPRESSION" +//usage:#define expr_full_usage "\n\n" +//usage: "Print the value of EXPRESSION to stdout\n" +//usage: "\n" +//usage: "EXPRESSION may be:\n" +//usage: " ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n" +//usage: " ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n" +//usage: " ARG1 < ARG2 1 if ARG1 is less than ARG2, else 0. Similarly:\n" +//usage: " ARG1 <= ARG2\n" +//usage: " ARG1 = ARG2\n" +//usage: " ARG1 != ARG2\n" +//usage: " ARG1 >= ARG2\n" +//usage: " ARG1 > ARG2\n" +//usage: " ARG1 + ARG2 Sum of ARG1 and ARG2. Similarly:\n" +//usage: " ARG1 - ARG2\n" +//usage: " ARG1 * ARG2\n" +//usage: " ARG1 / ARG2\n" +//usage: " ARG1 % ARG2\n" +//usage: " STRING : REGEXP Anchored pattern match of REGEXP in STRING\n" +//usage: " match STRING REGEXP Same as STRING : REGEXP\n" +//usage: " substr STRING POS LENGTH Substring of STRING, POS counted from 1\n" +//usage: " index STRING CHARS Index in STRING where any CHARS is found, or 0\n" +//usage: " length STRING Length of STRING\n" +//usage: " quote TOKEN Interpret TOKEN as a string, even if\n" +//usage: " it is a keyword like 'match' or an\n" +//usage: " operator like '/'\n" +//usage: " (EXPRESSION) Value of EXPRESSION\n" +//usage: "\n" +//usage: "Beware that many operators need to be escaped or quoted for shells.\n" +//usage: "Comparisons are arithmetic if both ARGs are numbers, else\n" +//usage: "lexicographical. Pattern matches return the string matched between\n" +//usage: "\\( and \\) or null; if \\( and \\) are not used, they return the number\n" +//usage: "of characters matched or 0." + #include "libbb.h" #include "xregex.h" diff --git a/coreutils/false.c b/coreutils/false.c index 033d2bff4..59c2f321a 100644 --- a/coreutils/false.c +++ b/coreutils/false.c @@ -10,6 +10,16 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/000095399/utilities/false.html */ +//usage:#define false_trivial_usage +//usage: "" +//usage:#define false_full_usage "\n\n" +//usage: "Return an exit code of FALSE (1)" +//usage: +//usage:#define false_example_usage +//usage: "$ false\n" +//usage: "$ echo $?\n" +//usage: "1\n" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/fold.c b/coreutils/fold.c index 4a6429ad7..3fe668512 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c @@ -9,6 +9,16 @@ Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define fold_trivial_usage +//usage: "[-bs] [-w WIDTH] [FILE]..." +//usage:#define fold_full_usage "\n\n" +//usage: "Wrap input lines in each FILE (or stdin), writing to stdout\n" +//usage: "\nOptions:" +//usage: "\n -b Count bytes rather than columns" +//usage: "\n -s Break at spaces" +//usage: "\n -w Use WIDTH columns instead of 80" + #include "libbb.h" #include "unicode.h" diff --git a/coreutils/fsync.c b/coreutils/fsync.c index b8b463cd1..518c5642b 100644 --- a/coreutils/fsync.c +++ b/coreutils/fsync.c @@ -6,6 +6,14 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define fsync_trivial_usage +//usage: "[-d] FILE..." +//usage:#define fsync_full_usage "\n\n" +//usage: "Write files' buffered blocks to disk\n" +//usage: "\nOptions:" +//usage: "\n -d Avoid syncing metadata" + #include "libbb.h" #ifndef O_NOATIME # define O_NOATIME 0 diff --git a/coreutils/head.c b/coreutils/head.c index 669aae819..f49320ef4 100644 --- a/coreutils/head.c +++ b/coreutils/head.c @@ -11,6 +11,26 @@ /* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */ +//usage:#define head_trivial_usage +//usage: "[OPTIONS] [FILE]..." +//usage:#define head_full_usage "\n\n" +//usage: "Print first 10 lines of each FILE (or stdin) to stdout.\n" +//usage: "With more than one FILE, precede each with a filename header.\n" +//usage: "\nOptions:" +//usage: "\n -n N[kbm] Print first N lines" +//usage: IF_FEATURE_FANCY_HEAD( +//usage: "\n -c N[kbm] Print first N bytes" +//usage: "\n -q Never print headers" +//usage: "\n -v Always print headers" +//usage: ) +//usage: "\n" +//usage: "\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)." +//usage: +//usage:#define head_example_usage +//usage: "$ head -n 2 /etc/passwd\n" +//usage: "root:x:0:0:root:/root:/bin/bash\n" +//usage: "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/hostid.c b/coreutils/hostid.c index 635e48e12..49409b9de 100644 --- a/coreutils/hostid.c +++ b/coreutils/hostid.c @@ -9,6 +9,11 @@ /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ +//usage:#define hostid_trivial_usage +//usage: "" +//usage:#define hostid_full_usage "\n\n" +//usage: "Print out a unique 32-bit identifier for the machine" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/id.c b/coreutils/id.c index 0639325c3..42ed4c749 100644 --- a/coreutils/id.c +++ b/coreutils/id.c @@ -15,6 +15,24 @@ * Added -G option Tito Ragusa (C) 2008 for SUSv3. */ +//usage:#define id_trivial_usage +//usage: "[OPTIONS] [USER]" +//usage:#define id_full_usage "\n\n" +//usage: "Print information about USER or the current user\n" +//usage: "\nOptions:" +//usage: IF_SELINUX( +//usage: "\n -Z Security context" +//usage: ) +//usage: "\n -u User ID" +//usage: "\n -g Group ID" +//usage: "\n -G Supplementary group IDs" +//usage: "\n -n Print names instead of numbers" +//usage: "\n -r Print real ID instead of effective ID" +//usage: +//usage:#define id_example_usage +//usage: "$ id\n" +//usage: "uid=1000(andersen) gid=1000(andersen)\n" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/install.c b/coreutils/install.c index 9dc90d641..fe5f26e79 100644 --- a/coreutils/install.c +++ b/coreutils/install.c @@ -6,6 +6,24 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +/* -v, -b, -c are ignored */ +//usage:#define install_trivial_usage +//usage: "[-cdDsp] [-o USER] [-g GRP] [-m MODE] [SOURCE]... DEST" +//usage:#define install_full_usage "\n\n" +//usage: "Copy files and set attributes\n" +//usage: "\nOptions:" +//usage: "\n -c Just copy (default)" +//usage: "\n -d Create directories" +//usage: "\n -D Create leading target directories" +//usage: "\n -s Strip symbol table" +//usage: "\n -p Preserve date" +//usage: "\n -o USER Set ownership" +//usage: "\n -g GRP Set group ownership" +//usage: "\n -m MODE Set permissions" +//usage: IF_SELINUX( +//usage: "\n -Z Set security context" +//usage: ) + #include "libbb.h" #include "libcoreutils/coreutils.h" diff --git a/coreutils/ln.c b/coreutils/ln.c index 6da290c11..2da915a68 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c @@ -11,6 +11,22 @@ /* BB_AUDIT GNU options missing: -d, -F, -i, and -v. */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/ln.html */ +//usage:#define ln_trivial_usage +//usage: "[OPTIONS] TARGET... LINK|DIR" +//usage:#define ln_full_usage "\n\n" +//usage: "Create a link LINK or DIR/TARGET to the specified TARGET(s)\n" +//usage: "\nOptions:" +//usage: "\n -s Make symlinks instead of hardlinks" +//usage: "\n -f Remove existing destinations" +//usage: "\n -n Don't dereference symlinks - treat like normal file" +//usage: "\n -b Make a backup of the target (if exists) before link operation" +//usage: "\n -S suf Use suffix instead of ~ when making backup files" +//usage: +//usage:#define ln_example_usage +//usage: "$ ln -s BusyBox /tmp/ls\n" +//usage: "$ ls -l /tmp/ls\n" +//usage: "lrwxrwxrwx 1 root root 7 Apr 12 18:39 ls -> BusyBox*\n" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/logname.c b/coreutils/logname.c index 62f453f2f..10b9615a1 100644 --- a/coreutils/logname.c +++ b/coreutils/logname.c @@ -20,6 +20,15 @@ * a diagnostic message and an error return. */ +//usage:#define logname_trivial_usage +//usage: "" +//usage:#define logname_full_usage "\n\n" +//usage: "Print the name of the current user" +//usage: +//usage:#define logname_example_usage +//usage: "$ logname\n" +//usage: "root\n" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 3b897c18f..09f3a0080 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c @@ -6,6 +6,64 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define md5sum_trivial_usage +//usage: "[FILE]..." +//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: md5sum -c [-sw] [FILE]") +//usage:#define md5sum_full_usage "\n\n" +//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " MD5 checksums" +//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" +//usage: "\nOptions:" +//usage: "\n -c Check sums against given list" +//usage: "\n -s Don't output anything, status code shows success" +//usage: "\n -w Warn about improperly formatted checksum lines" +//usage: ) +//usage: +//usage:#define md5sum_example_usage +//usage: "$ md5sum < busybox\n" +//usage: "6fd11e98b98a58f64ff3398d7b324003\n" +//usage: "$ md5sum busybox\n" +//usage: "6fd11e98b98a58f64ff3398d7b324003 busybox\n" +//usage: "$ md5sum -c -\n" +//usage: "6fd11e98b98a58f64ff3398d7b324003 busybox\n" +//usage: "busybox: OK\n" +//usage: "^D\n" +//usage: +//usage:#define sha1sum_trivial_usage +//usage: "[FILE]..." +//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha1sum -c [-sw] [FILE]") +//usage:#define sha1sum_full_usage "\n\n" +//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums" +//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" +//usage: "\nOptions:" +//usage: "\n -c Check sums against given list" +//usage: "\n -s Don't output anything, status code shows success" +//usage: "\n -w Warn about improperly formatted checksum lines" +//usage: ) +//usage: +//usage:#define sha256sum_trivial_usage +//usage: "[FILE]..." +//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha256sum -c [-sw] [FILE]") +//usage:#define sha256sum_full_usage "\n\n" +//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA256 checksums" +//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" +//usage: "\nOptions:" +//usage: "\n -c Check sums against given list" +//usage: "\n -s Don't output anything, status code shows success" +//usage: "\n -w Warn about improperly formatted checksum lines" +//usage: ) +//usage: +//usage:#define sha512sum_trivial_usage +//usage: "[FILE]..." +//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha512sum -c [-sw] [FILE]") +//usage:#define sha512sum_full_usage "\n\n" +//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA512 checksums" +//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" +//usage: "\nOptions:" +//usage: "\n -c Check sums against given list" +//usage: "\n -s Don't output anything, status code shows success" +//usage: "\n -w Warn about improperly formatted checksum lines" +//usage: ) + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 0de0d5c3b..e425bbe5e 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c @@ -19,6 +19,25 @@ /* Nov 28, 2006 Yoshinori Sato : Add SELinux Support. */ +//usage:#define mkdir_trivial_usage +//usage: "[OPTIONS] DIRECTORY..." +//usage:#define mkdir_full_usage "\n\n" +//usage: "Create DIRECTORY\n" +//usage: "\nOptions:" +//usage: "\n -m MODE Mode" +//usage: "\n -p No error if exists; make parent directories as needed" +//usage: IF_SELINUX( +//usage: "\n -Z Set security context" +//usage: ) +//usage: +//usage:#define mkdir_example_usage +//usage: "$ mkdir /tmp/foo\n" +//usage: "$ mkdir /tmp/foo\n" +//usage: "/tmp/foo: File exists\n" +//usage: "$ mkdir /tmp/foo/bar/baz\n" +//usage: "/tmp/foo/bar/baz: No such file or directory\n" +//usage: "$ mkdir -p /tmp/foo/bar/baz\n" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c index d908ce45e..84d8d99dd 100644 --- a/coreutils/mkfifo.c +++ b/coreutils/mkfifo.c @@ -10,6 +10,16 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/mkfifo.html */ +//usage:#define mkfifo_trivial_usage +//usage: "[-m MODE] " IF_SELINUX("[-Z] ") "NAME" +//usage:#define mkfifo_full_usage "\n\n" +//usage: "Create named pipe\n" +//usage: "\nOptions:" +//usage: "\n -m MODE Mode (default a=rw)" +//usage: IF_SELINUX( +//usage: "\n -Z Set security context" +//usage: ) + #include "libbb.h" #include "libcoreutils/coreutils.h" diff --git a/coreutils/mknod.c b/coreutils/mknod.c index 14d91b5df..50dbd62e3 100644 --- a/coreutils/mknod.c +++ b/coreutils/mknod.c @@ -9,6 +9,24 @@ /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ +//usage:#define mknod_trivial_usage +//usage: "[-m MODE] " IF_SELINUX("[-Z] ") "NAME TYPE MAJOR MINOR" +//usage:#define mknod_full_usage "\n\n" +//usage: "Create a special file (block, character, or pipe)\n" +//usage: "\nOptions:" +//usage: "\n -m MODE Creation mode (default a=rw)" +//usage: IF_SELINUX( +//usage: "\n -Z Set security context" +//usage: ) +//usage: "\nTYPE:" +//usage: "\n b Block device" +//usage: "\n c or u Character device" +//usage: "\n p Named pipe (MAJOR and MINOR are ignored)" +//usage: +//usage:#define mknod_example_usage +//usage: "$ mknod /dev/fd0 b 2 0\n" +//usage: "$ mknod -m 644 /tmp/pipe p\n" + #include // For makedev #include "libbb.h" diff --git a/coreutils/nice.c b/coreutils/nice.c index 35d6bf3d9..2763986e7 100644 --- a/coreutils/nice.c +++ b/coreutils/nice.c @@ -7,6 +7,13 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define nice_trivial_usage +//usage: "[-n ADJUST] [PROG ARGS]" +//usage:#define nice_full_usage "\n\n" +//usage: "Change scheduling priority, run PROG\n" +//usage: "\nOptions:" +//usage: "\n -n ADJUST Adjust priority by ADJUST" + #include #include "libbb.h" diff --git a/coreutils/nohup.c b/coreutils/nohup.c index c21aae9f5..63853fd55 100644 --- a/coreutils/nohup.c +++ b/coreutils/nohup.c @@ -10,6 +10,14 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define nohup_trivial_usage +//usage: "PROG ARGS" +//usage:#define nohup_full_usage "\n\n" +//usage: "Run PROG immune to hangups, with output to a non-tty" +//usage: +//usage:#define nohup_example_usage +//usage: "$ nohup make &" + #include "libbb.h" /* Compat info: nohup (GNU coreutils 6.8) does this: diff --git a/coreutils/od.c b/coreutils/od.c index e62711671..31ebde210 100644 --- a/coreutils/od.c +++ b/coreutils/od.c @@ -11,6 +11,11 @@ * Original copyright notice is retained at the end of this file. */ +//usage:#define od_trivial_usage +//usage: "[-aBbcDdeFfHhIiLlOovXx] " IF_DESKTOP("[-t TYPE] ") "[FILE]" +//usage:#define od_full_usage "\n\n" +//usage: "Write an unambiguous representation, octal bytes by default, of FILE\n" +//usage: "(or stdin) to stdout" #include "libbb.h" #if ENABLE_DESKTOP diff --git a/coreutils/printenv.c b/coreutils/printenv.c index d0fb71636..bd5db7073 100644 --- a/coreutils/printenv.c +++ b/coreutils/printenv.c @@ -8,6 +8,12 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define printenv_trivial_usage +//usage: "[VARIABLE]..." +//usage:#define printenv_full_usage "\n\n" +//usage: "Print environment VARIABLEs.\n" +//usage: "If no VARIABLE specified, print all." + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/printf.c b/coreutils/printf.c index c8395fa89..f53aa4787 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c @@ -38,6 +38,16 @@ // 19990508 Busy Boxed! Dave Cinege +//usage:#define printf_trivial_usage +//usage: "FORMAT [ARGUMENT]..." +//usage:#define printf_full_usage "\n\n" +//usage: "Format and print ARGUMENT(s) according to FORMAT,\n" +//usage: "where FORMAT controls the output exactly as in C printf" +//usage: +//usage:#define printf_example_usage +//usage: "$ printf \"Val=%d\\n\" 5\n" +//usage: "Val=5\n" + #include "libbb.h" /* A note on bad input: neither bash 3.2 nor coreutils 6.10 stop on it. diff --git a/coreutils/pwd.c b/coreutils/pwd.c index 2949c55c2..739b835b5 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c @@ -7,6 +7,15 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define pwd_trivial_usage +//usage: "" +//usage:#define pwd_full_usage "\n\n" +//usage: "Print the full filename of the current working directory" +//usage: +//usage:#define pwd_example_usage +//usage: "$ pwd\n" +//usage: "/root\n" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/readlink.c b/coreutils/readlink.c index 87602fbc6..1a0eca646 100644 --- a/coreutils/readlink.c +++ b/coreutils/readlink.c @@ -6,6 +6,18 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define readlink_trivial_usage +//usage: IF_FEATURE_READLINK_FOLLOW("[-fnv] ") "FILE" +//usage:#define readlink_full_usage "\n\n" +//usage: "Display the value of a symlink" +//usage: IF_FEATURE_READLINK_FOLLOW( "\n" +//usage: "\nOptions:" +//usage: "\n -f Canonicalize by following all symlinks" +//usage: "\n -n Don't add newline" +//usage: "\n -v Verbose" +//usage: ) + #include "libbb.h" /* diff --git a/coreutils/realpath.c b/coreutils/realpath.c index 5933062b8..c513b5549 100644 --- a/coreutils/realpath.c +++ b/coreutils/realpath.c @@ -10,6 +10,11 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define realpath_trivial_usage +//usage: "FILE..." +//usage:#define realpath_full_usage "\n\n" +//usage: "Return the absolute pathnames of given FILE" + #include "libbb.h" int realpath_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/coreutils/rm.c b/coreutils/rm.c index 69c473ddb..8efd895cc 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c @@ -15,6 +15,18 @@ * Size reduction. */ +//usage:#define rm_trivial_usage +//usage: "[-irf] FILE..." +//usage:#define rm_full_usage "\n\n" +//usage: "Remove (unlink) FILEs\n" +//usage: "\nOptions:" +//usage: "\n -i Always prompt before removing" +//usage: "\n -f Never prompt" +//usage: "\n -R,-r Recurse" +//usage: +//usage:#define rm_example_usage +//usage: "$ rm -rf /tmp/foo\n" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index 231793ce0..0dbd940a1 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c @@ -10,6 +10,22 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/rmdir.html */ +//usage:#define rmdir_trivial_usage +//usage: "[OPTIONS] DIRECTORY..." +//usage:#define rmdir_full_usage "\n\n" +//usage: "Remove DIRECTORY if it is empty\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_RMDIR_LONG_OPTIONS( +//usage: "\n -p|--parents Include parents" +//usage: "\n --ignore-fail-on-non-empty" +//usage: ) +//usage: IF_NOT_FEATURE_RMDIR_LONG_OPTIONS( +//usage: "\n -p Include parents" +//usage: ) +//usage: +//usage:#define rmdir_example_usage +//usage: "# rmdir /tmp/foo\n" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/seq.c b/coreutils/seq.c index 22bf3ec9d..b600266fd 100644 --- a/coreutils/seq.c +++ b/coreutils/seq.c @@ -6,6 +6,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define seq_trivial_usage +//usage: "[-w] [-s SEP] [FIRST [INC]] LAST" +//usage:#define seq_full_usage "\n\n" +//usage: "Print numbers from FIRST to LAST, in steps of INC.\n" +//usage: "FIRST, INC default to 1.\n" +//usage: "\nOptions:" +//usage: "\n -w Pad to last with leading zeros" +//usage: "\n -s SEP String separator" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 433f9d6ee..0ffbd16eb 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c @@ -18,6 +18,21 @@ * time suffixes for seconds, minutes, hours, and days. */ +//usage:#define sleep_trivial_usage +//usage: IF_FEATURE_FANCY_SLEEP("[") "N" IF_FEATURE_FANCY_SLEEP("]...") +//usage:#define sleep_full_usage "\n\n" +//usage: IF_NOT_FEATURE_FANCY_SLEEP("Pause for N seconds") +//usage: IF_FEATURE_FANCY_SLEEP( +//usage: "Pause for a time equal to the total of the args given, where each arg can\n" +//usage: "have an optional suffix of (s)econds, (m)inutes, (h)ours, or (d)ays") +//usage: +//usage:#define sleep_example_usage +//usage: "$ sleep 2\n" +//usage: "[2 second delay results]\n" +//usage: IF_FEATURE_FANCY_SLEEP( +//usage: "$ sleep 1d 3h 22m 8s\n" +//usage: "[98528 second delay results]\n") + #include "libbb.h" /* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells */ diff --git a/coreutils/sort.c b/coreutils/sort.c index 3562464d1..f709ea1b3 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -12,6 +12,54 @@ * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html */ +//usage:#define sort_trivial_usage +//usage: "[-nru" +//usage: IF_FEATURE_SORT_BIG("gMcszbdfimSTokt] [-o FILE] [-k start[.offset][opts][,end[.offset][opts]] [-t CHAR") +//usage: "] [FILE]..." +//usage:#define sort_full_usage "\n\n" +//usage: "Sort lines of text\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_SORT_BIG( +//usage: "\n -b Ignore leading blanks" +//usage: "\n -c Check whether input is sorted" +//usage: "\n -d Dictionary order (blank or alphanumeric only)" +//usage: "\n -f Ignore case" +//usage: "\n -g General numerical sort" +//usage: "\n -i Ignore unprintable characters" +//usage: "\n -k Sort key" +//usage: "\n -M Sort month" +//usage: ) +//usage: "\n -n Sort numbers" +//usage: IF_FEATURE_SORT_BIG( +//usage: "\n -o Output to file" +//usage: "\n -k Sort by key" +//usage: "\n -t CHAR Key separator" +//usage: ) +//usage: "\n -r Reverse sort order" +//usage: IF_FEATURE_SORT_BIG( +//usage: "\n -s Stable (don't sort ties alphabetically)" +//usage: ) +//usage: "\n -u Suppress duplicate lines" +//usage: IF_FEATURE_SORT_BIG( +//usage: "\n -z Lines are terminated by NUL, not newline" +//usage: "\n -mST Ignored for GNU compatibility") +//usage: +//usage:#define sort_example_usage +//usage: "$ echo -e \"e\\nf\\nb\\nd\\nc\\na\" | sort\n" +//usage: "a\n" +//usage: "b\n" +//usage: "c\n" +//usage: "d\n" +//usage: "e\n" +//usage: "f\n" +//usage: IF_FEATURE_SORT_BIG( +//usage: "$ echo -e \"c 3\\nb 2\\nd 2\" | $SORT -k 2,2n -k 1,1r\n" +//usage: "d 2\n" +//usage: "b 2\n" +//usage: "c 3\n" +//usage: ) +//usage: "" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/split.c b/coreutils/split.c index 79316ed74..f0077077e 100644 --- a/coreutils/split.c +++ b/coreutils/split.c @@ -9,6 +9,19 @@ * SUSv3 requirements: * http://www.opengroup.org/onlinepubs/009695399/utilities/split.html */ + +//usage:#define split_trivial_usage +//usage: "[OPTIONS] [INPUT [PREFIX]]" +//usage:#define split_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -b N[k|m] Split by N (kilo|mega)bytes" +//usage: "\n -l N Split by N lines" +//usage: "\n -a N Use N letters as suffix" +//usage: +//usage:#define split_example_usage +//usage: "$ split TODO foo\n" +//usage: "$ cat TODO | split -a 2 -l 2 TODO_\n" + #include "libbb.h" static const struct suffix_mult split_suffices[] = { diff --git a/coreutils/stat.c b/coreutils/stat.c index 7351f5956..e85e51033 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c @@ -12,6 +12,67 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define stat_trivial_usage +//usage: "[OPTIONS] FILE..." +//usage:#define stat_full_usage "\n\n" +//usage: "Display file (default) or filesystem status\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_STAT_FORMAT( +//usage: "\n -c fmt Use the specified format" +//usage: ) +//usage: "\n -f Display filesystem status" +//usage: "\n -L Follow links" +//usage: "\n -t Display info in terse form" +//usage: IF_SELINUX( +//usage: "\n -Z Print security context" +//usage: ) +//usage: IF_FEATURE_STAT_FORMAT( +//usage: "\n\nValid format sequences for files:\n" +//usage: " %a Access rights in octal\n" +//usage: " %A Access rights in human readable form\n" +//usage: " %b Number of blocks allocated (see %B)\n" +//usage: " %B The size in bytes of each block reported by %b\n" +//usage: " %d Device number in decimal\n" +//usage: " %D Device number in hex\n" +//usage: " %f Raw mode in hex\n" +//usage: " %F File type\n" +//usage: " %g Group ID of owner\n" +//usage: " %G Group name of owner\n" +//usage: " %h Number of hard links\n" +//usage: " %i Inode number\n" +//usage: " %n File name\n" +//usage: " %N File name, with -> TARGET if symlink\n" +//usage: " %o I/O block size\n" +//usage: " %s Total size, in bytes\n" +//usage: " %t Major device type in hex\n" +//usage: " %T Minor device type in hex\n" +//usage: " %u User ID of owner\n" +//usage: " %U User name of owner\n" +//usage: " %x Time of last access\n" +//usage: " %X Time of last access as seconds since Epoch\n" +//usage: " %y Time of last modification\n" +//usage: " %Y Time of last modification as seconds since Epoch\n" +//usage: " %z Time of last change\n" +//usage: " %Z Time of last change as seconds since Epoch\n" +//usage: "\nValid format sequences for file systems:\n" +//usage: " %a Free blocks available to non-superuser\n" +//usage: " %b Total data blocks in file system\n" +//usage: " %c Total file nodes in file system\n" +//usage: " %d Free file nodes in file system\n" +//usage: " %f Free blocks in file system\n" +//usage: IF_SELINUX( +//usage: " %C Security context in selinux\n" +//usage: ) +//usage: " %i File System ID in hex\n" +//usage: " %l Maximum length of filenames\n" +//usage: " %n File name\n" +//usage: " %s Block size (for faster transfer)\n" +//usage: " %S Fundamental block size (for block counts)\n" +//usage: " %t Type in hex\n" +//usage: " %T Type in human readable form" +//usage: ) + #include "libbb.h" #define OPT_FILESYS (1 << 0) diff --git a/coreutils/stty.c b/coreutils/stty.c index d8184a34f..af2347161 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c @@ -21,6 +21,17 @@ */ +//usage:#define stty_trivial_usage +//usage: "[-a|g] [-F DEVICE] [SETTING]..." +//usage:#define stty_full_usage "\n\n" +//usage: "Without arguments, prints baud rate, line discipline,\n" +//usage: "and deviations from stty sane\n" +//usage: "\nOptions:" +//usage: "\n -F DEVICE Open device instead of stdin" +//usage: "\n -a Print all current settings in human-readable form" +//usage: "\n -g Print in stty-readable form" +//usage: "\n [SETTING] See manpage" + #include "libbb.h" #ifndef _POSIX_VDISABLE diff --git a/coreutils/sum.c b/coreutils/sum.c index e087fb85b..9e6b0c5b1 100644 --- a/coreutils/sum.c +++ b/coreutils/sum.c @@ -13,6 +13,14 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define sum_trivial_usage +//usage: "[-rs] [FILE]..." +//usage:#define sum_full_usage "\n\n" +//usage: "Checksum and count the blocks in a file\n" +//usage: "\nOptions:" +//usage: "\n -r Use BSD sum algorithm (1K blocks)" +//usage: "\n -s Use System V sum algorithm (512byte blocks)" + #include "libbb.h" enum { SUM_BSD, PRINT_NAME, SUM_SYSV }; diff --git a/coreutils/sync.c b/coreutils/sync.c index bb112ea38..7d98a1e30 100644 --- a/coreutils/sync.c +++ b/coreutils/sync.c @@ -9,6 +9,11 @@ /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ +//usage:#define sync_trivial_usage +//usage: "" +//usage:#define sync_full_usage "\n\n" +//usage: "Write all buffered blocks to disk" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/tac.c b/coreutils/tac.c index ab3e66ac2..94d669de1 100644 --- a/coreutils/tac.c +++ b/coreutils/tac.c @@ -16,6 +16,11 @@ * http://www.uclibc.org/lists/busybox/2003-July/008813.html */ +//usage:#define tac_trivial_usage +//usage: "[FILE]..." +//usage:#define tac_full_usage "\n\n" +//usage: "Concatenate FILEs and print them in reverse" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ diff --git a/coreutils/tail.c b/coreutils/tail.c index df881a37a..eac982735 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -24,6 +24,31 @@ * 7) lseek attempted when count==0 even if arg was +0 (from top) */ +//usage:#define tail_trivial_usage +//usage: "[OPTIONS] [FILE]..." +//usage:#define tail_full_usage "\n\n" +//usage: "Print last 10 lines of each FILE (or stdin) to stdout.\n" +//usage: "With more than one FILE, precede each with a filename header.\n" +//usage: "\nOptions:" +//usage: "\n -f Print data as file grows" +//usage: IF_FEATURE_FANCY_TAIL( +//usage: "\n -s SECONDS Wait SECONDS between reads with -f" +//usage: ) +//usage: "\n -n N[kbm] Print last N lines" +//usage: IF_FEATURE_FANCY_TAIL( +//usage: "\n -c N[kbm] Print last N bytes" +//usage: "\n -q Never print headers" +//usage: "\n -v Always print headers" +//usage: "\n" +//usage: "\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)." +//usage: "\nIf N starts with a '+', output begins with the Nth item from the start" +//usage: "\nof each file, not from the end." +//usage: ) +//usage: +//usage:#define tail_example_usage +//usage: "$ tail -n 1 /etc/resolv.conf\n" +//usage: "nameserver 10.0.0.1\n" + #include "libbb.h" static const struct suffix_mult tail_suffixes[] = { diff --git a/coreutils/tee.c b/coreutils/tee.c index e66e885ec..3e3164e70 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c @@ -10,6 +10,19 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/tee.html */ +//usage:#define tee_trivial_usage +//usage: "[-ai] [FILE]..." +//usage:#define tee_full_usage "\n\n" +//usage: "Copy stdin to each FILE, and also to stdout\n" +//usage: "\nOptions:" +//usage: "\n -a Append to the given FILEs, don't overwrite" +//usage: "\n -i Ignore interrupt signals (SIGINT)" +//usage: +//usage:#define tee_example_usage +//usage: "$ echo \"Hello\" | tee /tmp/foo\n" +//usage: "$ cat /tmp/foo\n" +//usage: "Hello\n" + #include "libbb.h" int tee_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/coreutils/test.c b/coreutils/test.c index 2d245be6c..1f5398ad8 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -39,6 +39,29 @@ //config: help //config: Enable 64-bit support in test. +/* "test --help" does not print help (POSIX compat), only "[ --help" does. + * We display " EXPRESSION ]" here (not " EXPRESSION") + * Unfortunately, it screws up generated BusyBox.html. TODO. */ +//usage:#define test_trivial_usage +//usage: "EXPRESSION ]" +//usage:#define test_full_usage "\n\n" +//usage: "Check file types, compare values etc. Return a 0/1 exit code\n" +//usage: "depending on logical value of EXPRESSION" +//usage: +//usage:#define test_example_usage +//usage: "$ test 1 -eq 2\n" +//usage: "$ echo $?\n" +//usage: "1\n" +//usage: "$ test 1 -eq 1\n" +//usage: "$ echo $?\n" +//usage: "0\n" +//usage: "$ [ -d /etc ]\n" +//usage: "$ echo $?\n" +//usage: "0\n" +//usage: "$ [ -d /junk ]\n" +//usage: "$ echo $?\n" +//usage: "1\n" + #include "libbb.h" #include diff --git a/coreutils/tr.c b/coreutils/tr.c index 5b2b9a9a4..2f14a414f 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c @@ -47,6 +47,19 @@ //config: useful for cases when no other way of expressing a character //config: is possible. +//usage:#define tr_trivial_usage +//usage: "[-cds] STRING1 [STRING2]" +//usage:#define tr_full_usage "\n\n" +//usage: "Translate, squeeze, or delete characters from stdin, writing to stdout\n" +//usage: "\nOptions:" +//usage: "\n -c Take complement of STRING1" +//usage: "\n -d Delete input characters coded STRING1" +//usage: "\n -s Squeeze multiple output characters of STRING2 into one character" +//usage: +//usage:#define tr_example_usage +//usage: "$ echo \"gdkkn vnqkc\" | tr [a-y] [b-z]\n" +//usage: "hello world\n" + #include "libbb.h" enum { diff --git a/coreutils/true.c b/coreutils/true.c index 0a862ef18..382e476a8 100644 --- a/coreutils/true.c +++ b/coreutils/true.c @@ -10,6 +10,16 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/true.html */ +//usage:#define true_trivial_usage +//usage: "" +//usage:#define true_full_usage "\n\n" +//usage: "Return an exit code of TRUE (0)" +//usage: +//usage:#define true_example_usage +//usage: "$ true\n" +//usage: "$ echo $?\n" +//usage: "0\n" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/tty.c b/coreutils/tty.c index 282d9680f..67399cbf3 100644 --- a/coreutils/tty.c +++ b/coreutils/tty.c @@ -10,6 +10,19 @@ /* BB_AUDIT SUSv4 compliant */ /* http://www.opengroup.org/onlinepubs/9699919799/utilities/tty.html */ +//usage:#define tty_trivial_usage +//usage: "" +//usage:#define tty_full_usage "\n\n" +//usage: "Print file name of stdin's terminal" +//usage: IF_INCLUDE_SUSv2( "\n" +//usage: "\nOptions:" +//usage: "\n -s Print nothing, only return exit status" +//usage: ) +//usage: +//usage:#define tty_example_usage +//usage: "$ tty\n" +//usage: "/dev/tty2\n" + #include "libbb.h" int tty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/coreutils/uname.c b/coreutils/uname.c index d1c50e222..7a86b32a6 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c @@ -48,6 +48,23 @@ * Fix handling of -a to not print "unknown", add -o and -i support. */ +//usage:#define uname_trivial_usage +//usage: "[-amnrspv]" +//usage:#define uname_full_usage "\n\n" +//usage: "Print system information\n" +//usage: "\nOptions:" +//usage: "\n -a Print all" +//usage: "\n -m The machine (hardware) type" +//usage: "\n -n Hostname" +//usage: "\n -r OS release" +//usage: "\n -s OS name (default)" +//usage: "\n -p Processor type" +//usage: "\n -v OS version" +//usage: +//usage:#define uname_example_usage +//usage: "$ uname -a\n" +//usage: "Linux debian 2.4.23 #2 Tue Dec 23 17:09:10 MST 2003 i686 GNU/Linux\n" + #include "libbb.h" /* After libbb.h, since it needs sys/types.h on some systems */ #include diff --git a/coreutils/uniq.c b/coreutils/uniq.c index decf7e4f8..6e764d8a4 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c @@ -10,6 +10,24 @@ /* BB_AUDIT SUSv3 compliant */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */ +//usage:#define uniq_trivial_usage +//usage: "[-cdu][-f,s,w N] [INPUT [OUTPUT]]" +//usage:#define uniq_full_usage "\n\n" +//usage: "Discard duplicate lines\n" +//usage: "\nOptions:" +//usage: "\n -c Prefix lines by the number of occurrences" +//usage: "\n -d Only print duplicate lines" +//usage: "\n -u Only print unique lines" +//usage: "\n -f N Skip first N fields" +//usage: "\n -s N Skip first N chars (after any skipped fields)" +//usage: "\n -w N Compare N characters in line" +//usage: +//usage:#define uniq_example_usage +//usage: "$ echo -e \"a\\na\\nb\\nc\\nc\\na\" | sort | uniq\n" +//usage: "a\n" +//usage: "b\n" +//usage: "c\n" + #include "libbb.h" int uniq_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/coreutils/usleep.c b/coreutils/usleep.c index cb4ec5898..67f94f798 100644 --- a/coreutils/usleep.c +++ b/coreutils/usleep.c @@ -9,6 +9,15 @@ /* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */ +//usage:#define usleep_trivial_usage +//usage: "N" +//usage:#define usleep_full_usage "\n\n" +//usage: "Pause for N microseconds" +//usage: +//usage:#define usleep_example_usage +//usage: "$ usleep 1000000\n" +//usage: "[pauses for 1 second]\n" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 56ed254e5..47a155ecb 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c @@ -10,6 +10,18 @@ * Bugs: the spec doesn't mention anything about "`\n`\n" prior to the * "end" line */ + +//usage:#define uudecode_trivial_usage +//usage: "[-o OUTFILE] [INFILE]" +//usage:#define uudecode_full_usage "\n\n" +//usage: "Uudecode a file\n" +//usage: "Finds outfile name in uuencoded source unless -o is given" +//usage: +//usage:#define uudecode_example_usage +//usage: "$ uudecode -o busybox busybox.uu\n" +//usage: "$ ls -l busybox\n" +//usage: "-rwxr-xr-x 1 ams ams 245264 Jun 7 21:35 busybox\n" + #include "libbb.h" #if ENABLE_UUDECODE diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index fe9e8c664..b4cd0a9e6 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c @@ -8,6 +8,20 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define uuencode_trivial_usage +//usage: "[-m] [INFILE] STORED_FILENAME" +//usage:#define uuencode_full_usage "\n\n" +//usage: "Uuencode a file to stdout\n" +//usage: "\nOptions:" +//usage: "\n -m Use base64 encoding per RFC1521" +//usage: +//usage:#define uuencode_example_usage +//usage: "$ uuencode busybox busybox\n" +//usage: "begin 755 busybox\n" +//usage: "\n" +//usage: "$ uudecode busybox busybox > busybox.uu\n" +//usage: "$\n" + #include "libbb.h" enum { diff --git a/coreutils/who.c b/coreutils/who.c index ab1e30fc8..ec385bf95 100644 --- a/coreutils/who.c +++ b/coreutils/who.c @@ -18,6 +18,13 @@ */ /* BB_AUDIT SUSv3 _NOT_ compliant -- missing options -b, -d, -l, -m, -p, -q, -r, -s, -t, -T, -u; Missing argument 'file'. */ +//usage:#define who_trivial_usage +//usage: "[-a]" +//usage:#define who_full_usage "\n\n" +//usage: "Show who is logged on\n" +//usage: "\nOptions:" +//usage: "\n -a Show all" + #include "libbb.h" static void idle_string(char *str6, time_t t) diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 78d20db14..30b17cab3 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c @@ -9,6 +9,11 @@ /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ +//usage:#define whoami_trivial_usage +//usage: "" +//usage:#define whoami_full_usage "\n\n" +//usage: "Print the user name associated with the current effective user id" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/include/usage.src.h b/include/usage.src.h index c1720b5f1..d8360931f 100644 --- a/include/usage.src.h +++ b/include/usage.src.h @@ -118,18 +118,6 @@ INSERT "\n -F SEP Use SEP as field separator" \ "\n -f FILE Read program from FILE" \ -#define basename_trivial_usage \ - "FILE [SUFFIX]" -#define basename_full_usage "\n\n" \ - "Strip directory path and .SUFFIX from FILE\n" -#define basename_example_usage \ - "$ basename /usr/local/bin/foo\n" \ - "foo\n" \ - "$ basename /usr/local/bin/\n" \ - "bin\n" \ - "$ basename /foo/bar.txt .txt\n" \ - "bar" - #define beep_trivial_usage \ "-f FREQ -l LEN -d DELAY -r COUNT -n" #define beep_full_usage "\n\n" \ @@ -171,32 +159,6 @@ INSERT #define busybox_notes_usage \ "Hello world!\n" -#define cal_trivial_usage \ - "[-jy] [[MONTH] YEAR]" -#define cal_full_usage "\n\n" \ - "Display a calendar\n" \ - "\nOptions:" \ - "\n -j Use julian dates" \ - "\n -y Display the entire year" \ - -#define cat_trivial_usage \ - "[FILE]..." -#define cat_full_usage "\n\n" \ - "Concatenate FILEs and print them to stdout" \ - -#define cat_example_usage \ - "$ cat /proc/uptime\n" \ - "110716.72 17.67" - -#define catv_trivial_usage \ - "[-etv] [FILE]..." -#define catv_full_usage "\n\n" \ - "Display nonprinting characters as ^x or M-x\n" \ - "\nOptions:" \ - "\n -e End each line with $" \ - "\n -t Show tabs as ^I" \ - "\n -v Don't use ^x or M-x escapes" \ - #define chat_trivial_usage \ "EXPECT [SEND [EXPECT [SEND...]]]" #define chat_full_usage "\n\n" \ @@ -261,75 +223,6 @@ INSERT "\n -R Recurse" \ ) -#define chmod_trivial_usage \ - "[-R"IF_DESKTOP("cvf")"] MODE[,MODE]... FILE..." -#define chmod_full_usage "\n\n" \ - "Each MODE is one or more of the letters ugoa, one of the\n" \ - "symbols +-= and one or more of the letters rwxst\n" \ - "\nOptions:" \ - "\n -R Recurse" \ - IF_DESKTOP( \ - "\n -c List changed files" \ - "\n -v List all files" \ - "\n -f Hide errors" \ - ) -#define chmod_example_usage \ - "$ ls -l /tmp/foo\n" \ - "-rw-rw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n" \ - "$ chmod u+x /tmp/foo\n" \ - "$ ls -l /tmp/foo\n" \ - "-rwxrw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo*\n" \ - "$ chmod 444 /tmp/foo\n" \ - "$ ls -l /tmp/foo\n" \ - "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n" - -#define chgrp_trivial_usage \ - "[-RhLHP"IF_DESKTOP("cvf")"]... GROUP FILE..." -#define chgrp_full_usage "\n\n" \ - "Change the group membership of each FILE to GROUP\n" \ - "\nOptions:" \ - "\n -R Recurse" \ - "\n -h Affect symlinks instead of symlink targets" \ - "\n -L Traverse all symlinks to directories" \ - "\n -H Traverse symlinks on command line only" \ - "\n -P Don't traverse symlinks (default)" \ - IF_DESKTOP( \ - "\n -c List changed files" \ - "\n -v Verbose" \ - "\n -f Hide errors" \ - ) -#define chgrp_example_usage \ - "$ ls -l /tmp/foo\n" \ - "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n" \ - "$ chgrp root /tmp/foo\n" \ - "$ ls -l /tmp/foo\n" \ - "-r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo\n" - -#define chown_trivial_usage \ - "[-RhLHP"IF_DESKTOP("cvf")"]... OWNER[<.|:>[GROUP]] FILE..." -#define chown_full_usage "\n\n" \ - "Change the owner and/or group of each FILE to OWNER and/or GROUP\n" \ - "\nOptions:" \ - "\n -R Recurse" \ - "\n -h Affect symlinks instead of symlink targets" \ - "\n -L Traverse all symlinks to directories" \ - "\n -H Traverse symlinks on command line only" \ - "\n -P Don't traverse symlinks (default)" \ - IF_DESKTOP( \ - "\n -c List changed files" \ - "\n -v List all files" \ - "\n -f Hide errors" \ - ) -#define chown_example_usage \ - "$ ls -l /tmp/foo\n" \ - "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n" \ - "$ chown root /tmp/foo\n" \ - "$ ls -l /tmp/foo\n" \ - "-r--r--r-- 1 root andersen 0 Apr 12 18:25 /tmp/foo\n" \ - "$ chown root.root /tmp/foo\n" \ - "ls -l /tmp/foo\n" \ - "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n" - #define chpst_trivial_usage \ "[-vP012] [-u USER[:GRP]] [-U USER[:GRP]] [-e DIR]\n" \ " [-/ DIR] [-n NICE] [-m BYTES] [-d BYTES] [-o N]\n" \ @@ -391,23 +284,6 @@ INSERT "\n -t N Limit CPU time, process receives" \ "\n a SIGXCPU after N seconds" \ -#define chroot_trivial_usage \ - "NEWROOT [PROG ARGS]" -#define chroot_full_usage "\n\n" \ - "Run PROG with root directory set to NEWROOT" -#define chroot_example_usage \ - "$ ls -l /bin/ls\n" \ - "lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /BusyBox\n" \ - "# mount /dev/hdc1 /mnt -t minix\n" \ - "# chroot /mnt\n" \ - "# ls -l /bin/ls\n" \ - "-rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls*\n" - -#define cksum_trivial_usage \ - "FILES..." -#define cksum_full_usage "\n\n" \ - "Calculate the CRC32 checksums of FILES" - #define cmp_trivial_usage \ "[-l] [-s] FILE1 [FILE2" IF_DESKTOP(" [SKIP1 [SKIP2]]") "]" #define cmp_full_usage "\n\n" \ @@ -417,15 +293,6 @@ INSERT "\n for all differing bytes" \ "\n -s Quiet" \ -#define comm_trivial_usage \ - "[-123] FILE1 FILE2" -#define comm_full_usage "\n\n" \ - "Compare FILE1 with FILE2\n" \ - "\nOptions:" \ - "\n -1 Suppress lines unique to FILE1" \ - "\n -2 Suppress lines unique to FILE2" \ - "\n -3 Suppress lines common to both files" \ - #define bbconfig_trivial_usage \ "" #define bbconfig_full_usage "\n\n" \ @@ -447,13 +314,6 @@ INSERT "$ chrt -f -p 3 $x\n" \ "You need CAP_SYS_NICE privileges to set scheduling attributes of a process" -#define nice_trivial_usage \ - "[-n ADJUST] [PROG ARGS]" -#define nice_full_usage "\n\n" \ - "Change scheduling priority, run PROG\n" \ - "\nOptions:" \ - "\n -n ADJUST Adjust priority by ADJUST" \ - #define renice_trivial_usage \ "{{-n INCREMENT} | PRIORITY} [[-p | -g | -u] ID...]" #define renice_full_usage "\n\n" \ @@ -472,24 +332,6 @@ INSERT "\n -c Class. 1:realtime 2:best-effort 3:idle" \ "\n -n Priority" \ -#define cp_trivial_usage \ - "[OPTIONS] SOURCE DEST" -#define cp_full_usage "\n\n" \ - "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY\n" \ - "\nOptions:" \ - "\n -a Same as -dpR" \ - IF_SELINUX( \ - "\n -c Preserve security context" \ - ) \ - "\n -R,-r Recurse" \ - "\n -d,-P Preserve symlinks (default if -R)" \ - "\n -L Follow all symlinks" \ - "\n -H Follow symlinks on command line" \ - "\n -p Preserve file attributes if possible" \ - "\n -f Overwrite" \ - "\n -i Prompt before overwrite" \ - "\n -l,-s Create (sym)links" \ - #define crond_trivial_usage \ "-fbS -l N " IF_FEATURE_CROND_D("-d N ") "-L LOGFILE -c DIR" #define crond_full_usage "\n\n" \ @@ -553,57 +395,6 @@ INSERT "\n -S SALT" \ ) \ -#define cut_trivial_usage \ - "[OPTIONS] [FILE]..." -#define cut_full_usage "\n\n" \ - "Print selected fields from each input FILE to stdout\n" \ - "\nOptions:" \ - "\n -b LIST Output only bytes from LIST" \ - "\n -c LIST Output only characters from LIST" \ - "\n -d CHAR Use CHAR instead of tab as the field delimiter" \ - "\n -s Output only the lines containing delimiter" \ - "\n -f N Print only these fields" \ - "\n -n Ignored" \ - -#define cut_example_usage \ - "$ echo \"Hello world\" | cut -f 1 -d ' '\n" \ - "Hello\n" \ - "$ echo \"Hello world\" | cut -f 2 -d ' '\n" \ - "world\n" - -#define dd_trivial_usage \ - "[if=FILE] [of=FILE] " IF_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n" \ - " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync]") -#define dd_full_usage "\n\n" \ - "Copy a file with converting and formatting\n" \ - "\nOptions:" \ - "\n if=FILE Read from FILE instead of stdin" \ - "\n of=FILE Write to FILE instead of stdout" \ - "\n bs=N Read and write N bytes at a time" \ - IF_FEATURE_DD_IBS_OBS( \ - "\n ibs=N Read N bytes at a time" \ - ) \ - IF_FEATURE_DD_IBS_OBS( \ - "\n obs=N Write N bytes at a time" \ - ) \ - "\n count=N Copy only N input blocks" \ - "\n skip=N Skip N input blocks" \ - "\n seek=N Skip N output blocks" \ - IF_FEATURE_DD_IBS_OBS( \ - "\n conv=notrunc Don't truncate output file" \ - "\n conv=noerror Continue after read errors" \ - "\n conv=sync Pad blocks with zeros" \ - "\n conv=fsync Physically write data out before finishing" \ - ) \ - "\n" \ - "\nNumbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024)," \ - "\nMD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)" \ - -#define dd_example_usage \ - "$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4\n" \ - "4+0 records in\n" \ - "4+0 records out\n" - #define delgroup_trivial_usage \ IF_FEATURE_DEL_USER_FROM_GROUP("[USER] ")"GROUP" #define delgroup_full_usage "\n\n" \ @@ -639,41 +430,6 @@ INSERT "\n don't poll for events" \ ) -#define df_trivial_usage \ - "[-Pk" \ - IF_FEATURE_HUMAN_READABLE("mh") \ - IF_FEATURE_DF_FANCY("ai] [-B SIZE") \ - "] [FILESYSTEM]..." -#define df_full_usage "\n\n" \ - "Print filesystem usage statistics\n" \ - "\nOptions:" \ - "\n -P POSIX output format" \ - "\n -k 1024-byte blocks (default)" \ - IF_FEATURE_HUMAN_READABLE( \ - "\n -m 1M-byte blocks" \ - "\n -h Human readable (e.g. 1K 243M 2G)" \ - ) \ - IF_FEATURE_DF_FANCY( \ - "\n -a Show all filesystems" \ - "\n -i Inodes" \ - "\n -B SIZE Blocksize" \ - ) \ - -#define df_example_usage \ - "$ df\n" \ - "Filesystem 1K-blocks Used Available Use% Mounted on\n" \ - "/dev/sda3 8690864 8553540 137324 98% /\n" \ - "/dev/sda1 64216 36364 27852 57% /boot\n" \ - "$ df /dev/sda3\n" \ - "Filesystem 1K-blocks Used Available Use% Mounted on\n" \ - "/dev/sda3 8690864 8553540 137324 98% /\n" \ - "$ POSIXLY_CORRECT=sure df /dev/sda3\n" \ - "Filesystem 512B-blocks Used Available Use% Mounted on\n" \ - "/dev/sda3 17381728 17107080 274648 98% /\n" \ - "$ POSIXLY_CORRECT=yep df -P /dev/sda3\n" \ - "Filesystem 512-blocks Used Available Capacity Mounted on\n" \ - "/dev/sda3 17381728 17107080 274648 98% /\n" - #define dhcprelay_trivial_usage \ "CLIENT_IFACE[,CLIENT_IFACE2]... SERVER_IFACE [SERVER_IP]" #define dhcprelay_full_usage "\n\n" \ @@ -701,16 +457,6 @@ INSERT "\n -U Output LINES lines of context" \ "\n -w Ignore all whitespace" \ -#define dirname_trivial_usage \ - "FILENAME" -#define dirname_full_usage "\n\n" \ - "Strip non-directory suffix from FILENAME" -#define dirname_example_usage \ - "$ dirname /tmp/foo\n" \ - "/tmp\n" \ - "$ dirname /tmp/foo/\n" \ - "/tmp\n" - #define dmesg_trivial_usage \ "[-c] [-n LEVEL] [-s SIZE]" #define dmesg_full_usage "\n\n" \ @@ -736,61 +482,6 @@ INSERT "\n nameserver DNSD_SERVER" \ "\n nameserver NORNAL_DNS_SERVER" \ -#define dos2unix_trivial_usage \ - "[-ud] [FILE]" -#define dos2unix_full_usage "\n\n" \ - "Convert FILE in-place from DOS to Unix format.\n" \ - "When no file is given, use stdin/stdout.\n" \ - "\nOptions:" \ - "\n -u dos2unix" \ - "\n -d unix2dos" \ - -#define unix2dos_trivial_usage \ - "[-ud] [FILE]" -#define unix2dos_full_usage "\n\n" \ - "Convert FILE in-place from Unix to DOS format.\n" \ - "When no file is given, use stdin/stdout.\n" \ - "\nOptions:" \ - "\n -u dos2unix" \ - "\n -d unix2dos" \ - -#define du_trivial_usage \ - "[-aHLdclsx" IF_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..." -#define du_full_usage "\n\n" \ - "Summarize disk space used for each FILE and/or directory.\n" \ - "Disk space is printed in units of " \ - IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("1024") \ - IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("512") \ - " bytes.\n" \ - "\nOptions:" \ - "\n -a Show file sizes too" \ - "\n -L Follow all symlinks" \ - "\n -H Follow symlinks on command line" \ - "\n -d N Limit output to directories (and files with -a) of depth < N" \ - "\n -c Show grand total" \ - "\n -l Count sizes many times if hard linked" \ - "\n -s Display only a total for each argument" \ - "\n -x Skip directories on different filesystems" \ - IF_FEATURE_HUMAN_READABLE( \ - "\n -h Sizes in human readable format (e.g., 1K 243M 2G )" \ - "\n -m Sizes in megabytes" \ - ) \ - "\n -k Sizes in kilobytes" \ - IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(" (default)") \ - -#define du_example_usage \ - "$ du\n" \ - "16 ./CVS\n" \ - "12 ./kernel-patches/CVS\n" \ - "80 ./kernel-patches\n" \ - "12 ./tests/CVS\n" \ - "36 ./tests\n" \ - "12 ./scripts/CVS\n" \ - "16 ./scripts\n" \ - "12 ./docs/CVS\n" \ - "104 ./docs\n" \ - "2417 .\n" - #define dumpleases_trivial_usage \ "[-r|-a] [-f LEASEFILE]" #define dumpleases_full_usage "\n\n" \ @@ -829,26 +520,6 @@ INSERT "\n -L file Set badblocks list" \ */ -#define echo_trivial_usage \ - IF_FEATURE_FANCY_ECHO("[-neE] ") "[ARG]..." -#define echo_full_usage "\n\n" \ - "Print the specified ARGs to stdout" \ - IF_FEATURE_FANCY_ECHO( "\n" \ - "\nOptions:" \ - "\n -n Suppress trailing newline" \ - "\n -e Interpret backslash escapes (i.e., \\t=tab)" \ - "\n -E Don't interpret backslash escapes (default)" \ - ) -#define echo_example_usage \ - "$ echo \"Erik is cool\"\n" \ - "Erik is cool\n" \ - IF_FEATURE_FANCY_ECHO("$ echo -e \"Erik\\nis\\ncool\"\n" \ - "Erik\n" \ - "is\n" \ - "cool\n" \ - "$ echo \"Erik\\nis\\ncool\"\n" \ - "Erik\\nis\\ncool\n") - #define eject_trivial_usage \ "[-t] [-T] [DEVICE]" #define eject_full_usage "\n\n" \ @@ -863,15 +534,6 @@ INSERT #define ed_trivial_usage "" #define ed_full_usage "" -#define env_trivial_usage \ - "[-iu] [-] [name=value]... [PROG ARGS]" -#define env_full_usage "\n\n" \ - "Print the current environment or run PROG after setting up\n" \ - "the specified environment\n" \ - "\nOptions:" \ - "\n -, -i Start with an empty environment" \ - "\n -u Remove variable from the environment" \ - #define ether_wake_trivial_usage \ "[-b] [-i iface] [-p aa:bb:cc:dd[:ee:ff]] MAC" #define ether_wake_full_usage "\n\n" \ @@ -883,55 +545,6 @@ INSERT "\n -i iface Interface to use (default eth0)" \ "\n -p pass Append four or six byte password PW to the packet" \ -#define expand_trivial_usage \ - "[-i] [-t N] [FILE]..." -#define expand_full_usage "\n\n" \ - "Convert tabs to spaces, writing to stdout\n" \ - "\nOptions:" \ - IF_FEATURE_EXPAND_LONG_OPTIONS( \ - "\n -i,--initial Don't convert tabs after non blanks" \ - "\n -t,--tabs=N Tabstops every N chars" \ - ) \ - IF_NOT_FEATURE_EXPAND_LONG_OPTIONS( \ - "\n -i Don't convert tabs after non blanks" \ - "\n -t Tabstops every N chars" \ - ) - -#define expr_trivial_usage \ - "EXPRESSION" -#define expr_full_usage "\n\n" \ - "Print the value of EXPRESSION to stdout\n" \ - "\n" \ - "EXPRESSION may be:\n" \ - " ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n" \ - " ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n" \ - " ARG1 < ARG2 1 if ARG1 is less than ARG2, else 0. Similarly:\n" \ - " ARG1 <= ARG2\n" \ - " ARG1 = ARG2\n" \ - " ARG1 != ARG2\n" \ - " ARG1 >= ARG2\n" \ - " ARG1 > ARG2\n" \ - " ARG1 + ARG2 Sum of ARG1 and ARG2. Similarly:\n" \ - " ARG1 - ARG2\n" \ - " ARG1 * ARG2\n" \ - " ARG1 / ARG2\n" \ - " ARG1 % ARG2\n" \ - " STRING : REGEXP Anchored pattern match of REGEXP in STRING\n" \ - " match STRING REGEXP Same as STRING : REGEXP\n" \ - " substr STRING POS LENGTH Substring of STRING, POS counted from 1\n" \ - " index STRING CHARS Index in STRING where any CHARS is found, or 0\n" \ - " length STRING Length of STRING\n" \ - " quote TOKEN Interpret TOKEN as a string, even if\n" \ - " it is a keyword like 'match' or an\n" \ - " operator like '/'\n" \ - " (EXPRESSION) Value of EXPRESSION\n" \ - "\n" \ - "Beware that many operators need to be escaped or quoted for shells.\n" \ - "Comparisons are arithmetic if both ARGs are numbers, else\n" \ - "lexicographical. Pattern matches return the string matched between\n" \ - "\\( and \\) or null; if \\( and \\) are not used, they return the number\n" \ - "of characters matched or 0." - #define fakeidentd_trivial_usage \ "[-fiw] [-b ADDR] [STRING]" #define fakeidentd_full_usage "\n\n" \ @@ -943,16 +556,6 @@ INSERT "\n -b ADDR Bind to specified address" \ "\n STRING Ident answer string (default: nobody)" \ -#define false_trivial_usage \ - "" -#define false_full_usage "\n\n" \ - "Return an exit code of FALSE (1)" - -#define false_example_usage \ - "$ false\n" \ - "$ echo $?\n" \ - "1\n" - #define fbsplash_trivial_usage \ "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" #define fbsplash_full_usage "\n\n" \ @@ -1058,15 +661,6 @@ INSERT "\n -u Unlock FD" \ "\n -n Fail rather than wait" \ -#define fold_trivial_usage \ - "[-bs] [-w WIDTH] [FILE]..." -#define fold_full_usage "\n\n" \ - "Wrap input lines in each FILE (or stdin), writing to stdout\n" \ - "\nOptions:" \ - "\n -b Count bytes rather than columns" \ - "\n -s Break at spaces" \ - "\n -w Use WIDTH columns instead of 80" \ - #define free_trivial_usage \ "" IF_DESKTOP("[-b/k/m/g]") #define free_full_usage "\n\n" \ @@ -1267,51 +861,6 @@ INSERT "\n -Z Disable Seagate auto-powersaving mode" \ "\n -z Reread partition table" \ -#define head_trivial_usage \ - "[OPTIONS] [FILE]..." -#define head_full_usage "\n\n" \ - "Print first 10 lines of each FILE (or stdin) to stdout.\n" \ - "With more than one FILE, precede each with a filename header.\n" \ - "\nOptions:" \ - "\n -n N[kbm] Print first N lines" \ - IF_FEATURE_FANCY_HEAD( \ - "\n -c N[kbm] Print first N bytes" \ - "\n -q Never print headers" \ - "\n -v Always print headers" \ - ) \ - "\n" \ - "\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)." \ - -#define head_example_usage \ - "$ head -n 2 /etc/passwd\n" \ - "root:x:0:0:root:/root:/bin/bash\n" \ - "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n" - -#define tail_trivial_usage \ - "[OPTIONS] [FILE]..." -#define tail_full_usage "\n\n" \ - "Print last 10 lines of each FILE (or stdin) to stdout.\n" \ - "With more than one FILE, precede each with a filename header.\n" \ - "\nOptions:" \ - "\n -f Print data as file grows" \ - IF_FEATURE_FANCY_TAIL( \ - "\n -s SECONDS Wait SECONDS between reads with -f" \ - ) \ - "\n -n N[kbm] Print last N lines" \ - IF_FEATURE_FANCY_TAIL( \ - "\n -c N[kbm] Print last N bytes" \ - "\n -q Never print headers" \ - "\n -v Always print headers" \ - "\n" \ - "\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)." \ - "\nIf N starts with a '+', output begins with the Nth item from the start" \ - "\nof each file, not from the end." \ - ) \ - -#define tail_example_usage \ - "$ tail -n 1 /etc/resolv.conf\n" \ - "nameserver 10.0.0.1\n" - #define hexdump_trivial_usage \ "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..." #define hexdump_full_usage "\n\n" \ @@ -1336,11 +885,6 @@ INSERT #define hd_full_usage "\n\n" \ "hd is an alias for hexdump -C" -#define hostid_trivial_usage \ - "" -#define hostid_full_usage "\n\n" \ - "Print out a unique 32-bit identifier for the machine" - #define hostname_trivial_usage \ "[OPTIONS] [HOSTNAME | -F FILE]" #define hostname_full_usage "\n\n" \ @@ -1385,24 +929,6 @@ INSERT "\n -e STRING HTML encode STRING" \ "\n -d STRING URL decode STRING" \ -#define id_trivial_usage \ - "[OPTIONS] [USER]" -#define id_full_usage "\n\n" \ - "Print information about USER or the current user\n" \ - "\nOptions:" \ - IF_SELINUX( \ - "\n -Z Security context" \ - ) \ - "\n -u User ID" \ - "\n -g Group ID" \ - "\n -G Supplementary group IDs" \ - "\n -n Print names instead of numbers" \ - "\n -r Print real ID instead of effective ID" \ - -#define id_example_usage \ - "$ id\n" \ - "uid=1000(andersen) gid=1000(andersen)\n" - #define ifconfig_trivial_usage \ IF_FEATURE_IFCONFIG_STATUS("[-a]") " interface [address]" #define ifconfig_full_usage "\n\n" \ @@ -1542,24 +1068,6 @@ INSERT "\ninotifyd waits for PROG to exit." \ "\nWhen x event happens for all FILEs, inotifyd exits." \ -/* -v, -b, -c are ignored */ -#define install_trivial_usage \ - "[-cdDsp] [-o USER] [-g GRP] [-m MODE] [SOURCE]... DEST" -#define install_full_usage "\n\n" \ - "Copy files and set attributes\n" \ - "\nOptions:" \ - "\n -c Just copy (default)" \ - "\n -d Create directories" \ - "\n -D Create leading target directories" \ - "\n -s Strip symbol table" \ - "\n -p Preserve date" \ - "\n -o USER Set ownership" \ - "\n -g GRP Set group ownership" \ - "\n -m MODE Set permissions" \ - IF_SELINUX( \ - "\n -Z Set security context" \ - ) - /* would need to make the " | " optional depending on more than one selected: */ #define ip_trivial_usage \ "[OPTIONS] {" \ @@ -1732,15 +1240,6 @@ INSERT "\n -c N Only messages with level < N are printed to console" \ "\n -n Run in foreground" \ -#define length_trivial_usage \ - "STRING" -#define length_full_usage "\n\n" \ - "Print STRING's length" - -#define length_example_usage \ - "$ length Hello\n" \ - "5\n" - #define less_trivial_usage \ "[-EMNmh~I?] [FILE]..." #define less_full_usage "\n\n" \ @@ -1765,22 +1264,6 @@ INSERT " linux32 Set 32bit uname emulation\n" \ " linux64 Set 64bit uname emulation" \ -#define ln_trivial_usage \ - "[OPTIONS] TARGET... LINK|DIR" -#define ln_full_usage "\n\n" \ - "Create a link LINK or DIR/TARGET to the specified TARGET(s)\n" \ - "\nOptions:" \ - "\n -s Make symlinks instead of hardlinks" \ - "\n -f Remove existing destinations" \ - "\n -n Don't dereference symlinks - treat like normal file" \ - "\n -b Make a backup of the target (if exists) before link operation" \ - "\n -S suf Use suffix instead of ~ when making backup files" \ - -#define ln_example_usage \ - "$ ln -s BusyBox /tmp/ls\n" \ - "$ ls -l /tmp/ls\n" \ - "lrwxrwxrwx 1 root root 7 Apr 12 18:39 ls -> BusyBox*\n" - #define load_policy_trivial_usage NOUSAGE_STR #define load_policy_full_usage "" @@ -1805,14 +1288,6 @@ INSERT "\n -h Name of the remote host" \ "\n -p Preserve environment" \ -#define logname_trivial_usage \ - "" -#define logname_full_usage "\n\n" \ - "Print the name of the current user" -#define logname_example_usage \ - "$ logname\n" \ - "root\n" - #define logread_trivial_usage \ "[-f]" #define logread_full_usage "\n\n" \ @@ -1981,64 +1456,6 @@ INSERT "\n -p Use prefix to speed translations" \ "\n -V Verify file context on disk matches defaults" \ -#define md5sum_trivial_usage \ - "[FILE]..." \ - IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: md5sum -c [-sw] [FILE]") -#define md5sum_full_usage "\n\n" \ - "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " MD5 checksums" \ - IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ - "\nOptions:" \ - "\n -c Check sums against given list" \ - "\n -s Don't output anything, status code shows success" \ - "\n -w Warn about improperly formatted checksum lines" \ - ) - -#define md5sum_example_usage \ - "$ md5sum < busybox\n" \ - "6fd11e98b98a58f64ff3398d7b324003\n" \ - "$ md5sum busybox\n" \ - "6fd11e98b98a58f64ff3398d7b324003 busybox\n" \ - "$ md5sum -c -\n" \ - "6fd11e98b98a58f64ff3398d7b324003 busybox\n" \ - "busybox: OK\n" \ - "^D\n" - -#define sha1sum_trivial_usage \ - "[FILE]..." \ - IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha1sum -c [-sw] [FILE]") -#define sha1sum_full_usage "\n\n" \ - "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums" \ - IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ - "\nOptions:" \ - "\n -c Check sums against given list" \ - "\n -s Don't output anything, status code shows success" \ - "\n -w Warn about improperly formatted checksum lines" \ - ) - -#define sha256sum_trivial_usage \ - "[FILE]..." \ - IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha256sum -c [-sw] [FILE]") -#define sha256sum_full_usage "\n\n" \ - "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA256 checksums" \ - IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ - "\nOptions:" \ - "\n -c Check sums against given list" \ - "\n -s Don't output anything, status code shows success" \ - "\n -w Warn about improperly formatted checksum lines" \ - ) - -#define sha512sum_trivial_usage \ - "[FILE]..." \ - IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha512sum -c [-sw] [FILE]") -#define sha512sum_full_usage "\n\n" \ - "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA512 checksums" \ - IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n" \ - "\nOptions:" \ - "\n -c Check sums against given list" \ - "\n -s Don't output anything, status code shows success" \ - "\n -w Warn about improperly formatted checksum lines" \ - ) - #define mdev_trivial_usage \ "[-s]" #define mdev_full_usage "\n\n" \ @@ -2084,35 +1501,6 @@ INSERT "\n -s Set serial line to SPEED" \ "\n -X Disable special meaning of NUL and Ctrl-X from stdin" \ -#define mkdir_trivial_usage \ - "[OPTIONS] DIRECTORY..." -#define mkdir_full_usage "\n\n" \ - "Create DIRECTORY\n" \ - "\nOptions:" \ - "\n -m MODE Mode" \ - "\n -p No error if exists; make parent directories as needed" \ - IF_SELINUX( \ - "\n -Z Set security context" \ - ) - -#define mkdir_example_usage \ - "$ mkdir /tmp/foo\n" \ - "$ mkdir /tmp/foo\n" \ - "/tmp/foo: File exists\n" \ - "$ mkdir /tmp/foo/bar/baz\n" \ - "/tmp/foo/bar/baz: No such file or directory\n" \ - "$ mkdir -p /tmp/foo/bar/baz\n" - -#define mkfifo_trivial_usage \ - "[-m MODE] " IF_SELINUX("[-Z] ") "NAME" -#define mkfifo_full_usage "\n\n" \ - "Create named pipe\n" \ - "\nOptions:" \ - "\n -m MODE Mode (default a=rw)" \ - IF_SELINUX( \ - "\n -Z Set security context" \ - ) - #define mkfs_ext2_trivial_usage \ "[-Fn] " \ /* "[-c|-l filename] " */ \ @@ -2187,24 +1575,6 @@ INSERT /* "\n -I Allow to use entire disk device (e.g. /dev/hda)" */ \ "\n -n LBL Volume label" \ -#define mknod_trivial_usage \ - "[-m MODE] " IF_SELINUX("[-Z] ") "NAME TYPE MAJOR MINOR" -#define mknod_full_usage "\n\n" \ - "Create a special file (block, character, or pipe)\n" \ - "\nOptions:" \ - "\n -m MODE Creation mode (default a=rw)" \ - IF_SELINUX( \ - "\n -Z Set security context" \ - ) \ - "\nTYPE:" \ - "\n b Block device" \ - "\n c or u Character device" \ - "\n p Named pipe (MAJOR and MINOR are ignored)" \ - -#define mknod_example_usage \ - "$ mknod /dev/fd0 b 2 0\n" \ - "$ mknod -m 644 /tmp/pipe p\n" - #define mkswap_trivial_usage \ "[-L LBL] BLOCKDEV [KBYTES]" #define mkswap_full_usage "\n\n" \ @@ -2307,13 +1677,6 @@ INSERT "ras3 reset retension rewind rewoffline seek setblk setdensity\n" \ "setpart tell unload unlock weof wset" \ -#define nohup_trivial_usage \ - "PROG ARGS" -#define nohup_full_usage "\n\n" \ - "Run PROG immune to hangups, with output to a non-tty" -#define nohup_example_usage \ - "$ nohup make &" - #define nslookup_trivial_usage \ "[HOST] [SERVER]" #define nslookup_full_usage "\n\n" \ @@ -2343,12 +1706,6 @@ INSERT "\n -S PROG Run PROG after stepping time, stratum change, and every 11 mins" \ "\n -p PEER Obtain time from PEER (may be repeated)" \ -#define od_trivial_usage \ - "[-aBbcDdeFfHhIiLlOovXx] " IF_DESKTOP("[-t TYPE] ") "[FILE]" -#define od_full_usage "\n\n" \ - "Write an unambiguous representation, octal bytes by default, of FILE\n" \ - "(or stdin) to stdout" - /* #define parse_trivial_usage \ "[-n MAXTOKENS] [-m MINTOKENS] [-d DELIMS] [-f FLAGS] FILE..." @@ -2477,21 +1834,6 @@ INSERT "$ popmaildir -k ~/Maildir -- nc pop.drvv.ru 110 [ TARGET if symlink\n" \ - " %o I/O block size\n" \ - " %s Total size, in bytes\n" \ - " %t Major device type in hex\n" \ - " %T Minor device type in hex\n" \ - " %u User ID of owner\n" \ - " %U User name of owner\n" \ - " %x Time of last access\n" \ - " %X Time of last access as seconds since Epoch\n" \ - " %y Time of last modification\n" \ - " %Y Time of last modification as seconds since Epoch\n" \ - " %z Time of last change\n" \ - " %Z Time of last change as seconds since Epoch\n" \ - "\nValid format sequences for file systems:\n" \ - " %a Free blocks available to non-superuser\n" \ - " %b Total data blocks in file system\n" \ - " %c Total file nodes in file system\n" \ - " %d Free file nodes in file system\n" \ - " %f Free blocks in file system\n" \ - IF_SELINUX( \ - " %C Security context in selinux\n" \ - ) \ - " %i File System ID in hex\n" \ - " %l Maximum length of filenames\n" \ - " %n File name\n" \ - " %s Block size (for faster transfer)\n" \ - " %S Fundamental block size (for block counts)\n" \ - " %t Type in hex\n" \ - " %T Type in human readable form" \ - ) \ - #define strings_trivial_usage \ "[-afo] [-n LEN] [FILE]..." #define strings_full_usage "\n\n" \ @@ -3131,17 +2278,6 @@ INSERT "\n -n LEN At least LEN characters form a string (default 4)" \ "\n -o Precede strings with decimal offsets" \ -#define stty_trivial_usage \ - "[-a|g] [-F DEVICE] [SETTING]..." -#define stty_full_usage "\n\n" \ - "Without arguments, prints baud rate, line discipline,\n" \ - "and deviations from stty sane\n" \ - "\nOptions:" \ - "\n -F DEVICE Open device instead of stdin" \ - "\n -a Print all current settings in human-readable form" \ - "\n -g Print in stty-readable form" \ - "\n [SETTING] See manpage" \ - #define sulogin_trivial_usage \ "[-t N] [TTY]" #define sulogin_full_usage "\n\n" \ @@ -3149,14 +2285,6 @@ INSERT "\nOptions:" \ "\n -t N Timeout" \ -#define sum_trivial_usage \ - "[-rs] [FILE]..." -#define sum_full_usage "\n\n" \ - "Checksum and count the blocks in a file\n" \ - "\nOptions:" \ - "\n -r Use BSD sum algorithm (1K blocks)" \ - "\n -s Use System V sum algorithm (512byte blocks)" \ - #define sv_trivial_usage \ "[-v] [-w SEC] CMD SERVICE_DIR..." #define sv_full_usage "\n\n" \ @@ -3199,18 +2327,6 @@ INSERT "\nOptions:" \ "\n -c DEV Reopen stdio to DEV after switch" \ -#define sync_trivial_usage \ - "" -#define sync_full_usage "\n\n" \ - "Write all buffered blocks to disk" - -#define fsync_trivial_usage \ - "[-d] FILE..." -#define fsync_full_usage "\n\n" \ - "Write files' buffered blocks to disk\n" \ - "\nOptions:" \ - "\n -d Avoid syncing metadata" - #define sysctl_trivial_usage \ "[OPTIONS] [VALUE]..." #define sysctl_full_usage "\n\n" \ @@ -3257,11 +2373,6 @@ INSERT "$ syslogd -R masterlog:514\n" \ "$ syslogd -R 192.168.1.1:601\n" -#define tac_trivial_usage \ - "[FILE]..." -#define tac_full_usage "\n\n" \ - "Concatenate FILEs and print them in reverse" - #define taskset_trivial_usage \ "[-p] [MASK] [PID | PROG ARGS]" #define taskset_full_usage "\n\n" \ @@ -3280,19 +2391,6 @@ INSERT "$ taskset -p 1\n" \ "pid 1's current affinity mask: 3\n" -#define tee_trivial_usage \ - "[-ai] [FILE]..." -#define tee_full_usage "\n\n" \ - "Copy stdin to each FILE, and also to stdout\n" \ - "\nOptions:" \ - "\n -a Append to the given FILEs, don't overwrite" \ - "\n -i Ignore interrupt signals (SIGINT)" \ - -#define tee_example_usage \ - "$ echo \"Hello\" | tee /tmp/foo\n" \ - "$ cat /tmp/foo\n" \ - "Hello\n" - #if ENABLE_FEATURE_TELNET_AUTOLOGIN #define telnet_trivial_usage \ "[-a] [-l USER] HOST [PORT]" @@ -3330,28 +2428,6 @@ INSERT ) \ ) -/* "test --help" does not print help (POSIX compat), only "[ --help" does. - * We display " EXPRESSION ]" here (not " EXPRESSION") - * Unfortunately, it screws up generated BusyBox.html. TODO. */ -#define test_trivial_usage \ - "EXPRESSION ]" -#define test_full_usage "\n\n" \ - "Check file types, compare values etc. Return a 0/1 exit code\n" \ - "depending on logical value of EXPRESSION" -#define test_example_usage \ - "$ test 1 -eq 2\n" \ - "$ echo $?\n" \ - "1\n" \ - "$ test 1 -eq 1\n" \ - "$ echo $?\n" \ - "0\n" \ - "$ [ -d /etc ]\n" \ - "$ echo $?\n" \ - "0\n" \ - "$ [ -d /junk ]\n" \ - "$ echo $?\n" \ - "1\n" - #define tc_trivial_usage \ /*"[OPTIONS] "*/"OBJECT CMD [dev STRING]" #define tc_full_usage "\n\n" \ @@ -3454,19 +2530,6 @@ INSERT "Runs PROG. Sends SIG to it if it is not gone in SECS seconds.\n" \ "Defaults: SECS: 10, SIG: TERM." \ -#define tr_trivial_usage \ - "[-cds] STRING1 [STRING2]" -#define tr_full_usage "\n\n" \ - "Translate, squeeze, or delete characters from stdin, writing to stdout\n" \ - "\nOptions:" \ - "\n -c Take complement of STRING1" \ - "\n -d Delete input characters coded STRING1" \ - "\n -s Squeeze multiple output characters of STRING2 into one character" \ - -#define tr_example_usage \ - "$ echo \"gdkkn vnqkc\" | tr [a-y] [b-z]\n" \ - "hello world\n" - #define traceroute_trivial_usage \ "[-"IF_TRACEROUTE6("46")"FIldnrv] [-f 1ST_TTL] [-m MAXTTL] [-p PORT] [-q PROBES]\n" \ " [-s SRC_IP] [-t TOS] [-w WAIT_SEC] [-g GATEWAY] [-i IFACE]\n" \ @@ -3512,27 +2575,6 @@ INSERT "\n -t Type-of-service in probe packets (default 0)" \ "\n -w Time in seconds to wait for a response (default 3)" \ -#define true_trivial_usage \ - "" -#define true_full_usage "\n\n" \ - "Return an exit code of TRUE (0)" -#define true_example_usage \ - "$ true\n" \ - "$ echo $?\n" \ - "0\n" - -#define tty_trivial_usage \ - "" -#define tty_full_usage "\n\n" \ - "Print file name of stdin's terminal" \ - IF_INCLUDE_SUSv2( "\n" \ - "\nOptions:" \ - "\n -s Print nothing, only return exit status" \ - ) -#define tty_example_usage \ - "$ tty\n" \ - "/dev/tty2\n" - #define ttysize_trivial_usage \ "[w] [h]" #define ttysize_full_usage "\n\n" \ @@ -3587,57 +2629,6 @@ INSERT #define umount_example_usage \ "$ umount /dev/hdc1\n" -#define uname_trivial_usage \ - "[-amnrspv]" -#define uname_full_usage "\n\n" \ - "Print system information\n" \ - "\nOptions:" \ - "\n -a Print all" \ - "\n -m The machine (hardware) type" \ - "\n -n Hostname" \ - "\n -r OS release" \ - "\n -s OS name (default)" \ - "\n -p Processor type" \ - "\n -v OS version" \ - -#define uname_example_usage \ - "$ uname -a\n" \ - "Linux debian 2.4.23 #2 Tue Dec 23 17:09:10 MST 2003 i686 GNU/Linux\n" - -#define unexpand_trivial_usage \ - "[-fa][-t N] [FILE]..." -#define unexpand_full_usage "\n\n" \ - "Convert spaces to tabs, writing to stdout\n" \ - "\nOptions:" \ - IF_FEATURE_UNEXPAND_LONG_OPTIONS( \ - "\n -a,--all Convert all blanks" \ - "\n -f,--first-only Convert only leading blanks" \ - "\n -t,--tabs=N Tabstops every N chars" \ - ) \ - IF_NOT_FEATURE_UNEXPAND_LONG_OPTIONS( \ - "\n -a Convert all blanks" \ - "\n -f Convert only leading blanks" \ - "\n -t N Tabstops every N chars" \ - ) - -#define uniq_trivial_usage \ - "[-cdu][-f,s,w N] [INPUT [OUTPUT]]" -#define uniq_full_usage "\n\n" \ - "Discard duplicate lines\n" \ - "\nOptions:" \ - "\n -c Prefix lines by the number of occurrences" \ - "\n -d Only print duplicate lines" \ - "\n -u Only print unique lines" \ - "\n -f N Skip first N fields" \ - "\n -s N Skip first N chars (after any skipped fields)" \ - "\n -w N Compare N characters in line" \ - -#define uniq_example_usage \ - "$ echo -e \"a\\na\\nb\\nc\\nc\\na\" | sort | uniq\n" \ - "a\n" \ - "b\n" \ - "c\n" - #define uptime_trivial_usage \ "" #define uptime_full_usage "\n\n" \ @@ -3647,40 +2638,6 @@ INSERT "$ uptime\n" \ " 1:55pm up 2:30, load average: 0.09, 0.04, 0.00\n" -#define usleep_trivial_usage \ - "N" -#define usleep_full_usage "\n\n" \ - "Pause for N microseconds" - -#define usleep_example_usage \ - "$ usleep 1000000\n" \ - "[pauses for 1 second]\n" - -#define uudecode_trivial_usage \ - "[-o OUTFILE] [INFILE]" -#define uudecode_full_usage "\n\n" \ - "Uudecode a file\n" \ - "Finds outfile name in uuencoded source unless -o is given" - -#define uudecode_example_usage \ - "$ uudecode -o busybox busybox.uu\n" \ - "$ ls -l busybox\n" \ - "-rwxr-xr-x 1 ams ams 245264 Jun 7 21:35 busybox\n" - -#define uuencode_trivial_usage \ - "[-m] [INFILE] STORED_FILENAME" -#define uuencode_full_usage "\n\n" \ - "Uuencode a file to stdout\n" \ - "\nOptions:" \ - "\n -m Use base64 encoding per RFC1521" \ - -#define uuencode_example_usage \ - "$ uuencode busybox busybox\n" \ - "begin 755 busybox\n" \ - "\n" \ - "$ uudecode busybox busybox > busybox.uu\n" \ - "$\n" - #define vconfig_trivial_usage \ "COMMAND [OPTIONS]" #define vconfig_full_usage "\n\n" \ @@ -3759,18 +2716,6 @@ INSERT "$ which login\n" \ "/bin/login\n" -#define who_trivial_usage \ - "[-a]" -#define who_full_usage "\n\n" \ - "Show who is logged on\n" \ - "\nOptions:" \ - "\n -a Show all" \ - -#define whoami_trivial_usage \ - "" -#define whoami_full_usage "\n\n" \ - "Print the user name associated with the current effective user id" - #define zcip_trivial_usage \ "[OPTIONS] IFACE SCRIPT" #define zcip_full_usage "\n\n" \ -- cgit v1.2.3-55-g6feb From fa9126e68904b16aee2a0fc47688ffe17403152a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 3 Apr 2011 01:27:49 +0200 Subject: ls: better help text for -a and -A Signed-off-by: Denys Vlasenko --- coreutils/ls.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/coreutils/ls.c b/coreutils/ls.c index 847fdec07..217321933 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -43,9 +43,9 @@ //usage:#define ls_full_usage "\n\n" //usage: "List directory contents\n" //usage: "\nOptions:" -//usage: "\n -1 List in a single column" -//usage: "\n -A Don't list . and .." -//usage: "\n -a Don't hide entries starting with ." +//usage: "\n -1 One column output" +//usage: "\n -a Include entries which start with ." +//usage: "\n -A Like -a, but exclude . and .." //usage: "\n -C List by columns" //usage: "\n -x List by lines" //usage: "\n -d List directory entries instead of contents" @@ -63,7 +63,7 @@ //usage: "\n -l Long listing format" //usage: "\n -i List inode numbers" //usage: "\n -n List numeric UIDs and GIDs instead of names" -//usage: "\n -s List the size of each file, in blocks" +//usage: "\n -s List allocated blocks" //usage: IF_FEATURE_LS_TIMESTAMPS( //usage: "\n -e List full date and time" //usage: ) @@ -72,14 +72,14 @@ //usage: ) //usage: IF_FEATURE_LS_SORTFILES( //usage: "\n -r Sort in reverse order" -//usage: "\n -S Sort by file size" +//usage: "\n -S Sort by size" //usage: "\n -X Sort by extension" //usage: "\n -v Sort by version" //usage: ) //usage: IF_FEATURE_LS_TIMESTAMPS( //usage: "\n -c With -l: sort by ctime" -//usage: "\n -t With -l: sort by modification time" -//usage: "\n -u With -l: sort by access time" +//usage: "\n -t With -l: sort by mtime" +//usage: "\n -u With -l: sort by atime" //usage: ) //usage: IF_SELINUX( //usage: "\n -k List security context" -- cgit v1.2.3-55-g6feb From 6a3e01d5a9f979f7d6e52665c2bf6c74e2592980 Mon Sep 17 00:00:00 2001 From: Pere Orga Date: Fri, 1 Apr 2011 22:56:30 +0200 Subject: move help text from include/usage.src.h to debianutils/*.c e2fsprogs/*.c editors/*.c loginutils/*.c mailutils/*.c Signed-off-by: Pere Orga Signed-off-by: Denys Vlasenko --- coreutils/length.c.disabled | 9 + debianutils/pipe_progress.c | 4 + debianutils/run_parts.c | 26 +++ debianutils/start_stop_daemon.c | 63 +++++++ debianutils/which.c | 9 + e2fsprogs/chattr.c | 24 +++ e2fsprogs/fsck.c | 14 ++ e2fsprogs/lsattr.c | 11 ++ editors/awk.c | 8 + editors/cmp.c | 9 + editors/diff.c | 22 +++ editors/ed.c | 3 + editors/sed.c | 17 ++ editors/vi.c | 13 ++ include/usage.src.h | 400 ---------------------------------------- loginutils/addgroup.c | 9 + loginutils/adduser.c | 15 ++ loginutils/chpasswd.c | 14 ++ loginutils/cryptpw.c | 39 ++++ loginutils/deluser.c | 12 ++ loginutils/login.c | 10 + loginutils/passwd.c | 12 ++ loginutils/sulogin.c | 7 + loginutils/vlock.c | 7 + mailutils/mime.c | 27 +++ mailutils/popmaildir.c | 34 ++++ 26 files changed, 418 insertions(+), 400 deletions(-) diff --git a/coreutils/length.c.disabled b/coreutils/length.c.disabled index 7f0b48ccd..aee898d22 100644 --- a/coreutils/length.c.disabled +++ b/coreutils/length.c.disabled @@ -5,6 +5,15 @@ /* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */ +//usage:#define length_trivial_usage +//usage: "STRING" +//usage:#define length_full_usage "\n\n" +//usage: "Print STRING's length" +//usage: +//usage:#define length_example_usage +//usage: "$ length Hello\n" +//usage: "5\n" + #include "libbb.h" /* This is a NOFORK applet. Be very careful! */ diff --git a/debianutils/pipe_progress.c b/debianutils/pipe_progress.c index 1e57dc241..2c7444f31 100644 --- a/debianutils/pipe_progress.c +++ b/debianutils/pipe_progress.c @@ -6,6 +6,10 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define pipe_progress_trivial_usage NOUSAGE_STR +//usage:#define pipe_progress_full_usage "" + #include "libbb.h" #define PIPE_PROGRESS_SIZE 4096 diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c index b93a5a917..0c2302696 100644 --- a/debianutils/run_parts.c +++ b/debianutils/run_parts.c @@ -30,6 +30,32 @@ * -u MASK umask. Set the umask of the program executed to MASK. */ +//usage:#define run_parts_trivial_usage +//usage: "[-t] "IF_FEATURE_RUN_PARTS_FANCY("[-l] ")"[-a ARG] [-u MASK] DIRECTORY" +//usage:#define run_parts_full_usage "\n\n" +//usage: "Run a bunch of scripts in DIRECTORY\n" +//usage: "\nOptions:" +//usage: "\n -t Print what would be run, but don't actually run anything" +//usage: "\n -a ARG Pass ARG as argument for every program" +//usage: "\n -u MASK Set the umask to MASK before running every program" +//usage: IF_FEATURE_RUN_PARTS_FANCY( +//usage: "\n -l Print names of all matching files even if they are not executable" +//usage: ) +//usage: +//usage:#define run_parts_example_usage +//usage: "$ run-parts -a start /etc/init.d\n" +//usage: "$ run-parts -a stop=now /etc/init.d\n\n" +//usage: "Let's assume you have a script foo/dosomething:\n" +//usage: "#!/bin/sh\n" +//usage: "for i in $*; do eval $i; done; unset i\n" +//usage: "case \"$1\" in\n" +//usage: "start*) echo starting something;;\n" +//usage: "stop*) set -x; shutdown -h $stop;;\n" +//usage: "esac\n\n" +//usage: "Running this yields:\n" +//usage: "$run-parts -a stop=+4m foo/\n" +//usage: "+ shutdown -h +4m" + #include "libbb.h" struct globals { diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index d2ee95068..30dd9709d 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c @@ -56,6 +56,69 @@ Misc options: -v,--verbose Verbose */ +//usage:#define start_stop_daemon_trivial_usage +//usage: "[OPTIONS] [-S|-K] ... [-- ARGS...]" +//usage:#define start_stop_daemon_full_usage "\n\n" +//usage: "Search for matching processes, and then\n" +//usage: "-K: stop all matching processes.\n" +//usage: "-S: start a process unless a matching process is found.\n" +//usage: IF_FEATURE_START_STOP_DAEMON_LONG_OPTIONS( +//usage: "\nProcess matching:" +//usage: "\n -u,--user USERNAME|UID Match only this user's processes" +//usage: "\n -n,--name NAME Match processes with NAME" +//usage: "\n in comm field in /proc/PID/stat" +//usage: "\n -x,--exec EXECUTABLE Match processes with this command" +//usage: "\n in /proc/PID/cmdline" +//usage: "\n -p,--pidfile FILE Match a process with PID from the file" +//usage: "\n All specified conditions must match" +//usage: "\n-S only:" +//usage: "\n -x,--exec EXECUTABLE Program to run" +//usage: "\n -a,--startas NAME Zeroth argument" +//usage: "\n -b,--background Background" +//usage: IF_FEATURE_START_STOP_DAEMON_FANCY( +//usage: "\n -N,--nicelevel N Change nice level" +//usage: ) +//usage: "\n -c,--chuid USER[:[GRP]] Change to user/group" +//usage: "\n -m,--make-pidfile Write PID to the pidfile specified by -p" +//usage: "\n-K only:" +//usage: "\n -s,--signal SIG Signal to send" +//usage: "\n -t,--test Match only, exit with 0 if a process is found" +//usage: "\nOther:" +//usage: IF_FEATURE_START_STOP_DAEMON_FANCY( +//usage: "\n -o,--oknodo Exit with status 0 if nothing is done" +//usage: "\n -v,--verbose Verbose" +//usage: ) +//usage: "\n -q,--quiet Quiet" +//usage: ) +//usage: IF_NOT_FEATURE_START_STOP_DAEMON_LONG_OPTIONS( +//usage: "\nProcess matching:" +//usage: "\n -u USERNAME|UID Match only this user's processes" +//usage: "\n -n NAME Match processes with NAME" +//usage: "\n in comm field in /proc/PID/stat" +//usage: "\n -x EXECUTABLE Match processes with this command" +//usage: "\n command in /proc/PID/cmdline" +//usage: "\n -p FILE Match a process with PID from the file" +//usage: "\n All specified conditions must match" +//usage: "\n-S only:" +//usage: "\n -x EXECUTABLE Program to run" +//usage: "\n -a NAME Zeroth argument" +//usage: "\n -b Background" +//usage: IF_FEATURE_START_STOP_DAEMON_FANCY( +//usage: "\n -N N Change nice level" +//usage: ) +//usage: "\n -c USER[:[GRP]] Change to user/group" +//usage: "\n -m Write PID to the pidfile specified by -p" +//usage: "\n-K only:" +//usage: "\n -s SIG Signal to send" +//usage: "\n -t Match only, exit with 0 if a process is found" +//usage: "\nOther:" +//usage: IF_FEATURE_START_STOP_DAEMON_FANCY( +//usage: "\n -o Exit with status 0 if nothing is done" +//usage: "\n -v Verbose" +//usage: ) +//usage: "\n -q Quiet" +//usage: ) + #include /* Override ENABLE_FEATURE_PIDFILE */ diff --git a/debianutils/which.c b/debianutils/which.c index a82641909..15fd598b7 100644 --- a/debianutils/which.c +++ b/debianutils/which.c @@ -10,6 +10,15 @@ * Based on which from debianutils */ +//usage:#define which_trivial_usage +//usage: "[COMMAND]..." +//usage:#define which_full_usage "\n\n" +//usage: "Locate a COMMAND" +//usage: +//usage:#define which_example_usage +//usage: "$ which login\n" +//usage: "/bin/login\n" + #include "libbb.h" int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c index ab52cb009..b1c77faad 100644 --- a/e2fsprogs/chattr.c +++ b/e2fsprogs/chattr.c @@ -19,6 +19,30 @@ * 98/12/29 - Display version info only when -V specified (G M Sipe) */ +//usage:#define chattr_trivial_usage +//usage: "[-R] [-+=AacDdijsStTu] [-v VERSION] [FILE]..." +//usage:#define chattr_full_usage "\n\n" +//usage: "Change file attributes on an ext2 fs\n" +//usage: "\nModifiers:" +//usage: "\n - Remove attributes" +//usage: "\n + Add attributes" +//usage: "\n = Set attributes" +//usage: "\nAttributes:" +//usage: "\n A Don't track atime" +//usage: "\n a Append mode only" +//usage: "\n c Enable compress" +//usage: "\n D Write dir contents synchronously" +//usage: "\n d Don't backup with dump" +//usage: "\n i Cannot be modified (immutable)" +//usage: "\n j Write all data to journal first" +//usage: "\n s Zero disk storage when deleted" +//usage: "\n S Write file contents synchronously" +//usage: "\n t Disable tail-merging of partial blocks with other files" +//usage: "\n u Allow file to be undeleted" +//usage: "\nOptions:" +//usage: "\n -R Recurse" +//usage: "\n -v Set the file's version/generation number" + #include "libbb.h" #include "e2fs_lib.h" diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index a86a9d96f..b4257a2ad 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -34,6 +34,20 @@ * It doesn't guess filesystem types from on-disk format. */ +//usage:#define fsck_trivial_usage +//usage: "[-ANPRTV] [-C FD] [-t FSTYPE] [FS_OPTS] [BLOCKDEV]..." +//usage:#define fsck_full_usage "\n\n" +//usage: "Check and repair filesystems\n" +//usage: "\nOptions:" +//usage: "\n -A Walk /etc/fstab and check all filesystems" +//usage: "\n -N Don't execute, just show what would be done" +//usage: "\n -P With -A, check filesystems in parallel" +//usage: "\n -R With -A, skip the root filesystem" +//usage: "\n -T Don't show title on startup" +//usage: "\n -V Verbose" +//usage: "\n -C n Write status information to specified filedescriptor" +//usage: "\n -t TYPE List of filesystem types to check" + #include "libbb.h" /* "progress indicator" code is somewhat buggy and ext[23] specific. diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c index 7d475a969..964e8d026 100644 --- a/e2fsprogs/lsattr.c +++ b/e2fsprogs/lsattr.c @@ -18,6 +18,17 @@ * 98/12/29 - Display version info only when -V specified (G M Sipe) */ +//usage:#define lsattr_trivial_usage +//usage: "[-Radlv] [FILE]..." +//usage:#define lsattr_full_usage "\n\n" +//usage: "List file attributes on an ext2 fs\n" +//usage: "\nOptions:" +//usage: "\n -R Recurse" +//usage: "\n -a Don't hide entries starting with ." +//usage: "\n -d List directory entries instead of contents" +//usage: "\n -l List long flag names" +//usage: "\n -v List the file's version/generation number" + #include "libbb.h" #include "e2fs_lib.h" diff --git a/editors/awk.c b/editors/awk.c index 2eeb9d77a..9d38b1f88 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -7,6 +7,14 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define awk_trivial_usage +//usage: "[OPTIONS] [AWK_PROGRAM] [FILE]..." +//usage:#define awk_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -v VAR=VAL Set variable" +//usage: "\n -F SEP Use SEP as field separator" +//usage: "\n -f FILE Read program from FILE" + #include "libbb.h" #include "xregex.h" #include diff --git a/editors/cmp.c b/editors/cmp.c index f84a56e3e..3a0f5aa4f 100644 --- a/editors/cmp.c +++ b/editors/cmp.c @@ -10,6 +10,15 @@ /* BB_AUDIT SUSv3 (virtually) compliant -- uses nicer GNU format for -l. */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/cmp.html */ +//usage:#define cmp_trivial_usage +//usage: "[-l] [-s] FILE1 [FILE2" IF_DESKTOP(" [SKIP1 [SKIP2]]") "]" +//usage:#define cmp_full_usage "\n\n" +//usage: "Compare FILE1 with FILE2 (or stdin)\n" +//usage: "\nOptions:" +//usage: "\n -l Write the byte numbers (decimal) and values (octal)" +//usage: "\n for all differing bytes" +//usage: "\n -s Quiet" + #include "libbb.h" static const char fmt_eof[] ALIGN1 = "cmp: EOF on %s\n"; diff --git a/editors/diff.c b/editors/diff.c index 3719bb49f..daa58af9b 100644 --- a/editors/diff.c +++ b/editors/diff.c @@ -76,6 +76,28 @@ * 6n words for files of length n. */ +//usage:#define diff_trivial_usage +//usage: "[-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2" +//usage:#define diff_full_usage "\n\n" +//usage: "Compare files line by line and output the differences between them.\n" +//usage: "This implementation supports unified diffs only.\n" +//usage: "\nOptions:" +//usage: "\n -a Treat all files as text" +//usage: "\n -b Ignore changes in the amount of whitespace" +//usage: "\n -B Ignore changes whose lines are all blank" +//usage: "\n -d Try hard to find a smaller set of changes" +//usage: "\n -i Ignore case differences" +//usage: "\n -L Use LABEL instead of the filename in the unified header" +//usage: "\n -N Treat absent files as empty" +//usage: "\n -q Output only whether files differ" +//usage: "\n -r Recurse" +//usage: "\n -S Start with FILE when comparing directories" +//usage: "\n -T Make tabs line up by prefixing a tab when necessary" +//usage: "\n -s Report when two files are the same" +//usage: "\n -t Expand tabs to spaces in output" +//usage: "\n -U Output LINES lines of context" +//usage: "\n -w Ignore all whitespace" + #include "libbb.h" #if 0 diff --git a/editors/ed.c b/editors/ed.c index b1b6a8d27..41ac88c32 100644 --- a/editors/ed.c +++ b/editors/ed.c @@ -7,6 +7,9 @@ * The "ed" built-in command (much simplified) */ +//usage:#define ed_trivial_usage "" +//usage:#define ed_full_usage "" + #include "libbb.h" typedef struct LINE { diff --git a/editors/sed.c b/editors/sed.c index d3555243f..9ab758bd7 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -58,6 +58,23 @@ Reference http://www.opengroup.org/onlinepubs/007904975/utilities/sed.html */ +//usage:#define sed_trivial_usage +//usage: "[-efinr] SED_CMD [FILE]..." +//usage:#define sed_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -e CMD Add CMD to sed commands to be executed" +//usage: "\n -f FILE Add FILE contents to sed commands to be executed" +//usage: "\n -i Edit files in-place (else sends result to stdout)" +//usage: "\n -n Suppress automatic printing of pattern space" +//usage: "\n -r Use extended regex syntax" +//usage: "\n" +//usage: "\nIf no -e or -f, the first non-option argument is the sed command string." +//usage: "\nRemaining arguments are input files (stdin if none)." +//usage: +//usage:#define sed_example_usage +//usage: "$ echo \"foo\" | sed -e 's/f[a-zA-Z]o/bar/g'\n" +//usage: "bar\n" + #include "libbb.h" #include "xregex.h" diff --git a/editors/vi.c b/editors/vi.c index 602fc61d9..fd8bd0f78 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -21,6 +21,19 @@ * An "ex" line oriented mode- maybe using "cmdedit" */ +//usage:#define vi_trivial_usage +//usage: "[OPTIONS] [FILE]..." +//usage:#define vi_full_usage "\n\n" +//usage: "Edit FILE\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_VI_COLON( +//usage: "\n -c Initial command to run ($EXINIT also available)" +//usage: ) +//usage: IF_FEATURE_VI_READONLY( +//usage: "\n -R Read-only" +//usage: ) +//usage: "\n -H Short help regarding available features" + #include "libbb.h" /* the CRASHME code is unmaintained, and doesn't currently build */ diff --git a/include/usage.src.h b/include/usage.src.h index d8360931f..2c88c46a1 100644 --- a/include/usage.src.h +++ b/include/usage.src.h @@ -40,28 +40,6 @@ INSERT "# acpid -l /var/log/my-acpi-log\n" \ "# acpid -e /proc/acpi/event\n" -#define addgroup_trivial_usage \ - "[-g GID] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP" -#define addgroup_full_usage "\n\n" \ - "Add a group " IF_FEATURE_ADDUSER_TO_GROUP("or add a user to a group") "\n" \ - "\nOptions:" \ - "\n -g GID Group id" \ - "\n -S Create a system group" \ - -#define adduser_trivial_usage \ - "[OPTIONS] USER" -#define adduser_full_usage "\n\n" \ - "Add a user\n" \ - "\nOptions:" \ - "\n -h DIR Home directory" \ - "\n -g GECOS GECOS field" \ - "\n -s SHELL Login shell" \ - "\n -G GRP Add user to existing group" \ - "\n -S Create a system user" \ - "\n -D Don't assign a password" \ - "\n -H Don't create home directory" \ - "\n -u UID User id" \ - #define adjtimex_trivial_usage \ "[-q] [-o OFF] [-f FREQ] [-p TCONST] [-t TICK]" #define adjtimex_full_usage "\n\n" \ @@ -110,14 +88,6 @@ INSERT "\n -s SRC_IP Sender IP address" \ "\n DST_IP Target IP address" \ -#define awk_trivial_usage \ - "[OPTIONS] [AWK_PROGRAM] [FILE]..." -#define awk_full_usage "\n\n" \ - "Options:" \ - "\n -v VAR=VAL Set variable" \ - "\n -F SEP Use SEP as field separator" \ - "\n -f FILE Read program from FILE" \ - #define beep_trivial_usage \ "-f FREQ -l LEN -d DELAY -r COUNT -n" #define beep_full_usage "\n\n" \ @@ -167,30 +137,6 @@ INSERT "each pair is a pair of arguments. Example:\n" \ "chat '' ATZ OK ATD123456 CONNECT '' ogin: pppuser word: ppppass '~'" \ -#define chattr_trivial_usage \ - "[-R] [-+=AacDdijsStTu] [-v VERSION] [FILE]..." -#define chattr_full_usage "\n\n" \ - "Change file attributes on an ext2 fs\n" \ - "\nModifiers:" \ - "\n - Remove attributes" \ - "\n + Add attributes" \ - "\n = Set attributes" \ - "\nAttributes:" \ - "\n A Don't track atime" \ - "\n a Append mode only" \ - "\n c Enable compress" \ - "\n D Write dir contents synchronously" \ - "\n d Don't backup with dump" \ - "\n i Cannot be modified (immutable)" \ - "\n j Write all data to journal first" \ - "\n s Zero disk storage when deleted" \ - "\n S Write file contents synchronously" \ - "\n t Disable tail-merging of partial blocks with other files" \ - "\n u Allow file to be undeleted" \ - "\nOptions:" \ - "\n -R Recurse" \ - "\n -v Set the file's version/generation number" \ - #define chcon_trivial_usage \ "[OPTIONS] CONTEXT FILE..." \ "\n chcon [OPTIONS] [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE..." \ @@ -284,15 +230,6 @@ INSERT "\n -t N Limit CPU time, process receives" \ "\n a SIGXCPU after N seconds" \ -#define cmp_trivial_usage \ - "[-l] [-s] FILE1 [FILE2" IF_DESKTOP(" [SKIP1 [SKIP2]]") "]" -#define cmp_full_usage "\n\n" \ - "Compare FILE1 with FILE2 (or stdin)\n" \ - "\nOptions:" \ - "\n -l Write the byte numbers (decimal) and values (octal)" \ - "\n for all differing bytes" \ - "\n -s Quiet" \ - #define bbconfig_trivial_usage \ "" #define bbconfig_full_usage "\n\n" \ @@ -355,57 +292,6 @@ INSERT "\n -r Delete crontab" \ "\n FILE Replace crontab by FILE ('-': stdin)" \ -#define cryptpw_trivial_usage \ - "[OPTIONS] [PASSWORD] [SALT]" -/* We do support -s, we just don't mention it */ -#define cryptpw_full_usage "\n\n" \ - "Crypt the PASSWORD using crypt(3)\n" \ - "\nOptions:" \ - IF_LONG_OPTS( \ - "\n -P,--password-fd=N Read password from fd N" \ -/* "\n -s,--stdin Use stdin; like -P0" */ \ - "\n -m,--method=TYPE Encryption method TYPE" \ - "\n -S,--salt=SALT" \ - ) \ - IF_NOT_LONG_OPTS( \ - "\n -P N Read password from fd N" \ -/* "\n -s Use stdin; like -P0" */ \ - "\n -m TYPE Encryption method TYPE" \ - "\n -S SALT" \ - ) \ - -/* mkpasswd is an alias to cryptpw */ - -#define mkpasswd_trivial_usage \ - "[OPTIONS] [PASSWORD] [SALT]" -/* We do support -s, we just don't mention it */ -#define mkpasswd_full_usage "\n\n" \ - "Crypt the PASSWORD using crypt(3)\n" \ - "\nOptions:" \ - IF_LONG_OPTS( \ - "\n -P,--password-fd=N Read password from fd N" \ -/* "\n -s,--stdin Use stdin; like -P0" */ \ - "\n -m,--method=TYPE Encryption method TYPE" \ - "\n -S,--salt=SALT" \ - ) \ - IF_NOT_LONG_OPTS( \ - "\n -P N Read password from fd N" \ -/* "\n -s Use stdin; like -P0" */ \ - "\n -m TYPE Encryption method TYPE" \ - "\n -S SALT" \ - ) \ - -#define delgroup_trivial_usage \ - IF_FEATURE_DEL_USER_FROM_GROUP("[USER] ")"GROUP" -#define delgroup_full_usage "\n\n" \ - "Delete group GROUP from the system" \ - IF_FEATURE_DEL_USER_FROM_GROUP(" or user USER from group GROUP") - -#define deluser_trivial_usage \ - "USER" -#define deluser_full_usage "\n\n" \ - "Delete USER from the system" - #define devmem_trivial_usage \ "ADDRESS [WIDTH [VALUE]]" @@ -435,28 +321,6 @@ INSERT #define dhcprelay_full_usage "\n\n" \ "Relay DHCP requests between clients and server" \ -#define diff_trivial_usage \ - "[-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2" -#define diff_full_usage "\n\n" \ - "Compare files line by line and output the differences between them.\n" \ - "This implementation supports unified diffs only.\n" \ - "\nOptions:" \ - "\n -a Treat all files as text" \ - "\n -b Ignore changes in the amount of whitespace" \ - "\n -B Ignore changes whose lines are all blank" \ - "\n -d Try hard to find a smaller set of changes" \ - "\n -i Ignore case differences" \ - "\n -L Use LABEL instead of the filename in the unified header" \ - "\n -N Treat absent files as empty" \ - "\n -q Output only whether files differ" \ - "\n -r Recurse" \ - "\n -S Start with FILE when comparing directories" \ - "\n -T Make tabs line up by prefixing a tab when necessary" \ - "\n -s Report when two files are the same" \ - "\n -t Expand tabs to spaces in output" \ - "\n -U Output LINES lines of context" \ - "\n -w Ignore all whitespace" \ - #define dmesg_trivial_usage \ "[-c] [-n LEVEL] [-s SIZE]" #define dmesg_full_usage "\n\n" \ @@ -531,9 +395,6 @@ INSERT "\n -t Close tray" \ "\n -T Open/close tray (toggle)" \ -#define ed_trivial_usage "" -#define ed_full_usage "" - #define ether_wake_trivial_usage \ "[-b] [-i iface] [-p aa:bb:cc:dd[:ee:ff]] MAC" #define ether_wake_full_usage "\n\n" \ @@ -679,20 +540,6 @@ INSERT #define freeramdisk_example_usage \ "$ freeramdisk /dev/ram2\n" -#define fsck_trivial_usage \ - "[-ANPRTV] [-C FD] [-t FSTYPE] [FS_OPTS] [BLOCKDEV]..." -#define fsck_full_usage "\n\n" \ - "Check and repair filesystems\n" \ - "\nOptions:" \ - "\n -A Walk /etc/fstab and check all filesystems" \ - "\n -N Don't execute, just show what would be done" \ - "\n -P With -A, check filesystems in parallel" \ - "\n -R With -A, skip the root filesystem" \ - "\n -T Don't show title on startup" \ - "\n -V Verbose" \ - "\n -C n Write status information to specified filedescriptor" \ - "\n -t TYPE List of filesystem types to check" \ - #define fsck_minix_trivial_usage \ "[-larvsmf] BLOCKDEV" #define fsck_minix_full_usage "\n\n" \ @@ -1279,15 +1126,6 @@ INSERT #define logger_example_usage \ "$ logger \"hello\"\n" -#define login_trivial_usage \ - "[-p] [-h HOST] [[-f] USER]" -#define login_full_usage "\n\n" \ - "Begin a new session on the system\n" \ - "\nOptions:" \ - "\n -f Don't authenticate (user already authenticated)" \ - "\n -h Name of the remote host" \ - "\n -p Preserve environment" \ - #define logread_trivial_usage \ "[-f]" #define logread_full_usage "\n\n" \ @@ -1344,17 +1182,6 @@ INSERT "\n -h Print banner page too" \ "\n -V Verbose" \ -#define lsattr_trivial_usage \ - "[-Radlv] [FILE]..." -#define lsattr_full_usage "\n\n" \ - "List file attributes on an ext2 fs\n" \ - "\nOptions:" \ - "\n -R Recurse" \ - "\n -a Don't hide entries starting with ." \ - "\n -d List directory entries instead of contents" \ - "\n -l List long flag names" \ - "\n -v List the file's version/generation number" \ - #define lspci_trivial_usage \ "[-mk]" #define lspci_full_usage "\n\n" \ @@ -1424,21 +1251,6 @@ INSERT "/dev/hda[0-15]\n" #endif -#define makemime_trivial_usage \ - "[OPTIONS] [FILE]..." -#define makemime_full_usage "\n\n" \ - "Create multipart MIME-encoded message from FILEs\n" \ -/* "Transfer encoding is base64, disposition is inline (not attachment)\n" */ \ - "\nOptions:" \ - "\n -o FILE Output. Default: stdout" \ - "\n -a HDR Add header. Examples:" \ - "\n \"From: user@host.org\", \"Date: `date -R`\"" \ - "\n -c CT Content type. Default: text/plain" \ - "\n -C CS Charset. Default: " CONFIG_FEATURE_MIME_CHARSET \ -/* "\n -e ENC Transfer encoding. Ignored. base64 is assumed" */ \ - "\n" \ - "\nOther options are silently ignored" \ - #define man_trivial_usage \ "[-aw] [MANPAGE]..." #define man_full_usage "\n\n" \ @@ -1712,31 +1524,6 @@ INSERT #define parse_full_usage "" */ -#define passwd_trivial_usage \ - "[OPTIONS] [USER]" -#define passwd_full_usage "\n\n" \ - "Change USER's password. If no USER is specified,\n" \ - "changes the password for the current user.\n" \ - "\nOptions:" \ - "\n -a ALG Algorithm to use for password (des, md5)" /* ", sha1)" */ \ - "\n -d Delete password for the account" \ - "\n -l Lock (disable) account" \ - "\n -u Unlock (re-enable) account" \ - -#define chpasswd_trivial_usage \ - IF_LONG_OPTS("[--md5|--encrypted]") IF_NOT_LONG_OPTS("[-m|-e]") -#define chpasswd_full_usage "\n\n" \ - "Read user:password from stdin and update /etc/passwd\n" \ - "\nOptions:" \ - IF_LONG_OPTS( \ - "\n -e,--encrypted Supplied passwords are in encrypted form" \ - "\n -m,--md5 Use MD5 encryption instead of DES" \ - ) \ - IF_NOT_LONG_OPTS( \ - "\n -e Supplied passwords are in encrypted form" \ - "\n -m Use MD5 encryption instead of DES" \ - ) - #define pgrep_trivial_usage \ "[-flnovx] [-s SID|-P PPID|PATTERN]" #define pgrep_full_usage "\n\n" \ @@ -1779,9 +1566,6 @@ INSERT IF_FEATURE_PIDOF_OMIT( \ "$ pidof /bin/sh -o %PPID\n20351 5950") -#define pipe_progress_trivial_usage NOUSAGE_STR -#define pipe_progress_full_usage "" - #define pivot_root_trivial_usage \ "NEW_ROOT PUT_OLD" #define pivot_root_full_usage "\n\n" \ @@ -1802,38 +1586,6 @@ INSERT "\n -s Match session ID (0 for current)" \ "\n -P Match parent process ID" \ -#define popmaildir_trivial_usage \ - "[OPTIONS] MAILDIR [CONN_HELPER ARGS]" -#define popmaildir_full_usage "\n\n" \ - "Fetch content of remote mailbox to local maildir\n" \ - "\nOptions:" \ -/* "\n -b Binary mode. Ignored" */ \ -/* "\n -d Debug. Ignored" */ \ -/* "\n -m Show used memory. Ignored" */ \ -/* "\n -V Show version. Ignored" */ \ -/* "\n -c Use tcpclient. Ignored" */ \ -/* "\n -a Use APOP protocol. Implied. If server supports APOP -> use it" */ \ - "\n -s Skip authorization" \ - "\n -T Get messages with TOP instead of RETR" \ - "\n -k Keep retrieved messages on the server" \ - "\n -t SEC Network timeout" \ - IF_FEATURE_POPMAILDIR_DELIVERY( \ - "\n -F \"PROG ARGS\" Filter program (may be repeated)" \ - "\n -M \"PROG ARGS\" Delivery program" \ - ) \ - "\n" \ - "\nFetch from plain POP3 server:" \ - "\npopmaildir -k DIR nc pop3.server.com 110 = BYTES. Ignored" */ -/* "\n -Z N1-N2 Remove messages from N1 to N2 (dangerous). Ignored" */ -/* "\n -L BYTES Don't retrieve new messages >= BYTES. Ignored" */ -/* "\n -H LINES Type first LINES of a message. Ignored" */ -#define popmaildir_example_usage \ - "$ popmaildir -k ~/Maildir -- nc pop.drvv.ru 110 [ #include diff --git a/loginutils/passwd.c b/loginutils/passwd.c index f3928cecc..8b6a63eec 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c @@ -2,6 +2,18 @@ /* * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define passwd_trivial_usage +//usage: "[OPTIONS] [USER]" +//usage:#define passwd_full_usage "\n\n" +//usage: "Change USER's password. If no USER is specified,\n" +//usage: "changes the password for the current user.\n" +//usage: "\nOptions:" +//usage: "\n -a ALG Algorithm to use for password (des, md5)" /* ", sha1)" */ +//usage: "\n -d Delete password for the account" +//usage: "\n -l Lock (disable) account" +//usage: "\n -u Unlock (re-enable) account" + #include "libbb.h" #include diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index 0e5b59433..28edf067c 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c @@ -5,6 +5,13 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define sulogin_trivial_usage +//usage: "[-t N] [TTY]" +//usage:#define sulogin_full_usage "\n\n" +//usage: "Single user login\n" +//usage: "\nOptions:" +//usage: "\n -t N Timeout" + #include "libbb.h" #include diff --git a/loginutils/vlock.c b/loginutils/vlock.c index 3299afa50..efad63ff3 100644 --- a/loginutils/vlock.c +++ b/loginutils/vlock.c @@ -15,6 +15,13 @@ /* Fixed by Erik Andersen to do passwords the tinylogin way... * It now works with md5, sha1, etc passwords. */ +//usage:#define vlock_trivial_usage +//usage: "[-a]" +//usage:#define vlock_full_usage "\n\n" +//usage: "Lock a virtual terminal. A password is required to unlock.\n" +//usage: "\nOptions:" +//usage: "\n -a Lock all VTs" + #include "libbb.h" #ifdef __linux__ diff --git a/mailutils/mime.c b/mailutils/mime.c index 1e393ed31..0aff8b1d7 100644 --- a/mailutils/mime.c +++ b/mailutils/mime.c @@ -7,6 +7,33 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define makemime_trivial_usage +//usage: "[OPTIONS] [FILE]..." +//usage:#define makemime_full_usage "\n\n" +//usage: "Create multipart MIME-encoded message from FILEs\n" +/* //usage: "Transfer encoding is base64, disposition is inline (not attachment)\n" */ +//usage: "\nOptions:" +//usage: "\n -o FILE Output. Default: stdout" +//usage: "\n -a HDR Add header. Examples:" +//usage: "\n \"From: user@host.org\", \"Date: `date -R`\"" +//usage: "\n -c CT Content type. Default: text/plain" +//usage: "\n -C CS Charset. Default: " CONFIG_FEATURE_MIME_CHARSET +/* //usage: "\n -e ENC Transfer encoding. Ignored. base64 is assumed" */ +//usage: "\n" +//usage: "\nOther options are silently ignored" + +//usage:#define reformime_trivial_usage +//usage: "[OPTIONS] [FILE]..." +//usage:#define reformime_full_usage "\n\n" +//usage: "Parse MIME-encoded message\n" +//usage: "\nOptions:" +//usage: "\n -x PREFIX Extract content of MIME sections to files" +//usage: "\n -X PROG ARGS Filter content of MIME sections through PROG" +//usage: "\n Must be the last option" +//usage: "\n" +//usage: "\nOther options are silently ignored" + #include "libbb.h" #include "mail.h" diff --git a/mailutils/popmaildir.c b/mailutils/popmaildir.c index 6b733441f..642657919 100644 --- a/mailutils/popmaildir.c +++ b/mailutils/popmaildir.c @@ -9,6 +9,40 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define popmaildir_trivial_usage +//usage: "[OPTIONS] MAILDIR [CONN_HELPER ARGS]" +//usage:#define popmaildir_full_usage "\n\n" +//usage: "Fetch content of remote mailbox to local maildir\n" +//usage: "\nOptions:" +/* //usage: "\n -b Binary mode. Ignored" */ +/* //usage: "\n -d Debug. Ignored" */ +/* //usage: "\n -m Show used memory. Ignored" */ +/* //usage: "\n -V Show version. Ignored" */ +/* //usage: "\n -c Use tcpclient. Ignored" */ +/* //usage: "\n -a Use APOP protocol. Implied. If server supports APOP -> use it" */ +//usage: "\n -s Skip authorization" +//usage: "\n -T Get messages with TOP instead of RETR" +//usage: "\n -k Keep retrieved messages on the server" +//usage: "\n -t SEC Network timeout" +//usage: IF_FEATURE_POPMAILDIR_DELIVERY( +//usage: "\n -F \"PROG ARGS\" Filter program (may be repeated)" +//usage: "\n -M \"PROG ARGS\" Delivery program" +//usage: ) +//usage: "\n" +//usage: "\nFetch from plain POP3 server:" +//usage: "\npopmaildir -k DIR nc pop3.server.com 110 = BYTES. Ignored" */ +/* //usage: "\n -Z N1-N2 Remove messages from N1 to N2 (dangerous). Ignored" */ +/* //usage: "\n -L BYTES Don't retrieve new messages >= BYTES. Ignored" */ +/* //usage: "\n -H LINES Type first LINES of a message. Ignored" */ +//usage: +//usage:#define popmaildir_example_usage +//usage: "$ popmaildir -k ~/Maildir -- nc pop.drvv.ru 110 [ Date: Mon, 4 Apr 2011 02:03:35 +0200 Subject: start-stop-daemon: fix "-K --test --pidfile PIDFILE" exitcode Signed-off-by: Denys Vlasenko --- debianutils/start_stop_daemon.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index 30dd9709d..bc61959d2 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c @@ -337,11 +337,17 @@ static int do_stop(void) goto ret; } for (p = G.found_procs; p; p = p->next) { - if (TEST || kill(p->pid, signal_nr) == 0) { + if (kill(p->pid, TEST ? 0 : signal_nr) == 0) { killed++; } else { - p->pid = 0; bb_perror_msg("warning: killing process %u", (unsigned)p->pid); + p->pid = 0; + if (TEST) { + /* Example: -K --test --pidfile PIDFILE detected + * that PIDFILE's pid doesn't exist */ + killed = -1; + goto ret; + } } } if (!QUIET && killed) { -- cgit v1.2.3-55-g6feb From e32d05b708a31716e0a788c43f81990436535140 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 4 Apr 2011 02:12:14 +0200 Subject: ash,hush: add ulimit -e -r (RLIMIT_NICE, RLIMIT_RTPRIO) Signed-off-by: Denys Vlasenko --- shell/shell_common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/shell/shell_common.c b/shell/shell_common.c index f02ed81ea..68659abd3 100644 --- a/shell/shell_common.c +++ b/shell/shell_common.c @@ -286,6 +286,12 @@ static const struct limits limits_tbl[] = { #ifdef RLIMIT_LOCKS { RLIMIT_LOCKS, 0, 'w', "locks" }, #endif +#ifdef RLIMIT_NICE + { RLIMIT_NICE, 0, 'e', "scheduling priority" }, +#endif +#ifdef RLIMIT_RTPRIO + { RLIMIT_RTPRIO, 0, 'r', "real-time priority" }, +#endif }; enum { @@ -327,6 +333,12 @@ static const char ulimit_opt_string[] = "-HSa" #endif #ifdef RLIMIT_LOCKS "w::" +#endif +#ifdef RLIMIT_NICE + "e::" +#endif +#ifdef RLIMIT_RTPRIO + "r::" #endif ; -- cgit v1.2.3-55-g6feb From 12140e607cad045a41aaeb2ea54d4d9938645f4a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 4 Apr 2011 03:53:23 +0200 Subject: fix install.sh Signed-off-by: Bernhard Reutner-Fischer Signed-off-by: Denys Vlasenko --- applets/install.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/applets/install.sh b/applets/install.sh index 32049b157..8f449d6b5 100755 --- a/applets/install.sh +++ b/applets/install.sh @@ -74,12 +74,12 @@ for i in $h; do echo "#!/bin/busybox" > $prefix$i chmod +x $prefix/$i fi - echo " $prefix$i" + echo " $prefix/$i" else if [ "$2" = "--hardlinks" ]; then bb_path="$prefix/bin/busybox" else - case "$appdir" in + case "/$appdir" in /) bb_path="bin/busybox" ;; @@ -92,17 +92,21 @@ for i in $h; do /usr/bin|/usr/sbin) bb_path="../../bin/busybox" ;; + /root) # root/linuxrc (?!) + bb_path="bin/busybox" + i=$(basename $i) + ;; *) echo "Unknown installation directory: $appdir" exit 1 ;; esac fi - if [ "$noclobber" = "0" ] || [ ! -e "$prefix$i" ]; then - echo " $prefix$i -> $bb_path" - ln $linkopts $bb_path $prefix$i || exit 1 + if [ "$noclobber" = "0" ] || [ ! -e "$prefix/$i" ]; then + echo " $prefix/$i -> $bb_path" + ln $linkopts $bb_path $prefix/$i || exit 1 else - echo " $prefix$i already exists" + echo " $prefix/$i already exists" fi fi done -- cgit v1.2.3-55-g6feb From 9eb7bfd4d4ede3b6aa6a42595fd8824316ab4e2f Mon Sep 17 00:00:00 2001 From: Tito Ragusa Date: Tue, 5 Apr 2011 00:18:33 +0200 Subject: passwd,chpasswd: reset password in /etc/passwd to "x" if /etc/shadow was updated Signed-off-by: Tito Ragusa Signed-off-by: Denys Vlasenko --- loginutils/chpasswd.c | 5 ++++- loginutils/passwd.c | 9 ++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index c2d86664d..6c4296faa 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c @@ -67,7 +67,10 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) * we try to find & change his passwd in /etc/passwd */ #if ENABLE_FEATURE_SHADOWPASSWDS rc = update_passwd(bb_path_shadow_file, name, pass, NULL); - if (rc == 0) /* no lines updated, no errors detected */ + if (rc > 0) /* password in /etc/shadow was updated */ + pass = (char*)"x"; + if (rc >= 0) + /* 0 = /etc/shadow missing (not an error), >0 = passwd changed in /etc/shadow */ #endif rc = update_passwd(bb_path_passwd_file, name, pass, NULL); /* LOGMODE_BOTH logs to syslog also */ diff --git a/loginutils/passwd.c b/loginutils/passwd.c index 8b6a63eec..810644e61 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c @@ -184,8 +184,7 @@ int passwd_main(int argc UNUSED_PARAM, char **argv) * strdup'ing to avoid nasty surprizes */ newp = xstrdup(&pw->pw_passwd[1]); } else if (opt & OPT_delete) { - //newp = xstrdup(""); - newp = (char*)""; + newp = (char*)""; //xstrdup(""); } rlimit_fsize.rlim_cur = rlimit_fsize.rlim_max = 512L * 30000; @@ -201,7 +200,11 @@ int passwd_main(int argc UNUSED_PARAM, char **argv) #if ENABLE_FEATURE_SHADOWPASSWDS filename = bb_path_shadow_file; rc = update_passwd(bb_path_shadow_file, name, newp, NULL); - if (rc == 0) /* no lines updated, no errors detected */ + if (rc > 0) + /* password in /etc/shadow was updated */ + newp = (char*) "x"; //xstrdup("x"); + if (rc >= 0) + /* 0 = /etc/shadow missing (not an error), >0 = passwd changed in /etc/shadow */ #endif { filename = bb_path_passwd_file; -- cgit v1.2.3-55-g6feb From c0644cac0d430a2925920aec6820dd103cdf145f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 5 Apr 2011 02:37:15 +0200 Subject: applets/install.sh: afer quoting of variables Signed-off-by: Denys Vlasenko --- applets/install.sh | 69 +++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/applets/install.sh b/applets/install.sh index 8f449d6b5..95b4719d4 100755 --- a/applets/install.sh +++ b/applets/install.sh @@ -3,12 +3,15 @@ export LC_ALL=POSIX export LC_CTYPE=POSIX -prefix=${1} +prefix=$1 if [ -z "$prefix" ]; then echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--scriptwrapper]" - exit 1; + exit 1 fi + h=`sort busybox.links | uniq` + +linkopts="" scriptwrapper="n" cleanup="0" noclobber="0" @@ -33,12 +36,12 @@ if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then libdir=/lib fi - mkdir -p $prefix/$libdir || exit 1 + mkdir -p "$prefix/$libdir" || exit 1 for i in $DO_INSTALL_LIBS; do - rm -f $prefix/$libdir/$i || exit 1 - if [ -f $i ]; then - cp -pPR $i $prefix/$libdir/ || exit 1 - chmod 0644 $prefix/$libdir/$i || exit 1 + rm -f "$prefix/$libdir/$i" || exit 1 + if [ -f "$i" ]; then + cp -pPR "$i" "$prefix/$libdir/" || exit 1 + chmod 0644 "$prefix/$libdir/$i" || exit 1 fi done fi @@ -46,40 +49,40 @@ fi if [ "$cleanup" = "1" ] && [ -e "$prefix/bin/busybox" ]; then inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'` sub_shell_it=` - cd "$prefix" - for d in usr/sbin usr/bin sbin bin; do - pd=$PWD - if [ -d "$d" ]; then - cd $d - ls -iL . | grep "^ *$inode" | awk '{print $2}' | env -i xargs rm -f - fi - cd "$pd" - done - ` + cd "$prefix" + for d in usr/sbin usr/bin sbin bin; do + pd=$PWD + if [ -d "$d" ]; then + cd "$d" + ls -iL . | grep "^ *$inode" | awk '{print $2}' | env -i xargs rm -f + fi + cd "$pd" + done + ` exit 0 fi -rm -f $prefix/bin/busybox || exit 1 -mkdir -p $prefix/bin || exit 1 -install -m 755 busybox $prefix/bin/busybox || exit 1 +rm -f "$prefix/bin/busybox" || exit 1 +mkdir -p "$prefix/bin" || exit 1 +install -m 755 busybox "$prefix/bin/busybox" || exit 1 for i in $h; do - appdir=`dirname $i` - mkdir -p $prefix/$appdir || exit 1 + appdir=`dirname "$i"` + mkdir -p "$prefix/$appdir" || exit 1 if [ "$scriptwrapper" = "y" ]; then if [ "$swrapall" != "y" ] && [ "$i" = "/bin/sh" ]; then - ln $linkopts busybox $prefix$i || exit 1 + ln $linkopts busybox "$prefix/$i" || exit 1 else - rm -f $prefix$i - echo "#!/bin/busybox" > $prefix$i - chmod +x $prefix/$i + rm -f "$prefix/$i" + echo "#!/bin/busybox" >"$prefix/$i" + chmod +x "$prefix/$i" fi echo " $prefix/$i" else if [ "$2" = "--hardlinks" ]; then bb_path="$prefix/bin/busybox" else - case "/$appdir" in + case "$appdir" in /) bb_path="bin/busybox" ;; @@ -89,22 +92,18 @@ for i in $h; do /sbin) bb_path="../bin/busybox" ;; - /usr/bin|/usr/sbin) + /usr/bin | /usr/sbin) bb_path="../../bin/busybox" ;; - /root) # root/linuxrc (?!) - bb_path="bin/busybox" - i=$(basename $i) - ;; *) - echo "Unknown installation directory: $appdir" - exit 1 + echo "Unknown installation directory: $appdir" + exit 1 ;; esac fi if [ "$noclobber" = "0" ] || [ ! -e "$prefix/$i" ]; then echo " $prefix/$i -> $bb_path" - ln $linkopts $bb_path $prefix/$i || exit 1 + ln $linkopts "$bb_path" "$prefix/$i" || exit 1 else echo " $prefix/$i already exists" fi -- cgit v1.2.3-55-g6feb From 8e23fafadee75bbe275bb795d0b2c2121dad93e7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 7 Apr 2011 01:45:20 +0200 Subject: ntpd: decrease ntpd -q "no response" timeout to 10 sec Signed-off-by: Denys Vlasenko --- networking/ntpd.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/networking/ntpd.c b/networking/ntpd.c index 3ed05ba29..ba2950d8f 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -238,6 +238,8 @@ enum { OPT_p = (1 << 5), OPT_S = (1 << 6), OPT_l = (1 << 7) * ENABLE_FEATURE_NTPD_SERVER, + /* We hijack some bits for other purposes */ + OPT_qq = (1 << 8), }; struct globals { @@ -1930,15 +1932,18 @@ static NOINLINE void ntp_init(char **argv) setpriority(PRIO_PROCESS, 0, -15); /* If network is up, syncronization occurs in ~10 seconds. - * We give "ntpd -q" a full minute to finish, then we exit. + * We give "ntpd -q" 10 seconds to get first reply, + * then another 50 seconds to finish syncing. * * I tested ntpd 4.2.6p1 and apparently it never exits * (will try forever), but it does not feel right. * The goal of -q is to act like ntpdate: set time * after a reasonably small period of polling, or fail. */ - if (opts & OPT_q) - alarm(60); + if (opts & OPT_q) { + option_mask32 |= OPT_qq; + alarm(10); + } bb_signals(0 | (1 << SIGTERM) @@ -2065,6 +2070,15 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv) #endif for (; nfds != 0 && j < i; j++) { if (pfd[j].revents /* & (POLLIN|POLLERR)*/) { + /* + * At init, alarm was set to 10 sec. + * Now we did get a reply. + * Increase timeout to 50 seconds to finish syncing. + */ + if (option_mask32 & OPT_qq) { + option_mask32 &= ~OPT_qq; + alarm(50); + } nfds--; recv_and_process_peer_pkt(idx2peer[j]); gettime1900d(); /* sets G.cur_time */ -- cgit v1.2.3-55-g6feb From ca18311d0ae16a96e988df15a9009095f93df85e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 7 Apr 2011 17:52:20 +0200 Subject: libbb: make set_nport accept pointer to sockaddr, not to len_and_sockaddr. Signed-off-by: Denys Vlasenko --- include/libbb.h | 2 +- libbb/xconnect.c | 16 +++++++++------- networking/ftpd.c | 4 ++-- networking/ftpgetput.c | 2 +- networking/inetd.c | 4 ++-- networking/nc_bloaty.c | 8 ++++---- networking/pscan.c | 2 +- networking/tcpudp.c | 2 +- networking/traceroute.c | 8 ++++---- networking/wget.c | 2 +- 10 files changed, 26 insertions(+), 24 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index f2f3313b4..34f7f6a8b 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -589,7 +589,7 @@ len_and_sockaddr* xhost_and_af2sockaddr(const char *host, int port, sa_family_t /* Assign sin[6]_port member if the socket is an AF_INET[6] one, * otherwise no-op. Useful for ftp. * NB: does NOT do htons() internally, just direct assignment. */ -void set_nport(len_and_sockaddr *lsa, unsigned port) FAST_FUNC; +void set_nport(struct sockaddr *sa, unsigned port) FAST_FUNC; /* Retrieve sin[6]_port or return -1 for non-INET[6] lsa's */ int get_nport(const struct sockaddr *sa) FAST_FUNC; /* Reverse DNS. Returns NULL on failure. */ diff --git a/libbb/xconnect.c b/libbb/xconnect.c index 127e2a5fc..4b7c110d3 100644 --- a/libbb/xconnect.c +++ b/libbb/xconnect.c @@ -134,16 +134,18 @@ int FAST_FUNC get_nport(const struct sockaddr *sa) return -1; } -void FAST_FUNC set_nport(len_and_sockaddr *lsa, unsigned port) +void FAST_FUNC set_nport(struct sockaddr *sa, unsigned port) { #if ENABLE_FEATURE_IPV6 - if (lsa->u.sa.sa_family == AF_INET6) { - lsa->u.sin6.sin6_port = port; + if (sa->sa_family == AF_INET6) { + struct sockaddr_in6 *sin6 = (void*) sa; + sin6->sin6_port = port; return; } #endif - if (lsa->u.sa.sa_family == AF_INET) { - lsa->u.sin.sin_port = port; + if (sa->sa_family == AF_INET) { + struct sockaddr_in *sin = (void*) sa; + sin->sin_port = port; return; } /* What? UNIX socket? IPX?? :) */ @@ -283,7 +285,7 @@ IF_NOT_FEATURE_IPV6(sa_family_t af = AF_INET;) memcpy(&r->u.sa, used_res->ai_addr, used_res->ai_addrlen); set_port: - set_nport(r, htons(port)); + set_nport(&r->u.sa, htons(port)); ret: if (result) freeaddrinfo(result); @@ -369,7 +371,7 @@ static int create_and_bind_or_die(const char *bindaddr, int port, int sock_type) fd = xsocket(lsa->u.sa.sa_family, sock_type, 0); } else { fd = xsocket_type(&lsa, IF_FEATURE_IPV6(AF_UNSPEC,) sock_type); - set_nport(lsa, htons(port)); + set_nport(&lsa->u.sa, htons(port)); } setsockopt_reuseaddr(fd); xbind(fd, &lsa->u.sa, lsa->len); diff --git a/networking/ftpd.c b/networking/ftpd.c index b59135667..fae634ec4 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c @@ -433,7 +433,7 @@ bind_for_passive_mode(void) G.pasv_listen_fd = fd = xsocket(G.local_addr->u.sa.sa_family, SOCK_STREAM, 0); setsockopt_reuseaddr(fd); - set_nport(G.local_addr, 0); + set_nport(&G.local_addr->u.sa, 0); xbind(fd, &G.local_addr->u.sa, G.local_addr->len); xlisten(fd, 1); getsockname(fd, &G.local_addr->u.sa, &G.local_addr->len); @@ -542,7 +542,7 @@ handle_port(void) G.port_addr = xdotted2sockaddr(raw, port); #else G.port_addr = get_peer_lsa(STDIN_FILENO); - set_nport(G.port_addr, htons(port)); + set_nport(&G.port_addr->u.sa, htons(port)); #endif WRITE_OK(FTP_PORTOK); } diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index c68d0ace2..09c5ff30f 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -151,7 +151,7 @@ TODO2: need to stop ignoring IP address in PASV response. *buf_ptr = '\0'; port_num += xatoul_range(buf_ptr + 1, 0, 255) * 256; - set_nport(lsa, htons(port_num)); + set_nport(&lsa->u.sa, htons(port_num)); return xconnect_stream(lsa); } diff --git a/networking/inetd.c b/networking/inetd.c index fb00c6cd7..6018665ef 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -501,7 +501,7 @@ static void prepare_socket_fd(servtab_t *sep) /* zero out the port for all RPC services; let bind() * find one. */ - set_nport(sep->se_lsa, 0); + set_nport(&sep->se_lsa->u.sa, 0); /* for RPC services, attempt to use a reserved port * if they are going to be running as root. */ @@ -959,7 +959,7 @@ static void reread_config_file(int sig UNUSED_PARAM) } if (LONE_CHAR(sep->se_local_hostname, '*')) { lsa = xzalloc_lsa(sep->se_family); - set_nport(lsa, port); + set_nport(&lsa->u.sa, port); } else { lsa = host_and_af2sockaddr(sep->se_local_hostname, ntohs(port), sep->se_family); diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c index e98a5dd5b..29f99e76b 100644 --- a/networking/nc_bloaty.c +++ b/networking/nc_bloaty.c @@ -386,10 +386,10 @@ create new one, and bind() it. TODO */ if (port == 0) { /* "nc -nl -p LPORT RHOST" (w/o RPORT!): * we should accept any remote port */ - set_nport(&remend, 0); /* blot out remote port# */ + set_nport(&remend.u.sa, 0); /* blot out remote port# */ } r = memcmp(&remend.u.sa, &themaddr->u.sa, remend.len); - set_nport(&remend, sv_port); /* restore */ + set_nport(&remend.u.sa, sv_port); /* restore */ if (r != 0) { /* nc 1.10 bails out instead, and its error message * is not suppressed by o_verbose */ @@ -486,7 +486,7 @@ static int udptest(void) us to hang forever, and hit it */ o_wait = 5; /* enough that we'll notice?? */ rr = xsocket(ouraddr->u.sa.sa_family, SOCK_STREAM, 0); - set_nport(themaddr, htons(SLEAZE_PORT)); + set_nport(&themaddr->u.sa, htons(SLEAZE_PORT)); connect_w_timeout(rr); /* don't need to restore themaddr's port, it's not used anymore */ close(rr); @@ -813,7 +813,7 @@ int nc_main(int argc UNUSED_PARAM, char **argv) (themaddr ? themaddr->u.sa.sa_family : AF_UNSPEC), x); if (o_lport) - set_nport(ouraddr, htons(o_lport)); + set_nport(&ouraddr->u.sa, htons(o_lport)); } xmove_fd(x, netfd); setsockopt_reuseaddr(netfd); diff --git a/networking/pscan.c b/networking/pscan.c index a8194d1a8..a9e5d5c29 100644 --- a/networking/pscan.c +++ b/networking/pscan.c @@ -76,7 +76,7 @@ int pscan_main(int argc UNUSED_PARAM, char **argv) DMSG("rtt %u", rtt_4); /* The SOCK_STREAM socket type is implemented on the TCP/IP protocol. */ - set_nport(lsap, htons(port)); + set_nport(&lsap->u.sa, htons(port)); s = xsocket(lsap->u.sa.sa_family, SOCK_STREAM, 0); /* We need unblocking socket so we don't need to wait for ETIMEOUT. */ /* Nonblocking connect typically "fails" with errno == EINPROGRESS */ diff --git a/networking/tcpudp.c b/networking/tcpudp.c index b532e43cd..3ff2acbf8 100644 --- a/networking/tcpudp.c +++ b/networking/tcpudp.c @@ -387,7 +387,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv) * already bound in parent! This seems to work in Linux. * (otherwise we can move socket to fd #0 only if bind succeeds) */ close(0); - set_nport(localp, htons(local_port)); + set_nport(&localp->u.sa, htons(local_port)); xmove_fd(xsocket(localp->u.sa.sa_family, SOCK_DGRAM, 0), 0); setsockopt_reuseaddr(0); /* crucial */ xbind(0, &localp->u.sa, localp->len); diff --git a/networking/traceroute.c b/networking/traceroute.c index 82bb0118c..55dc15b66 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -482,7 +482,7 @@ send_probe(int seq, int ttl) if (!(option_mask32 & OPT_USE_ICMP)) { out = outdata; len -= sizeof(*outudp); - set_nport(dest_lsa, htons(port + seq)); + set_nport(&dest_lsa->u.sa, htons(port + seq)); } } @@ -1018,10 +1018,10 @@ common_traceroute_main(int op, char **argv) int probe_fd = xsocket(af, SOCK_DGRAM, 0); if (op & OPT_DEVICE) setsockopt_bindtodevice(probe_fd, device); - set_nport(dest_lsa, htons(1025)); + set_nport(&dest_lsa->u.sa, htons(1025)); /* dummy connect. makes kernel pick source IP (and port) */ xconnect(probe_fd, &dest_lsa->u.sa, dest_lsa->len); - set_nport(dest_lsa, htons(port)); + set_nport(&dest_lsa->u.sa, htons(port)); /* read IP and port */ source_lsa = get_sock_lsa(probe_fd); @@ -1031,7 +1031,7 @@ common_traceroute_main(int op, char **argv) close(probe_fd); /* bind our sockets to this IP (but not port) */ - set_nport(source_lsa, 0); + set_nport(&source_lsa->u.sa, 0); xbind(sndsock, &source_lsa->u.sa, source_lsa->len); xbind(rcvsock, &source_lsa->u.sa, source_lsa->len); diff --git a/networking/wget.c b/networking/wget.c index 2f89c8f7f..3a4be9878 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -407,7 +407,7 @@ static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_ str = strrchr(G.wget_buf, ','); if (!str) goto pasv_error; port += xatou_range(str+1, 0, 255) * 256; - set_nport(lsa, htons(port)); + set_nport(&lsa->u.sa, htons(port)); *dfpp = open_socket(lsa); -- cgit v1.2.3-55-g6feb From d277f55ebd3f21cef759435b432e37e8f1316f90 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 10 Apr 2011 03:08:22 +0200 Subject: http: document index.cgi usage. no code changes Signed-off-by: Denys Vlasenko --- networking/httpd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/networking/httpd.c b/networking/httpd.c index 9c1aa2a6f..eded7b63f 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -21,6 +21,10 @@ * The server changes directory to the location of the script and executes it * after setting QUERY_STRING and other environment variables. * + * If directory URL is given, no index.html is found and CGI support is enabled, + * cgi-bin/index.cgi will be run. Directory to list is ../$QUERY_STRING. + * See httpd_indexcgi.c for an example GCI code. + * * Doc: * "CGI Environment Variables": http://hoohoo.ncsa.uiuc.edu/cgi/env.html * @@ -71,7 +75,7 @@ * D:2.3.4. # deny from 2.3.4.0 - 2.3.4.255 * A:* # (optional line added for clarity) * - * If a sub directory contains a config file it is parsed and merged with + * If a sub directory contains config file, it is parsed and merged with * any existing settings as if it was appended to the original configuration. * * subdir paths are relative to the containing subdir and thus cannot -- cgit v1.2.3-55-g6feb From 73ef15cf3894716c1393ed21dee6e6bb2cdbc90f Mon Sep 17 00:00:00 2001 From: Sergey Naumov Date: Sun, 10 Apr 2011 07:34:27 +0200 Subject: syslogd: optional support for /etc/syslog.conf function old new delta syslogd_main 1241 1870 +629 timestamp_and_log 301 540 +239 find_by_name - 37 +37 find_by_val - 22 +22 init_data 64 68 +4 log_locally 603 413 -190 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/1 up/down: 931/-190) Total: 741 bytes Signed-off-by: Sergey Naumov Signed-off-by: Denys Vlasenko --- sysklogd/Config.src | 7 ++ sysklogd/syslogd.c | 333 ++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 275 insertions(+), 65 deletions(-) diff --git a/sysklogd/Config.src b/sysklogd/Config.src index d62dc5f5c..b3e13d7c0 100644 --- a/sysklogd/Config.src +++ b/sysklogd/Config.src @@ -52,6 +52,13 @@ config FEATURE_SYSLOGD_DUP Option -D instructs syslogd to drop consecutive messages which are totally the same. +config FEATURE_SYSLOGD_CFG + bool "Support syslog.conf" + default y + depends on SYSLOGD + help + Supports restricted syslogd config. + config FEATURE_SYSLOGD_READ_BUFFER_SIZE int "Read buffer size in bytes" default 256 diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 24cab3b6c..f179dc5ac 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -66,10 +66,26 @@ typedef struct { } remoteHost_t; #endif +typedef struct logFile_t { + const char *path; + int fd; +#if ENABLE_FEATURE_ROTATE_LOGFILE + unsigned size; + uint8_t isRegular; +#endif +} logFile_t; + +#if ENABLE_FEATURE_SYSLOGD_CFG +typedef struct logRule_t { + uint8_t enabled_facility_priomap[LOG_NFACILITIES]; + struct logFile_t *file; + struct logRule_t *next; +} logRule_t; +#endif + /* Allows us to have smaller initializer. Ugly. */ #define GLOBALS \ - const char *logFilePath; \ - int logFD; \ + logFile_t logFile; \ /* interval between marks in seconds */ \ /*int markInterval;*/ \ /* level of messages to be logged */ \ @@ -79,8 +95,6 @@ IF_FEATURE_ROTATE_LOGFILE( \ unsigned logFileSize; \ /* number of rotated message files */ \ unsigned logFileRotate; \ - unsigned curFileSize; \ - smallint isRegular; \ ) \ IF_FEATURE_IPC_SYSLOG( \ int shmid; /* ipc shared memory id */ \ @@ -88,6 +102,9 @@ IF_FEATURE_IPC_SYSLOG( \ int shm_size; \ struct sembuf SMwup[1]; \ struct sembuf SMwdn[3]; \ +) \ +IF_FEATURE_SYSLOGD_CFG( \ + logRule_t *log_rules; \ ) struct init_globals { @@ -119,8 +136,10 @@ struct globals { }; static const struct init_globals init_data = { - .logFilePath = "/var/log/messages", - .logFD = -1, + .logFile = { + .path = "/var/log/messages", + .fd = -1, + }, #ifdef SYSLOGD_MARK .markInterval = 20 * 60, #endif @@ -132,7 +151,7 @@ static const struct init_globals init_data = { #if ENABLE_FEATURE_IPC_SYSLOG .shmid = -1, .s_semid = -1, - .shm_size = ((CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE)*1024), // default shm size + .shm_size = ((CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE)*1024), /* default shm size */ .SMwup = { {1, -1, IPC_NOWAIT} }, .SMwdn = { {0, 0}, {1, 0}, {1, +1} }, #endif @@ -157,6 +176,7 @@ enum { IF_FEATURE_REMOTE_LOG( OPTBIT_locallog ,) // -L IF_FEATURE_IPC_SYSLOG( OPTBIT_circularlog,) // -C IF_FEATURE_SYSLOGD_DUP( OPTBIT_dup ,) // -D + IF_FEATURE_SYSLOGD_CFG( OPTBIT_cfg ,) // -f OPT_mark = 1 << OPTBIT_mark , OPT_nofork = 1 << OPTBIT_nofork , @@ -169,6 +189,7 @@ enum { OPT_locallog = IF_FEATURE_REMOTE_LOG( (1 << OPTBIT_locallog )) + 0, OPT_circularlog = IF_FEATURE_IPC_SYSLOG( (1 << OPTBIT_circularlog)) + 0, OPT_dup = IF_FEATURE_SYSLOGD_DUP( (1 << OPTBIT_dup )) + 0, + OPT_cfg = IF_FEATURE_SYSLOGD_CFG( (1 << OPTBIT_cfg )) + 0, }; #define OPTION_STR "m:nO:l:S" \ IF_FEATURE_ROTATE_LOGFILE("s:" ) \ @@ -176,18 +197,194 @@ enum { IF_FEATURE_REMOTE_LOG( "R:" ) \ IF_FEATURE_REMOTE_LOG( "L" ) \ IF_FEATURE_IPC_SYSLOG( "C::") \ - IF_FEATURE_SYSLOGD_DUP( "D" ) + IF_FEATURE_SYSLOGD_DUP( "D" ) \ + IF_FEATURE_SYSLOGD_CFG( "f:" ) #define OPTION_DECL *opt_m, *opt_l \ IF_FEATURE_ROTATE_LOGFILE(,*opt_s) \ IF_FEATURE_ROTATE_LOGFILE(,*opt_b) \ - IF_FEATURE_IPC_SYSLOG( ,*opt_C = NULL) -#define OPTION_PARAM &opt_m, &G.logFilePath, &opt_l \ + IF_FEATURE_IPC_SYSLOG( ,*opt_C = NULL) \ + IF_FEATURE_SYSLOGD_CFG( ,*opt_f = NULL) +#define OPTION_PARAM &opt_m, &(G.logFile.path), &opt_l \ IF_FEATURE_ROTATE_LOGFILE(,&opt_s) \ IF_FEATURE_ROTATE_LOGFILE(,&opt_b) \ IF_FEATURE_REMOTE_LOG( ,&remoteAddrList) \ - IF_FEATURE_IPC_SYSLOG( ,&opt_C) + IF_FEATURE_IPC_SYSLOG( ,&opt_C) \ + IF_FEATURE_SYSLOGD_CFG( ,&opt_f) +#if ENABLE_FEATURE_SYSLOGD_CFG +static const CODE* find_by_name(char *name, const CODE* c_set) +{ + for (; c_set->c_name; c_set++) { + if (strcmp(name, c_set->c_name) == 0) + return c_set; + } + return NULL; +} +#endif +static const CODE* find_by_val(int val, const CODE* c_set) +{ + for (; c_set->c_name; c_set++) { + if (c_set->c_val == val) + return c_set; + } + return NULL; +} + +#if ENABLE_FEATURE_SYSLOGD_CFG +static void parse_syslogdcfg(const char *file) +{ + char *t; + logRule_t **pp_rule; + /* tok[0] set of selectors */ + /* tok[1] file name */ + /* tok[2] has to be NULL */ + char *tok[3]; + parser_t *parser; + + parser = config_open2(file ? file : "/etc/syslog.conf", + file ? xfopen_for_read : fopen_or_warn_stdin); + if (!parser) + /* didn't find default /etc/syslog.conf */ + /* proceed as if we built busybox without config support */ + return; + + /* use ptr to ptr to avoid checking whether head was initialized */ + pp_rule = &G.log_rules; + /* iterate through lines of config, skipping comments */ + while (config_read(parser, tok, 3, 2, "# \t", PARSE_NORMAL | PARSE_MIN_DIE)) { + char *cur_selector; + logRule_t *cur_rule; + + /* unexpected trailing token? */ + if (tok[2]) { + t = tok[2]; + goto cfgerr; + } + + cur_rule = *pp_rule = xzalloc(sizeof(*cur_rule)); + + cur_selector = tok[0]; + /* iterate through selectors: "kern.info;kern.!err;..." */ + do { + const CODE *code; + char *next_selector; + uint8_t negated_prio; /* "kern.!err" */ + uint8_t single_prio; /* "kern.=err" */ + uint32_t facmap; /* bitmap of enabled facilities */ + uint8_t primap; /* bitmap of enabled priorities */ + unsigned i; + + next_selector = strchr(cur_selector, ';'); + if (next_selector) + *next_selector++ = '\0'; + + t = strchr(cur_selector, '.'); + if (!t) { + t = cur_selector; + goto cfgerr; + } + *t++ = '\0'; /* separate facility from priority */ + + negated_prio = 0; + single_prio = 0; + if (*t == '!') { + negated_prio = 1; + ++t; + } + if (*t == '=') { + single_prio = 1; + ++t; + } + + /* parse priority */ + if (*t == '*') + primap = 0xff; /* all 8 log levels enabled */ + else { + uint8_t priority; + code = find_by_name(t, prioritynames); + if (!code) + goto cfgerr; + primap = 0; + priority = code->c_val; + if (priority == INTERNAL_NOPRI) { + /* ensure we take "enabled_facility_priomap[fac] &= 0" branch below */ + negated_prio = 1; + } else { + priority = 1 << priority; + do { + primap |= priority; + if (single_prio) + break; + priority >>= 1; + } while (priority); + if (negated_prio) + primap = ~primap; + } + } + + /* parse facility */ + if (*cur_selector == '*') + facmap = (1<" */ + do { + next_facility = strchr(t, ','); + if (next_facility) + *next_facility++ = '\0'; + code = find_by_name(t, facilitynames); + if (!code) + goto cfgerr; + /* "mark" is not a real facility, skip it */ + if (code->c_val != INTERNAL_MARK) + facmap |= 1<<(LOG_FAC(code->c_val)); + t = next_facility; + } while (t); + } + + /* merge result with previous selectors */ + for (i = 0; i < LOG_NFACILITIES; ++i) { + if (!(facmap & (1<enabled_facility_priomap[i] &= primap; + else + cur_rule->enabled_facility_priomap[i] |= primap; + } + + cur_selector = next_selector; + } while (cur_selector); + + /* check whether current file name was mentioned in previous rules. + * temporarily use cur_rule as iterator, but *pp_rule still points to + * currently processing rule entry. + * NOTE: *pp_rule points to the current (and last in the list) rule. + */ + for (cur_rule = G.log_rules; cur_rule != *pp_rule; cur_rule = cur_rule->next) { + if (strcmp(cur_rule->file->path, tok[1]) == 0) { + /* found - reuse the same file structure */ + (*pp_rule)->file = cur_rule->file; + cur_rule = *pp_rule; + goto found; + } + } + cur_rule->file = xzalloc(sizeof(*cur_rule->file)); + cur_rule->file->fd = -1; + cur_rule->file->path = xstrdup(tok[1]); + found: + pp_rule = &cur_rule->next; + } + config_close(parser); + return; + + cfgerr: + bb_error_msg_and_die("bad line %d: wrong token '%s'", parser->lineno, t); +} +#endif + /* circular buffer variables/structures */ #if ENABLE_FEATURE_IPC_SYSLOG @@ -231,7 +428,7 @@ static void ipcsyslog_init(void) G.shbuf->size = G.shm_size - offsetof(struct shbuf_ds, data) - 1; /*G.shbuf->tail = 0;*/ - // we'll trust the OS to set initial semval to 0 (let's hope) + /* we'll trust the OS to set initial semval to 0 (let's hope) */ G.s_semid = semget(KEY_ID, 2, IPC_CREAT | IPC_EXCL | 1023); if (G.s_semid == -1) { if (errno == EEXIST) { @@ -244,9 +441,10 @@ static void ipcsyslog_init(void) } /* Write message to shared mem buffer */ -static void log_to_shmem(const char *msg, int len) +static void log_to_shmem(const char *msg) { int old_tail, new_tail; + int len; if (semop(G.s_semid, G.SMwdn, 3) == -1) { bb_perror_msg_and_die("SMwdn"); @@ -258,7 +456,7 @@ static void log_to_shmem(const char *msg, int len) * tail's max value is (shbuf->size - 1) * Last byte of buffer is never used and remains NUL. */ - len++; /* length with NUL included */ + len = strlen(msg) + 1; /* length with NUL included */ again: old_tail = G.shbuf->tail; new_tail = old_tail + len; @@ -288,22 +486,15 @@ void ipcsyslog_init(void); void log_to_shmem(const char *msg); #endif /* FEATURE_IPC_SYSLOG */ - /* Print a message to the log file. */ -static void log_locally(time_t now, char *msg) +static void log_locally(time_t now, char *msg, logFile_t *log_file) { #ifdef SYSLOGD_WRLOCK struct flock fl; #endif int len = strlen(msg); -#if ENABLE_FEATURE_IPC_SYSLOG - if ((option_mask32 & OPT_circularlog) && G.shbuf) { - log_to_shmem(msg, len); - return; - } -#endif - if (G.logFD >= 0) { + if (log_file->fd >= 0) { /* Reopen log file every second. This allows admin * to delete the file and not worry about restarting us. * This costs almost nothing since it happens @@ -313,15 +504,15 @@ static void log_locally(time_t now, char *msg) now = time(NULL); if (G.last_log_time != now) { G.last_log_time = now; - close(G.logFD); + close(log_file->fd); goto reopen; } } else { reopen: - G.logFD = open(G.logFilePath, O_WRONLY | O_CREAT + log_file->fd = open(log_file->path, O_WRONLY | O_CREAT | O_NOCTTY | O_APPEND | O_NONBLOCK, 0666); - if (G.logFD < 0) { + if (log_file->fd < 0) { /* cannot open logfile? - print to /dev/console then */ int fd = device_open(DEV_CONSOLE, O_WRONLY | O_NOCTTY | O_NONBLOCK); if (fd < 0) @@ -334,9 +525,9 @@ static void log_locally(time_t now, char *msg) #if ENABLE_FEATURE_ROTATE_LOGFILE { struct stat statf; - G.isRegular = (fstat(G.logFD, &statf) == 0 && S_ISREG(statf.st_mode)); + log_file->isRegular = (fstat(log_file->fd, &statf) == 0 && S_ISREG(statf.st_mode)); /* bug (mostly harmless): can wrap around if file > 4gb */ - G.curFileSize = statf.st_size; + log_file->size = statf.st_size; } #endif } @@ -346,41 +537,41 @@ static void log_locally(time_t now, char *msg) fl.l_start = 0; fl.l_len = 1; fl.l_type = F_WRLCK; - fcntl(G.logFD, F_SETLKW, &fl); + fcntl(log_file->fd, F_SETLKW, &fl); #endif #if ENABLE_FEATURE_ROTATE_LOGFILE - if (G.logFileSize && G.isRegular && G.curFileSize > G.logFileSize) { + if (G.logFileSize && log_file->isRegular && log_file->size > G.logFileSize) { if (G.logFileRotate) { /* always 0..99 */ - int i = strlen(G.logFilePath) + 3 + 1; + int i = strlen(log_file->path) + 3 + 1; char oldFile[i]; char newFile[i]; i = G.logFileRotate - 1; /* rename: f.8 -> f.9; f.7 -> f.8; ... */ while (1) { - sprintf(newFile, "%s.%d", G.logFilePath, i); + sprintf(newFile, "%s.%d", log_file->path, i); if (i == 0) break; - sprintf(oldFile, "%s.%d", G.logFilePath, --i); + sprintf(oldFile, "%s.%d", log_file->path, --i); /* ignore errors - file might be missing */ rename(oldFile, newFile); } /* newFile == "f.0" now */ - rename(G.logFilePath, newFile); + rename(log_file->path, newFile); #ifdef SYSLOGD_WRLOCK fl.l_type = F_UNLCK; - fcntl(G.logFD, F_SETLKW, &fl); + fcntl(log_file->fd, F_SETLKW, &fl); #endif - close(G.logFD); + close(log_file->fd); goto reopen; } - ftruncate(G.logFD, 0); + ftruncate(log_file->fd, 0); } - G.curFileSize += + log_file->size += #endif - full_write(G.logFD, msg, len); + full_write(log_file->fd, msg, len); #ifdef SYSLOGD_WRLOCK fl.l_type = F_UNLCK; - fcntl(G.logFD, F_SETLKW, &fl); + fcntl(log_file->fd, F_SETLKW, &fl); #endif } @@ -388,29 +579,15 @@ static void parse_fac_prio_20(int pri, char *res20) { const CODE *c_pri, *c_fac; - if (pri != 0) { - c_fac = facilitynames; - while (c_fac->c_name) { - if (c_fac->c_val != (LOG_FAC(pri) << 3)) { - c_fac++; - continue; - } - /* facility is found, look for prio */ - c_pri = prioritynames; - while (c_pri->c_name) { - if (c_pri->c_val != LOG_PRI(pri)) { - c_pri++; - continue; - } - snprintf(res20, 20, "%s.%s", - c_fac->c_name, c_pri->c_name); - return; - } - /* prio not found, bail out */ - break; + c_fac = find_by_val(LOG_FAC(pri) << 3, facilitynames); + if (c_fac) { + c_pri = find_by_val(LOG_PRI(pri), prioritynames); + if (c_pri) { + snprintf(res20, 20, "%s.%s", c_fac->c_name, c_pri->c_name); + return; } - snprintf(res20, 20, "<%d>", pri); } + snprintf(res20, 20, "<%d>", pri); } /* len parameter is used only for "is there a timestamp?" check. @@ -444,7 +621,32 @@ static void timestamp_and_log(int pri, char *msg, int len) } /* Log message locally (to file or shared mem) */ - log_locally(now, G.printbuf); +#if ENABLE_FEATURE_SYSLOGD_CFG + { + bool match = 0; + logRule_t *rule; + uint8_t facility = LOG_FAC(pri); + uint8_t prio_bit = 1 << LOG_PRI(pri); + + for (rule = G.log_rules; rule; rule = rule->next) { + if (rule->enabled_facility_priomap[facility] & prio_bit) { + log_locally(now, G.printbuf, rule->file); + match = 1; + } + } + if (match) + return; + } +#endif + if (LOG_PRI(pri) < G.logLevel) { +#if ENABLE_FEATURE_IPC_SYSLOG + if ((option_mask32 & OPT_circularlog) && G.shbuf) { + log_to_shmem(msg); + return; + } +#endif + log_locally(now, G.printbuf, &G.logFile); + } } static void timestamp_and_log_internal(const char *msg) @@ -489,8 +691,7 @@ static void split_escape_and_log(char *tmpbuf, int len) *q = '\0'; /* Now log it */ - if (LOG_PRI(pri) < G.logLevel) - timestamp_and_log(pri, G.parsebuf, q - G.parsebuf); + timestamp_and_log(pri, G.parsebuf, q - G.parsebuf); } } @@ -719,10 +920,12 @@ int syslogd_main(int argc UNUSED_PARAM, char **argv) if (opt_C) // -Cn G.shm_size = xatoul_range(opt_C, 4, INT_MAX/1024) * 1024; #endif - /* If they have not specified remote logging, then log locally */ if (ENABLE_FEATURE_REMOTE_LOG && !(opts & OPT_remotelog)) // -R option_mask32 |= OPT_locallog; +#if ENABLE_FEATURE_SYSLOGD_CFG + parse_syslogdcfg(opt_f); +#endif /* Store away localhost's name before the fork */ G.hostname = safe_gethostname(); -- cgit v1.2.3-55-g6feb From 5bc8c005a8e15c43285bc595a8d404de67a482ac Mon Sep 17 00:00:00 2001 From: Pere Orga Date: Mon, 11 Apr 2011 03:29:49 +0200 Subject: move remaining help text from include/usage.src.h Signed-off-by: Pere Orga Signed-off-by: Denys Vlasenko --- console-tools/loadfont.c | 11 + e2fsprogs/old_e2fsprogs/e2fsck.c | 22 + include/usage.src.h | 2311 -------------------------------------- libbb/parse_config.c | 6 + miscutils/adjtimex.c | 12 + miscutils/bbconfig.c | 6 + miscutils/beep.c | 11 + miscutils/chat.c | 9 + miscutils/chrt.c | 17 + miscutils/crond.c | 13 + miscutils/crontab.c | 10 + miscutils/devfsd.c | 16 + miscutils/devmem.c | 8 + miscutils/eject.c | 11 + miscutils/fbsplash.c | 13 + miscutils/flash_eraseall.c | 8 + miscutils/flash_lock_unlock.c | 12 + miscutils/flashcp.c | 7 + miscutils/hdparm.c | 52 + miscutils/inotifyd.c | 27 + miscutils/ionice.c | 8 + miscutils/last.c | 11 + miscutils/less.c | 12 + miscutils/makedevs.c | 60 + miscutils/man.c | 8 + miscutils/microcom.c | 12 + miscutils/mountpoint.c | 16 + miscutils/mt.c | 12 + miscutils/raidautorun.c | 8 + miscutils/readahead.c | 5 + miscutils/rfkill.c | 13 + miscutils/runlevel.c | 13 + miscutils/rx.c | 8 + miscutils/setsid.c | 7 + miscutils/strings.c | 10 + miscutils/taskset.c | 18 + miscutils/time.c | 7 + miscutils/timeout.c | 6 + miscutils/ttysize.c | 6 + miscutils/volname.c | 6 + miscutils/wall.c | 9 + miscutils/watchdog.c | 11 + networking/arp.c | 19 + networking/arping.c | 17 + networking/brctl.c | 24 + networking/dnsd.c | 16 + networking/ether-wake.c | 10 + networking/ftpgetput.c | 38 + networking/hostname.c | 19 + networking/httpd.c | 26 + networking/ifconfig.c | 21 + networking/ifenslave.c | 27 + networking/ifplugd.c | 26 + networking/ifupdown.c | 28 + networking/inetd.c | 11 + networking/ip.c | 73 ++ networking/ipcalc.c | 27 + networking/isrv_identd.c | 11 + networking/nslookup.c | 14 + networking/ntpd.c | 17 + networking/pscan.c | 12 + networking/route.c | 9 + networking/slattach.c | 14 + networking/tc.c | 21 + networking/tcpudp.c | 37 + networking/telnet.c | 16 + networking/telnetd.c | 22 + networking/tftp.c | 33 + networking/traceroute.c | 45 + networking/tunctl.c | 19 + networking/udhcp/dhcpd.c | 11 + networking/udhcp/dhcprelay.c | 6 + networking/udhcp/dumpleases.c | 17 + networking/vconfig.c | 12 + networking/zcip.c | 13 + printutils/lpd.c | 11 + printutils/lpr.c | 21 + procps/free.c | 12 + procps/fuser.c | 11 + procps/kill.c | 39 + procps/pgrep.c | 29 + procps/pidof.c | 28 + procps/ps.c | 47 + procps/renice.c | 10 + procps/sysctl.c | 19 + procps/uptime.c | 9 + procps/watch.c | 14 + runit/chpst.c | 64 ++ runit/runsv.c | 5 + runit/runsvdir.c | 7 + runit/sv.c | 16 + selinux/chcon.c | 33 + selinux/getenforce.c | 3 + selinux/getsebool.c | 5 + selinux/load_policy.c | 4 + selinux/matchpathcon.c | 10 + selinux/runcon.c | 22 + selinux/selinuxenabled.c | 4 + selinux/sestatus.c | 6 + selinux/setenforce.c | 4 + selinux/setfiles.c | 40 + selinux/setsebool.c | 5 + sysklogd/klogd.c | 8 + sysklogd/logger.c | 12 + sysklogd/logread.c | 7 + sysklogd/syslogd.c | 27 + util-linux/acpid.c | 24 + util-linux/blkid.c | 5 + util-linux/dmesg.c | 10 + util-linux/fbset.c | 15 + util-linux/fdformat.c | 7 + util-linux/fdisk.c | 22 + util-linux/findfs.c | 8 + util-linux/flock.c | 11 + util-linux/freeramdisk.c | 14 + util-linux/fsck_minix.c | 13 + util-linux/getopt.c | 48 + util-linux/hexdump.c | 24 + util-linux/ipcrm.c | 10 + util-linux/ipcs.c | 16 + util-linux/losetup.c | 18 + util-linux/lspci.c | 9 + util-linux/lsusb.c | 4 + util-linux/mdev.c | 35 + util-linux/mkfs_ext2.c | 39 + util-linux/mkfs_minix.c | 11 + util-linux/mkfs_reiser.c | 9 + util-linux/mkfs_vfat.c | 17 + util-linux/mkswap.c | 8 + util-linux/more.c | 8 + util-linux/mount.c | 60 + util-linux/pivot_root.c | 7 + util-linux/rdate.c | 8 + util-linux/rdev.c | 9 + util-linux/readprofile.c | 15 + util-linux/rtcwake.c | 23 + util-linux/script.c | 13 + util-linux/scriptreplay.c | 6 + util-linux/setarch.c | 15 +- util-linux/swaponoff.c | 17 + util-linux/switch_root.c | 10 + util-linux/umount.c | 22 + 142 files changed, 2369 insertions(+), 2312 deletions(-) diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 588322b05..597519f91 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c @@ -18,6 +18,17 @@ //usage: //usage:#define loadfont_example_usage //usage: "$ loadfont < /etc/i18n/fontname\n" +//usage: +//usage:#define setfont_trivial_usage +//usage: "FONT [-m MAPFILE] [-C TTY]" +//usage:#define setfont_full_usage "\n\n" +//usage: "Load a console font\n" +//usage: "\nOptions:" +//usage: "\n -m MAPFILE Load console screen map" +//usage: "\n -C TTY Affect TTY instead of /dev/tty" +//usage: +//usage:#define setfont_example_usage +//usage: "$ setfont -m koi8-r /etc/i18n/fontname\n" #include "libbb.h" #include diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c index d73665988..1f990b303 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.c +++ b/e2fsprogs/old_e2fsprogs/e2fsck.c @@ -29,6 +29,28 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +/* +//usage:#define e2fsck_trivial_usage +//usage: "[-panyrcdfvstDFSV] [-b superblock] [-B blocksize] " +//usage: "[-I inode_buffer_blocks] [-P process_inode_size] " +//usage: "[-l|-L bad_blocks_file] [-C fd] [-j external_journal] " +//usage: "[-E extended-options] device" +//usage:#define e2fsck_full_usage "\n\n" +//usage: "Check ext2/ext3 file system\n" +//usage: "\nOptions:" +//usage: "\n -p Automatic repair (no questions)" +//usage: "\n -n Make no changes to the filesystem" +//usage: "\n -y Assume 'yes' to all questions" +//usage: "\n -c Check for bad blocks and add them to the badblock list" +//usage: "\n -f Force checking even if filesystem is marked clean" +//usage: "\n -v Verbose" +//usage: "\n -b superblock Use alternative superblock" +//usage: "\n -B blocksize Force blocksize when looking for superblock" +//usage: "\n -j journal Set location of the external journal" +//usage: "\n -l file Add to badblocks list" +//usage: "\n -L file Set badblocks list" +*/ + #include "e2fsck.h" /*Put all of our defines here to clean things up*/ #define _(x) x diff --git a/include/usage.src.h b/include/usage.src.h index 2c88c46a1..78beccf4d 100644 --- a/include/usage.src.h +++ b/include/usage.src.h @@ -12,2322 +12,11 @@ #ifndef BB_USAGE_H #define BB_USAGE_H 1 - #define NOUSAGE_STR "\b" INSERT -#define acpid_trivial_usage \ - "[-d] [-c CONFDIR] [-l LOGFILE] [-a ACTIONFILE] [-M MAPFILE] [-e PROC_EVENT_FILE] [-p PIDFILE]" -#define acpid_full_usage "\n\n" \ - "Listen to ACPI events and spawn specific helpers on event arrival\n" \ - "\nOptions:" \ - "\n -c DIR Config directory [/etc/acpi]" \ - "\n -d Don't daemonize, (implies -f)" \ - "\n -e FILE /proc event file [/proc/acpi/event]" \ - "\n -f Run in foreground" \ - "\n -l FILE Log file [/var/log/acpid.log]" \ - "\n -p FILE Pid file [/var/run/acpid.pid]" \ - "\n -a FILE Action file [/etc/acpid.conf]" \ - "\n -M FILE Map file [/etc/acpi.map]" \ - IF_FEATURE_ACPID_COMPAT( \ - "\n\nAccept and ignore compatibility options -g -m -s -S -v" \ - ) - -#define acpid_example_usage \ - "Without -e option, acpid uses all /dev/input/event* files\n" \ - "# acpid\n" \ - "# acpid -l /var/log/my-acpi-log\n" \ - "# acpid -e /proc/acpi/event\n" - -#define adjtimex_trivial_usage \ - "[-q] [-o OFF] [-f FREQ] [-p TCONST] [-t TICK]" -#define adjtimex_full_usage "\n\n" \ - "Read and optionally set system timebase parameters. See adjtimex(2)\n" \ - "\nOptions:" \ - "\n -q Quiet" \ - "\n -o OFF Time offset, microseconds" \ - "\n -f FREQ Frequency adjust, integer kernel units (65536 is 1ppm)" \ - "\n (positive values make clock run faster)" \ - "\n -t TICK Microseconds per tick, usually 10000" \ - "\n -p TCONST" \ - -#define arp_trivial_usage \ - "\n[-vn] [-H HWTYPE] [-i IF] -a [HOSTNAME]" \ - "\n[-v] [-i IF] -d HOSTNAME [pub]" \ - "\n[-v] [-H HWTYPE] [-i IF] -s HOSTNAME HWADDR [temp]" \ - "\n[-v] [-H HWTYPE] [-i IF] -s HOSTNAME HWADDR [netmask MASK] pub" \ - "\n[-v] [-H HWTYPE] [-i IF] -Ds HOSTNAME IFACE [netmask MASK] pub" -#define arp_full_usage "\n\n" \ - "Manipulate ARP cache\n" \ - "\nOptions:" \ - "\n -a Display (all) hosts" \ - "\n -s Set new ARP entry" \ - "\n -d Delete a specified entry" \ - "\n -v Verbose" \ - "\n -n Don't resolve names" \ - "\n -i IF Network interface" \ - "\n -D Read from given device" \ - "\n -A,-p AF Protocol family" \ - "\n -H HWTYPE Hardware address type" \ - -#define arping_trivial_usage \ - "[-fqbDUA] [-c CNT] [-w TIMEOUT] [-I IFACE] [-s SRC_IP] DST_IP" -#define arping_full_usage "\n\n" \ - "Send ARP requests/replies\n" \ - "\nOptions:" \ - "\n -f Quit on first ARP reply" \ - "\n -q Quiet" \ - "\n -b Keep broadcasting, don't go unicast" \ - "\n -D Duplicated address detection mode" \ - "\n -U Unsolicited ARP mode, update your neighbors" \ - "\n -A ARP answer mode, update your neighbors" \ - "\n -c N Stop after sending N ARP requests" \ - "\n -w TIMEOUT Time to wait for ARP reply, seconds" \ - "\n -I IFACE Interface to use (default eth0)" \ - "\n -s SRC_IP Sender IP address" \ - "\n DST_IP Target IP address" \ - -#define beep_trivial_usage \ - "-f FREQ -l LEN -d DELAY -r COUNT -n" -#define beep_full_usage "\n\n" \ - "Options:" \ - "\n -f Frequency in Hz" \ - "\n -l Length in ms" \ - "\n -d Delay in ms" \ - "\n -r Repetitions" \ - "\n -n Start new tone" \ - -#define blkid_trivial_usage \ - "" -#define blkid_full_usage "\n\n" \ - "Print UUIDs of all filesystems" - -#define brctl_trivial_usage \ - "COMMAND [BRIDGE [INTERFACE]]" -#define brctl_full_usage "\n\n" \ - "Manage ethernet bridges\n" \ - "\nCommands:" \ - IF_FEATURE_BRCTL_SHOW( \ - "\n show Show a list of bridges" \ - ) \ - "\n addbr BRIDGE Create BRIDGE" \ - "\n delbr BRIDGE Delete BRIDGE" \ - "\n addif BRIDGE IFACE Add IFACE to BRIDGE" \ - "\n delif BRIDGE IFACE Delete IFACE from BRIDGE" \ - IF_FEATURE_BRCTL_FANCY( \ - "\n setageing BRIDGE TIME Set ageing time" \ - "\n setfd BRIDGE TIME Set bridge forward delay" \ - "\n sethello BRIDGE TIME Set hello time" \ - "\n setmaxage BRIDGE TIME Set max message age" \ - "\n setpathcost BRIDGE COST Set path cost" \ - "\n setportprio BRIDGE PRIO Set port priority" \ - "\n setbridgeprio BRIDGE PRIO Set bridge priority" \ - "\n stp BRIDGE [1/yes/on|0/no/off] STP on/off" \ - ) \ - #define busybox_notes_usage \ "Hello world!\n" -#define chat_trivial_usage \ - "EXPECT [SEND [EXPECT [SEND...]]]" -#define chat_full_usage "\n\n" \ - "Useful for interacting with a modem connected to stdin/stdout.\n" \ - "A script consists of one or more \"expect-send\" pairs of strings,\n" \ - "each pair is a pair of arguments. Example:\n" \ - "chat '' ATZ OK ATD123456 CONNECT '' ogin: pppuser word: ppppass '~'" \ - -#define chcon_trivial_usage \ - "[OPTIONS] CONTEXT FILE..." \ - "\n chcon [OPTIONS] [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE..." \ - IF_FEATURE_CHCON_LONG_OPTIONS( \ - "\n chcon [OPTIONS] --reference=RFILE FILE..." \ - ) -#define chcon_full_usage "\n\n" \ - "Change the security context of each FILE to CONTEXT\n" \ - IF_FEATURE_CHCON_LONG_OPTIONS( \ - "\n -v,--verbose Verbose" \ - "\n -c,--changes Report changes made" \ - "\n -h,--no-dereference Affect symlinks instead of their targets" \ - "\n -f,--silent,--quiet Suppress most error messages" \ - "\n --reference=RFILE Use RFILE's group instead of using a CONTEXT value" \ - "\n -u,--user=USER Set user/role/type/range in the target" \ - "\n -r,--role=ROLE security context" \ - "\n -t,--type=TYPE" \ - "\n -l,--range=RANGE" \ - "\n -R,--recursive Recurse" \ - ) \ - IF_NOT_FEATURE_CHCON_LONG_OPTIONS( \ - "\n -v Verbose" \ - "\n -c Report changes made" \ - "\n -h Affect symlinks instead of their targets" \ - "\n -f Suppress most error messages" \ - "\n -u USER Set user/role/type/range in the target security context" \ - "\n -r ROLE" \ - "\n -t TYPE" \ - "\n -l RNG" \ - "\n -R Recurse" \ - ) - -#define chpst_trivial_usage \ - "[-vP012] [-u USER[:GRP]] [-U USER[:GRP]] [-e DIR]\n" \ - " [-/ DIR] [-n NICE] [-m BYTES] [-d BYTES] [-o N]\n" \ - " [-p N] [-f BYTES] [-c BYTES] PROG ARGS" -#define chpst_full_usage "\n\n" \ - "Change the process state, run PROG\n" \ - "\nOptions:" \ - "\n -u USER[:GRP] Set uid and gid" \ - "\n -U USER[:GRP] Set $UID and $GID in environment" \ - "\n -e DIR Set environment variables as specified by files" \ - "\n in DIR: file=1st_line_of_file" \ - "\n -/ DIR Chroot to DIR" \ - "\n -n NICE Add NICE to nice value" \ - "\n -m BYTES Same as -d BYTES -s BYTES -l BYTES" \ - "\n -d BYTES Limit data segment" \ - "\n -o N Limit number of open files per process" \ - "\n -p N Limit number of processes per uid" \ - "\n -f BYTES Limit output file sizes" \ - "\n -c BYTES Limit core file size" \ - "\n -v Verbose" \ - "\n -P Create new process group" \ - "\n -0 Close stdin" \ - "\n -1 Close stdout" \ - "\n -2 Close stderr" \ - -#define setuidgid_trivial_usage \ - "USER PROG ARGS" -#define setuidgid_full_usage "\n\n" \ - "Set uid and gid to USER's uid and gid, drop supplementary group ids,\n" \ - "run PROG" -#define envuidgid_trivial_usage \ - "USER PROG ARGS" -#define envuidgid_full_usage "\n\n" \ - "Set $UID to USER's uid and $GID to USER's gid, run PROG" -#define envdir_trivial_usage \ - "DIR PROG ARGS" -#define envdir_full_usage "\n\n" \ - "Set various environment variables as specified by files\n" \ - "in the directory DIR, run PROG" -#define softlimit_trivial_usage \ - "[-a BYTES] [-m BYTES] [-d BYTES] [-s BYTES] [-l BYTES]\n" \ - " [-f BYTES] [-c BYTES] [-r BYTES] [-o N] [-p N] [-t N]\n" \ - " PROG ARGS" -#define softlimit_full_usage "\n\n" \ - "Set soft resource limits, then run PROG\n" \ - "\nOptions:" \ - "\n -a BYTES Limit total size of all segments" \ - "\n -m BYTES Same as -d BYTES -s BYTES -l BYTES -a BYTES" \ - "\n -d BYTES Limit data segment" \ - "\n -s BYTES Limit stack segment" \ - "\n -l BYTES Limit locked memory size" \ - "\n -o N Limit number of open files per process" \ - "\n -p N Limit number of processes per uid" \ - "\nOptions controlling file sizes:" \ - "\n -f BYTES Limit output file sizes" \ - "\n -c BYTES Limit core file size" \ - "\nEfficiency opts:" \ - "\n -r BYTES Limit resident set size" \ - "\n -t N Limit CPU time, process receives" \ - "\n a SIGXCPU after N seconds" \ - -#define bbconfig_trivial_usage \ - "" -#define bbconfig_full_usage "\n\n" \ - "Print the config file used by busybox build" - -#define chrt_trivial_usage \ - "[-prfom] [PRIO] [PID | PROG ARGS]" -#define chrt_full_usage "\n\n" \ - "Change scheduling priority and class for a process\n" \ - "\nOptions:" \ - "\n -p Operate on PID" \ - "\n -r Set SCHED_RR class" \ - "\n -f Set SCHED_FIFO class" \ - "\n -o Set SCHED_OTHER class" \ - "\n -m Show min/max priorities" \ - -#define chrt_example_usage \ - "$ chrt -r 4 sleep 900; x=$!\n" \ - "$ chrt -f -p 3 $x\n" \ - "You need CAP_SYS_NICE privileges to set scheduling attributes of a process" - -#define renice_trivial_usage \ - "{{-n INCREMENT} | PRIORITY} [[-p | -g | -u] ID...]" -#define renice_full_usage "\n\n" \ - "Change scheduling priority for a running process\n" \ - "\nOptions:" \ - "\n -n Adjust current nice value (smaller is faster)" \ - "\n -p Process id(s) (default)" \ - "\n -g Process group id(s)" \ - "\n -u Process user name(s) and/or id(s)" \ - -#define ionice_trivial_usage \ - "[-c 1-3] [-n 0-7] [-p PID] [PROG]" -#define ionice_full_usage "\n\n" \ - "Change I/O priority and class\n" \ - "\nOptions:" \ - "\n -c Class. 1:realtime 2:best-effort 3:idle" \ - "\n -n Priority" \ - -#define crond_trivial_usage \ - "-fbS -l N " IF_FEATURE_CROND_D("-d N ") "-L LOGFILE -c DIR" -#define crond_full_usage "\n\n" \ - " -f Foreground" \ - "\n -b Background (default)" \ - "\n -S Log to syslog (default)" \ - "\n -l Set log level. 0 is the most verbose, default 8" \ - IF_FEATURE_CROND_D( \ - "\n -d Set log level, log to stderr" \ - ) \ - "\n -L Log to file" \ - "\n -c Working dir" \ - -#define crontab_trivial_usage \ - "[-c DIR] [-u USER] [-ler]|[FILE]" -#define crontab_full_usage "\n\n" \ - " -c Crontab directory" \ - "\n -u User" \ - "\n -l List crontab" \ - "\n -e Edit crontab" \ - "\n -r Delete crontab" \ - "\n FILE Replace crontab by FILE ('-': stdin)" \ - -#define devmem_trivial_usage \ - "ADDRESS [WIDTH [VALUE]]" - -#define devmem_full_usage "\n\n" \ - "Read/write from physical address\n" \ - "\n ADDRESS Address to act upon" \ - "\n WIDTH Width (8/16/...)" \ - "\n VALUE Data to be written" \ - -#define devfsd_trivial_usage \ - "mntpnt [-v]" IF_DEVFSD_FG_NP("[-fg][-np]") -#define devfsd_full_usage "\n\n" \ - "Manage devfs permissions and old device name symlinks\n" \ - "\nOptions:" \ - "\n mntpnt The mount point where devfs is mounted" \ - "\n -v Print the protocol version numbers for devfsd" \ - "\n and the kernel-side protocol version and exit" \ - IF_DEVFSD_FG_NP( \ - "\n -fg Run in foreground" \ - "\n -np Exit after parsing the configuration file" \ - "\n and processing synthetic REGISTER events," \ - "\n don't poll for events" \ - ) - -#define dhcprelay_trivial_usage \ - "CLIENT_IFACE[,CLIENT_IFACE2]... SERVER_IFACE [SERVER_IP]" -#define dhcprelay_full_usage "\n\n" \ - "Relay DHCP requests between clients and server" \ - -#define dmesg_trivial_usage \ - "[-c] [-n LEVEL] [-s SIZE]" -#define dmesg_full_usage "\n\n" \ - "Print or control the kernel ring buffer\n" \ - "\nOptions:" \ - "\n -c Clear ring buffer after printing" \ - "\n -n LEVEL Set console logging level" \ - "\n -s SIZE Buffer size" \ - -#define dnsd_trivial_usage \ - "[-dvs] [-c CONFFILE] [-t TTL_SEC] [-p PORT] [-i ADDR]" -#define dnsd_full_usage "\n\n" \ - "Small static DNS server daemon\n" \ - "\nOptions:" \ - "\n -c FILE Config file" \ - "\n -t SEC TTL" \ - "\n -p PORT Listen on PORT" \ - "\n -i ADDR Listen on ADDR" \ - "\n -d Daemonize" \ - "\n -v Verbose" \ - "\n -s Send successful replies only. Use this if you want" \ - "\n to use /etc/resolv.conf with two nameserver lines:" \ - "\n nameserver DNSD_SERVER" \ - "\n nameserver NORNAL_DNS_SERVER" \ - -#define dumpleases_trivial_usage \ - "[-r|-a] [-f LEASEFILE]" -#define dumpleases_full_usage "\n\n" \ - "Display DHCP leases granted by udhcpd\n" \ - "\nOptions:" \ - IF_LONG_OPTS( \ - "\n -f,--file=FILE Lease file" \ - "\n -r,--remaining Show remaining time" \ - "\n -a,--absolute Show expiration time" \ - ) \ - IF_NOT_LONG_OPTS( \ - "\n -f FILE Lease file" \ - "\n -r Show remaining time" \ - "\n -a Show expiration time" \ - ) - -/* -#define e2fsck_trivial_usage \ - "[-panyrcdfvstDFSV] [-b superblock] [-B blocksize] " \ - "[-I inode_buffer_blocks] [-P process_inode_size] " \ - "[-l|-L bad_blocks_file] [-C fd] [-j external_journal] " \ - "[-E extended-options] device" -#define e2fsck_full_usage "\n\n" \ - "Check ext2/ext3 file system\n" \ - "\nOptions:" \ - "\n -p Automatic repair (no questions)" \ - "\n -n Make no changes to the filesystem" \ - "\n -y Assume 'yes' to all questions" \ - "\n -c Check for bad blocks and add them to the badblock list" \ - "\n -f Force checking even if filesystem is marked clean" \ - "\n -v Verbose" \ - "\n -b superblock Use alternative superblock" \ - "\n -B blocksize Force blocksize when looking for superblock" \ - "\n -j journal Set location of the external journal" \ - "\n -l file Add to badblocks list" \ - "\n -L file Set badblocks list" \ -*/ - -#define eject_trivial_usage \ - "[-t] [-T] [DEVICE]" -#define eject_full_usage "\n\n" \ - "Eject DEVICE or default /dev/cdrom\n" \ - "\nOptions:" \ - IF_FEATURE_EJECT_SCSI( \ - "\n -s SCSI device" \ - ) \ - "\n -t Close tray" \ - "\n -T Open/close tray (toggle)" \ - -#define ether_wake_trivial_usage \ - "[-b] [-i iface] [-p aa:bb:cc:dd[:ee:ff]] MAC" -#define ether_wake_full_usage "\n\n" \ - "Send a magic packet to wake up sleeping machines.\n" \ - "MAC must be a station address (00:11:22:33:44:55) or\n" \ - "a hostname with a known 'ethers' entry.\n" \ - "\nOptions:" \ - "\n -b Send wake-up packet to the broadcast address" \ - "\n -i iface Interface to use (default eth0)" \ - "\n -p pass Append four or six byte password PW to the packet" \ - -#define fakeidentd_trivial_usage \ - "[-fiw] [-b ADDR] [STRING]" -#define fakeidentd_full_usage "\n\n" \ - "Provide fake ident (auth) service\n" \ - "\nOptions:" \ - "\n -f Run in foreground" \ - "\n -i Inetd mode" \ - "\n -w Inetd 'wait' mode" \ - "\n -b ADDR Bind to specified address" \ - "\n STRING Ident answer string (default: nobody)" \ - -#define fbsplash_trivial_usage \ - "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" -#define fbsplash_full_usage "\n\n" \ - "Options:" \ - "\n -s Image" \ - "\n -c Hide cursor" \ - "\n -d Framebuffer device (default /dev/fb0)" \ - "\n -i Config file (var=value):" \ - "\n BAR_LEFT,BAR_TOP,BAR_WIDTH,BAR_HEIGHT" \ - "\n BAR_R,BAR_G,BAR_B" \ - "\n -f Control pipe (else exit after drawing image)" \ - "\n commands: 'NN' (% for progress bar) or 'exit'" \ - -#define fbset_trivial_usage \ - "[OPTIONS] [MODE]" -#define fbset_full_usage "\n\n" \ - "Show and modify frame buffer settings" - -#define fbset_example_usage \ - "$ fbset\n" \ - "mode \"1024x768-76\"\n" \ - " # D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz\n" \ - " geometry 1024 768 1024 768 16\n" \ - " timings 12714 128 32 16 4 128 4\n" \ - " accel false\n" \ - " rgba 5/11,6/5,5/0,0/0\n" \ - "endmode\n" - -#define fdflush_trivial_usage \ - "DEVICE" -#define fdflush_full_usage "\n\n" \ - "Force floppy disk drive to detect disk change" - -#define fdformat_trivial_usage \ - "[-n] DEVICE" -#define fdformat_full_usage "\n\n" \ - "Format floppy disk\n" \ - "\nOptions:" \ - "\n -n Don't verify after format" \ - -/* Looks like someone forgot to add this to config system */ -#ifndef ENABLE_FEATURE_FDISK_BLKSIZE -# define ENABLE_FEATURE_FDISK_BLKSIZE 0 -# define IF_FEATURE_FDISK_BLKSIZE(a) -#endif - -#define fdisk_trivial_usage \ - "[-ul" IF_FEATURE_FDISK_BLKSIZE("s") "] " \ - "[-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK" -#define fdisk_full_usage "\n\n" \ - "Change partition table\n" \ - "\nOptions:" \ - "\n -u Start and End are in sectors (instead of cylinders)" \ - "\n -l Show partition table for each DISK, then exit" \ - IF_FEATURE_FDISK_BLKSIZE( \ - "\n -s Show partition sizes in kb for each DISK, then exit" \ - ) \ - "\n -b 2048 (for certain MO disks) use 2048-byte sectors" \ - "\n -C CYLINDERS Set number of cylinders/heads/sectors" \ - "\n -H HEADS" \ - "\n -S SECTORS" \ - -#define findfs_trivial_usage \ - "LABEL=label or UUID=uuid" -#define findfs_full_usage "\n\n" \ - "Find a filesystem device based on a label or UUID" -#define findfs_example_usage \ - "$ findfs LABEL=MyDevice" - -#define flash_lock_trivial_usage \ - "MTD_DEVICE OFFSET SECTORS" -#define flash_lock_full_usage "\n\n" \ - "Lock part or all of an MTD device. If SECTORS is -1, then all sectors\n" \ - "will be locked, regardless of the value of OFFSET" - -#define flash_unlock_trivial_usage \ - "MTD_DEVICE" -#define flash_unlock_full_usage "\n\n" \ - "Unlock an MTD device" - -#define flash_eraseall_trivial_usage \ - "[-jq] MTD_DEVICE" -#define flash_eraseall_full_usage "\n\n" \ - "Erase an MTD device\n" \ - "\nOptions:" \ - "\n -j Format the device for jffs2" \ - "\n -q Don't display progress messages" \ - -#define flashcp_trivial_usage \ - "-v FILE MTD_DEVICE" -#define flashcp_full_usage "\n\n" \ - "Copy an image to MTD device\n" \ - "\nOptions:" \ - "\n -v Verbose" \ - -#define flock_trivial_usage \ - "[-sxun] FD|{FILE [-c] PROG ARGS}" -#define flock_full_usage "\n\n" \ - "[Un]lock file descriptor, or lock FILE, run PROG\n" \ - "\nOptions:" \ - "\n -s Shared lock" \ - "\n -x Exclusive lock (default)" \ - "\n -u Unlock FD" \ - "\n -n Fail rather than wait" \ - -#define free_trivial_usage \ - "" IF_DESKTOP("[-b/k/m/g]") -#define free_full_usage "\n\n" \ - "Display the amount of free and used system memory" -#define free_example_usage \ - "$ free\n" \ - " total used free shared buffers\n" \ - " Mem: 257628 248724 8904 59644 93124\n" \ - " Swap: 128516 8404 120112\n" \ - "Total: 386144 257128 129016\n" \ - -#define freeramdisk_trivial_usage \ - "DEVICE" -#define freeramdisk_full_usage "\n\n" \ - "Free all memory used by the specified ramdisk" -#define freeramdisk_example_usage \ - "$ freeramdisk /dev/ram2\n" - -#define fsck_minix_trivial_usage \ - "[-larvsmf] BLOCKDEV" -#define fsck_minix_full_usage "\n\n" \ - "Check MINIX filesystem\n" \ - "\nOptions:" \ - "\n -l List all filenames" \ - "\n -r Perform interactive repairs" \ - "\n -a Perform automatic repairs" \ - "\n -v Verbose" \ - "\n -s Output superblock information" \ - "\n -m Show \"mode not cleared\" warnings" \ - "\n -f Force file system check" \ - -#define ftpget_trivial_usage \ - "[OPTIONS] HOST [LOCAL_FILE] REMOTE_FILE" -#define ftpget_full_usage "\n\n" \ - "Retrieve a remote file via FTP\n" \ - "\nOptions:" \ - IF_FEATURE_FTPGETPUT_LONG_OPTIONS( \ - "\n -c,--continue Continue previous transfer" \ - "\n -v,--verbose Verbose" \ - "\n -u,--username Username" \ - "\n -p,--password Password" \ - "\n -P,--port Port number" \ - ) \ - IF_NOT_FEATURE_FTPGETPUT_LONG_OPTIONS( \ - "\n -c Continue previous transfer" \ - "\n -v Verbose" \ - "\n -u Username" \ - "\n -p Password" \ - "\n -P Port number" \ - ) - -#define ftpput_trivial_usage \ - "[OPTIONS] HOST [REMOTE_FILE] LOCAL_FILE" -#define ftpput_full_usage "\n\n" \ - "Store a local file on a remote machine via FTP\n" \ - "\nOptions:" \ - IF_FEATURE_FTPGETPUT_LONG_OPTIONS( \ - "\n -v,--verbose Verbose" \ - "\n -u,--username Username" \ - "\n -p,--password Password" \ - "\n -P,--port Port number" \ - ) \ - IF_NOT_FEATURE_FTPGETPUT_LONG_OPTIONS( \ - "\n -v Verbose" \ - "\n -u Username" \ - "\n -p Password" \ - "\n -P Port number" \ - ) - -#define fuser_trivial_usage \ - "[OPTIONS] FILE or PORT/PROTO" -#define fuser_full_usage "\n\n" \ - "Find processes which use FILEs or PORTs\n" \ - "\nOptions:" \ - "\n -m Find processes which use same fs as FILEs" \ - "\n -4,-6 Search only IPv4/IPv6 space" \ - "\n -s Don't display PIDs" \ - "\n -k Kill found processes" \ - "\n -SIGNAL Signal to send (default: KILL)" \ - -#define getenforce_trivial_usage NOUSAGE_STR -#define getenforce_full_usage "" - -#define getopt_trivial_usage \ - "[OPTIONS]" -#define getopt_full_usage "\n\n" \ - "Options:" \ - IF_LONG_OPTS( \ - "\n -a,--alternative Allow long options starting with single -" \ - "\n -l,--longoptions=longopts Long options to be recognized" \ - "\n -n,--name=progname The name under which errors are reported" \ - "\n -o,--options=optstring Short options to be recognized" \ - "\n -q,--quiet Disable error reporting by getopt(3)" \ - "\n -Q,--quiet-output No normal output" \ - "\n -s,--shell=shell Set shell quoting conventions" \ - "\n -T,--test Test for getopt(1) version" \ - "\n -u,--unquoted Don't quote the output" \ - ) \ - IF_NOT_LONG_OPTS( \ - "\n -a Allow long options starting with single -" \ - "\n -l longopts Long options to be recognized" \ - "\n -n progname The name under which errors are reported" \ - "\n -o optstring Short options to be recognized" \ - "\n -q Disable error reporting by getopt(3)" \ - "\n -Q No normal output" \ - "\n -s shell Set shell quoting conventions" \ - "\n -T Test for getopt(1) version" \ - "\n -u Don't quote the output" \ - ) -#define getopt_example_usage \ - "$ cat getopt.test\n" \ - "#!/bin/sh\n" \ - "GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \\\n" \ - " -n 'example.busybox' -- \"$@\"`\n" \ - "if [ $? != 0 ]; then exit 1; fi\n" \ - "eval set -- \"$GETOPT\"\n" \ - "while true; do\n" \ - " case $1 in\n" \ - " -a|--a-long) echo \"Option a\"; shift;;\n" \ - " -b|--b-long) echo \"Option b, argument '$2'\"; shift 2;;\n" \ - " -c|--c-long)\n" \ - " case \"$2\" in\n" \ - " \"\") echo \"Option c, no argument\"; shift 2;;\n" \ - " *) echo \"Option c, argument '$2'\"; shift 2;;\n" \ - " esac;;\n" \ - " --) shift; break;;\n" \ - " *) echo \"Internal error!\"; exit 1;;\n" \ - " esac\n" \ - "done\n" - -#define getsebool_trivial_usage \ - "-a or getsebool boolean..." -#define getsebool_full_usage "\n\n" \ - " -a Show all selinux booleans" - -#define hdparm_trivial_usage \ - "[OPTIONS] [DEVICE]" -#define hdparm_full_usage "\n\n" \ - "Options:" \ - "\n -a Get/set fs readahead" \ - "\n -A Set drive read-lookahead flag (0/1)" \ - "\n -b Get/set bus state (0 == off, 1 == on, 2 == tristate)" \ - "\n -B Set Advanced Power Management setting (1-255)" \ - "\n -c Get/set IDE 32-bit IO setting" \ - "\n -C Check IDE power mode status" \ - IF_FEATURE_HDPARM_HDIO_GETSET_DMA( \ - "\n -d Get/set using_dma flag") \ - "\n -D Enable/disable drive defect-mgmt" \ - "\n -f Flush buffer cache for device on exit" \ - "\n -g Display drive geometry" \ - "\n -h Display terse usage information" \ - IF_FEATURE_HDPARM_GET_IDENTITY( \ - "\n -i Display drive identification") \ - IF_FEATURE_HDPARM_GET_IDENTITY( \ - "\n -I Detailed/current information directly from drive") \ - "\n -k Get/set keep_settings_over_reset flag (0/1)" \ - "\n -K Set drive keep_features_over_reset flag (0/1)" \ - "\n -L Set drive doorlock (0/1) (removable harddisks only)" \ - "\n -m Get/set multiple sector count" \ - "\n -n Get/set ignore-write-errors flag (0/1)" \ - "\n -p Set PIO mode on IDE interface chipset (0,1,2,3,4,...)" \ - "\n -P Set drive prefetch count" \ -/* "\n -q Change next setting quietly" - not supported ib bbox */ \ - "\n -Q Get/set DMA tagged-queuing depth (if supported)" \ - "\n -r Get/set readonly flag (DANGEROUS to set)" \ - IF_FEATURE_HDPARM_HDIO_SCAN_HWIF( \ - "\n -R Register an IDE interface (DANGEROUS)") \ - "\n -S Set standby (spindown) timeout" \ - "\n -t Perform device read timings" \ - "\n -T Perform cache read timings" \ - "\n -u Get/set unmaskirq flag (0/1)" \ - IF_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF( \ - "\n -U Unregister an IDE interface (DANGEROUS)") \ - "\n -v Defaults; same as -mcudkrag for IDE drives" \ - "\n -V Display program version and exit immediately" \ - IF_FEATURE_HDPARM_HDIO_DRIVE_RESET( \ - "\n -w Perform device reset (DANGEROUS)") \ - "\n -W Set drive write-caching flag (0/1) (DANGEROUS)" \ - IF_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( \ - "\n -x Tristate device for hotswap (0/1) (DANGEROUS)") \ - "\n -X Set IDE xfer mode (DANGEROUS)" \ - "\n -y Put IDE drive in standby mode" \ - "\n -Y Put IDE drive to sleep" \ - "\n -Z Disable Seagate auto-powersaving mode" \ - "\n -z Reread partition table" \ - -#define hexdump_trivial_usage \ - "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..." -#define hexdump_full_usage "\n\n" \ - "Display FILEs (or stdin) in a user specified format\n" \ - "\nOptions:" \ - "\n -b One-byte octal display" \ - "\n -c One-byte character display" \ - "\n -C Canonical hex+ASCII, 16 bytes per line" \ - "\n -d Two-byte decimal display" \ - "\n -e FORMAT_STRING" \ - "\n -f FORMAT_FILE" \ - "\n -n LENGTH Interpret only LENGTH bytes of input" \ - "\n -o Two-byte octal display" \ - "\n -s OFFSET Skip OFFSET bytes" \ - "\n -v Display all input data" \ - "\n -x Two-byte hexadecimal display" \ - IF_FEATURE_HEXDUMP_REVERSE( \ - "\n -R Reverse of 'hexdump -Cv'") \ - -#define hd_trivial_usage \ - "FILE..." -#define hd_full_usage "\n\n" \ - "hd is an alias for hexdump -C" - -#define hostname_trivial_usage \ - "[OPTIONS] [HOSTNAME | -F FILE]" -#define hostname_full_usage "\n\n" \ - "Get or set hostname or DNS domain name\n" \ - "\nOptions:" \ - "\n -s Short" \ - "\n -i Addresses for the hostname" \ - "\n -d DNS domain name" \ - "\n -f Fully qualified domain name" \ - "\n -F FILE Use FILE's content as hostname" \ - -#define hostname_example_usage \ - "$ hostname\n" \ - "sage\n" - -#define dnsdomainname_trivial_usage NOUSAGE_STR -#define dnsdomainname_full_usage "" - -#define httpd_trivial_usage \ - "[-ifv[v]]" \ - " [-c CONFFILE]" \ - " [-p [IP:]PORT]" \ - IF_FEATURE_HTTPD_SETUID(" [-u USER[:GRP]]") \ - IF_FEATURE_HTTPD_BASIC_AUTH(" [-r REALM]") \ - " [-h HOME]\n" \ - "or httpd -d/-e" IF_FEATURE_HTTPD_AUTH_MD5("/-m") " STRING" -#define httpd_full_usage "\n\n" \ - "Listen for incoming HTTP requests\n" \ - "\nOptions:" \ - "\n -i Inetd mode" \ - "\n -f Don't daemonize" \ - "\n -v[v] Verbose" \ - "\n -p [IP:]PORT Bind to IP:PORT (default *:80)" \ - IF_FEATURE_HTTPD_SETUID( \ - "\n -u USER[:GRP] Set uid/gid after binding to port") \ - IF_FEATURE_HTTPD_BASIC_AUTH( \ - "\n -r REALM Authentication Realm for Basic Authentication") \ - "\n -h HOME Home directory (default .)" \ - "\n -c FILE Configuration file (default {/etc,HOME}/httpd.conf)" \ - IF_FEATURE_HTTPD_AUTH_MD5( \ - "\n -m STRING MD5 crypt STRING") \ - "\n -e STRING HTML encode STRING" \ - "\n -d STRING URL decode STRING" \ - -#define ifconfig_trivial_usage \ - IF_FEATURE_IFCONFIG_STATUS("[-a]") " interface [address]" -#define ifconfig_full_usage "\n\n" \ - "Configure a network interface\n" \ - "\nOptions:" \ - "\n" \ - IF_FEATURE_IPV6( \ - " [add ADDRESS[/PREFIXLEN]]\n") \ - IF_FEATURE_IPV6( \ - " [del ADDRESS[/PREFIXLEN]]\n") \ - " [[-]broadcast [ADDRESS]] [[-]pointopoint [ADDRESS]]\n" \ - " [netmask ADDRESS] [dstaddr ADDRESS]\n" \ - IF_FEATURE_IFCONFIG_SLIP( \ - " [outfill NN] [keepalive NN]\n") \ - " " IF_FEATURE_IFCONFIG_HW("[hw ether" IF_FEATURE_HWIB("|infiniband")" ADDRESS] ") "[metric NN] [mtu NN]\n" \ - " [[-]trailers] [[-]arp] [[-]allmulti]\n" \ - " [multicast] [[-]promisc] [txqueuelen NN] [[-]dynamic]\n" \ - IF_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ( \ - " [mem_start NN] [io_addr NN] [irq NN]\n") \ - " [up|down] ..." - -#define ifenslave_trivial_usage \ - "[-cdf] MASTER_IFACE SLAVE_IFACE..." -#define ifenslave_full_usage "\n\n" \ - "Configure network interfaces for parallel routing\n" \ - "\nOptions:" \ - "\n -c,--change-active Change active slave" \ - "\n -d,--detach Remove slave interface from bonding device" \ - "\n -f,--force Force, even if interface is not Ethernet" \ -/* "\n -r,--receive-slave Create a receive-only slave" */ - -#define ifenslave_example_usage \ - "To create a bond device, simply follow these three steps:\n" \ - "- ensure that the required drivers are properly loaded:\n" \ - " # modprobe bonding ; modprobe <3c59x|eepro100|pcnet32|tulip|...>\n" \ - "- assign an IP address to the bond device:\n" \ - " # ifconfig bond0 netmask broadcast \n" \ - "- attach all the interfaces you need to the bond device:\n" \ - " # ifenslave bond0 eth0 eth1 eth2\n" \ - " If bond0 didn't have a MAC address, it will take eth0's. Then, all\n" \ - " interfaces attached AFTER this assignment will get the same MAC addr.\n\n" \ - " To detach a dead interface without setting the bond device down:\n" \ - " # ifenslave -d bond0 eth1\n\n" \ - " To set the bond device down and automatically release all the slaves:\n" \ - " # ifconfig bond0 down\n\n" \ - " To change active slave:\n" \ - " # ifenslave -c bond0 eth0\n" \ - -#define ifplugd_trivial_usage \ - "[OPTIONS]" -#define ifplugd_full_usage "\n\n" \ - "Network interface plug detection daemon\n" \ - "\nOptions:" \ - "\n -n Don't daemonize" \ - "\n -s Don't log to syslog" \ - "\n -i IFACE Interface" \ - "\n -f/-F Treat link detection error as link down/link up" \ - "\n (otherwise exit on error)" \ - "\n -a Don't up interface at each link probe" \ - "\n -M Monitor creation/destruction of interface" \ - "\n (otherwise it must exist)" \ - "\n -r PROG Script to run" \ - "\n -x ARG Extra argument for script" \ - "\n -I Don't exit on nonzero exit code from script" \ - "\n -p Don't run script on daemon startup" \ - "\n -q Don't run script on daemon quit" \ - "\n -l Run script on startup even if no cable is detected" \ - "\n -t SECS Poll time in seconds" \ - "\n -u SECS Delay before running script after link up" \ - "\n -d SECS Delay after link down" \ - "\n -m MODE API mode (mii, priv, ethtool, wlan, iff, auto)" \ - "\n -k Kill running daemon" \ - -#define ifup_trivial_usage \ - "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." -#define ifup_full_usage "\n\n" \ - "Options:" \ - "\n -a De/configure all interfaces automatically" \ - "\n -i FILE Use FILE for interface definitions" \ - "\n -n Print out what would happen, but don't do it" \ - IF_FEATURE_IFUPDOWN_MAPPING( \ - "\n (note: doesn't disable mappings)" \ - "\n -m Don't run any mappings" \ - ) \ - "\n -v Print out what would happen before doing it" \ - "\n -f Force de/configuration" \ - -#define ifdown_trivial_usage \ - "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." -#define ifdown_full_usage "\n\n" \ - "Options:" \ - "\n -a De/configure all interfaces automatically" \ - "\n -i FILE Use FILE for interface definitions" \ - "\n -n Print out what would happen, but don't do it" \ - IF_FEATURE_IFUPDOWN_MAPPING( \ - "\n (note: doesn't disable mappings)" \ - "\n -m Don't run any mappings" \ - ) \ - "\n -v Print out what would happen before doing it" \ - "\n -f Force de/configuration" \ - -#define inetd_trivial_usage \ - "[-fe] [-q N] [-R N] [CONFFILE]" -#define inetd_full_usage "\n\n" \ - "Listen for network connections and launch programs\n" \ - "\nOptions:" \ - "\n -f Run in foreground" \ - "\n -e Log to stderr" \ - "\n -q N Socket listen queue (default: 128)" \ - "\n -R N Pause services after N connects/min" \ - "\n (default: 0 - disabled)" \ - -#define inotifyd_trivial_usage \ - "PROG FILE1[:MASK]..." -#define inotifyd_full_usage "\n\n" \ - "Run PROG on filesystem changes." \ - "\nWhen a filesystem event matching MASK occurs on FILEn," \ - "\nPROG ACTUAL_EVENTS FILEn [SUBFILE] is run." \ - "\nEvents:" \ - "\n a File is accessed" \ - "\n c File is modified" \ - "\n e Metadata changed" \ - "\n w Writable file is closed" \ - "\n 0 Unwritable file is closed" \ - "\n r File is opened" \ - "\n D File is deleted" \ - "\n M File is moved" \ - "\n u Backing fs is unmounted" \ - "\n o Event queue overflowed" \ - "\n x File can't be watched anymore" \ - "\nIf watching a directory:" \ - "\n m Subfile is moved into dir" \ - "\n y Subfile is moved out of dir" \ - "\n n Subfile is created" \ - "\n d Subfile is deleted" \ - "\n" \ - "\ninotifyd waits for PROG to exit." \ - "\nWhen x event happens for all FILEs, inotifyd exits." \ - -/* would need to make the " | " optional depending on more than one selected: */ -#define ip_trivial_usage \ - "[OPTIONS] {" \ - IF_FEATURE_IP_ADDRESS("address | ") \ - IF_FEATURE_IP_ROUTE("route | ") \ - IF_FEATURE_IP_LINK("link | ") \ - IF_FEATURE_IP_TUNNEL("tunnel | ") \ - IF_FEATURE_IP_RULE("rule") \ - "} {COMMAND}" -#define ip_full_usage "\n\n" \ - "ip [OPTIONS] OBJECT {COMMAND}\n" \ - "where OBJECT := {" \ - IF_FEATURE_IP_ADDRESS("address | ") \ - IF_FEATURE_IP_ROUTE("route | ") \ - IF_FEATURE_IP_LINK("link | ") \ - IF_FEATURE_IP_TUNNEL("tunnel | ") \ - IF_FEATURE_IP_RULE("rule") \ - "}\n" \ - "OPTIONS := { -f[amily] { inet | inet6 | link } | -o[neline] }" \ - -#define ipaddr_trivial_usage \ - "{ {add|del} IFADDR dev STRING | {show|flush}\n" \ - " [dev STRING] [to PREFIX] }" -#define ipaddr_full_usage "\n\n" \ - "ipaddr {add|delete} IFADDR dev STRING\n" \ - "ipaddr {show|flush} [dev STRING] [scope SCOPE-ID]\n" \ - " [to PREFIX] [label PATTERN]\n" \ - " IFADDR := PREFIX | ADDR peer PREFIX\n" \ - " [broadcast ADDR] [anycast ADDR]\n" \ - " [label STRING] [scope SCOPE-ID]\n" \ - " SCOPE-ID := [host | link | global | NUMBER]" \ - -#define ipcalc_trivial_usage \ - "[OPTIONS] ADDRESS[[/]NETMASK] [NETMASK]" -#define ipcalc_full_usage "\n\n" \ - "Calculate IP network settings from a IP address\n" \ - "\nOptions:" \ - IF_FEATURE_IPCALC_LONG_OPTIONS( \ - "\n -b,--broadcast Display calculated broadcast address" \ - "\n -n,--network Display calculated network address" \ - "\n -m,--netmask Display default netmask for IP" \ - IF_FEATURE_IPCALC_FANCY( \ - "\n -p,--prefix Display the prefix for IP/NETMASK" \ - "\n -h,--hostname Display first resolved host name" \ - "\n -s,--silent Don't ever display error messages" \ - ) \ - ) \ - IF_NOT_FEATURE_IPCALC_LONG_OPTIONS( \ - "\n -b Display calculated broadcast address" \ - "\n -n Display calculated network address" \ - "\n -m Display default netmask for IP" \ - IF_FEATURE_IPCALC_FANCY( \ - "\n -p Display the prefix for IP/NETMASK" \ - "\n -h Display first resolved host name" \ - "\n -s Don't ever display error messages" \ - ) \ - ) - -#define ipcrm_trivial_usage \ - "[-MQS key] [-mqs id]" -#define ipcrm_full_usage "\n\n" \ - "Upper-case options MQS remove an object by shmkey value.\n" \ - "Lower-case options remove an object by shmid value.\n" \ - "\nOptions:" \ - "\n -mM Remove memory segment after last detach" \ - "\n -qQ Remove message queue" \ - "\n -sS Remove semaphore" \ - -#define ipcs_trivial_usage \ - "[[-smq] -i shmid] | [[-asmq] [-tcplu]]" -#define ipcs_full_usage "\n\n" \ - " -i Show specific resource" \ - "\nResource specification:" \ - "\n -m Shared memory segments" \ - "\n -q Message queues" \ - "\n -s Semaphore arrays" \ - "\n -a All (default)" \ - "\nOutput format:" \ - "\n -t Time" \ - "\n -c Creator" \ - "\n -p Pid" \ - "\n -l Limits" \ - "\n -u Summary" \ - -#define iplink_trivial_usage \ - "{ set DEVICE { up | down | arp { on | off } | show [DEVICE] }" -#define iplink_full_usage "\n\n" \ - "iplink set DEVICE { up | down | arp | multicast { on | off } |\n" \ - " dynamic { on | off } |\n" \ - " mtu MTU }\n" \ - "iplink show [DEVICE]" \ - -#define iproute_trivial_usage \ - "{ list | flush | { add | del | change | append |\n" \ - " replace | monitor } ROUTE }" -#define iproute_full_usage "\n\n" \ - "iproute { list | flush } SELECTOR\n" \ - "iproute get ADDRESS [from ADDRESS iif STRING]\n" \ - " [oif STRING] [tos TOS]\n" \ - "iproute { add | del | change | append | replace | monitor } ROUTE\n" \ - " SELECTOR := [root PREFIX] [match PREFIX] [proto RTPROTO]\n" \ - " ROUTE := [TYPE] PREFIX [tos TOS] [proto RTPROTO]\n" \ - " [metric METRIC]" \ - -#define iprule_trivial_usage \ - "{[list | add | del] RULE}" -#define iprule_full_usage "\n\n" \ - "iprule [list | add | del] SELECTOR ACTION\n" \ - " SELECTOR := [from PREFIX] [to PREFIX] [tos TOS] [fwmark FWMARK]\n" \ - " [dev STRING] [pref NUMBER]\n" \ - " ACTION := [table TABLE_ID] [nat ADDRESS]\n" \ - " [prohibit | reject | unreachable]\n" \ - " [realms [SRCREALM/]DSTREALM]\n" \ - " TABLE_ID := [local | main | default | NUMBER]" \ - -#define iptunnel_trivial_usage \ - "{ add | change | del | show } [NAME]\n" \ - " [mode { ipip | gre | sit }]\n" \ - " [remote ADDR] [local ADDR] [ttl TTL]" -#define iptunnel_full_usage "\n\n" \ - "iptunnel { add | change | del | show } [NAME]\n" \ - " [mode { ipip | gre | sit }] [remote ADDR] [local ADDR]\n" \ - " [[i|o]seq] [[i|o]key KEY] [[i|o]csum]\n" \ - " [ttl TTL] [tos TOS] [[no]pmtudisc] [dev PHYS_DEV]" \ - -#define kill_trivial_usage \ - "[-l] [-SIG] PID..." -#define kill_full_usage "\n\n" \ - "Send a signal (default: TERM) to given PIDs\n" \ - "\nOptions:" \ - "\n -l List all signal names and numbers" \ -/* "\n -s SIG Yet another way of specifying SIG" */ \ - -#define kill_example_usage \ - "$ ps | grep apache\n" \ - "252 root root S [apache]\n" \ - "263 www-data www-data S [apache]\n" \ - "264 www-data www-data S [apache]\n" \ - "265 www-data www-data S [apache]\n" \ - "266 www-data www-data S [apache]\n" \ - "267 www-data www-data S [apache]\n" \ - "$ kill 252\n" - -#define killall_trivial_usage \ - "[-l] [-q] [-SIG] PROCESS_NAME..." -#define killall_full_usage "\n\n" \ - "Send a signal (default: TERM) to given processes\n" \ - "\nOptions:" \ - "\n -l List all signal names and numbers" \ -/* "\n -s SIG Yet another way of specifying SIG" */ \ - "\n -q Don't complain if no processes were killed" \ - -#define killall_example_usage \ - "$ killall apache\n" - -#define killall5_trivial_usage \ - "[-l] [-SIG] [-o PID]..." -#define killall5_full_usage "\n\n" \ - "Send a signal (default: TERM) to all processes outside current session\n" \ - "\nOptions:" \ - "\n -l List all signal names and numbers" \ - "\n -o PID Don't signal this PID" \ -/* "\n -s SIG Yet another way of specifying SIG" */ \ - -#define klogd_trivial_usage \ - "[-c N] [-n]" -#define klogd_full_usage "\n\n" \ - "Kernel logger\n" \ - "\nOptions:" \ - "\n -c N Only messages with level < N are printed to console" \ - "\n -n Run in foreground" \ - -#define less_trivial_usage \ - "[-EMNmh~I?] [FILE]..." -#define less_full_usage "\n\n" \ - "View FILE (or stdin) one screenful at a time\n" \ - "\nOptions:" \ - "\n -E Quit once the end of a file is reached" \ - "\n -M,-m Display status line with line numbers" \ - "\n and percentage through the file" \ - "\n -N Prefix line number to each line" \ - "\n -I Ignore case in all searches" \ - "\n -~ Suppress ~s displayed past the end of the file" \ - -#define linux32_trivial_usage NOUSAGE_STR -#define linux32_full_usage "" -#define linux64_trivial_usage NOUSAGE_STR -#define linux64_full_usage "" - -#define setarch_trivial_usage \ - "personality PROG ARGS" -#define setarch_full_usage "\n\n" \ - "Personality may be:\n" \ - " linux32 Set 32bit uname emulation\n" \ - " linux64 Set 64bit uname emulation" \ - -#define load_policy_trivial_usage NOUSAGE_STR -#define load_policy_full_usage "" - -#define logger_trivial_usage \ - "[OPTIONS] [MESSAGE]" -#define logger_full_usage "\n\n" \ - "Write MESSAGE (or stdin) to syslog\n" \ - "\nOptions:" \ - "\n -s Log to stderr as well as the system log" \ - "\n -t TAG Log using the specified tag (defaults to user name)" \ - "\n -p PRIO Priority (numeric or facility.level pair)" \ - -#define logger_example_usage \ - "$ logger \"hello\"\n" - -#define logread_trivial_usage \ - "[-f]" -#define logread_full_usage "\n\n" \ - "Show messages in syslogd's circular buffer\n" \ - "\nOptions:" \ - "\n -f Output data as log grows" \ - -#define losetup_trivial_usage \ - "[-o OFS] LOOPDEV FILE - associate loop devices\n" \ - " losetup -d LOOPDEV - disassociate\n" \ - " losetup [-f] - show" -#define losetup_full_usage "\n\n" \ - "Options:" \ - "\n -o OFS Start OFS bytes into FILE" \ - "\n -f Show first free loop device" \ - -#define losetup_notes_usage \ - "No arguments will display all current associations.\n" \ - "One argument (losetup /dev/loop1) will display the current association\n" \ - "(if any), or disassociate it (with -d). The display shows the offset\n" \ - "and filename of the file the loop device is currently bound to.\n\n" \ - "Two arguments (losetup /dev/loop1 file.img) create a new association,\n" \ - "with an optional offset (-o 12345). Encryption is not yet supported.\n" \ - "losetup -f will show the first loop free loop device\n\n" - -#define lpd_trivial_usage \ - "SPOOLDIR [HELPER [ARGS]]" -#define lpd_full_usage "\n\n" \ - "SPOOLDIR must contain (symlinks to) device nodes or directories" \ - "\nwith names matching print queue names. In the first case, jobs are" \ - "\nsent directly to the device. Otherwise each job is stored in queue" \ - "\ndirectory and HELPER program is called. Name of file to print" \ - "\nis passed in $DATAFILE variable." \ - "\nExample:" \ - "\n tcpsvd -E 0 515 softlimit -m 999999 lpd /var/spool ./print" \ - -#define lpq_trivial_usage \ - "[-P queue[@host[:port]]] [-U USERNAME] [-d JOBID]... [-fs]" -#define lpq_full_usage "\n\n" \ - "Options:" \ - "\n -P lp service to connect to (else uses $PRINTER)" \ - "\n -d Delete jobs" \ - "\n -f Force any waiting job to be printed" \ - "\n -s Short display" \ - -#define lpr_trivial_usage \ - "-P queue[@host[:port]] -U USERNAME -J TITLE -Vmh [FILE]..." -/* -C CLASS exists too, not shown. - * CLASS is supposed to be printed on banner page, if one is requested */ -#define lpr_full_usage "\n\n" \ - "Options:" \ - "\n -P lp service to connect to (else uses $PRINTER)"\ - "\n -m Send mail on completion" \ - "\n -h Print banner page too" \ - "\n -V Verbose" \ - -#define lspci_trivial_usage \ - "[-mk]" -#define lspci_full_usage "\n\n" \ - "List all PCI devices" \ - "\n" \ - "\n -m Parseable output" \ - "\n -k Show driver" \ - -#define lsusb_trivial_usage NOUSAGE_STR -#define lsusb_full_usage "" - -#if ENABLE_FEATURE_MAKEDEVS_LEAF -#define makedevs_trivial_usage \ - "NAME TYPE MAJOR MINOR FIRST LAST [s]" -#define makedevs_full_usage "\n\n" \ - "Create a range of block or character special files" \ - "\n" \ - "\nTYPE is:" \ - "\n b Block device" \ - "\n c Character device" \ - "\n f FIFO, MAJOR and MINOR are ignored" \ - "\n" \ - "\nFIRST..LAST specify numbers appended to NAME." \ - "\nIf 's' is the last argument, the base device is created as well." \ - "\n" \ - "\nExamples:" \ - "\n makedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63" \ - "\n makedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8" -#define makedevs_example_usage \ - "# makedevs /dev/ttyS c 4 66 2 63\n" \ - "[creates ttyS2-ttyS63]\n" \ - "# makedevs /dev/hda b 3 0 0 8 s\n" \ - "[creates hda,hda1-hda8]\n" -#endif - -#if ENABLE_FEATURE_MAKEDEVS_TABLE -#define makedevs_trivial_usage \ - "[-d device_table] rootdir" -#define makedevs_full_usage "\n\n" \ - "Create a range of special files as specified in a device table.\n" \ - "Device table entries take the form of:\n" \ - " \n" \ - "Where name is the file name, type can be one of:\n" \ - " f Regular file\n" \ - " d Directory\n" \ - " c Character device\n" \ - " b Block device\n" \ - " p Fifo (named pipe)\n" \ - "uid is the user id for the target file, gid is the group id for the\n" \ - "target file. The rest of the entries (major, minor, etc) apply to\n" \ - "to device special files. A '-' may be used for blank entries." -#define makedevs_example_usage \ - "For example:\n" \ - " \n" \ - "/dev d 755 0 0 - - - - -\n" \ - "/dev/console c 666 0 0 5 1 - - -\n" \ - "/dev/null c 666 0 0 1 3 0 0 -\n" \ - "/dev/zero c 666 0 0 1 5 0 0 -\n" \ - "/dev/hda b 640 0 0 3 0 0 0 -\n" \ - "/dev/hda b 640 0 0 3 1 1 1 15\n\n" \ - "Will Produce:\n" \ - "/dev\n" \ - "/dev/console\n" \ - "/dev/null\n" \ - "/dev/zero\n" \ - "/dev/hda\n" \ - "/dev/hda[0-15]\n" -#endif - -#define man_trivial_usage \ - "[-aw] [MANPAGE]..." -#define man_full_usage "\n\n" \ - "Format and display manual page\n" \ - "\nOptions:" \ - "\n -a Display all pages" \ - "\n -w Show page locations" \ - -#define matchpathcon_trivial_usage \ - "[-n] [-N] [-f file_contexts_file] [-p prefix] [-V]" -#define matchpathcon_full_usage "\n\n" \ - " -n Don't display path" \ - "\n -N Don't use translations" \ - "\n -f Use alternate file_context file" \ - "\n -p Use prefix to speed translations" \ - "\n -V Verify file context on disk matches defaults" \ - -#define mdev_trivial_usage \ - "[-s]" -#define mdev_full_usage "\n\n" \ - " -s Scan /sys and populate /dev during system boot\n" \ - "\n" \ - "It can be run by kernel as a hotplug helper. To activate it:\n" \ - " echo /sbin/mdev > /proc/sys/kernel/hotplug\n" \ - IF_FEATURE_MDEV_CONF( \ - "It uses /etc/mdev.conf with lines\n" \ - "[-]DEVNAME UID:GID PERM" \ - IF_FEATURE_MDEV_RENAME(" [>|=PATH]") \ - IF_FEATURE_MDEV_EXEC(" [@|$|*PROG]") \ - ) \ - -#define mdev_notes_usage "" \ - IF_FEATURE_MDEV_CONFIG( \ - "The mdev config file contains lines that look like:\n" \ - " hd[a-z][0-9]* 0:3 660\n\n" \ - "That's device name (with regex match), uid:gid, and permissions.\n\n" \ - IF_FEATURE_MDEV_EXEC( \ - "Optionally, that can be followed (on the same line) by a special character\n" \ - "and a command line to run after creating/before deleting the corresponding\n" \ - "device(s). The environment variable $MDEV indicates the active device node\n" \ - "(which is useful if it's a regex match). For example:\n\n" \ - " hdc root:cdrom 660 *ln -s $MDEV cdrom\n\n" \ - "The special characters are @ (run after creating), $ (run before deleting),\n" \ - "and * (run both after creating and before deleting). The commands run in\n" \ - "the /dev directory, and use system() which calls /bin/sh.\n\n" \ - ) \ - "Config file parsing stops on the first matching line. If no config\n" \ - "entry is matched, devices are created with default 0:0 660. (Make\n" \ - "the last line match .* to override this.)\n\n" \ - ) - -#define microcom_trivial_usage \ - "[-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY" -#define microcom_full_usage "\n\n" \ - "Copy bytes for stdin to TTY and from TTY to stdout\n" \ - "\nOptions:" \ - "\n -d Wait up to DELAY ms for TTY output before sending every" \ - "\n next byte to it" \ - "\n -t Exit if both stdin and TTY are silent for TIMEOUT ms" \ - "\n -s Set serial line to SPEED" \ - "\n -X Disable special meaning of NUL and Ctrl-X from stdin" \ - -#define mkfs_ext2_trivial_usage \ - "[-Fn] " \ - /* "[-c|-l filename] " */ \ - "[-b BLK_SIZE] " \ - /* "[-f fragment-size] [-g blocks-per-group] " */ \ - "[-i INODE_RATIO] [-I INODE_SIZE] " \ - /* "[-j] [-J journal-options] [-N number-of-inodes] " */ \ - "[-m RESERVED_PERCENT] " \ - /* "[-o creator-os] [-O feature[,...]] [-q] " */ \ - /* "[r fs-revision-level] [-E extended-options] [-v] [-F] " */ \ - "[-L LABEL] " \ - /* "[-M last-mounted-directory] [-S] [-T filesystem-type] " */ \ - "BLOCKDEV [KBYTES]" -#define mkfs_ext2_full_usage "\n\n" \ - " -b BLK_SIZE Block size, bytes" \ -/* "\n -c Check device for bad blocks" */ \ -/* "\n -E opts Set extended options" */ \ -/* "\n -f size Fragment size in bytes" */ \ - "\n -F Force" \ -/* "\n -g N Number of blocks in a block group" */ \ - "\n -i RATIO Max number of files is filesystem_size / RATIO" \ - "\n -I BYTES Inode size (min 128)" \ -/* "\n -j Create a journal (ext3)" */ \ -/* "\n -J opts Set journal options (size/device)" */ \ -/* "\n -l file Read bad blocks list from file" */ \ - "\n -L LBL Volume label" \ - "\n -m PERCENT Percent of blocks to reserve for admin" \ -/* "\n -M dir Set last mounted directory" */ \ - "\n -n Dry run" \ -/* "\n -N N Number of inodes to create" */ \ -/* "\n -o os Set the 'creator os' field" */ \ -/* "\n -O features Dir_index/filetype/has_journal/journal_dev/sparse_super" */ \ -/* "\n -q Quiet" */ \ -/* "\n -r rev Set filesystem revision" */ \ -/* "\n -S Write superblock and group descriptors only" */ \ -/* "\n -T fs-type Set usage type (news/largefile/largefile4)" */ \ -/* "\n -v Verbose" */ \ - -#define mkfs_minix_trivial_usage \ - "[-c | -l FILE] [-nXX] [-iXX] BLOCKDEV [KBYTES]" -#define mkfs_minix_full_usage "\n\n" \ - "Make a MINIX filesystem\n" \ - "\nOptions:" \ - "\n -c Check device for bad blocks" \ - "\n -n [14|30] Maximum length of filenames" \ - "\n -i INODES Number of inodes for the filesystem" \ - "\n -l FILE Read bad blocks list from FILE" \ - "\n -v Make version 2 filesystem" \ - -#define mkfs_reiser_trivial_usage \ - "[-f] [-l LABEL] BLOCKDEV [4K-BLOCKS]" - -#define mkfs_reiser_full_usage "\n\n" \ - "Make a ReiserFS V3 filesystem\n" \ - "\nOptions:" \ - "\n -f Force" \ - "\n -l LBL Volume label" \ - -#define mkfs_vfat_trivial_usage \ - "[-v] [-n LABEL] BLOCKDEV [KBYTES]" -/* Accepted but ignored: - "[-c] [-C] [-I] [-l bad-block-file] [-b backup-boot-sector] " - "[-m boot-msg-file] [-i volume-id] " - "[-s sectors-per-cluster] [-S logical-sector-size] [-f number-of-FATs] " - "[-h hidden-sectors] [-F fat-size] [-r root-dir-entries] [-R reserved-sectors] " -*/ -#define mkfs_vfat_full_usage "\n\n" \ - "Make a FAT32 filesystem\n" \ - "\nOptions:" \ -/* "\n -c Check device for bad blocks" */ \ - "\n -v Verbose" \ -/* "\n -I Allow to use entire disk device (e.g. /dev/hda)" */ \ - "\n -n LBL Volume label" \ - -#define mkswap_trivial_usage \ - "[-L LBL] BLOCKDEV [KBYTES]" -#define mkswap_full_usage "\n\n" \ - "Prepare BLOCKDEV to be used as swap partition\n" \ - "\nOptions:" \ - "\n -L LBL Label" \ - -#define more_trivial_usage \ - "[FILE]..." -#define more_full_usage "\n\n" \ - "View FILE (or stdin) one screenful at a time" - -#define more_example_usage \ - "$ dmesg | more\n" - -#define mount_trivial_usage \ - "[OPTIONS] [-o OPTS] DEVICE NODE" -#define mount_full_usage "\n\n" \ - "Mount a filesystem. Filesystem autodetection requires /proc.\n" \ - "\nOptions:" \ - "\n -a Mount all filesystems in fstab" \ - IF_FEATURE_MOUNT_FAKE( \ - IF_FEATURE_MTAB_SUPPORT( \ - "\n -f Update /etc/mtab, but don't mount" \ - ) \ - IF_NOT_FEATURE_MTAB_SUPPORT( \ - "\n -f Dry run" \ - ) \ - ) \ - IF_FEATURE_MOUNT_HELPERS( \ - "\n -i Don't run mount helper" \ - ) \ - IF_FEATURE_MTAB_SUPPORT( \ - "\n -n Don't update /etc/mtab" \ - ) \ - "\n -r Read-only mount" \ - "\n -w Read-write mount (default)" \ - "\n -t FSTYPE Filesystem type" \ - "\n -O OPT Mount only filesystems with option OPT (-a only)" \ - "\n-o OPT:" \ - IF_FEATURE_MOUNT_LOOP( \ - "\n loop Ignored (loop devices are autodetected)" \ - ) \ - IF_FEATURE_MOUNT_FLAGS( \ - "\n [a]sync Writes are [a]synchronous" \ - "\n [no]atime Disable/enable updates to inode access times" \ - "\n [no]diratime Disable/enable atime updates to directories" \ - "\n [no]relatime Disable/enable atime updates relative to modification time" \ - "\n [no]dev (Dis)allow use of special device files" \ - "\n [no]exec (Dis)allow use of executable files" \ - "\n [no]suid (Dis)allow set-user-id-root programs" \ - "\n [r]shared Convert [recursively] to a shared subtree" \ - "\n [r]slave Convert [recursively] to a slave subtree" \ - "\n [r]private Convert [recursively] to a private subtree" \ - "\n [un]bindable Make mount point [un]able to be bind mounted" \ - "\n [r]bind Bind a file or directory [recursively] to another location" \ - "\n move Relocate an existing mount point" \ - ) \ - "\n remount Remount a mounted filesystem, changing flags" \ - "\n ro/rw Same as -r/-w" \ - "\n" \ - "\nThere are filesystem-specific -o flags." \ - -#define mount_example_usage \ - "$ mount\n" \ - "/dev/hda3 on / type minix (rw)\n" \ - "proc on /proc type proc (rw)\n" \ - "devpts on /dev/pts type devpts (rw)\n" \ - "$ mount /dev/fd0 /mnt -t msdos -o ro\n" \ - "$ mount /tmp/diskimage /opt -t ext2 -o loop\n" \ - "$ mount cd_image.iso mydir\n" -#define mount_notes_usage \ - "Returns 0 for success, number of failed mounts for -a, or errno for one mount." - -#define mountpoint_trivial_usage \ - "[-q] <[-dn] DIR | -x DEVICE>" -#define mountpoint_full_usage "\n\n" \ - "Check if the directory is a mountpoint\n" \ - "\nOptions:" \ - "\n -q Quiet" \ - "\n -d Print major/minor device number of the filesystem" \ - "\n -n Print device name of the filesystem" \ - "\n -x Print major/minor device number of the blockdevice" \ - -#define mountpoint_example_usage \ - "$ mountpoint /proc\n" \ - "/proc is not a mountpoint\n" \ - "$ mountpoint /sys\n" \ - "/sys is a mountpoint\n" - -#define mt_trivial_usage \ - "[-f device] opcode value" -#define mt_full_usage "\n\n" \ - "Control magnetic tape drive operation\n" \ - "\n" \ - "Available Opcodes:\n" \ - "\n" \ - "bsf bsfm bsr bss datacompression drvbuffer eof eom erase\n" \ - "fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2\n" \ - "ras3 reset retension rewind rewoffline seek setblk setdensity\n" \ - "setpart tell unload unlock weof wset" \ - -#define nslookup_trivial_usage \ - "[HOST] [SERVER]" -#define nslookup_full_usage "\n\n" \ - "Query the nameserver for the IP address of the given HOST\n" \ - "optionally using a specified DNS server" -#define nslookup_example_usage \ - "$ nslookup localhost\n" \ - "Server: default\n" \ - "Address: default\n" \ - "\n" \ - "Name: debian\n" \ - "Address: 127.0.0.1\n" - -#define ntpd_trivial_usage \ - "[-dnqNw"IF_FEATURE_NTPD_SERVER("l")"] [-S PROG] [-p PEER]..." -#define ntpd_full_usage "\n\n" \ - "NTP client/server\n" \ - "\nOptions:" \ - "\n -d Verbose" \ - "\n -n Do not daemonize" \ - "\n -q Quit after clock is set" \ - "\n -N Run at high priority" \ - "\n -w Do not set time (only query peers), implies -n" \ - IF_FEATURE_NTPD_SERVER( \ - "\n -l Run as server on port 123" \ - ) \ - "\n -S PROG Run PROG after stepping time, stratum change, and every 11 mins" \ - "\n -p PEER Obtain time from PEER (may be repeated)" \ - -/* -#define parse_trivial_usage \ - "[-n MAXTOKENS] [-m MINTOKENS] [-d DELIMS] [-f FLAGS] FILE..." -#define parse_full_usage "" -*/ - -#define pgrep_trivial_usage \ - "[-flnovx] [-s SID|-P PPID|PATTERN]" -#define pgrep_full_usage "\n\n" \ - "Display process(es) selected by regex PATTERN\n" \ - "\nOptions:" \ - "\n -l Show command name too" \ - "\n -f Match against entire command line" \ - "\n -n Show the newest process only" \ - "\n -o Show the oldest process only" \ - "\n -v Negate the match" \ - "\n -x Match whole name (not substring)" \ - "\n -s Match session ID (0 for current)" \ - "\n -P Match parent process ID" \ - -#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT) -#define pidof_trivial_usage \ - "[OPTIONS] [NAME]..." -#define USAGE_PIDOF "\n\nOptions:" -#else -#define pidof_trivial_usage \ - "[NAME]..." -#define USAGE_PIDOF /* none */ -#endif -#define pidof_full_usage "\n\n" \ - "List PIDs of all processes with names that match NAMEs" \ - USAGE_PIDOF \ - IF_FEATURE_PIDOF_SINGLE( \ - "\n -s Show only one PID" \ - ) \ - IF_FEATURE_PIDOF_OMIT( \ - "\n -o PID Omit given pid" \ - "\n Use %PPID to omit pid of pidof's parent" \ - ) \ - -#define pidof_example_usage \ - "$ pidof init\n" \ - "1\n" \ - IF_FEATURE_PIDOF_OMIT( \ - "$ pidof /bin/sh\n20351 5973 5950\n") \ - IF_FEATURE_PIDOF_OMIT( \ - "$ pidof /bin/sh -o %PPID\n20351 5950") - -#define pivot_root_trivial_usage \ - "NEW_ROOT PUT_OLD" -#define pivot_root_full_usage "\n\n" \ - "Move the current root file system to PUT_OLD and make NEW_ROOT\n" \ - "the new root file system" - -#define pkill_trivial_usage \ - "[-l|-SIGNAL] [-fnovx] [-s SID|-P PPID|PATTERN]" -#define pkill_full_usage "\n\n" \ - "Send a signal to process(es) selected by regex PATTERN\n" \ - "\nOptions:" \ - "\n -l List all signals" \ - "\n -f Match against entire command line" \ - "\n -n Signal the newest process only" \ - "\n -o Signal the oldest process only" \ - "\n -v Negate the match" \ - "\n -x Match whole name (not substring)" \ - "\n -s Match session ID (0 for current)" \ - "\n -P Match parent process ID" \ - - -#if ENABLE_DESKTOP - -#define ps_trivial_usage \ - "[-o COL1,COL2=HEADER]" IF_FEATURE_SHOW_THREADS(" [-T]") -#define ps_full_usage "\n\n" \ - "Show list of processes\n" \ - "\nOptions:" \ - "\n -o COL1,COL2=HEADER Select columns for display" \ - IF_FEATURE_SHOW_THREADS( \ - "\n -T Show threads" \ - ) - -#else /* !ENABLE_DESKTOP */ - -#if !ENABLE_SELINUX && !ENABLE_FEATURE_PS_WIDE -#define USAGE_PS "\nThis version of ps accepts no options" -#else -#define USAGE_PS "\nOptions:" -#endif - -#define ps_trivial_usage \ - "" -#define ps_full_usage "\n\n" \ - "Show list of processes\n" \ - USAGE_PS \ - IF_SELINUX( \ - "\n -Z Show selinux context" \ - ) \ - IF_FEATURE_PS_WIDE( \ - "\n w Wide output" \ - ) - -#endif /* ENABLE_DESKTOP */ - -#define ps_example_usage \ - "$ ps\n" \ - " PID Uid Gid State Command\n" \ - " 1 root root S init\n" \ - " 2 root root S [kflushd]\n" \ - " 3 root root S [kupdate]\n" \ - " 4 root root S [kpiod]\n" \ - " 5 root root S [kswapd]\n" \ - " 742 andersen andersen S [bash]\n" \ - " 743 andersen andersen S -bash\n" \ - " 745 root root S [getty]\n" \ - " 2990 andersen andersen R ps\n" \ - -#define pscan_trivial_usage \ - "[-cb] [-p MIN_PORT] [-P MAX_PORT] [-t TIMEOUT] [-T MIN_RTT] HOST" -#define pscan_full_usage "\n\n" \ - "Scan a host, print all open ports\n" \ - "\nOptions:" \ - "\n -c Show closed ports too" \ - "\n -b Show blocked ports too" \ - "\n -p Scan from this port (default 1)" \ - "\n -P Scan up to this port (default 1024)" \ - "\n -t Timeout (default 5000 ms)" \ - "\n -T Minimum rtt (default 5 ms, increase for congested hosts)" \ - -#define raidautorun_trivial_usage \ - "DEVICE" -#define raidautorun_full_usage "\n\n" \ - "Tell the kernel to automatically search and start RAID arrays" -#define raidautorun_example_usage \ - "$ raidautorun /dev/md0" - -#define rdate_trivial_usage \ - "[-sp] HOST" -#define rdate_full_usage "\n\n" \ - "Get and possibly set the system date and time from a remote HOST\n" \ - "\nOptions:" \ - "\n -s Set the system date and time (default)" \ - "\n -p Print the date and time" \ - -#define rdev_trivial_usage \ - "" -#define rdev_full_usage "\n\n" \ - "Print the device node associated with the filesystem mounted at '/'" -#define rdev_example_usage \ - "$ rdev\n" \ - "/dev/mtdblock9 /\n" - -#define readahead_trivial_usage \ - "[FILE]..." -#define readahead_full_usage "\n\n" \ - "Preload FILEs to RAM" - -#define readprofile_trivial_usage \ - "[OPTIONS]" -#define readprofile_full_usage "\n\n" \ - "Options:" \ - "\n -m mapfile (Default: /boot/System.map)" \ - "\n -p profile (Default: /proc/profile)" \ - "\n -M NUM Set the profiling multiplier to NUM" \ - "\n -i Print only info about the sampling step" \ - "\n -v Verbose" \ - "\n -a Print all symbols, even if count is 0" \ - "\n -b Print individual histogram-bin counts" \ - "\n -s Print individual counters within functions" \ - "\n -r Reset all the counters (root only)" \ - "\n -n Disable byte order auto-detection" \ - -#define scriptreplay_trivial_usage \ - "timingfile [typescript [divisor]]" -#define scriptreplay_full_usage "\n\n" \ - "Play back typescripts, using timing information" - -#define restorecon_trivial_usage \ - "[-iFnRv] [-e EXCLUDEDIR]... [-o FILE] [-f FILE]" -#define restorecon_full_usage "\n\n" \ - "Reset security contexts of files in pathname\n" \ - "\n -i Ignore files that don't exist" \ - "\n -f FILE File with list of files to process" \ - "\n -e DIR Directory to exclude" \ - "\n -R,-r Recurse" \ - "\n -n Don't change any file labels" \ - "\n -o FILE Save list of files with incorrect context" \ - "\n -v Verbose" \ - "\n -vv Show changed labels" \ - "\n -F Force reset of context to match file_context" \ - "\n for customizable files, or the user section," \ - "\n if it has changed" \ - -#define rfkill_trivial_usage \ - "COMMAND [INDEX|TYPE]" -#define rfkill_full_usage "\n\n" \ - "Enable/disable wireless devices\n" \ - "\nCommands:" \ - "\n list [INDEX|TYPE] List current state" \ - "\n block INDEX|TYPE Disable device" \ - "\n unblock INDEX|TYPE Enable device" \ - "\n" \ - "\n TYPE: all, wlan(wifi), bluetooth, uwb(ultrawideband)," \ - "\n wimax, wwan, gps, fm" \ - -#define route_trivial_usage \ - "[{add|del|delete}]" -#define route_full_usage "\n\n" \ - "Edit kernel routing tables\n" \ - "\nOptions:" \ - "\n -n Don't resolve names" \ - "\n -e Display other/more information" \ - "\n -A inet" IF_FEATURE_IPV6("{6}") " Select address family" \ - -#define rtcwake_trivial_usage \ - "[-a | -l | -u] [-d DEV] [-m MODE] [-s SEC | -t TIME]" -#define rtcwake_full_usage "\n\n" \ - "Enter a system sleep state until specified wakeup time\n" \ - IF_LONG_OPTS( \ - "\n -a,--auto Read clock mode from adjtime" \ - "\n -l,--local Clock is set to local time" \ - "\n -u,--utc Clock is set to UTC time" \ - "\n -d,--device=DEV Specify the RTC device" \ - "\n -m,--mode=MODE Set the sleep state (default: standby)" \ - "\n -s,--seconds=SEC Set the timeout in SEC seconds from now" \ - "\n -t,--time=TIME Set the timeout to TIME seconds from epoch" \ - ) \ - IF_NOT_LONG_OPTS( \ - "\n -a Read clock mode from adjtime" \ - "\n -l Clock is set to local time" \ - "\n -u Clock is set to UTC time" \ - "\n -d DEV Specify the RTC device" \ - "\n -m MODE Set the sleep state (default: standby)" \ - "\n -s SEC Set the timeout in SEC seconds from now" \ - "\n -t TIME Set the timeout to TIME seconds from epoch" \ - ) - -#define runcon_trivial_usage \ - "[-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] PROG ARGS\n" \ - "runcon CONTEXT PROG ARGS" -#define runcon_full_usage "\n\n" \ - "Run PROG in a different security context\n" \ - "\n CONTEXT Complete security context\n" \ - IF_FEATURE_RUNCON_LONG_OPTIONS( \ - "\n -c,--compute Compute process transition context before modifying" \ - "\n -t,--type=TYPE Type (for same role as parent)" \ - "\n -u,--user=USER User identity" \ - "\n -r,--role=ROLE Role" \ - "\n -l,--range=RNG Levelrange" \ - ) \ - IF_NOT_FEATURE_RUNCON_LONG_OPTIONS( \ - "\n -c Compute process transition context before modifying" \ - "\n -t TYPE Type (for same role as parent)" \ - "\n -u USER User identity" \ - "\n -r ROLE Role" \ - "\n -l RNG Levelrange" \ - ) - -#define runlevel_trivial_usage \ - "[FILE]" -#define runlevel_full_usage "\n\n" \ - "Find the current and previous system runlevel\n" \ - "\n" \ - "If no utmp FILE exists or if no runlevel record can be found,\n" \ - "print \"unknown\"" -#define runlevel_example_usage \ - "$ runlevel /var/run/utmp\n" \ - "N 2" - -#define runsv_trivial_usage \ - "DIR" -#define runsv_full_usage "\n\n" \ - "Start and monitor a service and optionally an appendant log service" - -#define runsvdir_trivial_usage \ - "[-P] [-s SCRIPT] DIR" -#define runsvdir_full_usage "\n\n" \ - "Start a runsv process for each subdirectory. If it exits, restart it.\n" \ - "\n -P Put each runsv in a new session" \ - "\n -s SCRIPT Run SCRIPT after signal is processed" \ - -#define rx_trivial_usage \ - "FILE" -#define rx_full_usage "\n\n" \ - "Receive a file using the xmodem protocol" -#define rx_example_usage \ - "$ rx /tmp/foo\n" - -#define script_trivial_usage \ - "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]" -#define script_full_usage "\n\n" \ - "Options:" \ - "\n -a Append output" \ - "\n -c PROG Run PROG, not shell" \ - "\n -f Flush output after each write" \ - "\n -q Quiet" \ - IF_SCRIPTREPLAY( \ - "\n -t Send timing to stderr" \ - ) - -#define selinuxenabled_trivial_usage NOUSAGE_STR -#define selinuxenabled_full_usage "" - -#define sestatus_trivial_usage \ - "[-vb]" -#define sestatus_full_usage "\n\n" \ - " -v Verbose" \ - "\n -b Display current state of booleans" \ - -#define setenforce_trivial_usage \ - "[Enforcing | Permissive | 1 | 0]" -#define setenforce_full_usage "" - -#define setfiles_trivial_usage \ - "[-dnpqsvW] [-e DIR]... [-o FILE] [-r alt_root_path]" \ - IF_FEATURE_SETFILES_CHECK_OPTION( \ - " [-c policyfile] spec_file" \ - ) \ - " pathname" -#define setfiles_full_usage "\n\n" \ - "Reset file contexts under pathname according to spec_file\n" \ - IF_FEATURE_SETFILES_CHECK_OPTION( \ - "\n -c FILE Check the validity of the contexts against the specified binary policy" \ - ) \ - "\n -d Show which specification matched each file" \ - "\n -l Log changes in file labels to syslog" \ - "\n -n Don't change any file labels" \ - "\n -q Suppress warnings" \ - "\n -r DIR Use an alternate root path" \ - "\n -e DIR Exclude DIR" \ - "\n -F Force reset of context to match file_context for customizable files" \ - "\n -o FILE Save list of files with incorrect context" \ - "\n -s Take a list of files from stdin (instead of command line)" \ - "\n -v Show changes in file labels, if type or role are changing" \ - "\n -vv Show changes in file labels, if type, role, or user are changing" \ - "\n -W Display warnings about entries that had no matching files" \ - -#define setfont_trivial_usage \ - "FONT [-m MAPFILE] [-C TTY]" -#define setfont_full_usage "\n\n" \ - "Load a console font\n" \ - "\nOptions:" \ - "\n -m MAPFILE Load console screen map" \ - "\n -C TTY Affect TTY instead of /dev/tty" \ - -#define setfont_example_usage \ - "$ setfont -m koi8-r /etc/i18n/fontname\n" - -#define setsebool_trivial_usage \ - "boolean value" - -#define setsebool_full_usage "\n\n" \ - "Change boolean setting" - -#define setsid_trivial_usage \ - "PROG ARGS" -#define setsid_full_usage "\n\n" \ - "Run PROG in a new session. PROG will have no controlling terminal\n" \ - "and will not be affected by keyboard signals (Ctrl-C etc).\n" \ - "See setsid(2) for details." \ - -#define last_trivial_usage \ - ""IF_FEATURE_LAST_FANCY("[-HW] [-f FILE]") -#define last_full_usage "\n\n" \ - "Show listing of the last users that logged into the system" \ - IF_FEATURE_LAST_FANCY( "\n" \ - "\nOptions:" \ -/* "\n -H Show header line" */ \ - "\n -W Display with no host column truncation" \ - "\n -f FILE Read from FILE instead of /var/log/wtmp" \ - ) - -#define slattach_trivial_usage \ - "[-cehmLF] [-s SPEED] [-p PROTOCOL] DEVICE" -#define slattach_full_usage "\n\n" \ - "Attach network interface(s) to serial line(s)\n" \ - "\nOptions:" \ - "\n -p PROT Set protocol (slip, cslip, slip6, clisp6 or adaptive)" \ - "\n -s SPD Set line speed" \ - "\n -e Exit after initializing device" \ - "\n -h Exit when the carrier is lost" \ - "\n -c PROG Run PROG when the line is hung up" \ - "\n -m Do NOT initialize the line in raw 8 bits mode" \ - "\n -L Enable 3-wire operation" \ - "\n -F Disable RTS/CTS flow control" \ - -#define strings_trivial_usage \ - "[-afo] [-n LEN] [FILE]..." -#define strings_full_usage "\n\n" \ - "Display printable strings in a binary file\n" \ - "\nOptions:" \ - "\n -a Scan whole file (default)" \ - "\n -f Precede strings with filenames" \ - "\n -n LEN At least LEN characters form a string (default 4)" \ - "\n -o Precede strings with decimal offsets" \ - -#define sv_trivial_usage \ - "[-v] [-w SEC] CMD SERVICE_DIR..." -#define sv_full_usage "\n\n" \ - "Control services monitored by runsv supervisor.\n" \ - "Commands (only first character is enough):\n" \ - "\n" \ - "status: query service status\n" \ - "up: if service isn't running, start it. If service stops, restart it\n" \ - "once: like 'up', but if service stops, don't restart it\n" \ - "down: send TERM and CONT signals. If ./run exits, start ./finish\n" \ - " if it exists. After it stops, don't restart service\n" \ - "exit: send TERM and CONT signals to service and log service. If they exit,\n" \ - " runsv exits too\n" \ - "pause, cont, hup, alarm, interrupt, quit, 1, 2, term, kill: send\n" \ - "STOP, CONT, HUP, ALRM, INT, QUIT, USR1, USR2, TERM, KILL signal to service" \ - -#define swapoff_trivial_usage \ - "[-a] [DEVICE]" -#define swapoff_full_usage "\n\n" \ - "Stop swapping on DEVICE\n" \ - "\nOptions:" \ - "\n -a Stop swapping on all swap devices" \ - -#define swapon_trivial_usage \ - "[-a]" IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]" -#define swapon_full_usage "\n\n" \ - "Start swapping on DEVICE\n" \ - "\nOptions:" \ - "\n -a Start swapping on all swap devices" \ - IF_FEATURE_SWAPON_PRI( \ - "\n -p PRI Set swap device priority" \ - ) \ - -#define switch_root_trivial_usage \ - "[-c /dev/console] NEW_ROOT NEW_INIT [ARGS]" -#define switch_root_full_usage "\n\n" \ - "Free initramfs and switch to another root fs:\n" \ - "chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /,\n" \ - "execute NEW_INIT. PID must be 1. NEW_ROOT must be a mountpoint.\n" \ - "\nOptions:" \ - "\n -c DEV Reopen stdio to DEV after switch" \ - -#define sysctl_trivial_usage \ - "[OPTIONS] [VALUE]..." -#define sysctl_full_usage "\n\n" \ - "Configure kernel parameters at runtime\n" \ - "\nOptions:" \ - "\n -n Don't print key names" \ - "\n -e Don't warn about unknown keys" \ - "\n -w Change sysctl setting" \ - "\n -p FILE Load sysctl settings from FILE (default /etc/sysctl.conf)" \ - "\n -a Display all values" \ - "\n -A Display all values in table form" \ - -#define sysctl_example_usage \ - "sysctl [-n] [-e] variable...\n" \ - "sysctl [-n] [-e] -w variable=value...\n" \ - "sysctl [-n] [-e] -a\n" \ - "sysctl [-n] [-e] -p file (default /etc/sysctl.conf)\n" \ - "sysctl [-n] [-e] -A\n" - -#define syslogd_trivial_usage \ - "[OPTIONS]" -#define syslogd_full_usage "\n\n" \ - "System logging utility.\n" \ - "This version of syslogd ignores /etc/syslog.conf\n" \ - "\nOptions:" \ - "\n -n Run in foreground" \ - "\n -O FILE Log to given file (default:/var/log/messages)" \ - "\n -l N Set local log level" \ - "\n -S Smaller logging output" \ - IF_FEATURE_ROTATE_LOGFILE( \ - "\n -s SIZE Max size (KB) before rotate (default:200KB, 0=off)" \ - "\n -b N N rotated logs to keep (default:1, max=99, 0=purge)") \ - IF_FEATURE_REMOTE_LOG( \ - "\n -R HOST[:PORT] Log to IP or hostname on PORT (default PORT=514/UDP)" \ - "\n -L Log locally and via network (default is network only if -R)") \ - IF_FEATURE_SYSLOGD_DUP( \ - "\n -D Drop duplicates") \ - IF_FEATURE_IPC_SYSLOG( \ - "\n -C[size(KiB)] Log to shared mem buffer (read it using logread)") \ - /* NB: -Csize shouldn't have space (because size is optional) */ -/* "\n -m MIN Minutes between MARK lines (default:20, 0=off)" */ - -#define syslogd_example_usage \ - "$ syslogd -R masterlog:514\n" \ - "$ syslogd -R 192.168.1.1:601\n" - -#define taskset_trivial_usage \ - "[-p] [MASK] [PID | PROG ARGS]" -#define taskset_full_usage "\n\n" \ - "Set or get CPU affinity\n" \ - "\nOptions:" \ - "\n -p Operate on an existing PID" \ - -#define taskset_example_usage \ - "$ taskset 0x7 ./dgemm_test&\n" \ - "$ taskset -p 0x1 $!\n" \ - "pid 4790's current affinity mask: 7\n" \ - "pid 4790's new affinity mask: 1\n" \ - "$ taskset 0x7 /bin/sh -c './taskset -p 0x1 $$'\n" \ - "pid 6671's current affinity mask: 1\n" \ - "pid 6671's new affinity mask: 1\n" \ - "$ taskset -p 1\n" \ - "pid 1's current affinity mask: 3\n" - -#if ENABLE_FEATURE_TELNET_AUTOLOGIN -#define telnet_trivial_usage \ - "[-a] [-l USER] HOST [PORT]" -#define telnet_full_usage "\n\n" \ - "Connect to telnet server\n" \ - "\nOptions:" \ - "\n -a Automatic login with $USER variable" \ - "\n -l USER Automatic login as USER" \ - -#else -#define telnet_trivial_usage \ - "HOST [PORT]" -#define telnet_full_usage "\n\n" \ - "Connect to telnet server" -#endif - -#define telnetd_trivial_usage \ - "[OPTIONS]" -#define telnetd_full_usage "\n\n" \ - "Handle incoming telnet connections" \ - IF_NOT_FEATURE_TELNETD_STANDALONE(" via inetd") "\n" \ - "\nOptions:" \ - "\n -l LOGIN Exec LOGIN on connect" \ - "\n -f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue" \ - "\n -K Close connection as soon as login exits" \ - "\n (normally wait until all programs close slave pty)" \ - IF_FEATURE_TELNETD_STANDALONE( \ - "\n -p PORT Port to listen on" \ - "\n -b ADDR[:PORT] Address to bind to" \ - "\n -F Run in foreground" \ - "\n -i Inetd mode" \ - IF_FEATURE_TELNETD_INETD_WAIT( \ - "\n -w SEC Inetd 'wait' mode, linger time SEC" \ - "\n -S Log to syslog (implied by -i or without -F and -w)" \ - ) \ - ) - -#define tc_trivial_usage \ - /*"[OPTIONS] "*/"OBJECT CMD [dev STRING]" -#define tc_full_usage "\n\n" \ - "OBJECT: {qdisc|class|filter}\n" \ - "CMD: {add|del|change|replace|show}\n" \ - "\n" \ - "qdisc [ handle QHANDLE ] [ root |"IF_FEATURE_TC_INGRESS(" ingress |")" parent CLASSID ]\n" \ - /* "[ estimator INTERVAL TIME_CONSTANT ]\n" */ \ - " [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n" \ - " QDISC_KIND := { [p|b]fifo | tbf | prio | cbq | red | etc. }\n" \ - "qdisc show [ dev STRING ]"IF_FEATURE_TC_INGRESS(" [ingress]")"\n" \ - "class [ classid CLASSID ] [ root | parent CLASSID ]\n" \ - " [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n" \ - "class show [ dev STRING ] [ root | parent CLASSID ]\n" \ - "filter [ pref PRIO ] [ protocol PROTO ]\n" \ - /* "\t[ estimator INTERVAL TIME_CONSTANT ]\n" */ \ - " [ root | classid CLASSID ] [ handle FILTERID ]\n" \ - " [ [ FILTER_TYPE ] [ help | OPTIONS ] ]\n" \ - "filter show [ dev STRING ] [ root | parent CLASSID ]" - -#define tcpsvd_trivial_usage \ - "[-hEv] [-c N] [-C N[:MSG]] [-b N] [-u USER] [-l NAME] IP PORT PROG" -/* with not-implemented options: */ -/* "[-hpEvv] [-c N] [-C N[:MSG]] [-b N] [-u USER] [-l NAME] [-i DIR|-x CDB] [-t SEC] IP PORT PROG" */ -#define tcpsvd_full_usage "\n\n" \ - "Create TCP socket, bind to IP:PORT and listen\n" \ - "for incoming connection. Run PROG for each connection.\n" \ - "\n IP IP to listen on. '0' = all" \ - "\n PORT Port to listen on" \ - "\n PROG ARGS Program to run" \ - "\n -l NAME Local hostname (else looks up local hostname in DNS)" \ - "\n -u USER[:GRP] Change to user/group after bind" \ - "\n -c N Handle up to N connections simultaneously" \ - "\n -b N Allow a backlog of approximately N TCP SYNs" \ - "\n -C N[:MSG] Allow only up to N connections from the same IP." \ - "\n New connections from this IP address are closed" \ - "\n immediately. MSG is written to the peer before close" \ - "\n -h Look up peer's hostname" \ - "\n -E Don't set up environment variables" \ - "\n -v Verbose" \ - -#define udpsvd_trivial_usage \ - "[-hEv] [-c N] [-u USER] [-l NAME] IP PORT PROG" -#define udpsvd_full_usage "\n\n" \ - "Create UDP socket, bind to IP:PORT and wait\n" \ - "for incoming packets. Run PROG for each packet,\n" \ - "redirecting all further packets with same peer ip:port to it.\n" \ - "\n IP IP to listen on. '0' = all" \ - "\n PORT Port to listen on" \ - "\n PROG ARGS Program to run" \ - "\n -l NAME Local hostname (else looks up local hostname in DNS)" \ - "\n -u USER[:GRP] Change to user/group after bind" \ - "\n -c N Handle up to N connections simultaneously" \ - "\n -h Look up peer's hostname" \ - "\n -E Don't set up environment variables" \ - "\n -v Verbose" \ - -#define tftp_trivial_usage \ - "[OPTIONS] HOST [PORT]" -#define tftp_full_usage "\n\n" \ - "Transfer a file from/to tftp server\n" \ - "\nOptions:" \ - "\n -l FILE Local FILE" \ - "\n -r FILE Remote FILE" \ - IF_FEATURE_TFTP_GET( \ - "\n -g Get file" \ - ) \ - IF_FEATURE_TFTP_PUT( \ - "\n -p Put file" \ - ) \ - IF_FEATURE_TFTP_BLOCKSIZE( \ - "\n -b SIZE Transfer blocks of SIZE octets" \ - ) - -#define tftpd_trivial_usage \ - "[-cr] [-u USER] [DIR]" -#define tftpd_full_usage "\n\n" \ - "Transfer a file on tftp client's request\n" \ - "\n" \ - "tftpd should be used as an inetd service.\n" \ - "tftpd's line for inetd.conf:\n" \ - " 69 dgram udp nowait root tftpd tftpd /files/to/serve\n" \ - "It also can be ran from udpsvd:\n" \ - " udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve\n" \ - "\nOptions:" \ - "\n -r Prohibit upload" \ - "\n -c Allow file creation via upload" \ - "\n -u Access files as USER" \ - -#define time_trivial_usage \ - "[-v] PROG ARGS" -#define time_full_usage "\n\n" \ - "Run PROG, display resource usage when it exits\n" \ - "\nOptions:" \ - "\n -v Verbose" \ - -#define timeout_trivial_usage \ - "[-t SECS] [-s SIG] PROG ARGS" -#define timeout_full_usage "\n\n" \ - "Runs PROG. Sends SIG to it if it is not gone in SECS seconds.\n" \ - "Defaults: SECS: 10, SIG: TERM." \ - -#define traceroute_trivial_usage \ - "[-"IF_TRACEROUTE6("46")"FIldnrv] [-f 1ST_TTL] [-m MAXTTL] [-p PORT] [-q PROBES]\n" \ - " [-s SRC_IP] [-t TOS] [-w WAIT_SEC] [-g GATEWAY] [-i IFACE]\n" \ - " [-z PAUSE_MSEC] HOST [BYTES]" -#define traceroute_full_usage "\n\n" \ - "Trace the route to HOST\n" \ - "\nOptions:" \ - IF_TRACEROUTE6( \ - "\n -4,-6 Force IP or IPv6 name resolution" \ - ) \ - "\n -F Set the don't fragment bit" \ - "\n -I Use ICMP ECHO instead of UDP datagrams" \ - "\n -l Display the TTL value of the returned packet" \ - "\n -d Set SO_DEBUG options to socket" \ - "\n -n Print numeric addresses" \ - "\n -r Bypass routing tables, send directly to HOST" \ - "\n -v Verbose" \ - "\n -m Max time-to-live (max number of hops)" \ - "\n -p Base UDP port number used in probes" \ - "\n (default 33434)" \ - "\n -q Number of probes per TTL (default 3)" \ - "\n -s IP address to use as the source address" \ - "\n -t Type-of-service in probe packets (default 0)" \ - "\n -w Time in seconds to wait for a response (default 3)" \ - "\n -g Loose source route gateway (8 max)" \ - -#define traceroute6_trivial_usage \ - "[-dnrv] [-m MAXTTL] [-p PORT] [-q PROBES]\n" \ - " [-s SRC_IP] [-t TOS] [-w WAIT_SEC] [-i IFACE]\n" \ - " HOST [BYTES]" -#define traceroute6_full_usage "\n\n" \ - "Trace the route to HOST\n" \ - "\nOptions:" \ - "\n -d Set SO_DEBUG options to socket" \ - "\n -n Print numeric addresses" \ - "\n -r Bypass routing tables, send directly to HOST" \ - "\n -v Verbose" \ - "\n -m Max time-to-live (max number of hops)" \ - "\n -p Base UDP port number used in probes" \ - "\n (default is 33434)" \ - "\n -q Number of probes per TTL (default 3)" \ - "\n -s IP address to use as the source address" \ - "\n -t Type-of-service in probe packets (default 0)" \ - "\n -w Time in seconds to wait for a response (default 3)" \ - -#define ttysize_trivial_usage \ - "[w] [h]" -#define ttysize_full_usage "\n\n" \ - "Print dimension(s) of stdin's terminal, on error return 80x25" - -#define tunctl_trivial_usage \ - "[-f device] ([-t name] | -d name)" IF_FEATURE_TUNCTL_UG(" [-u owner] [-g group] [-b]") -#define tunctl_full_usage "\n\n" \ - "Create or delete tun interfaces\n" \ - "\nOptions:" \ - "\n -f name tun device (/dev/net/tun)" \ - "\n -t name Create iface 'name'" \ - "\n -d name Delete iface 'name'" \ - IF_FEATURE_TUNCTL_UG( \ - "\n -u owner Set iface owner" \ - "\n -g group Set iface group" \ - "\n -b Brief output" \ - ) -#define tunctl_example_usage \ - "# tunctl\n" \ - "# tunctl -d tun0\n" - -#define udhcpd_trivial_usage \ - "[-fS]" IF_FEATURE_UDHCP_PORT(" [-P N]") " [CONFFILE]" \ - -#define udhcpd_full_usage "\n\n" \ - "DHCP server\n" \ - "\n -f Run in foreground" \ - "\n -S Log to syslog too" \ - IF_FEATURE_UDHCP_PORT( \ - "\n -P N Use port N (default 67)" \ - ) - -#define umount_trivial_usage \ - "[OPTIONS] FILESYSTEM|DIRECTORY" -#define umount_full_usage "\n\n" \ - "Unmount file systems\n" \ - "\nOptions:" \ - IF_FEATURE_UMOUNT_ALL( \ - "\n -a Unmount all file systems" IF_FEATURE_MTAB_SUPPORT(" in /etc/mtab") \ - ) \ - IF_FEATURE_MTAB_SUPPORT( \ - "\n -n Don't erase /etc/mtab entries" \ - ) \ - "\n -r Try to remount devices as read-only if mount is busy" \ - "\n -l Lazy umount (detach filesystem)" \ - "\n -f Force umount (i.e., unreachable NFS server)" \ - IF_FEATURE_MOUNT_LOOP( \ - "\n -d Free loop device if it has been used" \ - ) - -#define umount_example_usage \ - "$ umount /dev/hdc1\n" - -#define uptime_trivial_usage \ - "" -#define uptime_full_usage "\n\n" \ - "Display the time since the last boot" - -#define uptime_example_usage \ - "$ uptime\n" \ - " 1:55pm up 2:30, load average: 0.09, 0.04, 0.00\n" - -#define vconfig_trivial_usage \ - "COMMAND [OPTIONS]" -#define vconfig_full_usage "\n\n" \ - "Create and remove virtual ethernet devices\n" \ - "\nOptions:" \ - "\n add [interface-name] [vlan_id]" \ - "\n rem [vlan-name]" \ - "\n set_flag [interface-name] [flag-num] [0 | 1]" \ - "\n set_egress_map [vlan-name] [skb_priority] [vlan_qos]" \ - "\n set_ingress_map [vlan-name] [skb_priority] [vlan_qos]" \ - "\n set_name_type [name-type]" \ - -#define volname_trivial_usage \ - "[DEVICE]" -#define volname_full_usage "\n\n" \ - "Show CD volume name of the DEVICE (default /dev/cdrom)" - -#define wall_trivial_usage \ - "[FILE]" -#define wall_full_usage "\n\n" \ - "Write content of FILE or stdin to all logged-in users" -#define wall_sample_usage \ - "echo foo | wall\n" \ - "wall ./mymessage" - -#define watch_trivial_usage \ - "[-n SEC] [-t] PROG ARGS" -#define watch_full_usage "\n\n" \ - "Run PROG periodically\n" \ - "\nOptions:" \ - "\n -n Loop period in seconds (default 2)" \ - "\n -t Don't print header" \ - -#define watch_example_usage \ - "$ watch date\n" \ - "Mon Dec 17 10:31:40 GMT 2000\n" \ - "Mon Dec 17 10:31:42 GMT 2000\n" \ - "Mon Dec 17 10:31:44 GMT 2000" - -#define watchdog_trivial_usage \ - "[-t N[ms]] [-T N[ms]] [-F] DEV" -#define watchdog_full_usage "\n\n" \ - "Periodically write to watchdog device DEV\n" \ - "\nOptions:" \ - "\n -T N Reboot after N seconds if not reset (default 60)" \ - "\n -t N Reset every N seconds (default 30)" \ - "\n -F Run in foreground" \ - "\n" \ - "\nUse 500ms to specify period in milliseconds" \ - -#define zcip_trivial_usage \ - "[OPTIONS] IFACE SCRIPT" -#define zcip_full_usage "\n\n" \ - "Manage a ZeroConf IPv4 link-local address\n" \ - "\nOptions:" \ - "\n -f Run in foreground" \ - "\n -q Quit after obtaining address" \ - "\n -r 169.254.x.x Request this address first" \ - "\n -v Verbose" \ - "\n" \ - "\nWith no -q, runs continuously monitoring for ARP conflicts," \ - "\nexits only on I/O errors (link down etc)" \ - - #endif diff --git a/libbb/parse_config.c b/libbb/parse_config.c index d471edbee..4b0236028 100644 --- a/libbb/parse_config.c +++ b/libbb/parse_config.c @@ -8,6 +8,12 @@ * Also for use in uClibc (http://uclibc.org/) licensed under LGPLv2.1 or later. */ +/* +//usage:#define parse_trivial_usage +//usage: "[-n MAXTOKENS] [-m MINTOKENS] [-d DELIMS] [-f FLAGS] FILE..." +//usage:#define parse_full_usage "" +*/ + #include "libbb.h" #if defined ENABLE_PARSE && ENABLE_PARSE diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c index 8e8ff8c0a..e1edbbebc 100644 --- a/miscutils/adjtimex.c +++ b/miscutils/adjtimex.c @@ -11,6 +11,18 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define adjtimex_trivial_usage +//usage: "[-q] [-o OFF] [-f FREQ] [-p TCONST] [-t TICK]" +//usage:#define adjtimex_full_usage "\n\n" +//usage: "Read and optionally set system timebase parameters. See adjtimex(2)\n" +//usage: "\nOptions:" +//usage: "\n -q Quiet" +//usage: "\n -o OFF Time offset, microseconds" +//usage: "\n -f FREQ Frequency adjust, integer kernel units (65536 is 1ppm)" +//usage: "\n (positive values make clock run faster)" +//usage: "\n -t TICK Microseconds per tick, usually 10000" +//usage: "\n -p TCONST" + #include "libbb.h" #include diff --git a/miscutils/bbconfig.c b/miscutils/bbconfig.c index 7c30669a3..e8be81352 100644 --- a/miscutils/bbconfig.c +++ b/miscutils/bbconfig.c @@ -1,6 +1,12 @@ /* vi: set sw=4 ts=4: */ /* This file was released into the public domain by Paul Fox. */ + +//usage:#define bbconfig_trivial_usage +//usage: "" +//usage:#define bbconfig_full_usage "\n\n" +//usage: "Print the config file used by busybox build" + #include "libbb.h" #include "bbconfigopts.h" #if ENABLE_FEATURE_COMPRESS_BBCONFIG diff --git a/miscutils/beep.c b/miscutils/beep.c index 013a72543..c7699ffe1 100644 --- a/miscutils/beep.c +++ b/miscutils/beep.c @@ -7,6 +7,17 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. * */ + +//usage:#define beep_trivial_usage +//usage: "-f FREQ -l LEN -d DELAY -r COUNT -n" +//usage:#define beep_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -f Frequency in Hz" +//usage: "\n -l Length in ms" +//usage: "\n -d Delay in ms" +//usage: "\n -r Repetitions" +//usage: "\n -n Start new tone" + #include "libbb.h" #include diff --git a/miscutils/chat.c b/miscutils/chat.c index d8370a963..ce994f870 100644 --- a/miscutils/chat.c +++ b/miscutils/chat.c @@ -7,6 +7,15 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define chat_trivial_usage +//usage: "EXPECT [SEND [EXPECT [SEND...]]]" +//usage:#define chat_full_usage "\n\n" +//usage: "Useful for interacting with a modem connected to stdin/stdout.\n" +//usage: "A script consists of one or more \"expect-send\" pairs of strings,\n" +//usage: "each pair is a pair of arguments. Example:\n" +//usage: "chat '' ATZ OK ATD123456 CONNECT '' ogin: pppuser word: ppppass '~'" + #include "libbb.h" // default timeout: 45 sec diff --git a/miscutils/chrt.c b/miscutils/chrt.c index 1c6737a3c..7e40b9f13 100644 --- a/miscutils/chrt.c +++ b/miscutils/chrt.c @@ -5,6 +5,23 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define chrt_trivial_usage +//usage: "[-prfom] [PRIO] [PID | PROG ARGS]" +//usage:#define chrt_full_usage "\n\n" +//usage: "Change scheduling priority and class for a process\n" +//usage: "\nOptions:" +//usage: "\n -p Operate on PID" +//usage: "\n -r Set SCHED_RR class" +//usage: "\n -f Set SCHED_FIFO class" +//usage: "\n -o Set SCHED_OTHER class" +//usage: "\n -m Show min/max priorities" +//usage: +//usage:#define chrt_example_usage +//usage: "$ chrt -r 4 sleep 900; x=$!\n" +//usage: "$ chrt -f -p 3 $x\n" +//usage: "You need CAP_SYS_NICE privileges to set scheduling attributes of a process" + #include #include "libbb.h" #ifndef _POSIX_PRIORITY_SCHEDULING diff --git a/miscutils/crond.c b/miscutils/crond.c index 5bf053609..014016fb6 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c @@ -11,6 +11,19 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define crond_trivial_usage +//usage: "-fbS -l N " IF_FEATURE_CROND_D("-d N ") "-L LOGFILE -c DIR" +//usage:#define crond_full_usage "\n\n" +//usage: " -f Foreground" +//usage: "\n -b Background (default)" +//usage: "\n -S Log to syslog (default)" +//usage: "\n -l Set log level. 0 is the most verbose, default 8" +//usage: IF_FEATURE_CROND_D( +//usage: "\n -d Set log level, log to stderr" +//usage: ) +//usage: "\n -L Log to file" +//usage: "\n -c Working dir" + #include "libbb.h" #include diff --git a/miscutils/crontab.c b/miscutils/crontab.c index 16d7fdf69..4731d8da6 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c @@ -10,6 +10,16 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define crontab_trivial_usage +//usage: "[-c DIR] [-u USER] [-ler]|[FILE]" +//usage:#define crontab_full_usage "\n\n" +//usage: " -c Crontab directory" +//usage: "\n -u User" +//usage: "\n -l List crontab" +//usage: "\n -e Edit crontab" +//usage: "\n -r Delete crontab" +//usage: "\n FILE Replace crontab by FILE ('-': stdin)" + #include "libbb.h" #define CRONTABS CONFIG_FEATURE_CROND_DIR "/crontabs" diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 35e431951..706276015 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c @@ -53,6 +53,22 @@ The postal address is: Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. */ + +//usage:#define devfsd_trivial_usage +//usage: "mntpnt [-v]" IF_DEVFSD_FG_NP("[-fg][-np]") +//usage:#define devfsd_full_usage "\n\n" +//usage: "Manage devfs permissions and old device name symlinks\n" +//usage: "\nOptions:" +//usage: "\n mntpnt The mount point where devfs is mounted" +//usage: "\n -v Print the protocol version numbers for devfsd" +//usage: "\n and the kernel-side protocol version and exit" +//usage: IF_DEVFSD_FG_NP( +//usage: "\n -fg Run in foreground" +//usage: "\n -np Exit after parsing the configuration file" +//usage: "\n and processing synthetic REGISTER events," +//usage: "\n don't poll for events" +//usage: ) + #include "libbb.h" #include "xregex.h" #include diff --git a/miscutils/devmem.c b/miscutils/devmem.c index 7a9f533af..786a21bee 100644 --- a/miscutils/devmem.c +++ b/miscutils/devmem.c @@ -4,6 +4,14 @@ * Copyright (C) 2008, BusyBox Team. -solar 4/26/08 */ +//usage:#define devmem_trivial_usage +//usage: "ADDRESS [WIDTH [VALUE]]" +//usage:#define devmem_full_usage "\n\n" +//usage: "Read/write from physical address\n" +//usage: "\n ADDRESS Address to act upon" +//usage: "\n WIDTH Width (8/16/...)" +//usage: "\n VALUE Data to be written" + #include "libbb.h" int devmem_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/miscutils/eject.c b/miscutils/eject.c index 63d20d3ad..184ccc5d7 100644 --- a/miscutils/eject.c +++ b/miscutils/eject.c @@ -13,6 +13,17 @@ * Most of the dirty work blatantly ripped off from cat.c =) */ +//usage:#define eject_trivial_usage +//usage: "[-t] [-T] [DEVICE]" +//usage:#define eject_full_usage "\n\n" +//usage: "Eject DEVICE or default /dev/cdrom\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_EJECT_SCSI( +//usage: "\n -s SCSI device" +//usage: ) +//usage: "\n -t Close tray" +//usage: "\n -T Open/close tray (toggle)" + #include #include "libbb.h" /* Must be after libbb.h: they need size_t */ diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c index 770e70026..c761a88ca 100644 --- a/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c @@ -21,6 +21,19 @@ * "exit" (or just close fifo) - well you guessed it. */ +//usage:#define fbsplash_trivial_usage +//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" +//usage:#define fbsplash_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -s Image" +//usage: "\n -c Hide cursor" +//usage: "\n -d Framebuffer device (default /dev/fb0)" +//usage: "\n -i Config file (var=value):" +//usage: "\n BAR_LEFT,BAR_TOP,BAR_WIDTH,BAR_HEIGHT" +//usage: "\n BAR_R,BAR_G,BAR_B" +//usage: "\n -f Control pipe (else exit after drawing image)" +//usage: "\n commands: 'NN' (% for progress bar) or 'exit'" + #include "libbb.h" #include diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c index 68596e11b..33803f87d 100644 --- a/miscutils/flash_eraseall.c +++ b/miscutils/flash_eraseall.c @@ -10,6 +10,14 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define flash_eraseall_trivial_usage +//usage: "[-jq] MTD_DEVICE" +//usage:#define flash_eraseall_full_usage "\n\n" +//usage: "Erase an MTD device\n" +//usage: "\nOptions:" +//usage: "\n -j Format the device for jffs2" +//usage: "\n -q Don't display progress messages" + #include "libbb.h" #include #include diff --git a/miscutils/flash_lock_unlock.c b/miscutils/flash_lock_unlock.c index fcb836b07..1fefd95f9 100644 --- a/miscutils/flash_lock_unlock.c +++ b/miscutils/flash_lock_unlock.c @@ -3,6 +3,18 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define flash_lock_trivial_usage +//usage: "MTD_DEVICE OFFSET SECTORS" +//usage:#define flash_lock_full_usage "\n\n" +//usage: "Lock part or all of an MTD device. If SECTORS is -1, then all sectors\n" +//usage: "will be locked, regardless of the value of OFFSET" +//usage: +//usage:#define flash_unlock_trivial_usage +//usage: "MTD_DEVICE" +//usage:#define flash_unlock_full_usage "\n\n" +//usage: "Unlock an MTD device" + #include "libbb.h" #include diff --git a/miscutils/flashcp.c b/miscutils/flashcp.c index fe37c3913..e4bb3a902 100644 --- a/miscutils/flashcp.c +++ b/miscutils/flashcp.c @@ -7,6 +7,13 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define flashcp_trivial_usage +//usage: "-v FILE MTD_DEVICE" +//usage:#define flashcp_full_usage "\n\n" +//usage: "Copy an image to MTD device\n" +//usage: "\nOptions:" +//usage: "\n -v Verbose" + #include "libbb.h" #include diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 38b265d60..7608408dd 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -11,6 +11,58 @@ * hdparm.c - Command line interface to get/set hard disk parameters * - by Mark Lord (C) 1994-2002 -- freely distributable */ + +//usage:#define hdparm_trivial_usage +//usage: "[OPTIONS] [DEVICE]" +//usage:#define hdparm_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -a Get/set fs readahead" +//usage: "\n -A Set drive read-lookahead flag (0/1)" +//usage: "\n -b Get/set bus state (0 == off, 1 == on, 2 == tristate)" +//usage: "\n -B Set Advanced Power Management setting (1-255)" +//usage: "\n -c Get/set IDE 32-bit IO setting" +//usage: "\n -C Check IDE power mode status" +//usage: IF_FEATURE_HDPARM_HDIO_GETSET_DMA( +//usage: "\n -d Get/set using_dma flag") +//usage: "\n -D Enable/disable drive defect-mgmt" +//usage: "\n -f Flush buffer cache for device on exit" +//usage: "\n -g Display drive geometry" +//usage: "\n -h Display terse usage information" +//usage: IF_FEATURE_HDPARM_GET_IDENTITY( +//usage: "\n -i Display drive identification") +//usage: IF_FEATURE_HDPARM_GET_IDENTITY( +//usage: "\n -I Detailed/current information directly from drive") +//usage: "\n -k Get/set keep_settings_over_reset flag (0/1)" +//usage: "\n -K Set drive keep_features_over_reset flag (0/1)" +//usage: "\n -L Set drive doorlock (0/1) (removable harddisks only)" +//usage: "\n -m Get/set multiple sector count" +//usage: "\n -n Get/set ignore-write-errors flag (0/1)" +//usage: "\n -p Set PIO mode on IDE interface chipset (0,1,2,3,4,...)" +//usage: "\n -P Set drive prefetch count" +/* //usage: "\n -q Change next setting quietly" - not supported ib bbox */ +//usage: "\n -Q Get/set DMA tagged-queuing depth (if supported)" +//usage: "\n -r Get/set readonly flag (DANGEROUS to set)" +//usage: IF_FEATURE_HDPARM_HDIO_SCAN_HWIF( +//usage: "\n -R Register an IDE interface (DANGEROUS)") +//usage: "\n -S Set standby (spindown) timeout" +//usage: "\n -t Perform device read timings" +//usage: "\n -T Perform cache read timings" +//usage: "\n -u Get/set unmaskirq flag (0/1)" +//usage: IF_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF( +//usage: "\n -U Unregister an IDE interface (DANGEROUS)") +//usage: "\n -v Defaults; same as -mcudkrag for IDE drives" +//usage: "\n -V Display program version and exit immediately" +//usage: IF_FEATURE_HDPARM_HDIO_DRIVE_RESET( +//usage: "\n -w Perform device reset (DANGEROUS)") +//usage: "\n -W Set drive write-caching flag (0/1) (DANGEROUS)" +//usage: IF_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( +//usage: "\n -x Tristate device for hotswap (0/1) (DANGEROUS)") +//usage: "\n -X Set IDE xfer mode (DANGEROUS)" +//usage: "\n -y Put IDE drive in standby mode" +//usage: "\n -Y Put IDE drive to sleep" +//usage: "\n -Z Disable Seagate auto-powersaving mode" +//usage: "\n -z Reread partition table" + #include "libbb.h" /* must be _after_ libbb.h: */ #include diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c index fe429b636..b64e0abb9 100644 --- a/miscutils/inotifyd.c +++ b/miscutils/inotifyd.c @@ -27,6 +27,33 @@ * See below for mask names explanation. */ +//usage:#define inotifyd_trivial_usage +//usage: "PROG FILE1[:MASK]..." +//usage:#define inotifyd_full_usage "\n\n" +//usage: "Run PROG on filesystem changes." +//usage: "\nWhen a filesystem event matching MASK occurs on FILEn," +//usage: "\nPROG ACTUAL_EVENTS FILEn [SUBFILE] is run." +//usage: "\nEvents:" +//usage: "\n a File is accessed" +//usage: "\n c File is modified" +//usage: "\n e Metadata changed" +//usage: "\n w Writable file is closed" +//usage: "\n 0 Unwritable file is closed" +//usage: "\n r File is opened" +//usage: "\n D File is deleted" +//usage: "\n M File is moved" +//usage: "\n u Backing fs is unmounted" +//usage: "\n o Event queue overflowed" +//usage: "\n x File can't be watched anymore" +//usage: "\nIf watching a directory:" +//usage: "\n m Subfile is moved into dir" +//usage: "\n y Subfile is moved out of dir" +//usage: "\n n Subfile is created" +//usage: "\n d Subfile is deleted" +//usage: "\n" +//usage: "\ninotifyd waits for PROG to exit." +//usage: "\nWhen x event happens for all FILEs, inotifyd exits." + #include "libbb.h" #include diff --git a/miscutils/ionice.c b/miscutils/ionice.c index 481a738ee..2bc83c5eb 100644 --- a/miscutils/ionice.c +++ b/miscutils/ionice.c @@ -7,6 +7,14 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define ionice_trivial_usage +//usage: "[-c 1-3] [-n 0-7] [-p PID] [PROG]" +//usage:#define ionice_full_usage "\n\n" +//usage: "Change I/O priority and class\n" +//usage: "\nOptions:" +//usage: "\n -c Class. 1:realtime 2:best-effort 3:idle" +//usage: "\n -n Priority" + #include #include #include "libbb.h" diff --git a/miscutils/last.c b/miscutils/last.c index 12457b157..27f5a35ce 100644 --- a/miscutils/last.c +++ b/miscutils/last.c @@ -7,6 +7,17 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define last_trivial_usage +//usage: ""IF_FEATURE_LAST_FANCY("[-HW] [-f FILE]") +//usage:#define last_full_usage "\n\n" +//usage: "Show listing of the last users that logged into the system" +//usage: IF_FEATURE_LAST_FANCY( "\n" +//usage: "\nOptions:" +/* //usage: "\n -H Show header line" */ +//usage: "\n -W Display with no host column truncation" +//usage: "\n -f FILE Read from FILE instead of /var/log/wtmp" +//usage: ) + #include "libbb.h" /* NB: ut_name and ut_user are the same field, use only one name (ut_user) diff --git a/miscutils/less.c b/miscutils/less.c index 9e12c11a7..77fd5a8de 100644 --- a/miscutils/less.c +++ b/miscutils/less.c @@ -21,6 +21,18 @@ * redirected input has been read from stdin */ +//usage:#define less_trivial_usage +//usage: "[-EMNmh~I?] [FILE]..." +//usage:#define less_full_usage "\n\n" +//usage: "View FILE (or stdin) one screenful at a time\n" +//usage: "\nOptions:" +//usage: "\n -E Quit once the end of a file is reached" +//usage: "\n -M,-m Display status line with line numbers" +//usage: "\n and percentage through the file" +//usage: "\n -N Prefix line number to each line" +//usage: "\n -I Ignore case in all searches" +//usage: "\n -~ Suppress ~s displayed past the end of the file" + #include /* sched_yield() */ #include "libbb.h" diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index e74c47c35..8cca83882 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c @@ -7,6 +7,66 @@ * known bugs: can't deal with alpha ranges */ +//usage:#if ENABLE_FEATURE_MAKEDEVS_LEAF +//usage:#define makedevs_trivial_usage +//usage: "NAME TYPE MAJOR MINOR FIRST LAST [s]" +//usage:#define makedevs_full_usage "\n\n" +//usage: "Create a range of block or character special files" +//usage: "\n" +//usage: "\nTYPE is:" +//usage: "\n b Block device" +//usage: "\n c Character device" +//usage: "\n f FIFO, MAJOR and MINOR are ignored" +//usage: "\n" +//usage: "\nFIRST..LAST specify numbers appended to NAME." +//usage: "\nIf 's' is the last argument, the base device is created as well." +//usage: "\n" +//usage: "\nExamples:" +//usage: "\n makedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63" +//usage: "\n makedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8" +//usage: +//usage:#define makedevs_example_usage +//usage: "# makedevs /dev/ttyS c 4 66 2 63\n" +//usage: "[creates ttyS2-ttyS63]\n" +//usage: "# makedevs /dev/hda b 3 0 0 8 s\n" +//usage: "[creates hda,hda1-hda8]\n" +//usage:#endif +//usage: +//usage:#if ENABLE_FEATURE_MAKEDEVS_TABLE +//usage:#define makedevs_trivial_usage +//usage: "[-d device_table] rootdir" +//usage:#define makedevs_full_usage "\n\n" +//usage: "Create a range of special files as specified in a device table.\n" +//usage: "Device table entries take the form of:\n" +//usage: " \n" +//usage: "Where name is the file name, type can be one of:\n" +//usage: " f Regular file\n" +//usage: " d Directory\n" +//usage: " c Character device\n" +//usage: " b Block device\n" +//usage: " p Fifo (named pipe)\n" +//usage: "uid is the user id for the target file, gid is the group id for the\n" +//usage: "target file. The rest of the entries (major, minor, etc) apply to\n" +//usage: "to device special files. A '-' may be used for blank entries." +//usage: +//usage:#define makedevs_example_usage +//usage: "For example:\n" +//usage: " \n" +//usage: "/dev d 755 0 0 - - - - -\n" +//usage: "/dev/console c 666 0 0 5 1 - - -\n" +//usage: "/dev/null c 666 0 0 1 3 0 0 -\n" +//usage: "/dev/zero c 666 0 0 1 5 0 0 -\n" +//usage: "/dev/hda b 640 0 0 3 0 0 0 -\n" +//usage: "/dev/hda b 640 0 0 3 1 1 1 15\n\n" +//usage: "Will Produce:\n" +//usage: "/dev\n" +//usage: "/dev/console\n" +//usage: "/dev/null\n" +//usage: "/dev/zero\n" +//usage: "/dev/hda\n" +//usage: "/dev/hda[0-15]\n" +//usage:#endif + #include "libbb.h" #if ENABLE_FEATURE_MAKEDEVS_LEAF diff --git a/miscutils/man.c b/miscutils/man.c index b356e726f..2c6b25ceb 100644 --- a/miscutils/man.c +++ b/miscutils/man.c @@ -3,6 +3,14 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define man_trivial_usage +//usage: "[-aw] [MANPAGE]..." +//usage:#define man_full_usage "\n\n" +//usage: "Format and display manual page\n" +//usage: "\nOptions:" +//usage: "\n -a Display all pages" +//usage: "\n -w Show page locations" + #include "libbb.h" enum { diff --git a/miscutils/microcom.c b/miscutils/microcom.c index 3acbe3023..edaeb6fa5 100644 --- a/miscutils/microcom.c +++ b/miscutils/microcom.c @@ -7,6 +7,18 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define microcom_trivial_usage +//usage: "[-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY" +//usage:#define microcom_full_usage "\n\n" +//usage: "Copy bytes for stdin to TTY and from TTY to stdout\n" +//usage: "\nOptions:" +//usage: "\n -d Wait up to DELAY ms for TTY output before sending every" +//usage: "\n next byte to it" +//usage: "\n -t Exit if both stdin and TTY are silent for TIMEOUT ms" +//usage: "\n -s Set serial line to SPEED" +//usage: "\n -X Disable special meaning of NUL and Ctrl-X from stdin" + #include "libbb.h" // set raw tty mode diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c index 784c3cbfc..a1a5b396a 100644 --- a/miscutils/mountpoint.c +++ b/miscutils/mountpoint.c @@ -9,6 +9,22 @@ * Based on sysvinit's mountpoint */ +//usage:#define mountpoint_trivial_usage +//usage: "[-q] <[-dn] DIR | -x DEVICE>" +//usage:#define mountpoint_full_usage "\n\n" +//usage: "Check if the directory is a mountpoint\n" +//usage: "\nOptions:" +//usage: "\n -q Quiet" +//usage: "\n -d Print major/minor device number of the filesystem" +//usage: "\n -n Print device name of the filesystem" +//usage: "\n -x Print major/minor device number of the blockdevice" +//usage: +//usage:#define mountpoint_example_usage +//usage: "$ mountpoint /proc\n" +//usage: "/proc is not a mountpoint\n" +//usage: "$ mountpoint /sys\n" +//usage: "/sys is a mountpoint\n" + #include "libbb.h" int mountpoint_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/miscutils/mt.c b/miscutils/mt.c index 142901bb0..20afd3a50 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c @@ -3,6 +3,18 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define mt_trivial_usage +//usage: "[-f device] opcode value" +//usage:#define mt_full_usage "\n\n" +//usage: "Control magnetic tape drive operation\n" +//usage: "\n" +//usage: "Available Opcodes:\n" +//usage: "\n" +//usage: "bsf bsfm bsr bss datacompression drvbuffer eof eom erase\n" +//usage: "fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2\n" +//usage: "ras3 reset retension rewind rewoffline seek setblk setdensity\n" +//usage: "setpart tell unload unlock weof wset" + #include "libbb.h" #include diff --git a/miscutils/raidautorun.c b/miscutils/raidautorun.c index bbfa8577c..b72d89058 100644 --- a/miscutils/raidautorun.c +++ b/miscutils/raidautorun.c @@ -8,6 +8,14 @@ * */ +//usage:#define raidautorun_trivial_usage +//usage: "DEVICE" +//usage:#define raidautorun_full_usage "\n\n" +//usage: "Tell the kernel to automatically search and start RAID arrays" +//usage: +//usage:#define raidautorun_example_usage +//usage: "$ raidautorun /dev/md0" + #include "libbb.h" #include diff --git a/miscutils/readahead.c b/miscutils/readahead.c index dd6de7c45..e22aaa468 100644 --- a/miscutils/readahead.c +++ b/miscutils/readahead.c @@ -10,6 +10,11 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define readahead_trivial_usage +//usage: "[FILE]..." +//usage:#define readahead_full_usage "\n\n" +//usage: "Preload FILEs to RAM" + #include "libbb.h" int readahead_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/miscutils/rfkill.c b/miscutils/rfkill.c index b150b2cae..467197371 100644 --- a/miscutils/rfkill.c +++ b/miscutils/rfkill.c @@ -6,6 +6,19 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define rfkill_trivial_usage +//usage: "COMMAND [INDEX|TYPE]" +//usage:#define rfkill_full_usage "\n\n" +//usage: "Enable/disable wireless devices\n" +//usage: "\nCommands:" +//usage: "\n list [INDEX|TYPE] List current state" +//usage: "\n block INDEX|TYPE Disable device" +//usage: "\n unblock INDEX|TYPE Enable device" +//usage: "\n" +//usage: "\n TYPE: all, wlan(wifi), bluetooth, uwb(ultrawideband)," +//usage: "\n wimax, wwan, gps, fm" + #include "libbb.h" #include diff --git a/miscutils/runlevel.c b/miscutils/runlevel.c index 7024361e7..9d38b791f 100644 --- a/miscutils/runlevel.c +++ b/miscutils/runlevel.c @@ -11,6 +11,19 @@ * * initially busyboxified by Bernhard Reutner-Fischer */ + +//usage:#define runlevel_trivial_usage +//usage: "[FILE]" +//usage:#define runlevel_full_usage "\n\n" +//usage: "Find the current and previous system runlevel\n" +//usage: "\n" +//usage: "If no utmp FILE exists or if no runlevel record can be found,\n" +//usage: "print \"unknown\"" +//usage: +//usage:#define runlevel_example_usage +//usage: "$ runlevel /var/run/utmp\n" +//usage: "N 2" + #include "libbb.h" int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/miscutils/rx.c b/miscutils/rx.c index de785d53c..e1225779e 100644 --- a/miscutils/rx.c +++ b/miscutils/rx.c @@ -15,6 +15,14 @@ * This was originally written for blob and then adapted for busybox. */ +//usage:#define rx_trivial_usage +//usage: "FILE" +//usage:#define rx_full_usage "\n\n" +//usage: "Receive a file using the xmodem protocol" +//usage: +//usage:#define rx_example_usage +//usage: "$ rx /tmp/foo\n" + #include "libbb.h" #define SOH 0x01 diff --git a/miscutils/setsid.c b/miscutils/setsid.c index c573fae34..ad2c8a4de 100644 --- a/miscutils/setsid.c +++ b/miscutils/setsid.c @@ -14,6 +14,13 @@ * - busyboxed */ +//usage:#define setsid_trivial_usage +//usage: "PROG ARGS" +//usage:#define setsid_full_usage "\n\n" +//usage: "Run PROG in a new session. PROG will have no controlling terminal\n" +//usage: "and will not be affected by keyboard signals (Ctrl-C etc).\n" +//usage: "See setsid(2) for details." + #include "libbb.h" int setsid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/miscutils/strings.c b/miscutils/strings.c index 7ab0e227c..6e8b9aefc 100644 --- a/miscutils/strings.c +++ b/miscutils/strings.c @@ -7,6 +7,16 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define strings_trivial_usage +//usage: "[-afo] [-n LEN] [FILE]..." +//usage:#define strings_full_usage "\n\n" +//usage: "Display printable strings in a binary file\n" +//usage: "\nOptions:" +//usage: "\n -a Scan whole file (default)" +//usage: "\n -f Precede strings with filenames" +//usage: "\n -n LEN At least LEN characters form a string (default 4)" +//usage: "\n -o Precede strings with decimal offsets" + #include "libbb.h" #define WHOLE_FILE 1 diff --git a/miscutils/taskset.c b/miscutils/taskset.c index 389ef43e4..77fc8643d 100644 --- a/miscutils/taskset.c +++ b/miscutils/taskset.c @@ -6,6 +6,24 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define taskset_trivial_usage +//usage: "[-p] [MASK] [PID | PROG ARGS]" +//usage:#define taskset_full_usage "\n\n" +//usage: "Set or get CPU affinity\n" +//usage: "\nOptions:" +//usage: "\n -p Operate on an existing PID" +//usage: +//usage:#define taskset_example_usage +//usage: "$ taskset 0x7 ./dgemm_test&\n" +//usage: "$ taskset -p 0x1 $!\n" +//usage: "pid 4790's current affinity mask: 7\n" +//usage: "pid 4790's new affinity mask: 1\n" +//usage: "$ taskset 0x7 /bin/sh -c './taskset -p 0x1 $$'\n" +//usage: "pid 6671's current affinity mask: 1\n" +//usage: "pid 6671's new affinity mask: 1\n" +//usage: "$ taskset -p 1\n" +//usage: "pid 1's current affinity mask: 3\n" + #include #include "libbb.h" diff --git a/miscutils/time.c b/miscutils/time.c index 6b1c3c42c..dcd89f8fc 100644 --- a/miscutils/time.c +++ b/miscutils/time.c @@ -9,6 +9,13 @@ Heavily modified for busybox by Erik Andersen */ +//usage:#define time_trivial_usage +//usage: "[-v] PROG ARGS" +//usage:#define time_full_usage "\n\n" +//usage: "Run PROG, display resource usage when it exits\n" +//usage: "\nOptions:" +//usage: "\n -v Verbose" + #include "libbb.h" /* Information on the resources used by a child process. */ diff --git a/miscutils/timeout.c b/miscutils/timeout.c index 841669416..9d56593ba 100644 --- a/miscutils/timeout.c +++ b/miscutils/timeout.c @@ -28,6 +28,12 @@ * rewrite 14-11-2008 vda */ +//usage:#define timeout_trivial_usage +//usage: "[-t SECS] [-s SIG] 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: "Defaults: SECS: 10, SIG: TERM." + #include "libbb.h" int timeout_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/miscutils/ttysize.c b/miscutils/ttysize.c index f93a506a2..d2d48d0a9 100644 --- a/miscutils/ttysize.c +++ b/miscutils/ttysize.c @@ -9,6 +9,12 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define ttysize_trivial_usage +//usage: "[w] [h]" +//usage:#define ttysize_full_usage "\n\n" +//usage: "Print dimension(s) of stdin's terminal, on error return 80x25" + #include "libbb.h" int ttysize_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/miscutils/volname.c b/miscutils/volname.c index 6e8615617..b50e79573 100644 --- a/miscutils/volname.c +++ b/miscutils/volname.c @@ -27,6 +27,12 @@ * mods from distributed source (eject-2.0.13) are by * Matthew Stoltenberg */ + +//usage:#define volname_trivial_usage +//usage: "[DEVICE]" +//usage:#define volname_full_usage "\n\n" +//usage: "Show CD volume name of the DEVICE (default /dev/cdrom)" + #include "libbb.h" int volname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/miscutils/wall.c b/miscutils/wall.c index 0a2b89e5e..762f53b72 100644 --- a/miscutils/wall.c +++ b/miscutils/wall.c @@ -6,6 +6,15 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define wall_trivial_usage +//usage: "[FILE]" +//usage:#define wall_full_usage "\n\n" +//usage: "Write content of FILE or stdin to all logged-in users" +//usage: +//usage:#define wall_sample_usage +//usage: "echo foo | wall\n" +//usage: "wall ./mymessage" + #include "libbb.h" int wall_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index 630782660..b24dd4b82 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c @@ -9,6 +9,17 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define watchdog_trivial_usage +//usage: "[-t N[ms]] [-T N[ms]] [-F] DEV" +//usage:#define watchdog_full_usage "\n\n" +//usage: "Periodically write to watchdog device DEV\n" +//usage: "\nOptions:" +//usage: "\n -T N Reboot after N seconds if not reset (default 60)" +//usage: "\n -t N Reset every N seconds (default 30)" +//usage: "\n -F Run in foreground" +//usage: "\n" +//usage: "\nUse 500ms to specify period in milliseconds" + #include "libbb.h" #include "linux/types.h" /* for __u32 */ #include "linux/watchdog.h" diff --git a/networking/arp.c b/networking/arp.c index 0ef267a35..3f68f5cf7 100644 --- a/networking/arp.c +++ b/networking/arp.c @@ -13,6 +13,25 @@ * modified for getopt32 by Arne Bernin */ +//usage:#define arp_trivial_usage +//usage: "\n[-vn] [-H HWTYPE] [-i IF] -a [HOSTNAME]" +//usage: "\n[-v] [-i IF] -d HOSTNAME [pub]" +//usage: "\n[-v] [-H HWTYPE] [-i IF] -s HOSTNAME HWADDR [temp]" +//usage: "\n[-v] [-H HWTYPE] [-i IF] -s HOSTNAME HWADDR [netmask MASK] pub" +//usage: "\n[-v] [-H HWTYPE] [-i IF] -Ds HOSTNAME IFACE [netmask MASK] pub" +//usage:#define arp_full_usage "\n\n" +//usage: "Manipulate ARP cache\n" +//usage: "\nOptions:" +//usage: "\n -a Display (all) hosts" +//usage: "\n -s Set new ARP entry" +//usage: "\n -d Delete a specified entry" +//usage: "\n -v Verbose" +//usage: "\n -n Don't resolve names" +//usage: "\n -i IF Network interface" +//usage: "\n -D Read from given device" +//usage: "\n -A,-p AF Protocol family" +//usage: "\n -H HWTYPE Hardware address type" + #include "libbb.h" #include "inet_common.h" diff --git a/networking/arping.c b/networking/arping.c index 6f6b59cfb..357dcaaf0 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -6,6 +6,23 @@ * Busybox port: Nick Fedchik */ +//usage:#define arping_trivial_usage +//usage: "[-fqbDUA] [-c CNT] [-w TIMEOUT] [-I IFACE] [-s SRC_IP] DST_IP" +//usage:#define arping_full_usage "\n\n" +//usage: "Send ARP requests/replies\n" +//usage: "\nOptions:" +//usage: "\n -f Quit on first ARP reply" +//usage: "\n -q Quiet" +//usage: "\n -b Keep broadcasting, don't go unicast" +//usage: "\n -D Duplicated address detection mode" +//usage: "\n -U Unsolicited ARP mode, update your neighbors" +//usage: "\n -A ARP answer mode, update your neighbors" +//usage: "\n -c N Stop after sending N ARP requests" +//usage: "\n -w TIMEOUT Time to wait for ARP reply, seconds" +//usage: "\n -I IFACE Interface to use (default eth0)" +//usage: "\n -s SRC_IP Sender IP address" +//usage: "\n DST_IP Target IP address" + #include #include #include diff --git a/networking/brctl.c b/networking/brctl.c index c0b094eba..19f474fce 100644 --- a/networking/brctl.c +++ b/networking/brctl.c @@ -12,6 +12,30 @@ /* This applet currently uses only the ioctl interface and no sysfs at all. * At the time of this writing this was considered a feature. */ + +//usage:#define brctl_trivial_usage +//usage: "COMMAND [BRIDGE [INTERFACE]]" +//usage:#define brctl_full_usage "\n\n" +//usage: "Manage ethernet bridges\n" +//usage: "\nCommands:" +//usage: IF_FEATURE_BRCTL_SHOW( +//usage: "\n show Show a list of bridges" +//usage: ) +//usage: "\n addbr BRIDGE Create BRIDGE" +//usage: "\n delbr BRIDGE Delete BRIDGE" +//usage: "\n addif BRIDGE IFACE Add IFACE to BRIDGE" +//usage: "\n delif BRIDGE IFACE Delete IFACE from BRIDGE" +//usage: IF_FEATURE_BRCTL_FANCY( +//usage: "\n setageing BRIDGE TIME Set ageing time" +//usage: "\n setfd BRIDGE TIME Set bridge forward delay" +//usage: "\n sethello BRIDGE TIME Set hello time" +//usage: "\n setmaxage BRIDGE TIME Set max message age" +//usage: "\n setpathcost BRIDGE COST Set path cost" +//usage: "\n setportprio BRIDGE PRIO Set port priority" +//usage: "\n setbridgeprio BRIDGE PRIO Set bridge priority" +//usage: "\n stp BRIDGE [1/yes/on|0/no/off] STP on/off" +//usage: ) + #include "libbb.h" #include #include diff --git a/networking/dnsd.c b/networking/dnsd.c index 8ed31cea2..65eae9670 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c @@ -17,6 +17,22 @@ * the first porting of oao' scdns to busybox also. */ +//usage:#define dnsd_trivial_usage +//usage: "[-dvs] [-c CONFFILE] [-t TTL_SEC] [-p PORT] [-i ADDR]" +//usage:#define dnsd_full_usage "\n\n" +//usage: "Small static DNS server daemon\n" +//usage: "\nOptions:" +//usage: "\n -c FILE Config file" +//usage: "\n -t SEC TTL" +//usage: "\n -p PORT Listen on PORT" +//usage: "\n -i ADDR Listen on ADDR" +//usage: "\n -d Daemonize" +//usage: "\n -v Verbose" +//usage: "\n -s Send successful replies only. Use this if you want" +//usage: "\n to use /etc/resolv.conf with two nameserver lines:" +//usage: "\n nameserver DNSD_SERVER" +//usage: "\n nameserver NORNAL_DNS_SERVER" + #include "libbb.h" #include diff --git a/networking/ether-wake.c b/networking/ether-wake.c index 8f1479c02..7bb9aa5a7 100644 --- a/networking/ether-wake.c +++ b/networking/ether-wake.c @@ -64,6 +64,16 @@ * filter. That configuration consumes more power. */ +//usage:#define ether_wake_trivial_usage +//usage: "[-b] [-i iface] [-p aa:bb:cc:dd[:ee:ff]] MAC" +//usage:#define ether_wake_full_usage "\n\n" +//usage: "Send a magic packet to wake up sleeping machines.\n" +//usage: "MAC must be a station address (00:11:22:33:44:55) or\n" +//usage: "a hostname with a known 'ethers' entry.\n" +//usage: "\nOptions:" +//usage: "\n -b Send wake-up packet to the broadcast address" +//usage: "\n -i iface Interface to use (default eth0)" +//usage: "\n -p pass Append four or six byte password PW to the packet" #include #include diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 09c5ff30f..66316e21f 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -13,6 +13,44 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define ftpget_trivial_usage +//usage: "[OPTIONS] HOST [LOCAL_FILE] REMOTE_FILE" +//usage:#define ftpget_full_usage "\n\n" +//usage: "Retrieve a remote file via FTP\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_FTPGETPUT_LONG_OPTIONS( +//usage: "\n -c,--continue Continue previous transfer" +//usage: "\n -v,--verbose Verbose" +//usage: "\n -u,--username Username" +//usage: "\n -p,--password Password" +//usage: "\n -P,--port Port number" +//usage: ) +//usage: IF_NOT_FEATURE_FTPGETPUT_LONG_OPTIONS( +//usage: "\n -c Continue previous transfer" +//usage: "\n -v Verbose" +//usage: "\n -u Username" +//usage: "\n -p Password" +//usage: "\n -P Port number" +//usage: ) +//usage: +//usage:#define ftpput_trivial_usage +//usage: "[OPTIONS] HOST [REMOTE_FILE] LOCAL_FILE" +//usage:#define ftpput_full_usage "\n\n" +//usage: "Store a local file on a remote machine via FTP\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_FTPGETPUT_LONG_OPTIONS( +//usage: "\n -v,--verbose Verbose" +//usage: "\n -u,--username Username" +//usage: "\n -p,--password Password" +//usage: "\n -P,--port Port number" +//usage: ) +//usage: IF_NOT_FEATURE_FTPGETPUT_LONG_OPTIONS( +//usage: "\n -v Verbose" +//usage: "\n -u Username" +//usage: "\n -p Password" +//usage: "\n -P Port number" +//usage: ) + #include "libbb.h" struct globals { diff --git a/networking/hostname.c b/networking/hostname.c index 66b52dd90..49a3e89bb 100644 --- a/networking/hostname.c +++ b/networking/hostname.c @@ -9,6 +9,25 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define hostname_trivial_usage +//usage: "[OPTIONS] [HOSTNAME | -F FILE]" +//usage:#define hostname_full_usage "\n\n" +//usage: "Get or set hostname or DNS domain name\n" +//usage: "\nOptions:" +//usage: "\n -s Short" +//usage: "\n -i Addresses for the hostname" +//usage: "\n -d DNS domain name" +//usage: "\n -f Fully qualified domain name" +//usage: "\n -F FILE Use FILE's content as hostname" +//usage: +//usage:#define hostname_example_usage +//usage: "$ hostname\n" +//usage: "sage\n" +//usage: +//usage:#define dnsdomainname_trivial_usage NOUSAGE_STR +//usage:#define dnsdomainname_full_usage "" + #include "libbb.h" static void do_sethostname(char *s, int isfile) diff --git a/networking/httpd.c b/networking/httpd.c index eded7b63f..d6157aca2 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -97,6 +97,32 @@ */ /* TODO: use TCP_CORK, parse_config() */ +//usage:#define httpd_trivial_usage +//usage: "[-ifv[v]]" +//usage: " [-c CONFFILE]" +//usage: " [-p [IP:]PORT]" +//usage: IF_FEATURE_HTTPD_SETUID(" [-u USER[:GRP]]") +//usage: IF_FEATURE_HTTPD_BASIC_AUTH(" [-r REALM]") +//usage: " [-h HOME]\n" +//usage: "or httpd -d/-e" IF_FEATURE_HTTPD_AUTH_MD5("/-m") " STRING" +//usage:#define httpd_full_usage "\n\n" +//usage: "Listen for incoming HTTP requests\n" +//usage: "\nOptions:" +//usage: "\n -i Inetd mode" +//usage: "\n -f Don't daemonize" +//usage: "\n -v[v] Verbose" +//usage: "\n -p [IP:]PORT Bind to IP:PORT (default *:80)" +//usage: IF_FEATURE_HTTPD_SETUID( +//usage: "\n -u USER[:GRP] Set uid/gid after binding to port") +//usage: IF_FEATURE_HTTPD_BASIC_AUTH( +//usage: "\n -r REALM Authentication Realm for Basic Authentication") +//usage: "\n -h HOME Home directory (default .)" +//usage: "\n -c FILE Configuration file (default {/etc,HOME}/httpd.conf)" +//usage: IF_FEATURE_HTTPD_AUTH_MD5( +//usage: "\n -m STRING MD5 crypt STRING") +//usage: "\n -e STRING HTML encode STRING" +//usage: "\n -d STRING URL decode STRING" + #include "libbb.h" #if ENABLE_FEATURE_HTTPD_USE_SENDFILE # include diff --git a/networking/ifconfig.c b/networking/ifconfig.c index da2635ce0..220b02126 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c @@ -26,6 +26,27 @@ * IPV6 support added by Bart Visscher */ +//usage:#define ifconfig_trivial_usage +//usage: IF_FEATURE_IFCONFIG_STATUS("[-a]") " interface [address]" +//usage:#define ifconfig_full_usage "\n\n" +//usage: "Configure a network interface\n" +//usage: "\nOptions:" +//usage: "\n" +//usage: IF_FEATURE_IPV6( +//usage: " [add ADDRESS[/PREFIXLEN]]\n") +//usage: IF_FEATURE_IPV6( +//usage: " [del ADDRESS[/PREFIXLEN]]\n") +//usage: " [[-]broadcast [ADDRESS]] [[-]pointopoint [ADDRESS]]\n" +//usage: " [netmask ADDRESS] [dstaddr ADDRESS]\n" +//usage: IF_FEATURE_IFCONFIG_SLIP( +//usage: " [outfill NN] [keepalive NN]\n") +//usage: " " IF_FEATURE_IFCONFIG_HW("[hw ether" IF_FEATURE_HWIB("|infiniband")" ADDRESS] ") "[metric NN] [mtu NN]\n" +//usage: " [[-]trailers] [[-]arp] [[-]allmulti]\n" +//usage: " [multicast] [[-]promisc] [txqueuelen NN] [[-]dynamic]\n" +//usage: IF_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ( +//usage: " [mem_start NN] [io_addr NN] [irq NN]\n") +//usage: " [up|down] ..." + #include #include #include diff --git a/networking/ifenslave.c b/networking/ifenslave.c index 0b3ebf72a..208623e7d 100644 --- a/networking/ifenslave.c +++ b/networking/ifenslave.c @@ -98,6 +98,33 @@ * set version to 1.1.0 */ +//usage:#define ifenslave_trivial_usage +//usage: "[-cdf] MASTER_IFACE SLAVE_IFACE..." +//usage:#define ifenslave_full_usage "\n\n" +//usage: "Configure network interfaces for parallel routing\n" +//usage: "\nOptions:" +//usage: "\n -c,--change-active Change active slave" +//usage: "\n -d,--detach Remove slave interface from bonding device" +//usage: "\n -f,--force Force, even if interface is not Ethernet" +/* //usage: "\n -r,--receive-slave Create a receive-only slave" */ +//usage: +//usage:#define ifenslave_example_usage +//usage: "To create a bond device, simply follow these three steps:\n" +//usage: "- ensure that the required drivers are properly loaded:\n" +//usage: " # modprobe bonding ; modprobe <3c59x|eepro100|pcnet32|tulip|...>\n" +//usage: "- assign an IP address to the bond device:\n" +//usage: " # ifconfig bond0 netmask broadcast \n" +//usage: "- attach all the interfaces you need to the bond device:\n" +//usage: " # ifenslave bond0 eth0 eth1 eth2\n" +//usage: " If bond0 didn't have a MAC address, it will take eth0's. Then, all\n" +//usage: " interfaces attached AFTER this assignment will get the same MAC addr.\n\n" +//usage: " To detach a dead interface without setting the bond device down:\n" +//usage: " # ifenslave -d bond0 eth1\n\n" +//usage: " To set the bond device down and automatically release all the slaves:\n" +//usage: " # ifconfig bond0 down\n\n" +//usage: " To change active slave:\n" +//usage: " # ifenslave -c bond0 eth0\n" + #include "libbb.h" /* #include - no. linux/if_bonding.h pulls in linux/if.h */ diff --git a/networking/ifplugd.c b/networking/ifplugd.c index 8dd0a5bd8..421611aae 100644 --- a/networking/ifplugd.c +++ b/networking/ifplugd.c @@ -6,6 +6,32 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define ifplugd_trivial_usage +//usage: "[OPTIONS]" +//usage:#define ifplugd_full_usage "\n\n" +//usage: "Network interface plug detection daemon\n" +//usage: "\nOptions:" +//usage: "\n -n Don't daemonize" +//usage: "\n -s Don't log to syslog" +//usage: "\n -i IFACE Interface" +//usage: "\n -f/-F Treat link detection error as link down/link up" +//usage: "\n (otherwise exit on error)" +//usage: "\n -a Don't up interface at each link probe" +//usage: "\n -M Monitor creation/destruction of interface" +//usage: "\n (otherwise it must exist)" +//usage: "\n -r PROG Script to run" +//usage: "\n -x ARG Extra argument for script" +//usage: "\n -I Don't exit on nonzero exit code from script" +//usage: "\n -p Don't run script on daemon startup" +//usage: "\n -q Don't run script on daemon quit" +//usage: "\n -l Run script on startup even if no cable is detected" +//usage: "\n -t SECS Poll time in seconds" +//usage: "\n -u SECS Delay before running script after link up" +//usage: "\n -d SECS Delay after link down" +//usage: "\n -m MODE API mode (mii, priv, ethtool, wlan, iff, auto)" +//usage: "\n -k Kill running daemon" + #include "libbb.h" #include "fix_u32.h" diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 7706a84b7..b48abb7dc 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -17,6 +17,34 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define ifup_trivial_usage +//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." +//usage:#define ifup_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -a De/configure all interfaces automatically" +//usage: "\n -i FILE Use FILE for interface definitions" +//usage: "\n -n Print out what would happen, but don't do it" +//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 de/configuration" +//usage: +//usage:#define ifdown_trivial_usage +//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." +//usage:#define ifdown_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -a De/configure all interfaces automatically" +//usage: "\n -i FILE Use FILE for interface definitions" +//usage: "\n -n Print out what would happen, but don't do it" +//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 de/configuration" + #include "libbb.h" /* After libbb.h, since it needs sys/types.h on some systems */ #include diff --git a/networking/inetd.c b/networking/inetd.c index 6018665ef..226a6491c 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -154,6 +154,17 @@ * setuid() */ +//usage:#define inetd_trivial_usage +//usage: "[-fe] [-q N] [-R N] [CONFFILE]" +//usage:#define inetd_full_usage "\n\n" +//usage: "Listen for network connections and launch programs\n" +//usage: "\nOptions:" +//usage: "\n -f Run in foreground" +//usage: "\n -e Log to stderr" +//usage: "\n -q N Socket listen queue (default: 128)" +//usage: "\n -R N Pause services after N connects/min" +//usage: "\n (default: 0 - disabled)" + #include #include diff --git a/networking/ip.c b/networking/ip.c index 350656cef..98d583325 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -9,6 +9,79 @@ * Bernhard Reutner-Fischer rewrote to use index_in_substr_array */ +/* would need to make the " | " optional depending on more than one selected: */ +//usage:#define ip_trivial_usage +//usage: "[OPTIONS] {" +//usage: IF_FEATURE_IP_ADDRESS("address | ") +//usage: IF_FEATURE_IP_ROUTE("route | ") +//usage: IF_FEATURE_IP_LINK("link | ") +//usage: IF_FEATURE_IP_TUNNEL("tunnel | ") +//usage: IF_FEATURE_IP_RULE("rule") +//usage: "} {COMMAND}" +//usage:#define ip_full_usage "\n\n" +//usage: "ip [OPTIONS] OBJECT {COMMAND}\n" +//usage: "where OBJECT := {" +//usage: IF_FEATURE_IP_ADDRESS("address | ") +//usage: IF_FEATURE_IP_ROUTE("route | ") +//usage: IF_FEATURE_IP_LINK("link | ") +//usage: IF_FEATURE_IP_TUNNEL("tunnel | ") +//usage: IF_FEATURE_IP_RULE("rule") +//usage: "}\n" +//usage: "OPTIONS := { -f[amily] { inet | inet6 | link } | -o[neline] }" +//usage: +//usage:#define ipaddr_trivial_usage +//usage: "{ {add|del} IFADDR dev STRING | {show|flush}\n" +//usage: " [dev STRING] [to PREFIX] }" +//usage:#define ipaddr_full_usage "\n\n" +//usage: "ipaddr {add|delete} IFADDR dev STRING\n" +//usage: "ipaddr {show|flush} [dev STRING] [scope SCOPE-ID]\n" +//usage: " [to PREFIX] [label PATTERN]\n" +//usage: " IFADDR := PREFIX | ADDR peer PREFIX\n" +//usage: " [broadcast ADDR] [anycast ADDR]\n" +//usage: " [label STRING] [scope SCOPE-ID]\n" +//usage: " SCOPE-ID := [host | link | global | NUMBER]" +//usage: +//usage:#define iplink_trivial_usage +//usage: "{ set DEVICE { up | down | arp { on | off } | show [DEVICE] }" +//usage:#define iplink_full_usage "\n\n" +//usage: "iplink set DEVICE { up | down | arp | multicast { on | off } |\n" +//usage: " dynamic { on | off } |\n" +//usage: " mtu MTU }\n" +//usage: "iplink show [DEVICE]" +//usage: +//usage:#define iproute_trivial_usage +//usage: "{ list | flush | { add | del | change | append |\n" +//usage: " replace | monitor } ROUTE }" +//usage:#define iproute_full_usage "\n\n" +//usage: "iproute { list | flush } SELECTOR\n" +//usage: "iproute get ADDRESS [from ADDRESS iif STRING]\n" +//usage: " [oif STRING] [tos TOS]\n" +//usage: "iproute { add | del | change | append | replace | monitor } ROUTE\n" +//usage: " SELECTOR := [root PREFIX] [match PREFIX] [proto RTPROTO]\n" +//usage: " ROUTE := [TYPE] PREFIX [tos TOS] [proto RTPROTO]\n" +//usage: " [metric METRIC]" +//usage: +//usage:#define iprule_trivial_usage +//usage: "{[list | add | del] RULE}" +//usage:#define iprule_full_usage "\n\n" +//usage: "iprule [list | add | del] SELECTOR ACTION\n" +//usage: " SELECTOR := [from PREFIX] [to PREFIX] [tos TOS] [fwmark FWMARK]\n" +//usage: " [dev STRING] [pref NUMBER]\n" +//usage: " ACTION := [table TABLE_ID] [nat ADDRESS]\n" +//usage: " [prohibit | reject | unreachable]\n" +//usage: " [realms [SRCREALM/]DSTREALM]\n" +//usage: " TABLE_ID := [local | main | default | NUMBER]" +//usage: +//usage:#define iptunnel_trivial_usage +//usage: "{ add | change | del | show } [NAME]\n" +//usage: " [mode { ipip | gre | sit }]\n" +//usage: " [remote ADDR] [local ADDR] [ttl TTL]" +//usage:#define iptunnel_full_usage "\n\n" +//usage: "iptunnel { add | change | del | show } [NAME]\n" +//usage: " [mode { ipip | gre | sit }] [remote ADDR] [local ADDR]\n" +//usage: " [[i|o]seq] [[i|o]key KEY] [[i|o]csum]\n" +//usage: " [ttl TTL] [tos TOS] [[no]pmtudisc] [dev PHYS_DEV]" + #include "libbb.h" #include "libiproute/utils.h" diff --git a/networking/ipcalc.c b/networking/ipcalc.c index acbaa4ac5..f96c73912 100644 --- a/networking/ipcalc.c +++ b/networking/ipcalc.c @@ -11,6 +11,33 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define ipcalc_trivial_usage +//usage: "[OPTIONS] ADDRESS[[/]NETMASK] [NETMASK]" +//usage:#define ipcalc_full_usage "\n\n" +//usage: "Calculate IP network settings from a IP address\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_IPCALC_LONG_OPTIONS( +//usage: "\n -b,--broadcast Display calculated broadcast address" +//usage: "\n -n,--network Display calculated network address" +//usage: "\n -m,--netmask Display default netmask for IP" +//usage: IF_FEATURE_IPCALC_FANCY( +//usage: "\n -p,--prefix Display the prefix for IP/NETMASK" +//usage: "\n -h,--hostname Display first resolved host name" +//usage: "\n -s,--silent Don't ever display error messages" +//usage: ) +//usage: ) +//usage: IF_NOT_FEATURE_IPCALC_LONG_OPTIONS( +//usage: "\n -b Display calculated broadcast address" +//usage: "\n -n Display calculated network address" +//usage: "\n -m Display default netmask for IP" +//usage: IF_FEATURE_IPCALC_FANCY( +//usage: "\n -p Display the prefix for IP/NETMASK" +//usage: "\n -h Display first resolved host name" +//usage: "\n -s Don't ever display error messages" +//usage: ) +//usage: ) + #include "libbb.h" /* After libbb.h, because on some systems it needs other includes */ #include diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c index 18ce59aaf..199e11225 100644 --- a/networking/isrv_identd.c +++ b/networking/isrv_identd.c @@ -7,6 +7,17 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define fakeidentd_trivial_usage +//usage: "[-fiw] [-b ADDR] [STRING]" +//usage:#define fakeidentd_full_usage "\n\n" +//usage: "Provide fake ident (auth) service\n" +//usage: "\nOptions:" +//usage: "\n -f Run in foreground" +//usage: "\n -i Inetd mode" +//usage: "\n -w Inetd 'wait' mode" +//usage: "\n -b ADDR Bind to specified address" +//usage: "\n STRING Ident answer string (default: nobody)" + #include "libbb.h" #include #include "isrv.h" diff --git a/networking/nslookup.c b/networking/nslookup.c index 67fc01547..f4fd407dd 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c @@ -11,6 +11,20 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define nslookup_trivial_usage +//usage: "[HOST] [SERVER]" +//usage:#define nslookup_full_usage "\n\n" +//usage: "Query the nameserver for the IP address of the given HOST\n" +//usage: "optionally using a specified DNS server" +//usage: +//usage:#define nslookup_example_usage +//usage: "$ nslookup localhost\n" +//usage: "Server: default\n" +//usage: "Address: default\n" +//usage: "\n" +//usage: "Name: debian\n" +//usage: "Address: 127.0.0.1\n" + #include #include "libbb.h" diff --git a/networking/ntpd.c b/networking/ntpd.c index ba2950d8f..e27dbaa6b 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -27,6 +27,23 @@ * * *********************************************************************** */ + +//usage:#define ntpd_trivial_usage +//usage: "[-dnqNw"IF_FEATURE_NTPD_SERVER("l")"] [-S PROG] [-p PEER]..." +//usage:#define ntpd_full_usage "\n\n" +//usage: "NTP client/server\n" +//usage: "\nOptions:" +//usage: "\n -d Verbose" +//usage: "\n -n Do not daemonize" +//usage: "\n -q Quit after clock is set" +//usage: "\n -N Run at high priority" +//usage: "\n -w Do not set time (only query peers), implies -n" +//usage: IF_FEATURE_NTPD_SERVER( +//usage: "\n -l Run as server on port 123" +//usage: ) +//usage: "\n -S PROG Run PROG after stepping time, stratum change, and every 11 mins" +//usage: "\n -p PEER Obtain time from PEER (may be repeated)" + #include "libbb.h" #include #include /* For IPTOS_LOWDELAY definition */ diff --git a/networking/pscan.c b/networking/pscan.c index a9e5d5c29..5595148fc 100644 --- a/networking/pscan.c +++ b/networking/pscan.c @@ -6,6 +6,18 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define pscan_trivial_usage +//usage: "[-cb] [-p MIN_PORT] [-P MAX_PORT] [-t TIMEOUT] [-T MIN_RTT] HOST" +//usage:#define pscan_full_usage "\n\n" +//usage: "Scan a host, print all open ports\n" +//usage: "\nOptions:" +//usage: "\n -c Show closed ports too" +//usage: "\n -b Show blocked ports too" +//usage: "\n -p Scan from this port (default 1)" +//usage: "\n -P Scan up to this port (default 1024)" +//usage: "\n -t Timeout (default 5000 ms)" +//usage: "\n -T Minimum rtt (default 5 ms, increase for congested hosts)" + #include "libbb.h" /* debugging */ diff --git a/networking/route.c b/networking/route.c index 98a03ded7..6699a1c32 100644 --- a/networking/route.c +++ b/networking/route.c @@ -25,6 +25,15 @@ * remove ridiculous amounts of bloat. */ +//usage:#define route_trivial_usage +//usage: "[{add|del|delete}]" +//usage:#define route_full_usage "\n\n" +//usage: "Edit kernel routing tables\n" +//usage: "\nOptions:" +//usage: "\n -n Don't resolve names" +//usage: "\n -e Display other/more information" +//usage: "\n -A inet" IF_FEATURE_IPV6("{6}") " Select address family" + #include #include diff --git a/networking/slattach.c b/networking/slattach.c index 71edd2f27..d1221b11a 100644 --- a/networking/slattach.c +++ b/networking/slattach.c @@ -13,6 +13,20 @@ * - The -F options allows disabling of RTS/CTS flow control. */ +//usage:#define slattach_trivial_usage +//usage: "[-cehmLF] [-s SPEED] [-p PROTOCOL] DEVICE" +//usage:#define slattach_full_usage "\n\n" +//usage: "Attach network interface(s) to serial line(s)\n" +//usage: "\nOptions:" +//usage: "\n -p PROT Set protocol (slip, cslip, slip6, clisp6 or adaptive)" +//usage: "\n -s SPD Set line speed" +//usage: "\n -e Exit after initializing device" +//usage: "\n -h Exit when the carrier is lost" +//usage: "\n -c PROG Run PROG when the line is hung up" +//usage: "\n -m Do NOT initialize the line in raw 8 bits mode" +//usage: "\n -L Enable 3-wire operation" +//usage: "\n -F Disable RTS/CTS flow control" + #include "libbb.h" #include "libiproute/utils.h" /* invarg() */ diff --git a/networking/tc.c b/networking/tc.c index 9b3245546..e9848a86b 100644 --- a/networking/tc.c +++ b/networking/tc.c @@ -7,6 +7,27 @@ * Bernhard Reutner-Fischer adjusted for busybox */ +//usage:#define tc_trivial_usage +/* //usage: "[OPTIONS] OBJECT CMD [dev STRING]" */ +//usage: "OBJECT CMD [dev STRING]" +//usage:#define tc_full_usage "\n\n" +//usage: "OBJECT: {qdisc|class|filter}\n" +//usage: "CMD: {add|del|change|replace|show}\n" +//usage: "\n" +//usage: "qdisc [ handle QHANDLE ] [ root |"IF_FEATURE_TC_INGRESS(" ingress |")" parent CLASSID ]\n" +/* //usage: "[ estimator INTERVAL TIME_CONSTANT ]\n" */ +//usage: " [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n" +//usage: " QDISC_KIND := { [p|b]fifo | tbf | prio | cbq | red | etc. }\n" +//usage: "qdisc show [ dev STRING ]"IF_FEATURE_TC_INGRESS(" [ingress]")"\n" +//usage: "class [ classid CLASSID ] [ root | parent CLASSID ]\n" +//usage: " [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n" +//usage: "class show [ dev STRING ] [ root | parent CLASSID ]\n" +//usage: "filter [ pref PRIO ] [ protocol PROTO ]\n" +/* //usage: "\t[ estimator INTERVAL TIME_CONSTANT ]\n" */ +//usage: " [ root | classid CLASSID ] [ handle FILTERID ]\n" +//usage: " [ [ FILTER_TYPE ] [ help | OPTIONS ] ]\n" +//usage: "filter show [ dev STRING ] [ root | parent CLASSID ]" + #include "libbb.h" #include "libiproute/utils.h" diff --git a/networking/tcpudp.c b/networking/tcpudp.c index 3ff2acbf8..a2b8c958c 100644 --- a/networking/tcpudp.c +++ b/networking/tcpudp.c @@ -29,6 +29,43 @@ * - don't know how to retrieve ORIGDST for udp. */ +//usage:#define tcpsvd_trivial_usage +//usage: "[-hEv] [-c N] [-C N[:MSG]] [-b N] [-u USER] [-l NAME] IP PORT PROG" +/* with not-implemented options: */ +/* //usage: "[-hpEvv] [-c N] [-C N[:MSG]] [-b N] [-u USER] [-l NAME] [-i DIR|-x CDB] [-t SEC] IP PORT PROG" */ +//usage:#define tcpsvd_full_usage "\n\n" +//usage: "Create TCP socket, bind to IP:PORT and listen\n" +//usage: "for incoming connection. Run PROG for each connection.\n" +//usage: "\n IP IP to listen on. '0' = all" +//usage: "\n PORT Port to listen on" +//usage: "\n PROG ARGS Program to run" +//usage: "\n -l NAME Local hostname (else looks up local hostname in DNS)" +//usage: "\n -u USER[:GRP] Change to user/group after bind" +//usage: "\n -c N Handle up to N connections simultaneously" +//usage: "\n -b N Allow a backlog of approximately N TCP SYNs" +//usage: "\n -C N[:MSG] Allow only up to N connections from the same IP." +//usage: "\n New connections from this IP address are closed" +//usage: "\n immediately. MSG is written to the peer before close" +//usage: "\n -h Look up peer's hostname" +//usage: "\n -E Don't set up environment variables" +//usage: "\n -v Verbose" +//usage: +//usage:#define udpsvd_trivial_usage +//usage: "[-hEv] [-c N] [-u USER] [-l NAME] IP PORT PROG" +//usage:#define udpsvd_full_usage "\n\n" +//usage: "Create UDP socket, bind to IP:PORT and wait\n" +//usage: "for incoming packets. Run PROG for each packet,\n" +//usage: "redirecting all further packets with same peer ip:port to it.\n" +//usage: "\n IP IP to listen on. '0' = all" +//usage: "\n PORT Port to listen on" +//usage: "\n PROG ARGS Program to run" +//usage: "\n -l NAME Local hostname (else looks up local hostname in DNS)" +//usage: "\n -u USER[:GRP] Change to user/group after bind" +//usage: "\n -c N Handle up to N connections simultaneously" +//usage: "\n -h Look up peer's hostname" +//usage: "\n -E Don't set up environment variables" +//usage: "\n -v Verbose" + #include "libbb.h" /* Wants etc, thus included after libbb.h: */ diff --git a/networking/telnet.c b/networking/telnet.c index f6fad684c..1f0d85107 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -21,6 +21,22 @@ * */ +//usage:#if ENABLE_FEATURE_TELNET_AUTOLOGIN +//usage:#define telnet_trivial_usage +//usage: "[-a] [-l USER] HOST [PORT]" +//usage:#define telnet_full_usage "\n\n" +//usage: "Connect to telnet server\n" +//usage: "\nOptions:" +//usage: "\n -a Automatic login with $USER variable" +//usage: "\n -l USER Automatic login as USER" +//usage: +//usage:#else +//usage:#define telnet_trivial_usage +//usage: "HOST [PORT]" +//usage:#define telnet_full_usage "\n\n" +//usage: "Connect to telnet server" +//usage:#endif + #include #include #include "libbb.h" diff --git a/networking/telnetd.c b/networking/telnetd.c index eec4417ca..4404064fc 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c @@ -20,6 +20,28 @@ * Vladimir Oleynik 2001 * Set process group corrections, initial busybox port */ + +//usage:#define telnetd_trivial_usage +//usage: "[OPTIONS]" +//usage:#define telnetd_full_usage "\n\n" +//usage: "Handle incoming telnet connections" +//usage: IF_NOT_FEATURE_TELNETD_STANDALONE(" via inetd") "\n" +//usage: "\nOptions:" +//usage: "\n -l LOGIN Exec LOGIN on connect" +//usage: "\n -f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue" +//usage: "\n -K Close connection as soon as login exits" +//usage: "\n (normally wait until all programs close slave pty)" +//usage: IF_FEATURE_TELNETD_STANDALONE( +//usage: "\n -p PORT Port to listen on" +//usage: "\n -b ADDR[:PORT] Address to bind to" +//usage: "\n -F Run in foreground" +//usage: "\n -i Inetd mode" +//usage: IF_FEATURE_TELNETD_INETD_WAIT( +//usage: "\n -w SEC Inetd 'wait' mode, linger time SEC" +//usage: "\n -S Log to syslog (implied by -i or without -F and -w)" +//usage: ) +//usage: ) + #define DEBUG 0 #include "libbb.h" diff --git a/networking/tftp.c b/networking/tftp.c index 35cf0dbd9..f52e49d51 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -18,6 +18,39 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define tftp_trivial_usage +//usage: "[OPTIONS] HOST [PORT]" +//usage:#define tftp_full_usage "\n\n" +//usage: "Transfer a file from/to tftp server\n" +//usage: "\nOptions:" +//usage: "\n -l FILE Local FILE" +//usage: "\n -r FILE Remote FILE" +//usage: IF_FEATURE_TFTP_GET( +//usage: "\n -g Get file" +//usage: ) +//usage: IF_FEATURE_TFTP_PUT( +//usage: "\n -p Put file" +//usage: ) +//usage: IF_FEATURE_TFTP_BLOCKSIZE( +//usage: "\n -b SIZE Transfer blocks of SIZE octets" +//usage: ) +//usage: +//usage:#define tftpd_trivial_usage +//usage: "[-cr] [-u USER] [DIR]" +//usage:#define tftpd_full_usage "\n\n" +//usage: "Transfer a file on tftp client's request\n" +//usage: "\n" +//usage: "tftpd should be used as an inetd service.\n" +//usage: "tftpd's line for inetd.conf:\n" +//usage: " 69 dgram udp nowait root tftpd tftpd /files/to/serve\n" +//usage: "It also can be ran from udpsvd:\n" +//usage: " udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve\n" +//usage: "\nOptions:" +//usage: "\n -r Prohibit upload" +//usage: "\n -c Allow file creation via upload" +//usage: "\n -u Access files as USER" + #include "libbb.h" #if ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT diff --git a/networking/traceroute.c b/networking/traceroute.c index 55dc15b66..96f9d3472 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -210,6 +210,51 @@ * Tue Dec 20 03:50:13 PST 1988 */ +//usage:#define traceroute_trivial_usage +//usage: "[-"IF_TRACEROUTE6("46")"FIldnrv] [-f 1ST_TTL] [-m MAXTTL] [-p PORT] [-q PROBES]\n" +//usage: " [-s SRC_IP] [-t TOS] [-w WAIT_SEC] [-g GATEWAY] [-i IFACE]\n" +//usage: " [-z PAUSE_MSEC] HOST [BYTES]" +//usage:#define traceroute_full_usage "\n\n" +//usage: "Trace the route to HOST\n" +//usage: "\nOptions:" +//usage: IF_TRACEROUTE6( +//usage: "\n -4,-6 Force IP or IPv6 name resolution" +//usage: ) +//usage: "\n -F Set the don't fragment bit" +//usage: "\n -I Use ICMP ECHO instead of UDP datagrams" +//usage: "\n -l Display the TTL value of the returned packet" +//usage: "\n -d Set SO_DEBUG options to socket" +//usage: "\n -n Print numeric addresses" +//usage: "\n -r Bypass routing tables, send directly to HOST" +//usage: "\n -v Verbose" +//usage: "\n -m Max time-to-live (max number of hops)" +//usage: "\n -p Base UDP port number used in probes" +//usage: "\n (default 33434)" +//usage: "\n -q Number of probes per TTL (default 3)" +//usage: "\n -s IP address to use as the source address" +//usage: "\n -t Type-of-service in probe packets (default 0)" +//usage: "\n -w Time in seconds to wait for a response (default 3)" +//usage: "\n -g Loose source route gateway (8 max)" +//usage: +//usage:#define traceroute6_trivial_usage +//usage: "[-dnrv] [-m MAXTTL] [-p PORT] [-q PROBES]\n" +//usage: " [-s SRC_IP] [-t TOS] [-w WAIT_SEC] [-i IFACE]\n" +//usage: " HOST [BYTES]" +//usage:#define traceroute6_full_usage "\n\n" +//usage: "Trace the route to HOST\n" +//usage: "\nOptions:" +//usage: "\n -d Set SO_DEBUG options to socket" +//usage: "\n -n Print numeric addresses" +//usage: "\n -r Bypass routing tables, send directly to HOST" +//usage: "\n -v Verbose" +//usage: "\n -m Max time-to-live (max number of hops)" +//usage: "\n -p Base UDP port number used in probes" +//usage: "\n (default is 33434)" +//usage: "\n -q Number of probes per TTL (default 3)" +//usage: "\n -s IP address to use as the source address" +//usage: "\n -t Type-of-service in probe packets (default 0)" +//usage: "\n -w Time in seconds to wait for a response (default 3)" + #define TRACEROUTE_SO_DEBUG 0 /* TODO: undefs were uncommented - ??! we have config system for that! */ diff --git a/networking/tunctl.c b/networking/tunctl.c index e17a9db64..8cb733b68 100644 --- a/networking/tunctl.c +++ b/networking/tunctl.c @@ -9,6 +9,25 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define tunctl_trivial_usage +//usage: "[-f device] ([-t name] | -d name)" IF_FEATURE_TUNCTL_UG(" [-u owner] [-g group] [-b]") +//usage:#define tunctl_full_usage "\n\n" +//usage: "Create or delete tun interfaces\n" +//usage: "\nOptions:" +//usage: "\n -f name tun device (/dev/net/tun)" +//usage: "\n -t name Create iface 'name'" +//usage: "\n -d name Delete iface 'name'" +//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: ) +//usage: +//usage:#define tunctl_example_usage +//usage: "# tunctl\n" +//usage: "# tunctl -d tun0\n" + #include #include #include diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c index 6fb48a19a..747472d0c 100644 --- a/networking/udhcp/dhcpd.c +++ b/networking/udhcp/dhcpd.c @@ -20,6 +20,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +//usage:#define udhcpd_trivial_usage +//usage: "[-fS]" IF_FEATURE_UDHCP_PORT(" [-P N]") " [CONFFILE]" +//usage:#define udhcpd_full_usage "\n\n" +//usage: "DHCP server\n" +//usage: "\n -f Run in foreground" +//usage: "\n -S Log to syslog too" +//usage: IF_FEATURE_UDHCP_PORT( +//usage: "\n -P N Use port N (default 67)" +//usage: ) + #include #include "common.h" #include "dhcpc.h" diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c index 86ef04a62..f82ac05b4 100644 --- a/networking/udhcp/dhcprelay.c +++ b/networking/udhcp/dhcprelay.c @@ -9,6 +9,12 @@ * Netbeat AG * Upstream has GPL v2 or later */ + +//usage:#define dhcprelay_trivial_usage +//usage: "CLIENT_IFACE[,CLIENT_IFACE2]... SERVER_IFACE [SERVER_IP]" +//usage:#define dhcprelay_full_usage "\n\n" +//usage: "Relay DHCP requests between clients and server" + #include "common.h" #define SERVER_PORT 67 diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c index 21d62a2d2..ec07192c1 100644 --- a/networking/udhcp/dumpleases.c +++ b/networking/udhcp/dumpleases.c @@ -2,6 +2,23 @@ /* * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define dumpleases_trivial_usage +//usage: "[-r|-a] [-f LEASEFILE]" +//usage:#define dumpleases_full_usage "\n\n" +//usage: "Display DHCP leases granted by udhcpd\n" +//usage: "\nOptions:" +//usage: IF_LONG_OPTS( +//usage: "\n -f,--file=FILE Lease file" +//usage: "\n -r,--remaining Show remaining time" +//usage: "\n -a,--absolute Show expiration time" +//usage: ) +//usage: IF_NOT_LONG_OPTS( +//usage: "\n -f FILE Lease file" +//usage: "\n -r Show remaining time" +//usage: "\n -a Show expiration time" +//usage: ) + #include "common.h" #include "dhcpd.h" #include "unicode.h" diff --git a/networking/vconfig.c b/networking/vconfig.c index 13c65ad78..4fa341ac3 100644 --- a/networking/vconfig.c +++ b/networking/vconfig.c @@ -9,6 +9,18 @@ /* BB_AUDIT SUSv3 N/A */ +//usage:#define vconfig_trivial_usage +//usage: "COMMAND [OPTIONS]" +//usage:#define vconfig_full_usage "\n\n" +//usage: "Create and remove virtual ethernet devices\n" +//usage: "\nOptions:" +//usage: "\n add [interface-name] [vlan_id]" +//usage: "\n rem [vlan-name]" +//usage: "\n set_flag [interface-name] [flag-num] [0 | 1]" +//usage: "\n set_egress_map [vlan-name] [skb_priority] [vlan_qos]" +//usage: "\n set_ingress_map [vlan-name] [skb_priority] [vlan_qos]" +//usage: "\n set_name_type [name-type]" + #include "libbb.h" #include diff --git a/networking/zcip.c b/networking/zcip.c index 6fa265ad4..7250fb2fd 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -23,6 +23,19 @@ // - avoid silent script failures, especially under load... // - link status monitoring (restart on link-up; stop on link-down) +//usage:#define zcip_trivial_usage +//usage: "[OPTIONS] IFACE SCRIPT" +//usage:#define zcip_full_usage "\n\n" +//usage: "Manage a ZeroConf IPv4 link-local address\n" +//usage: "\nOptions:" +//usage: "\n -f Run in foreground" +//usage: "\n -q Quit after obtaining address" +//usage: "\n -r 169.254.x.x Request this address first" +//usage: "\n -v Verbose" +//usage: "\n" +//usage: "\nWith no -q, runs continuously monitoring for ARP conflicts," +//usage: "\nexits only on I/O errors (link down etc)" + #include #include #include diff --git a/printutils/lpd.c b/printutils/lpd.c index 157cbe8ae..115552e0b 100644 --- a/printutils/lpd.c +++ b/printutils/lpd.c @@ -70,6 +70,17 @@ * mv -f ./"$DATAFILE" save/ */ +//usage:#define lpd_trivial_usage +//usage: "SPOOLDIR [HELPER [ARGS]]" +//usage:#define lpd_full_usage "\n\n" +//usage: "SPOOLDIR must contain (symlinks to) device nodes or directories" +//usage: "\nwith names matching print queue names. In the first case, jobs are" +//usage: "\nsent directly to the device. Otherwise each job is stored in queue" +//usage: "\ndirectory and HELPER program is called. Name of file to print" +//usage: "\nis passed in $DATAFILE variable." +//usage: "\nExample:" +//usage: "\n tcpsvd -E 0 515 softlimit -m 999999 lpd /var/spool ./print" + #include "libbb.h" // strip argument of bad chars diff --git a/printutils/lpr.c b/printutils/lpr.c index 284917926..f8ee9a11b 100644 --- a/printutils/lpr.c +++ b/printutils/lpr.c @@ -11,6 +11,27 @@ * * See RFC 1179 for protocol description. */ + +//usage:#define lpr_trivial_usage +//usage: "-P queue[@host[:port]] -U USERNAME -J TITLE -Vmh [FILE]..." +/* -C CLASS exists too, not shown. + * CLASS is supposed to be printed on banner page, if one is requested */ +//usage:#define lpr_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -P lp service to connect to (else uses $PRINTER)" +//usage: "\n -m Send mail on completion" +//usage: "\n -h Print banner page too" +//usage: "\n -V Verbose" +//usage: +//usage:#define lpq_trivial_usage +//usage: "[-P queue[@host[:port]]] [-U USERNAME] [-d JOBID]... [-fs]" +//usage:#define lpq_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -P lp service to connect to (else uses $PRINTER)" +//usage: "\n -d Delete jobs" +//usage: "\n -f Force any waiting job to be printed" +//usage: "\n -s Short display" + #include "libbb.h" /* diff --git a/procps/free.c b/procps/free.c index ad8711f8a..ca753134c 100644 --- a/procps/free.c +++ b/procps/free.c @@ -9,6 +9,18 @@ /* getopt not needed */ +//usage:#define free_trivial_usage +//usage: "" IF_DESKTOP("[-b/k/m/g]") +//usage:#define free_full_usage "\n\n" +//usage: "Display the amount of free and used system memory" +//usage: +//usage:#define free_example_usage +//usage: "$ free\n" +//usage: " total used free shared buffers\n" +//usage: " Mem: 257628 248724 8904 59644 93124\n" +//usage: " Swap: 128516 8404 120112\n" +//usage: "Total: 386144 257128 129016\n" + #include "libbb.h" struct globals { diff --git a/procps/fuser.c b/procps/fuser.c index a1b93d77f..7837ff883 100644 --- a/procps/fuser.c +++ b/procps/fuser.c @@ -7,6 +7,17 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define fuser_trivial_usage +//usage: "[OPTIONS] FILE or PORT/PROTO" +//usage:#define fuser_full_usage "\n\n" +//usage: "Find processes which use FILEs or PORTs\n" +//usage: "\nOptions:" +//usage: "\n -m Find processes which use same fs as FILEs" +//usage: "\n -4,-6 Search only IPv4/IPv6 space" +//usage: "\n -s Don't display PIDs" +//usage: "\n -k Kill found processes" +//usage: "\n -SIGNAL Signal to send (default: KILL)" + #include "libbb.h" #define MAX_LINE 255 diff --git a/procps/kill.c b/procps/kill.c index 695d266c5..6776d9546 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -8,6 +8,45 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define kill_trivial_usage +//usage: "[-l] [-SIG] PID..." +//usage:#define kill_full_usage "\n\n" +//usage: "Send a signal (default: TERM) to given PIDs\n" +//usage: "\nOptions:" +//usage: "\n -l List all signal names and numbers" +/* //usage: "\n -s SIG Yet another way of specifying SIG" */ +//usage: +//usage:#define kill_example_usage +//usage: "$ ps | grep apache\n" +//usage: "252 root root S [apache]\n" +//usage: "263 www-data www-data S [apache]\n" +//usage: "264 www-data www-data S [apache]\n" +//usage: "265 www-data www-data S [apache]\n" +//usage: "266 www-data www-data S [apache]\n" +//usage: "267 www-data www-data S [apache]\n" +//usage: "$ kill 252\n" +//usage: +//usage:#define killall_trivial_usage +//usage: "[-l] [-q] [-SIG] PROCESS_NAME..." +//usage:#define killall_full_usage "\n\n" +//usage: "Send a signal (default: TERM) to given processes\n" +//usage: "\nOptions:" +//usage: "\n -l List all signal names and numbers" +/* //usage: "\n -s SIG Yet another way of specifying SIG" */ +//usage: "\n -q Don't complain if no processes were killed" +//usage: +//usage:#define killall_example_usage +//usage: "$ killall apache\n" +//usage: +//usage:#define killall5_trivial_usage +//usage: "[-l] [-SIG] [-o PID]..." +//usage:#define killall5_full_usage "\n\n" +//usage: "Send a signal (default: TERM) to all processes outside current session\n" +//usage: "\nOptions:" +//usage: "\n -l List all signal names and numbers" +//usage: "\n -o PID Don't signal this PID" +/* //usage: "\n -s SIG Yet another way of specifying SIG" */ + #include "libbb.h" /* Note: kill_main is directly called from shell in order to implement diff --git a/procps/pgrep.c b/procps/pgrep.c index 5d388a87d..902a3a75e 100644 --- a/procps/pgrep.c +++ b/procps/pgrep.c @@ -6,6 +6,35 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define pgrep_trivial_usage +//usage: "[-flnovx] [-s SID|-P PPID|PATTERN]" +//usage:#define pgrep_full_usage "\n\n" +//usage: "Display process(es) selected by regex PATTERN\n" +//usage: "\nOptions:" +//usage: "\n -l Show command name too" +//usage: "\n -f Match against entire command line" +//usage: "\n -n Show the newest process only" +//usage: "\n -o Show the oldest process only" +//usage: "\n -v Negate the match" +//usage: "\n -x Match whole name (not substring)" +//usage: "\n -s Match session ID (0 for current)" +//usage: "\n -P Match parent process ID" +//usage: +//usage:#define pkill_trivial_usage +//usage: "[-l|-SIGNAL] [-fnovx] [-s SID|-P PPID|PATTERN]" +//usage:#define pkill_full_usage "\n\n" +//usage: "Send a signal to process(es) selected by regex PATTERN\n" +//usage: "\nOptions:" +//usage: "\n -l List all signals" +//usage: "\n -f Match against entire command line" +//usage: "\n -n Signal the newest process only" +//usage: "\n -o Signal the oldest process only" +//usage: "\n -v Negate the match" +//usage: "\n -x Match whole name (not substring)" +//usage: "\n -s Match session ID (0 for current)" +//usage: "\n -P Match parent process ID" + #include "libbb.h" #include "xregex.h" diff --git a/procps/pidof.c b/procps/pidof.c index 49e469ca5..e102a31c6 100644 --- a/procps/pidof.c +++ b/procps/pidof.c @@ -7,6 +7,34 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT) +//usage:#define pidof_trivial_usage +//usage: "[OPTIONS] [NAME]..." +//usage:#define USAGE_PIDOF "\n\nOptions:" +//usage:#else +//usage:#define pidof_trivial_usage +//usage: "[NAME]..." +//usage:#define USAGE_PIDOF /* none */ +//usage:#endif +//usage:#define pidof_full_usage "\n\n" +//usage: "List PIDs of all processes with names that match NAMEs" +//usage: USAGE_PIDOF +//usage: IF_FEATURE_PIDOF_SINGLE( +//usage: "\n -s Show only one PID" +//usage: ) +//usage: IF_FEATURE_PIDOF_OMIT( +//usage: "\n -o PID Omit given pid" +//usage: "\n Use %PPID to omit pid of pidof's parent" +//usage: ) +//usage: +//usage:#define pidof_example_usage +//usage: "$ pidof init\n" +//usage: "1\n" +//usage: IF_FEATURE_PIDOF_OMIT( +//usage: "$ pidof /bin/sh\n20351 5973 5950\n") +//usage: IF_FEATURE_PIDOF_OMIT( +//usage: "$ pidof /bin/sh -o %PPID\n20351 5950") + #include "libbb.h" enum { diff --git a/procps/ps.c b/procps/ps.c index 6945780ec..7f273d0a6 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -9,6 +9,53 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#if ENABLE_DESKTOP +//usage: +//usage:#define ps_trivial_usage +//usage: "[-o COL1,COL2=HEADER]" IF_FEATURE_SHOW_THREADS(" [-T]") +//usage:#define ps_full_usage "\n\n" +//usage: "Show list of processes\n" +//usage: "\nOptions:" +//usage: "\n -o COL1,COL2=HEADER Select columns for display" +//usage: IF_FEATURE_SHOW_THREADS( +//usage: "\n -T Show threads" +//usage: ) +//usage: +//usage:#else /* !ENABLE_DESKTOP */ +//usage: +//usage:#if !ENABLE_SELINUX && !ENABLE_FEATURE_PS_WIDE +//usage:#define USAGE_PS "\nThis version of ps accepts no options" +//usage:#else +//usage:#define USAGE_PS "\nOptions:" +//usage:#endif +//usage: +//usage:#define ps_trivial_usage +//usage: "" +//usage:#define ps_full_usage "\n\n" +//usage: "Show list of processes\n" +//usage: USAGE_PS +//usage: IF_SELINUX( +//usage: "\n -Z Show selinux context" +//usage: ) +//usage: IF_FEATURE_PS_WIDE( +//usage: "\n w Wide output" +//usage: ) +//usage: +//usage:#endif /* ENABLE_DESKTOP */ +//usage: +//usage:#define ps_example_usage +//usage: "$ ps\n" +//usage: " PID Uid Gid State Command\n" +//usage: " 1 root root S init\n" +//usage: " 2 root root S [kflushd]\n" +//usage: " 3 root root S [kupdate]\n" +//usage: " 4 root root S [kpiod]\n" +//usage: " 5 root root S [kswapd]\n" +//usage: " 742 andersen andersen S [bash]\n" +//usage: " 743 andersen andersen S -bash\n" +//usage: " 745 root root S [getty]\n" +//usage: " 2990 andersen andersen R ps\n" + #include "libbb.h" /* Absolute maximum on output line length */ diff --git a/procps/renice.c b/procps/renice.c index 59194b5f4..067c8f75a 100644 --- a/procps/renice.c +++ b/procps/renice.c @@ -19,6 +19,16 @@ * following IDs (if any). Multiple switches are allowed. */ +//usage:#define renice_trivial_usage +//usage: "{{-n INCREMENT} | PRIORITY} [[-p | -g | -u] ID...]" +//usage:#define renice_full_usage "\n\n" +//usage: "Change scheduling priority for a running process\n" +//usage: "\nOptions:" +//usage: "\n -n Adjust current nice value (smaller is faster)" +//usage: "\n -p Process id(s) (default)" +//usage: "\n -g Process group id(s)" +//usage: "\n -u Process user name(s) and/or id(s)" + #include "libbb.h" #include diff --git a/procps/sysctl.c b/procps/sysctl.c index aba966e7f..f36548f87 100644 --- a/procps/sysctl.c +++ b/procps/sysctl.c @@ -11,6 +11,25 @@ * v1.01.1 - busybox applet aware by */ +//usage:#define sysctl_trivial_usage +//usage: "[OPTIONS] [VALUE]..." +//usage:#define sysctl_full_usage "\n\n" +//usage: "Configure kernel parameters at runtime\n" +//usage: "\nOptions:" +//usage: "\n -n Don't print key names" +//usage: "\n -e Don't warn about unknown keys" +//usage: "\n -w Change sysctl setting" +//usage: "\n -p FILE Load sysctl settings from FILE (default /etc/sysctl.conf)" +//usage: "\n -a Display all values" +//usage: "\n -A Display all values in table form" +//usage: +//usage:#define sysctl_example_usage +//usage: "sysctl [-n] [-e] variable...\n" +//usage: "sysctl [-n] [-e] -w variable=value...\n" +//usage: "sysctl [-n] [-e] -a\n" +//usage: "sysctl [-n] [-e] -p file (default /etc/sysctl.conf)\n" +//usage: "sysctl [-n] [-e] -A\n" + #include "libbb.h" enum { diff --git a/procps/uptime.c b/procps/uptime.c index 5c48795bf..1a7da46a3 100644 --- a/procps/uptime.c +++ b/procps/uptime.c @@ -15,6 +15,15 @@ /* getopt not needed */ +//usage:#define uptime_trivial_usage +//usage: "" +//usage:#define uptime_full_usage "\n\n" +//usage: "Display the time since the last boot" +//usage: +//usage:#define uptime_example_usage +//usage: "$ uptime\n" +//usage: " 1:55pm up 2:30, load average: 0.09, 0.04, 0.00\n" + #include "libbb.h" #ifndef FSHIFT diff --git a/procps/watch.c b/procps/watch.c index 36f71c469..e289bf8cb 100644 --- a/procps/watch.c +++ b/procps/watch.c @@ -11,6 +11,20 @@ /* BB_AUDIT SUSv3 N/A */ /* BB_AUDIT GNU defects -- only option -n is supported. */ +//usage:#define watch_trivial_usage +//usage: "[-n SEC] [-t] PROG ARGS" +//usage:#define watch_full_usage "\n\n" +//usage: "Run PROG periodically\n" +//usage: "\nOptions:" +//usage: "\n -n Loop period in seconds (default 2)" +//usage: "\n -t Don't print header" +//usage: +//usage:#define watch_example_usage +//usage: "$ watch date\n" +//usage: "Mon Dec 17 10:31:40 GMT 2000\n" +//usage: "Mon Dec 17 10:31:42 GMT 2000\n" +//usage: "Mon Dec 17 10:31:44 GMT 2000" + #include "libbb.h" // procps 2.0.18: diff --git a/runit/chpst.c b/runit/chpst.c index dc8a26aeb..63da4797f 100644 --- a/runit/chpst.c +++ b/runit/chpst.c @@ -28,6 +28,70 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Busyboxed by Denys Vlasenko */ /* Dependencies on runit_lib.c removed */ +//usage:#define chpst_trivial_usage +//usage: "[-vP012] [-u USER[:GRP]] [-U USER[:GRP]] [-e DIR]\n" +//usage: " [-/ DIR] [-n NICE] [-m BYTES] [-d BYTES] [-o N]\n" +//usage: " [-p N] [-f BYTES] [-c BYTES] PROG ARGS" +//usage:#define chpst_full_usage "\n\n" +//usage: "Change the process state, run PROG\n" +//usage: "\nOptions:" +//usage: "\n -u USER[:GRP] Set uid and gid" +//usage: "\n -U USER[:GRP] Set $UID and $GID in environment" +//usage: "\n -e DIR Set environment variables as specified by files" +//usage: "\n in DIR: file=1st_line_of_file" +//usage: "\n -/ DIR Chroot to DIR" +//usage: "\n -n NICE Add NICE to nice value" +//usage: "\n -m BYTES Same as -d BYTES -s BYTES -l BYTES" +//usage: "\n -d BYTES Limit data segment" +//usage: "\n -o N Limit number of open files per process" +//usage: "\n -p N Limit number of processes per uid" +//usage: "\n -f BYTES Limit output file sizes" +//usage: "\n -c BYTES Limit core file size" +//usage: "\n -v Verbose" +//usage: "\n -P Create new process group" +//usage: "\n -0 Close stdin" +//usage: "\n -1 Close stdout" +//usage: "\n -2 Close stderr" +//usage: +//usage:#define envdir_trivial_usage +//usage: "DIR PROG ARGS" +//usage:#define envdir_full_usage "\n\n" +//usage: "Set various environment variables as specified by files\n" +//usage: "in the directory DIR, run PROG" +//usage: +//usage:#define envuidgid_trivial_usage +//usage: "USER PROG ARGS" +//usage:#define envuidgid_full_usage "\n\n" +//usage: "Set $UID to USER's uid and $GID to USER's gid, run PROG" +//usage: +//usage:#define setuidgid_trivial_usage +//usage: "USER PROG ARGS" +//usage:#define setuidgid_full_usage "\n\n" +//usage: "Set uid and gid to USER's uid and gid, drop supplementary group ids,\n" +//usage: "run PROG" +//usage: +//usage:#define softlimit_trivial_usage +//usage: "[-a BYTES] [-m BYTES] [-d BYTES] [-s BYTES] [-l BYTES]\n" +//usage: " [-f BYTES] [-c BYTES] [-r BYTES] [-o N] [-p N] [-t N]\n" +//usage: " PROG ARGS" +//usage:#define softlimit_full_usage "\n\n" +//usage: "Set soft resource limits, then run PROG\n" +//usage: "\nOptions:" +//usage: "\n -a BYTES Limit total size of all segments" +//usage: "\n -m BYTES Same as -d BYTES -s BYTES -l BYTES -a BYTES" +//usage: "\n -d BYTES Limit data segment" +//usage: "\n -s BYTES Limit stack segment" +//usage: "\n -l BYTES Limit locked memory size" +//usage: "\n -o N Limit number of open files per process" +//usage: "\n -p N Limit number of processes per uid" +//usage: "\nOptions controlling file sizes:" +//usage: "\n -f BYTES Limit output file sizes" +//usage: "\n -c BYTES Limit core file size" +//usage: "\nEfficiency opts:" +//usage: "\n -r BYTES Limit resident set size" +//usage: "\n -t N Limit CPU time, process receives" +//usage: "\n a SIGXCPU after N seconds" + #include "libbb.h" /* diff --git a/runit/runsv.c b/runit/runsv.c index e76572daa..ad8d84f74 100644 --- a/runit/runsv.c +++ b/runit/runsv.c @@ -28,6 +28,11 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Busyboxed by Denys Vlasenko */ /* TODO: depends on runit_lib.c - review and reduce/eliminate */ +//usage:#define runsv_trivial_usage +//usage: "DIR" +//usage:#define runsv_full_usage "\n\n" +//usage: "Start and monitor a service and optionally an appendant log service" + #include #include #include "libbb.h" diff --git a/runit/runsvdir.c b/runit/runsvdir.c index 166664237..9495a2a4f 100644 --- a/runit/runsvdir.c +++ b/runit/runsvdir.c @@ -28,6 +28,13 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Busyboxed by Denys Vlasenko */ /* TODO: depends on runit_lib.c - review and reduce/eliminate */ +//usage:#define runsvdir_trivial_usage +//usage: "[-P] [-s SCRIPT] DIR" +//usage:#define runsvdir_full_usage "\n\n" +//usage: "Start a runsv process for each subdirectory. If it exits, restart it.\n" +//usage: "\n -P Put each runsv in a new session" +//usage: "\n -s SCRIPT Run SCRIPT after signal is processed" + #include #include #include "libbb.h" diff --git a/runit/sv.c b/runit/sv.c index c420a91a6..322688a36 100644 --- a/runit/sv.c +++ b/runit/sv.c @@ -153,6 +153,22 @@ Exit Codes /* Busyboxed by Denys Vlasenko */ /* TODO: depends on runit_lib.c - review and reduce/eliminate */ +//usage:#define sv_trivial_usage +//usage: "[-v] [-w SEC] CMD SERVICE_DIR..." +//usage:#define sv_full_usage "\n\n" +//usage: "Control services monitored by runsv supervisor.\n" +//usage: "Commands (only first character is enough):\n" +//usage: "\n" +//usage: "status: query service status\n" +//usage: "up: if service isn't running, start it. If service stops, restart it\n" +//usage: "once: like 'up', but if service stops, don't restart it\n" +//usage: "down: send TERM and CONT signals. If ./run exits, start ./finish\n" +//usage: " if it exists. After it stops, don't restart service\n" +//usage: "exit: send TERM and CONT signals to service and log service. If they exit,\n" +//usage: " runsv exits too\n" +//usage: "pause, cont, hup, alarm, interrupt, quit, 1, 2, term, kill: send\n" +//usage: "STOP, CONT, HUP, ALRM, INT, QUIT, USR1, USR2, TERM, KILL signal to service" + #include #include #include "libbb.h" diff --git a/selinux/chcon.c b/selinux/chcon.c index e00cdda1b..8644502b5 100644 --- a/selinux/chcon.c +++ b/selinux/chcon.c @@ -7,6 +7,39 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define chcon_trivial_usage +//usage: "[OPTIONS] CONTEXT FILE..." +//usage: "\n chcon [OPTIONS] [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE..." +//usage: IF_FEATURE_CHCON_LONG_OPTIONS( +//usage: "\n chcon [OPTIONS] --reference=RFILE FILE..." +//usage: ) +//usage:#define chcon_full_usage "\n\n" +//usage: "Change the security context of each FILE to CONTEXT\n" +//usage: IF_FEATURE_CHCON_LONG_OPTIONS( +//usage: "\n -v,--verbose Verbose" +//usage: "\n -c,--changes Report changes made" +//usage: "\n -h,--no-dereference Affect symlinks instead of their targets" +//usage: "\n -f,--silent,--quiet Suppress most error messages" +//usage: "\n --reference=RFILE Use RFILE's group instead of using a CONTEXT value" +//usage: "\n -u,--user=USER Set user/role/type/range in the target" +//usage: "\n -r,--role=ROLE security context" +//usage: "\n -t,--type=TYPE" +//usage: "\n -l,--range=RANGE" +//usage: "\n -R,--recursive Recurse" +//usage: ) +//usage: IF_NOT_FEATURE_CHCON_LONG_OPTIONS( +//usage: "\n -v Verbose" +//usage: "\n -c Report changes made" +//usage: "\n -h Affect symlinks instead of their targets" +//usage: "\n -f Suppress most error messages" +//usage: "\n -u USER Set user/role/type/range in the target security context" +//usage: "\n -r ROLE" +//usage: "\n -t TYPE" +//usage: "\n -l RNG" +//usage: "\n -R Recurse" +//usage: ) + #include #include diff --git a/selinux/getenforce.c b/selinux/getenforce.c index d9d9d0f65..56611d693 100644 --- a/selinux/getenforce.c +++ b/selinux/getenforce.c @@ -7,6 +7,9 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define getenforce_trivial_usage NOUSAGE_STR +//usage:#define getenforce_full_usage "" + #include "libbb.h" int getenforce_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/selinux/getsebool.c b/selinux/getsebool.c index 924356cae..e8f0fefb0 100644 --- a/selinux/getsebool.c +++ b/selinux/getsebool.c @@ -7,6 +7,11 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define getsebool_trivial_usage +//usage: "-a or getsebool boolean..." +//usage:#define getsebool_full_usage "\n\n" +//usage: " -a Show all selinux booleans" + #include "libbb.h" int getsebool_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/selinux/load_policy.c b/selinux/load_policy.c index 8fc92dbf3..ce139dbf2 100644 --- a/selinux/load_policy.c +++ b/selinux/load_policy.c @@ -4,6 +4,10 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define load_policy_trivial_usage NOUSAGE_STR +//usage:#define load_policy_full_usage "" + #include "libbb.h" int load_policy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/selinux/matchpathcon.c b/selinux/matchpathcon.c index ec49077c8..9e5728eb3 100644 --- a/selinux/matchpathcon.c +++ b/selinux/matchpathcon.c @@ -5,6 +5,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define matchpathcon_trivial_usage +//usage: "[-n] [-N] [-f file_contexts_file] [-p prefix] [-V]" +//usage:#define matchpathcon_full_usage "\n\n" +//usage: " -n Don't display path" +//usage: "\n -N Don't use translations" +//usage: "\n -f Use alternate file_context file" +//usage: "\n -p Use prefix to speed translations" +//usage: "\n -V Verify file context on disk matches defaults" + #include "libbb.h" static int print_matchpathcon(char *path, int noprint) diff --git a/selinux/runcon.c b/selinux/runcon.c index 54349b25c..f0b21269f 100644 --- a/selinux/runcon.c +++ b/selinux/runcon.c @@ -28,6 +28,28 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define runcon_trivial_usage +//usage: "[-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] PROG ARGS\n" +//usage: "runcon CONTEXT PROG ARGS" +//usage:#define runcon_full_usage "\n\n" +//usage: "Run PROG in a different security context\n" +//usage: "\n CONTEXT Complete security context\n" +//usage: IF_FEATURE_RUNCON_LONG_OPTIONS( +//usage: "\n -c,--compute Compute process transition context before modifying" +//usage: "\n -t,--type=TYPE Type (for same role as parent)" +//usage: "\n -u,--user=USER User identity" +//usage: "\n -r,--role=ROLE Role" +//usage: "\n -l,--range=RNG Levelrange" +//usage: ) +//usage: IF_NOT_FEATURE_RUNCON_LONG_OPTIONS( +//usage: "\n -c Compute process transition context before modifying" +//usage: "\n -t TYPE Type (for same role as parent)" +//usage: "\n -u USER User identity" +//usage: "\n -r ROLE Role" +//usage: "\n -l RNG Levelrange" +//usage: ) + #include #include #include diff --git a/selinux/selinuxenabled.c b/selinux/selinuxenabled.c index aa4e63f74..ce830dc22 100644 --- a/selinux/selinuxenabled.c +++ b/selinux/selinuxenabled.c @@ -6,6 +6,10 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define selinuxenabled_trivial_usage NOUSAGE_STR +//usage:#define selinuxenabled_full_usage "" + #include "libbb.h" int selinuxenabled_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/selinux/sestatus.c b/selinux/sestatus.c index aa12e806c..0bd1a0dda 100644 --- a/selinux/sestatus.c +++ b/selinux/sestatus.c @@ -8,6 +8,12 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define sestatus_trivial_usage +//usage: "[-vb]" +//usage:#define sestatus_full_usage "\n\n" +//usage: " -v Verbose" +//usage: "\n -b Display current state of booleans" + #include "libbb.h" extern char *selinux_mnt; diff --git a/selinux/setenforce.c b/selinux/setenforce.c index be5432147..c5bc0a5a6 100644 --- a/selinux/setenforce.c +++ b/selinux/setenforce.c @@ -7,6 +7,10 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define setenforce_trivial_usage +//usage: "[Enforcing | Permissive | 1 | 0]" +//usage:#define setenforce_full_usage "" + #include "libbb.h" /* These strings are arranged so that odd ones diff --git a/selinux/setfiles.c b/selinux/setfiles.c index 989510e3d..ca3fd9361 100644 --- a/selinux/setfiles.c +++ b/selinux/setfiles.c @@ -4,6 +4,46 @@ Port to BusyBox (c) 2007 by Yuichi Nakamura */ +//usage:#define setfiles_trivial_usage +//usage: "[-dnpqsvW] [-e DIR]... [-o FILE] [-r alt_root_path]" +//usage: IF_FEATURE_SETFILES_CHECK_OPTION( +//usage: " [-c policyfile] spec_file" +//usage: ) +//usage: " pathname" +//usage:#define setfiles_full_usage "\n\n" +//usage: "Reset file contexts under pathname according to spec_file\n" +//usage: IF_FEATURE_SETFILES_CHECK_OPTION( +//usage: "\n -c FILE Check the validity of the contexts against the specified binary policy" +//usage: ) +//usage: "\n -d Show which specification matched each file" +//usage: "\n -l Log changes in file labels to syslog" +//usage: "\n -n Don't change any file labels" +//usage: "\n -q Suppress warnings" +//usage: "\n -r DIR Use an alternate root path" +//usage: "\n -e DIR Exclude DIR" +//usage: "\n -F Force reset of context to match file_context for customizable files" +//usage: "\n -o FILE Save list of files with incorrect context" +//usage: "\n -s Take a list of files from stdin (instead of command line)" +//usage: "\n -v Show changes in file labels, if type or role are changing" +//usage: "\n -vv Show changes in file labels, if type, role, or user are changing" +//usage: "\n -W Display warnings about entries that had no matching files" +//usage: +//usage:#define restorecon_trivial_usage +//usage: "[-iFnRv] [-e EXCLUDEDIR]... [-o FILE] [-f FILE]" +//usage:#define restorecon_full_usage "\n\n" +//usage: "Reset security contexts of files in pathname\n" +//usage: "\n -i Ignore files that don't exist" +//usage: "\n -f FILE File with list of files to process" +//usage: "\n -e DIR Directory to exclude" +//usage: "\n -R,-r Recurse" +//usage: "\n -n Don't change any file labels" +//usage: "\n -o FILE Save list of files with incorrect context" +//usage: "\n -v Verbose" +//usage: "\n -vv Show changed labels" +//usage: "\n -F Force reset of context to match file_context" +//usage: "\n for customizable files, or the user section," +//usage: "\n if it has changed" + #include "libbb.h" #if ENABLE_FEATURE_SETFILES_CHECK_OPTION #include diff --git a/selinux/setsebool.c b/selinux/setsebool.c index a8cc00407..ec682e5c5 100644 --- a/selinux/setsebool.c +++ b/selinux/setsebool.c @@ -8,6 +8,11 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define setsebool_trivial_usage +//usage: "boolean value" +//usage:#define setsebool_full_usage "\n\n" +//usage: "Change boolean setting" + #include "libbb.h" int setsebool_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c index db32065fb..3992081ca 100644 --- a/sysklogd/klogd.c +++ b/sysklogd/klogd.c @@ -17,6 +17,14 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define klogd_trivial_usage +//usage: "[-c N] [-n]" +//usage:#define klogd_full_usage "\n\n" +//usage: "Kernel logger\n" +//usage: "\nOptions:" +//usage: "\n -c N Only messages with level < N are printed to console" +//usage: "\n -n Run in foreground" + #include "libbb.h" #include diff --git a/sysklogd/logger.c b/sysklogd/logger.c index 120f6a718..0fabd97ca 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c @@ -7,6 +7,18 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define logger_trivial_usage +//usage: "[OPTIONS] [MESSAGE]" +//usage:#define logger_full_usage "\n\n" +//usage: "Write MESSAGE (or stdin) to syslog\n" +//usage: "\nOptions:" +//usage: "\n -s Log to stderr as well as the system log" +//usage: "\n -t TAG Log using the specified tag (defaults to user name)" +//usage: "\n -p PRIO Priority (numeric or facility.level pair)" +//usage: +//usage:#define logger_example_usage +//usage: "$ logger \"hello\"\n" + /* * Done in syslogd_and_logger.c: #include "libbb.h" diff --git a/sysklogd/logread.c b/sysklogd/logread.c index 52c97aa77..ae0b2194b 100644 --- a/sysklogd/logread.c +++ b/sysklogd/logread.c @@ -9,6 +9,13 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define logread_trivial_usage +//usage: "[-f]" +//usage:#define logread_full_usage "\n\n" +//usage: "Show messages in syslogd's circular buffer\n" +//usage: "\nOptions:" +//usage: "\n -f Output data as log grows" + #include "libbb.h" #include #include diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index f179dc5ac..7ddd3e4c3 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -13,6 +13,33 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define syslogd_trivial_usage +//usage: "[OPTIONS]" +//usage:#define syslogd_full_usage "\n\n" +//usage: "System logging utility.\n" +//usage: "This version of syslogd ignores /etc/syslog.conf\n" +//usage: "\nOptions:" +//usage: "\n -n Run in foreground" +//usage: "\n -O FILE Log to given file (default:/var/log/messages)" +//usage: "\n -l N Set local log level" +//usage: "\n -S Smaller logging output" +//usage: IF_FEATURE_ROTATE_LOGFILE( +//usage: "\n -s SIZE Max size (KB) before rotate (default:200KB, 0=off)" +//usage: "\n -b N N rotated logs to keep (default:1, max=99, 0=purge)") +//usage: IF_FEATURE_REMOTE_LOG( +//usage: "\n -R HOST[:PORT] Log to IP or hostname on PORT (default PORT=514/UDP)" +//usage: "\n -L Log locally and via network (default is network only if -R)") +//usage: IF_FEATURE_SYSLOGD_DUP( +//usage: "\n -D Drop duplicates") +//usage: IF_FEATURE_IPC_SYSLOG( +//usage: "\n -C[size(KiB)] Log to shared mem buffer (read it using logread)") +/* NB: -Csize shouldn't have space (because size is optional) */ +/* //usage: "\n -m MIN Minutes between MARK lines (default:20, 0=off)" */ +//usage: +//usage:#define syslogd_example_usage +//usage: "$ syslogd -R masterlog:514\n" +//usage: "$ syslogd -R 192.168.1.1:601\n" + /* * Done in syslogd_and_logger.c: #include "libbb.h" diff --git a/util-linux/acpid.c b/util-linux/acpid.c index ce4c98ebe..c9eed2a7f 100644 --- a/util-linux/acpid.c +++ b/util-linux/acpid.c @@ -6,6 +6,30 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define acpid_trivial_usage +//usage: "[-d] [-c CONFDIR] [-l LOGFILE] [-a ACTIONFILE] [-M MAPFILE] [-e PROC_EVENT_FILE] [-p PIDFILE]" +//usage:#define acpid_full_usage "\n\n" +//usage: "Listen to ACPI events and spawn specific helpers on event arrival\n" +//usage: "\nOptions:" +//usage: "\n -c DIR Config directory [/etc/acpi]" +//usage: "\n -d Don't daemonize, (implies -f)" +//usage: "\n -e FILE /proc event file [/proc/acpi/event]" +//usage: "\n -f Run in foreground" +//usage: "\n -l FILE Log file [/var/log/acpid.log]" +//usage: "\n -p FILE Pid file [/var/run/acpid.pid]" +//usage: "\n -a FILE Action file [/etc/acpid.conf]" +//usage: "\n -M FILE Map file [/etc/acpi.map]" +//usage: IF_FEATURE_ACPID_COMPAT( +//usage: "\n\nAccept and ignore compatibility options -g -m -s -S -v" +//usage: ) +//usage: +//usage:#define acpid_example_usage +//usage: "Without -e option, acpid uses all /dev/input/event* files\n" +//usage: "# acpid\n" +//usage: "# acpid -l /var/log/my-acpi-log\n" +//usage: "# acpid -e /proc/acpi/event\n" + #include "libbb.h" #include #include diff --git a/util-linux/blkid.c b/util-linux/blkid.c index fe88fb31d..c30360c65 100644 --- a/util-linux/blkid.c +++ b/util-linux/blkid.c @@ -7,6 +7,11 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define blkid_trivial_usage +//usage: "" +//usage:#define blkid_full_usage "\n\n" +//usage: "Print UUIDs of all filesystems" + #include "libbb.h" #include "volume_id.h" diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 6e43a22f5..412bf024b 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c @@ -8,6 +8,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define dmesg_trivial_usage +//usage: "[-c] [-n LEVEL] [-s SIZE]" +//usage:#define dmesg_full_usage "\n\n" +//usage: "Print or control the kernel ring buffer\n" +//usage: "\nOptions:" +//usage: "\n -c Clear ring buffer after printing" +//usage: "\n -n LEVEL Set console logging level" +//usage: "\n -s SIZE Buffer size" + #include #include "libbb.h" diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 77cc1fc12..75d41b882 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -12,6 +12,21 @@ * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be) */ +//usage:#define fbset_trivial_usage +//usage: "[OPTIONS] [MODE]" +//usage:#define fbset_full_usage "\n\n" +//usage: "Show and modify frame buffer settings" +//usage: +//usage:#define fbset_example_usage +//usage: "$ fbset\n" +//usage: "mode \"1024x768-76\"\n" +//usage: " # D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz\n" +//usage: " geometry 1024 768 1024 768 16\n" +//usage: " timings 12714 128 32 16 4 128 4\n" +//usage: " accel false\n" +//usage: " rgba 5/11,6/5,5/0,0/0\n" +//usage: "endmode\n" + #include "libbb.h" #define DEFAULTFBDEV FB_0 diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index 57e9c26f8..bf7098e71 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c @@ -5,6 +5,13 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define fdformat_trivial_usage +//usage: "[-n] DEVICE" +//usage:#define fdformat_full_usage "\n\n" +//usage: "Format floppy disk\n" +//usage: "\nOptions:" +//usage: "\n -n Don't verify after format" + #include "libbb.h" diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 0b93c22cc..da03e683e 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -7,6 +7,28 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +/* Looks like someone forgot to add this to config system */ +//usage:#ifndef ENABLE_FEATURE_FDISK_BLKSIZE +//usage:# define ENABLE_FEATURE_FDISK_BLKSIZE 0 +//usage:# define IF_FEATURE_FDISK_BLKSIZE(a) +//usage:#endif +//usage: +//usage:#define fdisk_trivial_usage +//usage: "[-ul" IF_FEATURE_FDISK_BLKSIZE("s") "] " +//usage: "[-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK" +//usage:#define fdisk_full_usage "\n\n" +//usage: "Change partition table\n" +//usage: "\nOptions:" +//usage: "\n -u Start and End are in sectors (instead of cylinders)" +//usage: "\n -l Show partition table for each DISK, then exit" +//usage: IF_FEATURE_FDISK_BLKSIZE( +//usage: "\n -s Show partition sizes in kb for each DISK, then exit" +//usage: ) +//usage: "\n -b 2048 (for certain MO disks) use 2048-byte sectors" +//usage: "\n -C CYLINDERS Set number of cylinders/heads/sectors" +//usage: "\n -H HEADS" +//usage: "\n -S SECTORS" + #ifndef _LARGEFILE64_SOURCE /* For lseek64 */ # define _LARGEFILE64_SOURCE diff --git a/util-linux/findfs.c b/util-linux/findfs.c index e1ec41f1b..49e8979ac 100644 --- a/util-linux/findfs.c +++ b/util-linux/findfs.c @@ -8,6 +8,14 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define findfs_trivial_usage +//usage: "LABEL=label or UUID=uuid" +//usage:#define findfs_full_usage "\n\n" +//usage: "Find a filesystem device based on a label or UUID" +//usage: +//usage:#define findfs_example_usage +//usage: "$ findfs LABEL=MyDevice" + #include "libbb.h" #include "volume_id.h" diff --git a/util-linux/flock.c b/util-linux/flock.c index 77fe1f809..8fecb54d4 100644 --- a/util-linux/flock.c +++ b/util-linux/flock.c @@ -3,6 +3,17 @@ * * This is free software, licensed under the GNU General Public License v2. */ + +//usage:#define flock_trivial_usage +//usage: "[-sxun] FD|{FILE [-c] PROG ARGS}" +//usage:#define flock_full_usage "\n\n" +//usage: "[Un]lock file descriptor, or lock FILE, run PROG\n" +//usage: "\nOptions:" +//usage: "\n -s Shared lock" +//usage: "\n -x Exclusive lock (default)" +//usage: "\n -u Unlock FD" +//usage: "\n -n Fail rather than wait" + #include #include "libbb.h" diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index 7ad443086..a89ae1a39 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c @@ -8,6 +8,20 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define freeramdisk_trivial_usage +//usage: "DEVICE" +//usage:#define freeramdisk_full_usage "\n\n" +//usage: "Free all memory used by the specified ramdisk" +//usage: +//usage:#define freeramdisk_example_usage +//usage: "$ freeramdisk /dev/ram2\n" +//usage: +//usage:#define fdflush_trivial_usage +//usage: "DEVICE" +//usage:#define fdflush_full_usage "\n\n" +//usage: "Force floppy disk drive to detect disk change" + #include #include "libbb.h" diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index e02e05fa4..b53c97248 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c @@ -87,6 +87,19 @@ * enforced (but it's not much fun on a character device :-). */ +//usage:#define fsck_minix_trivial_usage +//usage: "[-larvsmf] BLOCKDEV" +//usage:#define fsck_minix_full_usage "\n\n" +//usage: "Check MINIX filesystem\n" +//usage: "\nOptions:" +//usage: "\n -l List all filenames" +//usage: "\n -r Perform interactive repairs" +//usage: "\n -a Perform automatic repairs" +//usage: "\n -v Verbose" +//usage: "\n -s Output superblock information" +//usage: "\n -m Show \"mode not cleared\" warnings" +//usage: "\n -f Force file system check" + #include #include "libbb.h" #include "minix.h" diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 7c498538f..10e1dc49b 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -31,6 +31,54 @@ * */ +//usage:#define getopt_trivial_usage +//usage: "[OPTIONS]" +//usage:#define getopt_full_usage "\n\n" +//usage: "Options:" +//usage: IF_LONG_OPTS( +//usage: "\n -a,--alternative Allow long options starting with single -" +//usage: "\n -l,--longoptions=longopts Long options to be recognized" +//usage: "\n -n,--name=progname The name under which errors are reported" +//usage: "\n -o,--options=optstring Short options to be recognized" +//usage: "\n -q,--quiet Disable error reporting by getopt(3)" +//usage: "\n -Q,--quiet-output No normal output" +//usage: "\n -s,--shell=shell Set shell quoting conventions" +//usage: "\n -T,--test Test for getopt(1) version" +//usage: "\n -u,--unquoted Don't quote the output" +//usage: ) +//usage: IF_NOT_LONG_OPTS( +//usage: "\n -a Allow long options starting with single -" +//usage: "\n -l longopts Long options to be recognized" +//usage: "\n -n progname The name under which errors are reported" +//usage: "\n -o optstring Short options to be recognized" +//usage: "\n -q Disable error reporting by getopt(3)" +//usage: "\n -Q No normal output" +//usage: "\n -s shell Set shell quoting conventions" +//usage: "\n -T Test for getopt(1) version" +//usage: "\n -u Don't quote the output" +//usage: ) +//usage: +//usage:#define getopt_example_usage +//usage: "$ cat getopt.test\n" +//usage: "#!/bin/sh\n" +//usage: "GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \\\n" +//usage: " -n 'example.busybox' -- \"$@\"`\n" +//usage: "if [ $? != 0 ]; then exit 1; fi\n" +//usage: "eval set -- \"$GETOPT\"\n" +//usage: "while true; do\n" +//usage: " case $1 in\n" +//usage: " -a|--a-long) echo \"Option a\"; shift;;\n" +//usage: " -b|--b-long) echo \"Option b, argument '$2'\"; shift 2;;\n" +//usage: " -c|--c-long)\n" +//usage: " case \"$2\" in\n" +//usage: " \"\") echo \"Option c, no argument\"; shift 2;;\n" +//usage: " *) echo \"Option c, argument '$2'\"; shift 2;;\n" +//usage: " esac;;\n" +//usage: " --) shift; break;;\n" +//usage: " *) echo \"Internal error!\"; exit 1;;\n" +//usage: " esac\n" +//usage: "done\n" + #include #include "libbb.h" diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index a38fe05e7..1f5d57d74 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c @@ -9,6 +9,30 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define hexdump_trivial_usage +//usage: "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..." +//usage:#define hexdump_full_usage "\n\n" +//usage: "Display FILEs (or stdin) in a user specified format\n" +//usage: "\nOptions:" +//usage: "\n -b One-byte octal display" +//usage: "\n -c One-byte character display" +//usage: "\n -C Canonical hex+ASCII, 16 bytes per line" +//usage: "\n -d Two-byte decimal display" +//usage: "\n -e FORMAT_STRING" +//usage: "\n -f FORMAT_FILE" +//usage: "\n -n LENGTH Interpret only LENGTH bytes of input" +//usage: "\n -o Two-byte octal display" +//usage: "\n -s OFFSET Skip OFFSET bytes" +//usage: "\n -v Display all input data" +//usage: "\n -x Two-byte hexadecimal display" +//usage: IF_FEATURE_HEXDUMP_REVERSE( +//usage: "\n -R Reverse of 'hexdump -Cv'") +//usage: +//usage:#define hd_trivial_usage +//usage: "FILE..." +//usage:#define hd_full_usage "\n\n" +//usage: "hd is an alias for hexdump -C" + #include "libbb.h" #include "dump.h" diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c index e597ed637..bdd019f6f 100644 --- a/util-linux/ipcrm.c +++ b/util-linux/ipcrm.c @@ -8,6 +8,16 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define ipcrm_trivial_usage +//usage: "[-MQS key] [-mqs id]" +//usage:#define ipcrm_full_usage "\n\n" +//usage: "Upper-case options MQS remove an object by shmkey value.\n" +//usage: "Lower-case options remove an object by shmid value.\n" +//usage: "\nOptions:" +//usage: "\n -mM Remove memory segment after last detach" +//usage: "\n -qQ Remove message queue" +//usage: "\n -sS Remove semaphore" + #include "libbb.h" /* X/OPEN tells us to use for semctl() */ diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index 14df65280..33035c62e 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c @@ -8,6 +8,22 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define ipcs_trivial_usage +//usage: "[[-smq] -i shmid] | [[-asmq] [-tcplu]]" +//usage:#define ipcs_full_usage "\n\n" +//usage: " -i Show specific resource" +//usage: "\nResource specification:" +//usage: "\n -m Shared memory segments" +//usage: "\n -q Message queues" +//usage: "\n -s Semaphore arrays" +//usage: "\n -a All (default)" +//usage: "\nOutput format:" +//usage: "\n -t Time" +//usage: "\n -c Creator" +//usage: "\n -p Pid" +//usage: "\n -l Limits" +//usage: "\n -u Summary" + /* X/OPEN tells us to use for semctl() */ /* X/OPEN tells us to use for msgctl() */ /* X/OPEN tells us to use for shmctl() */ diff --git a/util-linux/losetup.c b/util-linux/losetup.c index 776f784f5..7e11e292d 100644 --- a/util-linux/losetup.c +++ b/util-linux/losetup.c @@ -7,6 +7,24 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define losetup_trivial_usage +//usage: "[-o OFS] LOOPDEV FILE - associate loop devices\n" +//usage: " losetup -d LOOPDEV - disassociate\n" +//usage: " losetup [-f] - show" +//usage:#define losetup_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -o OFS Start OFS bytes into FILE" +//usage: "\n -f Show first free loop device" +//usage: +//usage:#define losetup_notes_usage +//usage: "No arguments will display all current associations.\n" +//usage: "One argument (losetup /dev/loop1) will display the current association\n" +//usage: "(if any), or disassociate it (with -d). The display shows the offset\n" +//usage: "and filename of the file the loop device is currently bound to.\n\n" +//usage: "Two arguments (losetup /dev/loop1 file.img) create a new association,\n" +//usage: "with an optional offset (-o 12345). Encryption is not yet supported.\n" +//usage: "losetup -f will show the first loop free loop device\n\n" + #include "libbb.h" int losetup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/util-linux/lspci.c b/util-linux/lspci.c index 46e93b04d..f59aec8a5 100644 --- a/util-linux/lspci.c +++ b/util-linux/lspci.c @@ -6,6 +6,15 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define lspci_trivial_usage +//usage: "[-mk]" +//usage:#define lspci_full_usage "\n\n" +//usage: "List all PCI devices" +//usage: "\n" +//usage: "\n -m Parseable output" +//usage: "\n -k Show driver" + #include "libbb.h" enum { diff --git a/util-linux/lsusb.c b/util-linux/lsusb.c index 6f9b54daa..540f21ec6 100644 --- a/util-linux/lsusb.c +++ b/util-linux/lsusb.c @@ -6,6 +6,10 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define lsusb_trivial_usage NOUSAGE_STR +//usage:#define lsusb_full_usage "" + #include "libbb.h" static int FAST_FUNC fileAction( diff --git a/util-linux/mdev.c b/util-linux/mdev.c index a970f91f2..2f225ac0b 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -7,6 +7,41 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define mdev_trivial_usage +//usage: "[-s]" +//usage:#define mdev_full_usage "\n\n" +//usage: " -s Scan /sys and populate /dev during system boot\n" +//usage: "\n" +//usage: "It can be run by kernel as a hotplug helper. To activate it:\n" +//usage: " echo /sbin/mdev > /proc/sys/kernel/hotplug\n" +//usage: IF_FEATURE_MDEV_CONF( +//usage: "It uses /etc/mdev.conf with lines\n" +//usage: "[-]DEVNAME UID:GID PERM" +//usage: IF_FEATURE_MDEV_RENAME(" [>|=PATH]") +//usage: IF_FEATURE_MDEV_EXEC(" [@|$|*PROG]") +//usage: ) +//usage: +//usage:#define mdev_notes_usage "" +//usage: IF_FEATURE_MDEV_CONFIG( +//usage: "The mdev config file contains lines that look like:\n" +//usage: " hd[a-z][0-9]* 0:3 660\n\n" +//usage: "That's device name (with regex match), uid:gid, and permissions.\n\n" +//usage: IF_FEATURE_MDEV_EXEC( +//usage: "Optionally, that can be followed (on the same line) by a special character\n" +//usage: "and a command line to run after creating/before deleting the corresponding\n" +//usage: "device(s). The environment variable $MDEV indicates the active device node\n" +//usage: "(which is useful if it's a regex match). For example:\n\n" +//usage: " hdc root:cdrom 660 *ln -s $MDEV cdrom\n\n" +//usage: "The special characters are @ (run after creating), $ (run before deleting),\n" +//usage: "and * (run both after creating and before deleting). The commands run in\n" +//usage: "the /dev directory, and use system() which calls /bin/sh.\n\n" +//usage: ) +//usage: "Config file parsing stops on the first matching line. If no config\n" +//usage: "entry is matched, devices are created with default 0:0 660. (Make\n" +//usage: "the last line match .* to override this.)\n\n" +//usage: ) + #include "libbb.h" #include "xregex.h" diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c index 871ec835e..f6ccc9c9e 100644 --- a/util-linux/mkfs_ext2.c +++ b/util-linux/mkfs_ext2.c @@ -7,6 +7,45 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define mkfs_ext2_trivial_usage +//usage: "[-Fn] " +/* //usage: "[-c|-l filename] " */ +//usage: "[-b BLK_SIZE] " +/* //usage: "[-f fragment-size] [-g blocks-per-group] " */ +//usage: "[-i INODE_RATIO] [-I INODE_SIZE] " +/* //usage: "[-j] [-J journal-options] [-N number-of-inodes] " */ +//usage: "[-m RESERVED_PERCENT] " +/* //usage: "[-o creator-os] [-O feature[,...]] [-q] " */ +/* //usage: "[r fs-revision-level] [-E extended-options] [-v] [-F] " */ +//usage: "[-L LABEL] " +/* //usage: "[-M last-mounted-directory] [-S] [-T filesystem-type] " */ +//usage: "BLOCKDEV [KBYTES]" +//usage:#define mkfs_ext2_full_usage "\n\n" +//usage: " -b BLK_SIZE Block size, bytes" +/* //usage: "\n -c Check device for bad blocks" */ +/* //usage: "\n -E opts Set extended options" */ +/* //usage: "\n -f size Fragment size in bytes" */ +//usage: "\n -F Force" +/* //usage: "\n -g N Number of blocks in a block group" */ +//usage: "\n -i RATIO Max number of files is filesystem_size / RATIO" +//usage: "\n -I BYTES Inode size (min 128)" +/* //usage: "\n -j Create a journal (ext3)" */ +/* //usage: "\n -J opts Set journal options (size/device)" */ +/* //usage: "\n -l file Read bad blocks list from file" */ +//usage: "\n -L LBL Volume label" +//usage: "\n -m PERCENT Percent of blocks to reserve for admin" +/* //usage: "\n -M dir Set last mounted directory" */ +//usage: "\n -n Dry run" +/* //usage: "\n -N N Number of inodes to create" */ +/* //usage: "\n -o os Set the 'creator os' field" */ +/* //usage: "\n -O features Dir_index/filetype/has_journal/journal_dev/sparse_super" */ +/* //usage: "\n -q Quiet" */ +/* //usage: "\n -r rev Set filesystem revision" */ +/* //usage: "\n -S Write superblock and group descriptors only" */ +/* //usage: "\n -T fs-type Set usage type (news/largefile/largefile4)" */ +/* //usage: "\n -v Verbose" */ + #include "libbb.h" #include #include diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 95499ba17..a8bc4b80d 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c @@ -63,6 +63,17 @@ * removed getopt based parser and added a hand rolled one. */ +//usage:#define mkfs_minix_trivial_usage +//usage: "[-c | -l FILE] [-nXX] [-iXX] BLOCKDEV [KBYTES]" +//usage:#define mkfs_minix_full_usage "\n\n" +//usage: "Make a MINIX filesystem\n" +//usage: "\nOptions:" +//usage: "\n -c Check device for bad blocks" +//usage: "\n -n [14|30] Maximum length of filenames" +//usage: "\n -i INODES Number of inodes for the filesystem" +//usage: "\n -l FILE Read bad blocks list from FILE" +//usage: "\n -v Make version 2 filesystem" + #include "libbb.h" #include diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c index 00ce8f1d1..463ae1e2a 100644 --- a/util-linux/mkfs_reiser.c +++ b/util-linux/mkfs_reiser.c @@ -6,6 +6,15 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define mkfs_reiser_trivial_usage +//usage: "[-f] [-l LABEL] BLOCKDEV [4K-BLOCKS]" +//usage:#define mkfs_reiser_full_usage "\n\n" +//usage: "Make a ReiserFS V3 filesystem\n" +//usage: "\nOptions:" +//usage: "\n -f Force" +//usage: "\n -l LBL Volume label" + #include "libbb.h" #include diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c index bb5b59c66..e83ae7510 100644 --- a/util-linux/mkfs_vfat.c +++ b/util-linux/mkfs_vfat.c @@ -7,6 +7,23 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define mkfs_vfat_trivial_usage +//usage: "[-v] [-n LABEL] BLOCKDEV [KBYTES]" +/* Accepted but ignored: + "[-c] [-C] [-I] [-l bad-block-file] [-b backup-boot-sector] " + "[-m boot-msg-file] [-i volume-id] " + "[-s sectors-per-cluster] [-S logical-sector-size] [-f number-of-FATs] " + "[-h hidden-sectors] [-F fat-size] [-r root-dir-entries] [-R reserved-sectors] " +*/ +//usage:#define mkfs_vfat_full_usage "\n\n" +//usage: "Make a FAT32 filesystem\n" +//usage: "\nOptions:" +/* //usage: "\n -c Check device for bad blocks" */ +//usage: "\n -v Verbose" +/* //usage: "\n -I Allow to use entire disk device (e.g. /dev/hda)" */ +//usage: "\n -n LBL Volume label" + #include "libbb.h" #include /* HDIO_GETGEO */ diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 2e9662b2b..ef6932c6c 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -5,6 +5,14 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define mkswap_trivial_usage +//usage: "[-L LBL] BLOCKDEV [KBYTES]" +//usage:#define mkswap_full_usage "\n\n" +//usage: "Prepare BLOCKDEV to be used as swap partition\n" +//usage: "\nOptions:" +//usage: "\n -L LBL Label" + #include "libbb.h" #if ENABLE_SELINUX diff --git a/util-linux/more.c b/util-linux/more.c index 7160b8b00..efceb71ec 100644 --- a/util-linux/more.c +++ b/util-linux/more.c @@ -14,6 +14,14 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define more_trivial_usage +//usage: "[FILE]..." +//usage:#define more_full_usage "\n\n" +//usage: "View FILE (or stdin) one screenful at a time" +//usage: +//usage:#define more_example_usage +//usage: "$ dmesg | more\n" + #include "libbb.h" /* Support for FEATURE_USE_TERMIOS */ diff --git a/util-linux/mount.c b/util-linux/mount.c index 722d0be92..3e2ba1fab 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -16,6 +16,66 @@ // singlemount() can loop through /etc/filesystems for fstype detection. // mount_it_now() does the actual mount. // + +//usage:#define mount_trivial_usage +//usage: "[OPTIONS] [-o OPTS] DEVICE NODE" +//usage:#define mount_full_usage "\n\n" +//usage: "Mount a filesystem. Filesystem autodetection requires /proc.\n" +//usage: "\nOptions:" +//usage: "\n -a Mount all filesystems in fstab" +//usage: IF_FEATURE_MOUNT_FAKE( +//usage: IF_FEATURE_MTAB_SUPPORT( +//usage: "\n -f Update /etc/mtab, but don't mount" +//usage: ) +//usage: IF_NOT_FEATURE_MTAB_SUPPORT( +//usage: "\n -f Dry run" +//usage: ) +//usage: ) +//usage: IF_FEATURE_MOUNT_HELPERS( +//usage: "\n -i Don't run mount helper" +//usage: ) +//usage: IF_FEATURE_MTAB_SUPPORT( +//usage: "\n -n Don't update /etc/mtab" +//usage: ) +//usage: "\n -r Read-only mount" +//usage: "\n -w Read-write mount (default)" +//usage: "\n -t FSTYPE Filesystem type" +//usage: "\n -O OPT Mount only filesystems with option OPT (-a only)" +//usage: "\n-o OPT:" +//usage: IF_FEATURE_MOUNT_LOOP( +//usage: "\n loop Ignored (loop devices are autodetected)" +//usage: ) +//usage: IF_FEATURE_MOUNT_FLAGS( +//usage: "\n [a]sync Writes are [a]synchronous" +//usage: "\n [no]atime Disable/enable updates to inode access times" +//usage: "\n [no]diratime Disable/enable atime updates to directories" +//usage: "\n [no]relatime Disable/enable atime updates relative to modification time" +//usage: "\n [no]dev (Dis)allow use of special device files" +//usage: "\n [no]exec (Dis)allow use of executable files" +//usage: "\n [no]suid (Dis)allow set-user-id-root programs" +//usage: "\n [r]shared Convert [recursively] to a shared subtree" +//usage: "\n [r]slave Convert [recursively] to a slave subtree" +//usage: "\n [r]private Convert [recursively] to a private subtree" +//usage: "\n [un]bindable Make mount point [un]able to be bind mounted" +//usage: "\n [r]bind Bind a file or directory [recursively] to another location" +//usage: "\n move Relocate an existing mount point" +//usage: ) +//usage: "\n remount Remount a mounted filesystem, changing flags" +//usage: "\n ro/rw Same as -r/-w" +//usage: "\n" +//usage: "\nThere are filesystem-specific -o flags." +//usage: +//usage:#define mount_example_usage +//usage: "$ mount\n" +//usage: "/dev/hda3 on / type minix (rw)\n" +//usage: "proc on /proc type proc (rw)\n" +//usage: "devpts on /dev/pts type devpts (rw)\n" +//usage: "$ mount /dev/fd0 /mnt -t msdos -o ro\n" +//usage: "$ mount /tmp/diskimage /opt -t ext2 -o loop\n" +//usage: "$ mount cd_image.iso mydir\n" +//usage:#define mount_notes_usage +//usage: "Returns 0 for success, number of failed mounts for -a, or errno for one mount." + #include #include #include diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c index ac52a7aed..83f01fabd 100644 --- a/util-linux/pivot_root.c +++ b/util-linux/pivot_root.c @@ -8,6 +8,13 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define pivot_root_trivial_usage +//usage: "NEW_ROOT PUT_OLD" +//usage:#define pivot_root_full_usage "\n\n" +//usage: "Move the current root file system to PUT_OLD and make NEW_ROOT\n" +//usage: "the new root file system" + #include "libbb.h" extern int pivot_root(const char * new_root,const char * put_old); diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 2c3de74bc..628df0da7 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c @@ -8,6 +8,14 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define rdate_trivial_usage +//usage: "[-sp] HOST" +//usage:#define rdate_full_usage "\n\n" +//usage: "Get and possibly set the system date and time from a remote HOST\n" +//usage: "\nOptions:" +//usage: "\n -s Set the system date and time (default)" +//usage: "\n -p Print the date and time" + #include "libbb.h" enum { RFC_868_BIAS = 2208988800UL }; diff --git a/util-linux/rdev.c b/util-linux/rdev.c index 2fbb4d377..1212f841e 100644 --- a/util-linux/rdev.c +++ b/util-linux/rdev.c @@ -9,6 +9,15 @@ * */ +//usage:#define rdev_trivial_usage +//usage: "" +//usage:#define rdev_full_usage "\n\n" +//usage: "Print the device node associated with the filesystem mounted at '/'" +//usage: +//usage:#define rdev_example_usage +//usage: "$ rdev\n" +//usage: "/dev/mtdblock9 /\n" + #include "libbb.h" int rdev_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index f8a6e0cd0..7b7aa7c9f 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c @@ -32,6 +32,21 @@ * Paul Mundt . */ +//usage:#define readprofile_trivial_usage +//usage: "[OPTIONS]" +//usage:#define readprofile_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -m mapfile (Default: /boot/System.map)" +//usage: "\n -p profile (Default: /proc/profile)" +//usage: "\n -M NUM Set the profiling multiplier to NUM" +//usage: "\n -i Print only info about the sampling step" +//usage: "\n -v Verbose" +//usage: "\n -a Print all symbols, even if count is 0" +//usage: "\n -b Print individual histogram-bin counts" +//usage: "\n -s Print individual counters within functions" +//usage: "\n -r Reset all the counters (root only)" +//usage: "\n -n Disable byte order auto-detection" + #include "libbb.h" #include diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c index 06ed7eafc..735a29822 100644 --- a/util-linux/rtcwake.c +++ b/util-linux/rtcwake.c @@ -23,6 +23,29 @@ * That flag should not be needed on systems with adjtime support. */ +//usage:#define rtcwake_trivial_usage +//usage: "[-a | -l | -u] [-d DEV] [-m MODE] [-s SEC | -t TIME]" +//usage:#define rtcwake_full_usage "\n\n" +//usage: "Enter a system sleep state until specified wakeup time\n" +//usage: IF_LONG_OPTS( +//usage: "\n -a,--auto Read clock mode from adjtime" +//usage: "\n -l,--local Clock is set to local time" +//usage: "\n -u,--utc Clock is set to UTC time" +//usage: "\n -d,--device=DEV Specify the RTC device" +//usage: "\n -m,--mode=MODE Set the sleep state (default: standby)" +//usage: "\n -s,--seconds=SEC Set the timeout in SEC seconds from now" +//usage: "\n -t,--time=TIME Set the timeout to TIME seconds from epoch" +//usage: ) +//usage: IF_NOT_LONG_OPTS( +//usage: "\n -a Read clock mode from adjtime" +//usage: "\n -l Clock is set to local time" +//usage: "\n -u Clock is set to UTC time" +//usage: "\n -d DEV Specify the RTC device" +//usage: "\n -m MODE Set the sleep state (default: standby)" +//usage: "\n -s SEC Set the timeout in SEC seconds from now" +//usage: "\n -t TIME Set the timeout to TIME seconds from epoch" +//usage: ) + #include "libbb.h" #include "rtc_.h" diff --git a/util-linux/script.c b/util-linux/script.c index 47efc4526..26f16ebf5 100644 --- a/util-linux/script.c +++ b/util-linux/script.c @@ -10,6 +10,19 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define script_trivial_usage +//usage: "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]" +//usage:#define script_full_usage "\n\n" +//usage: "Options:" +//usage: "\n -a Append output" +//usage: "\n -c PROG Run PROG, not shell" +//usage: "\n -f Flush output after each write" +//usage: "\n -q Quiet" +//usage: IF_SCRIPTREPLAY( +//usage: "\n -t Send timing to stderr" +//usage: ) + #include "libbb.h" int script_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/util-linux/scriptreplay.c b/util-linux/scriptreplay.c index 6eaba43fa..382f56d9a 100644 --- a/util-linux/scriptreplay.c +++ b/util-linux/scriptreplay.c @@ -7,6 +7,12 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. * */ + +//usage:#define scriptreplay_trivial_usage +//usage: "timingfile [typescript [divisor]]" +//usage:#define scriptreplay_full_usage "\n\n" +//usage: "Play back typescripts, using timing information" + #include "libbb.h" int scriptreplay_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/util-linux/setarch.c b/util-linux/setarch.c index 7d5dc247c..7b9421af1 100644 --- a/util-linux/setarch.c +++ b/util-linux/setarch.c @@ -5,7 +5,20 @@ * Copyright 2002 Andi Kleen, SuSE Labs. * * Licensed under GPLv2 or later, see file LICENSE in this source tree. -*/ + */ + +//usage:#define setarch_trivial_usage +//usage: "personality PROG ARGS" +//usage:#define setarch_full_usage "\n\n" +//usage: "Personality may be:\n" +//usage: " linux32 Set 32bit uname emulation\n" +//usage: " linux64 Set 64bit uname emulation" +//usage: +//usage:#define linux32_trivial_usage NOUSAGE_STR +//usage:#define linux32_full_usage "" +//usage: +//usage:#define linux64_trivial_usage NOUSAGE_STR +//usage:#define linux64_full_usage "" #include diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index e2c060f30..b7cf69833 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -7,6 +7,23 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define swapon_trivial_usage +//usage: "[-a]" IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]" +//usage:#define swapon_full_usage "\n\n" +//usage: "Start swapping on DEVICE\n" +//usage: "\nOptions:" +//usage: "\n -a Start swapping on all swap devices" +//usage: IF_FEATURE_SWAPON_PRI( +//usage: "\n -p PRI Set swap device priority" +//usage: ) +//usage: +//usage:#define swapoff_trivial_usage +//usage: "[-a] [DEVICE]" +//usage:#define swapoff_full_usage "\n\n" +//usage: "Stop swapping on DEVICE\n" +//usage: "\nOptions:" +//usage: "\n -a Stop swapping on all swap devices" + #include "libbb.h" #include #include diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c index d471437fd..7794de18d 100644 --- a/util-linux/switch_root.c +++ b/util-linux/switch_root.c @@ -5,6 +5,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define switch_root_trivial_usage +//usage: "[-c /dev/console] NEW_ROOT NEW_INIT [ARGS]" +//usage:#define switch_root_full_usage "\n\n" +//usage: "Free initramfs and switch to another root fs:\n" +//usage: "chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /,\n" +//usage: "execute NEW_INIT. PID must be 1. NEW_ROOT must be a mountpoint.\n" +//usage: "\nOptions:" +//usage: "\n -c DEV Reopen stdio to DEV after switch" + #include #include #include "libbb.h" diff --git a/util-linux/umount.c b/util-linux/umount.c index 5597d9eba..1e576ca4e 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -7,6 +7,28 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define umount_trivial_usage +//usage: "[OPTIONS] FILESYSTEM|DIRECTORY" +//usage:#define umount_full_usage "\n\n" +//usage: "Unmount file systems\n" +//usage: "\nOptions:" +//usage: IF_FEATURE_UMOUNT_ALL( +//usage: "\n -a Unmount all file systems" IF_FEATURE_MTAB_SUPPORT(" in /etc/mtab") +//usage: ) +//usage: IF_FEATURE_MTAB_SUPPORT( +//usage: "\n -n Don't erase /etc/mtab entries" +//usage: ) +//usage: "\n -r Try to remount devices as read-only if mount is busy" +//usage: "\n -l Lazy umount (detach filesystem)" +//usage: "\n -f Force umount (i.e., unreachable NFS server)" +//usage: IF_FEATURE_MOUNT_LOOP( +//usage: "\n -d Free loop device if it has been used" +//usage: ) +//usage: +//usage:#define umount_example_usage +//usage: "$ umount /dev/hdc1\n" + #include #include #include "libbb.h" -- cgit v1.2.3-55-g6feb From 6161cdbb83bc35c20cf582bfce203f3e0632fbda Mon Sep 17 00:00:00 2001 From: Pascal Bellard Date: Mon, 11 Apr 2011 03:52:53 +0200 Subject: conspy: fix ESC key lost Signed-off-by: Pascal Bellard Signed-off-by: Denys Vlasenko --- miscutils/conspy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/miscutils/conspy.c b/miscutils/conspy.c index 9c5405332..90ef91c5c 100644 --- a/miscutils/conspy.c +++ b/miscutils/conspy.c @@ -504,16 +504,17 @@ int conspy_main(int argc UNUSED_PARAM, char **argv) } } poll_timeout_ms = 250; + if (option_mask32 & FLAG(v)) continue; // Insert all keys pressed into the virtual console's input // buffer. Don't do this if the virtual console is in scan // code mode - giving ASCII characters to a program expecting // scan codes will confuse it. - if (!(option_mask32 & FLAG(v)) && G.escape_count == 0) { + G.key_count += bytes_read; + if (G.escape_count == 0) { int handle, result; long kbd_mode; - G.key_count += bytes_read; handle = xopen(tty_name, O_WRONLY); result = ioctl(handle, KDGKBMODE, &kbd_mode); if (result >= 0) { -- cgit v1.2.3-55-g6feb From c13ee8c0f32fa816e12f1ac0c55a800066dc1560 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 11 Apr 2011 03:58:30 +0200 Subject: basename,dirname,freeramdisk,rx,raidautorun,runsv,chvt: skip "--" argument Signed-off-by: Denys Vlasenko --- coreutils/basename.c | 5 +++++ libbb/single_argv.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/coreutils/basename.c b/coreutils/basename.c index 177e023cd..1f7a13713 100644 --- a/coreutils/basename.c +++ b/coreutils/basename.c @@ -51,6 +51,11 @@ int basename_main(int argc, char **argv) size_t m, n; char *s; + if (argv[1] && strcmp(argv[1], "--") == 0) { + argv++; + argc--; + } + if ((unsigned)(argc-2) >= 2) { bb_show_usage(); } diff --git a/libbb/single_argv.c b/libbb/single_argv.c index 85137b40f..64844ddf8 100644 --- a/libbb/single_argv.c +++ b/libbb/single_argv.c @@ -10,6 +10,8 @@ char* FAST_FUNC single_argv(char **argv) { + if (argv[1] && strcmp(argv[1], "--") == 0) + argv++; if (!argv[1] || argv[2]) bb_show_usage(); return argv[1]; -- cgit v1.2.3-55-g6feb From 24ec952f1403759af280661b83471b28f1158553 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 11 Apr 2011 04:29:39 +0200 Subject: tftp: fix progress bar for large (>32M) files. Closes 3499 Signed-off-by: Denys Vlasenko --- networking/tftp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/networking/tftp.c b/networking/tftp.c index f52e49d51..e50d9254b 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -455,6 +455,7 @@ static int tftp_protocol( finished = 1; } cp += len; + IF_FEATURE_TFTP_PROGRESS_BAR(G.pos += len;) } send_pkt: /* Send packet */ @@ -476,8 +477,6 @@ static int tftp_protocol( xsendto(socket_fd, xbuf, send_len, &peer_lsa->u.sa, peer_lsa->len); #if ENABLE_FEATURE_TFTP_PROGRESS_BAR - if (ENABLE_TFTP && remote_file) /* tftp */ - G.pos = (block_nr - 1) * (uoff_t)blksize; if (is_bb_progress_inited(&G.pmt)) tftp_progress_update(); #endif @@ -621,6 +620,7 @@ static int tftp_protocol( if (sz != blksize) { finished = 1; } + IF_FEATURE_TFTP_PROGRESS_BAR(G.pos += sz;) continue; /* send ACK */ } /* Disabled to cope with servers with Sorcerer's Apprentice Syndrome */ -- cgit v1.2.3-55-g6feb From 532e961f7ec04d9490e11c16a9efac8aed4f0585 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 11 Apr 2011 05:12:53 +0200 Subject: tftpd: add -l "log to syslog" option. Needed for inetd mode Signed-off-by: Denys Vlasenko --- networking/tftp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/networking/tftp.c b/networking/tftp.c index e50d9254b..9080c442f 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -43,13 +43,14 @@ //usage: "\n" //usage: "tftpd should be used as an inetd service.\n" //usage: "tftpd's line for inetd.conf:\n" -//usage: " 69 dgram udp nowait root tftpd tftpd /files/to/serve\n" +//usage: " 69 dgram udp nowait root tftpd tftpd -l /files/to/serve\n" //usage: "It also can be ran from udpsvd:\n" //usage: " udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve\n" //usage: "\nOptions:" //usage: "\n -r Prohibit upload" //usage: "\n -c Allow file creation via upload" //usage: "\n -u Access files as USER" +//usage: "\n -l Log to syslog (inetd mode requires this)" #include "libbb.h" @@ -92,6 +93,7 @@ enum { TFTPD_OPT_r = (1 << 8) * ENABLE_TFTPD, TFTPD_OPT_c = (1 << 9) * ENABLE_TFTPD, TFTPD_OPT_u = (1 << 10) * ENABLE_TFTPD, + TFTPD_OPT_l = (1 << 11) * ENABLE_TFTPD, }; #if ENABLE_FEATURE_TFTP_GET && !ENABLE_FEATURE_TFTP_PUT @@ -782,8 +784,12 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv) peer_lsa->len = our_lsa->len; /* Shifting to not collide with TFTP_OPTs */ - opt = option_mask32 = TFTPD_OPT | (getopt32(argv, "rcu:", &user_opt) << 8); + opt = option_mask32 = TFTPD_OPT | (getopt32(argv, "rcu:l", &user_opt) << 8); argv += optind; + if (opt & TFTPD_OPT_l) { + openlog(applet_name, LOG_PID, LOG_DAEMON); + logmode = LOGMODE_SYSLOG; + } if (argv[0]) xchdir(argv[0]); -- cgit v1.2.3-55-g6feb From 88d3cfdb75b6da83f3552daceed803f0a29d0c9c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 11 Apr 2011 05:24:58 +0200 Subject: add forgotten #include Signed-off-by: Denys Vlasenko --- networking/tftp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/networking/tftp.c b/networking/tftp.c index 9080c442f..648441016 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -53,6 +53,7 @@ //usage: "\n -l Log to syslog (inetd mode requires this)" #include "libbb.h" +#include #if ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT -- cgit v1.2.3-55-g6feb From b0b8884009f9844e75d10f9e5d4ac16ef6b36170 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Sat, 16 Apr 2011 17:33:43 +0200 Subject: Fix double words in comments. No code changes Signed-off-by: Marek Polacek Signed-off-by: Denys Vlasenko --- archival/ar.c | 2 +- archival/gzip.c | 4 ++-- e2fsprogs/old_e2fsprogs/e2fsck.c | 2 +- e2fsprogs/old_e2fsprogs/e2fsck.h | 2 +- e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c | 2 +- editors/ed.c | 2 +- libbb/appletlib.c | 2 +- scripts/basic/docproc.c | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/archival/ar.c b/archival/ar.c index f5a379fb8..e7973af94 100644 --- a/archival/ar.c +++ b/archival/ar.c @@ -82,7 +82,7 @@ static void output_ar_header(archive_handle_t *handle) } /* - * when replacing files in an existing archive, copy from the the + * when replacing files in an existing archive, copy from the * original archive those files that are to be left intact */ static void FAST_FUNC copy_data(archive_handle_t *handle) diff --git a/archival/gzip.c b/archival/gzip.c index 7686e1adb..a9b216afe 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -1674,7 +1674,7 @@ static ulg flush_block(char *buf, ulg stored_len, int eof) /* =========================================================================== * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * IN assertion: all calls to UPDATE_HASH are made with consecutive * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ @@ -1705,7 +1705,7 @@ static ulg flush_block(char *buf, ulg stored_len, int eof) /* Insert string s in the dictionary and set match_head to the previous head * of the hash chain (the most recent string with same hash key). Return * the previous length of the hash chain. - * IN assertion: all calls to to INSERT_STRING are made with consecutive + * IN assertion: all calls to INSERT_STRING are made with consecutive * input characters and the first MIN_MATCH bytes of s are valid * (except for the last MIN_MATCH-1 bytes of the input file). */ #define INSERT_STRING(s, match_head) \ diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c index 1f990b303..ad4ff348b 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.c +++ b/e2fsprogs/old_e2fsprogs/e2fsck.c @@ -582,7 +582,7 @@ static dnode_t *dict_first(dict_t *dict) /* * Return the given node's successor node---the node which has the - * next key in the the left to right ordering. If the node has + * next key in the left to right ordering. If the node has * no successor, a null pointer is returned rather than a pointer to * the nil node. */ diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.h b/e2fsprogs/old_e2fsprogs/e2fsck.h index 330209d69..c159fabab 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.h +++ b/e2fsprogs/old_e2fsprogs/e2fsck.h @@ -258,7 +258,7 @@ The following defines are used in the 'flags' field of a dx_dirblock_info #define PR_1_SET_IMAGIC 0x01002F /* Imagic flag set on an inode when filesystem doesn't support it */ #define PR_1_SET_IMMUTABLE 0x010030 /* Immutable flag set on a device or socket inode */ #define PR_1_COMPR_SET 0x010031 /* Compression flag set on a non-compressed filesystem */ -#define PR_1_SET_NONZSIZE 0x010032 /* Non-zero size on on device, fifo or socket inode */ +#define PR_1_SET_NONZSIZE 0x010032 /* Non-zero size on device, fifo or socket inode */ #define PR_1_FS_REV_LEVEL 0x010033 /* Filesystem revision is 0, but feature flags are set */ #define PR_1_JOURNAL_INODE_NOT_CLEAR 0x010034 /* Journal inode not in use, needs clearing */ #define PR_1_JOURNAL_BAD_MODE 0x010035 /* Journal inode has wrong mode */ diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c b/e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c index a3bbad851..2bb1cc25e 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c @@ -15,7 +15,7 @@ * string, placing the result in . is the containing * directory inode, and is the inode number itself. If * is zero, then ext2fs_get_pathname will return pathname - * of the the directory . + * of the directory . * */ diff --git a/editors/ed.c b/editors/ed.c index 41ac88c32..dbb51306c 100644 --- a/editors/ed.c +++ b/editors/ed.c @@ -454,7 +454,7 @@ static void subCommand(const char *cmd, int num1, int num2) /* * The new string is larger, so allocate a new line - * structure and use that. Link it in in place of + * structure and use that. Link it in place of * the old line structure. */ nlp = xmalloc(sizeof(LINE) + lp->len + deltaLen); diff --git a/libbb/appletlib.c b/libbb/appletlib.c index fc84d36ec..705829cb0 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -442,7 +442,7 @@ static void parse_config_file(void) sct->m_mode |= mode_mask[(q - mode_chars) - i]; } - /* Now get the the user/group info. */ + /* Now get the user/group info. */ s = skip_whitespace(e); diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index db30019d8..0984e7d4b 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c @@ -212,7 +212,7 @@ void find_export_symbols(char * filename) * Document all external or internal functions in a file. * Call kernel-doc with following parameters: * kernel-doc -docbook -nofunction function_name1 filename - * function names are obtained from all the the src files + * function names are obtained from all the src files * by find_export_symbols. * intfunc uses -nofunction * extfunc uses -function -- cgit v1.2.3-55-g6feb From c3dadba699264c39bf6183505a09e9b28c636481 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 16 Apr 2011 17:59:34 +0200 Subject: gen_build_files.sh: do not use "sed --" for now Signed-off-by: Denys Vlasenko --- scripts/gen_build_files.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh index 03831f501..e518a9008 100755 --- a/scripts/gen_build_files.sh +++ b/scripts/gen_build_files.sh @@ -1,5 +1,9 @@ #!/bin/sh +# Note: was using sed OPTS CMD -- FILES +# but users complain that many sed implementations +# are misinterpreting --. + test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; } # cd to objtree @@ -43,7 +47,7 @@ generate() } # (Re)generate include/applets.h -s=`sed -n 's@^//applet:@@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c` +s=`sed -n 's@^//applet:@@p' "$srctree"/*/*.c "$srctree"/*/*/*.c` generate \ "$srctree/include/applets.src.h" \ "include/applets.h" \ @@ -55,7 +59,7 @@ generate \ # and insert empty line before each line which doesn't start # with space or tab # (note: we need to use \\\\ because of ``) -s=`sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\\\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\\\@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c` +s=`sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\\\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\\\@p' "$srctree"/*/*.c "$srctree"/*/*/*.c` generate \ "$srctree/include/usage.src.h" \ "include/usage.h" \ @@ -71,7 +75,7 @@ generate \ if test -f "$src"; then mkdir -p -- "$d" 2>/dev/null - s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c` + s=`sed -n 's@^//kbuild:@@p' "$srctree/$d"/*.c` generate \ "${src}" "${dst}" \ "# DO NOT EDIT. This file is generated from Kbuild.src" \ @@ -83,7 +87,7 @@ generate \ if test -f "$src"; then mkdir -p -- "$d" 2>/dev/null - s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c` + s=`sed -n 's@^//config:@@p' "$srctree/$d"/*.c` generate \ "${src}" "${dst}" \ "# DO NOT EDIT. This file is generated from Config.src" \ -- cgit v1.2.3-55-g6feb From 8c498b6c6e6fd0c218a1ea17d20ec399a5e7501d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 16 Apr 2011 18:07:35 +0200 Subject: make FDISK_SUPPORT_LARGE_DISKS redundant when LFS=y Signed-off-by: Denys Vlasenko --- Config.in | 1 - util-linux/Config.src | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Config.in b/Config.in index 94414db04..d4e14a488 100644 --- a/Config.in +++ b/Config.in @@ -566,7 +566,6 @@ config FEATURE_SHARED_BUSYBOX config LFS bool "Build with Large File Support (for accessing files > 2 GB)" default y - select FDISK_SUPPORT_LARGE_DISKS help If you want to build BusyBox with large file support, then enable this option. This will have no effect if your kernel or your C diff --git a/util-linux/Config.src b/util-linux/Config.src index 90606bcae..bb45705a9 100644 --- a/util-linux/Config.src +++ b/util-linux/Config.src @@ -144,6 +144,7 @@ config FDISK_SUPPORT_LARGE_DISKS bool "Support over 4GB disks" default y depends on FDISK + depends on !LFS # with LFS no special code is needed help Enable this option to support large disks > 4GB. -- cgit v1.2.3-55-g6feb From 2514302658d4c9655965f90d560b58e6dc92856b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 16 Apr 2011 18:31:53 +0200 Subject: Use net/ethernet.h instead of linux/if_ether.h in more cases. Closes 3619 Signed-off-by: Denys Vlasenko --- networking/interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/networking/interface.c b/networking/interface.c index 83af62b7c..bea54c180 100644 --- a/networking/interface.c +++ b/networking/interface.c @@ -32,7 +32,7 @@ */ #include #include -#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) +#ifndef __UCLIBC__ # include #else # include -- cgit v1.2.3-55-g6feb From 88a838438819f7a5224a2ab3ea99219f9a666bf4 Mon Sep 17 00:00:00 2001 From: Alexey Fomenko Date: Sat, 16 Apr 2011 18:49:39 +0200 Subject: md5/sha1sum: fix small resource leak Signed-off-by: Alexey Fomenko Signed-off-by: Denys Vlasenko --- coreutils/md5_sha1_sum.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 09f3a0080..8270d97e2 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c @@ -107,6 +107,9 @@ static uint8_t *hash_file(const char *filename) src_fd = open_or_warn_stdin(filename); if (src_fd < 0) { + if (ENABLE_FEATURE_CLEAN_UP) { + RELEASE_CONFIG_BUFFER(in_buf); + } return NULL; } -- cgit v1.2.3-55-g6feb From 43a3d50e14902e746ee53b7cfb63fe190bd5387f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 16 Apr 2011 18:56:36 +0200 Subject: md5/sha1sum: better fix for small resource leak Signed-off-by: Denys Vlasenko --- coreutils/md5_sha1_sum.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 8270d97e2..050d46701 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c @@ -100,22 +100,18 @@ static uint8_t *hash_file(const char *filename) md5_ctx_t md5; } context; uint8_t *hash_value = NULL; - RESERVE_CONFIG_UBUFFER(in_buf, 4096); void FAST_FUNC (*update)(void*, const void*, size_t); void FAST_FUNC (*final)(void*, void*); char hash_algo; src_fd = open_or_warn_stdin(filename); if (src_fd < 0) { - if (ENABLE_FEATURE_CLEAN_UP) { - RELEASE_CONFIG_BUFFER(in_buf); - } return NULL; } hash_algo = applet_name[3]; - /* figure specific hash algorithims */ + /* figure specific hash algorithms */ if (ENABLE_MD5SUM && hash_algo == HASH_MD5) { md5_begin(&context.md5); update = (void*)md5_hash; @@ -140,17 +136,18 @@ static uint8_t *hash_file(const char *filename) xfunc_die(); /* can't reach this */ } - while ((count = safe_read(src_fd, in_buf, 4096)) > 0) { - update(&context, in_buf, count); - } - - if (count == 0) { - final(&context, in_buf); - hash_value = hash_bin_to_hex(in_buf, hash_len); + { + RESERVE_CONFIG_UBUFFER(in_buf, 4096); + while ((count = safe_read(src_fd, in_buf, 4096)) > 0) { + update(&context, in_buf, count); + } + if (count == 0) { + final(&context, in_buf); + hash_value = hash_bin_to_hex(in_buf, hash_len); + } + RELEASE_CONFIG_BUFFER(in_buf); } - RELEASE_CONFIG_BUFFER(in_buf); - if (src_fd != STDIN_FILENO) { close(src_fd); } -- cgit v1.2.3-55-g6feb From d506897b4ef94a85013696d543686162293a02f1 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 16 Apr 2011 19:31:08 +0200 Subject: wget: add a note about bug 3625 Signed-off-by: Denys Vlasenko --- networking/wget.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/networking/wget.c b/networking/wget.c index 3a4be9878..df6d36358 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -661,6 +661,12 @@ static void download_one_url(const char *url) #if ENABLE_FEATURE_WGET_AUTHENTICATION if (target.user) { +//TODO: URL-decode "user:password" string before base64-encoding: +//wget http://test:my%20pass@example.com should send +// Authorization: Basic dGVzdDpteSBwYXNz +//which decodes to "test:my pass", instead of what we send now: +// Authorization: Basic dGVzdDpteSUyMHBhc3M= +//Can reuse decodeString() from httpd.c fprintf(sfp, "Proxy-Authorization: Basic %s\r\n"+6, base64enc(target.user)); } -- cgit v1.2.3-55-g6feb From e9c8bed4d3b157097e89ee2611ca731e37ce8d7d Mon Sep 17 00:00:00 2001 From: Sergey Naumov Date: Sat, 16 Apr 2011 19:36:15 +0200 Subject: syslogd: small fix to config patch Signed-off-by: Sergey Naumov Signed-off-by: Denys Vlasenko --- sysklogd/syslogd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 7ddd3e4c3..0799038e9 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -385,9 +385,15 @@ static void parse_syslogdcfg(const char *file) cur_selector = next_selector; } while (cur_selector); - /* check whether current file name was mentioned in previous rules. - * temporarily use cur_rule as iterator, but *pp_rule still points to - * currently processing rule entry. + /* check whether current file name was mentioned in previous rules or + * as global logfile (G.logFile). + */ + if (strcmp(G.logFile.path, tok[1]) == 0) { + cur_rule->file = &G.logFile; + goto found; + } + /* temporarily use cur_rule as iterator, but *pp_rule still points + * to currently processing rule entry. * NOTE: *pp_rule points to the current (and last in the list) rule. */ for (cur_rule = G.log_rules; cur_rule != *pp_rule; cur_rule = cur_rule->next) { -- cgit v1.2.3-55-g6feb From 08caf0900db680273bac419448f21fea4fe28499 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 16 Apr 2011 19:45:33 +0200 Subject: fix another nonportable grep usage in scripts Signed-off-by: Denys Vlasenko --- scripts/mkconfigs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mkconfigs b/scripts/mkconfigs index 7488d294e..db94fcc44 100755 --- a/scripts/mkconfigs +++ b/scripts/mkconfigs @@ -63,7 +63,7 @@ echo "\ */ static const char bbconfig_config_bz2[] ALIGN1 = {" -grep '^#\? \?CONFIG_' "$config" \ +grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \ | bzip2 -1 | dd bs=2 skip=1 2>/dev/null \ | od -v -t x1 \ | sed -e 's/^[^ ]*//' \ -- cgit v1.2.3-55-g6feb From 89b3cbaa97d715ac27e9558ea73a1221925f589b Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Sat, 16 Apr 2011 20:05:14 +0200 Subject: ash: clear sa_flags always Signed-off-by: Ian Wienand Signed-off-by: Denys Vlasenko --- shell/ash.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shell/ash.c b/shell/ash.c index 11ba9774a..b50e0952e 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -3491,13 +3491,18 @@ setsignal(int signo) switch (new_act) { case S_CATCH: act.sa_handler = signal_handler; - act.sa_flags = 0; /* matters only if !DFL and !IGN */ - sigfillset(&act.sa_mask); /* ditto */ break; case S_IGN: act.sa_handler = SIG_IGN; break; } + + /* flags and mask matter only if !DFL and !IGN, but we do it + * for all cases for more deterministic behavior: + */ + act.sa_flags = 0; + sigfillset(&act.sa_mask); + sigaction_set(signo, &act); *t = new_act; -- cgit v1.2.3-55-g6feb From 0288b27ad870adc437c370c262b7b41990ae0118 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 16 Apr 2011 20:15:14 +0200 Subject: small fixes atop syslog config patch Signed-off-by: Denys Vlasenko --- docs/syslog.conf.txt | 28 ++++++++++++++++++++++++++++ libbb/get_line_from_file.c | 6 +++++- sysklogd/Config.src | 2 +- sysklogd/syslogd.c | 12 +++++------- 4 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 docs/syslog.conf.txt diff --git a/docs/syslog.conf.txt b/docs/syslog.conf.txt new file mode 100644 index 000000000..6d9c4a173 --- /dev/null +++ b/docs/syslog.conf.txt @@ -0,0 +1,28 @@ +If syslogd applet compiled with FEATURE_SYSLOGD_CFG=y, then it supports restricted syslog.conf. +The config resembles rsyslog.conf in RULES part: + +LINE = DELIM [RULE | COMMENT] +COMMENT = #.* +DELIM = SPACE TAB +RULE = SELECTOR [;SELECTOR]* DELIM* ACTION DELIM* +SELECTOR = FACILITY [,FACILITY]* .[[!]=] PRIORITY +FACILITY = * | kern | user ... (see syslog.h) +PRIORITY = * | emerg | alert ... (see syslog.h) +ACTION = FILE + +"mark" facility is NOT supported. +"none" priority is supported. +In FACILITY and PRIORITY "*" stands for "any". +FILE is a regular file or tty device. + +Here is an example: + +#syslog.conf +kern,user.* /var/log/messages #all messages of kern and user facilities +kern.!err /var/log/critical #all messages of kern facility with priorities lower than err (warn, notice ...) +*.*;auth,authpriv.none /var/log/noauth #all messages except ones with auth and authpriv facilities +kern,user.*;kern.!=notice;*.err;syslog.none /var/log/OMG #some whicked rule just as an example =) +*.* /dev/null #this prevents from logging to default log file (-O FILE or /var/log/messages) + +Even in the case of match with some rule another rules will be tried too. +If there was no match with any of the rules, logging to default log file or shared memory will be performed. diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c index a0ed9193f..9be10687b 100644 --- a/libbb/get_line_from_file.c +++ b/libbb/get_line_from_file.c @@ -44,8 +44,12 @@ char* FAST_FUNC bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno idx -= 2; } } - if (end) + if (end) { *end = idx; + /* handle corner case when the file is not ended with '\n' */ + if (ch == EOF && lineno != NULL) + (*lineno)++; + } if (linebuf) { // huh, does fgets discard prior data on error like this? // I don't think so.... diff --git a/sysklogd/Config.src b/sysklogd/Config.src index b3e13d7c0..b7a494eff 100644 --- a/sysklogd/Config.src +++ b/sysklogd/Config.src @@ -57,7 +57,7 @@ config FEATURE_SYSLOGD_CFG default y depends on SYSLOGD help - Supports restricted syslogd config. + Supports restricted syslogd config. See docs/syslog.conf.txt config FEATURE_SYSLOGD_READ_BUFFER_SIZE int "Read buffer size in bytes" diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 0799038e9..b6f409f41 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -33,6 +33,8 @@ //usage: "\n -D Drop duplicates") //usage: IF_FEATURE_IPC_SYSLOG( //usage: "\n -C[size(KiB)] Log to shared mem buffer (read it using logread)") +//usage: IF_FEATURE_SYSLOGD_CFG( +//usage: "\n -f FILE Use FILE as config (default is /etc/syslog.conf)") /* NB: -Csize shouldn't have space (because size is optional) */ /* //usage: "\n -m MIN Minutes between MARK lines (default:20, 0=off)" */ //usage: @@ -284,10 +286,8 @@ static void parse_syslogdcfg(const char *file) logRule_t *cur_rule; /* unexpected trailing token? */ - if (tok[2]) { - t = tok[2]; + if (tok[2]) goto cfgerr; - } cur_rule = *pp_rule = xzalloc(sizeof(*cur_rule)); @@ -307,10 +307,8 @@ static void parse_syslogdcfg(const char *file) *next_selector++ = '\0'; t = strchr(cur_selector, '.'); - if (!t) { - t = cur_selector; + if (!t) goto cfgerr; - } *t++ = '\0'; /* separate facility from priority */ negated_prio = 0; @@ -414,7 +412,7 @@ static void parse_syslogdcfg(const char *file) return; cfgerr: - bb_error_msg_and_die("bad line %d: wrong token '%s'", parser->lineno, t); + bb_error_msg_and_die("error in '%s' at line %d", file, parser->lineno); } #endif -- cgit v1.2.3-55-g6feb From 47061b4e9b5b7e5d1f27eb7fb83f6721c94b0986 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 17 Apr 2011 23:14:19 +0200 Subject: straighten out dprintf/fdprintf mess; remove old "define lchown chown" Signed-off-by: Denys Vlasenko --- include/platform.h | 19 ++++++------------- libbb/platform.c | 6 +++--- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/include/platform.h b/include/platform.h index e390e58e2..2b57cd5a2 100644 --- a/include/platform.h +++ b/include/platform.h @@ -12,7 +12,7 @@ */ #define HAVE_CLEARENV 1 #define HAVE_FDATASYNC 1 -#define HAVE_FDPRINTF 1 +#define HAVE_DPRINTF 1 #define HAVE_MEMRCHR 1 #define HAVE_MKDTEMP 1 #define HAVE_PTSNAME_R 1 @@ -264,7 +264,7 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING; # undef HAVE_SYS_STATFS_H # undef HAVE_SIGHANDLER_T # undef HAVE_XTABS -# undef HAVE_FDPRINTF +# undef HAVE_DPRINTF #else # define HAVE_MNTENT_H 1 # define HAVE_SYS_STATFS_H 1 @@ -332,11 +332,6 @@ typedef unsigned smalluint; # define USE_FOR_MMU(...) __VA_ARGS__ #endif -/* Don't use lchown with glibc older than 2.1.x */ -#if defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1 -# define lchown chown -#endif - #if defined(__digital__) && defined(__unix__) # include @@ -366,16 +361,14 @@ typedef unsigned smalluint; #endif #include -#if (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L) || defined(__GLIBC__) -# define fdprintf dprintf -#endif +#define fdprintf dprintf #if defined(__dietlibc__) # undef HAVE_STRCHRNUL #endif #if defined(__WATCOMC__) -# undef HAVE_FDPRINTF +# undef HAVE_DPRINTF # undef HAVE_MEMRCHR # undef HAVE_MKDTEMP # undef HAVE_SETBIT @@ -396,8 +389,8 @@ typedef unsigned smalluint; * These must come after all the HAVE_* macros are defined (or not) */ -#ifndef HAVE_FDPRINTF -extern int fdprintf(int fd, const char *format, ...); +#ifndef HAVE_DPRINTF +extern int dprintf(int fd, const char *format, ...); #endif #ifndef HAVE_MEMRCHR diff --git a/libbb/platform.c b/libbb/platform.c index fe7ce1567..04b8961de 100644 --- a/libbb/platform.c +++ b/libbb/platform.c @@ -42,9 +42,9 @@ int FAST_FUNC vasprintf(char **string_ptr, const char *format, va_list p) } #endif -#ifndef HAVE_FDPRINTF -/* dprintf is now actually part of POSIX.1, but was only added in 2008 */ -int fdprintf(int fd, const char *format, ...) +#ifndef HAVE_DPRINTF +/* dprintf is now part of POSIX.1, but was only added in 2008 */ +int dprintf(int fd, const char *format, ...) { va_list p; int r; -- cgit v1.2.3-55-g6feb From cfbd31a7fb0a2e76864432823da1aa956fbdfa25 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 17 Apr 2011 23:18:15 +0200 Subject: add include Signed-off-by: Denys Vlasenko --- networking/libiproute/ll_types.c | 1 + 1 file changed, 1 insertion(+) diff --git a/networking/libiproute/ll_types.c b/networking/libiproute/ll_types.c index 38b6c0516..bb42e269e 100644 --- a/networking/libiproute/ll_types.c +++ b/networking/libiproute/ll_types.c @@ -7,6 +7,7 @@ * * Authors: Alexey Kuznetsov, */ +#include /* linux/if_arp.h needs it on some systems */ #include #include -- cgit v1.2.3-55-g6feb From b83c9704128dd106071184e4b00335a3b8486857 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 18 Apr 2011 01:19:59 +0200 Subject: build fixes for scripts/kconfig Signed-off-by: Denys Vlasenko --- scripts/kconfig/conf.c | 2 ++ scripts/kconfig/mconf.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 9befa2b54..6e097889f 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -3,6 +3,8 @@ * Released under the terms of the GNU GPL v2.0. */ +#define _XOPEN_SOURCE 700 + #include #include #include diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index d292b46cc..d3f69f8f5 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -8,6 +8,8 @@ * i18n, 2005, Arnaldo Carvalho de Melo */ +#define _XOPEN_SOURCE 700 + #include #include #include @@ -18,6 +20,7 @@ #include #include #include +#include /* for strcasecmp */ #include #include #include -- cgit v1.2.3-55-g6feb