diff options
Diffstat (limited to 'coreutils')
66 files changed, 1070 insertions, 0 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 <mntent.h> #include <sys/vfs.h> #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 <ysato@users.sourceforge.jp>: 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 <sys/sysmacros.h> // 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 <sys/resource.h> #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 "<applet> EXPRESSION ]" here (not "<applet> 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 <setjmp.h> 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 <sys/utsname.h> 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: "<encoded file snipped>\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! */ |