aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/basename.c13
-rw-r--r--coreutils/cal.c9
-rw-r--r--coreutils/cat.c9
-rw-r--r--coreutils/catv.c9
-rw-r--r--coreutils/chgrp.c23
-rw-r--r--coreutils/chmod.c23
-rw-r--r--coreutils/chown.c26
-rw-r--r--coreutils/chroot.c13
-rw-r--r--coreutils/cksum.c6
-rw-r--r--coreutils/comm.c9
-rw-r--r--coreutils/cp.c18
-rw-r--r--coreutils/cut.c18
-rw-r--r--coreutils/dd.c33
-rw-r--r--coreutils/df.c35
-rw-r--r--coreutils/dirname.c11
-rw-r--r--coreutils/dos2unix.c18
-rw-r--r--coreutils/du.c37
-rw-r--r--coreutils/echo.c21
-rw-r--r--coreutils/env.c9
-rw-r--r--coreutils/expand.c31
-rw-r--r--coreutils/expr.c35
-rw-r--r--coreutils/false.c10
-rw-r--r--coreutils/fold.c10
-rw-r--r--coreutils/fsync.c8
-rw-r--r--coreutils/head.c20
-rw-r--r--coreutils/hostid.c5
-rw-r--r--coreutils/id.c18
-rw-r--r--coreutils/install.c18
-rw-r--r--coreutils/ln.c16
-rw-r--r--coreutils/logname.c9
-rw-r--r--coreutils/md5_sha1_sum.c58
-rw-r--r--coreutils/mkdir.c19
-rw-r--r--coreutils/mkfifo.c10
-rw-r--r--coreutils/mknod.c18
-rw-r--r--coreutils/nice.c7
-rw-r--r--coreutils/nohup.c8
-rw-r--r--coreutils/od.c5
-rw-r--r--coreutils/printenv.c6
-rw-r--r--coreutils/printf.c10
-rw-r--r--coreutils/pwd.c9
-rw-r--r--coreutils/readlink.c12
-rw-r--r--coreutils/realpath.c5
-rw-r--r--coreutils/rm.c12
-rw-r--r--coreutils/rmdir.c16
-rw-r--r--coreutils/seq.c10
-rw-r--r--coreutils/sleep.c15
-rw-r--r--coreutils/sort.c48
-rw-r--r--coreutils/split.c13
-rw-r--r--coreutils/stat.c61
-rw-r--r--coreutils/stty.c11
-rw-r--r--coreutils/sum.c8
-rw-r--r--coreutils/sync.c5
-rw-r--r--coreutils/tac.c5
-rw-r--r--coreutils/tail.c25
-rw-r--r--coreutils/tee.c13
-rw-r--r--coreutils/test.c23
-rw-r--r--coreutils/tr.c13
-rw-r--r--coreutils/true.c10
-rw-r--r--coreutils/tty.c13
-rw-r--r--coreutils/uname.c17
-rw-r--r--coreutils/uniq.c18
-rw-r--r--coreutils/usleep.c9
-rw-r--r--coreutils/uudecode.c12
-rw-r--r--coreutils/uuencode.c14
-rw-r--r--coreutils/who.c7
-rw-r--r--coreutils/whoami.c5
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 @@
28//config: leaving just the filename itself. Enable this option if you wish 28//config: leaving just the filename itself. Enable this option if you wish
29//config: to enable the 'basename' utility. 29//config: to enable the 'basename' utility.
30 30
31//usage:#define basename_trivial_usage
32//usage: "FILE [SUFFIX]"
33//usage:#define basename_full_usage "\n\n"
34//usage: "Strip directory path and .SUFFIX from FILE\n"
35//usage:
36//usage:#define basename_example_usage
37//usage: "$ basename /usr/local/bin/foo\n"
38//usage: "foo\n"
39//usage: "$ basename /usr/local/bin/\n"
40//usage: "bin\n"
41//usage: "$ basename /foo/bar.txt .txt\n"
42//usage: "bar"
43
31#include "libbb.h" 44#include "libbb.h"
32 45
33/* This is a NOFORK applet. Be very careful! */ 46/* 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 @@
16 * 16 *
17 * Major size reduction... over 50% (>1.5k) on i386. 17 * Major size reduction... over 50% (>1.5k) on i386.
18 */ 18 */
19
20//usage:#define cal_trivial_usage
21//usage: "[-jy] [[MONTH] YEAR]"
22//usage:#define cal_full_usage "\n\n"
23//usage: "Display a calendar\n"
24//usage: "\nOptions:"
25//usage: "\n -j Use julian dates"
26//usage: "\n -y Display the entire year"
27
19#include "libbb.h" 28#include "libbb.h"
20#include "unicode.h" 29#include "unicode.h"
21 30
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 @@
22//config: cat is used to concatenate files and print them to the standard 22//config: cat is used to concatenate files and print them to the standard
23//config: output. Enable this option if you wish to enable the 'cat' utility. 23//config: output. Enable this option if you wish to enable the 'cat' utility.
24 24
25//usage:#define cat_trivial_usage
26//usage: "[FILE]..."
27//usage:#define cat_full_usage "\n\n"
28//usage: "Concatenate FILEs and print them to stdout"
29//usage:
30//usage:#define cat_example_usage
31//usage: "$ cat /proc/uptime\n"
32//usage: "110716.72 17.67"
33
25#include "libbb.h" 34#include "libbb.h"
26 35
27/* This is a NOFORK applet. Be very careful! */ 36/* 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 @@
10/* See "Cat -v considered harmful" at 10/* See "Cat -v considered harmful" at
11 * http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */ 11 * http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */
12 12
13//usage:#define catv_trivial_usage
14//usage: "[-etv] [FILE]..."
15//usage:#define catv_full_usage "\n\n"
16//usage: "Display nonprinting characters as ^x or M-x\n"
17//usage: "\nOptions:"
18//usage: "\n -e End each line with $"
19//usage: "\n -t Show tabs as ^I"
20//usage: "\n -v Don't use ^x or M-x escapes"
21
13#include "libbb.h" 22#include "libbb.h"
14 23
15int catv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 24int 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 @@
11/* BB_AUDIT GNU defects - unsupported long options. */ 11/* BB_AUDIT GNU defects - unsupported long options. */
12/* http://www.opengroup.org/onlinepubs/007904975/utilities/chgrp.html */ 12/* http://www.opengroup.org/onlinepubs/007904975/utilities/chgrp.html */
13 13
14//usage:#define chgrp_trivial_usage
15//usage: "[-RhLHP"IF_DESKTOP("cvf")"]... GROUP FILE..."
16//usage:#define chgrp_full_usage "\n\n"
17//usage: "Change the group membership of each FILE to GROUP\n"
18//usage: "\nOptions:"
19//usage: "\n -R Recurse"
20//usage: "\n -h Affect symlinks instead of symlink targets"
21//usage: "\n -L Traverse all symlinks to directories"
22//usage: "\n -H Traverse symlinks on command line only"
23//usage: "\n -P Don't traverse symlinks (default)"
24//usage: IF_DESKTOP(
25//usage: "\n -c List changed files"
26//usage: "\n -v Verbose"
27//usage: "\n -f Hide errors"
28//usage: )
29//usage:
30//usage:#define chgrp_example_usage
31//usage: "$ ls -l /tmp/foo\n"
32//usage: "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n"
33//usage: "$ chgrp root /tmp/foo\n"
34//usage: "$ ls -l /tmp/foo\n"
35//usage: "-r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo\n"
36
14#include "libbb.h" 37#include "libbb.h"
15 38
16/* This is a NOEXEC applet. Be very careful! */ 39/* 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 @@
14/* BB_AUDIT GNU defects - unsupported long options. */ 14/* BB_AUDIT GNU defects - unsupported long options. */
15/* http://www.opengroup.org/onlinepubs/007904975/utilities/chmod.html */ 15/* http://www.opengroup.org/onlinepubs/007904975/utilities/chmod.html */
16 16
17//usage:#define chmod_trivial_usage
18//usage: "[-R"IF_DESKTOP("cvf")"] MODE[,MODE]... FILE..."
19//usage:#define chmod_full_usage "\n\n"
20//usage: "Each MODE is one or more of the letters ugoa, one of the\n"
21//usage: "symbols +-= and one or more of the letters rwxst\n"
22//usage: "\nOptions:"
23//usage: "\n -R Recurse"
24//usage: IF_DESKTOP(
25//usage: "\n -c List changed files"
26//usage: "\n -v List all files"
27//usage: "\n -f Hide errors"
28//usage: )
29//usage:
30//usage:#define chmod_example_usage
31//usage: "$ ls -l /tmp/foo\n"
32//usage: "-rw-rw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n"
33//usage: "$ chmod u+x /tmp/foo\n"
34//usage: "$ ls -l /tmp/foo\n"
35//usage: "-rwxrw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo*\n"
36//usage: "$ chmod 444 /tmp/foo\n"
37//usage: "$ ls -l /tmp/foo\n"
38//usage: "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n"
39
17#include "libbb.h" 40#include "libbb.h"
18 41
19/* This is a NOEXEC applet. Be very careful! */ 42/* 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 @@
10/* BB_AUDIT SUSv3 defects - none? */ 10/* BB_AUDIT SUSv3 defects - none? */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */
12 12
13//usage:#define chown_trivial_usage
14//usage: "[-RhLHP"IF_DESKTOP("cvf")"]... OWNER[<.|:>[GROUP]] FILE..."
15//usage:#define chown_full_usage "\n\n"
16//usage: "Change the owner and/or group of each FILE to OWNER and/or GROUP\n"
17//usage: "\nOptions:"
18//usage: "\n -R Recurse"
19//usage: "\n -h Affect symlinks instead of symlink targets"
20//usage: "\n -L Traverse all symlinks to directories"
21//usage: "\n -H Traverse symlinks on command line only"
22//usage: "\n -P Don't traverse symlinks (default)"
23//usage: IF_DESKTOP(
24//usage: "\n -c List changed files"
25//usage: "\n -v List all files"
26//usage: "\n -f Hide errors"
27//usage: )
28//usage:
29//usage:#define chown_example_usage
30//usage: "$ ls -l /tmp/foo\n"
31//usage: "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n"
32//usage: "$ chown root /tmp/foo\n"
33//usage: "$ ls -l /tmp/foo\n"
34//usage: "-r--r--r-- 1 root andersen 0 Apr 12 18:25 /tmp/foo\n"
35//usage: "$ chown root.root /tmp/foo\n"
36//usage: "ls -l /tmp/foo\n"
37//usage: "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n"
38
13#include "libbb.h" 39#include "libbb.h"
14 40
15/* This is a NOEXEC applet. Be very careful! */ 41/* 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 @@
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11 11
12//usage:#define chroot_trivial_usage
13//usage: "NEWROOT [PROG ARGS]"
14//usage:#define chroot_full_usage "\n\n"
15//usage: "Run PROG with root directory set to NEWROOT"
16//usage:
17//usage:#define chroot_example_usage
18//usage: "$ ls -l /bin/ls\n"
19//usage: "lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /BusyBox\n"
20//usage: "# mount /dev/hdc1 /mnt -t minix\n"
21//usage: "# chroot /mnt\n"
22//usage: "# ls -l /bin/ls\n"
23//usage: "-rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls*\n"
24
12#include "libbb.h" 25#include "libbb.h"
13 26
14int chroot_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 27int 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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10//usage:#define cksum_trivial_usage
11//usage: "FILES..."
12//usage:#define cksum_full_usage "\n\n"
13//usage: "Calculate the CRC32 checksums of FILES"
14
9#include "libbb.h" 15#include "libbb.h"
10 16
11/* This is a NOEXEC applet. Be very careful! */ 17/* 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 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10//usage:#define comm_trivial_usage
11//usage: "[-123] FILE1 FILE2"
12//usage:#define comm_full_usage "\n\n"
13//usage: "Compare FILE1 with FILE2\n"
14//usage: "\nOptions:"
15//usage: "\n -1 Suppress lines unique to FILE1"
16//usage: "\n -2 Suppress lines unique to FILE2"
17//usage: "\n -3 Suppress lines common to both files"
18
10#include "libbb.h" 19#include "libbb.h"
11 20
12#define COMM_OPT_1 (1 << 0) 21#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 @@
15 * Size reduction. 15 * Size reduction.
16 */ 16 */
17 17
18//usage:#define cp_trivial_usage
19//usage: "[OPTIONS] SOURCE DEST"
20//usage:#define cp_full_usage "\n\n"
21//usage: "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY\n"
22//usage: "\nOptions:"
23//usage: "\n -a Same as -dpR"
24//usage: IF_SELINUX(
25//usage: "\n -c Preserve security context"
26//usage: )
27//usage: "\n -R,-r Recurse"
28//usage: "\n -d,-P Preserve symlinks (default if -R)"
29//usage: "\n -L Follow all symlinks"
30//usage: "\n -H Follow symlinks on command line"
31//usage: "\n -p Preserve file attributes if possible"
32//usage: "\n -f Overwrite"
33//usage: "\n -i Prompt before overwrite"
34//usage: "\n -l,-s Create (sym)links"
35
18#include "libbb.h" 36#include "libbb.h"
19#include "libcoreutils/coreutils.h" 37#include "libcoreutils/coreutils.h"
20 38
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 @@
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12//usage:#define cut_trivial_usage
13//usage: "[OPTIONS] [FILE]..."
14//usage:#define cut_full_usage "\n\n"
15//usage: "Print selected fields from each input FILE to stdout\n"
16//usage: "\nOptions:"
17//usage: "\n -b LIST Output only bytes from LIST"
18//usage: "\n -c LIST Output only characters from LIST"
19//usage: "\n -d CHAR Use CHAR instead of tab as the field delimiter"
20//usage: "\n -s Output only the lines containing delimiter"
21//usage: "\n -f N Print only these fields"
22//usage: "\n -n Ignored"
23//usage:
24//usage:#define cut_example_usage
25//usage: "$ echo \"Hello world\" | cut -f 1 -d ' '\n"
26//usage: "Hello\n"
27//usage: "$ echo \"Hello world\" | cut -f 2 -d ' '\n"
28//usage: "world\n"
29
12#include "libbb.h" 30#include "libbb.h"
13 31
14/* This is a NOEXEC applet. Be very careful! */ 32/* 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 @@
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11//usage:#define dd_trivial_usage
12//usage: "[if=FILE] [of=FILE] " IF_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n"
13//usage: " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync]")
14//usage:#define dd_full_usage "\n\n"
15//usage: "Copy a file with converting and formatting\n"
16//usage: "\nOptions:"
17//usage: "\n if=FILE Read from FILE instead of stdin"
18//usage: "\n of=FILE Write to FILE instead of stdout"
19//usage: "\n bs=N Read and write N bytes at a time"
20//usage: IF_FEATURE_DD_IBS_OBS(
21//usage: "\n ibs=N Read N bytes at a time"
22//usage: )
23//usage: IF_FEATURE_DD_IBS_OBS(
24//usage: "\n obs=N Write N bytes at a time"
25//usage: )
26//usage: "\n count=N Copy only N input blocks"
27//usage: "\n skip=N Skip N input blocks"
28//usage: "\n seek=N Skip N output blocks"
29//usage: IF_FEATURE_DD_IBS_OBS(
30//usage: "\n conv=notrunc Don't truncate output file"
31//usage: "\n conv=noerror Continue after read errors"
32//usage: "\n conv=sync Pad blocks with zeros"
33//usage: "\n conv=fsync Physically write data out before finishing"
34//usage: )
35//usage: "\n"
36//usage: "\nNumbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),"
37//usage: "\nMD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)"
38//usage:
39//usage:#define dd_example_usage
40//usage: "$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4\n"
41//usage: "4+0 records in\n"
42//usage: "4+0 records out\n"
43
11#include "libbb.h" 44#include "libbb.h"
12 45
13/* This is a NOEXEC applet. Be very careful! */ 46/* 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 @@
22 * Implement -P and -B; better coreutils compat; cleanup 22 * Implement -P and -B; better coreutils compat; cleanup
23 */ 23 */
24 24
25//usage:#define df_trivial_usage
26//usage: "[-Pk"
27//usage: IF_FEATURE_HUMAN_READABLE("mh")
28//usage: IF_FEATURE_DF_FANCY("ai] [-B SIZE")
29//usage: "] [FILESYSTEM]..."
30//usage:#define df_full_usage "\n\n"
31//usage: "Print filesystem usage statistics\n"
32//usage: "\nOptions:"
33//usage: "\n -P POSIX output format"
34//usage: "\n -k 1024-byte blocks (default)"
35//usage: IF_FEATURE_HUMAN_READABLE(
36//usage: "\n -m 1M-byte blocks"
37//usage: "\n -h Human readable (e.g. 1K 243M 2G)"
38//usage: )
39//usage: IF_FEATURE_DF_FANCY(
40//usage: "\n -a Show all filesystems"
41//usage: "\n -i Inodes"
42//usage: "\n -B SIZE Blocksize"
43//usage: )
44//usage:
45//usage:#define df_example_usage
46//usage: "$ df\n"
47//usage: "Filesystem 1K-blocks Used Available Use% Mounted on\n"
48//usage: "/dev/sda3 8690864 8553540 137324 98% /\n"
49//usage: "/dev/sda1 64216 36364 27852 57% /boot\n"
50//usage: "$ df /dev/sda3\n"
51//usage: "Filesystem 1K-blocks Used Available Use% Mounted on\n"
52//usage: "/dev/sda3 8690864 8553540 137324 98% /\n"
53//usage: "$ POSIXLY_CORRECT=sure df /dev/sda3\n"
54//usage: "Filesystem 512B-blocks Used Available Use% Mounted on\n"
55//usage: "/dev/sda3 17381728 17107080 274648 98% /\n"
56//usage: "$ POSIXLY_CORRECT=yep df -P /dev/sda3\n"
57//usage: "Filesystem 512-blocks Used Available Capacity Mounted on\n"
58//usage: "/dev/sda3 17381728 17107080 274648 98% /\n"
59
25#include <mntent.h> 60#include <mntent.h>
26#include <sys/vfs.h> 61#include <sys/vfs.h>
27#include "libbb.h" 62#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 @@
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */
12 12
13//usage:#define dirname_trivial_usage
14//usage: "FILENAME"
15//usage:#define dirname_full_usage "\n\n"
16//usage: "Strip non-directory suffix from FILENAME"
17//usage:
18//usage:#define dirname_example_usage
19//usage: "$ dirname /tmp/foo\n"
20//usage: "/tmp\n"
21//usage: "$ dirname /tmp/foo/\n"
22//usage: "/tmp\n"
23
13#include "libbb.h" 24#include "libbb.h"
14 25
15/* This is a NOFORK applet. Be very careful! */ 26/* 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 @@
12 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 12 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
13*/ 13*/
14 14
15//usage:#define dos2unix_trivial_usage
16//usage: "[-ud] [FILE]"
17//usage:#define dos2unix_full_usage "\n\n"
18//usage: "Convert FILE in-place from DOS to Unix format.\n"
19//usage: "When no file is given, use stdin/stdout.\n"
20//usage: "\nOptions:"
21//usage: "\n -u dos2unix"
22//usage: "\n -d unix2dos"
23//usage:
24//usage:#define unix2dos_trivial_usage
25//usage: "[-ud] [FILE]"
26//usage:#define unix2dos_full_usage "\n\n"
27//usage: "Convert FILE in-place from Unix to DOS format.\n"
28//usage: "When no file is given, use stdin/stdout.\n"
29//usage: "\nOptions:"
30//usage: "\n -u dos2unix"
31//usage: "\n -d unix2dos"
32
15#include "libbb.h" 33#include "libbb.h"
16 34
17/* This is a NOEXEC applet. Be very careful! */ 35/* 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 @@
23 * 4) Fixed busybox bug #1284 involving long overflow with human_readable. 23 * 4) Fixed busybox bug #1284 involving long overflow with human_readable.
24 */ 24 */
25 25
26//usage:#define du_trivial_usage
27//usage: "[-aHLdclsx" IF_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..."
28//usage:#define du_full_usage "\n\n"
29//usage: "Summarize disk space used for each FILE and/or directory.\n"
30//usage: "Disk space is printed in units of "
31//usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("1024")
32//usage: IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("512")
33//usage: " bytes.\n"
34//usage: "\nOptions:"
35//usage: "\n -a Show file sizes too"
36//usage: "\n -L Follow all symlinks"
37//usage: "\n -H Follow symlinks on command line"
38//usage: "\n -d N Limit output to directories (and files with -a) of depth < N"
39//usage: "\n -c Show grand total"
40//usage: "\n -l Count sizes many times if hard linked"
41//usage: "\n -s Display only a total for each argument"
42//usage: "\n -x Skip directories on different filesystems"
43//usage: IF_FEATURE_HUMAN_READABLE(
44//usage: "\n -h Sizes in human readable format (e.g., 1K 243M 2G )"
45//usage: "\n -m Sizes in megabytes"
46//usage: )
47//usage: "\n -k Sizes in kilobytes"
48//usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(" (default)")
49//usage:
50//usage:#define du_example_usage
51//usage: "$ du\n"
52//usage: "16 ./CVS\n"
53//usage: "12 ./kernel-patches/CVS\n"
54//usage: "80 ./kernel-patches\n"
55//usage: "12 ./tests/CVS\n"
56//usage: "36 ./tests\n"
57//usage: "12 ./scripts/CVS\n"
58//usage: "16 ./scripts\n"
59//usage: "12 ./docs/CVS\n"
60//usage: "104 ./docs\n"
61//usage: "2417 .\n"
62
26#include "libbb.h" 63#include "libbb.h"
27 64
28enum { 65enum {
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 @@
23 * The previous version did not allow 4-digit octals. 23 * The previous version did not allow 4-digit octals.
24 */ 24 */
25 25
26//usage:#define echo_trivial_usage
27//usage: IF_FEATURE_FANCY_ECHO("[-neE] ") "[ARG]..."
28//usage:#define echo_full_usage "\n\n"
29//usage: "Print the specified ARGs to stdout"
30//usage: IF_FEATURE_FANCY_ECHO( "\n"
31//usage: "\nOptions:"
32//usage: "\n -n Suppress trailing newline"
33//usage: "\n -e Interpret backslash escapes (i.e., \\t=tab)"
34//usage: "\n -E Don't interpret backslash escapes (default)"
35//usage: )
36//usage:
37//usage:#define echo_example_usage
38//usage: "$ echo \"Erik is cool\"\n"
39//usage: "Erik is cool\n"
40//usage: IF_FEATURE_FANCY_ECHO("$ echo -e \"Erik\\nis\\ncool\"\n"
41//usage: "Erik\n"
42//usage: "is\n"
43//usage: "cool\n"
44//usage: "$ echo \"Erik\\nis\\ncool\"\n"
45//usage: "Erik\\nis\\ncool\n")
46
26#include "libbb.h" 47#include "libbb.h"
27 48
28/* This is a NOFORK applet. Be very careful! */ 49/* 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 @@
31 31
32/* This is a NOEXEC applet. Be very careful! */ 32/* This is a NOEXEC applet. Be very careful! */
33 33
34//usage:#define env_trivial_usage
35//usage: "[-iu] [-] [name=value]... [PROG ARGS]"
36//usage:#define env_full_usage "\n\n"
37//usage: "Print the current environment or run PROG after setting up\n"
38//usage: "the specified environment\n"
39//usage: "\nOptions:"
40//usage: "\n -, -i Start with an empty environment"
41//usage: "\n -u Remove variable from the environment"
42
34#include "libbb.h" 43#include "libbb.h"
35 44
36#if ENABLE_FEATURE_ENV_LONG_OPTIONS 45#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 @@
20 * 20 *
21 * Caveat: this versions of expand and unexpand don't accept tab lists. 21 * Caveat: this versions of expand and unexpand don't accept tab lists.
22 */ 22 */
23
24//usage:#define expand_trivial_usage
25//usage: "[-i] [-t N] [FILE]..."
26//usage:#define expand_full_usage "\n\n"
27//usage: "Convert tabs to spaces, writing to stdout\n"
28//usage: "\nOptions:"
29//usage: IF_FEATURE_EXPAND_LONG_OPTIONS(
30//usage: "\n -i,--initial Don't convert tabs after non blanks"
31//usage: "\n -t,--tabs=N Tabstops every N chars"
32//usage: )
33//usage: IF_NOT_FEATURE_EXPAND_LONG_OPTIONS(
34//usage: "\n -i Don't convert tabs after non blanks"
35//usage: "\n -t Tabstops every N chars"
36//usage: )
37
38//usage:#define unexpand_trivial_usage
39//usage: "[-fa][-t N] [FILE]..."
40//usage:#define unexpand_full_usage "\n\n"
41//usage: "Convert spaces to tabs, writing to stdout\n"
42//usage: "\nOptions:"
43//usage: IF_FEATURE_UNEXPAND_LONG_OPTIONS(
44//usage: "\n -a,--all Convert all blanks"
45//usage: "\n -f,--first-only Convert only leading blanks"
46//usage: "\n -t,--tabs=N Tabstops every N chars"
47//usage: )
48//usage: IF_NOT_FEATURE_UNEXPAND_LONG_OPTIONS(
49//usage: "\n -a Convert all blanks"
50//usage: "\n -f Convert only leading blanks"
51//usage: "\n -t N Tabstops every N chars"
52//usage: )
53
23#include "libbb.h" 54#include "libbb.h"
24#include "unicode.h" 55#include "unicode.h"
25 56
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 @@
25 25
26/* no getopt needed */ 26/* no getopt needed */
27 27
28//usage:#define expr_trivial_usage
29//usage: "EXPRESSION"
30//usage:#define expr_full_usage "\n\n"
31//usage: "Print the value of EXPRESSION to stdout\n"
32//usage: "\n"
33//usage: "EXPRESSION may be:\n"
34//usage: " ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n"
35//usage: " ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n"
36//usage: " ARG1 < ARG2 1 if ARG1 is less than ARG2, else 0. Similarly:\n"
37//usage: " ARG1 <= ARG2\n"
38//usage: " ARG1 = ARG2\n"
39//usage: " ARG1 != ARG2\n"
40//usage: " ARG1 >= ARG2\n"
41//usage: " ARG1 > ARG2\n"
42//usage: " ARG1 + ARG2 Sum of ARG1 and ARG2. Similarly:\n"
43//usage: " ARG1 - ARG2\n"
44//usage: " ARG1 * ARG2\n"
45//usage: " ARG1 / ARG2\n"
46//usage: " ARG1 % ARG2\n"
47//usage: " STRING : REGEXP Anchored pattern match of REGEXP in STRING\n"
48//usage: " match STRING REGEXP Same as STRING : REGEXP\n"
49//usage: " substr STRING POS LENGTH Substring of STRING, POS counted from 1\n"
50//usage: " index STRING CHARS Index in STRING where any CHARS is found, or 0\n"
51//usage: " length STRING Length of STRING\n"
52//usage: " quote TOKEN Interpret TOKEN as a string, even if\n"
53//usage: " it is a keyword like 'match' or an\n"
54//usage: " operator like '/'\n"
55//usage: " (EXPRESSION) Value of EXPRESSION\n"
56//usage: "\n"
57//usage: "Beware that many operators need to be escaped or quoted for shells.\n"
58//usage: "Comparisons are arithmetic if both ARGs are numbers, else\n"
59//usage: "lexicographical. Pattern matches return the string matched between\n"
60//usage: "\\( and \\) or null; if \\( and \\) are not used, they return the number\n"
61//usage: "of characters matched or 0."
62
28#include "libbb.h" 63#include "libbb.h"
29#include "xregex.h" 64#include "xregex.h"
30 65
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 @@
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/000095399/utilities/false.html */ 11/* http://www.opengroup.org/onlinepubs/000095399/utilities/false.html */
12 12
13//usage:#define false_trivial_usage
14//usage: ""
15//usage:#define false_full_usage "\n\n"
16//usage: "Return an exit code of FALSE (1)"
17//usage:
18//usage:#define false_example_usage
19//usage: "$ false\n"
20//usage: "$ echo $?\n"
21//usage: "1\n"
22
13#include "libbb.h" 23#include "libbb.h"
14 24
15/* This is a NOFORK applet. Be very careful! */ 25/* 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 @@
9 9
10 Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 Licensed under GPLv2 or later, see file LICENSE in this source tree.
11*/ 11*/
12
13//usage:#define fold_trivial_usage
14//usage: "[-bs] [-w WIDTH] [FILE]..."
15//usage:#define fold_full_usage "\n\n"
16//usage: "Wrap input lines in each FILE (or stdin), writing to stdout\n"
17//usage: "\nOptions:"
18//usage: "\n -b Count bytes rather than columns"
19//usage: "\n -s Break at spaces"
20//usage: "\n -w Use WIDTH columns instead of 80"
21
12#include "libbb.h" 22#include "libbb.h"
13#include "unicode.h" 23#include "unicode.h"
14 24
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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10//usage:#define fsync_trivial_usage
11//usage: "[-d] FILE..."
12//usage:#define fsync_full_usage "\n\n"
13//usage: "Write files' buffered blocks to disk\n"
14//usage: "\nOptions:"
15//usage: "\n -d Avoid syncing metadata"
16
9#include "libbb.h" 17#include "libbb.h"
10#ifndef O_NOATIME 18#ifndef O_NOATIME
11# define O_NOATIME 0 19# 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 @@
11/* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */ 11/* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */
12/* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */ 12/* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */
13 13
14//usage:#define head_trivial_usage
15//usage: "[OPTIONS] [FILE]..."
16//usage:#define head_full_usage "\n\n"
17//usage: "Print first 10 lines of each FILE (or stdin) to stdout.\n"
18//usage: "With more than one FILE, precede each with a filename header.\n"
19//usage: "\nOptions:"
20//usage: "\n -n N[kbm] Print first N lines"
21//usage: IF_FEATURE_FANCY_HEAD(
22//usage: "\n -c N[kbm] Print first N bytes"
23//usage: "\n -q Never print headers"
24//usage: "\n -v Always print headers"
25//usage: )
26//usage: "\n"
27//usage: "\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)."
28//usage:
29//usage:#define head_example_usage
30//usage: "$ head -n 2 /etc/passwd\n"
31//usage: "root:x:0:0:root:/root:/bin/bash\n"
32//usage: "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n"
33
14#include "libbb.h" 34#include "libbb.h"
15 35
16/* This is a NOEXEC applet. Be very careful! */ 36/* 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 @@
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11 11
12//usage:#define hostid_trivial_usage
13//usage: ""
14//usage:#define hostid_full_usage "\n\n"
15//usage: "Print out a unique 32-bit identifier for the machine"
16
12#include "libbb.h" 17#include "libbb.h"
13 18
14/* This is a NOFORK applet. Be very careful! */ 19/* 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 @@
15 * Added -G option Tito Ragusa (C) 2008 for SUSv3. 15 * Added -G option Tito Ragusa (C) 2008 for SUSv3.
16 */ 16 */
17 17
18//usage:#define id_trivial_usage
19//usage: "[OPTIONS] [USER]"
20//usage:#define id_full_usage "\n\n"
21//usage: "Print information about USER or the current user\n"
22//usage: "\nOptions:"
23//usage: IF_SELINUX(
24//usage: "\n -Z Security context"
25//usage: )
26//usage: "\n -u User ID"
27//usage: "\n -g Group ID"
28//usage: "\n -G Supplementary group IDs"
29//usage: "\n -n Print names instead of numbers"
30//usage: "\n -r Print real ID instead of effective ID"
31//usage:
32//usage:#define id_example_usage
33//usage: "$ id\n"
34//usage: "uid=1000(andersen) gid=1000(andersen)\n"
35
18#include "libbb.h" 36#include "libbb.h"
19 37
20/* This is a NOEXEC applet. Be very careful! */ 38/* 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 @@
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9/* -v, -b, -c are ignored */
10//usage:#define install_trivial_usage
11//usage: "[-cdDsp] [-o USER] [-g GRP] [-m MODE] [SOURCE]... DEST"
12//usage:#define install_full_usage "\n\n"
13//usage: "Copy files and set attributes\n"
14//usage: "\nOptions:"
15//usage: "\n -c Just copy (default)"
16//usage: "\n -d Create directories"
17//usage: "\n -D Create leading target directories"
18//usage: "\n -s Strip symbol table"
19//usage: "\n -p Preserve date"
20//usage: "\n -o USER Set ownership"
21//usage: "\n -g GRP Set group ownership"
22//usage: "\n -m MODE Set permissions"
23//usage: IF_SELINUX(
24//usage: "\n -Z Set security context"
25//usage: )
26
9#include "libbb.h" 27#include "libbb.h"
10#include "libcoreutils/coreutils.h" 28#include "libcoreutils/coreutils.h"
11 29
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 @@
11/* BB_AUDIT GNU options missing: -d, -F, -i, and -v. */ 11/* BB_AUDIT GNU options missing: -d, -F, -i, and -v. */
12/* http://www.opengroup.org/onlinepubs/007904975/utilities/ln.html */ 12/* http://www.opengroup.org/onlinepubs/007904975/utilities/ln.html */
13 13
14//usage:#define ln_trivial_usage
15//usage: "[OPTIONS] TARGET... LINK|DIR"
16//usage:#define ln_full_usage "\n\n"
17//usage: "Create a link LINK or DIR/TARGET to the specified TARGET(s)\n"
18//usage: "\nOptions:"
19//usage: "\n -s Make symlinks instead of hardlinks"
20//usage: "\n -f Remove existing destinations"
21//usage: "\n -n Don't dereference symlinks - treat like normal file"
22//usage: "\n -b Make a backup of the target (if exists) before link operation"
23//usage: "\n -S suf Use suffix instead of ~ when making backup files"
24//usage:
25//usage:#define ln_example_usage
26//usage: "$ ln -s BusyBox /tmp/ls\n"
27//usage: "$ ls -l /tmp/ls\n"
28//usage: "lrwxrwxrwx 1 root root 7 Apr 12 18:39 ls -> BusyBox*\n"
29
14#include "libbb.h" 30#include "libbb.h"
15 31
16/* This is a NOEXEC applet. Be very careful! */ 32/* 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 @@
20 * a diagnostic message and an error return. 20 * a diagnostic message and an error return.
21 */ 21 */
22 22
23//usage:#define logname_trivial_usage
24//usage: ""
25//usage:#define logname_full_usage "\n\n"
26//usage: "Print the name of the current user"
27//usage:
28//usage:#define logname_example_usage
29//usage: "$ logname\n"
30//usage: "root\n"
31
23#include "libbb.h" 32#include "libbb.h"
24 33
25/* This is a NOFORK applet. Be very careful! */ 34/* 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 @@
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9//usage:#define md5sum_trivial_usage
10//usage: "[FILE]..."
11//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: md5sum -c [-sw] [FILE]")
12//usage:#define md5sum_full_usage "\n\n"
13//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " MD5 checksums"
14//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n"
15//usage: "\nOptions:"
16//usage: "\n -c Check sums against given list"
17//usage: "\n -s Don't output anything, status code shows success"
18//usage: "\n -w Warn about improperly formatted checksum lines"
19//usage: )
20//usage:
21//usage:#define md5sum_example_usage
22//usage: "$ md5sum < busybox\n"
23//usage: "6fd11e98b98a58f64ff3398d7b324003\n"
24//usage: "$ md5sum busybox\n"
25//usage: "6fd11e98b98a58f64ff3398d7b324003 busybox\n"
26//usage: "$ md5sum -c -\n"
27//usage: "6fd11e98b98a58f64ff3398d7b324003 busybox\n"
28//usage: "busybox: OK\n"
29//usage: "^D\n"
30//usage:
31//usage:#define sha1sum_trivial_usage
32//usage: "[FILE]..."
33//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha1sum -c [-sw] [FILE]")
34//usage:#define sha1sum_full_usage "\n\n"
35//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA1 checksums"
36//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n"
37//usage: "\nOptions:"
38//usage: "\n -c Check sums against given list"
39//usage: "\n -s Don't output anything, status code shows success"
40//usage: "\n -w Warn about improperly formatted checksum lines"
41//usage: )
42//usage:
43//usage:#define sha256sum_trivial_usage
44//usage: "[FILE]..."
45//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha256sum -c [-sw] [FILE]")
46//usage:#define sha256sum_full_usage "\n\n"
47//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA256 checksums"
48//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n"
49//usage: "\nOptions:"
50//usage: "\n -c Check sums against given list"
51//usage: "\n -s Don't output anything, status code shows success"
52//usage: "\n -w Warn about improperly formatted checksum lines"
53//usage: )
54//usage:
55//usage:#define sha512sum_trivial_usage
56//usage: "[FILE]..."
57//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK("\n or: sha512sum -c [-sw] [FILE]")
58//usage:#define sha512sum_full_usage "\n\n"
59//usage: "Print" IF_FEATURE_MD5_SHA1_SUM_CHECK(" or check") " SHA512 checksums"
60//usage: IF_FEATURE_MD5_SHA1_SUM_CHECK( "\n"
61//usage: "\nOptions:"
62//usage: "\n -c Check sums against given list"
63//usage: "\n -s Don't output anything, status code shows success"
64//usage: "\n -w Warn about improperly formatted checksum lines"
65//usage: )
66
9#include "libbb.h" 67#include "libbb.h"
10 68
11/* This is a NOEXEC applet. Be very careful! */ 69/* 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 @@
19/* Nov 28, 2006 Yoshinori Sato <ysato@users.sourceforge.jp>: Add SELinux Support. 19/* Nov 28, 2006 Yoshinori Sato <ysato@users.sourceforge.jp>: Add SELinux Support.
20 */ 20 */
21 21
22//usage:#define mkdir_trivial_usage
23//usage: "[OPTIONS] DIRECTORY..."
24//usage:#define mkdir_full_usage "\n\n"
25//usage: "Create DIRECTORY\n"
26//usage: "\nOptions:"
27//usage: "\n -m MODE Mode"
28//usage: "\n -p No error if exists; make parent directories as needed"
29//usage: IF_SELINUX(
30//usage: "\n -Z Set security context"
31//usage: )
32//usage:
33//usage:#define mkdir_example_usage
34//usage: "$ mkdir /tmp/foo\n"
35//usage: "$ mkdir /tmp/foo\n"
36//usage: "/tmp/foo: File exists\n"
37//usage: "$ mkdir /tmp/foo/bar/baz\n"
38//usage: "/tmp/foo/bar/baz: No such file or directory\n"
39//usage: "$ mkdir -p /tmp/foo/bar/baz\n"
40
22#include "libbb.h" 41#include "libbb.h"
23 42
24/* This is a NOFORK applet. Be very careful! */ 43/* 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 @@
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkfifo.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkfifo.html */
12 12
13//usage:#define mkfifo_trivial_usage
14//usage: "[-m MODE] " IF_SELINUX("[-Z] ") "NAME"
15//usage:#define mkfifo_full_usage "\n\n"
16//usage: "Create named pipe\n"
17//usage: "\nOptions:"
18//usage: "\n -m MODE Mode (default a=rw)"
19//usage: IF_SELINUX(
20//usage: "\n -Z Set security context"
21//usage: )
22
13#include "libbb.h" 23#include "libbb.h"
14#include "libcoreutils/coreutils.h" 24#include "libcoreutils/coreutils.h"
15 25
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 @@
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11 11
12//usage:#define mknod_trivial_usage
13//usage: "[-m MODE] " IF_SELINUX("[-Z] ") "NAME TYPE MAJOR MINOR"
14//usage:#define mknod_full_usage "\n\n"
15//usage: "Create a special file (block, character, or pipe)\n"
16//usage: "\nOptions:"
17//usage: "\n -m MODE Creation mode (default a=rw)"
18//usage: IF_SELINUX(
19//usage: "\n -Z Set security context"
20//usage: )
21//usage: "\nTYPE:"
22//usage: "\n b Block device"
23//usage: "\n c or u Character device"
24//usage: "\n p Named pipe (MAJOR and MINOR are ignored)"
25//usage:
26//usage:#define mknod_example_usage
27//usage: "$ mknod /dev/fd0 b 2 0\n"
28//usage: "$ mknod -m 644 /tmp/pipe p\n"
29
12#include <sys/sysmacros.h> // For makedev 30#include <sys/sysmacros.h> // For makedev
13 31
14#include "libbb.h" 32#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 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10//usage:#define nice_trivial_usage
11//usage: "[-n ADJUST] [PROG ARGS]"
12//usage:#define nice_full_usage "\n\n"
13//usage: "Change scheduling priority, run PROG\n"
14//usage: "\nOptions:"
15//usage: "\n -n ADJUST Adjust priority by ADJUST"
16
10#include <sys/resource.h> 17#include <sys/resource.h>
11#include "libbb.h" 18#include "libbb.h"
12 19
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 @@
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13//usage:#define nohup_trivial_usage
14//usage: "PROG ARGS"
15//usage:#define nohup_full_usage "\n\n"
16//usage: "Run PROG immune to hangups, with output to a non-tty"
17//usage:
18//usage:#define nohup_example_usage
19//usage: "$ nohup make &"
20
13#include "libbb.h" 21#include "libbb.h"
14 22
15/* Compat info: nohup (GNU coreutils 6.8) does this: 23/* 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 @@
11 * Original copyright notice is retained at the end of this file. 11 * Original copyright notice is retained at the end of this file.
12 */ 12 */
13 13
14//usage:#define od_trivial_usage
15//usage: "[-aBbcDdeFfHhIiLlOovXx] " IF_DESKTOP("[-t TYPE] ") "[FILE]"
16//usage:#define od_full_usage "\n\n"
17//usage: "Write an unambiguous representation, octal bytes by default, of FILE\n"
18//usage: "(or stdin) to stdout"
14 19
15#include "libbb.h" 20#include "libbb.h"
16#if ENABLE_DESKTOP 21#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 @@
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11//usage:#define printenv_trivial_usage
12//usage: "[VARIABLE]..."
13//usage:#define printenv_full_usage "\n\n"
14//usage: "Print environment VARIABLEs.\n"
15//usage: "If no VARIABLE specified, print all."
16
11#include "libbb.h" 17#include "libbb.h"
12 18
13/* This is a NOFORK applet. Be very careful! */ 19/* 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 @@
38 38
39// 19990508 Busy Boxed! Dave Cinege 39// 19990508 Busy Boxed! Dave Cinege
40 40
41//usage:#define printf_trivial_usage
42//usage: "FORMAT [ARGUMENT]..."
43//usage:#define printf_full_usage "\n\n"
44//usage: "Format and print ARGUMENT(s) according to FORMAT,\n"
45//usage: "where FORMAT controls the output exactly as in C printf"
46//usage:
47//usage:#define printf_example_usage
48//usage: "$ printf \"Val=%d\\n\" 5\n"
49//usage: "Val=5\n"
50
41#include "libbb.h" 51#include "libbb.h"
42 52
43/* A note on bad input: neither bash 3.2 nor coreutils 6.10 stop on it. 53/* 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 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10//usage:#define pwd_trivial_usage
11//usage: ""
12//usage:#define pwd_full_usage "\n\n"
13//usage: "Print the full filename of the current working directory"
14//usage:
15//usage:#define pwd_example_usage
16//usage: "$ pwd\n"
17//usage: "/root\n"
18
10#include "libbb.h" 19#include "libbb.h"
11 20
12/* This is a NOFORK applet. Be very careful! */ 21/* 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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10//usage:#define readlink_trivial_usage
11//usage: IF_FEATURE_READLINK_FOLLOW("[-fnv] ") "FILE"
12//usage:#define readlink_full_usage "\n\n"
13//usage: "Display the value of a symlink"
14//usage: IF_FEATURE_READLINK_FOLLOW( "\n"
15//usage: "\nOptions:"
16//usage: "\n -f Canonicalize by following all symlinks"
17//usage: "\n -n Don't add newline"
18//usage: "\n -v Verbose"
19//usage: )
20
9#include "libbb.h" 21#include "libbb.h"
10 22
11/* 23/*
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 @@
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13//usage:#define realpath_trivial_usage
14//usage: "FILE..."
15//usage:#define realpath_full_usage "\n\n"
16//usage: "Return the absolute pathnames of given FILE"
17
13#include "libbb.h" 18#include "libbb.h"
14 19
15int realpath_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 20int 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 @@
15 * Size reduction. 15 * Size reduction.
16 */ 16 */
17 17
18//usage:#define rm_trivial_usage
19//usage: "[-irf] FILE..."
20//usage:#define rm_full_usage "\n\n"
21//usage: "Remove (unlink) FILEs\n"
22//usage: "\nOptions:"
23//usage: "\n -i Always prompt before removing"
24//usage: "\n -f Never prompt"
25//usage: "\n -R,-r Recurse"
26//usage:
27//usage:#define rm_example_usage
28//usage: "$ rm -rf /tmp/foo\n"
29
18#include "libbb.h" 30#include "libbb.h"
19 31
20/* This is a NOFORK applet. Be very careful! */ 32/* 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 @@
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/rmdir.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/rmdir.html */
12 12
13//usage:#define rmdir_trivial_usage
14//usage: "[OPTIONS] DIRECTORY..."
15//usage:#define rmdir_full_usage "\n\n"
16//usage: "Remove DIRECTORY if it is empty\n"
17//usage: "\nOptions:"
18//usage: IF_FEATURE_RMDIR_LONG_OPTIONS(
19//usage: "\n -p|--parents Include parents"
20//usage: "\n --ignore-fail-on-non-empty"
21//usage: )
22//usage: IF_NOT_FEATURE_RMDIR_LONG_OPTIONS(
23//usage: "\n -p Include parents"
24//usage: )
25//usage:
26//usage:#define rmdir_example_usage
27//usage: "# rmdir /tmp/foo\n"
28
13#include "libbb.h" 29#include "libbb.h"
14 30
15/* This is a NOFORK applet. Be very careful! */ 31/* 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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10//usage:#define seq_trivial_usage
11//usage: "[-w] [-s SEP] [FIRST [INC]] LAST"
12//usage:#define seq_full_usage "\n\n"
13//usage: "Print numbers from FIRST to LAST, in steps of INC.\n"
14//usage: "FIRST, INC default to 1.\n"
15//usage: "\nOptions:"
16//usage: "\n -w Pad to last with leading zeros"
17//usage: "\n -s SEP String separator"
18
9#include "libbb.h" 19#include "libbb.h"
10 20
11/* This is a NOFORK applet. Be very careful! */ 21/* 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 @@
18 * time suffixes for seconds, minutes, hours, and days. 18 * time suffixes for seconds, minutes, hours, and days.
19 */ 19 */
20 20
21//usage:#define sleep_trivial_usage
22//usage: IF_FEATURE_FANCY_SLEEP("[") "N" IF_FEATURE_FANCY_SLEEP("]...")
23//usage:#define sleep_full_usage "\n\n"
24//usage: IF_NOT_FEATURE_FANCY_SLEEP("Pause for N seconds")
25//usage: IF_FEATURE_FANCY_SLEEP(
26//usage: "Pause for a time equal to the total of the args given, where each arg can\n"
27//usage: "have an optional suffix of (s)econds, (m)inutes, (h)ours, or (d)ays")
28//usage:
29//usage:#define sleep_example_usage
30//usage: "$ sleep 2\n"
31//usage: "[2 second delay results]\n"
32//usage: IF_FEATURE_FANCY_SLEEP(
33//usage: "$ sleep 1d 3h 22m 8s\n"
34//usage: "[98528 second delay results]\n")
35
21#include "libbb.h" 36#include "libbb.h"
22 37
23/* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells */ 38/* 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 @@
12 * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html 12 * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
13 */ 13 */
14 14
15//usage:#define sort_trivial_usage
16//usage: "[-nru"
17//usage: IF_FEATURE_SORT_BIG("gMcszbdfimSTokt] [-o FILE] [-k start[.offset][opts][,end[.offset][opts]] [-t CHAR")
18//usage: "] [FILE]..."
19//usage:#define sort_full_usage "\n\n"
20//usage: "Sort lines of text\n"
21//usage: "\nOptions:"
22//usage: IF_FEATURE_SORT_BIG(
23//usage: "\n -b Ignore leading blanks"
24//usage: "\n -c Check whether input is sorted"
25//usage: "\n -d Dictionary order (blank or alphanumeric only)"
26//usage: "\n -f Ignore case"
27//usage: "\n -g General numerical sort"
28//usage: "\n -i Ignore unprintable characters"
29//usage: "\n -k Sort key"
30//usage: "\n -M Sort month"
31//usage: )
32//usage: "\n -n Sort numbers"
33//usage: IF_FEATURE_SORT_BIG(
34//usage: "\n -o Output to file"
35//usage: "\n -k Sort by key"
36//usage: "\n -t CHAR Key separator"
37//usage: )
38//usage: "\n -r Reverse sort order"
39//usage: IF_FEATURE_SORT_BIG(
40//usage: "\n -s Stable (don't sort ties alphabetically)"
41//usage: )
42//usage: "\n -u Suppress duplicate lines"
43//usage: IF_FEATURE_SORT_BIG(
44//usage: "\n -z Lines are terminated by NUL, not newline"
45//usage: "\n -mST Ignored for GNU compatibility")
46//usage:
47//usage:#define sort_example_usage
48//usage: "$ echo -e \"e\\nf\\nb\\nd\\nc\\na\" | sort\n"
49//usage: "a\n"
50//usage: "b\n"
51//usage: "c\n"
52//usage: "d\n"
53//usage: "e\n"
54//usage: "f\n"
55//usage: IF_FEATURE_SORT_BIG(
56//usage: "$ echo -e \"c 3\\nb 2\\nd 2\" | $SORT -k 2,2n -k 1,1r\n"
57//usage: "d 2\n"
58//usage: "b 2\n"
59//usage: "c 3\n"
60//usage: )
61//usage: ""
62
15#include "libbb.h" 63#include "libbb.h"
16 64
17/* This is a NOEXEC applet. Be very careful! */ 65/* 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 @@
9 * SUSv3 requirements: 9 * SUSv3 requirements:
10 * http://www.opengroup.org/onlinepubs/009695399/utilities/split.html 10 * http://www.opengroup.org/onlinepubs/009695399/utilities/split.html
11 */ 11 */
12
13//usage:#define split_trivial_usage
14//usage: "[OPTIONS] [INPUT [PREFIX]]"
15//usage:#define split_full_usage "\n\n"
16//usage: "Options:"
17//usage: "\n -b N[k|m] Split by N (kilo|mega)bytes"
18//usage: "\n -l N Split by N lines"
19//usage: "\n -a N Use N letters as suffix"
20//usage:
21//usage:#define split_example_usage
22//usage: "$ split TODO foo\n"
23//usage: "$ cat TODO | split -a 2 -l 2 TODO_\n"
24
12#include "libbb.h" 25#include "libbb.h"
13 26
14static const struct suffix_mult split_suffices[] = { 27static 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 @@
12 * 12 *
13 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15
16//usage:#define stat_trivial_usage
17//usage: "[OPTIONS] FILE..."
18//usage:#define stat_full_usage "\n\n"
19//usage: "Display file (default) or filesystem status\n"
20//usage: "\nOptions:"
21//usage: IF_FEATURE_STAT_FORMAT(
22//usage: "\n -c fmt Use the specified format"
23//usage: )
24//usage: "\n -f Display filesystem status"
25//usage: "\n -L Follow links"
26//usage: "\n -t Display info in terse form"
27//usage: IF_SELINUX(
28//usage: "\n -Z Print security context"
29//usage: )
30//usage: IF_FEATURE_STAT_FORMAT(
31//usage: "\n\nValid format sequences for files:\n"
32//usage: " %a Access rights in octal\n"
33//usage: " %A Access rights in human readable form\n"
34//usage: " %b Number of blocks allocated (see %B)\n"
35//usage: " %B The size in bytes of each block reported by %b\n"
36//usage: " %d Device number in decimal\n"
37//usage: " %D Device number in hex\n"
38//usage: " %f Raw mode in hex\n"
39//usage: " %F File type\n"
40//usage: " %g Group ID of owner\n"
41//usage: " %G Group name of owner\n"
42//usage: " %h Number of hard links\n"
43//usage: " %i Inode number\n"
44//usage: " %n File name\n"
45//usage: " %N File name, with -> TARGET if symlink\n"
46//usage: " %o I/O block size\n"
47//usage: " %s Total size, in bytes\n"
48//usage: " %t Major device type in hex\n"
49//usage: " %T Minor device type in hex\n"
50//usage: " %u User ID of owner\n"
51//usage: " %U User name of owner\n"
52//usage: " %x Time of last access\n"
53//usage: " %X Time of last access as seconds since Epoch\n"
54//usage: " %y Time of last modification\n"
55//usage: " %Y Time of last modification as seconds since Epoch\n"
56//usage: " %z Time of last change\n"
57//usage: " %Z Time of last change as seconds since Epoch\n"
58//usage: "\nValid format sequences for file systems:\n"
59//usage: " %a Free blocks available to non-superuser\n"
60//usage: " %b Total data blocks in file system\n"
61//usage: " %c Total file nodes in file system\n"
62//usage: " %d Free file nodes in file system\n"
63//usage: " %f Free blocks in file system\n"
64//usage: IF_SELINUX(
65//usage: " %C Security context in selinux\n"
66//usage: )
67//usage: " %i File System ID in hex\n"
68//usage: " %l Maximum length of filenames\n"
69//usage: " %n File name\n"
70//usage: " %s Block size (for faster transfer)\n"
71//usage: " %S Fundamental block size (for block counts)\n"
72//usage: " %t Type in hex\n"
73//usage: " %T Type in human readable form"
74//usage: )
75
15#include "libbb.h" 76#include "libbb.h"
16 77
17#define OPT_FILESYS (1 << 0) 78#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 @@
21 21
22 */ 22 */
23 23
24//usage:#define stty_trivial_usage
25//usage: "[-a|g] [-F DEVICE] [SETTING]..."
26//usage:#define stty_full_usage "\n\n"
27//usage: "Without arguments, prints baud rate, line discipline,\n"
28//usage: "and deviations from stty sane\n"
29//usage: "\nOptions:"
30//usage: "\n -F DEVICE Open device instead of stdin"
31//usage: "\n -a Print all current settings in human-readable form"
32//usage: "\n -g Print in stty-readable form"
33//usage: "\n [SETTING] See manpage"
34
24#include "libbb.h" 35#include "libbb.h"
25 36
26#ifndef _POSIX_VDISABLE 37#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 @@
13 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15 15
16//usage:#define sum_trivial_usage
17//usage: "[-rs] [FILE]..."
18//usage:#define sum_full_usage "\n\n"
19//usage: "Checksum and count the blocks in a file\n"
20//usage: "\nOptions:"
21//usage: "\n -r Use BSD sum algorithm (1K blocks)"
22//usage: "\n -s Use System V sum algorithm (512byte blocks)"
23
16#include "libbb.h" 24#include "libbb.h"
17 25
18enum { SUM_BSD, PRINT_NAME, SUM_SYSV }; 26enum { 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 @@
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11 11
12//usage:#define sync_trivial_usage
13//usage: ""
14//usage:#define sync_full_usage "\n\n"
15//usage: "Write all buffered blocks to disk"
16
12#include "libbb.h" 17#include "libbb.h"
13 18
14/* This is a NOFORK applet. Be very careful! */ 19/* 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 @@
16 * http://www.uclibc.org/lists/busybox/2003-July/008813.html 16 * http://www.uclibc.org/lists/busybox/2003-July/008813.html
17 */ 17 */
18 18
19//usage:#define tac_trivial_usage
20//usage: "[FILE]..."
21//usage:#define tac_full_usage "\n\n"
22//usage: "Concatenate FILEs and print them in reverse"
23
19#include "libbb.h" 24#include "libbb.h"
20 25
21/* This is a NOEXEC applet. Be very careful! */ 26/* 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 @@
24 * 7) lseek attempted when count==0 even if arg was +0 (from top) 24 * 7) lseek attempted when count==0 even if arg was +0 (from top)
25 */ 25 */
26 26
27//usage:#define tail_trivial_usage
28//usage: "[OPTIONS] [FILE]..."
29//usage:#define tail_full_usage "\n\n"
30//usage: "Print last 10 lines of each FILE (or stdin) to stdout.\n"
31//usage: "With more than one FILE, precede each with a filename header.\n"
32//usage: "\nOptions:"
33//usage: "\n -f Print data as file grows"
34//usage: IF_FEATURE_FANCY_TAIL(
35//usage: "\n -s SECONDS Wait SECONDS between reads with -f"
36//usage: )
37//usage: "\n -n N[kbm] Print last N lines"
38//usage: IF_FEATURE_FANCY_TAIL(
39//usage: "\n -c N[kbm] Print last N bytes"
40//usage: "\n -q Never print headers"
41//usage: "\n -v Always print headers"
42//usage: "\n"
43//usage: "\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)."
44//usage: "\nIf N starts with a '+', output begins with the Nth item from the start"
45//usage: "\nof each file, not from the end."
46//usage: )
47//usage:
48//usage:#define tail_example_usage
49//usage: "$ tail -n 1 /etc/resolv.conf\n"
50//usage: "nameserver 10.0.0.1\n"
51
27#include "libbb.h" 52#include "libbb.h"
28 53
29static const struct suffix_mult tail_suffixes[] = { 54static 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 @@
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/tee.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/tee.html */
12 12
13//usage:#define tee_trivial_usage
14//usage: "[-ai] [FILE]..."
15//usage:#define tee_full_usage "\n\n"
16//usage: "Copy stdin to each FILE, and also to stdout\n"
17//usage: "\nOptions:"
18//usage: "\n -a Append to the given FILEs, don't overwrite"
19//usage: "\n -i Ignore interrupt signals (SIGINT)"
20//usage:
21//usage:#define tee_example_usage
22//usage: "$ echo \"Hello\" | tee /tmp/foo\n"
23//usage: "$ cat /tmp/foo\n"
24//usage: "Hello\n"
25
13#include "libbb.h" 26#include "libbb.h"
14 27
15int tee_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 28int 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 @@
39//config: help 39//config: help
40//config: Enable 64-bit support in test. 40//config: Enable 64-bit support in test.
41 41
42/* "test --help" does not print help (POSIX compat), only "[ --help" does.
43 * We display "<applet> EXPRESSION ]" here (not "<applet> EXPRESSION")
44 * Unfortunately, it screws up generated BusyBox.html. TODO. */
45//usage:#define test_trivial_usage
46//usage: "EXPRESSION ]"
47//usage:#define test_full_usage "\n\n"
48//usage: "Check file types, compare values etc. Return a 0/1 exit code\n"
49//usage: "depending on logical value of EXPRESSION"
50//usage:
51//usage:#define test_example_usage
52//usage: "$ test 1 -eq 2\n"
53//usage: "$ echo $?\n"
54//usage: "1\n"
55//usage: "$ test 1 -eq 1\n"
56//usage: "$ echo $?\n"
57//usage: "0\n"
58//usage: "$ [ -d /etc ]\n"
59//usage: "$ echo $?\n"
60//usage: "0\n"
61//usage: "$ [ -d /junk ]\n"
62//usage: "$ echo $?\n"
63//usage: "1\n"
64
42#include "libbb.h" 65#include "libbb.h"
43#include <setjmp.h> 66#include <setjmp.h>
44 67
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 @@
47//config: useful for cases when no other way of expressing a character 47//config: useful for cases when no other way of expressing a character
48//config: is possible. 48//config: is possible.
49 49
50//usage:#define tr_trivial_usage
51//usage: "[-cds] STRING1 [STRING2]"
52//usage:#define tr_full_usage "\n\n"
53//usage: "Translate, squeeze, or delete characters from stdin, writing to stdout\n"
54//usage: "\nOptions:"
55//usage: "\n -c Take complement of STRING1"
56//usage: "\n -d Delete input characters coded STRING1"
57//usage: "\n -s Squeeze multiple output characters of STRING2 into one character"
58//usage:
59//usage:#define tr_example_usage
60//usage: "$ echo \"gdkkn vnqkc\" | tr [a-y] [b-z]\n"
61//usage: "hello world\n"
62
50#include "libbb.h" 63#include "libbb.h"
51 64
52enum { 65enum {
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 @@
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/true.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/true.html */
12 12
13//usage:#define true_trivial_usage
14//usage: ""
15//usage:#define true_full_usage "\n\n"
16//usage: "Return an exit code of TRUE (0)"
17//usage:
18//usage:#define true_example_usage
19//usage: "$ true\n"
20//usage: "$ echo $?\n"
21//usage: "0\n"
22
13#include "libbb.h" 23#include "libbb.h"
14 24
15/* This is a NOFORK applet. Be very careful! */ 25/* 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 @@
10/* BB_AUDIT SUSv4 compliant */ 10/* BB_AUDIT SUSv4 compliant */
11/* http://www.opengroup.org/onlinepubs/9699919799/utilities/tty.html */ 11/* http://www.opengroup.org/onlinepubs/9699919799/utilities/tty.html */
12 12
13//usage:#define tty_trivial_usage
14//usage: ""
15//usage:#define tty_full_usage "\n\n"
16//usage: "Print file name of stdin's terminal"
17//usage: IF_INCLUDE_SUSv2( "\n"
18//usage: "\nOptions:"
19//usage: "\n -s Print nothing, only return exit status"
20//usage: )
21//usage:
22//usage:#define tty_example_usage
23//usage: "$ tty\n"
24//usage: "/dev/tty2\n"
25
13#include "libbb.h" 26#include "libbb.h"
14 27
15int tty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 28int 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 @@
48 * Fix handling of -a to not print "unknown", add -o and -i support. 48 * Fix handling of -a to not print "unknown", add -o and -i support.
49 */ 49 */
50 50
51//usage:#define uname_trivial_usage
52//usage: "[-amnrspv]"
53//usage:#define uname_full_usage "\n\n"
54//usage: "Print system information\n"
55//usage: "\nOptions:"
56//usage: "\n -a Print all"
57//usage: "\n -m The machine (hardware) type"
58//usage: "\n -n Hostname"
59//usage: "\n -r OS release"
60//usage: "\n -s OS name (default)"
61//usage: "\n -p Processor type"
62//usage: "\n -v OS version"
63//usage:
64//usage:#define uname_example_usage
65//usage: "$ uname -a\n"
66//usage: "Linux debian 2.4.23 #2 Tue Dec 23 17:09:10 MST 2003 i686 GNU/Linux\n"
67
51#include "libbb.h" 68#include "libbb.h"
52/* After libbb.h, since it needs sys/types.h on some systems */ 69/* After libbb.h, since it needs sys/types.h on some systems */
53#include <sys/utsname.h> 70#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 @@
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */
12 12
13//usage:#define uniq_trivial_usage
14//usage: "[-cdu][-f,s,w N] [INPUT [OUTPUT]]"
15//usage:#define uniq_full_usage "\n\n"
16//usage: "Discard duplicate lines\n"
17//usage: "\nOptions:"
18//usage: "\n -c Prefix lines by the number of occurrences"
19//usage: "\n -d Only print duplicate lines"
20//usage: "\n -u Only print unique lines"
21//usage: "\n -f N Skip first N fields"
22//usage: "\n -s N Skip first N chars (after any skipped fields)"
23//usage: "\n -w N Compare N characters in line"
24//usage:
25//usage:#define uniq_example_usage
26//usage: "$ echo -e \"a\\na\\nb\\nc\\nc\\na\" | sort | uniq\n"
27//usage: "a\n"
28//usage: "b\n"
29//usage: "c\n"
30
13#include "libbb.h" 31#include "libbb.h"
14 32
15int uniq_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 33int 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 @@
9 9
10/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */ 10/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
11 11
12//usage:#define usleep_trivial_usage
13//usage: "N"
14//usage:#define usleep_full_usage "\n\n"
15//usage: "Pause for N microseconds"
16//usage:
17//usage:#define usleep_example_usage
18//usage: "$ usleep 1000000\n"
19//usage: "[pauses for 1 second]\n"
20
12#include "libbb.h" 21#include "libbb.h"
13 22
14/* This is a NOFORK applet. Be very careful! */ 23/* 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 @@
10 * Bugs: the spec doesn't mention anything about "`\n`\n" prior to the 10 * Bugs: the spec doesn't mention anything about "`\n`\n" prior to the
11 * "end" line 11 * "end" line
12 */ 12 */
13
14//usage:#define uudecode_trivial_usage
15//usage: "[-o OUTFILE] [INFILE]"
16//usage:#define uudecode_full_usage "\n\n"
17//usage: "Uudecode a file\n"
18//usage: "Finds outfile name in uuencoded source unless -o is given"
19//usage:
20//usage:#define uudecode_example_usage
21//usage: "$ uudecode -o busybox busybox.uu\n"
22//usage: "$ ls -l busybox\n"
23//usage: "-rwxr-xr-x 1 ams ams 245264 Jun 7 21:35 busybox\n"
24
13#include "libbb.h" 25#include "libbb.h"
14 26
15#if ENABLE_UUDECODE 27#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 @@
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11//usage:#define uuencode_trivial_usage
12//usage: "[-m] [INFILE] STORED_FILENAME"
13//usage:#define uuencode_full_usage "\n\n"
14//usage: "Uuencode a file to stdout\n"
15//usage: "\nOptions:"
16//usage: "\n -m Use base64 encoding per RFC1521"
17//usage:
18//usage:#define uuencode_example_usage
19//usage: "$ uuencode busybox busybox\n"
20//usage: "begin 755 busybox\n"
21//usage: "<encoded file snipped>\n"
22//usage: "$ uudecode busybox busybox > busybox.uu\n"
23//usage: "$\n"
24
11#include "libbb.h" 25#include "libbb.h"
12 26
13enum { 27enum {
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 @@
18 */ 18 */
19/* BB_AUDIT SUSv3 _NOT_ compliant -- missing options -b, -d, -l, -m, -p, -q, -r, -s, -t, -T, -u; Missing argument 'file'. */ 19/* BB_AUDIT SUSv3 _NOT_ compliant -- missing options -b, -d, -l, -m, -p, -q, -r, -s, -t, -T, -u; Missing argument 'file'. */
20 20
21//usage:#define who_trivial_usage
22//usage: "[-a]"
23//usage:#define who_full_usage "\n\n"
24//usage: "Show who is logged on\n"
25//usage: "\nOptions:"
26//usage: "\n -a Show all"
27
21#include "libbb.h" 28#include "libbb.h"
22 29
23static void idle_string(char *str6, time_t t) 30static 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 @@
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11 11
12//usage:#define whoami_trivial_usage
13//usage: ""
14//usage:#define whoami_full_usage "\n\n"
15//usage: "Print the user name associated with the current effective user id"
16
12#include "libbb.h" 17#include "libbb.h"
13 18
14/* This is a NOFORK applet. Be very careful! */ 19/* This is a NOFORK applet. Be very careful! */