aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-02-22 01:15:47 +0000
committerEric Andersen <andersen@codepoet.org>2001-02-22 01:15:47 +0000
commit7e9276b50a7aa948b2b4fe093e4049bbece4699c (patch)
treed20a5e4a07ec079ffd40ee587b12a0b65fdf2eb4
parent8fc300976f5a06d98f8be3e1798b5bc8da868e02 (diff)
downloadbusybox-w32-7e9276b50a7aa948b2b4fe093e4049bbece4699c.tar.gz
busybox-w32-7e9276b50a7aa948b2b4fe093e4049bbece4699c.tar.bz2
busybox-w32-7e9276b50a7aa948b2b4fe093e4049bbece4699c.zip
Another update to the way usage messages are done by Evin Robertson
<nitfol@my-deja.com>, which makes things just a little bit smaller, but makes usage.h more readable/maintainable IMHO. -Erik
-rw-r--r--applets.h60
-rw-r--r--applets/usage.c10
-rw-r--r--applets/usage.h2586
-rw-r--r--busybox.h7
-rw-r--r--include/applets.h60
-rw-r--r--include/busybox.h7
-rw-r--r--include/usage.h2586
-rw-r--r--usage.c10
-rw-r--r--usage.h2586
-rw-r--r--utility.c22
10 files changed, 2641 insertions, 5293 deletions
diff --git a/applets.h b/applets.h
index cb744567a..446906cad 100644
--- a/applets.h
+++ b/applets.h
@@ -14,33 +14,33 @@
14#undef APPLET_ODDNAME 14#undef APPLET_ODDNAME
15#undef APPLET_NOUSAGE 15#undef APPLET_NOUSAGE
16 16
17
17#if defined(PROTOTYPES) 18#if defined(PROTOTYPES)
18#define APPLET(a,b,c) \ 19 #define APPLET(a,b,c) extern int b(int argc, char **argv);
19 extern int b(int argc, char **argv); 20 #define APPLET_NOUSAGE(a,b,c) extern int b(int argc, char **argv);
20#define APPLET_ODDNAME(a,b,c,d,e) APPLET(a,b,c) 21 #define APPLET_ODDNAME(a,b,c,d) extern int b(int argc, char **argv);
21#define APPLET_NOUSAGE(a,b,c) \ 22 extern const char usage_messages[];
22 extern int b(int argc, char **argv); 23#elif defined(MAKE_USAGE)
23#elif defined(MAKE_LINKS) 24 #ifdef BB_FEATURE_TRIVIAL_HELP
24#define APPLET(a,b,c) LINK c #a 25 #define APPLET(a,b,c) a##_trivial_usage "\0"
25#define APPLET_ODDNAME(a,b,c,d,e) LINK c a 26 #define APPLET_NOUSAGE(a,b,c) "\0"
26#define APPLET_NOUSAGE(a,b,c) LINK c #a 27 #define APPLET_ODDNAME(a,b,c,d) d##_trivial_usage "\0"
27#elif defined(APPLET_ENUM) 28 #else
28#define APPLET(a,b,c) a##_applet_number, 29 #define APPLET(a,b,c) a##_trivial_usage "\n\n" a##_full_usage "\0"
29#define APPLET_ODDNAME(a,b,c,d,e) e##_applet_number, 30 #define APPLET_NOUSAGE(a,b,c) "\0"
30#define APPLET_NOUSAGE(a,b,c) a##applet_number, 31 #define APPLET_ODDNAME(a,b,c,d) d##_trivial_usage "\n\n" d##_full_usage "\0"
32 #endif
31#else 33#else
32#define USAGE_ENUM 34 const struct BB_applet applets[] = {
33#include "usage.h" 35 #define APPLET(a,b,c) {#a,b,c},
34const struct BB_applet applets[] = { 36 #define APPLET_NOUSAGE(a,b,c) {a,b,c},
35#define APPLET(a,b,c) {#a,b,c,a##_usage_index}, 37 #define APPLET_ODDNAME(a,b,c,d) {a,b,c},
36#define APPLET_ODDNAME(a,b,c,d,e) {a,b,c,d},
37#define APPLET_NOUSAGE(a,b,c) {#a,b,c,-1},
38#define zcat_usage_index gunzip_usage_index
39#define sh_usage_index shell_usage_index
40#endif 38#endif
41 39
40
41
42#ifdef BB_TEST 42#ifdef BB_TEST
43 APPLET_ODDNAME("[", test_main, _BB_DIR_USR_BIN, test_usage_index, open_bracket) 43 APPLET_NOUSAGE("[", test_main, _BB_DIR_USR_BIN)
44#endif 44#endif
45#ifdef BB_AR 45#ifdef BB_AR
46 APPLET(ar, ar_main, _BB_DIR_USR_BIN) 46 APPLET(ar, ar_main, _BB_DIR_USR_BIN)
@@ -48,7 +48,7 @@ const struct BB_applet applets[] = {
48#ifdef BB_BASENAME 48#ifdef BB_BASENAME
49 APPLET(basename, basename_main, _BB_DIR_USR_BIN) 49 APPLET(basename, basename_main, _BB_DIR_USR_BIN)
50#endif 50#endif
51 APPLET_NOUSAGE(busybox, busybox_main, _BB_DIR_BIN) 51 APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN)
52#ifdef BB_CAT 52#ifdef BB_CAT
53 APPLET(cat, cat_main, _BB_DIR_BIN) 53 APPLET(cat, cat_main, _BB_DIR_BIN)
54#endif 54#endif
@@ -107,7 +107,7 @@ const struct BB_applet applets[] = {
107 APPLET(dpkg, dpkg_main, _BB_DIR_USR_BIN) 107 APPLET(dpkg, dpkg_main, _BB_DIR_USR_BIN)
108#endif 108#endif
109#ifdef BB_DPKG_DEB 109#ifdef BB_DPKG_DEB
110 APPLET_ODDNAME("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb_usage_index, dpkg_deb) 110 APPLET_ODDNAME("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb)
111#endif 111#endif
112#ifdef BB_DU 112#ifdef BB_DU
113 APPLET(du, du_main, _BB_DIR_USR_BIN) 113 APPLET(du, du_main, _BB_DIR_USR_BIN)
@@ -128,7 +128,7 @@ const struct BB_applet applets[] = {
128 APPLET(false, false_main, _BB_DIR_BIN) 128 APPLET(false, false_main, _BB_DIR_BIN)
129#endif 129#endif
130#ifdef BB_FBSET 130#ifdef BB_FBSET
131 APPLET_NOUSAGE(fbset, fbset_main, _BB_DIR_USR_SBIN) 131 APPLET_NOUSAGE("fbset", fbset_main, _BB_DIR_USR_SBIN)
132#endif 132#endif
133#ifdef BB_FDFLUSH 133#ifdef BB_FDFLUSH
134 APPLET(fdflush, fdflush_main, _BB_DIR_BIN) 134 APPLET(fdflush, fdflush_main, _BB_DIR_BIN)
@@ -143,7 +143,7 @@ const struct BB_applet applets[] = {
143 APPLET(freeramdisk, freeramdisk_main, _BB_DIR_SBIN) 143 APPLET(freeramdisk, freeramdisk_main, _BB_DIR_SBIN)
144#endif 144#endif
145#ifdef BB_FSCK_MINIX 145#ifdef BB_FSCK_MINIX
146 APPLET_ODDNAME("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage_index, fsck_minix) 146 APPLET_ODDNAME("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix)
147#endif 147#endif
148#ifdef BB_GETOPT 148#ifdef BB_GETOPT
149 APPLET(getopt, getopt_main, _BB_DIR_BIN) 149 APPLET(getopt, getopt_main, _BB_DIR_BIN)
@@ -191,7 +191,7 @@ const struct BB_applet applets[] = {
191 APPLET(length, length_main, _BB_DIR_USR_BIN) 191 APPLET(length, length_main, _BB_DIR_USR_BIN)
192#endif 192#endif
193#ifdef BB_LINUXRC 193#ifdef BB_LINUXRC
194 APPLET_NOUSAGE(linuxrc, init_main, _BB_DIR_ROOT) 194 APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT)
195#endif 195#endif
196#ifdef BB_LN 196#ifdef BB_LN
197 APPLET(ln, ln_main, _BB_DIR_BIN) 197 APPLET(ln, ln_main, _BB_DIR_BIN)
@@ -230,7 +230,7 @@ const struct BB_applet applets[] = {
230 APPLET(mkfifo, mkfifo_main, _BB_DIR_USR_BIN) 230 APPLET(mkfifo, mkfifo_main, _BB_DIR_USR_BIN)
231#endif 231#endif
232#ifdef BB_MKFS_MINIX 232#ifdef BB_MKFS_MINIX
233 APPLET_ODDNAME("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage_index, mkfs_minix) 233 APPLET_ODDNAME("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix)
234#endif 234#endif
235#ifdef BB_MKNOD 235#ifdef BB_MKNOD
236 APPLET(mknod, mknod_main, _BB_DIR_BIN) 236 APPLET(mknod, mknod_main, _BB_DIR_BIN)
@@ -416,8 +416,8 @@ const struct BB_applet applets[] = {
416 APPLET(zcat, gunzip_main, _BB_DIR_BIN) 416 APPLET(zcat, gunzip_main, _BB_DIR_BIN)
417#endif 417#endif
418 418
419#if !defined(PROTOTYPES) && !defined(MAKE_LINKS) && !defined(APPLET_ENUM) 419#if !defined(PROTOTYPES) && !defined(MAKE_USAGE)
420 { 0,NULL,0,-1} 420 { 0,NULL,0 }
421}; 421};
422 422
423/* The -1 arises because of the {0,NULL,0,-1} entry above. */ 423/* The -1 arises because of the {0,NULL,0,-1} entry above. */
diff --git a/applets/usage.c b/applets/usage.c
index e429c5a4e..dfea1f96b 100644
--- a/applets/usage.c
+++ b/applets/usage.c
@@ -1,2 +1,10 @@
1#define USAGE_MESSAGES 1#include "busybox.h"
2
3const char usage_messages[] =
4
5#define MAKE_USAGE
2#include "usage.h" 6#include "usage.h"
7
8#include "applets.h"
9
10;
diff --git a/applets/usage.h b/applets/usage.h
index 7c7318595..b39fec924 100644
--- a/applets/usage.h
+++ b/applets/usage.h
@@ -1,2049 +1,1165 @@
1#include "Config.h" 1#define ar_trivial_usage \
2
3extern const char usage_messages[];
4
5#if defined USAGE_ENUM
6enum
7#elif defined USAGE_MESSAGES
8const char usage_messages[] =
9#endif
10
11#if defined USAGE_ENUM || defined USAGE_MESSAGES
12{
13#endif
14
15#if defined USAGE_ENUM
16#define DO_COMMA ,
17#elif defined USAGE_MESSAGES
18#define DO_COMMA "\0"
19#else
20#define DO_COMMA
21#endif
22
23
24#if defined BB_AR
25#if defined USAGE_ENUM
26ar_usage_index
27#elif defined USAGE_MESSAGES
28 "-[ovR]{ptx} archive filenames" 2 "-[ovR]{ptx} archive filenames"
29#ifndef BB_FEATURE_TRIVIAL_HELP 3#define ar_full_usage \
30 "\n\nExtract or list files from an ar archive.\n\n" 4 "Extract or list files from an ar archive.\n\n" \
31 "Options:\n" 5 "Options:\n" \
32 "\t-o\t\tpreserve original dates\n" 6 "\t-o\t\tpreserve original dates\n" \
33 "\t-p\t\textract to stdout\n" 7 "\t-p\t\textract to stdout\n" \
34 "\t-t\t\tlist\n" 8 "\t-t\t\tlist\n" \
35 "\t-x\t\textract\n" 9 "\t-x\t\textract\n" \
36 "\t-v\t\tverbosely list files processed\n" 10 "\t-v\t\tverbosely list files processed\n" \
37 "\t-R\t\trecursive action" 11 "\t-R\t\trecursive action"
38#endif
39#endif
40DO_COMMA
41#endif
42 12
43#if defined BB_BASENAME 13#define basename_trivial_usage \
44#if defined USAGE_ENUM
45basename_usage_index
46#elif defined USAGE_MESSAGES
47 "FILE [SUFFIX]" 14 "FILE [SUFFIX]"
48#ifndef BB_FEATURE_TRIVIAL_HELP 15#define basename_full_usage \
49 "\n\nStrips directory path and suffixes from FILE.\n" 16 "Strips directory path and suffixes from FILE.\n" \
50 "If specified, also removes any trailing SUFFIX." 17 "If specified, also removes any trailing SUFFIX."
51#endif
52#endif
53DO_COMMA
54#endif
55 18
56#if defined BB_CAT 19#define cat_trivial_usage \
57#if defined USAGE_ENUM
58cat_usage_index
59#elif defined USAGE_MESSAGES
60 "[FILE]..." 20 "[FILE]..."
61#ifndef BB_FEATURE_TRIVIAL_HELP 21#define cat_full_usage \
62 "\n\nConcatenates FILE(s) and prints them to stdout." 22 "Concatenates FILE(s) and prints them to stdout."
63#endif
64#endif
65DO_COMMA
66#endif
67 23
68#if defined BB_CHMOD_CHOWN_CHGRP 24#define chgrp_trivial_usage \
69#if defined USAGE_ENUM
70chgrp_usage_index
71#elif defined USAGE_MESSAGES
72 "[OPTION]... GROUP FILE..." 25 "[OPTION]... GROUP FILE..."
73#ifndef BB_FEATURE_TRIVIAL_HELP 26#define chgrp_full_usage \
74 "\n\nChange the group membership of each FILE to GROUP.\n" 27 "Change the group membership of each FILE to GROUP.\n" \
75 "\nOptions:\n\t-R\tChanges files and directories recursively." 28 "\nOptions:\n\t-R\tChanges files and directories recursively."
76#endif
77#endif
78DO_COMMA
79#endif
80 29
81#if defined BB_CHMOD_CHOWN_CHGRP 30#define chmod_trivial_usage \
82#if defined USAGE_ENUM
83chmod_usage_index
84#elif defined USAGE_MESSAGES
85 "[-R] MODE[,MODE]... FILE..." 31 "[-R] MODE[,MODE]... FILE..."
86#ifndef BB_FEATURE_TRIVIAL_HELP 32#define chmod_full_usage \
87 "\n\nEach MODE is one or more of the letters ugoa, one of the symbols +-= and\n" 33 "Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n" \
88 "one or more of the letters rwxst.\n\n" 34 "one or more of the letters rwxst.\n\n" \
89 "Options:\n\t-R\tChanges files and directories recursively." 35 "Options:\n\t-R\tChanges files and directories recursively."
90#endif
91#endif
92DO_COMMA
93#endif
94 36
95#if defined BB_CHMOD_CHOWN_CHGRP 37#define chown_trivial_usage \
96#if defined USAGE_ENUM
97chown_usage_index
98#elif defined USAGE_MESSAGES
99 "[OPTION]... OWNER[<.|:>[GROUP] FILE..." 38 "[OPTION]... OWNER[<.|:>[GROUP] FILE..."
100#ifndef BB_FEATURE_TRIVIAL_HELP 39#define chown_full_usage \
101 "\n\nChange the owner and/or group of each FILE to OWNER and/or GROUP.\n" 40 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" \
102 "\nOptions:\n\t-R\tChanges files and directories recursively." 41 "\nOptions:\n\t-R\tChanges files and directories recursively."
103#endif
104#endif
105DO_COMMA
106#endif
107 42
108#if defined BB_CHROOT 43#define chroot_trivial_usage \
109#if defined USAGE_ENUM
110chroot_usage_index
111#elif defined USAGE_MESSAGES
112 "NEWROOT [COMMAND...]" 44 "NEWROOT [COMMAND...]"
113#ifndef BB_FEATURE_TRIVIAL_HELP 45#define chroot_full_usage \
114 "\n\nRun COMMAND with root directory set to NEWROOT." 46 "Run COMMAND with root directory set to NEWROOT."
115#endif
116#endif
117DO_COMMA
118#endif
119 47
120#if defined BB_CHVT 48#define chvt_trivial_usage \
121#if defined USAGE_ENUM
122chvt_usage_index
123#elif defined USAGE_MESSAGES
124 "N" 49 "N"
125#ifndef BB_FEATURE_TRIVIAL_HELP 50#define chvt_full_usage \
126 "\n\nChanges the foreground virtual terminal to /dev/ttyN" 51 "Changes the foreground virtual terminal to /dev/ttyN"
127#endif
128#endif
129DO_COMMA
130#endif
131 52
132#if defined BB_CLEAR 53#define clear_trivial_usage \
133#if defined USAGE_ENUM
134clear_usage_index
135#elif defined USAGE_MESSAGES
136 "" 54 ""
137#ifndef BB_FEATURE_TRIVIAL_HELP 55#define clear_full_usage \
138 "\n\nClear screen." 56 "Clear screen."
139#endif
140#endif
141DO_COMMA
142#endif
143 57
144#if defined BB_CMP 58#define cmp_trivial_usage \
145#if defined USAGE_ENUM
146cmp_usage_index
147#elif defined USAGE_MESSAGES
148 "FILE1 [FILE2]" 59 "FILE1 [FILE2]"
149#ifndef BB_FEATURE_TRIVIAL_HELP 60#define cmp_full_usage \
150 "\n\nCompare files." 61 "Compare files."
151#endif
152#endif
153DO_COMMA
154#endif
155 62
156#if defined BB_CP_MV 63#define cp_trivial_usage \
157#if defined USAGE_ENUM
158cp_usage_index
159#elif defined USAGE_MESSAGES
160 "[OPTION]... SOURCE DEST\n" 64 "[OPTION]... SOURCE DEST\n"
161 " or: cp [OPTION]... SOURCE... DIRECTORY" 65#define cp_full_usage \
162#ifndef BB_FEATURE_TRIVIAL_HELP 66 "Copies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" \
163 "\n\nCopies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" 67 "\n" \
164 "\n" 68 "\t-a\tSame as -dpR\n" \
165 "\t-a\tSame as -dpR\n" 69 "\t-d\tPreserves links\n" \
166 "\t-d\tPreserves links\n" 70 "\t-p\tPreserves file attributes if possible\n" \
167 "\t-p\tPreserves file attributes if possible\n" 71 "\t-f\tforce (implied; ignored) - always set\n" \
168 "\t-f\tforce (implied; ignored) - always set\n"
169 "\t-R\tCopies directories recursively" 72 "\t-R\tCopies directories recursively"
170#endif
171#endif
172DO_COMMA
173#endif
174 73
175#if defined BB_CUT 74#define cut_trivial_usage \
176#if defined USAGE_ENUM
177cut_usage_index
178#elif defined USAGE_MESSAGES
179 "[OPTION]... [FILE]..." 75 "[OPTION]... [FILE]..."
180#ifndef BB_FEATURE_TRIVIAL_HELP 76#define cut_full_usage \
181 "\n\nPrints selected fields from each input FILE to standard output.\n\n" 77 "Prints selected fields from each input FILE to standard output.\n\n" \
182 "Options:\n" 78 "Options:\n" \
183 "\t-b LIST\tOutput only bytes from LIST\n" 79 "\t-b LIST\tOutput only bytes from LIST\n" \
184 "\t-c LIST\tOutput only characters from LIST\n" 80 "\t-c LIST\tOutput only characters from LIST\n" \
185 "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n" 81 "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n" \
186 "\t-s\tOutput only the lines containing delimiter\n" 82 "\t-s\tOutput only the lines containing delimiter\n" \
187 "\t-f N\tPrint only these fields\n" 83 "\t-f N\tPrint only these fields\n" \
188 "\t-n\tIgnored" 84 "\t-n\tIgnored"
189#endif
190#endif
191DO_COMMA
192#endif
193 85
194#if defined BB_DATE 86#define date_trivial_usage \
195#if defined USAGE_ENUM
196date_usage_index
197#elif defined USAGE_MESSAGES
198 "[OPTION]... [+FORMAT]\n" 87 "[OPTION]... [+FORMAT]\n"
199 " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]" 88#define date_full_usage \
200#ifndef BB_FEATURE_TRIVIAL_HELP 89 "Displays the current time in the given FORMAT, or sets the system date.\n" \
201 "\n\nDisplays the current time in the given FORMAT, or sets the system date.\n" 90 "\nOptions:\n\t-R\t\tOutputs RFC-822 compliant date string\n" \
202 "\nOptions:\n\t-R\t\tOutputs RFC-822 compliant date string\n" 91 "\t-d STRING\tdisplay time described by STRING, not `now'\n" \
203 "\t-d STRING\tdisplay time described by STRING, not `now'\n" 92 "\t-s\t\tSets time described by STRING\n" \
204 "\t-s\t\tSets time described by STRING\n"
205 "\t-u\t\tPrints or sets Coordinated Universal Time" 93 "\t-u\t\tPrints or sets Coordinated Universal Time"
206#endif
207#endif
208DO_COMMA
209#endif
210 94
211#if defined BB_DC 95#define dc_trivial_usage \
212#if defined USAGE_ENUM
213dc_usage_index
214#elif defined USAGE_MESSAGES
215 "expression ..." 96 "expression ..."
216#ifndef BB_FEATURE_TRIVIAL_HELP 97#define dc_full_usage \
217 "\n\nThis is a Tiny RPN calculator that understands the\n" 98 "This is a Tiny RPN calculator that understands the\n" \
218 "following operations: +, -, /, *, and, or, not, eor.\n" 99 "following operations: +, -, /, *, and, or, not, eor.\n" \
219 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16" 100 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16"
220#endif
221#endif
222DO_COMMA
223#endif
224 101
225#if defined BB_DD 102#define dd_trivial_usage \
226#if defined USAGE_ENUM 103 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N] [seek=N] [conv=notrunc|sync]"
227dd_usage_index 104#define dd_full_usage \
228#elif defined USAGE_MESSAGES 105 "Copy a file, converting and formatting according to options\n\n" \
229 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N] [seek=N]\n" 106 "\tif=FILE\tread from FILE instead of stdin\n" \
230 "\t [conv=notrunc|sync]" 107 "\tof=FILE\twrite to FILE instead of stdout\n" \
231#ifndef BB_FEATURE_TRIVIAL_HELP 108 "\tbs=N\tread and write N bytes at a time\n" \
232 "\n\nCopy a file, converting and formatting according to options\n\n" 109 "\tcount=N\tcopy only N input blocks\n" \
233 "\tif=FILE\t\tread from FILE instead of stdin\n" 110 "\tskip=N\tskip N input blocks\n" \
234 "\tof=FILE\t\twrite to FILE instead of stdout\n" 111 "\tseek=N\tskip N output blocks\n" \
235 "\tbs=N\t\tread and write N bytes at a time\n" 112 "\tconv=notrunc\tdon't truncate output file\n" \
236 "\tcount=N\t\tcopy only N input blocks\n" 113 "\tconv=sync\tpad blocks with zeros\n" \
237 "\tskip=N\t\tskip N input blocks\n" 114 "\n" \
238 "\tseek=N\t\tskip N output blocks\n" 115 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \
239 "\tconv=notrunc\tdon't truncate output file\n"
240 "\tconv=sync\tpad blocks with zeros\n"
241 "\n"
242 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n"
243 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)." 116 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)."
244#endif
245#endif
246DO_COMMA
247#endif
248 117
249#if defined BB_DEALLOCVT 118#define deallocvt_trivial_usage \
250#if defined USAGE_ENUM
251deallocvt_usage_index
252#elif defined USAGE_MESSAGES
253 "N" 119 "N"
254#ifndef BB_FEATURE_TRIVIAL_HELP 120#define deallocvt_full_usage \
255 "\n\nDeallocate unused virtual terminal /dev/ttyN" 121 "Deallocate unused virtual terminal /dev/ttyN"
256#endif 122
257#endif
258DO_COMMA
259#endif
260 123
261#if defined BB_DF
262#if defined USAGE_ENUM
263df_usage_index
264#elif defined USAGE_MESSAGES
265 "[-"
266#ifdef BB_FEATURE_HUMAN_READABLE
267 "hm"
268#endif
269 "k] [filesystem ...]"
270#ifndef BB_FEATURE_TRIVIAL_HELP
271 "\n\nPrint the filesystem space used and space available\n\n"
272 "Options:\n"
273#ifdef BB_FEATURE_HUMAN_READABLE 124#ifdef BB_FEATURE_HUMAN_READABLE
274 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G)\n" 125 #define USAGE_HUMAN_READABLE(a,b) a
275 "\t-m\tprint sizes in megabytes\n"
276 "\t-k\tprint sizes in kilobytes(default)"
277#else 126#else
278 "\n\t-k\tprint sizes in kilobytes(compatability)" 127 #define USAGE_HUMAN_READABLE(a,b) b
279#endif 128#endif
280#endif 129#define df_trivial_usage \
281#endif 130 "[-" \
282DO_COMMA 131 USAGE_HUMAN_READABLE("hm", "") \
283#endif 132 "k] [filesystem ...]\n"
284 133#define df_full_usage \
285#if defined BB_DIRNAME 134 "Print the filesystem space used and space available.\n\n" \
286#if defined USAGE_ENUM 135 "Options:\n" \
287dirname_usage_index 136USAGE_HUMAN_READABLE( \
288#elif defined USAGE_MESSAGES 137 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
138 "\t-m\tprint sizes in megabytes\n" \
139 "\t-k\tprint sizes in kilobytes(default)", \
140 "\n\t-k\tprint sizes in kilobytes(compatability)")
141
142#define dirname_trivial_usage \
289 "[FILENAME ...]" 143 "[FILENAME ...]"
290#ifndef BB_FEATURE_TRIVIAL_HELP 144#define dirname_full_usage \
291 "\n\nStrips non-directory suffix from FILENAME" 145 "Strips non-directory suffix from FILENAME"
292#endif
293#endif
294DO_COMMA
295#endif
296 146
297#if defined BB_DMESG 147#define dmesg_trivial_usage \
298#if defined USAGE_ENUM
299dmesg_usage_index
300#elif defined USAGE_MESSAGES
301 "[-c] [-n LEVEL] [-s SIZE]" 148 "[-c] [-n LEVEL] [-s SIZE]"
302#ifndef BB_FEATURE_TRIVIAL_HELP 149#define dmesg_full_usage \
303 "\n\nPrints or controls the kernel ring buffer\n\n" 150 "Prints or controls the kernel ring buffer\n\n" \
304 "Options:\n" 151 "Options:\n" \
305 "\t-c\t\tClears the ring buffer's contents after printing\n" 152 "\t-c\t\tClears the ring buffer's contents after printing\n" \
306 "\t-n LEVEL\tSets console logging level\n" 153 "\t-n LEVEL\tSets console logging level\n" \
307 "\t-s SIZE\t\tUse a buffer of size SIZE" 154 "\t-s SIZE\t\tUse a buffer of size SIZE"
308#endif
309#endif
310DO_COMMA
311#endif
312 155
313#if defined BB_DOS2UNIX 156#define dos2unix_trivial_usage \
314#if defined USAGE_ENUM
315dos2unix_usage_index
316#elif defined USAGE_MESSAGES
317 "< dosfile > unixfile" 157 "< dosfile > unixfile"
318#ifndef BB_FEATURE_TRIVIAL_HELP 158#define dos2unix_full_usage \
319 "\n\nConverts a text file from dos format to unix format." 159 "Converts a text file from dos format to unix format."
320#endif
321#endif
322DO_COMMA
323#endif
324 160
325#if defined BB_DPKG 161#define dpkg_trivial_usage \
326#if defined USAGE_ENUM 162 "[-i|-r|--unpack|--configure] my.deb"
327dpkg_usage_index 163#define dpkg_full_usage \
328#elif defined USAGE_MESSAGES
329 "<-i|-r|--unpack|--configure> my.deb\n"
330 "WORK IN PROGRESS, only usefull for debian-installer" 164 "WORK IN PROGRESS, only usefull for debian-installer"
331#ifndef BB_FEATURE_TRIVIAL_HELP
332#endif
333#endif
334DO_COMMA
335#endif
336 165
337#if defined BB_DPKG_DEB 166#define dpkg_deb_trivial_usage \
338#if defined USAGE_ENUM
339dpkg_deb_usage_index
340#elif defined USAGE_MESSAGES
341 "[-cexX] file directory" 167 "[-cexX] file directory"
342#ifndef BB_FEATURE_TRIVIAL_HELP 168#define dpkg_deb_full_usage \
343 "\n\nPerform actions on debian packages (.debs)\n\n" 169 "Perform actions on debian packages (.debs)\n\n" \
344 "Options:\n" 170 "Options:\n" \
345 "\t-c\tList contents of filesystem tree (verbose)\n" 171 "\t-c\tList contents of filesystem tree (verbose)\n" \
346 "\t-l\tList contents of filesystem tree (.list format)\n" 172 "\t-l\tList contents of filesystem tree (.list format)\n" \
347 "\t-e\tExtract control files to directory\n" 173 "\t-e\tExtract control files to directory\n" \
348 "\t-x\tExctract packages filesystem tree to directory\n" 174 "\t-x\tExctract packages filesystem tree to directory\n" \
349 "\t-X\tVerbose extract" 175 "\t-X\tVerbose extract"
350#endif
351#endif
352DO_COMMA
353#endif
354 176
355#if defined BB_DU 177#define du_trivial_usage \
356#if defined USAGE_ENUM 178 "[-ls" USAGE_HUMAN_READABLE("hm", "") "k] [FILE]..."
357du_usage_index 179#define du_full_usage \
358#elif defined USAGE_MESSAGES 180 "Summarizes disk space used for each FILE and/or directory.\n" \
359 "[-ls" 181 "Disk space is printed in units of 1024 bytes.\n\n" \
360#ifdef BB_FEATURE_HUMAN_READABLE 182 "Options:\n" \
361 "hm" 183 "\t-l\tcount sizes many times if hard linked\n" \
362#endif 184 "\t-s\tdisplay only a total for each argument" \
363 "k] [FILE]..." 185USAGE_HUMAN_READABLE( \
364#ifndef BB_FEATURE_TRIVIAL_HELP 186 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
365 "\n\nSummarizes disk space used for each FILE and/or directory.\n" 187 "\t-m\tprint sizes in megabytes\n" \
366 "Disk space is printed in units of 1024 bytes.\n\n" 188 "\t-k\tprint sizes in kilobytes(default)" \
367 "Options:\n" 189 , \
368 "\t-l\tcount sizes many times if hard linked\n" 190 "\n\t-k\tprint sizes in kilobytes(compatability)" \
369 "\t-s\tdisplay only a total for each argument" 191 )
370#ifdef BB_FEATURE_HUMAN_READABLE 192
371 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G)\n" 193#define dumpkmap_trivial_usage \
372 "\t-m\tprint sizes in megabytes\n"
373 "\t-k\tprint sizes in kilobytes(default)"
374#else
375 "\n\t-k\tprint sizes in kilobytes(compatability)"
376#endif
377#endif
378#endif
379DO_COMMA
380#endif
381
382#if defined BB_DUMPKMAP
383#if defined USAGE_ENUM
384dumpkmap_usage_index
385#elif defined USAGE_MESSAGES
386 "> keymap" 194 "> keymap"
387#ifndef BB_FEATURE_TRIVIAL_HELP 195#define dumpkmap_full_usage \
388 "\n\nPrints out a binary keyboard translation table to standard output" 196 "Prints out a binary keyboard translation table to standard output."
389#endif
390#endif
391DO_COMMA
392#endif
393 197
394#if defined BB_DUTMP 198#define dutmp_trivial_usage \
395#if defined USAGE_ENUM
396dutmp_usage_index
397#elif defined USAGE_MESSAGES
398 "[FILE]" 199 "[FILE]"
399#ifndef BB_FEATURE_TRIVIAL_HELP 200#define dutmp_full_usage \
400 "\n\nDump utmp file format (pipe delimited) from FILE\n" 201 "Dump utmp file format (pipe delimited) from FILE\n" \
401 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')" 202 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')"
402#endif
403#endif
404DO_COMMA
405#endif
406 203
407#if defined BB_ECHO 204#define echo_trivial_usage \
408#if defined USAGE_ENUM
409echo_usage_index
410#elif defined USAGE_MESSAGES
411 "[-neE] [ARG ...]" 205 "[-neE] [ARG ...]"
412#ifndef BB_FEATURE_TRIVIAL_HELP 206#define echo_full_usage \
413 "\n\nPrints the specified ARGs to stdout\n\n" 207 "Prints the specified ARGs to stdout\n\n" \
414 "Options:\n" 208 "Options:\n" \
415 "\t-n\tsuppress trailing newline\n" 209 "\t-n\tsuppress trailing newline\n" \
416 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" 210 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" \
417 "\t-E\tdisable interpretation of backslash-escaped characters" 211 "\t-E\tdisable interpretation of backslash-escaped characters"
418#endif
419#endif
420DO_COMMA
421#endif
422 212
423#if defined BB_EXPR 213#define expr_trivial_usage \
424#if defined USAGE_ENUM
425expr_usage_index
426#elif defined USAGE_MESSAGES
427 "EXPRESSION" 214 "EXPRESSION"
428#ifndef BB_FEATURE_TRIVIAL_HELP 215#define expr_full_usage \
429"\n\nPrints the value of EXPRESSION to standard output.\n\n" 216 "Prints the value of EXPRESSION to standard output.\n\n" \
430"EXPRESSION may be:\n" 217 "EXPRESSION may be:\n" \
431"ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n" 218 "ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n" \
432"ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n" 219 "ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n" \
433"ARG1 < ARG2 ARG1 is less than ARG2\n" 220 "ARG1 < ARG2 ARG1 is less than ARG2\n" \
434"ARG1 <= ARG2 ARG1 is less than or equal to ARG2\n" 221 "ARG1 <= ARG2 ARG1 is less than or equal to ARG2\n" \
435"ARG1 = ARG2 ARG1 is equal to ARG2\n" 222 "ARG1 = ARG2 ARG1 is equal to ARG2\n" \
436"ARG1 != ARG2 ARG1 is unequal to ARG2\n" 223 "ARG1 != ARG2 ARG1 is unequal to ARG2\n" \
437"ARG1 >= ARG2 ARG1 is greater than or equal to ARG2\n" 224 "ARG1 >= ARG2 ARG1 is greater than or equal to ARG2\n" \
438"ARG1 > ARG2 ARG1 is greater than ARG2\n" 225 "ARG1 > ARG2 ARG1 is greater than ARG2\n" \
439"ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n" 226 "ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n" \
440"ARG1 - ARG2 arithmetic difference of ARG1 and ARG2\n" 227 "ARG1 - ARG2 arithmetic difference of ARG1 and ARG2\n" \
441"ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n" 228 "ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n" \
442"ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2\n" 229 "ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2\n" \
443"ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2\n" 230 "ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2\n" \
444"STRING : REGEXP anchored pattern match of REGEXP in STRING\n" 231 "STRING : REGEXP anchored pattern match of REGEXP in STRING\n" \
445"match STRING REGEXP same as STRING : REGEXP\n" 232 "match STRING REGEXP same as STRING : REGEXP\n" \
446"substr STRING POS LENGTH substring of STRING, POS counted from 1\n" 233 "substr STRING POS LENGTH substring of STRING, POS counted from 1\n" \
447"index STRING CHARS index in STRING where any CHARS is found, or 0\n" 234 "index STRING CHARS index in STRING where any CHARS is found, or 0\n" \
448"length STRING length of STRING\n" 235 "length STRING length of STRING\n" \
449"quote TOKEN interpret TOKEN as a string, even if it is a \n" 236 "quote TOKEN interpret TOKEN as a string, even if it is a \n" \
450" keyword like `match' or an operator like `/'\n" 237 " keyword like `match' or an operator like `/'\n" \
451"( EXPRESSION ) value of EXPRESSION\n\n" 238 "( EXPRESSION ) value of EXPRESSION\n\n" \
452"Beware that many operators need to be escaped or quoted for shells.\n" 239 "Beware that many operators need to be escaped or quoted for shells.\n" \
453"Comparisons are arithmetic if both ARGs are numbers, else\n" 240 "Comparisons are arithmetic if both ARGs are numbers, else\n" \
454"lexicographical. Pattern matches return the string matched between \n" 241 "lexicographical. Pattern matches return the string matched between \n" \
455"\\( and \\) or null; if \\( and \\) are not used, they return the number \n" 242 "\\( and \\) or null; if \\( and \\) are not used, they return the number \n" \
456"of characters matched or 0." 243 "of characters matched or 0."
457 244
458#endif 245#define false_trivial_usage \
459#endif
460DO_COMMA
461#endif
462
463
464#if defined BB_TRUE_FALSE
465#if defined USAGE_ENUM
466false_usage_index
467#elif defined USAGE_MESSAGES
468 "" 246 ""
469#ifndef BB_FEATURE_TRIVIAL_HELP 247#define false_full_usage \
470 "\n\nReturn an exit code of FALSE (1)." 248 "Return an exit code of FALSE (1)."
471#endif
472#endif
473DO_COMMA
474#endif
475 249
476#if defined BB_FBSET 250#define fdflush_trivial_usage \
477#if defined USAGE_ENUM
478fbset_usage_index
479#elif defined USAGE_MESSAGES
480 "fbset [options] [mode]"
481#ifndef BB_FEATURE_TRIVIAL_HELP
482 "\n\nShows and modifies frame buffer device settings"
483#endif
484#endif
485DO_COMMA
486#endif
487
488#if defined BB_FDFLUSH
489#if defined USAGE_ENUM
490fdflush_usage_index
491#elif defined USAGE_MESSAGES
492 "DEVICE" 251 "DEVICE"
493#ifndef BB_FEATURE_TRIVIAL_HELP 252#define fdflush_full_usage \
494 "\n\nForces floppy disk drive to detect disk change" 253 "Forces floppy disk drive to detect disk change"
495#endif
496#endif
497DO_COMMA
498#endif
499 254
500#if defined BB_FIND
501#if defined USAGE_ENUM
502find_usage_index
503#elif defined USAGE_MESSAGES
504 "[PATH...] [EXPRESSION]"
505#ifndef BB_FEATURE_TRIVIAL_HELP
506 "\n\nSearch for files in a directory hierarchy. The default PATH is\n"
507 "the current directory; default EXPRESSION is '-print'\n\n"
508 "\nEXPRESSION may consist of:\n"
509 "\t-follow\t\tDereference symbolic links.\n"
510 "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN."
511#ifdef BB_FEATURE_FIND_TYPE 255#ifdef BB_FEATURE_FIND_TYPE
512 "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" 256 #define USAGE_FIND_TYPE(a) a
257#else
258 #define USAGE_FIND_TYPE(a)
513#endif 259#endif
514#ifdef BB_FEATURE_FIND_PERM 260#ifdef BB_FEATURE_FIND_PERM
515 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" 261 #define USAGE_FIND_PERM(a) a
262#else
263 #define USAGE_FIND_PERM(a)
516#endif 264#endif
517#ifdef BB_FEATURE_FIND_MTIME 265#ifdef BB_FEATURE_FIND_MTIME
518 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days" 266 #define USAGE_FIND_MTIME(a) a
519#endif 267#else
520#endif 268 #define USAGE_FIND_MTIME(a)
521#endif
522DO_COMMA
523#endif 269#endif
524 270
525#if defined BB_FREE 271#define find_trivial_usage \
526#if defined USAGE_ENUM 272 "[PATH...] [EXPRESSION]"
527free_usage_index 273#define find_full_usage \
528#elif defined USAGE_MESSAGES 274 "Search for files in a directory hierarchy. The default PATH is\n" \
275 "the current directory; default EXPRESSION is '-print'\n\n" \
276 "\nEXPRESSION may consist of:\n" \
277 "\t-follow\t\tDereference symbolic links.\n" \
278 "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN." \
279USAGE_FIND_TYPE( \
280 "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" \
281) USAGE_FIND_PERM( \
282 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \
283) USAGE_FIND_MTIME( \
284 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days")
285
286#define free_trivial_usage \
529 "" 287 ""
530#ifndef BB_FEATURE_TRIVIAL_HELP 288#define free_full_usage \
531 "\n\nDisplays the amount of free and used system memory" 289 "Displays the amount of free and used system memory"
532#endif
533#endif
534DO_COMMA
535#endif
536 290
537#if defined BB_FREERAMDISK 291#define freeramdisk_trivial_usage \
538#if defined USAGE_ENUM
539freeramdisk_usage_index
540#elif defined USAGE_MESSAGES
541 "DEVICE" 292 "DEVICE"
542#ifndef BB_FEATURE_TRIVIAL_HELP 293#define freeramdisk_full_usage \
543 "\n\nFrees all memory used by the specified ramdisk." 294 "Frees all memory used by the specified ramdisk."
544#endif
545#endif
546DO_COMMA
547#endif
548 295
549#if defined BB_FSCK_MINIX 296#define fsck_minix_trivial_usage \
550#if defined USAGE_ENUM
551fsck_minix_usage_index
552#elif defined USAGE_MESSAGES
553 "[-larvsmf] /dev/name" 297 "[-larvsmf] /dev/name"
554#ifndef BB_FEATURE_TRIVIAL_HELP 298#define fsck_minix_full_usage \
555 "\n\nPerforms a consistency check for MINIX filesystems.\n\n" 299 "Performs a consistency check for MINIX filesystems.\n\n" \
556 "Options:\n" 300 "Options:\n" \
557 "\t-l\tLists all filenames\n" 301 "\t-l\tLists all filenames\n" \
558 "\t-r\tPerform interactive repairs\n" 302 "\t-r\tPerform interactive repairs\n" \
559 "\t-a\tPerform automatic repairs\n" 303 "\t-a\tPerform automatic repairs\n" \
560 "\t-v\tverbose\n" 304 "\t-v\tverbose\n" \
561 "\t-s\tOutputs super-block information\n" 305 "\t-s\tOutputs super-block information\n" \
562 "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n" 306 "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n" \
563 "\t-f\tForce file system check." 307 "\t-f\tForce file system check."
564#endif
565#endif
566DO_COMMA
567#endif
568 308
569#if defined BB_GETOPT 309#define getopt_trivial_usage \
570#if defined USAGE_ENUM
571getopt_usage_index
572#elif defined USAGE_MESSAGES
573 "[OPTIONS]..." 310 "[OPTIONS]..."
574#ifndef BB_FEATURE_TRIVIAL_HELP 311#define getopt_full_usage \
575 "\nParse command options\n" 312 "\nParse command options\n" \
576 " -a, --alternative Allow long options starting with single -\n" 313 "\t-a, --alternative Allow long options starting with single -\n" \
577 " -l, --longoptions=longopts Long options to be recognized\n" 314 "\t-l, --longoptions=longopts Long options to be recognized\n" \
578 " -n, --name=progname The name under which errors are reported\n" 315 "\t-n, --name=progname The name under which errors are reported\n" \
579 " -o, --options=optstring Short options to be recognized\n" 316 "\t-o, --options=optstring Short options to be recognized\n" \
580 " -q, --quiet Disable error reporting by getopt(3)\n" 317 "\t-q, --quiet Disable error reporting by getopt(3)\n" \
581 " -Q, --quiet-output No normal output\n" 318 "\t-Q, --quiet-output No normal output\n" \
582 " -s, --shell=shell Set shell quoting conventions\n" 319 "\t-s, --shell=shell Set shell quoting conventions\n" \
583 " -T, --test Test for getopt(1) version\n" 320 "\t-T, --test Test for getopt(1) version\n" \
584 " -u, --unqote Do not quote the output" 321 "\t-u, --unqote Do not quote the output"
585#endif 322
586#endif 323#define grep_trivial_usage \
587DO_COMMA
588#endif
589
590#if defined BB_GREP
591#if defined USAGE_ENUM
592grep_usage_index
593#elif defined USAGE_MESSAGES
594 "[-ihHnqvs] pattern [files...]" 324 "[-ihHnqvs] pattern [files...]"
595#ifndef BB_FEATURE_TRIVIAL_HELP 325#define grep_full_usage \
596 "\n\nSearch for PATTERN in each FILE or standard input.\n\n" 326 "Search for PATTERN in each FILE or standard input.\n\n" \
597 "Options:\n" 327 "Options:\n" \
598 "\t-H\tprefix output lines with filename where match was found\n" 328 "\t-H\tprefix output lines with filename where match was found\n" \
599 "\t-h\tsuppress the prefixing filename on output\n" 329 "\t-h\tsuppress the prefixing filename on output\n" \
600 "\t-i\tignore case distinctions\n" 330 "\t-i\tignore case distinctions\n" \
601 "\t-n\tprint line number with output lines\n" 331 "\t-n\tprint line number with output lines\n" \
602 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" 332 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" \
603 "\t-v\tselect non-matching lines\n" 333 "\t-v\tselect non-matching lines\n" \
604 "\t-s\tsuppress file open/read error messages" 334 "\t-s\tsuppress file open/read error messages"
605#endif
606#endif
607DO_COMMA
608#endif
609 335
610#if defined BB_GUNZIP 336#define gunzip_trivial_usage \
611#if defined USAGE_ENUM
612gunzip_usage_index
613#elif defined USAGE_MESSAGES
614 "[OPTION]... FILE" 337 "[OPTION]... FILE"
615#ifndef BB_FEATURE_TRIVIAL_HELP 338#define gunzip_full_usage \
616 "\n\nUncompress FILE (or standard input if FILE is '-').\n\n" 339 "Uncompress FILE (or standard input if FILE is '-').\n\n" \
617 "Options:\n" 340 "Options:\n" \
618 "\t-c\tWrite output to standard output\n" 341 "\t-c\tWrite output to standard output\n" \
619 "\t-t\tTest compressed file integrity" 342 "\t-t\tTest compressed file integrity"
620#endif
621#endif
622DO_COMMA
623#endif
624 343
625#if defined BB_GZIP 344#define gzip_trivial_usage \
626#if defined USAGE_ENUM
627gzip_usage_index
628#elif defined USAGE_MESSAGES
629 "[OPTION]... FILE" 345 "[OPTION]... FILE"
630#ifndef BB_FEATURE_TRIVIAL_HELP 346#define gzip_full_usage \
631 "\n\nCompress FILE with maximum compression.\n" 347 "Compress FILE with maximum compression.\n" \
632 "When FILE is '-', reads standard input. Implies -c.\n\n" 348 "When FILE is '-', reads standard input. Implies -c.\n\n" \
633 "Options:\n" 349 "Options:\n" \
634 "\t-c\tWrite output to standard output instead of FILE.gz\n" 350 "\t-c\tWrite output to standard output instead of FILE.gz\n" \
635 "\t-d\tdecompress" 351 "\t-d\tdecompress"
636#endif
637#endif
638DO_COMMA
639#endif
640 352
641#if defined BB_HALT 353#define halt_trivial_usage \
642#if defined USAGE_ENUM
643halt_usage_index
644#elif defined USAGE_MESSAGES
645 "" 354 ""
646#ifndef BB_FEATURE_TRIVIAL_HELP 355#define halt_full_usage \
647 "\n\nHalt the system." 356 "Halt the system."
648#endif
649#endif
650DO_COMMA
651#endif
652 357
653#if defined BB_HEAD 358#define head_trivial_usage \
654#if defined USAGE_ENUM
655head_usage_index
656#elif defined USAGE_MESSAGES
657 "[OPTION] [FILE]..." 359 "[OPTION] [FILE]..."
658#ifndef BB_FEATURE_TRIVIAL_HELP 360#define head_full_usage \
659 "\n\nPrint first 10 lines of each FILE to standard output.\n" 361 "Print first 10 lines of each FILE to standard output.\n" \
660 "With more than one FILE, precede each with a header giving the\n" 362 "With more than one FILE, precede each with a header giving the\n" \
661 "file name. With no FILE, or when FILE is -, read standard input.\n\n" 363 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
662
663 "Options:\n" "\t-n NUM\t\tPrint first NUM lines instead of first 10" 364 "Options:\n" "\t-n NUM\t\tPrint first NUM lines instead of first 10"
664#endif
665#endif
666DO_COMMA
667#endif
668 365
669#if defined BB_HOSTID 366#define hostid_trivial_usage \
670#if defined USAGE_ENUM
671hostid_usage_index
672#elif defined USAGE_MESSAGES
673 "" 367 ""
674#ifndef BB_FEATURE_TRIVIAL_HELP 368#define hostid_full_usage \
675 "\n\nPrint out a unique 32-bit identifier for the machine." 369 "Print out a unique 32-bit identifier for the machine."
676#endif
677#endif
678DO_COMMA
679#endif
680 370
681#if defined BB_HOSTNAME 371#define hostname_trivial_usage \
682#if defined USAGE_ENUM
683hostname_usage_index
684#elif defined USAGE_MESSAGES
685 "[OPTION] {hostname | -F file}" 372 "[OPTION] {hostname | -F file}"
686#ifndef BB_FEATURE_TRIVIAL_HELP 373#define hostname_full_usage \
687 "\n\nGet or set the hostname or DNS domain name. If a hostname is given\n" 374 "Get or set the hostname or DNS domain name. If a hostname is given\n" \
688 "(or a file with the -F parameter), the host name will be set.\n\n" 375 "(or a file with the -F parameter), the host name will be set.\n\n" \
689 376 "Options:\n" \
690 "Options:\n" 377 "\t-s\t\tShort\n" \
691 "\t-s\t\tShort\n" 378 "\t-i\t\tAddresses for the hostname\n" \
692 "\t-i\t\tAddresses for the hostname\n" 379 "\t-d\t\tDNS domain name\n" \
693 "\t-d\t\tDNS domain name\n"
694 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname" 380 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname"
695#endif
696#endif
697DO_COMMA
698#endif
699 381
700#if defined BB_ID 382#define id_trivial_usage \
701#if defined USAGE_ENUM
702id_usage_index
703#elif defined USAGE_MESSAGES
704 "[OPTIONS]... [USERNAME]" 383 "[OPTIONS]... [USERNAME]"
705#ifndef BB_FEATURE_TRIVIAL_HELP 384#define id_full_usage \
706 "\n\nPrint information for USERNAME or the current user\n\n" 385 "Print information for USERNAME or the current user\n\n" \
707 "Options:\n" 386 "Options:\n" \
708 "\t-g\tprints only the group ID\n" 387 "\t-g\tprints only the group ID\n" \
709 "\t-u\tprints only the user ID\n" 388 "\t-u\tprints only the user ID\n" \
710 "\t-n\tprint a name instead of a number (with for -ug)\n" 389 "\t-n\tprint a name instead of a number (with for -ug)\n" \
711 "\t-r\tprints the real user ID instead of the effective ID (with -ug)" 390 "\t-r\tprints the real user ID instead of the effective ID (with -ug)"
712#endif
713#endif
714DO_COMMA
715#endif
716 391
717#if defined BB_IFCONFIG
718#if defined USAGE_ENUM
719ifconfig_usage_index
720#elif defined USAGE_MESSAGES
721 "[-a] [-i] [-v] <interface> [<address>]"
722#ifndef BB_FEATURE_TRIVIAL_HELP
723 "\n\nconfigure a network interface\n\n"
724 "Options:\n"
725 " [[-]broadcast [<address>]] [[-]pointopoint [<address>]]\n"
726 " [netmask <address>] [dstaddr <address>] [tunnel <adress>]\n"
727#ifdef SIOCSKEEPALIVE 392#ifdef SIOCSKEEPALIVE
728 " [outfill <NN>] [keepalive <NN>]\n" 393 #define USAGE_SIOCSKEEPALIVE(a) a
729#endif 394#else
730 " [hw ether <address>] [metric <NN>] [mtu <NN>]\n" 395 #define USAGE_SIOCSKEEPALIVE(a)
731 " [[-]trailers] [[-]arp] [[-]allmulti]\n"
732 " [multicast] [[-]promisc]\n"
733 " [mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]\n"
734 " [up|down] ..."
735#endif
736#endif
737DO_COMMA
738#endif 396#endif
739 397#define ifconfig_trivial_usage \
740#if defined BB_INIT 398 "[-a] [-i] [-v] <interface> [<address>]"
741#if defined USAGE_ENUM 399#define ifconfig_full_usage \
742init_usage_index 400 "configure a network interface\n\n" \
743#elif defined USAGE_MESSAGES 401 "Options:\n" \
402 "\t[[-]broadcast [<address>]] [[-]pointopoint [<address>]]\n" \
403 "\t[netmask <address>] [dstaddr <address>] [tunnel <adress>]\n" \
404USAGE_SIOCSKEEPALIVE("\t[outfill <NN>] [keepalive <NN>]\n") \
405 "\t[hw ether <address>] [metric <NN>] [mtu <NN>]\n" \
406 "\t[[-]trailers] [[-]arp] [[-]allmulti]\n" \
407 "\t[multicast] [[-]promisc]\n" \
408 "\t[mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]\n" \
409 "\t[up|down] ..."
410
411#define init_trivial_usage \
744 "" 412 ""
745#ifndef BB_FEATURE_TRIVIAL_HELP 413#define init_full_usage \
746 "\n\nInit is the parent of all processes.\n\n" 414 "Init is the parent of all processes.\n\n" \
747 "This version of init is designed to be run only by the kernel." 415 "This version of init is designed to be run only by the kernel."
748#endif
749#endif
750DO_COMMA
751#endif
752 416
753#if defined BB_INSMOD 417#define insmod_trivial_usage \
754#if defined USAGE_ENUM
755insmod_usage_index
756#elif defined USAGE_MESSAGES
757 "[OPTION]... MODULE [symbol=value]..." 418 "[OPTION]... MODULE [symbol=value]..."
758#ifndef BB_FEATURE_TRIVIAL_HELP 419#define insmod_full_usage \
759 "\n\nLoads the specified kernel modules into the kernel.\n\n" 420 "Loads the specified kernel modules into the kernel.\n\n" \
760 "Options:\n" 421 "Options:\n" \
761 "\t-f\tForce module to load into the wrong kernel version.\n" 422 "\t-f\tForce module to load into the wrong kernel version.\n" \
762 "\t-k\tMake module autoclean-able.\n" 423 "\t-k\tMake module autoclean-able.\n" \
763 "\t-v\tverbose output\n" 424 "\t-v\tverbose output\n" \
764 "\t-L\tLock to prevent simultaneous loads of a module\n" 425 "\t-L\tLock to prevent simultaneous loads of a module\n" \
765 "\t-x\tdo not export externs" 426 "\t-x\tdo not export externs"
766#endif
767#endif
768DO_COMMA
769#endif
770 427
771#if defined BB_KILL 428#define kill_trivial_usage \
772#if defined USAGE_ENUM
773kill_usage_index
774#elif defined USAGE_MESSAGES
775 "[-signal] process-id [process-id ...]" 429 "[-signal] process-id [process-id ...]"
776#ifndef BB_FEATURE_TRIVIAL_HELP 430#define kill_full_usage \
777 "\n\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" 431 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
778 "Options:\n" "\t-l\tList all signal names and numbers." 432 "Options:\n" "\t-l\tList all signal names and numbers."
779#endif
780#endif
781DO_COMMA
782#endif
783 433
784#if defined BB_KILLALL 434#define killall_trivial_usage \
785#if defined USAGE_ENUM
786killall_usage_index
787#elif defined USAGE_MESSAGES
788 "[-signal] process-name [process-name ...]" 435 "[-signal] process-name [process-name ...]"
789#ifndef BB_FEATURE_TRIVIAL_HELP 436#define killall_full_usage \
790 "\n\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" 437 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
791 "Options:\n" "\t-l\tList all signal names and numbers." 438 "Options:\n" "\t-l\tList all signal names and numbers."
792#endif
793#endif
794DO_COMMA
795#endif
796 439
797#if defined BB_LENGTH 440#define length_trivial_usage \
798#if defined USAGE_ENUM
799length_usage_index
800#elif defined USAGE_MESSAGES
801 "STRING" 441 "STRING"
802#ifndef BB_FEATURE_TRIVIAL_HELP 442#define length_full_usage \
803 "\n\nPrints out the length of the specified STRING." 443 "Prints out the length of the specified STRING."
804#endif
805#endif
806DO_COMMA
807#endif
808 444
809#if defined BB_LN 445#define ln_trivial_usage \
810#if defined USAGE_ENUM
811ln_usage_index
812#elif defined USAGE_MESSAGES
813 "[OPTION] TARGET... LINK_NAME|DIRECTORY" 446 "[OPTION] TARGET... LINK_NAME|DIRECTORY"
814#ifndef BB_FEATURE_TRIVIAL_HELP 447#define ln_full_usage \
815 "\n\nCreate a link named LINK_NAME or DIRECTORY to the specified TARGET\n" 448 "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n"\
816 "\nYou may use '--' to indicate that all following arguments are non-options.\n\n" 449 "\nYou may use '--' to indicate that all following arguments are non-options.\n\n" \
817 "Options:\n" 450 "Options:\n" \
818 "\t-s\tmake symbolic links instead of hard links\n" 451 "\t-s\tmake symbolic links instead of hard links\n" \
819 "\t-f\tremove existing destination files\n" 452 "\t-f\tremove existing destination files\n" \
820 "\t-n\tno dereference symlinks - treat like normal file" 453 "\t-n\tno dereference symlinks - treat like normal file"
821#endif
822#endif
823DO_COMMA
824#endif
825 454
826#if defined BB_LOADACM 455#define loadacm_trivial_usage \
827#if defined USAGE_ENUM
828loadacm_usage_index
829#elif defined USAGE_MESSAGES
830 "< mapfile" 456 "< mapfile"
831#ifndef BB_FEATURE_TRIVIAL_HELP 457#define loadacm_full_usage \
832 "\n\nLoads an acm from standard input." 458 "Loads an acm from standard input."
833#endif
834#endif
835DO_COMMA
836#endif
837 459
838#if defined BB_LOADFONT 460#define loadfont_trivial_usage \
839#if defined USAGE_ENUM
840loadfont_usage_index
841#elif defined USAGE_MESSAGES
842 "< font" 461 "< font"
843#ifndef BB_FEATURE_TRIVIAL_HELP 462#define loadfont_full_usage \
844 "\n\nLoads a console font from standard input." 463 "Loads a console font from standard input."
845#endif
846#endif
847DO_COMMA
848#endif
849 464
850#if defined BB_LOADKMAP 465#define loadkmap_trivial_usage \
851#if defined USAGE_ENUM
852loadkmap_usage_index
853#elif defined USAGE_MESSAGES
854 "< keymap" 466 "< keymap"
855#ifndef BB_FEATURE_TRIVIAL_HELP 467#define loadkmap_full_usage \
856 "\n\nLoads a binary keyboard translation table from standard input." 468 "Loads a binary keyboard translation table from standard input."
857#endif
858#endif
859DO_COMMA
860#endif
861 469
862#if defined BB_LOGGER 470#define logger_trivial_usage \
863#if defined USAGE_ENUM
864logger_usage_index
865#elif defined USAGE_MESSAGES
866 "[OPTION]... [MESSAGE]" 471 "[OPTION]... [MESSAGE]"
867#ifndef BB_FEATURE_TRIVIAL_HELP 472#define logger_full_usage \
868 "\n\nWrite MESSAGE to the system log. If MESSAGE is omitted, log stdin.\n\n" 473 "Write MESSAGE to the system log. If MESSAGE is omitted, log stdin.\n\n" \
869 "Options:\n" 474 "Options:\n" \
870 "\t-s\tLog to stderr as well as the system log.\n" 475 "\t-s\tLog to stderr as well as the system log.\n" \
871 "\t-t\tLog using the specified tag (defaults to user name).\n" 476 "\t-t\tLog using the specified tag (defaults to user name).\n" \
872 "\t-p\tEnter the message with the specified priority.\n" 477 "\t-p\tEnter the message with the specified priority.\n" \
873 "\t\tThis may be numerical or a ``facility.level'' pair." 478 "\t\tThis may be numerical or a ``facility.level'' pair."
874#endif
875#endif
876DO_COMMA
877#endif
878 479
879#if defined BB_LOGNAME 480#define logname_trivial_usage \
880#if defined USAGE_ENUM
881logname_usage_index
882#elif defined USAGE_MESSAGES
883 "" 481 ""
884#ifndef BB_FEATURE_TRIVIAL_HELP 482#define logname_full_usage \
885 "\n\nPrint the name of the current user." 483 "Print the name of the current user."
886#endif
887#endif
888DO_COMMA
889#endif
890 484
891#if defined BB_LS
892#if defined USAGE_ENUM
893ls_usage_index
894#elif defined USAGE_MESSAGES
895 "[-1Aa"
896#ifdef BB_FEATURE_LS_TIMESTAMPS
897 "c"
898#endif
899 "Cd"
900#ifdef BB_FEATURE_LS_TIMESTAMPS 485#ifdef BB_FEATURE_LS_TIMESTAMPS
901 "e" 486 #define USAGE_LS_TIMESTAMPS(a) a
902#endif 487#else
903#ifdef BB_FEATURE_LS_FILETYPES 488 #define USAGE_LS_TIMESTAMPS(a)
904 "F"
905#endif
906 "iln"
907#ifdef BB_FEATURE_LS_FILETYPES
908 "p"
909#endif
910#ifdef BB_FEATURE_LS_FOLLOWLINKS
911 "L"
912#endif
913#ifdef BB_FEATURE_LS_RECURSIVE
914 "R"
915#endif
916#ifdef BB_FEATURE_LS_SORTFILES
917 "rS"
918#endif
919 "s"
920#ifdef BB_FEATURE_AUTOWIDTH
921 "T"
922#endif
923#ifdef BB_FEATURE_LS_TIMESTAMPS
924 "tu"
925#endif
926#ifdef BB_FEATURE_LS_SORTFILES
927 "v"
928#endif
929#ifdef BB_FEATURE_AUTOWIDTH
930 "w"
931#endif
932 "x"
933#ifdef BB_FEATURE_LS_SORTFILES
934 "X"
935#endif
936#ifdef BB_FEATURE_HUMAN_READABLE
937 "h"
938#endif
939 "k] [filenames...]"
940#ifndef BB_FEATURE_TRIVIAL_HELP
941 "\n\nList directory contents\n\n"
942 "Options:\n"
943 "\t-1\tlist files in a single column\n"
944 "\t-A\tdo not list implied . and ..\n"
945 "\t-a\tdo not hide entries starting with .\n"
946 "\t-C\tlist entries by columns\n"
947#ifdef BB_FEATURE_LS_TIMESTAMPS
948 "\t-c\twith -l: show ctime (the time of last\n"
949 "\t\tmodification of file status information)\n"
950#endif
951 "\t-d\tlist directory entries instead of contents\n"
952#ifdef BB_FEATURE_LS_TIMESTAMPS
953 "\t-e\tlist both full date and full time\n"
954#endif
955#ifdef BB_FEATURE_LS_FILETYPES
956 "\t-F\tappend indicator (one of */=@|) to entries\n"
957#endif 489#endif
958 "\t-i\tlist the i-node for each file\n"
959 "\t-l\tuse a long listing format\n"
960 "\t-n\tlist numeric UIDs and GIDs instead of names\n"
961#ifdef BB_FEATURE_LS_FILETYPES 490#ifdef BB_FEATURE_LS_FILETYPES
962 "\t-p\tappend indicator (one of /=@|) to entries\n" 491 #define USAGE_LS_FILETYPES(a) a
492#else
493 #define USAGE_LS_FILETYPES(a)
963#endif 494#endif
964#ifdef BB_FEATURE_LS_FOLLOWLINKS 495#ifdef BB_FEATURE_LS_FOLLOWLINKS
965 "\t-L\tlist entries pointed to by symbolic links\n" 496 #define USAGE_LS_FOLLOWLINKS(a) a
497#else
498 #define USAGE_LS_FOLLOWLINKS(a)
966#endif 499#endif
967#ifdef BB_FEATURE_LS_RECURSIVE 500#ifdef BB_FEATURE_LS_RECURSIVE
968 "\t-R\tlist subdirectories recursively\n" 501 #define USAGE_LS_RECURSIVE(a) a
969#endif 502#else
970#ifdef BB_FEATURE_LS_SORTFILES 503 #define USAGE_LS_RECURSIVE(a)
971 "\t-r\tsort the listing in reverse order\n"
972 "\t-S\tsort the listing by file size\n"
973#endif
974 "\t-s\tlist the size of each file, in blocks\n"
975#ifdef BB_FEATURE_AUTOWIDTH
976 "\t-T NUM\tassume Tabstop every NUM columns\n"
977#endif
978#ifdef BB_FEATURE_LS_TIMESTAMPS
979 "\t-t\twith -l: show modification time (the time of last\n"
980 "\t\tchange of the file)\n"
981 "\t-u\twith -l: show access time (the time of last\n"
982 "\t\taccess of the file)\n"
983#endif 504#endif
984#ifdef BB_FEATURE_LS_SORTFILES 505#ifdef BB_FEATURE_LS_SORTFILES
985 "\t-v\tsort the listing by version\n" 506 #define USAGE_LS_SORTFILES(a) a
507#else
508 #define USAGE_LS_SORTFILES(a)
986#endif 509#endif
987#ifdef BB_FEATURE_AUTOWIDTH 510#ifdef BB_FEATURE_AUTOWIDTH
988 "\t-w NUM\tassume the terminal is NUM columns wide\n" 511 #define USAGE_AUTOWIDTH(a) a
989#endif
990 "\t-x\tlist entries by lines instead of by columns\n"
991#ifdef BB_FEATURE_LS_SORTFILES
992 "\t-X\tsort the listing by extension\n"
993#endif
994
995#ifdef BB_FEATURE_HUMAN_READABLE
996 "\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G)\n"
997 "\t-k\tprint sizes in kilobytes(default)"
998#else 512#else
999 "\t-k\tprint sizes in kilobytes(compatability)" 513 #define USAGE_AUTOWIDTH(a)
1000#endif 514#endif
1001 515#define ls_trivial_usage \
1002#endif /* BB_FEATURE_TRIVIAL_HELP */ 516 "[-1Aa" USAGE_LS_TIMESTAMPS("c") \
1003#endif 517 "Cd" USAGE_LS_TIMESTAMPS("e") USAGE_LS_FILETYPES("F") "iln" \
1004DO_COMMA 518 USAGE_LS_FILETYPES("p") USAGE_LS_FOLLOWLINKS("L") \
1005#endif /* BB_LS */ 519 USAGE_LS_RECURSIVE("R") USAGE_LS_SORTFILES("rS") \
1006 520 "s" USAGE_AUTOWIDTH("T") USAGE_LS_TIMESTAMPS("tu") \
1007#if defined BB_LSMOD 521 USAGE_LS_SORTFILES("v") USAGE_AUTOWIDTH("w") "x" \
1008#if defined USAGE_ENUM 522 USAGE_LS_SORTFILES("X") USAGE_HUMAN_READABLE("h", "") \
1009lsmod_usage_index 523 "k] [filenames...]"
1010#elif defined USAGE_MESSAGES 524#define ls_full_usage \
525 "List directory contents\n\n" \
526 "Options:\n" \
527 "\t-1\tlist files in a single column\n" \
528 "\t-A\tdo not list implied . and ..\n" \
529 "\t-a\tdo not hide entries starting with .\n" \
530 "\t-C\tlist entries by columns\n" \
531USAGE_LS_TIMESTAMPS( \
532 "\t-c\twith -l: show ctime (the time of last\n" \
533 "\t\tmodification of file status information)\n" \
534 ) \
535 "\t-d\tlist directory entries instead of contents\n" \
536USAGE_LS_TIMESTAMPS( \
537 "\t-e\tlist both full date and full time\n" \
538 ) \
539USAGE_LS_FILETYPES( \
540 "\t-F\tappend indicator (one of */=@|) to entries\n" \
541 ) \
542 "\t-i\tlist the i-node for each file\n" \
543 "\t-l\tuse a long listing format\n" \
544 "\t-n\tlist numeric UIDs and GIDs instead of names\n" \
545USAGE_LS_FILETYPES( \
546 "\t-p\tappend indicator (one of /=@|) to entries\n" \
547 ) \
548USAGE_LS_FOLLOWLINKS( \
549 "\t-L\tlist entries pointed to by symbolic links\n" \
550 ) \
551USAGE_LS_RECURSIVE( \
552 "\t-R\tlist subdirectories recursively\n" \
553 ) \
554USAGE_LS_SORTFILES( \
555 "\t-r\tsort the listing in reverse order\n" \
556 "\t-S\tsort the listing by file size\n" \
557 ) \
558 "\t-s\tlist the size of each file, in blocks\n" \
559USAGE_AUTOWIDTH( \
560 "\t-T NUM\tassume Tabstop every NUM columns\n" \
561 ) \
562USAGE_LS_TIMESTAMPS( \
563 "\t-t\twith -l: show modification time (the time of last\n" \
564 "\t\tchange of the file)\n" \
565 "\t-u\twith -l: show access time (the time of last\n" \
566 "\t\taccess of the file)\n" \
567 ) \
568USAGE_LS_SORTFILES( \
569 "\t-v\tsort the listing by version\n" \
570 ) \
571USAGE_AUTOWIDTH( \
572 "\t-w NUM\tassume the terminal is NUM columns wide\n" \
573 ) \
574 "\t-x\tlist entries by lines instead of by columns\n" \
575USAGE_LS_SORTFILES( \
576 "\t-X\tsort the listing by extension\n" \
577 ) \
578USAGE_HUMAN_READABLE( \
579 "\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
580 "\t-k\tprint sizes in kilobytes(default)" \
581 , \
582 "\t-k\tprint sizes in kilobytes(compatability)" \
583 ) \
584
585#define lsmod_trivial_usage \
1011 "" 586 ""
1012#ifndef BB_FEATURE_TRIVIAL_HELP 587#define lsmod_full_usage \
1013 "\n\nList the currently loaded kernel modules." 588 "List the currently loaded kernel modules."
1014#endif
1015#endif
1016DO_COMMA
1017#endif
1018 589
1019#if defined BB_MAKEDEVS 590#define makedevs_trivial_usage \
1020#if defined USAGE_ENUM
1021makedevs_usage_index
1022#elif defined USAGE_MESSAGES
1023 "NAME TYPE MAJOR MINOR FIRST LAST [s]" 591 "NAME TYPE MAJOR MINOR FIRST LAST [s]"
1024#ifndef BB_FEATURE_TRIVIAL_HELP 592#define makedevs_full_usage \
1025 "\n\nCreates a range of block or character special files\n\n" 593 "Creates a range of block or character special files\n\n" \
1026 "TYPEs include:\n" 594 "TYPEs include:\n" \
1027 "\tb:\tMake a block (buffered) device.\n" 595 "\tb:\tMake a block (buffered) device.\n" \
1028 "\tc or u:\tMake a character (un-buffered) device.\n" 596 "\tc or u:\tMake a character (un-buffered) device.\n" \
1029 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n\n" 597 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n\n" \
1030 "FIRST specifies the number appended to NAME to create the first device.\n" 598 "FIRST specifies the number appended to NAME to create the first device.\n" \
1031 "LAST specifies the number of the last item that should be created.\n" 599 "LAST specifies the number of the last item that should be created.\n" \
1032 "If 's' is the last argument, the base device is created as well.\n\n" 600 "If 's' is the last argument, the base device is created as well.\n\n" \
1033 "For example:\n" 601 "For example:\n" \
1034 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" 602 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" \
1035 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8" 603 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8"
1036#endif
1037#endif
1038DO_COMMA
1039#endif
1040 604
1041#if defined BB_MD5SUM 605#define md5sum_trivial_usage \
1042#if defined USAGE_ENUM 606 "[OPTION] [FILE]...\nor: md5sum [OPTION] -c [FILE]"
1043md5sum_usage_index 607#define md5sum_full_usage \
1044#elif defined USAGE_MESSAGES 608 "Print or check MD5 checksums.\n\n" \
1045 "[OPTION] [FILE]...\n" 609 "Options:\n" \
1046 "or: md5sum [OPTION] -c [FILE]" 610 "With no FILE, or when FILE is -, read standard input.\n\n" \
1047#ifndef BB_FEATURE_TRIVIAL_HELP 611 "\t-b\tread files in binary mode\n" \
1048 "\n\nPrint or check MD5 checksums.\n\n" 612 "\t-c\tcheck MD5 sums against given list\n" \
1049 "Options:\n" 613 "\t-t\tread files in text mode (default)\n" \
1050 "With no FILE, or when FILE is -, read standard input.\n\n" 614 "\t-g\tread a string\n" \
1051 "\t-b\tread files in binary mode\n" 615 "\nThe following two options are useful only when verifying checksums:\n" \
1052 "\t-c\tcheck MD5 sums against given list\n" 616 "\t-s,\tdon't output anything, status code shows success\n" \
1053 "\t-t\tread files in text mode (default)\n"
1054 "\t-g\tread a string\n"
1055 "\nThe following two options are useful only when verifying checksums:\n"
1056 "\t-s,\tdon't output anything, status code shows success\n"
1057 "\t-w,\twarn about improperly formated MD5 checksum lines" 617 "\t-w,\twarn about improperly formated MD5 checksum lines"
1058#endif
1059#endif
1060DO_COMMA
1061#endif
1062 618
1063#if defined BB_MKDIR 619#define mkdir_trivial_usage \
1064#if defined USAGE_ENUM
1065mkdir_usage_index
1066#elif defined USAGE_MESSAGES
1067 "[OPTION] DIRECTORY..." 620 "[OPTION] DIRECTORY..."
1068#ifndef BB_FEATURE_TRIVIAL_HELP 621#define mkdir_full_usage \
1069 "\n\nCreate the DIRECTORY(ies), if they do not already exist\n\n" 622 "Create the DIRECTORY(ies), if they do not already exist\n\n" \
1070 623 "Options:\n" \
1071 "Options:\n" 624 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" \
1072 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n"
1073 "\t-p\tno error if existing, make parent directories as needed" 625 "\t-p\tno error if existing, make parent directories as needed"
1074#endif
1075#endif
1076DO_COMMA
1077#endif
1078 626
1079#if defined BB_MKFIFO 627#define mkfifo_trivial_usage \
1080#if defined USAGE_ENUM
1081mkfifo_usage_index
1082#elif defined USAGE_MESSAGES
1083 "[OPTIONS] name" 628 "[OPTIONS] name"
1084#ifndef BB_FEATURE_TRIVIAL_HELP 629#define mkfifo_full_usage \
1085 "\n\nCreates a named pipe (identical to 'mknod name p')\n\n" 630 "Creates a named pipe (identical to 'mknod name p')\n\n" \
1086 "Options:\n" 631 "Options:\n" \
1087 "\t-m\tcreate the pipe using the specified mode (default a=rw)" 632 "\t-m\tcreate the pipe using the specified mode (default a=rw)"
1088#endif
1089#endif
1090DO_COMMA
1091#endif
1092 633
1093#if defined BB_MKFS_MINIX 634#define mkfs_minix_trivial_usage \
1094#if defined USAGE_ENUM
1095mkfs_minix_usage_index
1096#elif defined USAGE_MESSAGES
1097 "[-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]" 635 "[-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]"
1098#ifndef BB_FEATURE_TRIVIAL_HELP 636#define mkfs_minix_full_usage \
1099 "\n\nMake a MINIX filesystem.\n\n" 637 "Make a MINIX filesystem.\n\n" \
1100 "Options:\n" 638 "Options:\n" \
1101 "\t-c\t\tCheck the device for bad blocks\n" 639 "\t-c\t\tCheck the device for bad blocks\n" \
1102 "\t-n [14|30]\tSpecify the maximum length of filenames\n" 640 "\t-n [14|30]\tSpecify the maximum length of filenames\n" \
1103 "\t-i INODES\tSpecify the number of inodes for the filesystem\n" 641 "\t-i INODES\tSpecify the number of inodes for the filesystem\n" \
1104 "\t-l FILENAME\tRead the bad blocks list from FILENAME\n" 642 "\t-l FILENAME\tRead the bad blocks list from FILENAME\n" \
1105 "\t-v\t\tMake a Minix version 2 filesystem" 643 "\t-v\t\tMake a Minix version 2 filesystem"
1106#endif
1107#endif
1108DO_COMMA
1109#endif
1110 644
1111#if defined BB_MKNOD 645#define mknod_trivial_usage \
1112#if defined USAGE_ENUM
1113mknod_usage_index
1114#elif defined USAGE_MESSAGES
1115 "[OPTIONS] NAME TYPE MAJOR MINOR" 646 "[OPTIONS] NAME TYPE MAJOR MINOR"
1116#ifndef BB_FEATURE_TRIVIAL_HELP 647#define mknod_full_usage \
1117 "\n\nCreate a special file (block, character, or pipe).\n\n" 648 "Create a special file (block, character, or pipe).\n\n" \
1118 "Options:\n" 649 "Options:\n" \
1119 "\t-m\tcreate the special file using the specified mode (default a=rw)\n\n" 650 "\t-m\tcreate the special file using the specified mode (default a=rw)\n\n" \
1120 "TYPEs include:\n" 651 "TYPEs include:\n" \
1121 "\tb:\tMake a block (buffered) device.\n" 652 "\tb:\tMake a block (buffered) device.\n" \
1122 "\tc or u:\tMake a character (un-buffered) device.\n" 653 "\tc or u:\tMake a character (un-buffered) device.\n" \
1123 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes." 654 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes."
1124#endif
1125#endif
1126DO_COMMA
1127#endif
1128 655
1129#if defined BB_MKSWAP 656#define mkswap_trivial_usage \
1130#if defined USAGE_ENUM
1131mkswap_usage_index
1132#elif defined USAGE_MESSAGES
1133 "[-c] [-v0|-v1] device [block-count]" 657 "[-c] [-v0|-v1] device [block-count]"
1134#ifndef BB_FEATURE_TRIVIAL_HELP 658#define mkswap_full_usage \
1135 "\n\nPrepare a disk partition to be used as a swap partition.\n\n" 659 "Prepare a disk partition to be used as a swap partition.\n\n" \
1136 "Options:\n" "\t-c\t\tCheck for read-ability.\n" 660 "Options:\n" "\t-c\t\tCheck for read-ability.\n" \
1137 "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" 661 "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" \
1138 "\t-v1\t\tMake version 1 swap [big!] (default for kernels >\n" 662 "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" \
1139 "\t\t\t2.1.117).\n"
1140 "\tblock-count\tNumber of block to use (default is entire partition)." 663 "\tblock-count\tNumber of block to use (default is entire partition)."
1141#endif
1142#endif
1143DO_COMMA
1144#endif
1145 664
1146#if defined BB_MKTEMP 665#define mktemp_trivial_usage \
1147#if defined USAGE_ENUM
1148mktemp_usage_index
1149#elif defined USAGE_MESSAGES
1150 "[-q] TEMPLATE" 666 "[-q] TEMPLATE"
1151#ifndef BB_FEATURE_TRIVIAL_HELP 667#define mktemp_full_usage \
1152 "\n\nCreates a temporary file with its name based on TEMPLATE.\n" 668 "Creates a temporary file with its name based on TEMPLATE.\n" \
1153 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)." 669 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)."
1154#endif
1155#endif
1156DO_COMMA
1157#endif
1158 670
1159#if defined BB_MORE 671#define more_trivial_usage \
1160#if defined USAGE_ENUM
1161more_usage_index
1162#elif defined USAGE_MESSAGES
1163 "[FILE ...]" 672 "[FILE ...]"
1164#ifndef BB_FEATURE_TRIVIAL_HELP 673#define more_full_usage \
1165 "\n\nMore is a filter for viewing FILE one screenful at a time." 674 "More is a filter for viewing FILE one screenful at a time."
1166#endif
1167#endif
1168DO_COMMA
1169#endif
1170 675
1171#if defined BB_MOUNT 676#ifdef BB_FEATURE_MOUNT_LOOP
1172#if defined USAGE_ENUM 677 #define USAGE_MOUNT_LOOP(a) a
1173mount_usage_index 678#else
1174#elif defined USAGE_MESSAGES 679 #define USAGE_MOUNT_LOOP(a)
1175 "[flags] device directory [-o options,more-options]"
1176#ifndef BB_FEATURE_TRIVIAL_HELP
1177 "\n\nMount a filesystem\n\n"
1178 "Flags:\n"
1179 "\t-a:\t\tMount all filesystems in fstab.\n"
1180#ifdef BB_MTAB
1181 "\t-f:\t\t\"Fake\" Add entry to mount table but don't mount it.\n"
1182 "\t-n:\t\tDon't write a mount table entry.\n"
1183#endif 680#endif
1184 "\t-o option:\tOne of many filesystem options, listed below.\n" 681#ifdef BB_MTAB
1185 "\t-r:\t\tMount the filesystem read-only.\n" 682 #define USAGE_MTAB(a) a
1186 "\t-t fs-type:\tSpecify the filesystem type.\n" 683#else
1187 "\t-w:\t\tMount for reading and writing (default).\n" 684 #define USAGE_MTAB(a)
1188 "\n"
1189 "Options for use with the \"-o\" flag:\n"
1190 "\tasync/sync:\tWrites are asynchronous / synchronous.\n"
1191 "\tatime/noatime:\tEnable / disable updates to inode access times.\n"
1192 "\tdev/nodev:\tAllow use of special device files / disallow them.\n"
1193 "\texec/noexec:\tAllow use of executable files / disallow them.\n"
1194#if defined BB_FEATURE_MOUNT_LOOP
1195 "\tloop:\t\tMounts a file via loop device.\n"
1196#endif 685#endif
1197 "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" 686#define mount_trivial_usage \
1198 "\tremount:\tRe-mount a mounted filesystem, changing its flags.\n" 687 "[flags] device directory [-o options,more-options]"
1199 "\tro/rw:\t\tMount for read-only / read-write.\n" 688#define mount_full_usage \
1200 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" 689 "Mount a filesystem\n\n" \
690 "Flags:\n" \
691 "\t-a:\t\tMount all filesystems in fstab.\n" \
692USAGE_MTAB( \
693 "\t-f:\t\t\"Fake\" mount. Add entry to mount table but don't mount it.\n" \
694 "\t-n:\t\tDon't write a mount table entry.\n" \
695 ) \
696 "\t-o option:\tOne of many filesystem options, listed below.\n" \
697 "\t-r:\t\tMount the filesystem read-only.\n" \
698 "\t-t fs-type:\tSpecify the filesystem type.\n" \
699 "\t-w:\t\tMount for reading and writing (default).\n" \
700 "\n" \
701 "Options for use with the \"-o\" flag:\n" \
702 "\tasync/sync:\tWrites are asynchronous / synchronous.\n" \
703 "\tatime/noatime:\tEnable / disable updates to inode access times.\n" \
704 "\tdev/nodev:\tAllow use of special device files / disallow them.\n" \
705 "\texec/noexec:\tAllow use of executable files / disallow them.\n" \
706USAGE_MOUNT_LOOP( \
707 "\tloop:\t\tMounts a file via loop device.\n" \
708 ) \
709 "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" \
710 "\tremount:\tRe-mount a currently-mounted filesystem, changing its flags.\n" \
711 "\tro/rw:\t\tMount for read-only / read-write.\n" \
712 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" \
1201 "You'll have to see the written documentation for those." 713 "You'll have to see the written documentation for those."
1202#endif
1203#endif
1204DO_COMMA
1205#endif
1206 714
1207#if defined BB_MT 715#define mt_trivial_usage \
1208#if defined USAGE_ENUM
1209mt_usage_index
1210#elif defined USAGE_MESSAGES
1211 "[-f device] opcode value" 716 "[-f device] opcode value"
1212#ifndef BB_FEATURE_TRIVIAL_HELP 717#define mt_full_usage \
1213 "\n\nControl magnetic tape drive operation\n" 718 "Control magnetic tape drive operation\n" \
1214 "\nAvailable Opcodes:\n\n" 719 "\nAvailable Opcodes:\n\n" \
1215 "bsf bsfm bsr bss datacompression drvbuffer eof eom erase\n" 720 "bsf bsfm bsr bss datacompression drvbuffer eof eom erase\n" \
1216 "fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2\n" 721 "fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2\n" \
1217 "ras3 reset retension rew rewoffline seek setblk setdensity\n" 722 "ras3 reset retension rew rewoffline seek setblk setdensity\n" \
1218 "setpart tell unload unlock weof wset" 723 "setpart tell unload unlock weof wset"
1219#endif
1220#endif
1221DO_COMMA
1222#endif
1223 724
1224#if defined BB_CP_MV 725#define mv_trivial_usage \
1225#if defined USAGE_ENUM 726 "SOURCE DEST\n or: mv SOURCE... DIRECTORY"
1226mv_usage_index 727#define mv_full_usage \
1227#elif defined USAGE_MESSAGES 728 "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY."
1228 "SOURCE DEST\n"
1229 " or: mv SOURCE... DIRECTORY"
1230#ifndef BB_FEATURE_TRIVIAL_HELP
1231 "\n\nRename SOURCE to DEST, or move SOURCE(s) to DIRECTORY."
1232#endif
1233#endif
1234DO_COMMA
1235#endif
1236 729
1237#if defined BB_NC 730#define nc_trivial_usage \
1238#if defined USAGE_ENUM
1239nc_usage_index
1240#elif defined USAGE_MESSAGES
1241 "[IP] [port]" 731 "[IP] [port]"
1242#ifndef BB_FEATURE_TRIVIAL_HELP 732#define nc_full_usage \
1243 "\n\nNetcat opens a pipe to IP:port" 733 "Netcat opens a pipe to IP:port"
1244#endif
1245#endif
1246DO_COMMA
1247#endif
1248 734
1249#if defined BB_NSLOOKUP 735#define nslookup_trivial_usage \
1250#if defined USAGE_ENUM
1251nslookup_usage_index
1252#elif defined USAGE_MESSAGES
1253 "[HOST]" 736 "[HOST]"
1254#ifndef BB_FEATURE_TRIVIAL_HELP 737#define nslookup_full_usage \
1255 "\n\nQueries the nameserver for the IP address of the given HOST" 738 "Queries the nameserver for the IP address of the given HOST"
1256#endif
1257#endif
1258DO_COMMA
1259#endif
1260 739
1261#if defined BB_PING 740#ifdef BB_FEATURE_SIMPLE_PING
1262#if defined BB_FEATURE_SIMPLE_PING 741#define ping_trivial_usage "host"
1263#if defined USAGE_ENUM 742#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
1264ping_usage_index 743#else
1265#elif defined USAGE_MESSAGES 744#define ping_trivial_usage \
1266 "host"
1267#ifndef BB_FEATURE_TRIVIAL_HELP
1268 "\n\nSend ICMP ECHO_REQUEST packets to network hosts"
1269#endif
1270#endif
1271DO_COMMA
1272#else /* ! defined BB_FEATURE_SIMPLE_PING */
1273#if defined USAGE_ENUM
1274ping_usage_index
1275#elif defined USAGE_MESSAGES
1276 "[OPTION]... host" 745 "[OPTION]... host"
1277#ifndef BB_FEATURE_TRIVIAL_HELP 746#define ping_full_usage \
1278 "\n\nSend ICMP ECHO_REQUEST packets to network hosts.\n\n" 747 "Send ICMP ECHO_REQUEST packets to network hosts.\n\n" \
1279 "Options:\n" 748 "Options:\n" \
1280 "\t-c COUNT\tSend only COUNT pings.\n" 749 "\t-c COUNT\tSend only COUNT pings.\n" \
1281 "\t-s SIZE\t\tSend SIZE data bytes in packets (default=56).\n" 750 "\t-s SIZE\t\tSend SIZE data bytes in packets (default=56).\n" \
1282 "\t-q\t\tQuiet mode, only displays output at start\n" 751 "\t-q\t\tQuiet mode, only displays output at start\n" \
1283 "\t\t\tand when finished." 752 "\t\t\tand when finished."
1284#endif 753#endif
1285#endif
1286DO_COMMA
1287#endif
1288#endif
1289 754
1290#if defined BB_PIVOT_ROOT 755#define pivot_root_trivial_usage \
1291#if defined USAGE_ENUM
1292pivot_root_usage_index
1293#elif defined USAGE_MESSAGES
1294 "new_root put_old" 756 "new_root put_old"
1295#ifndef BB_FEATURE_TRIVIAL_HELP 757#define pivot_root_full_usage \
1296 "\n\nMove the current root file system to put_old and make new_root\n" 758 "Move the current root file system to put_old and make new_root\n" \
1297 "the new root file system." 759 "the new root file system."
1298#endif
1299#endif
1300DO_COMMA
1301#endif
1302 760
1303#if defined BB_POWEROFF 761#define poweroff_trivial_usage \
1304#if defined USAGE_ENUM
1305poweroff_usage_index
1306#elif defined USAGE_MESSAGES
1307 "" 762 ""
1308#ifndef BB_FEATURE_TRIVIAL_HELP 763#define poweroff_full_usage \
1309 "\n\nHalt the system and request that the kernel shut off the power." 764 "Halt the system and request that the kernel shut off the power."
1310#endif
1311#endif
1312DO_COMMA
1313#endif
1314 765
1315#if defined BB_PRINTF 766#define printf_trivial_usage \
1316#if defined USAGE_ENUM
1317printf_usage_index
1318#elif defined USAGE_MESSAGES
1319 "FORMAT [ARGUMENT...]" 767 "FORMAT [ARGUMENT...]"
1320#ifndef BB_FEATURE_TRIVIAL_HELP 768#define printf_full_usage \
1321 "\n\nFormats and prints ARGUMENT(s) according to FORMAT,\n" 769 "Formats and prints ARGUMENT(s) according to FORMAT,\n" \
1322 "Where FORMAT controls the output exactly as in C printf." 770 "Where FORMAT controls the output exactly as in C printf."
1323#endif
1324#endif
1325DO_COMMA
1326#endif
1327 771
1328#if defined BB_PS 772#define ps_trivial_usage \
1329#if defined USAGE_ENUM
1330ps_usage_index
1331#elif defined USAGE_MESSAGES
1332 "" 773 ""
1333#ifndef BB_FEATURE_TRIVIAL_HELP 774#define ps_full_usage \
1334 "\n\nReport process status\n" 775 "Report process status\n" \
1335 "\nThis version of ps accepts no options." 776 "\nThis version of ps accepts no options."
1336#endif
1337#endif
1338DO_COMMA
1339#endif
1340 777
1341#if defined BB_PWD 778#define pwd_trivial_usage \
1342#if defined USAGE_ENUM
1343pwd_usage_index
1344#elif defined USAGE_MESSAGES
1345 "" 779 ""
1346#ifndef BB_FEATURE_TRIVIAL_HELP 780#define pwd_full_usage \
1347 "\n\nPrint the full filename of the current working directory." 781 "Print the full filename of the current working directory."
1348#endif
1349#endif
1350DO_COMMA
1351#endif
1352 782
1353#if defined BB_RDATE 783#define rdate_trivial_usage \
1354#if defined USAGE_ENUM
1355rdate_usage_index
1356#elif defined USAGE_MESSAGES
1357 "[OPTION] HOST" 784 "[OPTION] HOST"
1358#ifndef BB_FEATURE_TRIVIAL_HELP 785#define rdate_full_usage \
1359 "\n\nGet and possibly set the system date and time from a remote HOST.\n" 786 "Get and possibly set the system date and time from a remote HOST.\n" \
1360 "Options:\n" 787 "Options:\n" \
1361 "\t-s\tSet the system date and time (default).\n" 788 "\t-s\tSet the system date and time (default).\n" \
1362 "\t-p\tPrint the date and time." 789 "\t-p\tPrint the date and time."
1363#endif
1364#endif
1365DO_COMMA
1366#endif
1367 790
1368#if defined BB_READLINK 791#define readlink_trivial_usage \
1369#if defined USAGE_ENUM
1370readlink_usage_index
1371#elif defined USAGE_MESSAGES
1372 "" 792 ""
1373#ifndef BB_FEATURE_TRIVIAL_HELP 793#define readlink_full_usage \
1374 "\n\nRead a symbolic link." 794 "Read a symbolic link."
1375#endif
1376#endif
1377DO_COMMA
1378#endif
1379 795
1380#if defined BB_REBOOT 796#define reboot_trivial_usage \
1381#if defined USAGE_ENUM
1382reboot_usage_index
1383#elif defined USAGE_MESSAGES
1384 "" 797 ""
1385#ifndef BB_FEATURE_TRIVIAL_HELP 798#define reboot_full_usage \
1386 "\n\nReboot the system." 799 "Reboot the system."
1387#endif 800
1388#endif 801#define renice_trivial_usage \
1389DO_COMMA
1390#endif
1391
1392#if defined BB_RENICE
1393#if defined USAGE_ENUM
1394renice_usage_index
1395#elif defined USAGE_MESSAGES
1396 "priority pid [pid ...]" 802 "priority pid [pid ...]"
1397#ifndef BB_FEATURE_TRIVIAL_HELP 803#define renice_full_usage \
1398 "\n\nChanges priority of running processes. Allowed priorities range\n" 804 "Changes priority of running processes. Allowed priorities range\n" \
1399 "from 20 (the process runs only when nothing else is running) to 0\n" 805 "from 20 (the process runs only when nothing else is running) to 0\n" \
1400 "(default priority) to -20 (almost nothing else ever gets to run)." 806 "(default priority) to -20 (almost nothing else ever gets to run)."
1401#endif
1402#endif
1403DO_COMMA
1404#endif
1405
1406 807
1407#if defined BB_RESET 808#define reset_trivial_usage \
1408#if defined USAGE_ENUM
1409reset_usage_index
1410#elif defined USAGE_MESSAGES
1411 "" 809 ""
1412#ifndef BB_FEATURE_TRIVIAL_HELP 810#define reset_full_usage \
1413 "\n\nResets the screen." 811 "Resets the screen."
1414#endif
1415#endif
1416DO_COMMA
1417#endif
1418 812
1419#if defined BB_RM 813#define rm_trivial_usage \
1420#if defined USAGE_ENUM
1421rm_usage_index
1422#elif defined USAGE_MESSAGES
1423 "[OPTION]... FILE..." 814 "[OPTION]... FILE..."
1424#ifndef BB_FEATURE_TRIVIAL_HELP 815#define rm_full_usage \
1425 "\n\nRemove (unlink) the FILE(s). You may use '--' to\n" 816 "Remove (unlink) the FILE(s). You may use '--' to\n" \
1426 "indicate that all following arguments are non-options.\n\n" 817 "indicate that all following arguments are non-options.\n\n" \
1427 "Options:\n" 818 "Options:\n" \
1428 "\t-f\t\tremove existing destinations, never prompt\n" 819 "\t-f\t\tremove existing destinations, never prompt\n" \
1429 "\t-r or -R\tremove the contents of directories recursively" 820 "\t-r or -R\tremove the contents of directories recursively"
1430#endif
1431#endif
1432DO_COMMA
1433#endif
1434 821
1435#if defined BB_RMDIR 822#define rmdir_trivial_usage \
1436#if defined USAGE_ENUM
1437rmdir_usage_index
1438#elif defined USAGE_MESSAGES
1439 "[OPTION]... DIRECTORY..." 823 "[OPTION]... DIRECTORY..."
1440#ifndef BB_FEATURE_TRIVIAL_HELP 824#define rmdir_full_usage \
1441 "\n\nRemove the DIRECTORY(ies), if they are empty." 825 "Remove the DIRECTORY(ies), if they are empty."
1442#endif
1443#endif
1444DO_COMMA
1445#endif
1446 826
1447#if defined BB_RMMOD 827#define rmmod_trivial_usage \
1448#if defined USAGE_ENUM
1449rmmod_usage_index
1450#elif defined USAGE_MESSAGES
1451 "[OPTION]... [MODULE]..." 828 "[OPTION]... [MODULE]..."
1452#ifndef BB_FEATURE_TRIVIAL_HELP 829#define rmmod_full_usage \
1453 "\n\nUnloads the specified kernel modules from the kernel.\n\n" 830 "Unloads the specified kernel modules from the kernel.\n\n" \
1454 "Options:\n" 831 "Options:\n" \
1455 "\t-a\tTry to remove all unused kernel modules." 832 "\t-a\tTry to remove all unused kernel modules."
1456#endif
1457#endif
1458DO_COMMA
1459#endif
1460 833
1461#if defined BB_ROUTE 834#define route_trivial_usage \
1462#if defined USAGE_ENUM
1463route_usage_index
1464#elif defined USAGE_MESSAGES
1465 "[{add|del|flush}]" 835 "[{add|del|flush}]"
1466#ifndef BB_FEATURE_TRIVIAL_HELP 836#define route_full_usage \
1467 "\n\nEdit the kernel's routing tables" 837 "Edit the kernel's routing tables"
1468#endif
1469#endif
1470DO_COMMA
1471#endif
1472 838
1473#if defined BB_RPMUNPACK 839#define rpmunpack_trivial_usage \
1474#if defined USAGE_ENUM
1475rpmunpack_usage_index
1476#elif defined USAGE_MESSAGES
1477 "< package.rpm | gunzip | cpio -idmuv" 840 "< package.rpm | gunzip | cpio -idmuv"
1478#ifndef BB_FEATURE_TRIVIAL_HELP 841#define rpmunpack_full_usage \
1479 "\n\nExtracts an rpm archive." 842 "Extracts an rpm archive."
1480#endif
1481#endif
1482DO_COMMA
1483#endif
1484 843
1485#if defined BB_SED 844#define sed_trivial_usage \
1486#if defined USAGE_ENUM
1487sed_usage_index
1488#elif defined USAGE_MESSAGES
1489 "[-Vhnef] pattern [files...]" 845 "[-Vhnef] pattern [files...]"
1490#ifndef BB_FEATURE_TRIVIAL_HELP 846#define sed_full_usage \
1491 "\n\n" 847 "-n\t\tsuppress automatic printing of pattern space\n" \
1492 "-n\t\tsuppress automatic printing of pattern space\n" 848 "-e script\tadd the script to the commands to be executed\n" \
1493 "-e script\tadd the script to the commands to be executed\n" 849 "-f scriptfile\tadd the contents of script-file to the commands to be executed\n" \
1494 "-f scriptfile\tadd the contents of script-file to the commands to be executed\n" 850 "-h\t\tdisplay this help message\n" \
1495 "\n" 851 "\n" \
1496 "If no -e or -f is given, the first non-option argument is taken as the\n" 852 "If no -e or -f is given, the first non-option argument is taken as the\n" \
1497 "sed script to interpret. All remaining arguments are names of input\n" 853 "sed script to interpret. All remaining arguments are names of input\n" \
1498 "files; if no input files are specified, then the standard input is read." 854 "files; if no input files are specified, then the standard input is read."
1499#endif
1500#endif
1501DO_COMMA
1502#endif
1503 855
1504#if defined BB_SETKEYCODES 856#define setkeycodes_trivial_usage \
1505#if defined USAGE_ENUM
1506setkeycodes_usage_index
1507#elif defined USAGE_MESSAGES
1508 "SCANCODE KEYCODE ..." 857 "SCANCODE KEYCODE ..."
1509#ifndef BB_FEATURE_TRIVIAL_HELP 858#define setkeycodes_full_usage \
1510 "\n\nSet entries into the kernel's scancode-to-keycode map,\n" 859 "Set entries into the kernel's scancode-to-keycode map,\n" \
1511 "allowing unusual keyboards to generate usable keycodes.\n\n" 860 "allowing unusual keyboards to generate usable keycodes.\n\n" \
1512 "SCANCODE may be either xx or e0xx (hexadecimal),\n" 861 "SCANCODE may be either xx or e0xx (hexadecimal),\n" \
1513 "and KEYCODE is given in decimal" 862 "and KEYCODE is given in decimal"
1514#endif
1515#endif
1516DO_COMMA
1517#endif
1518 863
1519#if defined BB_SH 864#define sh_trivial_usage \
1520#if defined USAGE_ENUM 865 "[FILE]...\n or: sh -c command [args]..."
1521shell_usage_index 866#define sh_full_usage \
1522#elif defined USAGE_MESSAGES 867 "lash: The BusyBox command interpreter (shell)."
1523 "[FILE]...\n"
1524 " or: sh -c command [args]..."
1525#ifndef BB_FEATURE_TRIVIAL_HELP
1526 "\n\nlash: The BusyBox command interpreter (shell)."
1527#endif
1528#endif
1529DO_COMMA
1530#endif
1531 868
1532#if defined BB_SLEEP 869#define sleep_trivial_usage \
1533#if defined USAGE_ENUM 870 "N"
1534sleep_usage_index 871#define sleep_full_usage \
1535#elif defined USAGE_MESSAGES 872 "Pause for N seconds."
1536 "N"
1537#ifndef BB_FEATURE_TRIVIAL_HELP
1538 "\n\nPause for N seconds."
1539#endif
1540#endif
1541DO_COMMA
1542#endif
1543 873
1544#if defined BB_SORT
1545#if defined USAGE_ENUM
1546sort_usage_index
1547#elif defined USAGE_MESSAGES
1548 "[-n]"
1549#ifdef BB_FEATURE_SORT_REVERSE
1550 " [-r]"
1551#endif
1552 " [FILE]..."
1553#ifndef BB_FEATURE_TRIVIAL_HELP
1554 "\n\nSorts lines of text in the specified files"
1555#endif
1556#endif
1557DO_COMMA
1558#endif
1559 874
1560#if defined BB_STTY 875#ifdef BB_FEATURE_SORT_REVERSE
1561#if defined USAGE_ENUM 876 #define USAGE_SORT_REVERSE(a) a
1562stty_usage_index 877#else
1563#elif defined USAGE_MESSAGES 878 #define USAGE_SORT_REVERSE(a)
1564 "stty [-a|g] [-F device] [SETTING]..." 879#endif
1565#ifndef BB_FEATURE_TRIVIAL_HELP 880#define sort_trivial_usage \
1566 "\n\nWithout arguments, prints baud rate, line discipline," 881 "[-n]" USAGE_SORT_REVERSE(" [-r]") " [FILE]..."
1567 "\nand deviations from stty sane." 882#define sort_full_usage \
1568 "\n -F device open and use the specified device instead of stdin" 883 "Sorts lines of text in the specified files"
1569 "\n -a print all current settings in human-readable form. Or" 884
1570 "\n -g print in a stty-readable form" 885#define stty_trivial_usage \
886 "[-a|g] [-F device] [SETTING]..."
887#define stty_full_usage \
888 "Without arguments, prints baud rate, line discipline," \
889 "\nand deviations from stty sane." \
890 "\n -F device open and use the specified device instead of stdin" \
891 "\n -a print all current settings in human-readable form. Or" \
892 "\n -g print in a stty-readable form" \
1571 "\n [SETTING] see in documentation" 893 "\n [SETTING] see in documentation"
1572#endif
1573#endif
1574DO_COMMA
1575#endif
1576 894
1577#if defined BB_SWAPONOFF 895#define swapoff_trivial_usage \
1578#if defined USAGE_ENUM
1579swapoff_usage_index
1580#elif defined USAGE_MESSAGES
1581 "[OPTION] [device]" 896 "[OPTION] [device]"
1582#ifndef BB_FEATURE_TRIVIAL_HELP 897#define swapoff_full_usage \
1583 "\n\nStop swapping virtual memory pages on the given device.\n\n" 898 "Stop swapping virtual memory pages on the given device.\n\n" \
1584 "Options:\n" 899 "Options:\n" \
1585 "\t-a\tStop swapping on all swap devices" 900 "\t-a\tStop swapping on all swap devices"
1586#endif
1587#endif
1588DO_COMMA
1589#endif
1590 901
1591#if defined BB_SWAPONOFF 902#define swapon_trivial_usage \
1592#if defined USAGE_ENUM
1593swapon_usage_index
1594#elif defined USAGE_MESSAGES
1595 "[OPTION] [device]" 903 "[OPTION] [device]"
1596#ifndef BB_FEATURE_TRIVIAL_HELP 904#define swapon_full_usage \
1597 "\n\nStart swapping virtual memory pages on the given device.\n\n" 905 "Start swapping virtual memory pages on the given device.\n\n" \
1598 "Options:\n" 906 "Options:\n" \
1599 "\t-a\tStart swapping on all swap devices" 907 "\t-a\tStart swapping on all swap devices"
1600#endif
1601#endif
1602DO_COMMA
1603#endif
1604 908
1605#if defined BB_SYNC 909#define sync_trivial_usage \
1606#if defined USAGE_ENUM
1607sync_usage_index
1608#elif defined USAGE_MESSAGES
1609 "" 910 ""
1610#ifndef BB_FEATURE_TRIVIAL_HELP 911#define sync_full_usage \
1611 "\n\nWrite all buffered filesystem blocks to disk." 912 "Write all buffered filesystem blocks to disk."
1612#endif 913
1613#endif
1614DO_COMMA
1615#endif
1616 914
1617#if defined BB_SYSLOGD
1618#if defined USAGE_ENUM
1619syslogd_usage_index
1620#elif defined USAGE_MESSAGES
1621 "[OPTION]..."
1622#ifndef BB_FEATURE_TRIVIAL_HELP
1623 "\n\nLinux system and kernel (provides klogd) logging utility.\n"
1624 "Note that this version of syslogd/klogd ignores /etc/syslog.conf.\n\n"
1625 "Options:\n"
1626 "\t-m NUM\t\tInterval between MARK lines (default=20min, 0=off)\n"
1627 "\t-n\t\tRun as a foreground process\n"
1628#ifdef BB_FEATURE_KLOGD 915#ifdef BB_FEATURE_KLOGD
1629 "\t-K\t\tDo not start up the klogd process\n" 916 #define USAGE_KLOGD(a) a
917#else
918 #define USAGE_KLOGD(a)
1630#endif 919#endif
1631 "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)"
1632#ifdef BB_FEATURE_REMOTE_LOG 920#ifdef BB_FEATURE_REMOTE_LOG
1633 "\n\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n" 921 #define USAGE_REMOTE_LOG(a) a
1634 "\t-L\t\tLog locally as well as network logging (default is network only)" 922#else
1635#endif 923 #define USAGE_REMOTE_LOG(a)
1636#endif
1637#endif 924#endif
1638DO_COMMA 925#define syslogd_trivial_usage \
926 "[OPTION]..."
927#define syslogd_full_usage \
928 "Linux system and kernel (provides klogd) logging utility.\n" \
929 "Note that this version of syslogd/klogd ignores /etc/syslog.conf.\n\n" \
930 "Options:\n" \
931 "\t-m NUM\t\tInterval between MARK lines (default=20min, 0=off)\n" \
932 "\t-n\t\tRun as a foreground process\n" \
933USAGE_KLOGD("\t-K\t\tDo not start up the klogd process\n") \
934 "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)" \
935USAGE_REMOTE_LOG( \
936 "\n\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n" \
937 "\t-L\t\tLog locally as well as network logging (default is network only)")
938
939
940#ifdef BB_FEATURE_SIMPLE_TAIL
941 #define USAGE_UNSIMPLE_TAIL(a)
942#else
943 #define USAGE_UNSIMPLE_TAIL(a) a
1639#endif 944#endif
1640 945#define tail_trivial_usage \
1641#if defined BB_TAIL
1642#if defined USAGE_ENUM
1643tail_usage_index
1644#elif defined USAGE_MESSAGES
1645 "[OPTION]... [FILE]..." 946 "[OPTION]... [FILE]..."
1646#ifndef BB_FEATURE_TRIVIAL_HELP 947#define tail_full_usage \
1647 "\n\nPrint last 10 lines of each FILE to standard output.\n" 948 "Print last 10 lines of each FILE to standard output.\n" \
1648 "With more than one FILE, precede each with a header giving the\n" 949 "With more than one FILE, precede each with a header giving the\n" \
1649 "file name. With no FILE, or when FILE is -, read standard input.\n\n" 950 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
1650 "Options:\n" 951 "Options:\n" \
1651#ifndef BB_FEATURE_SIMPLE_TAIL 952USAGE_UNSIMPLE_TAIL("\t-c N[kbm]\toutput the last N bytes\n") \
1652 "\t-c N[kbm]\toutput the last N bytes\n" 953 "\t-n N[kbm]\tprint last N lines instead of last 10\n" \
1653#endif 954 "\t-f\t\toutput data as the file grows" \
1654 "\t-n N[kbm]\tprint last N lines instead of last 10\n" 955USAGE_UNSIMPLE_TAIL( \
1655 "\t-f\t\toutput data as the file grows" 956 "\n\t-q\t\tnever output headers giving file names\n" \
1656#ifndef BB_FEATURE_SIMPLE_TAIL 957 "\t-s SEC\t\twait SEC seconds between reads with -f\n" \
1657 "\n\t-q\t\tnever output headers giving file names\n" 958 "\t-v\t\talways output headers giving file names\n\n" \
1658 "\t-s SEC\t\twait SEC seconds between reads with -f\n" 959 "If the first character of N (bytes or lines) is a `+', output begins with \n" \
1659 "\t-v\t\talways output headers giving file names\n\n" 960 "the Nth item from the start of each file, otherwise, print the last N items\n" \
1660 "If the first character of N (bytes or lines) is a `+', output begins with \n" 961 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." \
1661 "the Nth item from the start of each file, otherwise, print the last N items\n" 962 )
1662 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)."
1663//#else
1664// "\nIf the first character of N (bytes or lines) is a `+', output begins with \n"
1665// "the Nth item from the start of each file."
1666#endif
1667#endif
1668#endif
1669DO_COMMA
1670#endif
1671 963
1672#if defined BB_TAR
1673#if defined USAGE_ENUM
1674tar_usage_index
1675#elif defined USAGE_MESSAGES
1676#ifdef BB_FEATURE_TAR_CREATE 964#ifdef BB_FEATURE_TAR_CREATE
1677 "-[cxtvO] " 965 #define USAGE_TAR_CREATE(a) a
1678#else 966#else
1679 "-[xtvO] " 967 #define USAGE_TAR_CREATE(a)
1680#endif 968#endif
1681#if defined BB_FEATURE_TAR_EXCLUDE 969#ifdef BB_FEATURE_TAR_EXCLUDE
1682 "[--exclude File] " 970 #define USAGE_TAR_EXCLUDE(a) a
1683 "[-X File]" 971#else
972 #define USAGE_TAR_EXCLUDE(a)
1684#endif 973#endif
974#define tar_trivial_usage \
975 "-[" USAGE_TAR_CREATE("c") "xtvO] " \
976 USAGE_TAR_EXCLUDE("[--exclude File] [-X File]") \
1685 "[-f tarFile] [FILE(s)] ..." 977 "[-f tarFile] [FILE(s)] ..."
1686#ifndef BB_FEATURE_TRIVIAL_HELP 978#define tar_full_usage \
1687 "\n\nCreate, extract, or list files from a tar file.\n\n" 979 "Create, extract, or list files from a tar file.\n\n" \
1688 "Main operation mode:\n" 980 "Main operation mode:\n" \
1689#ifdef BB_FEATURE_TAR_CREATE 981USAGE_TAR_CREATE("\tc\t\tcreate\n") \
1690 "\tc\t\tcreate\n" 982 "\tx\t\textract\n" \
1691#endif 983 "\tt\t\tlist\n" \
1692 "\tx\t\textract\n" 984 "\nFile selection:\n" \
1693 "\tt\t\tlist\n" 985 "\tf\t\tname of tarfile or \"-\" for stdin\n" \
1694 "\nFile selection:\n" 986 "\tO\t\textract to stdout\n" \
1695 "\tf\t\tname of tarfile or \"-\" for stdin\n" 987USAGE_TAR_EXCLUDE( \
1696 "\tO\t\textract to stdout\n" 988 "\texclude\t\tfile to exclude\n" \
1697#if defined BB_FEATURE_TAR_EXCLUDE 989 "\tX\t\tfile with names to exclude\n" \
1698 "\texclude\t\tfile to exclude\n" 990 ) \
1699 "\tX\t\tfile with names to exclude\n" 991 "\nInformative output:\n" \
1700#endif
1701 "\nInformative output:\n"
1702 "\tv\t\tverbosely list files processed" 992 "\tv\t\tverbosely list files processed"
1703#endif
1704#endif
1705DO_COMMA
1706#endif
1707 993
1708#if defined BB_TEE 994#define tee_trivial_usage \
1709#if defined USAGE_ENUM
1710tee_usage_index
1711#elif defined USAGE_MESSAGES
1712 "[OPTION]... [FILE]..." 995 "[OPTION]... [FILE]..."
1713#ifndef BB_FEATURE_TRIVIAL_HELP 996#define tee_full_usage \
1714 "\n\nCopy standard input to each FILE, and also to standard output.\n\n" 997 "Copy standard input to each FILE, and also to standard output.\n\n" \
1715 "Options:\n" "\t-a\tappend to the given FILEs, do not overwrite" 998 "Options:\n" "\t-a\tappend to the given FILEs, do not overwrite"
1716#endif
1717#endif
1718DO_COMMA
1719#endif
1720 999
1721#if defined BB_TELNET 1000#define telnet_trivial_usage \
1722#if defined USAGE_ENUM
1723telnet_usage_index
1724#elif defined USAGE_MESSAGES
1725 "host [port]" 1001 "host [port]"
1726#ifndef BB_FEATURE_TRIVIAL_HELP 1002#define telnet_full_usage \
1727 "\n\nTelnet is used to establish interactive communication with another\n" 1003 "Telnet is used to establish interactive communication with another\n"\
1728 "computer over a network using the TELNET protocol." 1004 "computer over a network using the TELNET protocol."
1729#endif
1730#endif
1731DO_COMMA
1732#endif
1733 1005
1734#if defined BB_TEST 1006#define test_trivial_usage \
1735#if defined USAGE_ENUM 1007 "EXPRESSION\n or [ EXPRESSION ]"
1736test_usage_index 1008#define test_full_usage \
1737#elif defined USAGE_MESSAGES 1009 "Checks file types and compares values returning an exit\n" \
1738 "\ntest EXPRESSION\n"
1739 "or [ EXPRESSION ]"
1740#ifndef BB_FEATURE_TRIVIAL_HELP
1741 "\n\nChecks file types and compares values returning an exit\n"
1742 "code determined by the value of EXPRESSION." 1010 "code determined by the value of EXPRESSION."
1743#endif
1744#endif
1745DO_COMMA
1746#endif
1747 1011
1748#if defined BB_TOUCH 1012#define touch_trivial_usage \
1749#if defined USAGE_ENUM
1750touch_usage_index
1751#elif defined USAGE_MESSAGES
1752 "[-c] file [file ...]" 1013 "[-c] file [file ...]"
1753#ifndef BB_FEATURE_TRIVIAL_HELP 1014#define touch_full_usage \
1754 "\n\nUpdate the last-modified date on the given file[s].\n\n" 1015 "Update the last-modified date on the given file[s].\n\n" \
1755 "Options:\n" 1016 "Options:\n" \
1756 "\t-c\tDo not create any files" 1017 "\t-c\tDo not create any files"
1757#endif
1758#endif
1759DO_COMMA
1760#endif
1761 1018
1762#if defined BB_TR 1019#define tr_trivial_usage \
1763#if defined USAGE_ENUM
1764tr_usage_index
1765#elif defined USAGE_MESSAGES
1766 "[-cds] STRING1 [STRING2]" 1020 "[-cds] STRING1 [STRING2]"
1767#ifndef BB_FEATURE_TRIVIAL_HELP 1021#define tr_full_usage \
1768 "\n\nTranslate, squeeze, and/or delete characters from\n" 1022 "Translate, squeeze, and/or delete characters from\n" \
1769 "standard input, writing to standard output.\n\n" 1023 "standard input, writing to standard output.\n\n" \
1770 "Options:\n" 1024 "Options:\n" \
1771 "\t-c\ttake complement of STRING1\n" 1025 "\t-c\ttake complement of STRING1\n" \
1772 "\t-d\tdelete input characters coded STRING1\n" 1026 "\t-d\tdelete input characters coded STRING1\n" \
1773 "\t-s\tsqueeze multiple output characters of STRING2 into one character" 1027 "\t-s\tsqueeze multiple output characters of STRING2 into one character"
1774#endif
1775#endif
1776DO_COMMA
1777#endif
1778 1028
1779#if defined BB_TRUE_FALSE 1029#define true_trivial_usage \
1780#if defined USAGE_ENUM
1781true_usage_index
1782#elif defined USAGE_MESSAGES
1783 "" 1030 ""
1784#ifndef BB_FEATURE_TRIVIAL_HELP 1031#define true_full_usage \
1785 "\n\nReturn an exit code of TRUE (0)." 1032 "Return an exit code of TRUE (0)."
1786#endif
1787#endif
1788DO_COMMA
1789#endif
1790 1033
1791#if defined BB_TTY 1034#define tty_trivial_usage \
1792#if defined USAGE_ENUM
1793tty_usage_index
1794#elif defined USAGE_MESSAGES
1795 "" 1035 ""
1796#ifndef BB_FEATURE_TRIVIAL_HELP 1036#define tty_full_usage \
1797 "\n\nPrint the file name of the terminal connected to standard input.\n\n" 1037 "Print the file name of the terminal connected to standard input.\n\n"\
1798 "Options:\n" 1038 "Options:\n" \
1799 "\t-s\tprint nothing, only return an exit status" 1039 "\t-s\tprint nothing, only return an exit status"
1800#endif
1801#endif
1802DO_COMMA
1803#endif
1804 1040
1805#if defined BB_UMOUNT 1041#ifdef BB_FEATURE_MOUNT_FORCE
1806#if defined USAGE_ENUM 1042 #define USAGE_MOUNT_FORCE(a) a
1807umount_usage_index
1808#elif defined USAGE_MESSAGES
1809 "[flags] filesystem|directory"
1810#ifndef BB_FEATURE_TRIVIAL_HELP
1811 "\nUnmount file systems\n"
1812 "\nFlags:\n" "\t-a:\tUnmount all file systems"
1813#ifdef BB_MTAB
1814 " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n"
1815#else 1043#else
1816 "\n" 1044 #define USAGE_MOUNT_FORCE(a)
1817#endif
1818 "\t-r:\tTry to remount devices as read-only if mount is busy"
1819#if defined BB_FEATURE_MOUNT_FORCE
1820 "\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)"
1821#endif
1822#if defined BB_FEATURE_MOUNT_LOOP
1823 "\n\t-l:\tDo not free loop device (if a loop device has been used)"
1824#endif 1045#endif
1825#endif 1046#define umount_trivial_usage \
1826#endif 1047 "[flags] filesystem|directory"
1827DO_COMMA 1048#define umount_full_usage \
1828#endif 1049 "Unmount file systems\n" \
1829 1050 "\nFlags:\n" "\t-a:\tUnmount all file systems" \
1830#if defined BB_UNAME 1051USAGE_MTAB(" in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries") \
1831#if defined USAGE_ENUM 1052 "\n\t-r:\tTry to remount devices as read-only if mount is busy" \
1832uname_usage_index 1053USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \
1833#elif defined USAGE_MESSAGES 1054USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)" \
1055 )
1056
1057#define uname_trivial_usage \
1834 "[OPTION]..." 1058 "[OPTION]..."
1835#ifndef BB_FEATURE_TRIVIAL_HELP 1059#define uname_full_usage \
1836 "\n\nPrint certain system information. With no OPTION, same as -s.\n\n" 1060 "Print certain system information. With no OPTION, same as -s.\n\n" \
1837 "Options:\n" 1061 "Options:\n" \
1838 "\t-a\tprint all information\n" 1062 "\t-a\tprint all information\n" \
1839 "\t-m\tthe machine (hardware) type\n" 1063 "\t-m\tthe machine (hardware) type\n" \
1840 "\t-n\tprint the machine's network node hostname\n" 1064 "\t-n\tprint the machine's network node hostname\n" \
1841 "\t-r\tprint the operating system release\n" 1065 "\t-r\tprint the operating system release\n" \
1842 "\t-s\tprint the operating system name\n" 1066 "\t-s\tprint the operating system name\n" \
1843 1067 "\t-p\tprint the host processor type\n" \
1844 "\t-p\tprint the host processor type\n"
1845 "\t-v\tprint the operating system version" 1068 "\t-v\tprint the operating system version"
1846#endif
1847#endif
1848DO_COMMA
1849#endif
1850 1069
1851#if defined BB_UNIQ 1070#define uniq_trivial_usage \
1852#if defined USAGE_ENUM
1853uniq_usage_index
1854#elif defined USAGE_MESSAGES
1855 "[OPTION]... [INPUT [OUTPUT]]" 1071 "[OPTION]... [INPUT [OUTPUT]]"
1856#ifndef BB_FEATURE_TRIVIAL_HELP 1072#define uniq_full_usage \
1857 "\n\nDiscard all but one of successive identical lines from INPUT\n" 1073 "Discard all but one of successive identical lines from INPUT\n" \
1858 "(or standard input), writing to OUTPUT (or standard output).\n" 1074 "(or standard input), writing to OUTPUT (or standard output).\n" \
1859 "Options:\n" 1075 "Options:\n" \
1860 "\t-c\tprefix lines by the number of occurrences\n" 1076 "\t-c\tprefix lines by the number of occurrences\n" \
1861 "\t-d\tonly print duplicate lines\n" 1077 "\t-d\tonly print duplicate lines\n" \
1862 "\t-u\tonly print unique lines" 1078 "\t-u\tonly print unique lines"
1863#endif
1864#endif
1865DO_COMMA
1866#endif
1867 1079
1868#if defined BB_UNIX2DOS 1080#define unix2dos_trivial_usage \
1869#if defined USAGE_ENUM
1870unix2dos_usage_index
1871#elif defined USAGE_MESSAGES
1872 "< unixfile > dosfile" 1081 "< unixfile > dosfile"
1873#ifndef BB_FEATURE_TRIVIAL_HELP 1082#define unix2dos_full_usage \
1874 "\n\nConverts a text file from unix format to dos format." 1083 "Converts a text file from unix format to dos format."
1875#endif
1876#endif
1877DO_COMMA
1878#endif
1879 1084
1880#if defined BB_UPDATE 1085#define update_trivial_usage \
1881#if defined USAGE_ENUM
1882update_usage_index
1883#elif defined USAGE_MESSAGES
1884 "[options]" 1086 "[options]"
1885#ifndef BB_FEATURE_TRIVIAL_HELP 1087#define update_full_usage \
1886 "\n\nPeriodically flushes filesystem buffers.\n\n" 1088 "Periodically flushes filesystem buffers.\n\n" \
1887 "Options:\n" 1089 "Options:\n" \
1888 "\t-S\tforce use of sync(2) instead of flushing\n" 1090 "\t-S\tforce use of sync(2) instead of flushing\n" \
1889 "\t-s SECS\tcall sync this often (default 30)\n" 1091 "\t-s SECS\tcall sync this often (default 30)\n" \
1890 "\t-f SECS\tflush some buffers this often (default 5)" 1092 "\t-f SECS\tflush some buffers this often (default 5)"
1891#endif
1892#endif
1893DO_COMMA
1894#endif
1895 1093
1896#if defined BB_UPTIME 1094#define uptime_trivial_usage \
1897#if defined USAGE_ENUM
1898uptime_usage_index
1899#elif defined USAGE_MESSAGES
1900 "" 1095 ""
1901#ifndef BB_FEATURE_TRIVIAL_HELP 1096#define uptime_full_usage \
1902 "\n\nDisplay the time since the last boot." 1097 "Display the time since the last boot."
1903#endif
1904#endif
1905DO_COMMA
1906#endif
1907 1098
1908#if defined BB_USLEEP 1099#define usleep_trivial_usage \
1909#if defined USAGE_ENUM
1910usleep_usage_index
1911#elif defined USAGE_MESSAGES
1912 "N" 1100 "N"
1913#ifndef BB_FEATURE_TRIVIAL_HELP 1101#define usleep_full_usage \
1914 "\n\nPause for N microseconds." 1102 "Pause for N microseconds."
1915#endif
1916#endif
1917DO_COMMA
1918#endif
1919 1103
1920#if defined BB_UUDECODE 1104#define uudecode_trivial_usage \
1921#if defined USAGE_ENUM
1922uudecode_usage_index
1923#elif defined USAGE_MESSAGES
1924 "[FILE]..." 1105 "[FILE]..."
1925#ifndef BB_FEATURE_TRIVIAL_HELP 1106#define uudecode_full_usage \
1926 "\n\nUudecode a file that is uuencoded.\n\n" 1107 "Uudecode a file that is uuencoded.\n\n" \
1927 "Options:\n" 1108 "Options:\n" \
1928 "\t-o FILE\tdirect output to FILE" 1109 "\t-o FILE\tdirect output to FILE" \
1929#endif
1930#endif
1931DO_COMMA
1932#endif
1933 1110
1934#if defined BB_UUENCODE 1111#define uuencode_trivial_usage \
1935#if defined USAGE_ENUM
1936uuencode_usage_index
1937#elif defined USAGE_MESSAGES
1938 "[OPTION] [INFILE] REMOTEFILE" 1112 "[OPTION] [INFILE] REMOTEFILE"
1939#ifndef BB_FEATURE_TRIVIAL_HELP 1113#define uuencode_full_usage \
1940 "\n\nUuencode a file.\n\n" 1114 "Uuencode a file.\n\n" \
1941 "Options:\n" 1115 "Options:\n" \
1942 "\t-m\tuse base64 encoding as of RFC1521" 1116 "\t-m\tuse base64 encoding as of RFC1521"
1943#endif
1944#endif
1945DO_COMMA
1946#endif
1947 1117
1948#if defined BB_WATCHDOG 1118#define watchdog_trivial_usage \
1949#if defined USAGE_ENUM
1950watchdog_usage_index
1951#elif defined USAGE_MESSAGES
1952 "dev" 1119 "dev"
1953#ifndef BB_FEATURE_TRIVIAL_HELP 1120#define watchdog_full_usage \
1954 "\n\nPeriodically write to watchdog device \"dev\"" 1121 "Periodically write to watchdog device \"dev\""
1955#endif
1956#endif
1957DO_COMMA
1958#endif
1959 1122
1960#if defined BB_WC 1123#define wc_trivial_usage \
1961#if defined USAGE_ENUM
1962wc_usage_index
1963#elif defined USAGE_MESSAGES
1964 "[OPTION]... [FILE]..." 1124 "[OPTION]... [FILE]..."
1965#ifndef BB_FEATURE_TRIVIAL_HELP 1125#define wc_full_usage \
1966 "\n\nPrint line, word, and byte counts for each FILE, and a total line if\n" 1126 "Print line, word, and byte counts for each FILE, and a total line if\n" \
1967 "more than one FILE is specified. With no FILE, read standard input.\n\n" 1127 "more than one FILE is specified. With no FILE, read standard input.\n\n" \
1968 "Options:\n" 1128 "Options:\n" \
1969 "\t-c\tprint the byte counts\n" 1129 "\t-c\tprint the byte counts\n" \
1970 "\t-l\tprint the newline counts\n" 1130 "\t-l\tprint the newline counts\n" \
1971 1131 "\t-L\tprint the length of the longest line\n" \
1972 "\t-L\tprint the length of the longest line\n"
1973 "\t-w\tprint the word counts" 1132 "\t-w\tprint the word counts"
1974#endif
1975#endif
1976DO_COMMA
1977#endif
1978 1133
1979#if defined BB_WGET 1134#define wget_trivial_usage \
1980#if defined USAGE_ENUM 1135 "[-c] [-O file] url"
1981wget_usage_index 1136#define wget_full_usage \
1982#elif defined USAGE_MESSAGES 1137 "wget retrieves files via HTTP\n\n" \
1983 "[-c] [-O file] url" 1138 "Options:\n" \
1984#ifndef BB_FEATURE_TRIVIAL_HELP 1139 "\t-c\tcontinue retrieval of aborted transfers\n" \
1985 "\n\nwget retrieves files via HTTP\n\n"
1986 "Options:\n"
1987 "\t-c\tcontinue retrieval of aborted transfers\n"
1988 "\t-O\tsave to filename ('-' for stdout)" 1140 "\t-O\tsave to filename ('-' for stdout)"
1989#endif
1990#endif
1991DO_COMMA
1992#endif
1993 1141
1994#if defined BB_WHICH 1142#define which_trivial_usage \
1995#if defined USAGE_ENUM
1996which_usage_index
1997#elif defined USAGE_MESSAGES
1998 "[COMMAND ...]" 1143 "[COMMAND ...]"
1999#ifndef BB_FEATURE_TRIVIAL_HELP 1144#define which_full_usage \
2000 "\n\nLocates a COMMAND." 1145 "Locates a COMMAND."
2001#endif
2002#endif
2003DO_COMMA
2004#endif
2005 1146
2006#if defined BB_WHOAMI 1147#define whoami_trivial_usage \
2007#if defined USAGE_ENUM
2008whoami_usage_index
2009#elif defined USAGE_MESSAGES
2010 "" 1148 ""
2011#ifndef BB_FEATURE_TRIVIAL_HELP 1149#define whoami_full_usage \
2012 "\n\nPrints the user name associated with the current effective user id." 1150 "Prints the user name associated with the current effective user id."
2013#endif
2014#endif
2015DO_COMMA
2016#endif
2017 1151
2018#if defined BB_XARGS 1152#define xargs_trivial_usage \
2019#if defined USAGE_ENUM 1153 "[COMMAND] [ARGS...]"
2020xargs_usage_index 1154#define xargs_full_usage \
2021#elif defined USAGE_MESSAGES 1155 "Executes COMMAND on every item given by standard input."
2022 "[COMMAND] [ARGS...]"
2023#ifndef BB_FEATURE_TRIVIAL_HELP
2024 "\n\nExecutes COMMAND on every item given by standard input."
2025#endif
2026#endif
2027DO_COMMA
2028#endif
2029 1156
2030#if defined BB_YES 1157#define yes_trivial_usage \
2031#if defined USAGE_ENUM
2032yes_usage_index
2033#elif defined USAGE_MESSAGES
2034 "[OPTION]... [STRING]..." 1158 "[OPTION]... [STRING]..."
2035#ifndef BB_FEATURE_TRIVIAL_HELP 1159#define yes_full_usage \
2036 "\n\nRepeatedly outputs a line with all specified STRING(s), or `y'." 1160 "Repeatedly outputs a line with all specified STRING(s), or `y'."
2037#endif
2038#endif
2039DO_COMMA
2040#endif
2041
2042#if defined USAGE_ENUM || defined USAGE_MESSAGES
2043};
2044#endif
2045
2046#undef DOCOMMA
2047#undef USAGE_ENUM
2048#undef USAGE_MESSAGES
2049 1161
1162#define zcat_trivial_usage \
1163 "FILE"
1164#define zcat_full_usage \
1165 "Uncompress to stdout."
diff --git a/busybox.h b/busybox.h
index aef537b2b..692a9084e 100644
--- a/busybox.h
+++ b/busybox.h
@@ -72,7 +72,6 @@ struct BB_applet {
72 const char* name; 72 const char* name;
73 int (*main)(int argc, char** argv); 73 int (*main)(int argc, char** argv);
74 enum Location location; 74 enum Location location;
75 int usage_index;
76}; 75};
77/* From busybox.c */ 76/* From busybox.c */
78extern const struct BB_applet applets[]; 77extern const struct BB_applet applets[];
@@ -87,12 +86,6 @@ extern const struct BB_applet applets[];
87#include "applets.h" 86#include "applets.h"
88#undef PROTOTYPES 87#undef PROTOTYPES
89 88
90#define APPLET_ENUM
91enum APPLET_INDEX_NUMBERS {
92#include "applets.h"
93};
94#undef APPLET_ENUM
95
96extern const char *applet_name; 89extern const char *applet_name;
97 90
98extern void show_usage(void) __attribute__ ((noreturn)); 91extern void show_usage(void) __attribute__ ((noreturn));
diff --git a/include/applets.h b/include/applets.h
index cb744567a..446906cad 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -14,33 +14,33 @@
14#undef APPLET_ODDNAME 14#undef APPLET_ODDNAME
15#undef APPLET_NOUSAGE 15#undef APPLET_NOUSAGE
16 16
17
17#if defined(PROTOTYPES) 18#if defined(PROTOTYPES)
18#define APPLET(a,b,c) \ 19 #define APPLET(a,b,c) extern int b(int argc, char **argv);
19 extern int b(int argc, char **argv); 20 #define APPLET_NOUSAGE(a,b,c) extern int b(int argc, char **argv);
20#define APPLET_ODDNAME(a,b,c,d,e) APPLET(a,b,c) 21 #define APPLET_ODDNAME(a,b,c,d) extern int b(int argc, char **argv);
21#define APPLET_NOUSAGE(a,b,c) \ 22 extern const char usage_messages[];
22 extern int b(int argc, char **argv); 23#elif defined(MAKE_USAGE)
23#elif defined(MAKE_LINKS) 24 #ifdef BB_FEATURE_TRIVIAL_HELP
24#define APPLET(a,b,c) LINK c #a 25 #define APPLET(a,b,c) a##_trivial_usage "\0"
25#define APPLET_ODDNAME(a,b,c,d,e) LINK c a 26 #define APPLET_NOUSAGE(a,b,c) "\0"
26#define APPLET_NOUSAGE(a,b,c) LINK c #a 27 #define APPLET_ODDNAME(a,b,c,d) d##_trivial_usage "\0"
27#elif defined(APPLET_ENUM) 28 #else
28#define APPLET(a,b,c) a##_applet_number, 29 #define APPLET(a,b,c) a##_trivial_usage "\n\n" a##_full_usage "\0"
29#define APPLET_ODDNAME(a,b,c,d,e) e##_applet_number, 30 #define APPLET_NOUSAGE(a,b,c) "\0"
30#define APPLET_NOUSAGE(a,b,c) a##applet_number, 31 #define APPLET_ODDNAME(a,b,c,d) d##_trivial_usage "\n\n" d##_full_usage "\0"
32 #endif
31#else 33#else
32#define USAGE_ENUM 34 const struct BB_applet applets[] = {
33#include "usage.h" 35 #define APPLET(a,b,c) {#a,b,c},
34const struct BB_applet applets[] = { 36 #define APPLET_NOUSAGE(a,b,c) {a,b,c},
35#define APPLET(a,b,c) {#a,b,c,a##_usage_index}, 37 #define APPLET_ODDNAME(a,b,c,d) {a,b,c},
36#define APPLET_ODDNAME(a,b,c,d,e) {a,b,c,d},
37#define APPLET_NOUSAGE(a,b,c) {#a,b,c,-1},
38#define zcat_usage_index gunzip_usage_index
39#define sh_usage_index shell_usage_index
40#endif 38#endif
41 39
40
41
42#ifdef BB_TEST 42#ifdef BB_TEST
43 APPLET_ODDNAME("[", test_main, _BB_DIR_USR_BIN, test_usage_index, open_bracket) 43 APPLET_NOUSAGE("[", test_main, _BB_DIR_USR_BIN)
44#endif 44#endif
45#ifdef BB_AR 45#ifdef BB_AR
46 APPLET(ar, ar_main, _BB_DIR_USR_BIN) 46 APPLET(ar, ar_main, _BB_DIR_USR_BIN)
@@ -48,7 +48,7 @@ const struct BB_applet applets[] = {
48#ifdef BB_BASENAME 48#ifdef BB_BASENAME
49 APPLET(basename, basename_main, _BB_DIR_USR_BIN) 49 APPLET(basename, basename_main, _BB_DIR_USR_BIN)
50#endif 50#endif
51 APPLET_NOUSAGE(busybox, busybox_main, _BB_DIR_BIN) 51 APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN)
52#ifdef BB_CAT 52#ifdef BB_CAT
53 APPLET(cat, cat_main, _BB_DIR_BIN) 53 APPLET(cat, cat_main, _BB_DIR_BIN)
54#endif 54#endif
@@ -107,7 +107,7 @@ const struct BB_applet applets[] = {
107 APPLET(dpkg, dpkg_main, _BB_DIR_USR_BIN) 107 APPLET(dpkg, dpkg_main, _BB_DIR_USR_BIN)
108#endif 108#endif
109#ifdef BB_DPKG_DEB 109#ifdef BB_DPKG_DEB
110 APPLET_ODDNAME("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb_usage_index, dpkg_deb) 110 APPLET_ODDNAME("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb)
111#endif 111#endif
112#ifdef BB_DU 112#ifdef BB_DU
113 APPLET(du, du_main, _BB_DIR_USR_BIN) 113 APPLET(du, du_main, _BB_DIR_USR_BIN)
@@ -128,7 +128,7 @@ const struct BB_applet applets[] = {
128 APPLET(false, false_main, _BB_DIR_BIN) 128 APPLET(false, false_main, _BB_DIR_BIN)
129#endif 129#endif
130#ifdef BB_FBSET 130#ifdef BB_FBSET
131 APPLET_NOUSAGE(fbset, fbset_main, _BB_DIR_USR_SBIN) 131 APPLET_NOUSAGE("fbset", fbset_main, _BB_DIR_USR_SBIN)
132#endif 132#endif
133#ifdef BB_FDFLUSH 133#ifdef BB_FDFLUSH
134 APPLET(fdflush, fdflush_main, _BB_DIR_BIN) 134 APPLET(fdflush, fdflush_main, _BB_DIR_BIN)
@@ -143,7 +143,7 @@ const struct BB_applet applets[] = {
143 APPLET(freeramdisk, freeramdisk_main, _BB_DIR_SBIN) 143 APPLET(freeramdisk, freeramdisk_main, _BB_DIR_SBIN)
144#endif 144#endif
145#ifdef BB_FSCK_MINIX 145#ifdef BB_FSCK_MINIX
146 APPLET_ODDNAME("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage_index, fsck_minix) 146 APPLET_ODDNAME("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix)
147#endif 147#endif
148#ifdef BB_GETOPT 148#ifdef BB_GETOPT
149 APPLET(getopt, getopt_main, _BB_DIR_BIN) 149 APPLET(getopt, getopt_main, _BB_DIR_BIN)
@@ -191,7 +191,7 @@ const struct BB_applet applets[] = {
191 APPLET(length, length_main, _BB_DIR_USR_BIN) 191 APPLET(length, length_main, _BB_DIR_USR_BIN)
192#endif 192#endif
193#ifdef BB_LINUXRC 193#ifdef BB_LINUXRC
194 APPLET_NOUSAGE(linuxrc, init_main, _BB_DIR_ROOT) 194 APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT)
195#endif 195#endif
196#ifdef BB_LN 196#ifdef BB_LN
197 APPLET(ln, ln_main, _BB_DIR_BIN) 197 APPLET(ln, ln_main, _BB_DIR_BIN)
@@ -230,7 +230,7 @@ const struct BB_applet applets[] = {
230 APPLET(mkfifo, mkfifo_main, _BB_DIR_USR_BIN) 230 APPLET(mkfifo, mkfifo_main, _BB_DIR_USR_BIN)
231#endif 231#endif
232#ifdef BB_MKFS_MINIX 232#ifdef BB_MKFS_MINIX
233 APPLET_ODDNAME("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage_index, mkfs_minix) 233 APPLET_ODDNAME("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix)
234#endif 234#endif
235#ifdef BB_MKNOD 235#ifdef BB_MKNOD
236 APPLET(mknod, mknod_main, _BB_DIR_BIN) 236 APPLET(mknod, mknod_main, _BB_DIR_BIN)
@@ -416,8 +416,8 @@ const struct BB_applet applets[] = {
416 APPLET(zcat, gunzip_main, _BB_DIR_BIN) 416 APPLET(zcat, gunzip_main, _BB_DIR_BIN)
417#endif 417#endif
418 418
419#if !defined(PROTOTYPES) && !defined(MAKE_LINKS) && !defined(APPLET_ENUM) 419#if !defined(PROTOTYPES) && !defined(MAKE_USAGE)
420 { 0,NULL,0,-1} 420 { 0,NULL,0 }
421}; 421};
422 422
423/* The -1 arises because of the {0,NULL,0,-1} entry above. */ 423/* The -1 arises because of the {0,NULL,0,-1} entry above. */
diff --git a/include/busybox.h b/include/busybox.h
index aef537b2b..692a9084e 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -72,7 +72,6 @@ struct BB_applet {
72 const char* name; 72 const char* name;
73 int (*main)(int argc, char** argv); 73 int (*main)(int argc, char** argv);
74 enum Location location; 74 enum Location location;
75 int usage_index;
76}; 75};
77/* From busybox.c */ 76/* From busybox.c */
78extern const struct BB_applet applets[]; 77extern const struct BB_applet applets[];
@@ -87,12 +86,6 @@ extern const struct BB_applet applets[];
87#include "applets.h" 86#include "applets.h"
88#undef PROTOTYPES 87#undef PROTOTYPES
89 88
90#define APPLET_ENUM
91enum APPLET_INDEX_NUMBERS {
92#include "applets.h"
93};
94#undef APPLET_ENUM
95
96extern const char *applet_name; 89extern const char *applet_name;
97 90
98extern void show_usage(void) __attribute__ ((noreturn)); 91extern void show_usage(void) __attribute__ ((noreturn));
diff --git a/include/usage.h b/include/usage.h
index 7c7318595..b39fec924 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -1,2049 +1,1165 @@
1#include "Config.h" 1#define ar_trivial_usage \
2
3extern const char usage_messages[];
4
5#if defined USAGE_ENUM
6enum
7#elif defined USAGE_MESSAGES
8const char usage_messages[] =
9#endif
10
11#if defined USAGE_ENUM || defined USAGE_MESSAGES
12{
13#endif
14
15#if defined USAGE_ENUM
16#define DO_COMMA ,
17#elif defined USAGE_MESSAGES
18#define DO_COMMA "\0"
19#else
20#define DO_COMMA
21#endif
22
23
24#if defined BB_AR
25#if defined USAGE_ENUM
26ar_usage_index
27#elif defined USAGE_MESSAGES
28 "-[ovR]{ptx} archive filenames" 2 "-[ovR]{ptx} archive filenames"
29#ifndef BB_FEATURE_TRIVIAL_HELP 3#define ar_full_usage \
30 "\n\nExtract or list files from an ar archive.\n\n" 4 "Extract or list files from an ar archive.\n\n" \
31 "Options:\n" 5 "Options:\n" \
32 "\t-o\t\tpreserve original dates\n" 6 "\t-o\t\tpreserve original dates\n" \
33 "\t-p\t\textract to stdout\n" 7 "\t-p\t\textract to stdout\n" \
34 "\t-t\t\tlist\n" 8 "\t-t\t\tlist\n" \
35 "\t-x\t\textract\n" 9 "\t-x\t\textract\n" \
36 "\t-v\t\tverbosely list files processed\n" 10 "\t-v\t\tverbosely list files processed\n" \
37 "\t-R\t\trecursive action" 11 "\t-R\t\trecursive action"
38#endif
39#endif
40DO_COMMA
41#endif
42 12
43#if defined BB_BASENAME 13#define basename_trivial_usage \
44#if defined USAGE_ENUM
45basename_usage_index
46#elif defined USAGE_MESSAGES
47 "FILE [SUFFIX]" 14 "FILE [SUFFIX]"
48#ifndef BB_FEATURE_TRIVIAL_HELP 15#define basename_full_usage \
49 "\n\nStrips directory path and suffixes from FILE.\n" 16 "Strips directory path and suffixes from FILE.\n" \
50 "If specified, also removes any trailing SUFFIX." 17 "If specified, also removes any trailing SUFFIX."
51#endif
52#endif
53DO_COMMA
54#endif
55 18
56#if defined BB_CAT 19#define cat_trivial_usage \
57#if defined USAGE_ENUM
58cat_usage_index
59#elif defined USAGE_MESSAGES
60 "[FILE]..." 20 "[FILE]..."
61#ifndef BB_FEATURE_TRIVIAL_HELP 21#define cat_full_usage \
62 "\n\nConcatenates FILE(s) and prints them to stdout." 22 "Concatenates FILE(s) and prints them to stdout."
63#endif
64#endif
65DO_COMMA
66#endif
67 23
68#if defined BB_CHMOD_CHOWN_CHGRP 24#define chgrp_trivial_usage \
69#if defined USAGE_ENUM
70chgrp_usage_index
71#elif defined USAGE_MESSAGES
72 "[OPTION]... GROUP FILE..." 25 "[OPTION]... GROUP FILE..."
73#ifndef BB_FEATURE_TRIVIAL_HELP 26#define chgrp_full_usage \
74 "\n\nChange the group membership of each FILE to GROUP.\n" 27 "Change the group membership of each FILE to GROUP.\n" \
75 "\nOptions:\n\t-R\tChanges files and directories recursively." 28 "\nOptions:\n\t-R\tChanges files and directories recursively."
76#endif
77#endif
78DO_COMMA
79#endif
80 29
81#if defined BB_CHMOD_CHOWN_CHGRP 30#define chmod_trivial_usage \
82#if defined USAGE_ENUM
83chmod_usage_index
84#elif defined USAGE_MESSAGES
85 "[-R] MODE[,MODE]... FILE..." 31 "[-R] MODE[,MODE]... FILE..."
86#ifndef BB_FEATURE_TRIVIAL_HELP 32#define chmod_full_usage \
87 "\n\nEach MODE is one or more of the letters ugoa, one of the symbols +-= and\n" 33 "Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n" \
88 "one or more of the letters rwxst.\n\n" 34 "one or more of the letters rwxst.\n\n" \
89 "Options:\n\t-R\tChanges files and directories recursively." 35 "Options:\n\t-R\tChanges files and directories recursively."
90#endif
91#endif
92DO_COMMA
93#endif
94 36
95#if defined BB_CHMOD_CHOWN_CHGRP 37#define chown_trivial_usage \
96#if defined USAGE_ENUM
97chown_usage_index
98#elif defined USAGE_MESSAGES
99 "[OPTION]... OWNER[<.|:>[GROUP] FILE..." 38 "[OPTION]... OWNER[<.|:>[GROUP] FILE..."
100#ifndef BB_FEATURE_TRIVIAL_HELP 39#define chown_full_usage \
101 "\n\nChange the owner and/or group of each FILE to OWNER and/or GROUP.\n" 40 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" \
102 "\nOptions:\n\t-R\tChanges files and directories recursively." 41 "\nOptions:\n\t-R\tChanges files and directories recursively."
103#endif
104#endif
105DO_COMMA
106#endif
107 42
108#if defined BB_CHROOT 43#define chroot_trivial_usage \
109#if defined USAGE_ENUM
110chroot_usage_index
111#elif defined USAGE_MESSAGES
112 "NEWROOT [COMMAND...]" 44 "NEWROOT [COMMAND...]"
113#ifndef BB_FEATURE_TRIVIAL_HELP 45#define chroot_full_usage \
114 "\n\nRun COMMAND with root directory set to NEWROOT." 46 "Run COMMAND with root directory set to NEWROOT."
115#endif
116#endif
117DO_COMMA
118#endif
119 47
120#if defined BB_CHVT 48#define chvt_trivial_usage \
121#if defined USAGE_ENUM
122chvt_usage_index
123#elif defined USAGE_MESSAGES
124 "N" 49 "N"
125#ifndef BB_FEATURE_TRIVIAL_HELP 50#define chvt_full_usage \
126 "\n\nChanges the foreground virtual terminal to /dev/ttyN" 51 "Changes the foreground virtual terminal to /dev/ttyN"
127#endif
128#endif
129DO_COMMA
130#endif
131 52
132#if defined BB_CLEAR 53#define clear_trivial_usage \
133#if defined USAGE_ENUM
134clear_usage_index
135#elif defined USAGE_MESSAGES
136 "" 54 ""
137#ifndef BB_FEATURE_TRIVIAL_HELP 55#define clear_full_usage \
138 "\n\nClear screen." 56 "Clear screen."
139#endif
140#endif
141DO_COMMA
142#endif
143 57
144#if defined BB_CMP 58#define cmp_trivial_usage \
145#if defined USAGE_ENUM
146cmp_usage_index
147#elif defined USAGE_MESSAGES
148 "FILE1 [FILE2]" 59 "FILE1 [FILE2]"
149#ifndef BB_FEATURE_TRIVIAL_HELP 60#define cmp_full_usage \
150 "\n\nCompare files." 61 "Compare files."
151#endif
152#endif
153DO_COMMA
154#endif
155 62
156#if defined BB_CP_MV 63#define cp_trivial_usage \
157#if defined USAGE_ENUM
158cp_usage_index
159#elif defined USAGE_MESSAGES
160 "[OPTION]... SOURCE DEST\n" 64 "[OPTION]... SOURCE DEST\n"
161 " or: cp [OPTION]... SOURCE... DIRECTORY" 65#define cp_full_usage \
162#ifndef BB_FEATURE_TRIVIAL_HELP 66 "Copies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" \
163 "\n\nCopies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" 67 "\n" \
164 "\n" 68 "\t-a\tSame as -dpR\n" \
165 "\t-a\tSame as -dpR\n" 69 "\t-d\tPreserves links\n" \
166 "\t-d\tPreserves links\n" 70 "\t-p\tPreserves file attributes if possible\n" \
167 "\t-p\tPreserves file attributes if possible\n" 71 "\t-f\tforce (implied; ignored) - always set\n" \
168 "\t-f\tforce (implied; ignored) - always set\n"
169 "\t-R\tCopies directories recursively" 72 "\t-R\tCopies directories recursively"
170#endif
171#endif
172DO_COMMA
173#endif
174 73
175#if defined BB_CUT 74#define cut_trivial_usage \
176#if defined USAGE_ENUM
177cut_usage_index
178#elif defined USAGE_MESSAGES
179 "[OPTION]... [FILE]..." 75 "[OPTION]... [FILE]..."
180#ifndef BB_FEATURE_TRIVIAL_HELP 76#define cut_full_usage \
181 "\n\nPrints selected fields from each input FILE to standard output.\n\n" 77 "Prints selected fields from each input FILE to standard output.\n\n" \
182 "Options:\n" 78 "Options:\n" \
183 "\t-b LIST\tOutput only bytes from LIST\n" 79 "\t-b LIST\tOutput only bytes from LIST\n" \
184 "\t-c LIST\tOutput only characters from LIST\n" 80 "\t-c LIST\tOutput only characters from LIST\n" \
185 "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n" 81 "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n" \
186 "\t-s\tOutput only the lines containing delimiter\n" 82 "\t-s\tOutput only the lines containing delimiter\n" \
187 "\t-f N\tPrint only these fields\n" 83 "\t-f N\tPrint only these fields\n" \
188 "\t-n\tIgnored" 84 "\t-n\tIgnored"
189#endif
190#endif
191DO_COMMA
192#endif
193 85
194#if defined BB_DATE 86#define date_trivial_usage \
195#if defined USAGE_ENUM
196date_usage_index
197#elif defined USAGE_MESSAGES
198 "[OPTION]... [+FORMAT]\n" 87 "[OPTION]... [+FORMAT]\n"
199 " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]" 88#define date_full_usage \
200#ifndef BB_FEATURE_TRIVIAL_HELP 89 "Displays the current time in the given FORMAT, or sets the system date.\n" \
201 "\n\nDisplays the current time in the given FORMAT, or sets the system date.\n" 90 "\nOptions:\n\t-R\t\tOutputs RFC-822 compliant date string\n" \
202 "\nOptions:\n\t-R\t\tOutputs RFC-822 compliant date string\n" 91 "\t-d STRING\tdisplay time described by STRING, not `now'\n" \
203 "\t-d STRING\tdisplay time described by STRING, not `now'\n" 92 "\t-s\t\tSets time described by STRING\n" \
204 "\t-s\t\tSets time described by STRING\n"
205 "\t-u\t\tPrints or sets Coordinated Universal Time" 93 "\t-u\t\tPrints or sets Coordinated Universal Time"
206#endif
207#endif
208DO_COMMA
209#endif
210 94
211#if defined BB_DC 95#define dc_trivial_usage \
212#if defined USAGE_ENUM
213dc_usage_index
214#elif defined USAGE_MESSAGES
215 "expression ..." 96 "expression ..."
216#ifndef BB_FEATURE_TRIVIAL_HELP 97#define dc_full_usage \
217 "\n\nThis is a Tiny RPN calculator that understands the\n" 98 "This is a Tiny RPN calculator that understands the\n" \
218 "following operations: +, -, /, *, and, or, not, eor.\n" 99 "following operations: +, -, /, *, and, or, not, eor.\n" \
219 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16" 100 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16"
220#endif
221#endif
222DO_COMMA
223#endif
224 101
225#if defined BB_DD 102#define dd_trivial_usage \
226#if defined USAGE_ENUM 103 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N] [seek=N] [conv=notrunc|sync]"
227dd_usage_index 104#define dd_full_usage \
228#elif defined USAGE_MESSAGES 105 "Copy a file, converting and formatting according to options\n\n" \
229 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N] [seek=N]\n" 106 "\tif=FILE\tread from FILE instead of stdin\n" \
230 "\t [conv=notrunc|sync]" 107 "\tof=FILE\twrite to FILE instead of stdout\n" \
231#ifndef BB_FEATURE_TRIVIAL_HELP 108 "\tbs=N\tread and write N bytes at a time\n" \
232 "\n\nCopy a file, converting and formatting according to options\n\n" 109 "\tcount=N\tcopy only N input blocks\n" \
233 "\tif=FILE\t\tread from FILE instead of stdin\n" 110 "\tskip=N\tskip N input blocks\n" \
234 "\tof=FILE\t\twrite to FILE instead of stdout\n" 111 "\tseek=N\tskip N output blocks\n" \
235 "\tbs=N\t\tread and write N bytes at a time\n" 112 "\tconv=notrunc\tdon't truncate output file\n" \
236 "\tcount=N\t\tcopy only N input blocks\n" 113 "\tconv=sync\tpad blocks with zeros\n" \
237 "\tskip=N\t\tskip N input blocks\n" 114 "\n" \
238 "\tseek=N\t\tskip N output blocks\n" 115 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \
239 "\tconv=notrunc\tdon't truncate output file\n"
240 "\tconv=sync\tpad blocks with zeros\n"
241 "\n"
242 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n"
243 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)." 116 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)."
244#endif
245#endif
246DO_COMMA
247#endif
248 117
249#if defined BB_DEALLOCVT 118#define deallocvt_trivial_usage \
250#if defined USAGE_ENUM
251deallocvt_usage_index
252#elif defined USAGE_MESSAGES
253 "N" 119 "N"
254#ifndef BB_FEATURE_TRIVIAL_HELP 120#define deallocvt_full_usage \
255 "\n\nDeallocate unused virtual terminal /dev/ttyN" 121 "Deallocate unused virtual terminal /dev/ttyN"
256#endif 122
257#endif
258DO_COMMA
259#endif
260 123
261#if defined BB_DF
262#if defined USAGE_ENUM
263df_usage_index
264#elif defined USAGE_MESSAGES
265 "[-"
266#ifdef BB_FEATURE_HUMAN_READABLE
267 "hm"
268#endif
269 "k] [filesystem ...]"
270#ifndef BB_FEATURE_TRIVIAL_HELP
271 "\n\nPrint the filesystem space used and space available\n\n"
272 "Options:\n"
273#ifdef BB_FEATURE_HUMAN_READABLE 124#ifdef BB_FEATURE_HUMAN_READABLE
274 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G)\n" 125 #define USAGE_HUMAN_READABLE(a,b) a
275 "\t-m\tprint sizes in megabytes\n"
276 "\t-k\tprint sizes in kilobytes(default)"
277#else 126#else
278 "\n\t-k\tprint sizes in kilobytes(compatability)" 127 #define USAGE_HUMAN_READABLE(a,b) b
279#endif 128#endif
280#endif 129#define df_trivial_usage \
281#endif 130 "[-" \
282DO_COMMA 131 USAGE_HUMAN_READABLE("hm", "") \
283#endif 132 "k] [filesystem ...]\n"
284 133#define df_full_usage \
285#if defined BB_DIRNAME 134 "Print the filesystem space used and space available.\n\n" \
286#if defined USAGE_ENUM 135 "Options:\n" \
287dirname_usage_index 136USAGE_HUMAN_READABLE( \
288#elif defined USAGE_MESSAGES 137 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
138 "\t-m\tprint sizes in megabytes\n" \
139 "\t-k\tprint sizes in kilobytes(default)", \
140 "\n\t-k\tprint sizes in kilobytes(compatability)")
141
142#define dirname_trivial_usage \
289 "[FILENAME ...]" 143 "[FILENAME ...]"
290#ifndef BB_FEATURE_TRIVIAL_HELP 144#define dirname_full_usage \
291 "\n\nStrips non-directory suffix from FILENAME" 145 "Strips non-directory suffix from FILENAME"
292#endif
293#endif
294DO_COMMA
295#endif
296 146
297#if defined BB_DMESG 147#define dmesg_trivial_usage \
298#if defined USAGE_ENUM
299dmesg_usage_index
300#elif defined USAGE_MESSAGES
301 "[-c] [-n LEVEL] [-s SIZE]" 148 "[-c] [-n LEVEL] [-s SIZE]"
302#ifndef BB_FEATURE_TRIVIAL_HELP 149#define dmesg_full_usage \
303 "\n\nPrints or controls the kernel ring buffer\n\n" 150 "Prints or controls the kernel ring buffer\n\n" \
304 "Options:\n" 151 "Options:\n" \
305 "\t-c\t\tClears the ring buffer's contents after printing\n" 152 "\t-c\t\tClears the ring buffer's contents after printing\n" \
306 "\t-n LEVEL\tSets console logging level\n" 153 "\t-n LEVEL\tSets console logging level\n" \
307 "\t-s SIZE\t\tUse a buffer of size SIZE" 154 "\t-s SIZE\t\tUse a buffer of size SIZE"
308#endif
309#endif
310DO_COMMA
311#endif
312 155
313#if defined BB_DOS2UNIX 156#define dos2unix_trivial_usage \
314#if defined USAGE_ENUM
315dos2unix_usage_index
316#elif defined USAGE_MESSAGES
317 "< dosfile > unixfile" 157 "< dosfile > unixfile"
318#ifndef BB_FEATURE_TRIVIAL_HELP 158#define dos2unix_full_usage \
319 "\n\nConverts a text file from dos format to unix format." 159 "Converts a text file from dos format to unix format."
320#endif
321#endif
322DO_COMMA
323#endif
324 160
325#if defined BB_DPKG 161#define dpkg_trivial_usage \
326#if defined USAGE_ENUM 162 "[-i|-r|--unpack|--configure] my.deb"
327dpkg_usage_index 163#define dpkg_full_usage \
328#elif defined USAGE_MESSAGES
329 "<-i|-r|--unpack|--configure> my.deb\n"
330 "WORK IN PROGRESS, only usefull for debian-installer" 164 "WORK IN PROGRESS, only usefull for debian-installer"
331#ifndef BB_FEATURE_TRIVIAL_HELP
332#endif
333#endif
334DO_COMMA
335#endif
336 165
337#if defined BB_DPKG_DEB 166#define dpkg_deb_trivial_usage \
338#if defined USAGE_ENUM
339dpkg_deb_usage_index
340#elif defined USAGE_MESSAGES
341 "[-cexX] file directory" 167 "[-cexX] file directory"
342#ifndef BB_FEATURE_TRIVIAL_HELP 168#define dpkg_deb_full_usage \
343 "\n\nPerform actions on debian packages (.debs)\n\n" 169 "Perform actions on debian packages (.debs)\n\n" \
344 "Options:\n" 170 "Options:\n" \
345 "\t-c\tList contents of filesystem tree (verbose)\n" 171 "\t-c\tList contents of filesystem tree (verbose)\n" \
346 "\t-l\tList contents of filesystem tree (.list format)\n" 172 "\t-l\tList contents of filesystem tree (.list format)\n" \
347 "\t-e\tExtract control files to directory\n" 173 "\t-e\tExtract control files to directory\n" \
348 "\t-x\tExctract packages filesystem tree to directory\n" 174 "\t-x\tExctract packages filesystem tree to directory\n" \
349 "\t-X\tVerbose extract" 175 "\t-X\tVerbose extract"
350#endif
351#endif
352DO_COMMA
353#endif
354 176
355#if defined BB_DU 177#define du_trivial_usage \
356#if defined USAGE_ENUM 178 "[-ls" USAGE_HUMAN_READABLE("hm", "") "k] [FILE]..."
357du_usage_index 179#define du_full_usage \
358#elif defined USAGE_MESSAGES 180 "Summarizes disk space used for each FILE and/or directory.\n" \
359 "[-ls" 181 "Disk space is printed in units of 1024 bytes.\n\n" \
360#ifdef BB_FEATURE_HUMAN_READABLE 182 "Options:\n" \
361 "hm" 183 "\t-l\tcount sizes many times if hard linked\n" \
362#endif 184 "\t-s\tdisplay only a total for each argument" \
363 "k] [FILE]..." 185USAGE_HUMAN_READABLE( \
364#ifndef BB_FEATURE_TRIVIAL_HELP 186 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
365 "\n\nSummarizes disk space used for each FILE and/or directory.\n" 187 "\t-m\tprint sizes in megabytes\n" \
366 "Disk space is printed in units of 1024 bytes.\n\n" 188 "\t-k\tprint sizes in kilobytes(default)" \
367 "Options:\n" 189 , \
368 "\t-l\tcount sizes many times if hard linked\n" 190 "\n\t-k\tprint sizes in kilobytes(compatability)" \
369 "\t-s\tdisplay only a total for each argument" 191 )
370#ifdef BB_FEATURE_HUMAN_READABLE 192
371 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G)\n" 193#define dumpkmap_trivial_usage \
372 "\t-m\tprint sizes in megabytes\n"
373 "\t-k\tprint sizes in kilobytes(default)"
374#else
375 "\n\t-k\tprint sizes in kilobytes(compatability)"
376#endif
377#endif
378#endif
379DO_COMMA
380#endif
381
382#if defined BB_DUMPKMAP
383#if defined USAGE_ENUM
384dumpkmap_usage_index
385#elif defined USAGE_MESSAGES
386 "> keymap" 194 "> keymap"
387#ifndef BB_FEATURE_TRIVIAL_HELP 195#define dumpkmap_full_usage \
388 "\n\nPrints out a binary keyboard translation table to standard output" 196 "Prints out a binary keyboard translation table to standard output."
389#endif
390#endif
391DO_COMMA
392#endif
393 197
394#if defined BB_DUTMP 198#define dutmp_trivial_usage \
395#if defined USAGE_ENUM
396dutmp_usage_index
397#elif defined USAGE_MESSAGES
398 "[FILE]" 199 "[FILE]"
399#ifndef BB_FEATURE_TRIVIAL_HELP 200#define dutmp_full_usage \
400 "\n\nDump utmp file format (pipe delimited) from FILE\n" 201 "Dump utmp file format (pipe delimited) from FILE\n" \
401 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')" 202 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')"
402#endif
403#endif
404DO_COMMA
405#endif
406 203
407#if defined BB_ECHO 204#define echo_trivial_usage \
408#if defined USAGE_ENUM
409echo_usage_index
410#elif defined USAGE_MESSAGES
411 "[-neE] [ARG ...]" 205 "[-neE] [ARG ...]"
412#ifndef BB_FEATURE_TRIVIAL_HELP 206#define echo_full_usage \
413 "\n\nPrints the specified ARGs to stdout\n\n" 207 "Prints the specified ARGs to stdout\n\n" \
414 "Options:\n" 208 "Options:\n" \
415 "\t-n\tsuppress trailing newline\n" 209 "\t-n\tsuppress trailing newline\n" \
416 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" 210 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" \
417 "\t-E\tdisable interpretation of backslash-escaped characters" 211 "\t-E\tdisable interpretation of backslash-escaped characters"
418#endif
419#endif
420DO_COMMA
421#endif
422 212
423#if defined BB_EXPR 213#define expr_trivial_usage \
424#if defined USAGE_ENUM
425expr_usage_index
426#elif defined USAGE_MESSAGES
427 "EXPRESSION" 214 "EXPRESSION"
428#ifndef BB_FEATURE_TRIVIAL_HELP 215#define expr_full_usage \
429"\n\nPrints the value of EXPRESSION to standard output.\n\n" 216 "Prints the value of EXPRESSION to standard output.\n\n" \
430"EXPRESSION may be:\n" 217 "EXPRESSION may be:\n" \
431"ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n" 218 "ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n" \
432"ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n" 219 "ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n" \
433"ARG1 < ARG2 ARG1 is less than ARG2\n" 220 "ARG1 < ARG2 ARG1 is less than ARG2\n" \
434"ARG1 <= ARG2 ARG1 is less than or equal to ARG2\n" 221 "ARG1 <= ARG2 ARG1 is less than or equal to ARG2\n" \
435"ARG1 = ARG2 ARG1 is equal to ARG2\n" 222 "ARG1 = ARG2 ARG1 is equal to ARG2\n" \
436"ARG1 != ARG2 ARG1 is unequal to ARG2\n" 223 "ARG1 != ARG2 ARG1 is unequal to ARG2\n" \
437"ARG1 >= ARG2 ARG1 is greater than or equal to ARG2\n" 224 "ARG1 >= ARG2 ARG1 is greater than or equal to ARG2\n" \
438"ARG1 > ARG2 ARG1 is greater than ARG2\n" 225 "ARG1 > ARG2 ARG1 is greater than ARG2\n" \
439"ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n" 226 "ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n" \
440"ARG1 - ARG2 arithmetic difference of ARG1 and ARG2\n" 227 "ARG1 - ARG2 arithmetic difference of ARG1 and ARG2\n" \
441"ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n" 228 "ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n" \
442"ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2\n" 229 "ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2\n" \
443"ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2\n" 230 "ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2\n" \
444"STRING : REGEXP anchored pattern match of REGEXP in STRING\n" 231 "STRING : REGEXP anchored pattern match of REGEXP in STRING\n" \
445"match STRING REGEXP same as STRING : REGEXP\n" 232 "match STRING REGEXP same as STRING : REGEXP\n" \
446"substr STRING POS LENGTH substring of STRING, POS counted from 1\n" 233 "substr STRING POS LENGTH substring of STRING, POS counted from 1\n" \
447"index STRING CHARS index in STRING where any CHARS is found, or 0\n" 234 "index STRING CHARS index in STRING where any CHARS is found, or 0\n" \
448"length STRING length of STRING\n" 235 "length STRING length of STRING\n" \
449"quote TOKEN interpret TOKEN as a string, even if it is a \n" 236 "quote TOKEN interpret TOKEN as a string, even if it is a \n" \
450" keyword like `match' or an operator like `/'\n" 237 " keyword like `match' or an operator like `/'\n" \
451"( EXPRESSION ) value of EXPRESSION\n\n" 238 "( EXPRESSION ) value of EXPRESSION\n\n" \
452"Beware that many operators need to be escaped or quoted for shells.\n" 239 "Beware that many operators need to be escaped or quoted for shells.\n" \
453"Comparisons are arithmetic if both ARGs are numbers, else\n" 240 "Comparisons are arithmetic if both ARGs are numbers, else\n" \
454"lexicographical. Pattern matches return the string matched between \n" 241 "lexicographical. Pattern matches return the string matched between \n" \
455"\\( and \\) or null; if \\( and \\) are not used, they return the number \n" 242 "\\( and \\) or null; if \\( and \\) are not used, they return the number \n" \
456"of characters matched or 0." 243 "of characters matched or 0."
457 244
458#endif 245#define false_trivial_usage \
459#endif
460DO_COMMA
461#endif
462
463
464#if defined BB_TRUE_FALSE
465#if defined USAGE_ENUM
466false_usage_index
467#elif defined USAGE_MESSAGES
468 "" 246 ""
469#ifndef BB_FEATURE_TRIVIAL_HELP 247#define false_full_usage \
470 "\n\nReturn an exit code of FALSE (1)." 248 "Return an exit code of FALSE (1)."
471#endif
472#endif
473DO_COMMA
474#endif
475 249
476#if defined BB_FBSET 250#define fdflush_trivial_usage \
477#if defined USAGE_ENUM
478fbset_usage_index
479#elif defined USAGE_MESSAGES
480 "fbset [options] [mode]"
481#ifndef BB_FEATURE_TRIVIAL_HELP
482 "\n\nShows and modifies frame buffer device settings"
483#endif
484#endif
485DO_COMMA
486#endif
487
488#if defined BB_FDFLUSH
489#if defined USAGE_ENUM
490fdflush_usage_index
491#elif defined USAGE_MESSAGES
492 "DEVICE" 251 "DEVICE"
493#ifndef BB_FEATURE_TRIVIAL_HELP 252#define fdflush_full_usage \
494 "\n\nForces floppy disk drive to detect disk change" 253 "Forces floppy disk drive to detect disk change"
495#endif
496#endif
497DO_COMMA
498#endif
499 254
500#if defined BB_FIND
501#if defined USAGE_ENUM
502find_usage_index
503#elif defined USAGE_MESSAGES
504 "[PATH...] [EXPRESSION]"
505#ifndef BB_FEATURE_TRIVIAL_HELP
506 "\n\nSearch for files in a directory hierarchy. The default PATH is\n"
507 "the current directory; default EXPRESSION is '-print'\n\n"
508 "\nEXPRESSION may consist of:\n"
509 "\t-follow\t\tDereference symbolic links.\n"
510 "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN."
511#ifdef BB_FEATURE_FIND_TYPE 255#ifdef BB_FEATURE_FIND_TYPE
512 "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" 256 #define USAGE_FIND_TYPE(a) a
257#else
258 #define USAGE_FIND_TYPE(a)
513#endif 259#endif
514#ifdef BB_FEATURE_FIND_PERM 260#ifdef BB_FEATURE_FIND_PERM
515 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" 261 #define USAGE_FIND_PERM(a) a
262#else
263 #define USAGE_FIND_PERM(a)
516#endif 264#endif
517#ifdef BB_FEATURE_FIND_MTIME 265#ifdef BB_FEATURE_FIND_MTIME
518 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days" 266 #define USAGE_FIND_MTIME(a) a
519#endif 267#else
520#endif 268 #define USAGE_FIND_MTIME(a)
521#endif
522DO_COMMA
523#endif 269#endif
524 270
525#if defined BB_FREE 271#define find_trivial_usage \
526#if defined USAGE_ENUM 272 "[PATH...] [EXPRESSION]"
527free_usage_index 273#define find_full_usage \
528#elif defined USAGE_MESSAGES 274 "Search for files in a directory hierarchy. The default PATH is\n" \
275 "the current directory; default EXPRESSION is '-print'\n\n" \
276 "\nEXPRESSION may consist of:\n" \
277 "\t-follow\t\tDereference symbolic links.\n" \
278 "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN." \
279USAGE_FIND_TYPE( \
280 "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" \
281) USAGE_FIND_PERM( \
282 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \
283) USAGE_FIND_MTIME( \
284 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days")
285
286#define free_trivial_usage \
529 "" 287 ""
530#ifndef BB_FEATURE_TRIVIAL_HELP 288#define free_full_usage \
531 "\n\nDisplays the amount of free and used system memory" 289 "Displays the amount of free and used system memory"
532#endif
533#endif
534DO_COMMA
535#endif
536 290
537#if defined BB_FREERAMDISK 291#define freeramdisk_trivial_usage \
538#if defined USAGE_ENUM
539freeramdisk_usage_index
540#elif defined USAGE_MESSAGES
541 "DEVICE" 292 "DEVICE"
542#ifndef BB_FEATURE_TRIVIAL_HELP 293#define freeramdisk_full_usage \
543 "\n\nFrees all memory used by the specified ramdisk." 294 "Frees all memory used by the specified ramdisk."
544#endif
545#endif
546DO_COMMA
547#endif
548 295
549#if defined BB_FSCK_MINIX 296#define fsck_minix_trivial_usage \
550#if defined USAGE_ENUM
551fsck_minix_usage_index
552#elif defined USAGE_MESSAGES
553 "[-larvsmf] /dev/name" 297 "[-larvsmf] /dev/name"
554#ifndef BB_FEATURE_TRIVIAL_HELP 298#define fsck_minix_full_usage \
555 "\n\nPerforms a consistency check for MINIX filesystems.\n\n" 299 "Performs a consistency check for MINIX filesystems.\n\n" \
556 "Options:\n" 300 "Options:\n" \
557 "\t-l\tLists all filenames\n" 301 "\t-l\tLists all filenames\n" \
558 "\t-r\tPerform interactive repairs\n" 302 "\t-r\tPerform interactive repairs\n" \
559 "\t-a\tPerform automatic repairs\n" 303 "\t-a\tPerform automatic repairs\n" \
560 "\t-v\tverbose\n" 304 "\t-v\tverbose\n" \
561 "\t-s\tOutputs super-block information\n" 305 "\t-s\tOutputs super-block information\n" \
562 "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n" 306 "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n" \
563 "\t-f\tForce file system check." 307 "\t-f\tForce file system check."
564#endif
565#endif
566DO_COMMA
567#endif
568 308
569#if defined BB_GETOPT 309#define getopt_trivial_usage \
570#if defined USAGE_ENUM
571getopt_usage_index
572#elif defined USAGE_MESSAGES
573 "[OPTIONS]..." 310 "[OPTIONS]..."
574#ifndef BB_FEATURE_TRIVIAL_HELP 311#define getopt_full_usage \
575 "\nParse command options\n" 312 "\nParse command options\n" \
576 " -a, --alternative Allow long options starting with single -\n" 313 "\t-a, --alternative Allow long options starting with single -\n" \
577 " -l, --longoptions=longopts Long options to be recognized\n" 314 "\t-l, --longoptions=longopts Long options to be recognized\n" \
578 " -n, --name=progname The name under which errors are reported\n" 315 "\t-n, --name=progname The name under which errors are reported\n" \
579 " -o, --options=optstring Short options to be recognized\n" 316 "\t-o, --options=optstring Short options to be recognized\n" \
580 " -q, --quiet Disable error reporting by getopt(3)\n" 317 "\t-q, --quiet Disable error reporting by getopt(3)\n" \
581 " -Q, --quiet-output No normal output\n" 318 "\t-Q, --quiet-output No normal output\n" \
582 " -s, --shell=shell Set shell quoting conventions\n" 319 "\t-s, --shell=shell Set shell quoting conventions\n" \
583 " -T, --test Test for getopt(1) version\n" 320 "\t-T, --test Test for getopt(1) version\n" \
584 " -u, --unqote Do not quote the output" 321 "\t-u, --unqote Do not quote the output"
585#endif 322
586#endif 323#define grep_trivial_usage \
587DO_COMMA
588#endif
589
590#if defined BB_GREP
591#if defined USAGE_ENUM
592grep_usage_index
593#elif defined USAGE_MESSAGES
594 "[-ihHnqvs] pattern [files...]" 324 "[-ihHnqvs] pattern [files...]"
595#ifndef BB_FEATURE_TRIVIAL_HELP 325#define grep_full_usage \
596 "\n\nSearch for PATTERN in each FILE or standard input.\n\n" 326 "Search for PATTERN in each FILE or standard input.\n\n" \
597 "Options:\n" 327 "Options:\n" \
598 "\t-H\tprefix output lines with filename where match was found\n" 328 "\t-H\tprefix output lines with filename where match was found\n" \
599 "\t-h\tsuppress the prefixing filename on output\n" 329 "\t-h\tsuppress the prefixing filename on output\n" \
600 "\t-i\tignore case distinctions\n" 330 "\t-i\tignore case distinctions\n" \
601 "\t-n\tprint line number with output lines\n" 331 "\t-n\tprint line number with output lines\n" \
602 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" 332 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" \
603 "\t-v\tselect non-matching lines\n" 333 "\t-v\tselect non-matching lines\n" \
604 "\t-s\tsuppress file open/read error messages" 334 "\t-s\tsuppress file open/read error messages"
605#endif
606#endif
607DO_COMMA
608#endif
609 335
610#if defined BB_GUNZIP 336#define gunzip_trivial_usage \
611#if defined USAGE_ENUM
612gunzip_usage_index
613#elif defined USAGE_MESSAGES
614 "[OPTION]... FILE" 337 "[OPTION]... FILE"
615#ifndef BB_FEATURE_TRIVIAL_HELP 338#define gunzip_full_usage \
616 "\n\nUncompress FILE (or standard input if FILE is '-').\n\n" 339 "Uncompress FILE (or standard input if FILE is '-').\n\n" \
617 "Options:\n" 340 "Options:\n" \
618 "\t-c\tWrite output to standard output\n" 341 "\t-c\tWrite output to standard output\n" \
619 "\t-t\tTest compressed file integrity" 342 "\t-t\tTest compressed file integrity"
620#endif
621#endif
622DO_COMMA
623#endif
624 343
625#if defined BB_GZIP 344#define gzip_trivial_usage \
626#if defined USAGE_ENUM
627gzip_usage_index
628#elif defined USAGE_MESSAGES
629 "[OPTION]... FILE" 345 "[OPTION]... FILE"
630#ifndef BB_FEATURE_TRIVIAL_HELP 346#define gzip_full_usage \
631 "\n\nCompress FILE with maximum compression.\n" 347 "Compress FILE with maximum compression.\n" \
632 "When FILE is '-', reads standard input. Implies -c.\n\n" 348 "When FILE is '-', reads standard input. Implies -c.\n\n" \
633 "Options:\n" 349 "Options:\n" \
634 "\t-c\tWrite output to standard output instead of FILE.gz\n" 350 "\t-c\tWrite output to standard output instead of FILE.gz\n" \
635 "\t-d\tdecompress" 351 "\t-d\tdecompress"
636#endif
637#endif
638DO_COMMA
639#endif
640 352
641#if defined BB_HALT 353#define halt_trivial_usage \
642#if defined USAGE_ENUM
643halt_usage_index
644#elif defined USAGE_MESSAGES
645 "" 354 ""
646#ifndef BB_FEATURE_TRIVIAL_HELP 355#define halt_full_usage \
647 "\n\nHalt the system." 356 "Halt the system."
648#endif
649#endif
650DO_COMMA
651#endif
652 357
653#if defined BB_HEAD 358#define head_trivial_usage \
654#if defined USAGE_ENUM
655head_usage_index
656#elif defined USAGE_MESSAGES
657 "[OPTION] [FILE]..." 359 "[OPTION] [FILE]..."
658#ifndef BB_FEATURE_TRIVIAL_HELP 360#define head_full_usage \
659 "\n\nPrint first 10 lines of each FILE to standard output.\n" 361 "Print first 10 lines of each FILE to standard output.\n" \
660 "With more than one FILE, precede each with a header giving the\n" 362 "With more than one FILE, precede each with a header giving the\n" \
661 "file name. With no FILE, or when FILE is -, read standard input.\n\n" 363 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
662
663 "Options:\n" "\t-n NUM\t\tPrint first NUM lines instead of first 10" 364 "Options:\n" "\t-n NUM\t\tPrint first NUM lines instead of first 10"
664#endif
665#endif
666DO_COMMA
667#endif
668 365
669#if defined BB_HOSTID 366#define hostid_trivial_usage \
670#if defined USAGE_ENUM
671hostid_usage_index
672#elif defined USAGE_MESSAGES
673 "" 367 ""
674#ifndef BB_FEATURE_TRIVIAL_HELP 368#define hostid_full_usage \
675 "\n\nPrint out a unique 32-bit identifier for the machine." 369 "Print out a unique 32-bit identifier for the machine."
676#endif
677#endif
678DO_COMMA
679#endif
680 370
681#if defined BB_HOSTNAME 371#define hostname_trivial_usage \
682#if defined USAGE_ENUM
683hostname_usage_index
684#elif defined USAGE_MESSAGES
685 "[OPTION] {hostname | -F file}" 372 "[OPTION] {hostname | -F file}"
686#ifndef BB_FEATURE_TRIVIAL_HELP 373#define hostname_full_usage \
687 "\n\nGet or set the hostname or DNS domain name. If a hostname is given\n" 374 "Get or set the hostname or DNS domain name. If a hostname is given\n" \
688 "(or a file with the -F parameter), the host name will be set.\n\n" 375 "(or a file with the -F parameter), the host name will be set.\n\n" \
689 376 "Options:\n" \
690 "Options:\n" 377 "\t-s\t\tShort\n" \
691 "\t-s\t\tShort\n" 378 "\t-i\t\tAddresses for the hostname\n" \
692 "\t-i\t\tAddresses for the hostname\n" 379 "\t-d\t\tDNS domain name\n" \
693 "\t-d\t\tDNS domain name\n"
694 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname" 380 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname"
695#endif
696#endif
697DO_COMMA
698#endif
699 381
700#if defined BB_ID 382#define id_trivial_usage \
701#if defined USAGE_ENUM
702id_usage_index
703#elif defined USAGE_MESSAGES
704 "[OPTIONS]... [USERNAME]" 383 "[OPTIONS]... [USERNAME]"
705#ifndef BB_FEATURE_TRIVIAL_HELP 384#define id_full_usage \
706 "\n\nPrint information for USERNAME or the current user\n\n" 385 "Print information for USERNAME or the current user\n\n" \
707 "Options:\n" 386 "Options:\n" \
708 "\t-g\tprints only the group ID\n" 387 "\t-g\tprints only the group ID\n" \
709 "\t-u\tprints only the user ID\n" 388 "\t-u\tprints only the user ID\n" \
710 "\t-n\tprint a name instead of a number (with for -ug)\n" 389 "\t-n\tprint a name instead of a number (with for -ug)\n" \
711 "\t-r\tprints the real user ID instead of the effective ID (with -ug)" 390 "\t-r\tprints the real user ID instead of the effective ID (with -ug)"
712#endif
713#endif
714DO_COMMA
715#endif
716 391
717#if defined BB_IFCONFIG
718#if defined USAGE_ENUM
719ifconfig_usage_index
720#elif defined USAGE_MESSAGES
721 "[-a] [-i] [-v] <interface> [<address>]"
722#ifndef BB_FEATURE_TRIVIAL_HELP
723 "\n\nconfigure a network interface\n\n"
724 "Options:\n"
725 " [[-]broadcast [<address>]] [[-]pointopoint [<address>]]\n"
726 " [netmask <address>] [dstaddr <address>] [tunnel <adress>]\n"
727#ifdef SIOCSKEEPALIVE 392#ifdef SIOCSKEEPALIVE
728 " [outfill <NN>] [keepalive <NN>]\n" 393 #define USAGE_SIOCSKEEPALIVE(a) a
729#endif 394#else
730 " [hw ether <address>] [metric <NN>] [mtu <NN>]\n" 395 #define USAGE_SIOCSKEEPALIVE(a)
731 " [[-]trailers] [[-]arp] [[-]allmulti]\n"
732 " [multicast] [[-]promisc]\n"
733 " [mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]\n"
734 " [up|down] ..."
735#endif
736#endif
737DO_COMMA
738#endif 396#endif
739 397#define ifconfig_trivial_usage \
740#if defined BB_INIT 398 "[-a] [-i] [-v] <interface> [<address>]"
741#if defined USAGE_ENUM 399#define ifconfig_full_usage \
742init_usage_index 400 "configure a network interface\n\n" \
743#elif defined USAGE_MESSAGES 401 "Options:\n" \
402 "\t[[-]broadcast [<address>]] [[-]pointopoint [<address>]]\n" \
403 "\t[netmask <address>] [dstaddr <address>] [tunnel <adress>]\n" \
404USAGE_SIOCSKEEPALIVE("\t[outfill <NN>] [keepalive <NN>]\n") \
405 "\t[hw ether <address>] [metric <NN>] [mtu <NN>]\n" \
406 "\t[[-]trailers] [[-]arp] [[-]allmulti]\n" \
407 "\t[multicast] [[-]promisc]\n" \
408 "\t[mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]\n" \
409 "\t[up|down] ..."
410
411#define init_trivial_usage \
744 "" 412 ""
745#ifndef BB_FEATURE_TRIVIAL_HELP 413#define init_full_usage \
746 "\n\nInit is the parent of all processes.\n\n" 414 "Init is the parent of all processes.\n\n" \
747 "This version of init is designed to be run only by the kernel." 415 "This version of init is designed to be run only by the kernel."
748#endif
749#endif
750DO_COMMA
751#endif
752 416
753#if defined BB_INSMOD 417#define insmod_trivial_usage \
754#if defined USAGE_ENUM
755insmod_usage_index
756#elif defined USAGE_MESSAGES
757 "[OPTION]... MODULE [symbol=value]..." 418 "[OPTION]... MODULE [symbol=value]..."
758#ifndef BB_FEATURE_TRIVIAL_HELP 419#define insmod_full_usage \
759 "\n\nLoads the specified kernel modules into the kernel.\n\n" 420 "Loads the specified kernel modules into the kernel.\n\n" \
760 "Options:\n" 421 "Options:\n" \
761 "\t-f\tForce module to load into the wrong kernel version.\n" 422 "\t-f\tForce module to load into the wrong kernel version.\n" \
762 "\t-k\tMake module autoclean-able.\n" 423 "\t-k\tMake module autoclean-able.\n" \
763 "\t-v\tverbose output\n" 424 "\t-v\tverbose output\n" \
764 "\t-L\tLock to prevent simultaneous loads of a module\n" 425 "\t-L\tLock to prevent simultaneous loads of a module\n" \
765 "\t-x\tdo not export externs" 426 "\t-x\tdo not export externs"
766#endif
767#endif
768DO_COMMA
769#endif
770 427
771#if defined BB_KILL 428#define kill_trivial_usage \
772#if defined USAGE_ENUM
773kill_usage_index
774#elif defined USAGE_MESSAGES
775 "[-signal] process-id [process-id ...]" 429 "[-signal] process-id [process-id ...]"
776#ifndef BB_FEATURE_TRIVIAL_HELP 430#define kill_full_usage \
777 "\n\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" 431 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
778 "Options:\n" "\t-l\tList all signal names and numbers." 432 "Options:\n" "\t-l\tList all signal names and numbers."
779#endif
780#endif
781DO_COMMA
782#endif
783 433
784#if defined BB_KILLALL 434#define killall_trivial_usage \
785#if defined USAGE_ENUM
786killall_usage_index
787#elif defined USAGE_MESSAGES
788 "[-signal] process-name [process-name ...]" 435 "[-signal] process-name [process-name ...]"
789#ifndef BB_FEATURE_TRIVIAL_HELP 436#define killall_full_usage \
790 "\n\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" 437 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
791 "Options:\n" "\t-l\tList all signal names and numbers." 438 "Options:\n" "\t-l\tList all signal names and numbers."
792#endif
793#endif
794DO_COMMA
795#endif
796 439
797#if defined BB_LENGTH 440#define length_trivial_usage \
798#if defined USAGE_ENUM
799length_usage_index
800#elif defined USAGE_MESSAGES
801 "STRING" 441 "STRING"
802#ifndef BB_FEATURE_TRIVIAL_HELP 442#define length_full_usage \
803 "\n\nPrints out the length of the specified STRING." 443 "Prints out the length of the specified STRING."
804#endif
805#endif
806DO_COMMA
807#endif
808 444
809#if defined BB_LN 445#define ln_trivial_usage \
810#if defined USAGE_ENUM
811ln_usage_index
812#elif defined USAGE_MESSAGES
813 "[OPTION] TARGET... LINK_NAME|DIRECTORY" 446 "[OPTION] TARGET... LINK_NAME|DIRECTORY"
814#ifndef BB_FEATURE_TRIVIAL_HELP 447#define ln_full_usage \
815 "\n\nCreate a link named LINK_NAME or DIRECTORY to the specified TARGET\n" 448 "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n"\
816 "\nYou may use '--' to indicate that all following arguments are non-options.\n\n" 449 "\nYou may use '--' to indicate that all following arguments are non-options.\n\n" \
817 "Options:\n" 450 "Options:\n" \
818 "\t-s\tmake symbolic links instead of hard links\n" 451 "\t-s\tmake symbolic links instead of hard links\n" \
819 "\t-f\tremove existing destination files\n" 452 "\t-f\tremove existing destination files\n" \
820 "\t-n\tno dereference symlinks - treat like normal file" 453 "\t-n\tno dereference symlinks - treat like normal file"
821#endif
822#endif
823DO_COMMA
824#endif
825 454
826#if defined BB_LOADACM 455#define loadacm_trivial_usage \
827#if defined USAGE_ENUM
828loadacm_usage_index
829#elif defined USAGE_MESSAGES
830 "< mapfile" 456 "< mapfile"
831#ifndef BB_FEATURE_TRIVIAL_HELP 457#define loadacm_full_usage \
832 "\n\nLoads an acm from standard input." 458 "Loads an acm from standard input."
833#endif
834#endif
835DO_COMMA
836#endif
837 459
838#if defined BB_LOADFONT 460#define loadfont_trivial_usage \
839#if defined USAGE_ENUM
840loadfont_usage_index
841#elif defined USAGE_MESSAGES
842 "< font" 461 "< font"
843#ifndef BB_FEATURE_TRIVIAL_HELP 462#define loadfont_full_usage \
844 "\n\nLoads a console font from standard input." 463 "Loads a console font from standard input."
845#endif
846#endif
847DO_COMMA
848#endif
849 464
850#if defined BB_LOADKMAP 465#define loadkmap_trivial_usage \
851#if defined USAGE_ENUM
852loadkmap_usage_index
853#elif defined USAGE_MESSAGES
854 "< keymap" 466 "< keymap"
855#ifndef BB_FEATURE_TRIVIAL_HELP 467#define loadkmap_full_usage \
856 "\n\nLoads a binary keyboard translation table from standard input." 468 "Loads a binary keyboard translation table from standard input."
857#endif
858#endif
859DO_COMMA
860#endif
861 469
862#if defined BB_LOGGER 470#define logger_trivial_usage \
863#if defined USAGE_ENUM
864logger_usage_index
865#elif defined USAGE_MESSAGES
866 "[OPTION]... [MESSAGE]" 471 "[OPTION]... [MESSAGE]"
867#ifndef BB_FEATURE_TRIVIAL_HELP 472#define logger_full_usage \
868 "\n\nWrite MESSAGE to the system log. If MESSAGE is omitted, log stdin.\n\n" 473 "Write MESSAGE to the system log. If MESSAGE is omitted, log stdin.\n\n" \
869 "Options:\n" 474 "Options:\n" \
870 "\t-s\tLog to stderr as well as the system log.\n" 475 "\t-s\tLog to stderr as well as the system log.\n" \
871 "\t-t\tLog using the specified tag (defaults to user name).\n" 476 "\t-t\tLog using the specified tag (defaults to user name).\n" \
872 "\t-p\tEnter the message with the specified priority.\n" 477 "\t-p\tEnter the message with the specified priority.\n" \
873 "\t\tThis may be numerical or a ``facility.level'' pair." 478 "\t\tThis may be numerical or a ``facility.level'' pair."
874#endif
875#endif
876DO_COMMA
877#endif
878 479
879#if defined BB_LOGNAME 480#define logname_trivial_usage \
880#if defined USAGE_ENUM
881logname_usage_index
882#elif defined USAGE_MESSAGES
883 "" 481 ""
884#ifndef BB_FEATURE_TRIVIAL_HELP 482#define logname_full_usage \
885 "\n\nPrint the name of the current user." 483 "Print the name of the current user."
886#endif
887#endif
888DO_COMMA
889#endif
890 484
891#if defined BB_LS
892#if defined USAGE_ENUM
893ls_usage_index
894#elif defined USAGE_MESSAGES
895 "[-1Aa"
896#ifdef BB_FEATURE_LS_TIMESTAMPS
897 "c"
898#endif
899 "Cd"
900#ifdef BB_FEATURE_LS_TIMESTAMPS 485#ifdef BB_FEATURE_LS_TIMESTAMPS
901 "e" 486 #define USAGE_LS_TIMESTAMPS(a) a
902#endif 487#else
903#ifdef BB_FEATURE_LS_FILETYPES 488 #define USAGE_LS_TIMESTAMPS(a)
904 "F"
905#endif
906 "iln"
907#ifdef BB_FEATURE_LS_FILETYPES
908 "p"
909#endif
910#ifdef BB_FEATURE_LS_FOLLOWLINKS
911 "L"
912#endif
913#ifdef BB_FEATURE_LS_RECURSIVE
914 "R"
915#endif
916#ifdef BB_FEATURE_LS_SORTFILES
917 "rS"
918#endif
919 "s"
920#ifdef BB_FEATURE_AUTOWIDTH
921 "T"
922#endif
923#ifdef BB_FEATURE_LS_TIMESTAMPS
924 "tu"
925#endif
926#ifdef BB_FEATURE_LS_SORTFILES
927 "v"
928#endif
929#ifdef BB_FEATURE_AUTOWIDTH
930 "w"
931#endif
932 "x"
933#ifdef BB_FEATURE_LS_SORTFILES
934 "X"
935#endif
936#ifdef BB_FEATURE_HUMAN_READABLE
937 "h"
938#endif
939 "k] [filenames...]"
940#ifndef BB_FEATURE_TRIVIAL_HELP
941 "\n\nList directory contents\n\n"
942 "Options:\n"
943 "\t-1\tlist files in a single column\n"
944 "\t-A\tdo not list implied . and ..\n"
945 "\t-a\tdo not hide entries starting with .\n"
946 "\t-C\tlist entries by columns\n"
947#ifdef BB_FEATURE_LS_TIMESTAMPS
948 "\t-c\twith -l: show ctime (the time of last\n"
949 "\t\tmodification of file status information)\n"
950#endif
951 "\t-d\tlist directory entries instead of contents\n"
952#ifdef BB_FEATURE_LS_TIMESTAMPS
953 "\t-e\tlist both full date and full time\n"
954#endif
955#ifdef BB_FEATURE_LS_FILETYPES
956 "\t-F\tappend indicator (one of */=@|) to entries\n"
957#endif 489#endif
958 "\t-i\tlist the i-node for each file\n"
959 "\t-l\tuse a long listing format\n"
960 "\t-n\tlist numeric UIDs and GIDs instead of names\n"
961#ifdef BB_FEATURE_LS_FILETYPES 490#ifdef BB_FEATURE_LS_FILETYPES
962 "\t-p\tappend indicator (one of /=@|) to entries\n" 491 #define USAGE_LS_FILETYPES(a) a
492#else
493 #define USAGE_LS_FILETYPES(a)
963#endif 494#endif
964#ifdef BB_FEATURE_LS_FOLLOWLINKS 495#ifdef BB_FEATURE_LS_FOLLOWLINKS
965 "\t-L\tlist entries pointed to by symbolic links\n" 496 #define USAGE_LS_FOLLOWLINKS(a) a
497#else
498 #define USAGE_LS_FOLLOWLINKS(a)
966#endif 499#endif
967#ifdef BB_FEATURE_LS_RECURSIVE 500#ifdef BB_FEATURE_LS_RECURSIVE
968 "\t-R\tlist subdirectories recursively\n" 501 #define USAGE_LS_RECURSIVE(a) a
969#endif 502#else
970#ifdef BB_FEATURE_LS_SORTFILES 503 #define USAGE_LS_RECURSIVE(a)
971 "\t-r\tsort the listing in reverse order\n"
972 "\t-S\tsort the listing by file size\n"
973#endif
974 "\t-s\tlist the size of each file, in blocks\n"
975#ifdef BB_FEATURE_AUTOWIDTH
976 "\t-T NUM\tassume Tabstop every NUM columns\n"
977#endif
978#ifdef BB_FEATURE_LS_TIMESTAMPS
979 "\t-t\twith -l: show modification time (the time of last\n"
980 "\t\tchange of the file)\n"
981 "\t-u\twith -l: show access time (the time of last\n"
982 "\t\taccess of the file)\n"
983#endif 504#endif
984#ifdef BB_FEATURE_LS_SORTFILES 505#ifdef BB_FEATURE_LS_SORTFILES
985 "\t-v\tsort the listing by version\n" 506 #define USAGE_LS_SORTFILES(a) a
507#else
508 #define USAGE_LS_SORTFILES(a)
986#endif 509#endif
987#ifdef BB_FEATURE_AUTOWIDTH 510#ifdef BB_FEATURE_AUTOWIDTH
988 "\t-w NUM\tassume the terminal is NUM columns wide\n" 511 #define USAGE_AUTOWIDTH(a) a
989#endif
990 "\t-x\tlist entries by lines instead of by columns\n"
991#ifdef BB_FEATURE_LS_SORTFILES
992 "\t-X\tsort the listing by extension\n"
993#endif
994
995#ifdef BB_FEATURE_HUMAN_READABLE
996 "\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G)\n"
997 "\t-k\tprint sizes in kilobytes(default)"
998#else 512#else
999 "\t-k\tprint sizes in kilobytes(compatability)" 513 #define USAGE_AUTOWIDTH(a)
1000#endif 514#endif
1001 515#define ls_trivial_usage \
1002#endif /* BB_FEATURE_TRIVIAL_HELP */ 516 "[-1Aa" USAGE_LS_TIMESTAMPS("c") \
1003#endif 517 "Cd" USAGE_LS_TIMESTAMPS("e") USAGE_LS_FILETYPES("F") "iln" \
1004DO_COMMA 518 USAGE_LS_FILETYPES("p") USAGE_LS_FOLLOWLINKS("L") \
1005#endif /* BB_LS */ 519 USAGE_LS_RECURSIVE("R") USAGE_LS_SORTFILES("rS") \
1006 520 "s" USAGE_AUTOWIDTH("T") USAGE_LS_TIMESTAMPS("tu") \
1007#if defined BB_LSMOD 521 USAGE_LS_SORTFILES("v") USAGE_AUTOWIDTH("w") "x" \
1008#if defined USAGE_ENUM 522 USAGE_LS_SORTFILES("X") USAGE_HUMAN_READABLE("h", "") \
1009lsmod_usage_index 523 "k] [filenames...]"
1010#elif defined USAGE_MESSAGES 524#define ls_full_usage \
525 "List directory contents\n\n" \
526 "Options:\n" \
527 "\t-1\tlist files in a single column\n" \
528 "\t-A\tdo not list implied . and ..\n" \
529 "\t-a\tdo not hide entries starting with .\n" \
530 "\t-C\tlist entries by columns\n" \
531USAGE_LS_TIMESTAMPS( \
532 "\t-c\twith -l: show ctime (the time of last\n" \
533 "\t\tmodification of file status information)\n" \
534 ) \
535 "\t-d\tlist directory entries instead of contents\n" \
536USAGE_LS_TIMESTAMPS( \
537 "\t-e\tlist both full date and full time\n" \
538 ) \
539USAGE_LS_FILETYPES( \
540 "\t-F\tappend indicator (one of */=@|) to entries\n" \
541 ) \
542 "\t-i\tlist the i-node for each file\n" \
543 "\t-l\tuse a long listing format\n" \
544 "\t-n\tlist numeric UIDs and GIDs instead of names\n" \
545USAGE_LS_FILETYPES( \
546 "\t-p\tappend indicator (one of /=@|) to entries\n" \
547 ) \
548USAGE_LS_FOLLOWLINKS( \
549 "\t-L\tlist entries pointed to by symbolic links\n" \
550 ) \
551USAGE_LS_RECURSIVE( \
552 "\t-R\tlist subdirectories recursively\n" \
553 ) \
554USAGE_LS_SORTFILES( \
555 "\t-r\tsort the listing in reverse order\n" \
556 "\t-S\tsort the listing by file size\n" \
557 ) \
558 "\t-s\tlist the size of each file, in blocks\n" \
559USAGE_AUTOWIDTH( \
560 "\t-T NUM\tassume Tabstop every NUM columns\n" \
561 ) \
562USAGE_LS_TIMESTAMPS( \
563 "\t-t\twith -l: show modification time (the time of last\n" \
564 "\t\tchange of the file)\n" \
565 "\t-u\twith -l: show access time (the time of last\n" \
566 "\t\taccess of the file)\n" \
567 ) \
568USAGE_LS_SORTFILES( \
569 "\t-v\tsort the listing by version\n" \
570 ) \
571USAGE_AUTOWIDTH( \
572 "\t-w NUM\tassume the terminal is NUM columns wide\n" \
573 ) \
574 "\t-x\tlist entries by lines instead of by columns\n" \
575USAGE_LS_SORTFILES( \
576 "\t-X\tsort the listing by extension\n" \
577 ) \
578USAGE_HUMAN_READABLE( \
579 "\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
580 "\t-k\tprint sizes in kilobytes(default)" \
581 , \
582 "\t-k\tprint sizes in kilobytes(compatability)" \
583 ) \
584
585#define lsmod_trivial_usage \
1011 "" 586 ""
1012#ifndef BB_FEATURE_TRIVIAL_HELP 587#define lsmod_full_usage \
1013 "\n\nList the currently loaded kernel modules." 588 "List the currently loaded kernel modules."
1014#endif
1015#endif
1016DO_COMMA
1017#endif
1018 589
1019#if defined BB_MAKEDEVS 590#define makedevs_trivial_usage \
1020#if defined USAGE_ENUM
1021makedevs_usage_index
1022#elif defined USAGE_MESSAGES
1023 "NAME TYPE MAJOR MINOR FIRST LAST [s]" 591 "NAME TYPE MAJOR MINOR FIRST LAST [s]"
1024#ifndef BB_FEATURE_TRIVIAL_HELP 592#define makedevs_full_usage \
1025 "\n\nCreates a range of block or character special files\n\n" 593 "Creates a range of block or character special files\n\n" \
1026 "TYPEs include:\n" 594 "TYPEs include:\n" \
1027 "\tb:\tMake a block (buffered) device.\n" 595 "\tb:\tMake a block (buffered) device.\n" \
1028 "\tc or u:\tMake a character (un-buffered) device.\n" 596 "\tc or u:\tMake a character (un-buffered) device.\n" \
1029 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n\n" 597 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n\n" \
1030 "FIRST specifies the number appended to NAME to create the first device.\n" 598 "FIRST specifies the number appended to NAME to create the first device.\n" \
1031 "LAST specifies the number of the last item that should be created.\n" 599 "LAST specifies the number of the last item that should be created.\n" \
1032 "If 's' is the last argument, the base device is created as well.\n\n" 600 "If 's' is the last argument, the base device is created as well.\n\n" \
1033 "For example:\n" 601 "For example:\n" \
1034 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" 602 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" \
1035 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8" 603 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8"
1036#endif
1037#endif
1038DO_COMMA
1039#endif
1040 604
1041#if defined BB_MD5SUM 605#define md5sum_trivial_usage \
1042#if defined USAGE_ENUM 606 "[OPTION] [FILE]...\nor: md5sum [OPTION] -c [FILE]"
1043md5sum_usage_index 607#define md5sum_full_usage \
1044#elif defined USAGE_MESSAGES 608 "Print or check MD5 checksums.\n\n" \
1045 "[OPTION] [FILE]...\n" 609 "Options:\n" \
1046 "or: md5sum [OPTION] -c [FILE]" 610 "With no FILE, or when FILE is -, read standard input.\n\n" \
1047#ifndef BB_FEATURE_TRIVIAL_HELP 611 "\t-b\tread files in binary mode\n" \
1048 "\n\nPrint or check MD5 checksums.\n\n" 612 "\t-c\tcheck MD5 sums against given list\n" \
1049 "Options:\n" 613 "\t-t\tread files in text mode (default)\n" \
1050 "With no FILE, or when FILE is -, read standard input.\n\n" 614 "\t-g\tread a string\n" \
1051 "\t-b\tread files in binary mode\n" 615 "\nThe following two options are useful only when verifying checksums:\n" \
1052 "\t-c\tcheck MD5 sums against given list\n" 616 "\t-s,\tdon't output anything, status code shows success\n" \
1053 "\t-t\tread files in text mode (default)\n"
1054 "\t-g\tread a string\n"
1055 "\nThe following two options are useful only when verifying checksums:\n"
1056 "\t-s,\tdon't output anything, status code shows success\n"
1057 "\t-w,\twarn about improperly formated MD5 checksum lines" 617 "\t-w,\twarn about improperly formated MD5 checksum lines"
1058#endif
1059#endif
1060DO_COMMA
1061#endif
1062 618
1063#if defined BB_MKDIR 619#define mkdir_trivial_usage \
1064#if defined USAGE_ENUM
1065mkdir_usage_index
1066#elif defined USAGE_MESSAGES
1067 "[OPTION] DIRECTORY..." 620 "[OPTION] DIRECTORY..."
1068#ifndef BB_FEATURE_TRIVIAL_HELP 621#define mkdir_full_usage \
1069 "\n\nCreate the DIRECTORY(ies), if they do not already exist\n\n" 622 "Create the DIRECTORY(ies), if they do not already exist\n\n" \
1070 623 "Options:\n" \
1071 "Options:\n" 624 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" \
1072 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n"
1073 "\t-p\tno error if existing, make parent directories as needed" 625 "\t-p\tno error if existing, make parent directories as needed"
1074#endif
1075#endif
1076DO_COMMA
1077#endif
1078 626
1079#if defined BB_MKFIFO 627#define mkfifo_trivial_usage \
1080#if defined USAGE_ENUM
1081mkfifo_usage_index
1082#elif defined USAGE_MESSAGES
1083 "[OPTIONS] name" 628 "[OPTIONS] name"
1084#ifndef BB_FEATURE_TRIVIAL_HELP 629#define mkfifo_full_usage \
1085 "\n\nCreates a named pipe (identical to 'mknod name p')\n\n" 630 "Creates a named pipe (identical to 'mknod name p')\n\n" \
1086 "Options:\n" 631 "Options:\n" \
1087 "\t-m\tcreate the pipe using the specified mode (default a=rw)" 632 "\t-m\tcreate the pipe using the specified mode (default a=rw)"
1088#endif
1089#endif
1090DO_COMMA
1091#endif
1092 633
1093#if defined BB_MKFS_MINIX 634#define mkfs_minix_trivial_usage \
1094#if defined USAGE_ENUM
1095mkfs_minix_usage_index
1096#elif defined USAGE_MESSAGES
1097 "[-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]" 635 "[-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]"
1098#ifndef BB_FEATURE_TRIVIAL_HELP 636#define mkfs_minix_full_usage \
1099 "\n\nMake a MINIX filesystem.\n\n" 637 "Make a MINIX filesystem.\n\n" \
1100 "Options:\n" 638 "Options:\n" \
1101 "\t-c\t\tCheck the device for bad blocks\n" 639 "\t-c\t\tCheck the device for bad blocks\n" \
1102 "\t-n [14|30]\tSpecify the maximum length of filenames\n" 640 "\t-n [14|30]\tSpecify the maximum length of filenames\n" \
1103 "\t-i INODES\tSpecify the number of inodes for the filesystem\n" 641 "\t-i INODES\tSpecify the number of inodes for the filesystem\n" \
1104 "\t-l FILENAME\tRead the bad blocks list from FILENAME\n" 642 "\t-l FILENAME\tRead the bad blocks list from FILENAME\n" \
1105 "\t-v\t\tMake a Minix version 2 filesystem" 643 "\t-v\t\tMake a Minix version 2 filesystem"
1106#endif
1107#endif
1108DO_COMMA
1109#endif
1110 644
1111#if defined BB_MKNOD 645#define mknod_trivial_usage \
1112#if defined USAGE_ENUM
1113mknod_usage_index
1114#elif defined USAGE_MESSAGES
1115 "[OPTIONS] NAME TYPE MAJOR MINOR" 646 "[OPTIONS] NAME TYPE MAJOR MINOR"
1116#ifndef BB_FEATURE_TRIVIAL_HELP 647#define mknod_full_usage \
1117 "\n\nCreate a special file (block, character, or pipe).\n\n" 648 "Create a special file (block, character, or pipe).\n\n" \
1118 "Options:\n" 649 "Options:\n" \
1119 "\t-m\tcreate the special file using the specified mode (default a=rw)\n\n" 650 "\t-m\tcreate the special file using the specified mode (default a=rw)\n\n" \
1120 "TYPEs include:\n" 651 "TYPEs include:\n" \
1121 "\tb:\tMake a block (buffered) device.\n" 652 "\tb:\tMake a block (buffered) device.\n" \
1122 "\tc or u:\tMake a character (un-buffered) device.\n" 653 "\tc or u:\tMake a character (un-buffered) device.\n" \
1123 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes." 654 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes."
1124#endif
1125#endif
1126DO_COMMA
1127#endif
1128 655
1129#if defined BB_MKSWAP 656#define mkswap_trivial_usage \
1130#if defined USAGE_ENUM
1131mkswap_usage_index
1132#elif defined USAGE_MESSAGES
1133 "[-c] [-v0|-v1] device [block-count]" 657 "[-c] [-v0|-v1] device [block-count]"
1134#ifndef BB_FEATURE_TRIVIAL_HELP 658#define mkswap_full_usage \
1135 "\n\nPrepare a disk partition to be used as a swap partition.\n\n" 659 "Prepare a disk partition to be used as a swap partition.\n\n" \
1136 "Options:\n" "\t-c\t\tCheck for read-ability.\n" 660 "Options:\n" "\t-c\t\tCheck for read-ability.\n" \
1137 "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" 661 "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" \
1138 "\t-v1\t\tMake version 1 swap [big!] (default for kernels >\n" 662 "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" \
1139 "\t\t\t2.1.117).\n"
1140 "\tblock-count\tNumber of block to use (default is entire partition)." 663 "\tblock-count\tNumber of block to use (default is entire partition)."
1141#endif
1142#endif
1143DO_COMMA
1144#endif
1145 664
1146#if defined BB_MKTEMP 665#define mktemp_trivial_usage \
1147#if defined USAGE_ENUM
1148mktemp_usage_index
1149#elif defined USAGE_MESSAGES
1150 "[-q] TEMPLATE" 666 "[-q] TEMPLATE"
1151#ifndef BB_FEATURE_TRIVIAL_HELP 667#define mktemp_full_usage \
1152 "\n\nCreates a temporary file with its name based on TEMPLATE.\n" 668 "Creates a temporary file with its name based on TEMPLATE.\n" \
1153 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)." 669 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)."
1154#endif
1155#endif
1156DO_COMMA
1157#endif
1158 670
1159#if defined BB_MORE 671#define more_trivial_usage \
1160#if defined USAGE_ENUM
1161more_usage_index
1162#elif defined USAGE_MESSAGES
1163 "[FILE ...]" 672 "[FILE ...]"
1164#ifndef BB_FEATURE_TRIVIAL_HELP 673#define more_full_usage \
1165 "\n\nMore is a filter for viewing FILE one screenful at a time." 674 "More is a filter for viewing FILE one screenful at a time."
1166#endif
1167#endif
1168DO_COMMA
1169#endif
1170 675
1171#if defined BB_MOUNT 676#ifdef BB_FEATURE_MOUNT_LOOP
1172#if defined USAGE_ENUM 677 #define USAGE_MOUNT_LOOP(a) a
1173mount_usage_index 678#else
1174#elif defined USAGE_MESSAGES 679 #define USAGE_MOUNT_LOOP(a)
1175 "[flags] device directory [-o options,more-options]"
1176#ifndef BB_FEATURE_TRIVIAL_HELP
1177 "\n\nMount a filesystem\n\n"
1178 "Flags:\n"
1179 "\t-a:\t\tMount all filesystems in fstab.\n"
1180#ifdef BB_MTAB
1181 "\t-f:\t\t\"Fake\" Add entry to mount table but don't mount it.\n"
1182 "\t-n:\t\tDon't write a mount table entry.\n"
1183#endif 680#endif
1184 "\t-o option:\tOne of many filesystem options, listed below.\n" 681#ifdef BB_MTAB
1185 "\t-r:\t\tMount the filesystem read-only.\n" 682 #define USAGE_MTAB(a) a
1186 "\t-t fs-type:\tSpecify the filesystem type.\n" 683#else
1187 "\t-w:\t\tMount for reading and writing (default).\n" 684 #define USAGE_MTAB(a)
1188 "\n"
1189 "Options for use with the \"-o\" flag:\n"
1190 "\tasync/sync:\tWrites are asynchronous / synchronous.\n"
1191 "\tatime/noatime:\tEnable / disable updates to inode access times.\n"
1192 "\tdev/nodev:\tAllow use of special device files / disallow them.\n"
1193 "\texec/noexec:\tAllow use of executable files / disallow them.\n"
1194#if defined BB_FEATURE_MOUNT_LOOP
1195 "\tloop:\t\tMounts a file via loop device.\n"
1196#endif 685#endif
1197 "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" 686#define mount_trivial_usage \
1198 "\tremount:\tRe-mount a mounted filesystem, changing its flags.\n" 687 "[flags] device directory [-o options,more-options]"
1199 "\tro/rw:\t\tMount for read-only / read-write.\n" 688#define mount_full_usage \
1200 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" 689 "Mount a filesystem\n\n" \
690 "Flags:\n" \
691 "\t-a:\t\tMount all filesystems in fstab.\n" \
692USAGE_MTAB( \
693 "\t-f:\t\t\"Fake\" mount. Add entry to mount table but don't mount it.\n" \
694 "\t-n:\t\tDon't write a mount table entry.\n" \
695 ) \
696 "\t-o option:\tOne of many filesystem options, listed below.\n" \
697 "\t-r:\t\tMount the filesystem read-only.\n" \
698 "\t-t fs-type:\tSpecify the filesystem type.\n" \
699 "\t-w:\t\tMount for reading and writing (default).\n" \
700 "\n" \
701 "Options for use with the \"-o\" flag:\n" \
702 "\tasync/sync:\tWrites are asynchronous / synchronous.\n" \
703 "\tatime/noatime:\tEnable / disable updates to inode access times.\n" \
704 "\tdev/nodev:\tAllow use of special device files / disallow them.\n" \
705 "\texec/noexec:\tAllow use of executable files / disallow them.\n" \
706USAGE_MOUNT_LOOP( \
707 "\tloop:\t\tMounts a file via loop device.\n" \
708 ) \
709 "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" \
710 "\tremount:\tRe-mount a currently-mounted filesystem, changing its flags.\n" \
711 "\tro/rw:\t\tMount for read-only / read-write.\n" \
712 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" \
1201 "You'll have to see the written documentation for those." 713 "You'll have to see the written documentation for those."
1202#endif
1203#endif
1204DO_COMMA
1205#endif
1206 714
1207#if defined BB_MT 715#define mt_trivial_usage \
1208#if defined USAGE_ENUM
1209mt_usage_index
1210#elif defined USAGE_MESSAGES
1211 "[-f device] opcode value" 716 "[-f device] opcode value"
1212#ifndef BB_FEATURE_TRIVIAL_HELP 717#define mt_full_usage \
1213 "\n\nControl magnetic tape drive operation\n" 718 "Control magnetic tape drive operation\n" \
1214 "\nAvailable Opcodes:\n\n" 719 "\nAvailable Opcodes:\n\n" \
1215 "bsf bsfm bsr bss datacompression drvbuffer eof eom erase\n" 720 "bsf bsfm bsr bss datacompression drvbuffer eof eom erase\n" \
1216 "fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2\n" 721 "fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2\n" \
1217 "ras3 reset retension rew rewoffline seek setblk setdensity\n" 722 "ras3 reset retension rew rewoffline seek setblk setdensity\n" \
1218 "setpart tell unload unlock weof wset" 723 "setpart tell unload unlock weof wset"
1219#endif
1220#endif
1221DO_COMMA
1222#endif
1223 724
1224#if defined BB_CP_MV 725#define mv_trivial_usage \
1225#if defined USAGE_ENUM 726 "SOURCE DEST\n or: mv SOURCE... DIRECTORY"
1226mv_usage_index 727#define mv_full_usage \
1227#elif defined USAGE_MESSAGES 728 "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY."
1228 "SOURCE DEST\n"
1229 " or: mv SOURCE... DIRECTORY"
1230#ifndef BB_FEATURE_TRIVIAL_HELP
1231 "\n\nRename SOURCE to DEST, or move SOURCE(s) to DIRECTORY."
1232#endif
1233#endif
1234DO_COMMA
1235#endif
1236 729
1237#if defined BB_NC 730#define nc_trivial_usage \
1238#if defined USAGE_ENUM
1239nc_usage_index
1240#elif defined USAGE_MESSAGES
1241 "[IP] [port]" 731 "[IP] [port]"
1242#ifndef BB_FEATURE_TRIVIAL_HELP 732#define nc_full_usage \
1243 "\n\nNetcat opens a pipe to IP:port" 733 "Netcat opens a pipe to IP:port"
1244#endif
1245#endif
1246DO_COMMA
1247#endif
1248 734
1249#if defined BB_NSLOOKUP 735#define nslookup_trivial_usage \
1250#if defined USAGE_ENUM
1251nslookup_usage_index
1252#elif defined USAGE_MESSAGES
1253 "[HOST]" 736 "[HOST]"
1254#ifndef BB_FEATURE_TRIVIAL_HELP 737#define nslookup_full_usage \
1255 "\n\nQueries the nameserver for the IP address of the given HOST" 738 "Queries the nameserver for the IP address of the given HOST"
1256#endif
1257#endif
1258DO_COMMA
1259#endif
1260 739
1261#if defined BB_PING 740#ifdef BB_FEATURE_SIMPLE_PING
1262#if defined BB_FEATURE_SIMPLE_PING 741#define ping_trivial_usage "host"
1263#if defined USAGE_ENUM 742#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
1264ping_usage_index 743#else
1265#elif defined USAGE_MESSAGES 744#define ping_trivial_usage \
1266 "host"
1267#ifndef BB_FEATURE_TRIVIAL_HELP
1268 "\n\nSend ICMP ECHO_REQUEST packets to network hosts"
1269#endif
1270#endif
1271DO_COMMA
1272#else /* ! defined BB_FEATURE_SIMPLE_PING */
1273#if defined USAGE_ENUM
1274ping_usage_index
1275#elif defined USAGE_MESSAGES
1276 "[OPTION]... host" 745 "[OPTION]... host"
1277#ifndef BB_FEATURE_TRIVIAL_HELP 746#define ping_full_usage \
1278 "\n\nSend ICMP ECHO_REQUEST packets to network hosts.\n\n" 747 "Send ICMP ECHO_REQUEST packets to network hosts.\n\n" \
1279 "Options:\n" 748 "Options:\n" \
1280 "\t-c COUNT\tSend only COUNT pings.\n" 749 "\t-c COUNT\tSend only COUNT pings.\n" \
1281 "\t-s SIZE\t\tSend SIZE data bytes in packets (default=56).\n" 750 "\t-s SIZE\t\tSend SIZE data bytes in packets (default=56).\n" \
1282 "\t-q\t\tQuiet mode, only displays output at start\n" 751 "\t-q\t\tQuiet mode, only displays output at start\n" \
1283 "\t\t\tand when finished." 752 "\t\t\tand when finished."
1284#endif 753#endif
1285#endif
1286DO_COMMA
1287#endif
1288#endif
1289 754
1290#if defined BB_PIVOT_ROOT 755#define pivot_root_trivial_usage \
1291#if defined USAGE_ENUM
1292pivot_root_usage_index
1293#elif defined USAGE_MESSAGES
1294 "new_root put_old" 756 "new_root put_old"
1295#ifndef BB_FEATURE_TRIVIAL_HELP 757#define pivot_root_full_usage \
1296 "\n\nMove the current root file system to put_old and make new_root\n" 758 "Move the current root file system to put_old and make new_root\n" \
1297 "the new root file system." 759 "the new root file system."
1298#endif
1299#endif
1300DO_COMMA
1301#endif
1302 760
1303#if defined BB_POWEROFF 761#define poweroff_trivial_usage \
1304#if defined USAGE_ENUM
1305poweroff_usage_index
1306#elif defined USAGE_MESSAGES
1307 "" 762 ""
1308#ifndef BB_FEATURE_TRIVIAL_HELP 763#define poweroff_full_usage \
1309 "\n\nHalt the system and request that the kernel shut off the power." 764 "Halt the system and request that the kernel shut off the power."
1310#endif
1311#endif
1312DO_COMMA
1313#endif
1314 765
1315#if defined BB_PRINTF 766#define printf_trivial_usage \
1316#if defined USAGE_ENUM
1317printf_usage_index
1318#elif defined USAGE_MESSAGES
1319 "FORMAT [ARGUMENT...]" 767 "FORMAT [ARGUMENT...]"
1320#ifndef BB_FEATURE_TRIVIAL_HELP 768#define printf_full_usage \
1321 "\n\nFormats and prints ARGUMENT(s) according to FORMAT,\n" 769 "Formats and prints ARGUMENT(s) according to FORMAT,\n" \
1322 "Where FORMAT controls the output exactly as in C printf." 770 "Where FORMAT controls the output exactly as in C printf."
1323#endif
1324#endif
1325DO_COMMA
1326#endif
1327 771
1328#if defined BB_PS 772#define ps_trivial_usage \
1329#if defined USAGE_ENUM
1330ps_usage_index
1331#elif defined USAGE_MESSAGES
1332 "" 773 ""
1333#ifndef BB_FEATURE_TRIVIAL_HELP 774#define ps_full_usage \
1334 "\n\nReport process status\n" 775 "Report process status\n" \
1335 "\nThis version of ps accepts no options." 776 "\nThis version of ps accepts no options."
1336#endif
1337#endif
1338DO_COMMA
1339#endif
1340 777
1341#if defined BB_PWD 778#define pwd_trivial_usage \
1342#if defined USAGE_ENUM
1343pwd_usage_index
1344#elif defined USAGE_MESSAGES
1345 "" 779 ""
1346#ifndef BB_FEATURE_TRIVIAL_HELP 780#define pwd_full_usage \
1347 "\n\nPrint the full filename of the current working directory." 781 "Print the full filename of the current working directory."
1348#endif
1349#endif
1350DO_COMMA
1351#endif
1352 782
1353#if defined BB_RDATE 783#define rdate_trivial_usage \
1354#if defined USAGE_ENUM
1355rdate_usage_index
1356#elif defined USAGE_MESSAGES
1357 "[OPTION] HOST" 784 "[OPTION] HOST"
1358#ifndef BB_FEATURE_TRIVIAL_HELP 785#define rdate_full_usage \
1359 "\n\nGet and possibly set the system date and time from a remote HOST.\n" 786 "Get and possibly set the system date and time from a remote HOST.\n" \
1360 "Options:\n" 787 "Options:\n" \
1361 "\t-s\tSet the system date and time (default).\n" 788 "\t-s\tSet the system date and time (default).\n" \
1362 "\t-p\tPrint the date and time." 789 "\t-p\tPrint the date and time."
1363#endif
1364#endif
1365DO_COMMA
1366#endif
1367 790
1368#if defined BB_READLINK 791#define readlink_trivial_usage \
1369#if defined USAGE_ENUM
1370readlink_usage_index
1371#elif defined USAGE_MESSAGES
1372 "" 792 ""
1373#ifndef BB_FEATURE_TRIVIAL_HELP 793#define readlink_full_usage \
1374 "\n\nRead a symbolic link." 794 "Read a symbolic link."
1375#endif
1376#endif
1377DO_COMMA
1378#endif
1379 795
1380#if defined BB_REBOOT 796#define reboot_trivial_usage \
1381#if defined USAGE_ENUM
1382reboot_usage_index
1383#elif defined USAGE_MESSAGES
1384 "" 797 ""
1385#ifndef BB_FEATURE_TRIVIAL_HELP 798#define reboot_full_usage \
1386 "\n\nReboot the system." 799 "Reboot the system."
1387#endif 800
1388#endif 801#define renice_trivial_usage \
1389DO_COMMA
1390#endif
1391
1392#if defined BB_RENICE
1393#if defined USAGE_ENUM
1394renice_usage_index
1395#elif defined USAGE_MESSAGES
1396 "priority pid [pid ...]" 802 "priority pid [pid ...]"
1397#ifndef BB_FEATURE_TRIVIAL_HELP 803#define renice_full_usage \
1398 "\n\nChanges priority of running processes. Allowed priorities range\n" 804 "Changes priority of running processes. Allowed priorities range\n" \
1399 "from 20 (the process runs only when nothing else is running) to 0\n" 805 "from 20 (the process runs only when nothing else is running) to 0\n" \
1400 "(default priority) to -20 (almost nothing else ever gets to run)." 806 "(default priority) to -20 (almost nothing else ever gets to run)."
1401#endif
1402#endif
1403DO_COMMA
1404#endif
1405
1406 807
1407#if defined BB_RESET 808#define reset_trivial_usage \
1408#if defined USAGE_ENUM
1409reset_usage_index
1410#elif defined USAGE_MESSAGES
1411 "" 809 ""
1412#ifndef BB_FEATURE_TRIVIAL_HELP 810#define reset_full_usage \
1413 "\n\nResets the screen." 811 "Resets the screen."
1414#endif
1415#endif
1416DO_COMMA
1417#endif
1418 812
1419#if defined BB_RM 813#define rm_trivial_usage \
1420#if defined USAGE_ENUM
1421rm_usage_index
1422#elif defined USAGE_MESSAGES
1423 "[OPTION]... FILE..." 814 "[OPTION]... FILE..."
1424#ifndef BB_FEATURE_TRIVIAL_HELP 815#define rm_full_usage \
1425 "\n\nRemove (unlink) the FILE(s). You may use '--' to\n" 816 "Remove (unlink) the FILE(s). You may use '--' to\n" \
1426 "indicate that all following arguments are non-options.\n\n" 817 "indicate that all following arguments are non-options.\n\n" \
1427 "Options:\n" 818 "Options:\n" \
1428 "\t-f\t\tremove existing destinations, never prompt\n" 819 "\t-f\t\tremove existing destinations, never prompt\n" \
1429 "\t-r or -R\tremove the contents of directories recursively" 820 "\t-r or -R\tremove the contents of directories recursively"
1430#endif
1431#endif
1432DO_COMMA
1433#endif
1434 821
1435#if defined BB_RMDIR 822#define rmdir_trivial_usage \
1436#if defined USAGE_ENUM
1437rmdir_usage_index
1438#elif defined USAGE_MESSAGES
1439 "[OPTION]... DIRECTORY..." 823 "[OPTION]... DIRECTORY..."
1440#ifndef BB_FEATURE_TRIVIAL_HELP 824#define rmdir_full_usage \
1441 "\n\nRemove the DIRECTORY(ies), if they are empty." 825 "Remove the DIRECTORY(ies), if they are empty."
1442#endif
1443#endif
1444DO_COMMA
1445#endif
1446 826
1447#if defined BB_RMMOD 827#define rmmod_trivial_usage \
1448#if defined USAGE_ENUM
1449rmmod_usage_index
1450#elif defined USAGE_MESSAGES
1451 "[OPTION]... [MODULE]..." 828 "[OPTION]... [MODULE]..."
1452#ifndef BB_FEATURE_TRIVIAL_HELP 829#define rmmod_full_usage \
1453 "\n\nUnloads the specified kernel modules from the kernel.\n\n" 830 "Unloads the specified kernel modules from the kernel.\n\n" \
1454 "Options:\n" 831 "Options:\n" \
1455 "\t-a\tTry to remove all unused kernel modules." 832 "\t-a\tTry to remove all unused kernel modules."
1456#endif
1457#endif
1458DO_COMMA
1459#endif
1460 833
1461#if defined BB_ROUTE 834#define route_trivial_usage \
1462#if defined USAGE_ENUM
1463route_usage_index
1464#elif defined USAGE_MESSAGES
1465 "[{add|del|flush}]" 835 "[{add|del|flush}]"
1466#ifndef BB_FEATURE_TRIVIAL_HELP 836#define route_full_usage \
1467 "\n\nEdit the kernel's routing tables" 837 "Edit the kernel's routing tables"
1468#endif
1469#endif
1470DO_COMMA
1471#endif
1472 838
1473#if defined BB_RPMUNPACK 839#define rpmunpack_trivial_usage \
1474#if defined USAGE_ENUM
1475rpmunpack_usage_index
1476#elif defined USAGE_MESSAGES
1477 "< package.rpm | gunzip | cpio -idmuv" 840 "< package.rpm | gunzip | cpio -idmuv"
1478#ifndef BB_FEATURE_TRIVIAL_HELP 841#define rpmunpack_full_usage \
1479 "\n\nExtracts an rpm archive." 842 "Extracts an rpm archive."
1480#endif
1481#endif
1482DO_COMMA
1483#endif
1484 843
1485#if defined BB_SED 844#define sed_trivial_usage \
1486#if defined USAGE_ENUM
1487sed_usage_index
1488#elif defined USAGE_MESSAGES
1489 "[-Vhnef] pattern [files...]" 845 "[-Vhnef] pattern [files...]"
1490#ifndef BB_FEATURE_TRIVIAL_HELP 846#define sed_full_usage \
1491 "\n\n" 847 "-n\t\tsuppress automatic printing of pattern space\n" \
1492 "-n\t\tsuppress automatic printing of pattern space\n" 848 "-e script\tadd the script to the commands to be executed\n" \
1493 "-e script\tadd the script to the commands to be executed\n" 849 "-f scriptfile\tadd the contents of script-file to the commands to be executed\n" \
1494 "-f scriptfile\tadd the contents of script-file to the commands to be executed\n" 850 "-h\t\tdisplay this help message\n" \
1495 "\n" 851 "\n" \
1496 "If no -e or -f is given, the first non-option argument is taken as the\n" 852 "If no -e or -f is given, the first non-option argument is taken as the\n" \
1497 "sed script to interpret. All remaining arguments are names of input\n" 853 "sed script to interpret. All remaining arguments are names of input\n" \
1498 "files; if no input files are specified, then the standard input is read." 854 "files; if no input files are specified, then the standard input is read."
1499#endif
1500#endif
1501DO_COMMA
1502#endif
1503 855
1504#if defined BB_SETKEYCODES 856#define setkeycodes_trivial_usage \
1505#if defined USAGE_ENUM
1506setkeycodes_usage_index
1507#elif defined USAGE_MESSAGES
1508 "SCANCODE KEYCODE ..." 857 "SCANCODE KEYCODE ..."
1509#ifndef BB_FEATURE_TRIVIAL_HELP 858#define setkeycodes_full_usage \
1510 "\n\nSet entries into the kernel's scancode-to-keycode map,\n" 859 "Set entries into the kernel's scancode-to-keycode map,\n" \
1511 "allowing unusual keyboards to generate usable keycodes.\n\n" 860 "allowing unusual keyboards to generate usable keycodes.\n\n" \
1512 "SCANCODE may be either xx or e0xx (hexadecimal),\n" 861 "SCANCODE may be either xx or e0xx (hexadecimal),\n" \
1513 "and KEYCODE is given in decimal" 862 "and KEYCODE is given in decimal"
1514#endif
1515#endif
1516DO_COMMA
1517#endif
1518 863
1519#if defined BB_SH 864#define sh_trivial_usage \
1520#if defined USAGE_ENUM 865 "[FILE]...\n or: sh -c command [args]..."
1521shell_usage_index 866#define sh_full_usage \
1522#elif defined USAGE_MESSAGES 867 "lash: The BusyBox command interpreter (shell)."
1523 "[FILE]...\n"
1524 " or: sh -c command [args]..."
1525#ifndef BB_FEATURE_TRIVIAL_HELP
1526 "\n\nlash: The BusyBox command interpreter (shell)."
1527#endif
1528#endif
1529DO_COMMA
1530#endif
1531 868
1532#if defined BB_SLEEP 869#define sleep_trivial_usage \
1533#if defined USAGE_ENUM 870 "N"
1534sleep_usage_index 871#define sleep_full_usage \
1535#elif defined USAGE_MESSAGES 872 "Pause for N seconds."
1536 "N"
1537#ifndef BB_FEATURE_TRIVIAL_HELP
1538 "\n\nPause for N seconds."
1539#endif
1540#endif
1541DO_COMMA
1542#endif
1543 873
1544#if defined BB_SORT
1545#if defined USAGE_ENUM
1546sort_usage_index
1547#elif defined USAGE_MESSAGES
1548 "[-n]"
1549#ifdef BB_FEATURE_SORT_REVERSE
1550 " [-r]"
1551#endif
1552 " [FILE]..."
1553#ifndef BB_FEATURE_TRIVIAL_HELP
1554 "\n\nSorts lines of text in the specified files"
1555#endif
1556#endif
1557DO_COMMA
1558#endif
1559 874
1560#if defined BB_STTY 875#ifdef BB_FEATURE_SORT_REVERSE
1561#if defined USAGE_ENUM 876 #define USAGE_SORT_REVERSE(a) a
1562stty_usage_index 877#else
1563#elif defined USAGE_MESSAGES 878 #define USAGE_SORT_REVERSE(a)
1564 "stty [-a|g] [-F device] [SETTING]..." 879#endif
1565#ifndef BB_FEATURE_TRIVIAL_HELP 880#define sort_trivial_usage \
1566 "\n\nWithout arguments, prints baud rate, line discipline," 881 "[-n]" USAGE_SORT_REVERSE(" [-r]") " [FILE]..."
1567 "\nand deviations from stty sane." 882#define sort_full_usage \
1568 "\n -F device open and use the specified device instead of stdin" 883 "Sorts lines of text in the specified files"
1569 "\n -a print all current settings in human-readable form. Or" 884
1570 "\n -g print in a stty-readable form" 885#define stty_trivial_usage \
886 "[-a|g] [-F device] [SETTING]..."
887#define stty_full_usage \
888 "Without arguments, prints baud rate, line discipline," \
889 "\nand deviations from stty sane." \
890 "\n -F device open and use the specified device instead of stdin" \
891 "\n -a print all current settings in human-readable form. Or" \
892 "\n -g print in a stty-readable form" \
1571 "\n [SETTING] see in documentation" 893 "\n [SETTING] see in documentation"
1572#endif
1573#endif
1574DO_COMMA
1575#endif
1576 894
1577#if defined BB_SWAPONOFF 895#define swapoff_trivial_usage \
1578#if defined USAGE_ENUM
1579swapoff_usage_index
1580#elif defined USAGE_MESSAGES
1581 "[OPTION] [device]" 896 "[OPTION] [device]"
1582#ifndef BB_FEATURE_TRIVIAL_HELP 897#define swapoff_full_usage \
1583 "\n\nStop swapping virtual memory pages on the given device.\n\n" 898 "Stop swapping virtual memory pages on the given device.\n\n" \
1584 "Options:\n" 899 "Options:\n" \
1585 "\t-a\tStop swapping on all swap devices" 900 "\t-a\tStop swapping on all swap devices"
1586#endif
1587#endif
1588DO_COMMA
1589#endif
1590 901
1591#if defined BB_SWAPONOFF 902#define swapon_trivial_usage \
1592#if defined USAGE_ENUM
1593swapon_usage_index
1594#elif defined USAGE_MESSAGES
1595 "[OPTION] [device]" 903 "[OPTION] [device]"
1596#ifndef BB_FEATURE_TRIVIAL_HELP 904#define swapon_full_usage \
1597 "\n\nStart swapping virtual memory pages on the given device.\n\n" 905 "Start swapping virtual memory pages on the given device.\n\n" \
1598 "Options:\n" 906 "Options:\n" \
1599 "\t-a\tStart swapping on all swap devices" 907 "\t-a\tStart swapping on all swap devices"
1600#endif
1601#endif
1602DO_COMMA
1603#endif
1604 908
1605#if defined BB_SYNC 909#define sync_trivial_usage \
1606#if defined USAGE_ENUM
1607sync_usage_index
1608#elif defined USAGE_MESSAGES
1609 "" 910 ""
1610#ifndef BB_FEATURE_TRIVIAL_HELP 911#define sync_full_usage \
1611 "\n\nWrite all buffered filesystem blocks to disk." 912 "Write all buffered filesystem blocks to disk."
1612#endif 913
1613#endif
1614DO_COMMA
1615#endif
1616 914
1617#if defined BB_SYSLOGD
1618#if defined USAGE_ENUM
1619syslogd_usage_index
1620#elif defined USAGE_MESSAGES
1621 "[OPTION]..."
1622#ifndef BB_FEATURE_TRIVIAL_HELP
1623 "\n\nLinux system and kernel (provides klogd) logging utility.\n"
1624 "Note that this version of syslogd/klogd ignores /etc/syslog.conf.\n\n"
1625 "Options:\n"
1626 "\t-m NUM\t\tInterval between MARK lines (default=20min, 0=off)\n"
1627 "\t-n\t\tRun as a foreground process\n"
1628#ifdef BB_FEATURE_KLOGD 915#ifdef BB_FEATURE_KLOGD
1629 "\t-K\t\tDo not start up the klogd process\n" 916 #define USAGE_KLOGD(a) a
917#else
918 #define USAGE_KLOGD(a)
1630#endif 919#endif
1631 "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)"
1632#ifdef BB_FEATURE_REMOTE_LOG 920#ifdef BB_FEATURE_REMOTE_LOG
1633 "\n\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n" 921 #define USAGE_REMOTE_LOG(a) a
1634 "\t-L\t\tLog locally as well as network logging (default is network only)" 922#else
1635#endif 923 #define USAGE_REMOTE_LOG(a)
1636#endif
1637#endif 924#endif
1638DO_COMMA 925#define syslogd_trivial_usage \
926 "[OPTION]..."
927#define syslogd_full_usage \
928 "Linux system and kernel (provides klogd) logging utility.\n" \
929 "Note that this version of syslogd/klogd ignores /etc/syslog.conf.\n\n" \
930 "Options:\n" \
931 "\t-m NUM\t\tInterval between MARK lines (default=20min, 0=off)\n" \
932 "\t-n\t\tRun as a foreground process\n" \
933USAGE_KLOGD("\t-K\t\tDo not start up the klogd process\n") \
934 "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)" \
935USAGE_REMOTE_LOG( \
936 "\n\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n" \
937 "\t-L\t\tLog locally as well as network logging (default is network only)")
938
939
940#ifdef BB_FEATURE_SIMPLE_TAIL
941 #define USAGE_UNSIMPLE_TAIL(a)
942#else
943 #define USAGE_UNSIMPLE_TAIL(a) a
1639#endif 944#endif
1640 945#define tail_trivial_usage \
1641#if defined BB_TAIL
1642#if defined USAGE_ENUM
1643tail_usage_index
1644#elif defined USAGE_MESSAGES
1645 "[OPTION]... [FILE]..." 946 "[OPTION]... [FILE]..."
1646#ifndef BB_FEATURE_TRIVIAL_HELP 947#define tail_full_usage \
1647 "\n\nPrint last 10 lines of each FILE to standard output.\n" 948 "Print last 10 lines of each FILE to standard output.\n" \
1648 "With more than one FILE, precede each with a header giving the\n" 949 "With more than one FILE, precede each with a header giving the\n" \
1649 "file name. With no FILE, or when FILE is -, read standard input.\n\n" 950 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
1650 "Options:\n" 951 "Options:\n" \
1651#ifndef BB_FEATURE_SIMPLE_TAIL 952USAGE_UNSIMPLE_TAIL("\t-c N[kbm]\toutput the last N bytes\n") \
1652 "\t-c N[kbm]\toutput the last N bytes\n" 953 "\t-n N[kbm]\tprint last N lines instead of last 10\n" \
1653#endif 954 "\t-f\t\toutput data as the file grows" \
1654 "\t-n N[kbm]\tprint last N lines instead of last 10\n" 955USAGE_UNSIMPLE_TAIL( \
1655 "\t-f\t\toutput data as the file grows" 956 "\n\t-q\t\tnever output headers giving file names\n" \
1656#ifndef BB_FEATURE_SIMPLE_TAIL 957 "\t-s SEC\t\twait SEC seconds between reads with -f\n" \
1657 "\n\t-q\t\tnever output headers giving file names\n" 958 "\t-v\t\talways output headers giving file names\n\n" \
1658 "\t-s SEC\t\twait SEC seconds between reads with -f\n" 959 "If the first character of N (bytes or lines) is a `+', output begins with \n" \
1659 "\t-v\t\talways output headers giving file names\n\n" 960 "the Nth item from the start of each file, otherwise, print the last N items\n" \
1660 "If the first character of N (bytes or lines) is a `+', output begins with \n" 961 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." \
1661 "the Nth item from the start of each file, otherwise, print the last N items\n" 962 )
1662 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)."
1663//#else
1664// "\nIf the first character of N (bytes or lines) is a `+', output begins with \n"
1665// "the Nth item from the start of each file."
1666#endif
1667#endif
1668#endif
1669DO_COMMA
1670#endif
1671 963
1672#if defined BB_TAR
1673#if defined USAGE_ENUM
1674tar_usage_index
1675#elif defined USAGE_MESSAGES
1676#ifdef BB_FEATURE_TAR_CREATE 964#ifdef BB_FEATURE_TAR_CREATE
1677 "-[cxtvO] " 965 #define USAGE_TAR_CREATE(a) a
1678#else 966#else
1679 "-[xtvO] " 967 #define USAGE_TAR_CREATE(a)
1680#endif 968#endif
1681#if defined BB_FEATURE_TAR_EXCLUDE 969#ifdef BB_FEATURE_TAR_EXCLUDE
1682 "[--exclude File] " 970 #define USAGE_TAR_EXCLUDE(a) a
1683 "[-X File]" 971#else
972 #define USAGE_TAR_EXCLUDE(a)
1684#endif 973#endif
974#define tar_trivial_usage \
975 "-[" USAGE_TAR_CREATE("c") "xtvO] " \
976 USAGE_TAR_EXCLUDE("[--exclude File] [-X File]") \
1685 "[-f tarFile] [FILE(s)] ..." 977 "[-f tarFile] [FILE(s)] ..."
1686#ifndef BB_FEATURE_TRIVIAL_HELP 978#define tar_full_usage \
1687 "\n\nCreate, extract, or list files from a tar file.\n\n" 979 "Create, extract, or list files from a tar file.\n\n" \
1688 "Main operation mode:\n" 980 "Main operation mode:\n" \
1689#ifdef BB_FEATURE_TAR_CREATE 981USAGE_TAR_CREATE("\tc\t\tcreate\n") \
1690 "\tc\t\tcreate\n" 982 "\tx\t\textract\n" \
1691#endif 983 "\tt\t\tlist\n" \
1692 "\tx\t\textract\n" 984 "\nFile selection:\n" \
1693 "\tt\t\tlist\n" 985 "\tf\t\tname of tarfile or \"-\" for stdin\n" \
1694 "\nFile selection:\n" 986 "\tO\t\textract to stdout\n" \
1695 "\tf\t\tname of tarfile or \"-\" for stdin\n" 987USAGE_TAR_EXCLUDE( \
1696 "\tO\t\textract to stdout\n" 988 "\texclude\t\tfile to exclude\n" \
1697#if defined BB_FEATURE_TAR_EXCLUDE 989 "\tX\t\tfile with names to exclude\n" \
1698 "\texclude\t\tfile to exclude\n" 990 ) \
1699 "\tX\t\tfile with names to exclude\n" 991 "\nInformative output:\n" \
1700#endif
1701 "\nInformative output:\n"
1702 "\tv\t\tverbosely list files processed" 992 "\tv\t\tverbosely list files processed"
1703#endif
1704#endif
1705DO_COMMA
1706#endif
1707 993
1708#if defined BB_TEE 994#define tee_trivial_usage \
1709#if defined USAGE_ENUM
1710tee_usage_index
1711#elif defined USAGE_MESSAGES
1712 "[OPTION]... [FILE]..." 995 "[OPTION]... [FILE]..."
1713#ifndef BB_FEATURE_TRIVIAL_HELP 996#define tee_full_usage \
1714 "\n\nCopy standard input to each FILE, and also to standard output.\n\n" 997 "Copy standard input to each FILE, and also to standard output.\n\n" \
1715 "Options:\n" "\t-a\tappend to the given FILEs, do not overwrite" 998 "Options:\n" "\t-a\tappend to the given FILEs, do not overwrite"
1716#endif
1717#endif
1718DO_COMMA
1719#endif
1720 999
1721#if defined BB_TELNET 1000#define telnet_trivial_usage \
1722#if defined USAGE_ENUM
1723telnet_usage_index
1724#elif defined USAGE_MESSAGES
1725 "host [port]" 1001 "host [port]"
1726#ifndef BB_FEATURE_TRIVIAL_HELP 1002#define telnet_full_usage \
1727 "\n\nTelnet is used to establish interactive communication with another\n" 1003 "Telnet is used to establish interactive communication with another\n"\
1728 "computer over a network using the TELNET protocol." 1004 "computer over a network using the TELNET protocol."
1729#endif
1730#endif
1731DO_COMMA
1732#endif
1733 1005
1734#if defined BB_TEST 1006#define test_trivial_usage \
1735#if defined USAGE_ENUM 1007 "EXPRESSION\n or [ EXPRESSION ]"
1736test_usage_index 1008#define test_full_usage \
1737#elif defined USAGE_MESSAGES 1009 "Checks file types and compares values returning an exit\n" \
1738 "\ntest EXPRESSION\n"
1739 "or [ EXPRESSION ]"
1740#ifndef BB_FEATURE_TRIVIAL_HELP
1741 "\n\nChecks file types and compares values returning an exit\n"
1742 "code determined by the value of EXPRESSION." 1010 "code determined by the value of EXPRESSION."
1743#endif
1744#endif
1745DO_COMMA
1746#endif
1747 1011
1748#if defined BB_TOUCH 1012#define touch_trivial_usage \
1749#if defined USAGE_ENUM
1750touch_usage_index
1751#elif defined USAGE_MESSAGES
1752 "[-c] file [file ...]" 1013 "[-c] file [file ...]"
1753#ifndef BB_FEATURE_TRIVIAL_HELP 1014#define touch_full_usage \
1754 "\n\nUpdate the last-modified date on the given file[s].\n\n" 1015 "Update the last-modified date on the given file[s].\n\n" \
1755 "Options:\n" 1016 "Options:\n" \
1756 "\t-c\tDo not create any files" 1017 "\t-c\tDo not create any files"
1757#endif
1758#endif
1759DO_COMMA
1760#endif
1761 1018
1762#if defined BB_TR 1019#define tr_trivial_usage \
1763#if defined USAGE_ENUM
1764tr_usage_index
1765#elif defined USAGE_MESSAGES
1766 "[-cds] STRING1 [STRING2]" 1020 "[-cds] STRING1 [STRING2]"
1767#ifndef BB_FEATURE_TRIVIAL_HELP 1021#define tr_full_usage \
1768 "\n\nTranslate, squeeze, and/or delete characters from\n" 1022 "Translate, squeeze, and/or delete characters from\n" \
1769 "standard input, writing to standard output.\n\n" 1023 "standard input, writing to standard output.\n\n" \
1770 "Options:\n" 1024 "Options:\n" \
1771 "\t-c\ttake complement of STRING1\n" 1025 "\t-c\ttake complement of STRING1\n" \
1772 "\t-d\tdelete input characters coded STRING1\n" 1026 "\t-d\tdelete input characters coded STRING1\n" \
1773 "\t-s\tsqueeze multiple output characters of STRING2 into one character" 1027 "\t-s\tsqueeze multiple output characters of STRING2 into one character"
1774#endif
1775#endif
1776DO_COMMA
1777#endif
1778 1028
1779#if defined BB_TRUE_FALSE 1029#define true_trivial_usage \
1780#if defined USAGE_ENUM
1781true_usage_index
1782#elif defined USAGE_MESSAGES
1783 "" 1030 ""
1784#ifndef BB_FEATURE_TRIVIAL_HELP 1031#define true_full_usage \
1785 "\n\nReturn an exit code of TRUE (0)." 1032 "Return an exit code of TRUE (0)."
1786#endif
1787#endif
1788DO_COMMA
1789#endif
1790 1033
1791#if defined BB_TTY 1034#define tty_trivial_usage \
1792#if defined USAGE_ENUM
1793tty_usage_index
1794#elif defined USAGE_MESSAGES
1795 "" 1035 ""
1796#ifndef BB_FEATURE_TRIVIAL_HELP 1036#define tty_full_usage \
1797 "\n\nPrint the file name of the terminal connected to standard input.\n\n" 1037 "Print the file name of the terminal connected to standard input.\n\n"\
1798 "Options:\n" 1038 "Options:\n" \
1799 "\t-s\tprint nothing, only return an exit status" 1039 "\t-s\tprint nothing, only return an exit status"
1800#endif
1801#endif
1802DO_COMMA
1803#endif
1804 1040
1805#if defined BB_UMOUNT 1041#ifdef BB_FEATURE_MOUNT_FORCE
1806#if defined USAGE_ENUM 1042 #define USAGE_MOUNT_FORCE(a) a
1807umount_usage_index
1808#elif defined USAGE_MESSAGES
1809 "[flags] filesystem|directory"
1810#ifndef BB_FEATURE_TRIVIAL_HELP
1811 "\nUnmount file systems\n"
1812 "\nFlags:\n" "\t-a:\tUnmount all file systems"
1813#ifdef BB_MTAB
1814 " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n"
1815#else 1043#else
1816 "\n" 1044 #define USAGE_MOUNT_FORCE(a)
1817#endif
1818 "\t-r:\tTry to remount devices as read-only if mount is busy"
1819#if defined BB_FEATURE_MOUNT_FORCE
1820 "\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)"
1821#endif
1822#if defined BB_FEATURE_MOUNT_LOOP
1823 "\n\t-l:\tDo not free loop device (if a loop device has been used)"
1824#endif 1045#endif
1825#endif 1046#define umount_trivial_usage \
1826#endif 1047 "[flags] filesystem|directory"
1827DO_COMMA 1048#define umount_full_usage \
1828#endif 1049 "Unmount file systems\n" \
1829 1050 "\nFlags:\n" "\t-a:\tUnmount all file systems" \
1830#if defined BB_UNAME 1051USAGE_MTAB(" in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries") \
1831#if defined USAGE_ENUM 1052 "\n\t-r:\tTry to remount devices as read-only if mount is busy" \
1832uname_usage_index 1053USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \
1833#elif defined USAGE_MESSAGES 1054USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)" \
1055 )
1056
1057#define uname_trivial_usage \
1834 "[OPTION]..." 1058 "[OPTION]..."
1835#ifndef BB_FEATURE_TRIVIAL_HELP 1059#define uname_full_usage \
1836 "\n\nPrint certain system information. With no OPTION, same as -s.\n\n" 1060 "Print certain system information. With no OPTION, same as -s.\n\n" \
1837 "Options:\n" 1061 "Options:\n" \
1838 "\t-a\tprint all information\n" 1062 "\t-a\tprint all information\n" \
1839 "\t-m\tthe machine (hardware) type\n" 1063 "\t-m\tthe machine (hardware) type\n" \
1840 "\t-n\tprint the machine's network node hostname\n" 1064 "\t-n\tprint the machine's network node hostname\n" \
1841 "\t-r\tprint the operating system release\n" 1065 "\t-r\tprint the operating system release\n" \
1842 "\t-s\tprint the operating system name\n" 1066 "\t-s\tprint the operating system name\n" \
1843 1067 "\t-p\tprint the host processor type\n" \
1844 "\t-p\tprint the host processor type\n"
1845 "\t-v\tprint the operating system version" 1068 "\t-v\tprint the operating system version"
1846#endif
1847#endif
1848DO_COMMA
1849#endif
1850 1069
1851#if defined BB_UNIQ 1070#define uniq_trivial_usage \
1852#if defined USAGE_ENUM
1853uniq_usage_index
1854#elif defined USAGE_MESSAGES
1855 "[OPTION]... [INPUT [OUTPUT]]" 1071 "[OPTION]... [INPUT [OUTPUT]]"
1856#ifndef BB_FEATURE_TRIVIAL_HELP 1072#define uniq_full_usage \
1857 "\n\nDiscard all but one of successive identical lines from INPUT\n" 1073 "Discard all but one of successive identical lines from INPUT\n" \
1858 "(or standard input), writing to OUTPUT (or standard output).\n" 1074 "(or standard input), writing to OUTPUT (or standard output).\n" \
1859 "Options:\n" 1075 "Options:\n" \
1860 "\t-c\tprefix lines by the number of occurrences\n" 1076 "\t-c\tprefix lines by the number of occurrences\n" \
1861 "\t-d\tonly print duplicate lines\n" 1077 "\t-d\tonly print duplicate lines\n" \
1862 "\t-u\tonly print unique lines" 1078 "\t-u\tonly print unique lines"
1863#endif
1864#endif
1865DO_COMMA
1866#endif
1867 1079
1868#if defined BB_UNIX2DOS 1080#define unix2dos_trivial_usage \
1869#if defined USAGE_ENUM
1870unix2dos_usage_index
1871#elif defined USAGE_MESSAGES
1872 "< unixfile > dosfile" 1081 "< unixfile > dosfile"
1873#ifndef BB_FEATURE_TRIVIAL_HELP 1082#define unix2dos_full_usage \
1874 "\n\nConverts a text file from unix format to dos format." 1083 "Converts a text file from unix format to dos format."
1875#endif
1876#endif
1877DO_COMMA
1878#endif
1879 1084
1880#if defined BB_UPDATE 1085#define update_trivial_usage \
1881#if defined USAGE_ENUM
1882update_usage_index
1883#elif defined USAGE_MESSAGES
1884 "[options]" 1086 "[options]"
1885#ifndef BB_FEATURE_TRIVIAL_HELP 1087#define update_full_usage \
1886 "\n\nPeriodically flushes filesystem buffers.\n\n" 1088 "Periodically flushes filesystem buffers.\n\n" \
1887 "Options:\n" 1089 "Options:\n" \
1888 "\t-S\tforce use of sync(2) instead of flushing\n" 1090 "\t-S\tforce use of sync(2) instead of flushing\n" \
1889 "\t-s SECS\tcall sync this often (default 30)\n" 1091 "\t-s SECS\tcall sync this often (default 30)\n" \
1890 "\t-f SECS\tflush some buffers this often (default 5)" 1092 "\t-f SECS\tflush some buffers this often (default 5)"
1891#endif
1892#endif
1893DO_COMMA
1894#endif
1895 1093
1896#if defined BB_UPTIME 1094#define uptime_trivial_usage \
1897#if defined USAGE_ENUM
1898uptime_usage_index
1899#elif defined USAGE_MESSAGES
1900 "" 1095 ""
1901#ifndef BB_FEATURE_TRIVIAL_HELP 1096#define uptime_full_usage \
1902 "\n\nDisplay the time since the last boot." 1097 "Display the time since the last boot."
1903#endif
1904#endif
1905DO_COMMA
1906#endif
1907 1098
1908#if defined BB_USLEEP 1099#define usleep_trivial_usage \
1909#if defined USAGE_ENUM
1910usleep_usage_index
1911#elif defined USAGE_MESSAGES
1912 "N" 1100 "N"
1913#ifndef BB_FEATURE_TRIVIAL_HELP 1101#define usleep_full_usage \
1914 "\n\nPause for N microseconds." 1102 "Pause for N microseconds."
1915#endif
1916#endif
1917DO_COMMA
1918#endif
1919 1103
1920#if defined BB_UUDECODE 1104#define uudecode_trivial_usage \
1921#if defined USAGE_ENUM
1922uudecode_usage_index
1923#elif defined USAGE_MESSAGES
1924 "[FILE]..." 1105 "[FILE]..."
1925#ifndef BB_FEATURE_TRIVIAL_HELP 1106#define uudecode_full_usage \
1926 "\n\nUudecode a file that is uuencoded.\n\n" 1107 "Uudecode a file that is uuencoded.\n\n" \
1927 "Options:\n" 1108 "Options:\n" \
1928 "\t-o FILE\tdirect output to FILE" 1109 "\t-o FILE\tdirect output to FILE" \
1929#endif
1930#endif
1931DO_COMMA
1932#endif
1933 1110
1934#if defined BB_UUENCODE 1111#define uuencode_trivial_usage \
1935#if defined USAGE_ENUM
1936uuencode_usage_index
1937#elif defined USAGE_MESSAGES
1938 "[OPTION] [INFILE] REMOTEFILE" 1112 "[OPTION] [INFILE] REMOTEFILE"
1939#ifndef BB_FEATURE_TRIVIAL_HELP 1113#define uuencode_full_usage \
1940 "\n\nUuencode a file.\n\n" 1114 "Uuencode a file.\n\n" \
1941 "Options:\n" 1115 "Options:\n" \
1942 "\t-m\tuse base64 encoding as of RFC1521" 1116 "\t-m\tuse base64 encoding as of RFC1521"
1943#endif
1944#endif
1945DO_COMMA
1946#endif
1947 1117
1948#if defined BB_WATCHDOG 1118#define watchdog_trivial_usage \
1949#if defined USAGE_ENUM
1950watchdog_usage_index
1951#elif defined USAGE_MESSAGES
1952 "dev" 1119 "dev"
1953#ifndef BB_FEATURE_TRIVIAL_HELP 1120#define watchdog_full_usage \
1954 "\n\nPeriodically write to watchdog device \"dev\"" 1121 "Periodically write to watchdog device \"dev\""
1955#endif
1956#endif
1957DO_COMMA
1958#endif
1959 1122
1960#if defined BB_WC 1123#define wc_trivial_usage \
1961#if defined USAGE_ENUM
1962wc_usage_index
1963#elif defined USAGE_MESSAGES
1964 "[OPTION]... [FILE]..." 1124 "[OPTION]... [FILE]..."
1965#ifndef BB_FEATURE_TRIVIAL_HELP 1125#define wc_full_usage \
1966 "\n\nPrint line, word, and byte counts for each FILE, and a total line if\n" 1126 "Print line, word, and byte counts for each FILE, and a total line if\n" \
1967 "more than one FILE is specified. With no FILE, read standard input.\n\n" 1127 "more than one FILE is specified. With no FILE, read standard input.\n\n" \
1968 "Options:\n" 1128 "Options:\n" \
1969 "\t-c\tprint the byte counts\n" 1129 "\t-c\tprint the byte counts\n" \
1970 "\t-l\tprint the newline counts\n" 1130 "\t-l\tprint the newline counts\n" \
1971 1131 "\t-L\tprint the length of the longest line\n" \
1972 "\t-L\tprint the length of the longest line\n"
1973 "\t-w\tprint the word counts" 1132 "\t-w\tprint the word counts"
1974#endif
1975#endif
1976DO_COMMA
1977#endif
1978 1133
1979#if defined BB_WGET 1134#define wget_trivial_usage \
1980#if defined USAGE_ENUM 1135 "[-c] [-O file] url"
1981wget_usage_index 1136#define wget_full_usage \
1982#elif defined USAGE_MESSAGES 1137 "wget retrieves files via HTTP\n\n" \
1983 "[-c] [-O file] url" 1138 "Options:\n" \
1984#ifndef BB_FEATURE_TRIVIAL_HELP 1139 "\t-c\tcontinue retrieval of aborted transfers\n" \
1985 "\n\nwget retrieves files via HTTP\n\n"
1986 "Options:\n"
1987 "\t-c\tcontinue retrieval of aborted transfers\n"
1988 "\t-O\tsave to filename ('-' for stdout)" 1140 "\t-O\tsave to filename ('-' for stdout)"
1989#endif
1990#endif
1991DO_COMMA
1992#endif
1993 1141
1994#if defined BB_WHICH 1142#define which_trivial_usage \
1995#if defined USAGE_ENUM
1996which_usage_index
1997#elif defined USAGE_MESSAGES
1998 "[COMMAND ...]" 1143 "[COMMAND ...]"
1999#ifndef BB_FEATURE_TRIVIAL_HELP 1144#define which_full_usage \
2000 "\n\nLocates a COMMAND." 1145 "Locates a COMMAND."
2001#endif
2002#endif
2003DO_COMMA
2004#endif
2005 1146
2006#if defined BB_WHOAMI 1147#define whoami_trivial_usage \
2007#if defined USAGE_ENUM
2008whoami_usage_index
2009#elif defined USAGE_MESSAGES
2010 "" 1148 ""
2011#ifndef BB_FEATURE_TRIVIAL_HELP 1149#define whoami_full_usage \
2012 "\n\nPrints the user name associated with the current effective user id." 1150 "Prints the user name associated with the current effective user id."
2013#endif
2014#endif
2015DO_COMMA
2016#endif
2017 1151
2018#if defined BB_XARGS 1152#define xargs_trivial_usage \
2019#if defined USAGE_ENUM 1153 "[COMMAND] [ARGS...]"
2020xargs_usage_index 1154#define xargs_full_usage \
2021#elif defined USAGE_MESSAGES 1155 "Executes COMMAND on every item given by standard input."
2022 "[COMMAND] [ARGS...]"
2023#ifndef BB_FEATURE_TRIVIAL_HELP
2024 "\n\nExecutes COMMAND on every item given by standard input."
2025#endif
2026#endif
2027DO_COMMA
2028#endif
2029 1156
2030#if defined BB_YES 1157#define yes_trivial_usage \
2031#if defined USAGE_ENUM
2032yes_usage_index
2033#elif defined USAGE_MESSAGES
2034 "[OPTION]... [STRING]..." 1158 "[OPTION]... [STRING]..."
2035#ifndef BB_FEATURE_TRIVIAL_HELP 1159#define yes_full_usage \
2036 "\n\nRepeatedly outputs a line with all specified STRING(s), or `y'." 1160 "Repeatedly outputs a line with all specified STRING(s), or `y'."
2037#endif
2038#endif
2039DO_COMMA
2040#endif
2041
2042#if defined USAGE_ENUM || defined USAGE_MESSAGES
2043};
2044#endif
2045
2046#undef DOCOMMA
2047#undef USAGE_ENUM
2048#undef USAGE_MESSAGES
2049 1161
1162#define zcat_trivial_usage \
1163 "FILE"
1164#define zcat_full_usage \
1165 "Uncompress to stdout."
diff --git a/usage.c b/usage.c
index e429c5a4e..dfea1f96b 100644
--- a/usage.c
+++ b/usage.c
@@ -1,2 +1,10 @@
1#define USAGE_MESSAGES 1#include "busybox.h"
2
3const char usage_messages[] =
4
5#define MAKE_USAGE
2#include "usage.h" 6#include "usage.h"
7
8#include "applets.h"
9
10;
diff --git a/usage.h b/usage.h
index 7c7318595..b39fec924 100644
--- a/usage.h
+++ b/usage.h
@@ -1,2049 +1,1165 @@
1#include "Config.h" 1#define ar_trivial_usage \
2
3extern const char usage_messages[];
4
5#if defined USAGE_ENUM
6enum
7#elif defined USAGE_MESSAGES
8const char usage_messages[] =
9#endif
10
11#if defined USAGE_ENUM || defined USAGE_MESSAGES
12{
13#endif
14
15#if defined USAGE_ENUM
16#define DO_COMMA ,
17#elif defined USAGE_MESSAGES
18#define DO_COMMA "\0"
19#else
20#define DO_COMMA
21#endif
22
23
24#if defined BB_AR
25#if defined USAGE_ENUM
26ar_usage_index
27#elif defined USAGE_MESSAGES
28 "-[ovR]{ptx} archive filenames" 2 "-[ovR]{ptx} archive filenames"
29#ifndef BB_FEATURE_TRIVIAL_HELP 3#define ar_full_usage \
30 "\n\nExtract or list files from an ar archive.\n\n" 4 "Extract or list files from an ar archive.\n\n" \
31 "Options:\n" 5 "Options:\n" \
32 "\t-o\t\tpreserve original dates\n" 6 "\t-o\t\tpreserve original dates\n" \
33 "\t-p\t\textract to stdout\n" 7 "\t-p\t\textract to stdout\n" \
34 "\t-t\t\tlist\n" 8 "\t-t\t\tlist\n" \
35 "\t-x\t\textract\n" 9 "\t-x\t\textract\n" \
36 "\t-v\t\tverbosely list files processed\n" 10 "\t-v\t\tverbosely list files processed\n" \
37 "\t-R\t\trecursive action" 11 "\t-R\t\trecursive action"
38#endif
39#endif
40DO_COMMA
41#endif
42 12
43#if defined BB_BASENAME 13#define basename_trivial_usage \
44#if defined USAGE_ENUM
45basename_usage_index
46#elif defined USAGE_MESSAGES
47 "FILE [SUFFIX]" 14 "FILE [SUFFIX]"
48#ifndef BB_FEATURE_TRIVIAL_HELP 15#define basename_full_usage \
49 "\n\nStrips directory path and suffixes from FILE.\n" 16 "Strips directory path and suffixes from FILE.\n" \
50 "If specified, also removes any trailing SUFFIX." 17 "If specified, also removes any trailing SUFFIX."
51#endif
52#endif
53DO_COMMA
54#endif
55 18
56#if defined BB_CAT 19#define cat_trivial_usage \
57#if defined USAGE_ENUM
58cat_usage_index
59#elif defined USAGE_MESSAGES
60 "[FILE]..." 20 "[FILE]..."
61#ifndef BB_FEATURE_TRIVIAL_HELP 21#define cat_full_usage \
62 "\n\nConcatenates FILE(s) and prints them to stdout." 22 "Concatenates FILE(s) and prints them to stdout."
63#endif
64#endif
65DO_COMMA
66#endif
67 23
68#if defined BB_CHMOD_CHOWN_CHGRP 24#define chgrp_trivial_usage \
69#if defined USAGE_ENUM
70chgrp_usage_index
71#elif defined USAGE_MESSAGES
72 "[OPTION]... GROUP FILE..." 25 "[OPTION]... GROUP FILE..."
73#ifndef BB_FEATURE_TRIVIAL_HELP 26#define chgrp_full_usage \
74 "\n\nChange the group membership of each FILE to GROUP.\n" 27 "Change the group membership of each FILE to GROUP.\n" \
75 "\nOptions:\n\t-R\tChanges files and directories recursively." 28 "\nOptions:\n\t-R\tChanges files and directories recursively."
76#endif
77#endif
78DO_COMMA
79#endif
80 29
81#if defined BB_CHMOD_CHOWN_CHGRP 30#define chmod_trivial_usage \
82#if defined USAGE_ENUM
83chmod_usage_index
84#elif defined USAGE_MESSAGES
85 "[-R] MODE[,MODE]... FILE..." 31 "[-R] MODE[,MODE]... FILE..."
86#ifndef BB_FEATURE_TRIVIAL_HELP 32#define chmod_full_usage \
87 "\n\nEach MODE is one or more of the letters ugoa, one of the symbols +-= and\n" 33 "Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n" \
88 "one or more of the letters rwxst.\n\n" 34 "one or more of the letters rwxst.\n\n" \
89 "Options:\n\t-R\tChanges files and directories recursively." 35 "Options:\n\t-R\tChanges files and directories recursively."
90#endif
91#endif
92DO_COMMA
93#endif
94 36
95#if defined BB_CHMOD_CHOWN_CHGRP 37#define chown_trivial_usage \
96#if defined USAGE_ENUM
97chown_usage_index
98#elif defined USAGE_MESSAGES
99 "[OPTION]... OWNER[<.|:>[GROUP] FILE..." 38 "[OPTION]... OWNER[<.|:>[GROUP] FILE..."
100#ifndef BB_FEATURE_TRIVIAL_HELP 39#define chown_full_usage \
101 "\n\nChange the owner and/or group of each FILE to OWNER and/or GROUP.\n" 40 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" \
102 "\nOptions:\n\t-R\tChanges files and directories recursively." 41 "\nOptions:\n\t-R\tChanges files and directories recursively."
103#endif
104#endif
105DO_COMMA
106#endif
107 42
108#if defined BB_CHROOT 43#define chroot_trivial_usage \
109#if defined USAGE_ENUM
110chroot_usage_index
111#elif defined USAGE_MESSAGES
112 "NEWROOT [COMMAND...]" 44 "NEWROOT [COMMAND...]"
113#ifndef BB_FEATURE_TRIVIAL_HELP 45#define chroot_full_usage \
114 "\n\nRun COMMAND with root directory set to NEWROOT." 46 "Run COMMAND with root directory set to NEWROOT."
115#endif
116#endif
117DO_COMMA
118#endif
119 47
120#if defined BB_CHVT 48#define chvt_trivial_usage \
121#if defined USAGE_ENUM
122chvt_usage_index
123#elif defined USAGE_MESSAGES
124 "N" 49 "N"
125#ifndef BB_FEATURE_TRIVIAL_HELP 50#define chvt_full_usage \
126 "\n\nChanges the foreground virtual terminal to /dev/ttyN" 51 "Changes the foreground virtual terminal to /dev/ttyN"
127#endif
128#endif
129DO_COMMA
130#endif
131 52
132#if defined BB_CLEAR 53#define clear_trivial_usage \
133#if defined USAGE_ENUM
134clear_usage_index
135#elif defined USAGE_MESSAGES
136 "" 54 ""
137#ifndef BB_FEATURE_TRIVIAL_HELP 55#define clear_full_usage \
138 "\n\nClear screen." 56 "Clear screen."
139#endif
140#endif
141DO_COMMA
142#endif
143 57
144#if defined BB_CMP 58#define cmp_trivial_usage \
145#if defined USAGE_ENUM
146cmp_usage_index
147#elif defined USAGE_MESSAGES
148 "FILE1 [FILE2]" 59 "FILE1 [FILE2]"
149#ifndef BB_FEATURE_TRIVIAL_HELP 60#define cmp_full_usage \
150 "\n\nCompare files." 61 "Compare files."
151#endif
152#endif
153DO_COMMA
154#endif
155 62
156#if defined BB_CP_MV 63#define cp_trivial_usage \
157#if defined USAGE_ENUM
158cp_usage_index
159#elif defined USAGE_MESSAGES
160 "[OPTION]... SOURCE DEST\n" 64 "[OPTION]... SOURCE DEST\n"
161 " or: cp [OPTION]... SOURCE... DIRECTORY" 65#define cp_full_usage \
162#ifndef BB_FEATURE_TRIVIAL_HELP 66 "Copies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" \
163 "\n\nCopies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" 67 "\n" \
164 "\n" 68 "\t-a\tSame as -dpR\n" \
165 "\t-a\tSame as -dpR\n" 69 "\t-d\tPreserves links\n" \
166 "\t-d\tPreserves links\n" 70 "\t-p\tPreserves file attributes if possible\n" \
167 "\t-p\tPreserves file attributes if possible\n" 71 "\t-f\tforce (implied; ignored) - always set\n" \
168 "\t-f\tforce (implied; ignored) - always set\n"
169 "\t-R\tCopies directories recursively" 72 "\t-R\tCopies directories recursively"
170#endif
171#endif
172DO_COMMA
173#endif
174 73
175#if defined BB_CUT 74#define cut_trivial_usage \
176#if defined USAGE_ENUM
177cut_usage_index
178#elif defined USAGE_MESSAGES
179 "[OPTION]... [FILE]..." 75 "[OPTION]... [FILE]..."
180#ifndef BB_FEATURE_TRIVIAL_HELP 76#define cut_full_usage \
181 "\n\nPrints selected fields from each input FILE to standard output.\n\n" 77 "Prints selected fields from each input FILE to standard output.\n\n" \
182 "Options:\n" 78 "Options:\n" \
183 "\t-b LIST\tOutput only bytes from LIST\n" 79 "\t-b LIST\tOutput only bytes from LIST\n" \
184 "\t-c LIST\tOutput only characters from LIST\n" 80 "\t-c LIST\tOutput only characters from LIST\n" \
185 "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n" 81 "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n" \
186 "\t-s\tOutput only the lines containing delimiter\n" 82 "\t-s\tOutput only the lines containing delimiter\n" \
187 "\t-f N\tPrint only these fields\n" 83 "\t-f N\tPrint only these fields\n" \
188 "\t-n\tIgnored" 84 "\t-n\tIgnored"
189#endif
190#endif
191DO_COMMA
192#endif
193 85
194#if defined BB_DATE 86#define date_trivial_usage \
195#if defined USAGE_ENUM
196date_usage_index
197#elif defined USAGE_MESSAGES
198 "[OPTION]... [+FORMAT]\n" 87 "[OPTION]... [+FORMAT]\n"
199 " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]" 88#define date_full_usage \
200#ifndef BB_FEATURE_TRIVIAL_HELP 89 "Displays the current time in the given FORMAT, or sets the system date.\n" \
201 "\n\nDisplays the current time in the given FORMAT, or sets the system date.\n" 90 "\nOptions:\n\t-R\t\tOutputs RFC-822 compliant date string\n" \
202 "\nOptions:\n\t-R\t\tOutputs RFC-822 compliant date string\n" 91 "\t-d STRING\tdisplay time described by STRING, not `now'\n" \
203 "\t-d STRING\tdisplay time described by STRING, not `now'\n" 92 "\t-s\t\tSets time described by STRING\n" \
204 "\t-s\t\tSets time described by STRING\n"
205 "\t-u\t\tPrints or sets Coordinated Universal Time" 93 "\t-u\t\tPrints or sets Coordinated Universal Time"
206#endif
207#endif
208DO_COMMA
209#endif
210 94
211#if defined BB_DC 95#define dc_trivial_usage \
212#if defined USAGE_ENUM
213dc_usage_index
214#elif defined USAGE_MESSAGES
215 "expression ..." 96 "expression ..."
216#ifndef BB_FEATURE_TRIVIAL_HELP 97#define dc_full_usage \
217 "\n\nThis is a Tiny RPN calculator that understands the\n" 98 "This is a Tiny RPN calculator that understands the\n" \
218 "following operations: +, -, /, *, and, or, not, eor.\n" 99 "following operations: +, -, /, *, and, or, not, eor.\n" \
219 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16" 100 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16"
220#endif
221#endif
222DO_COMMA
223#endif
224 101
225#if defined BB_DD 102#define dd_trivial_usage \
226#if defined USAGE_ENUM 103 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N] [seek=N] [conv=notrunc|sync]"
227dd_usage_index 104#define dd_full_usage \
228#elif defined USAGE_MESSAGES 105 "Copy a file, converting and formatting according to options\n\n" \
229 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N] [seek=N]\n" 106 "\tif=FILE\tread from FILE instead of stdin\n" \
230 "\t [conv=notrunc|sync]" 107 "\tof=FILE\twrite to FILE instead of stdout\n" \
231#ifndef BB_FEATURE_TRIVIAL_HELP 108 "\tbs=N\tread and write N bytes at a time\n" \
232 "\n\nCopy a file, converting and formatting according to options\n\n" 109 "\tcount=N\tcopy only N input blocks\n" \
233 "\tif=FILE\t\tread from FILE instead of stdin\n" 110 "\tskip=N\tskip N input blocks\n" \
234 "\tof=FILE\t\twrite to FILE instead of stdout\n" 111 "\tseek=N\tskip N output blocks\n" \
235 "\tbs=N\t\tread and write N bytes at a time\n" 112 "\tconv=notrunc\tdon't truncate output file\n" \
236 "\tcount=N\t\tcopy only N input blocks\n" 113 "\tconv=sync\tpad blocks with zeros\n" \
237 "\tskip=N\t\tskip N input blocks\n" 114 "\n" \
238 "\tseek=N\t\tskip N output blocks\n" 115 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \
239 "\tconv=notrunc\tdon't truncate output file\n"
240 "\tconv=sync\tpad blocks with zeros\n"
241 "\n"
242 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n"
243 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)." 116 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)."
244#endif
245#endif
246DO_COMMA
247#endif
248 117
249#if defined BB_DEALLOCVT 118#define deallocvt_trivial_usage \
250#if defined USAGE_ENUM
251deallocvt_usage_index
252#elif defined USAGE_MESSAGES
253 "N" 119 "N"
254#ifndef BB_FEATURE_TRIVIAL_HELP 120#define deallocvt_full_usage \
255 "\n\nDeallocate unused virtual terminal /dev/ttyN" 121 "Deallocate unused virtual terminal /dev/ttyN"
256#endif 122
257#endif
258DO_COMMA
259#endif
260 123
261#if defined BB_DF
262#if defined USAGE_ENUM
263df_usage_index
264#elif defined USAGE_MESSAGES
265 "[-"
266#ifdef BB_FEATURE_HUMAN_READABLE
267 "hm"
268#endif
269 "k] [filesystem ...]"
270#ifndef BB_FEATURE_TRIVIAL_HELP
271 "\n\nPrint the filesystem space used and space available\n\n"
272 "Options:\n"
273#ifdef BB_FEATURE_HUMAN_READABLE 124#ifdef BB_FEATURE_HUMAN_READABLE
274 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G)\n" 125 #define USAGE_HUMAN_READABLE(a,b) a
275 "\t-m\tprint sizes in megabytes\n"
276 "\t-k\tprint sizes in kilobytes(default)"
277#else 126#else
278 "\n\t-k\tprint sizes in kilobytes(compatability)" 127 #define USAGE_HUMAN_READABLE(a,b) b
279#endif 128#endif
280#endif 129#define df_trivial_usage \
281#endif 130 "[-" \
282DO_COMMA 131 USAGE_HUMAN_READABLE("hm", "") \
283#endif 132 "k] [filesystem ...]\n"
284 133#define df_full_usage \
285#if defined BB_DIRNAME 134 "Print the filesystem space used and space available.\n\n" \
286#if defined USAGE_ENUM 135 "Options:\n" \
287dirname_usage_index 136USAGE_HUMAN_READABLE( \
288#elif defined USAGE_MESSAGES 137 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
138 "\t-m\tprint sizes in megabytes\n" \
139 "\t-k\tprint sizes in kilobytes(default)", \
140 "\n\t-k\tprint sizes in kilobytes(compatability)")
141
142#define dirname_trivial_usage \
289 "[FILENAME ...]" 143 "[FILENAME ...]"
290#ifndef BB_FEATURE_TRIVIAL_HELP 144#define dirname_full_usage \
291 "\n\nStrips non-directory suffix from FILENAME" 145 "Strips non-directory suffix from FILENAME"
292#endif
293#endif
294DO_COMMA
295#endif
296 146
297#if defined BB_DMESG 147#define dmesg_trivial_usage \
298#if defined USAGE_ENUM
299dmesg_usage_index
300#elif defined USAGE_MESSAGES
301 "[-c] [-n LEVEL] [-s SIZE]" 148 "[-c] [-n LEVEL] [-s SIZE]"
302#ifndef BB_FEATURE_TRIVIAL_HELP 149#define dmesg_full_usage \
303 "\n\nPrints or controls the kernel ring buffer\n\n" 150 "Prints or controls the kernel ring buffer\n\n" \
304 "Options:\n" 151 "Options:\n" \
305 "\t-c\t\tClears the ring buffer's contents after printing\n" 152 "\t-c\t\tClears the ring buffer's contents after printing\n" \
306 "\t-n LEVEL\tSets console logging level\n" 153 "\t-n LEVEL\tSets console logging level\n" \
307 "\t-s SIZE\t\tUse a buffer of size SIZE" 154 "\t-s SIZE\t\tUse a buffer of size SIZE"
308#endif
309#endif
310DO_COMMA
311#endif
312 155
313#if defined BB_DOS2UNIX 156#define dos2unix_trivial_usage \
314#if defined USAGE_ENUM
315dos2unix_usage_index
316#elif defined USAGE_MESSAGES
317 "< dosfile > unixfile" 157 "< dosfile > unixfile"
318#ifndef BB_FEATURE_TRIVIAL_HELP 158#define dos2unix_full_usage \
319 "\n\nConverts a text file from dos format to unix format." 159 "Converts a text file from dos format to unix format."
320#endif
321#endif
322DO_COMMA
323#endif
324 160
325#if defined BB_DPKG 161#define dpkg_trivial_usage \
326#if defined USAGE_ENUM 162 "[-i|-r|--unpack|--configure] my.deb"
327dpkg_usage_index 163#define dpkg_full_usage \
328#elif defined USAGE_MESSAGES
329 "<-i|-r|--unpack|--configure> my.deb\n"
330 "WORK IN PROGRESS, only usefull for debian-installer" 164 "WORK IN PROGRESS, only usefull for debian-installer"
331#ifndef BB_FEATURE_TRIVIAL_HELP
332#endif
333#endif
334DO_COMMA
335#endif
336 165
337#if defined BB_DPKG_DEB 166#define dpkg_deb_trivial_usage \
338#if defined USAGE_ENUM
339dpkg_deb_usage_index
340#elif defined USAGE_MESSAGES
341 "[-cexX] file directory" 167 "[-cexX] file directory"
342#ifndef BB_FEATURE_TRIVIAL_HELP 168#define dpkg_deb_full_usage \
343 "\n\nPerform actions on debian packages (.debs)\n\n" 169 "Perform actions on debian packages (.debs)\n\n" \
344 "Options:\n" 170 "Options:\n" \
345 "\t-c\tList contents of filesystem tree (verbose)\n" 171 "\t-c\tList contents of filesystem tree (verbose)\n" \
346 "\t-l\tList contents of filesystem tree (.list format)\n" 172 "\t-l\tList contents of filesystem tree (.list format)\n" \
347 "\t-e\tExtract control files to directory\n" 173 "\t-e\tExtract control files to directory\n" \
348 "\t-x\tExctract packages filesystem tree to directory\n" 174 "\t-x\tExctract packages filesystem tree to directory\n" \
349 "\t-X\tVerbose extract" 175 "\t-X\tVerbose extract"
350#endif
351#endif
352DO_COMMA
353#endif
354 176
355#if defined BB_DU 177#define du_trivial_usage \
356#if defined USAGE_ENUM 178 "[-ls" USAGE_HUMAN_READABLE("hm", "") "k] [FILE]..."
357du_usage_index 179#define du_full_usage \
358#elif defined USAGE_MESSAGES 180 "Summarizes disk space used for each FILE and/or directory.\n" \
359 "[-ls" 181 "Disk space is printed in units of 1024 bytes.\n\n" \
360#ifdef BB_FEATURE_HUMAN_READABLE 182 "Options:\n" \
361 "hm" 183 "\t-l\tcount sizes many times if hard linked\n" \
362#endif 184 "\t-s\tdisplay only a total for each argument" \
363 "k] [FILE]..." 185USAGE_HUMAN_READABLE( \
364#ifndef BB_FEATURE_TRIVIAL_HELP 186 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
365 "\n\nSummarizes disk space used for each FILE and/or directory.\n" 187 "\t-m\tprint sizes in megabytes\n" \
366 "Disk space is printed in units of 1024 bytes.\n\n" 188 "\t-k\tprint sizes in kilobytes(default)" \
367 "Options:\n" 189 , \
368 "\t-l\tcount sizes many times if hard linked\n" 190 "\n\t-k\tprint sizes in kilobytes(compatability)" \
369 "\t-s\tdisplay only a total for each argument" 191 )
370#ifdef BB_FEATURE_HUMAN_READABLE 192
371 "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G)\n" 193#define dumpkmap_trivial_usage \
372 "\t-m\tprint sizes in megabytes\n"
373 "\t-k\tprint sizes in kilobytes(default)"
374#else
375 "\n\t-k\tprint sizes in kilobytes(compatability)"
376#endif
377#endif
378#endif
379DO_COMMA
380#endif
381
382#if defined BB_DUMPKMAP
383#if defined USAGE_ENUM
384dumpkmap_usage_index
385#elif defined USAGE_MESSAGES
386 "> keymap" 194 "> keymap"
387#ifndef BB_FEATURE_TRIVIAL_HELP 195#define dumpkmap_full_usage \
388 "\n\nPrints out a binary keyboard translation table to standard output" 196 "Prints out a binary keyboard translation table to standard output."
389#endif
390#endif
391DO_COMMA
392#endif
393 197
394#if defined BB_DUTMP 198#define dutmp_trivial_usage \
395#if defined USAGE_ENUM
396dutmp_usage_index
397#elif defined USAGE_MESSAGES
398 "[FILE]" 199 "[FILE]"
399#ifndef BB_FEATURE_TRIVIAL_HELP 200#define dutmp_full_usage \
400 "\n\nDump utmp file format (pipe delimited) from FILE\n" 201 "Dump utmp file format (pipe delimited) from FILE\n" \
401 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')" 202 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')"
402#endif
403#endif
404DO_COMMA
405#endif
406 203
407#if defined BB_ECHO 204#define echo_trivial_usage \
408#if defined USAGE_ENUM
409echo_usage_index
410#elif defined USAGE_MESSAGES
411 "[-neE] [ARG ...]" 205 "[-neE] [ARG ...]"
412#ifndef BB_FEATURE_TRIVIAL_HELP 206#define echo_full_usage \
413 "\n\nPrints the specified ARGs to stdout\n\n" 207 "Prints the specified ARGs to stdout\n\n" \
414 "Options:\n" 208 "Options:\n" \
415 "\t-n\tsuppress trailing newline\n" 209 "\t-n\tsuppress trailing newline\n" \
416 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" 210 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" \
417 "\t-E\tdisable interpretation of backslash-escaped characters" 211 "\t-E\tdisable interpretation of backslash-escaped characters"
418#endif
419#endif
420DO_COMMA
421#endif
422 212
423#if defined BB_EXPR 213#define expr_trivial_usage \
424#if defined USAGE_ENUM
425expr_usage_index
426#elif defined USAGE_MESSAGES
427 "EXPRESSION" 214 "EXPRESSION"
428#ifndef BB_FEATURE_TRIVIAL_HELP 215#define expr_full_usage \
429"\n\nPrints the value of EXPRESSION to standard output.\n\n" 216 "Prints the value of EXPRESSION to standard output.\n\n" \
430"EXPRESSION may be:\n" 217 "EXPRESSION may be:\n" \
431"ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n" 218 "ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n" \
432"ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n" 219 "ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n" \
433"ARG1 < ARG2 ARG1 is less than ARG2\n" 220 "ARG1 < ARG2 ARG1 is less than ARG2\n" \
434"ARG1 <= ARG2 ARG1 is less than or equal to ARG2\n" 221 "ARG1 <= ARG2 ARG1 is less than or equal to ARG2\n" \
435"ARG1 = ARG2 ARG1 is equal to ARG2\n" 222 "ARG1 = ARG2 ARG1 is equal to ARG2\n" \
436"ARG1 != ARG2 ARG1 is unequal to ARG2\n" 223 "ARG1 != ARG2 ARG1 is unequal to ARG2\n" \
437"ARG1 >= ARG2 ARG1 is greater than or equal to ARG2\n" 224 "ARG1 >= ARG2 ARG1 is greater than or equal to ARG2\n" \
438"ARG1 > ARG2 ARG1 is greater than ARG2\n" 225 "ARG1 > ARG2 ARG1 is greater than ARG2\n" \
439"ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n" 226 "ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n" \
440"ARG1 - ARG2 arithmetic difference of ARG1 and ARG2\n" 227 "ARG1 - ARG2 arithmetic difference of ARG1 and ARG2\n" \
441"ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n" 228 "ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n" \
442"ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2\n" 229 "ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2\n" \
443"ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2\n" 230 "ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2\n" \
444"STRING : REGEXP anchored pattern match of REGEXP in STRING\n" 231 "STRING : REGEXP anchored pattern match of REGEXP in STRING\n" \
445"match STRING REGEXP same as STRING : REGEXP\n" 232 "match STRING REGEXP same as STRING : REGEXP\n" \
446"substr STRING POS LENGTH substring of STRING, POS counted from 1\n" 233 "substr STRING POS LENGTH substring of STRING, POS counted from 1\n" \
447"index STRING CHARS index in STRING where any CHARS is found, or 0\n" 234 "index STRING CHARS index in STRING where any CHARS is found, or 0\n" \
448"length STRING length of STRING\n" 235 "length STRING length of STRING\n" \
449"quote TOKEN interpret TOKEN as a string, even if it is a \n" 236 "quote TOKEN interpret TOKEN as a string, even if it is a \n" \
450" keyword like `match' or an operator like `/'\n" 237 " keyword like `match' or an operator like `/'\n" \
451"( EXPRESSION ) value of EXPRESSION\n\n" 238 "( EXPRESSION ) value of EXPRESSION\n\n" \
452"Beware that many operators need to be escaped or quoted for shells.\n" 239 "Beware that many operators need to be escaped or quoted for shells.\n" \
453"Comparisons are arithmetic if both ARGs are numbers, else\n" 240 "Comparisons are arithmetic if both ARGs are numbers, else\n" \
454"lexicographical. Pattern matches return the string matched between \n" 241 "lexicographical. Pattern matches return the string matched between \n" \
455"\\( and \\) or null; if \\( and \\) are not used, they return the number \n" 242 "\\( and \\) or null; if \\( and \\) are not used, they return the number \n" \
456"of characters matched or 0." 243 "of characters matched or 0."
457 244
458#endif 245#define false_trivial_usage \
459#endif
460DO_COMMA
461#endif
462
463
464#if defined BB_TRUE_FALSE
465#if defined USAGE_ENUM
466false_usage_index
467#elif defined USAGE_MESSAGES
468 "" 246 ""
469#ifndef BB_FEATURE_TRIVIAL_HELP 247#define false_full_usage \
470 "\n\nReturn an exit code of FALSE (1)." 248 "Return an exit code of FALSE (1)."
471#endif
472#endif
473DO_COMMA
474#endif
475 249
476#if defined BB_FBSET 250#define fdflush_trivial_usage \
477#if defined USAGE_ENUM
478fbset_usage_index
479#elif defined USAGE_MESSAGES
480 "fbset [options] [mode]"
481#ifndef BB_FEATURE_TRIVIAL_HELP
482 "\n\nShows and modifies frame buffer device settings"
483#endif
484#endif
485DO_COMMA
486#endif
487
488#if defined BB_FDFLUSH
489#if defined USAGE_ENUM
490fdflush_usage_index
491#elif defined USAGE_MESSAGES
492 "DEVICE" 251 "DEVICE"
493#ifndef BB_FEATURE_TRIVIAL_HELP 252#define fdflush_full_usage \
494 "\n\nForces floppy disk drive to detect disk change" 253 "Forces floppy disk drive to detect disk change"
495#endif
496#endif
497DO_COMMA
498#endif
499 254
500#if defined BB_FIND
501#if defined USAGE_ENUM
502find_usage_index
503#elif defined USAGE_MESSAGES
504 "[PATH...] [EXPRESSION]"
505#ifndef BB_FEATURE_TRIVIAL_HELP
506 "\n\nSearch for files in a directory hierarchy. The default PATH is\n"
507 "the current directory; default EXPRESSION is '-print'\n\n"
508 "\nEXPRESSION may consist of:\n"
509 "\t-follow\t\tDereference symbolic links.\n"
510 "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN."
511#ifdef BB_FEATURE_FIND_TYPE 255#ifdef BB_FEATURE_FIND_TYPE
512 "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" 256 #define USAGE_FIND_TYPE(a) a
257#else
258 #define USAGE_FIND_TYPE(a)
513#endif 259#endif
514#ifdef BB_FEATURE_FIND_PERM 260#ifdef BB_FEATURE_FIND_PERM
515 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" 261 #define USAGE_FIND_PERM(a) a
262#else
263 #define USAGE_FIND_PERM(a)
516#endif 264#endif
517#ifdef BB_FEATURE_FIND_MTIME 265#ifdef BB_FEATURE_FIND_MTIME
518 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days" 266 #define USAGE_FIND_MTIME(a) a
519#endif 267#else
520#endif 268 #define USAGE_FIND_MTIME(a)
521#endif
522DO_COMMA
523#endif 269#endif
524 270
525#if defined BB_FREE 271#define find_trivial_usage \
526#if defined USAGE_ENUM 272 "[PATH...] [EXPRESSION]"
527free_usage_index 273#define find_full_usage \
528#elif defined USAGE_MESSAGES 274 "Search for files in a directory hierarchy. The default PATH is\n" \
275 "the current directory; default EXPRESSION is '-print'\n\n" \
276 "\nEXPRESSION may consist of:\n" \
277 "\t-follow\t\tDereference symbolic links.\n" \
278 "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN." \
279USAGE_FIND_TYPE( \
280 "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" \
281) USAGE_FIND_PERM( \
282 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \
283) USAGE_FIND_MTIME( \
284 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days")
285
286#define free_trivial_usage \
529 "" 287 ""
530#ifndef BB_FEATURE_TRIVIAL_HELP 288#define free_full_usage \
531 "\n\nDisplays the amount of free and used system memory" 289 "Displays the amount of free and used system memory"
532#endif
533#endif
534DO_COMMA
535#endif
536 290
537#if defined BB_FREERAMDISK 291#define freeramdisk_trivial_usage \
538#if defined USAGE_ENUM
539freeramdisk_usage_index
540#elif defined USAGE_MESSAGES
541 "DEVICE" 292 "DEVICE"
542#ifndef BB_FEATURE_TRIVIAL_HELP 293#define freeramdisk_full_usage \
543 "\n\nFrees all memory used by the specified ramdisk." 294 "Frees all memory used by the specified ramdisk."
544#endif
545#endif
546DO_COMMA
547#endif
548 295
549#if defined BB_FSCK_MINIX 296#define fsck_minix_trivial_usage \
550#if defined USAGE_ENUM
551fsck_minix_usage_index
552#elif defined USAGE_MESSAGES
553 "[-larvsmf] /dev/name" 297 "[-larvsmf] /dev/name"
554#ifndef BB_FEATURE_TRIVIAL_HELP 298#define fsck_minix_full_usage \
555 "\n\nPerforms a consistency check for MINIX filesystems.\n\n" 299 "Performs a consistency check for MINIX filesystems.\n\n" \
556 "Options:\n" 300 "Options:\n" \
557 "\t-l\tLists all filenames\n" 301 "\t-l\tLists all filenames\n" \
558 "\t-r\tPerform interactive repairs\n" 302 "\t-r\tPerform interactive repairs\n" \
559 "\t-a\tPerform automatic repairs\n" 303 "\t-a\tPerform automatic repairs\n" \
560 "\t-v\tverbose\n" 304 "\t-v\tverbose\n" \
561 "\t-s\tOutputs super-block information\n" 305 "\t-s\tOutputs super-block information\n" \
562 "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n" 306 "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n" \
563 "\t-f\tForce file system check." 307 "\t-f\tForce file system check."
564#endif
565#endif
566DO_COMMA
567#endif
568 308
569#if defined BB_GETOPT 309#define getopt_trivial_usage \
570#if defined USAGE_ENUM
571getopt_usage_index
572#elif defined USAGE_MESSAGES
573 "[OPTIONS]..." 310 "[OPTIONS]..."
574#ifndef BB_FEATURE_TRIVIAL_HELP 311#define getopt_full_usage \
575 "\nParse command options\n" 312 "\nParse command options\n" \
576 " -a, --alternative Allow long options starting with single -\n" 313 "\t-a, --alternative Allow long options starting with single -\n" \
577 " -l, --longoptions=longopts Long options to be recognized\n" 314 "\t-l, --longoptions=longopts Long options to be recognized\n" \
578 " -n, --name=progname The name under which errors are reported\n" 315 "\t-n, --name=progname The name under which errors are reported\n" \
579 " -o, --options=optstring Short options to be recognized\n" 316 "\t-o, --options=optstring Short options to be recognized\n" \
580 " -q, --quiet Disable error reporting by getopt(3)\n" 317 "\t-q, --quiet Disable error reporting by getopt(3)\n" \
581 " -Q, --quiet-output No normal output\n" 318 "\t-Q, --quiet-output No normal output\n" \
582 " -s, --shell=shell Set shell quoting conventions\n" 319 "\t-s, --shell=shell Set shell quoting conventions\n" \
583 " -T, --test Test for getopt(1) version\n" 320 "\t-T, --test Test for getopt(1) version\n" \
584 " -u, --unqote Do not quote the output" 321 "\t-u, --unqote Do not quote the output"
585#endif 322
586#endif 323#define grep_trivial_usage \
587DO_COMMA
588#endif
589
590#if defined BB_GREP
591#if defined USAGE_ENUM
592grep_usage_index
593#elif defined USAGE_MESSAGES
594 "[-ihHnqvs] pattern [files...]" 324 "[-ihHnqvs] pattern [files...]"
595#ifndef BB_FEATURE_TRIVIAL_HELP 325#define grep_full_usage \
596 "\n\nSearch for PATTERN in each FILE or standard input.\n\n" 326 "Search for PATTERN in each FILE or standard input.\n\n" \
597 "Options:\n" 327 "Options:\n" \
598 "\t-H\tprefix output lines with filename where match was found\n" 328 "\t-H\tprefix output lines with filename where match was found\n" \
599 "\t-h\tsuppress the prefixing filename on output\n" 329 "\t-h\tsuppress the prefixing filename on output\n" \
600 "\t-i\tignore case distinctions\n" 330 "\t-i\tignore case distinctions\n" \
601 "\t-n\tprint line number with output lines\n" 331 "\t-n\tprint line number with output lines\n" \
602 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" 332 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" \
603 "\t-v\tselect non-matching lines\n" 333 "\t-v\tselect non-matching lines\n" \
604 "\t-s\tsuppress file open/read error messages" 334 "\t-s\tsuppress file open/read error messages"
605#endif
606#endif
607DO_COMMA
608#endif
609 335
610#if defined BB_GUNZIP 336#define gunzip_trivial_usage \
611#if defined USAGE_ENUM
612gunzip_usage_index
613#elif defined USAGE_MESSAGES
614 "[OPTION]... FILE" 337 "[OPTION]... FILE"
615#ifndef BB_FEATURE_TRIVIAL_HELP 338#define gunzip_full_usage \
616 "\n\nUncompress FILE (or standard input if FILE is '-').\n\n" 339 "Uncompress FILE (or standard input if FILE is '-').\n\n" \
617 "Options:\n" 340 "Options:\n" \
618 "\t-c\tWrite output to standard output\n" 341 "\t-c\tWrite output to standard output\n" \
619 "\t-t\tTest compressed file integrity" 342 "\t-t\tTest compressed file integrity"
620#endif
621#endif
622DO_COMMA
623#endif
624 343
625#if defined BB_GZIP 344#define gzip_trivial_usage \
626#if defined USAGE_ENUM
627gzip_usage_index
628#elif defined USAGE_MESSAGES
629 "[OPTION]... FILE" 345 "[OPTION]... FILE"
630#ifndef BB_FEATURE_TRIVIAL_HELP 346#define gzip_full_usage \
631 "\n\nCompress FILE with maximum compression.\n" 347 "Compress FILE with maximum compression.\n" \
632 "When FILE is '-', reads standard input. Implies -c.\n\n" 348 "When FILE is '-', reads standard input. Implies -c.\n\n" \
633 "Options:\n" 349 "Options:\n" \
634 "\t-c\tWrite output to standard output instead of FILE.gz\n" 350 "\t-c\tWrite output to standard output instead of FILE.gz\n" \
635 "\t-d\tdecompress" 351 "\t-d\tdecompress"
636#endif
637#endif
638DO_COMMA
639#endif
640 352
641#if defined BB_HALT 353#define halt_trivial_usage \
642#if defined USAGE_ENUM
643halt_usage_index
644#elif defined USAGE_MESSAGES
645 "" 354 ""
646#ifndef BB_FEATURE_TRIVIAL_HELP 355#define halt_full_usage \
647 "\n\nHalt the system." 356 "Halt the system."
648#endif
649#endif
650DO_COMMA
651#endif
652 357
653#if defined BB_HEAD 358#define head_trivial_usage \
654#if defined USAGE_ENUM
655head_usage_index
656#elif defined USAGE_MESSAGES
657 "[OPTION] [FILE]..." 359 "[OPTION] [FILE]..."
658#ifndef BB_FEATURE_TRIVIAL_HELP 360#define head_full_usage \
659 "\n\nPrint first 10 lines of each FILE to standard output.\n" 361 "Print first 10 lines of each FILE to standard output.\n" \
660 "With more than one FILE, precede each with a header giving the\n" 362 "With more than one FILE, precede each with a header giving the\n" \
661 "file name. With no FILE, or when FILE is -, read standard input.\n\n" 363 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
662
663 "Options:\n" "\t-n NUM\t\tPrint first NUM lines instead of first 10" 364 "Options:\n" "\t-n NUM\t\tPrint first NUM lines instead of first 10"
664#endif
665#endif
666DO_COMMA
667#endif
668 365
669#if defined BB_HOSTID 366#define hostid_trivial_usage \
670#if defined USAGE_ENUM
671hostid_usage_index
672#elif defined USAGE_MESSAGES
673 "" 367 ""
674#ifndef BB_FEATURE_TRIVIAL_HELP 368#define hostid_full_usage \
675 "\n\nPrint out a unique 32-bit identifier for the machine." 369 "Print out a unique 32-bit identifier for the machine."
676#endif
677#endif
678DO_COMMA
679#endif
680 370
681#if defined BB_HOSTNAME 371#define hostname_trivial_usage \
682#if defined USAGE_ENUM
683hostname_usage_index
684#elif defined USAGE_MESSAGES
685 "[OPTION] {hostname | -F file}" 372 "[OPTION] {hostname | -F file}"
686#ifndef BB_FEATURE_TRIVIAL_HELP 373#define hostname_full_usage \
687 "\n\nGet or set the hostname or DNS domain name. If a hostname is given\n" 374 "Get or set the hostname or DNS domain name. If a hostname is given\n" \
688 "(or a file with the -F parameter), the host name will be set.\n\n" 375 "(or a file with the -F parameter), the host name will be set.\n\n" \
689 376 "Options:\n" \
690 "Options:\n" 377 "\t-s\t\tShort\n" \
691 "\t-s\t\tShort\n" 378 "\t-i\t\tAddresses for the hostname\n" \
692 "\t-i\t\tAddresses for the hostname\n" 379 "\t-d\t\tDNS domain name\n" \
693 "\t-d\t\tDNS domain name\n"
694 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname" 380 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname"
695#endif
696#endif
697DO_COMMA
698#endif
699 381
700#if defined BB_ID 382#define id_trivial_usage \
701#if defined USAGE_ENUM
702id_usage_index
703#elif defined USAGE_MESSAGES
704 "[OPTIONS]... [USERNAME]" 383 "[OPTIONS]... [USERNAME]"
705#ifndef BB_FEATURE_TRIVIAL_HELP 384#define id_full_usage \
706 "\n\nPrint information for USERNAME or the current user\n\n" 385 "Print information for USERNAME or the current user\n\n" \
707 "Options:\n" 386 "Options:\n" \
708 "\t-g\tprints only the group ID\n" 387 "\t-g\tprints only the group ID\n" \
709 "\t-u\tprints only the user ID\n" 388 "\t-u\tprints only the user ID\n" \
710 "\t-n\tprint a name instead of a number (with for -ug)\n" 389 "\t-n\tprint a name instead of a number (with for -ug)\n" \
711 "\t-r\tprints the real user ID instead of the effective ID (with -ug)" 390 "\t-r\tprints the real user ID instead of the effective ID (with -ug)"
712#endif
713#endif
714DO_COMMA
715#endif
716 391
717#if defined BB_IFCONFIG
718#if defined USAGE_ENUM
719ifconfig_usage_index
720#elif defined USAGE_MESSAGES
721 "[-a] [-i] [-v] <interface> [<address>]"
722#ifndef BB_FEATURE_TRIVIAL_HELP
723 "\n\nconfigure a network interface\n\n"
724 "Options:\n"
725 " [[-]broadcast [<address>]] [[-]pointopoint [<address>]]\n"
726 " [netmask <address>] [dstaddr <address>] [tunnel <adress>]\n"
727#ifdef SIOCSKEEPALIVE 392#ifdef SIOCSKEEPALIVE
728 " [outfill <NN>] [keepalive <NN>]\n" 393 #define USAGE_SIOCSKEEPALIVE(a) a
729#endif 394#else
730 " [hw ether <address>] [metric <NN>] [mtu <NN>]\n" 395 #define USAGE_SIOCSKEEPALIVE(a)
731 " [[-]trailers] [[-]arp] [[-]allmulti]\n"
732 " [multicast] [[-]promisc]\n"
733 " [mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]\n"
734 " [up|down] ..."
735#endif
736#endif
737DO_COMMA
738#endif 396#endif
739 397#define ifconfig_trivial_usage \
740#if defined BB_INIT 398 "[-a] [-i] [-v] <interface> [<address>]"
741#if defined USAGE_ENUM 399#define ifconfig_full_usage \
742init_usage_index 400 "configure a network interface\n\n" \
743#elif defined USAGE_MESSAGES 401 "Options:\n" \
402 "\t[[-]broadcast [<address>]] [[-]pointopoint [<address>]]\n" \
403 "\t[netmask <address>] [dstaddr <address>] [tunnel <adress>]\n" \
404USAGE_SIOCSKEEPALIVE("\t[outfill <NN>] [keepalive <NN>]\n") \
405 "\t[hw ether <address>] [metric <NN>] [mtu <NN>]\n" \
406 "\t[[-]trailers] [[-]arp] [[-]allmulti]\n" \
407 "\t[multicast] [[-]promisc]\n" \
408 "\t[mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]\n" \
409 "\t[up|down] ..."
410
411#define init_trivial_usage \
744 "" 412 ""
745#ifndef BB_FEATURE_TRIVIAL_HELP 413#define init_full_usage \
746 "\n\nInit is the parent of all processes.\n\n" 414 "Init is the parent of all processes.\n\n" \
747 "This version of init is designed to be run only by the kernel." 415 "This version of init is designed to be run only by the kernel."
748#endif
749#endif
750DO_COMMA
751#endif
752 416
753#if defined BB_INSMOD 417#define insmod_trivial_usage \
754#if defined USAGE_ENUM
755insmod_usage_index
756#elif defined USAGE_MESSAGES
757 "[OPTION]... MODULE [symbol=value]..." 418 "[OPTION]... MODULE [symbol=value]..."
758#ifndef BB_FEATURE_TRIVIAL_HELP 419#define insmod_full_usage \
759 "\n\nLoads the specified kernel modules into the kernel.\n\n" 420 "Loads the specified kernel modules into the kernel.\n\n" \
760 "Options:\n" 421 "Options:\n" \
761 "\t-f\tForce module to load into the wrong kernel version.\n" 422 "\t-f\tForce module to load into the wrong kernel version.\n" \
762 "\t-k\tMake module autoclean-able.\n" 423 "\t-k\tMake module autoclean-able.\n" \
763 "\t-v\tverbose output\n" 424 "\t-v\tverbose output\n" \
764 "\t-L\tLock to prevent simultaneous loads of a module\n" 425 "\t-L\tLock to prevent simultaneous loads of a module\n" \
765 "\t-x\tdo not export externs" 426 "\t-x\tdo not export externs"
766#endif
767#endif
768DO_COMMA
769#endif
770 427
771#if defined BB_KILL 428#define kill_trivial_usage \
772#if defined USAGE_ENUM
773kill_usage_index
774#elif defined USAGE_MESSAGES
775 "[-signal] process-id [process-id ...]" 429 "[-signal] process-id [process-id ...]"
776#ifndef BB_FEATURE_TRIVIAL_HELP 430#define kill_full_usage \
777 "\n\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" 431 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
778 "Options:\n" "\t-l\tList all signal names and numbers." 432 "Options:\n" "\t-l\tList all signal names and numbers."
779#endif
780#endif
781DO_COMMA
782#endif
783 433
784#if defined BB_KILLALL 434#define killall_trivial_usage \
785#if defined USAGE_ENUM
786killall_usage_index
787#elif defined USAGE_MESSAGES
788 "[-signal] process-name [process-name ...]" 435 "[-signal] process-name [process-name ...]"
789#ifndef BB_FEATURE_TRIVIAL_HELP 436#define killall_full_usage \
790 "\n\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" 437 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
791 "Options:\n" "\t-l\tList all signal names and numbers." 438 "Options:\n" "\t-l\tList all signal names and numbers."
792#endif
793#endif
794DO_COMMA
795#endif
796 439
797#if defined BB_LENGTH 440#define length_trivial_usage \
798#if defined USAGE_ENUM
799length_usage_index
800#elif defined USAGE_MESSAGES
801 "STRING" 441 "STRING"
802#ifndef BB_FEATURE_TRIVIAL_HELP 442#define length_full_usage \
803 "\n\nPrints out the length of the specified STRING." 443 "Prints out the length of the specified STRING."
804#endif
805#endif
806DO_COMMA
807#endif
808 444
809#if defined BB_LN 445#define ln_trivial_usage \
810#if defined USAGE_ENUM
811ln_usage_index
812#elif defined USAGE_MESSAGES
813 "[OPTION] TARGET... LINK_NAME|DIRECTORY" 446 "[OPTION] TARGET... LINK_NAME|DIRECTORY"
814#ifndef BB_FEATURE_TRIVIAL_HELP 447#define ln_full_usage \
815 "\n\nCreate a link named LINK_NAME or DIRECTORY to the specified TARGET\n" 448 "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n"\
816 "\nYou may use '--' to indicate that all following arguments are non-options.\n\n" 449 "\nYou may use '--' to indicate that all following arguments are non-options.\n\n" \
817 "Options:\n" 450 "Options:\n" \
818 "\t-s\tmake symbolic links instead of hard links\n" 451 "\t-s\tmake symbolic links instead of hard links\n" \
819 "\t-f\tremove existing destination files\n" 452 "\t-f\tremove existing destination files\n" \
820 "\t-n\tno dereference symlinks - treat like normal file" 453 "\t-n\tno dereference symlinks - treat like normal file"
821#endif
822#endif
823DO_COMMA
824#endif
825 454
826#if defined BB_LOADACM 455#define loadacm_trivial_usage \
827#if defined USAGE_ENUM
828loadacm_usage_index
829#elif defined USAGE_MESSAGES
830 "< mapfile" 456 "< mapfile"
831#ifndef BB_FEATURE_TRIVIAL_HELP 457#define loadacm_full_usage \
832 "\n\nLoads an acm from standard input." 458 "Loads an acm from standard input."
833#endif
834#endif
835DO_COMMA
836#endif
837 459
838#if defined BB_LOADFONT 460#define loadfont_trivial_usage \
839#if defined USAGE_ENUM
840loadfont_usage_index
841#elif defined USAGE_MESSAGES
842 "< font" 461 "< font"
843#ifndef BB_FEATURE_TRIVIAL_HELP 462#define loadfont_full_usage \
844 "\n\nLoads a console font from standard input." 463 "Loads a console font from standard input."
845#endif
846#endif
847DO_COMMA
848#endif
849 464
850#if defined BB_LOADKMAP 465#define loadkmap_trivial_usage \
851#if defined USAGE_ENUM
852loadkmap_usage_index
853#elif defined USAGE_MESSAGES
854 "< keymap" 466 "< keymap"
855#ifndef BB_FEATURE_TRIVIAL_HELP 467#define loadkmap_full_usage \
856 "\n\nLoads a binary keyboard translation table from standard input." 468 "Loads a binary keyboard translation table from standard input."
857#endif
858#endif
859DO_COMMA
860#endif
861 469
862#if defined BB_LOGGER 470#define logger_trivial_usage \
863#if defined USAGE_ENUM
864logger_usage_index
865#elif defined USAGE_MESSAGES
866 "[OPTION]... [MESSAGE]" 471 "[OPTION]... [MESSAGE]"
867#ifndef BB_FEATURE_TRIVIAL_HELP 472#define logger_full_usage \
868 "\n\nWrite MESSAGE to the system log. If MESSAGE is omitted, log stdin.\n\n" 473 "Write MESSAGE to the system log. If MESSAGE is omitted, log stdin.\n\n" \
869 "Options:\n" 474 "Options:\n" \
870 "\t-s\tLog to stderr as well as the system log.\n" 475 "\t-s\tLog to stderr as well as the system log.\n" \
871 "\t-t\tLog using the specified tag (defaults to user name).\n" 476 "\t-t\tLog using the specified tag (defaults to user name).\n" \
872 "\t-p\tEnter the message with the specified priority.\n" 477 "\t-p\tEnter the message with the specified priority.\n" \
873 "\t\tThis may be numerical or a ``facility.level'' pair." 478 "\t\tThis may be numerical or a ``facility.level'' pair."
874#endif
875#endif
876DO_COMMA
877#endif
878 479
879#if defined BB_LOGNAME 480#define logname_trivial_usage \
880#if defined USAGE_ENUM
881logname_usage_index
882#elif defined USAGE_MESSAGES
883 "" 481 ""
884#ifndef BB_FEATURE_TRIVIAL_HELP 482#define logname_full_usage \
885 "\n\nPrint the name of the current user." 483 "Print the name of the current user."
886#endif
887#endif
888DO_COMMA
889#endif
890 484
891#if defined BB_LS
892#if defined USAGE_ENUM
893ls_usage_index
894#elif defined USAGE_MESSAGES
895 "[-1Aa"
896#ifdef BB_FEATURE_LS_TIMESTAMPS
897 "c"
898#endif
899 "Cd"
900#ifdef BB_FEATURE_LS_TIMESTAMPS 485#ifdef BB_FEATURE_LS_TIMESTAMPS
901 "e" 486 #define USAGE_LS_TIMESTAMPS(a) a
902#endif 487#else
903#ifdef BB_FEATURE_LS_FILETYPES 488 #define USAGE_LS_TIMESTAMPS(a)
904 "F"
905#endif
906 "iln"
907#ifdef BB_FEATURE_LS_FILETYPES
908 "p"
909#endif
910#ifdef BB_FEATURE_LS_FOLLOWLINKS
911 "L"
912#endif
913#ifdef BB_FEATURE_LS_RECURSIVE
914 "R"
915#endif
916#ifdef BB_FEATURE_LS_SORTFILES
917 "rS"
918#endif
919 "s"
920#ifdef BB_FEATURE_AUTOWIDTH
921 "T"
922#endif
923#ifdef BB_FEATURE_LS_TIMESTAMPS
924 "tu"
925#endif
926#ifdef BB_FEATURE_LS_SORTFILES
927 "v"
928#endif
929#ifdef BB_FEATURE_AUTOWIDTH
930 "w"
931#endif
932 "x"
933#ifdef BB_FEATURE_LS_SORTFILES
934 "X"
935#endif
936#ifdef BB_FEATURE_HUMAN_READABLE
937 "h"
938#endif
939 "k] [filenames...]"
940#ifndef BB_FEATURE_TRIVIAL_HELP
941 "\n\nList directory contents\n\n"
942 "Options:\n"
943 "\t-1\tlist files in a single column\n"
944 "\t-A\tdo not list implied . and ..\n"
945 "\t-a\tdo not hide entries starting with .\n"
946 "\t-C\tlist entries by columns\n"
947#ifdef BB_FEATURE_LS_TIMESTAMPS
948 "\t-c\twith -l: show ctime (the time of last\n"
949 "\t\tmodification of file status information)\n"
950#endif
951 "\t-d\tlist directory entries instead of contents\n"
952#ifdef BB_FEATURE_LS_TIMESTAMPS
953 "\t-e\tlist both full date and full time\n"
954#endif
955#ifdef BB_FEATURE_LS_FILETYPES
956 "\t-F\tappend indicator (one of */=@|) to entries\n"
957#endif 489#endif
958 "\t-i\tlist the i-node for each file\n"
959 "\t-l\tuse a long listing format\n"
960 "\t-n\tlist numeric UIDs and GIDs instead of names\n"
961#ifdef BB_FEATURE_LS_FILETYPES 490#ifdef BB_FEATURE_LS_FILETYPES
962 "\t-p\tappend indicator (one of /=@|) to entries\n" 491 #define USAGE_LS_FILETYPES(a) a
492#else
493 #define USAGE_LS_FILETYPES(a)
963#endif 494#endif
964#ifdef BB_FEATURE_LS_FOLLOWLINKS 495#ifdef BB_FEATURE_LS_FOLLOWLINKS
965 "\t-L\tlist entries pointed to by symbolic links\n" 496 #define USAGE_LS_FOLLOWLINKS(a) a
497#else
498 #define USAGE_LS_FOLLOWLINKS(a)
966#endif 499#endif
967#ifdef BB_FEATURE_LS_RECURSIVE 500#ifdef BB_FEATURE_LS_RECURSIVE
968 "\t-R\tlist subdirectories recursively\n" 501 #define USAGE_LS_RECURSIVE(a) a
969#endif 502#else
970#ifdef BB_FEATURE_LS_SORTFILES 503 #define USAGE_LS_RECURSIVE(a)
971 "\t-r\tsort the listing in reverse order\n"
972 "\t-S\tsort the listing by file size\n"
973#endif
974 "\t-s\tlist the size of each file, in blocks\n"
975#ifdef BB_FEATURE_AUTOWIDTH
976 "\t-T NUM\tassume Tabstop every NUM columns\n"
977#endif
978#ifdef BB_FEATURE_LS_TIMESTAMPS
979 "\t-t\twith -l: show modification time (the time of last\n"
980 "\t\tchange of the file)\n"
981 "\t-u\twith -l: show access time (the time of last\n"
982 "\t\taccess of the file)\n"
983#endif 504#endif
984#ifdef BB_FEATURE_LS_SORTFILES 505#ifdef BB_FEATURE_LS_SORTFILES
985 "\t-v\tsort the listing by version\n" 506 #define USAGE_LS_SORTFILES(a) a
507#else
508 #define USAGE_LS_SORTFILES(a)
986#endif 509#endif
987#ifdef BB_FEATURE_AUTOWIDTH 510#ifdef BB_FEATURE_AUTOWIDTH
988 "\t-w NUM\tassume the terminal is NUM columns wide\n" 511 #define USAGE_AUTOWIDTH(a) a
989#endif
990 "\t-x\tlist entries by lines instead of by columns\n"
991#ifdef BB_FEATURE_LS_SORTFILES
992 "\t-X\tsort the listing by extension\n"
993#endif
994
995#ifdef BB_FEATURE_HUMAN_READABLE
996 "\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G)\n"
997 "\t-k\tprint sizes in kilobytes(default)"
998#else 512#else
999 "\t-k\tprint sizes in kilobytes(compatability)" 513 #define USAGE_AUTOWIDTH(a)
1000#endif 514#endif
1001 515#define ls_trivial_usage \
1002#endif /* BB_FEATURE_TRIVIAL_HELP */ 516 "[-1Aa" USAGE_LS_TIMESTAMPS("c") \
1003#endif 517 "Cd" USAGE_LS_TIMESTAMPS("e") USAGE_LS_FILETYPES("F") "iln" \
1004DO_COMMA 518 USAGE_LS_FILETYPES("p") USAGE_LS_FOLLOWLINKS("L") \
1005#endif /* BB_LS */ 519 USAGE_LS_RECURSIVE("R") USAGE_LS_SORTFILES("rS") \
1006 520 "s" USAGE_AUTOWIDTH("T") USAGE_LS_TIMESTAMPS("tu") \
1007#if defined BB_LSMOD 521 USAGE_LS_SORTFILES("v") USAGE_AUTOWIDTH("w") "x" \
1008#if defined USAGE_ENUM 522 USAGE_LS_SORTFILES("X") USAGE_HUMAN_READABLE("h", "") \
1009lsmod_usage_index 523 "k] [filenames...]"
1010#elif defined USAGE_MESSAGES 524#define ls_full_usage \
525 "List directory contents\n\n" \
526 "Options:\n" \
527 "\t-1\tlist files in a single column\n" \
528 "\t-A\tdo not list implied . and ..\n" \
529 "\t-a\tdo not hide entries starting with .\n" \
530 "\t-C\tlist entries by columns\n" \
531USAGE_LS_TIMESTAMPS( \
532 "\t-c\twith -l: show ctime (the time of last\n" \
533 "\t\tmodification of file status information)\n" \
534 ) \
535 "\t-d\tlist directory entries instead of contents\n" \
536USAGE_LS_TIMESTAMPS( \
537 "\t-e\tlist both full date and full time\n" \
538 ) \
539USAGE_LS_FILETYPES( \
540 "\t-F\tappend indicator (one of */=@|) to entries\n" \
541 ) \
542 "\t-i\tlist the i-node for each file\n" \
543 "\t-l\tuse a long listing format\n" \
544 "\t-n\tlist numeric UIDs and GIDs instead of names\n" \
545USAGE_LS_FILETYPES( \
546 "\t-p\tappend indicator (one of /=@|) to entries\n" \
547 ) \
548USAGE_LS_FOLLOWLINKS( \
549 "\t-L\tlist entries pointed to by symbolic links\n" \
550 ) \
551USAGE_LS_RECURSIVE( \
552 "\t-R\tlist subdirectories recursively\n" \
553 ) \
554USAGE_LS_SORTFILES( \
555 "\t-r\tsort the listing in reverse order\n" \
556 "\t-S\tsort the listing by file size\n" \
557 ) \
558 "\t-s\tlist the size of each file, in blocks\n" \
559USAGE_AUTOWIDTH( \
560 "\t-T NUM\tassume Tabstop every NUM columns\n" \
561 ) \
562USAGE_LS_TIMESTAMPS( \
563 "\t-t\twith -l: show modification time (the time of last\n" \
564 "\t\tchange of the file)\n" \
565 "\t-u\twith -l: show access time (the time of last\n" \
566 "\t\taccess of the file)\n" \
567 ) \
568USAGE_LS_SORTFILES( \
569 "\t-v\tsort the listing by version\n" \
570 ) \
571USAGE_AUTOWIDTH( \
572 "\t-w NUM\tassume the terminal is NUM columns wide\n" \
573 ) \
574 "\t-x\tlist entries by lines instead of by columns\n" \
575USAGE_LS_SORTFILES( \
576 "\t-X\tsort the listing by extension\n" \
577 ) \
578USAGE_HUMAN_READABLE( \
579 "\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
580 "\t-k\tprint sizes in kilobytes(default)" \
581 , \
582 "\t-k\tprint sizes in kilobytes(compatability)" \
583 ) \
584
585#define lsmod_trivial_usage \
1011 "" 586 ""
1012#ifndef BB_FEATURE_TRIVIAL_HELP 587#define lsmod_full_usage \
1013 "\n\nList the currently loaded kernel modules." 588 "List the currently loaded kernel modules."
1014#endif
1015#endif
1016DO_COMMA
1017#endif
1018 589
1019#if defined BB_MAKEDEVS 590#define makedevs_trivial_usage \
1020#if defined USAGE_ENUM
1021makedevs_usage_index
1022#elif defined USAGE_MESSAGES
1023 "NAME TYPE MAJOR MINOR FIRST LAST [s]" 591 "NAME TYPE MAJOR MINOR FIRST LAST [s]"
1024#ifndef BB_FEATURE_TRIVIAL_HELP 592#define makedevs_full_usage \
1025 "\n\nCreates a range of block or character special files\n\n" 593 "Creates a range of block or character special files\n\n" \
1026 "TYPEs include:\n" 594 "TYPEs include:\n" \
1027 "\tb:\tMake a block (buffered) device.\n" 595 "\tb:\tMake a block (buffered) device.\n" \
1028 "\tc or u:\tMake a character (un-buffered) device.\n" 596 "\tc or u:\tMake a character (un-buffered) device.\n" \
1029 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n\n" 597 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n\n" \
1030 "FIRST specifies the number appended to NAME to create the first device.\n" 598 "FIRST specifies the number appended to NAME to create the first device.\n" \
1031 "LAST specifies the number of the last item that should be created.\n" 599 "LAST specifies the number of the last item that should be created.\n" \
1032 "If 's' is the last argument, the base device is created as well.\n\n" 600 "If 's' is the last argument, the base device is created as well.\n\n" \
1033 "For example:\n" 601 "For example:\n" \
1034 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" 602 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" \
1035 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8" 603 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8"
1036#endif
1037#endif
1038DO_COMMA
1039#endif
1040 604
1041#if defined BB_MD5SUM 605#define md5sum_trivial_usage \
1042#if defined USAGE_ENUM 606 "[OPTION] [FILE]...\nor: md5sum [OPTION] -c [FILE]"
1043md5sum_usage_index 607#define md5sum_full_usage \
1044#elif defined USAGE_MESSAGES 608 "Print or check MD5 checksums.\n\n" \
1045 "[OPTION] [FILE]...\n" 609 "Options:\n" \
1046 "or: md5sum [OPTION] -c [FILE]" 610 "With no FILE, or when FILE is -, read standard input.\n\n" \
1047#ifndef BB_FEATURE_TRIVIAL_HELP 611 "\t-b\tread files in binary mode\n" \
1048 "\n\nPrint or check MD5 checksums.\n\n" 612 "\t-c\tcheck MD5 sums against given list\n" \
1049 "Options:\n" 613 "\t-t\tread files in text mode (default)\n" \
1050 "With no FILE, or when FILE is -, read standard input.\n\n" 614 "\t-g\tread a string\n" \
1051 "\t-b\tread files in binary mode\n" 615 "\nThe following two options are useful only when verifying checksums:\n" \
1052 "\t-c\tcheck MD5 sums against given list\n" 616 "\t-s,\tdon't output anything, status code shows success\n" \
1053 "\t-t\tread files in text mode (default)\n"
1054 "\t-g\tread a string\n"
1055 "\nThe following two options are useful only when verifying checksums:\n"
1056 "\t-s,\tdon't output anything, status code shows success\n"
1057 "\t-w,\twarn about improperly formated MD5 checksum lines" 617 "\t-w,\twarn about improperly formated MD5 checksum lines"
1058#endif
1059#endif
1060DO_COMMA
1061#endif
1062 618
1063#if defined BB_MKDIR 619#define mkdir_trivial_usage \
1064#if defined USAGE_ENUM
1065mkdir_usage_index
1066#elif defined USAGE_MESSAGES
1067 "[OPTION] DIRECTORY..." 620 "[OPTION] DIRECTORY..."
1068#ifndef BB_FEATURE_TRIVIAL_HELP 621#define mkdir_full_usage \
1069 "\n\nCreate the DIRECTORY(ies), if they do not already exist\n\n" 622 "Create the DIRECTORY(ies), if they do not already exist\n\n" \
1070 623 "Options:\n" \
1071 "Options:\n" 624 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" \
1072 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n"
1073 "\t-p\tno error if existing, make parent directories as needed" 625 "\t-p\tno error if existing, make parent directories as needed"
1074#endif
1075#endif
1076DO_COMMA
1077#endif
1078 626
1079#if defined BB_MKFIFO 627#define mkfifo_trivial_usage \
1080#if defined USAGE_ENUM
1081mkfifo_usage_index
1082#elif defined USAGE_MESSAGES
1083 "[OPTIONS] name" 628 "[OPTIONS] name"
1084#ifndef BB_FEATURE_TRIVIAL_HELP 629#define mkfifo_full_usage \
1085 "\n\nCreates a named pipe (identical to 'mknod name p')\n\n" 630 "Creates a named pipe (identical to 'mknod name p')\n\n" \
1086 "Options:\n" 631 "Options:\n" \
1087 "\t-m\tcreate the pipe using the specified mode (default a=rw)" 632 "\t-m\tcreate the pipe using the specified mode (default a=rw)"
1088#endif
1089#endif
1090DO_COMMA
1091#endif
1092 633
1093#if defined BB_MKFS_MINIX 634#define mkfs_minix_trivial_usage \
1094#if defined USAGE_ENUM
1095mkfs_minix_usage_index
1096#elif defined USAGE_MESSAGES
1097 "[-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]" 635 "[-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]"
1098#ifndef BB_FEATURE_TRIVIAL_HELP 636#define mkfs_minix_full_usage \
1099 "\n\nMake a MINIX filesystem.\n\n" 637 "Make a MINIX filesystem.\n\n" \
1100 "Options:\n" 638 "Options:\n" \
1101 "\t-c\t\tCheck the device for bad blocks\n" 639 "\t-c\t\tCheck the device for bad blocks\n" \
1102 "\t-n [14|30]\tSpecify the maximum length of filenames\n" 640 "\t-n [14|30]\tSpecify the maximum length of filenames\n" \
1103 "\t-i INODES\tSpecify the number of inodes for the filesystem\n" 641 "\t-i INODES\tSpecify the number of inodes for the filesystem\n" \
1104 "\t-l FILENAME\tRead the bad blocks list from FILENAME\n" 642 "\t-l FILENAME\tRead the bad blocks list from FILENAME\n" \
1105 "\t-v\t\tMake a Minix version 2 filesystem" 643 "\t-v\t\tMake a Minix version 2 filesystem"
1106#endif
1107#endif
1108DO_COMMA
1109#endif
1110 644
1111#if defined BB_MKNOD 645#define mknod_trivial_usage \
1112#if defined USAGE_ENUM
1113mknod_usage_index
1114#elif defined USAGE_MESSAGES
1115 "[OPTIONS] NAME TYPE MAJOR MINOR" 646 "[OPTIONS] NAME TYPE MAJOR MINOR"
1116#ifndef BB_FEATURE_TRIVIAL_HELP 647#define mknod_full_usage \
1117 "\n\nCreate a special file (block, character, or pipe).\n\n" 648 "Create a special file (block, character, or pipe).\n\n" \
1118 "Options:\n" 649 "Options:\n" \
1119 "\t-m\tcreate the special file using the specified mode (default a=rw)\n\n" 650 "\t-m\tcreate the special file using the specified mode (default a=rw)\n\n" \
1120 "TYPEs include:\n" 651 "TYPEs include:\n" \
1121 "\tb:\tMake a block (buffered) device.\n" 652 "\tb:\tMake a block (buffered) device.\n" \
1122 "\tc or u:\tMake a character (un-buffered) device.\n" 653 "\tc or u:\tMake a character (un-buffered) device.\n" \
1123 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes." 654 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes."
1124#endif
1125#endif
1126DO_COMMA
1127#endif
1128 655
1129#if defined BB_MKSWAP 656#define mkswap_trivial_usage \
1130#if defined USAGE_ENUM
1131mkswap_usage_index
1132#elif defined USAGE_MESSAGES
1133 "[-c] [-v0|-v1] device [block-count]" 657 "[-c] [-v0|-v1] device [block-count]"
1134#ifndef BB_FEATURE_TRIVIAL_HELP 658#define mkswap_full_usage \
1135 "\n\nPrepare a disk partition to be used as a swap partition.\n\n" 659 "Prepare a disk partition to be used as a swap partition.\n\n" \
1136 "Options:\n" "\t-c\t\tCheck for read-ability.\n" 660 "Options:\n" "\t-c\t\tCheck for read-ability.\n" \
1137 "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" 661 "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" \
1138 "\t-v1\t\tMake version 1 swap [big!] (default for kernels >\n" 662 "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" \
1139 "\t\t\t2.1.117).\n"
1140 "\tblock-count\tNumber of block to use (default is entire partition)." 663 "\tblock-count\tNumber of block to use (default is entire partition)."
1141#endif
1142#endif
1143DO_COMMA
1144#endif
1145 664
1146#if defined BB_MKTEMP 665#define mktemp_trivial_usage \
1147#if defined USAGE_ENUM
1148mktemp_usage_index
1149#elif defined USAGE_MESSAGES
1150 "[-q] TEMPLATE" 666 "[-q] TEMPLATE"
1151#ifndef BB_FEATURE_TRIVIAL_HELP 667#define mktemp_full_usage \
1152 "\n\nCreates a temporary file with its name based on TEMPLATE.\n" 668 "Creates a temporary file with its name based on TEMPLATE.\n" \
1153 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)." 669 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)."
1154#endif
1155#endif
1156DO_COMMA
1157#endif
1158 670
1159#if defined BB_MORE 671#define more_trivial_usage \
1160#if defined USAGE_ENUM
1161more_usage_index
1162#elif defined USAGE_MESSAGES
1163 "[FILE ...]" 672 "[FILE ...]"
1164#ifndef BB_FEATURE_TRIVIAL_HELP 673#define more_full_usage \
1165 "\n\nMore is a filter for viewing FILE one screenful at a time." 674 "More is a filter for viewing FILE one screenful at a time."
1166#endif
1167#endif
1168DO_COMMA
1169#endif
1170 675
1171#if defined BB_MOUNT 676#ifdef BB_FEATURE_MOUNT_LOOP
1172#if defined USAGE_ENUM 677 #define USAGE_MOUNT_LOOP(a) a
1173mount_usage_index 678#else
1174#elif defined USAGE_MESSAGES 679 #define USAGE_MOUNT_LOOP(a)
1175 "[flags] device directory [-o options,more-options]"
1176#ifndef BB_FEATURE_TRIVIAL_HELP
1177 "\n\nMount a filesystem\n\n"
1178 "Flags:\n"
1179 "\t-a:\t\tMount all filesystems in fstab.\n"
1180#ifdef BB_MTAB
1181 "\t-f:\t\t\"Fake\" Add entry to mount table but don't mount it.\n"
1182 "\t-n:\t\tDon't write a mount table entry.\n"
1183#endif 680#endif
1184 "\t-o option:\tOne of many filesystem options, listed below.\n" 681#ifdef BB_MTAB
1185 "\t-r:\t\tMount the filesystem read-only.\n" 682 #define USAGE_MTAB(a) a
1186 "\t-t fs-type:\tSpecify the filesystem type.\n" 683#else
1187 "\t-w:\t\tMount for reading and writing (default).\n" 684 #define USAGE_MTAB(a)
1188 "\n"
1189 "Options for use with the \"-o\" flag:\n"
1190 "\tasync/sync:\tWrites are asynchronous / synchronous.\n"
1191 "\tatime/noatime:\tEnable / disable updates to inode access times.\n"
1192 "\tdev/nodev:\tAllow use of special device files / disallow them.\n"
1193 "\texec/noexec:\tAllow use of executable files / disallow them.\n"
1194#if defined BB_FEATURE_MOUNT_LOOP
1195 "\tloop:\t\tMounts a file via loop device.\n"
1196#endif 685#endif
1197 "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" 686#define mount_trivial_usage \
1198 "\tremount:\tRe-mount a mounted filesystem, changing its flags.\n" 687 "[flags] device directory [-o options,more-options]"
1199 "\tro/rw:\t\tMount for read-only / read-write.\n" 688#define mount_full_usage \
1200 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" 689 "Mount a filesystem\n\n" \
690 "Flags:\n" \
691 "\t-a:\t\tMount all filesystems in fstab.\n" \
692USAGE_MTAB( \
693 "\t-f:\t\t\"Fake\" mount. Add entry to mount table but don't mount it.\n" \
694 "\t-n:\t\tDon't write a mount table entry.\n" \
695 ) \
696 "\t-o option:\tOne of many filesystem options, listed below.\n" \
697 "\t-r:\t\tMount the filesystem read-only.\n" \
698 "\t-t fs-type:\tSpecify the filesystem type.\n" \
699 "\t-w:\t\tMount for reading and writing (default).\n" \
700 "\n" \
701 "Options for use with the \"-o\" flag:\n" \
702 "\tasync/sync:\tWrites are asynchronous / synchronous.\n" \
703 "\tatime/noatime:\tEnable / disable updates to inode access times.\n" \
704 "\tdev/nodev:\tAllow use of special device files / disallow them.\n" \
705 "\texec/noexec:\tAllow use of executable files / disallow them.\n" \
706USAGE_MOUNT_LOOP( \
707 "\tloop:\t\tMounts a file via loop device.\n" \
708 ) \
709 "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" \
710 "\tremount:\tRe-mount a currently-mounted filesystem, changing its flags.\n" \
711 "\tro/rw:\t\tMount for read-only / read-write.\n" \
712 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" \
1201 "You'll have to see the written documentation for those." 713 "You'll have to see the written documentation for those."
1202#endif
1203#endif
1204DO_COMMA
1205#endif
1206 714
1207#if defined BB_MT 715#define mt_trivial_usage \
1208#if defined USAGE_ENUM
1209mt_usage_index
1210#elif defined USAGE_MESSAGES
1211 "[-f device] opcode value" 716 "[-f device] opcode value"
1212#ifndef BB_FEATURE_TRIVIAL_HELP 717#define mt_full_usage \
1213 "\n\nControl magnetic tape drive operation\n" 718 "Control magnetic tape drive operation\n" \
1214 "\nAvailable Opcodes:\n\n" 719 "\nAvailable Opcodes:\n\n" \
1215 "bsf bsfm bsr bss datacompression drvbuffer eof eom erase\n" 720 "bsf bsfm bsr bss datacompression drvbuffer eof eom erase\n" \
1216 "fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2\n" 721 "fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2\n" \
1217 "ras3 reset retension rew rewoffline seek setblk setdensity\n" 722 "ras3 reset retension rew rewoffline seek setblk setdensity\n" \
1218 "setpart tell unload unlock weof wset" 723 "setpart tell unload unlock weof wset"
1219#endif
1220#endif
1221DO_COMMA
1222#endif
1223 724
1224#if defined BB_CP_MV 725#define mv_trivial_usage \
1225#if defined USAGE_ENUM 726 "SOURCE DEST\n or: mv SOURCE... DIRECTORY"
1226mv_usage_index 727#define mv_full_usage \
1227#elif defined USAGE_MESSAGES 728 "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY."
1228 "SOURCE DEST\n"
1229 " or: mv SOURCE... DIRECTORY"
1230#ifndef BB_FEATURE_TRIVIAL_HELP
1231 "\n\nRename SOURCE to DEST, or move SOURCE(s) to DIRECTORY."
1232#endif
1233#endif
1234DO_COMMA
1235#endif
1236 729
1237#if defined BB_NC 730#define nc_trivial_usage \
1238#if defined USAGE_ENUM
1239nc_usage_index
1240#elif defined USAGE_MESSAGES
1241 "[IP] [port]" 731 "[IP] [port]"
1242#ifndef BB_FEATURE_TRIVIAL_HELP 732#define nc_full_usage \
1243 "\n\nNetcat opens a pipe to IP:port" 733 "Netcat opens a pipe to IP:port"
1244#endif
1245#endif
1246DO_COMMA
1247#endif
1248 734
1249#if defined BB_NSLOOKUP 735#define nslookup_trivial_usage \
1250#if defined USAGE_ENUM
1251nslookup_usage_index
1252#elif defined USAGE_MESSAGES
1253 "[HOST]" 736 "[HOST]"
1254#ifndef BB_FEATURE_TRIVIAL_HELP 737#define nslookup_full_usage \
1255 "\n\nQueries the nameserver for the IP address of the given HOST" 738 "Queries the nameserver for the IP address of the given HOST"
1256#endif
1257#endif
1258DO_COMMA
1259#endif
1260 739
1261#if defined BB_PING 740#ifdef BB_FEATURE_SIMPLE_PING
1262#if defined BB_FEATURE_SIMPLE_PING 741#define ping_trivial_usage "host"
1263#if defined USAGE_ENUM 742#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
1264ping_usage_index 743#else
1265#elif defined USAGE_MESSAGES 744#define ping_trivial_usage \
1266 "host"
1267#ifndef BB_FEATURE_TRIVIAL_HELP
1268 "\n\nSend ICMP ECHO_REQUEST packets to network hosts"
1269#endif
1270#endif
1271DO_COMMA
1272#else /* ! defined BB_FEATURE_SIMPLE_PING */
1273#if defined USAGE_ENUM
1274ping_usage_index
1275#elif defined USAGE_MESSAGES
1276 "[OPTION]... host" 745 "[OPTION]... host"
1277#ifndef BB_FEATURE_TRIVIAL_HELP 746#define ping_full_usage \
1278 "\n\nSend ICMP ECHO_REQUEST packets to network hosts.\n\n" 747 "Send ICMP ECHO_REQUEST packets to network hosts.\n\n" \
1279 "Options:\n" 748 "Options:\n" \
1280 "\t-c COUNT\tSend only COUNT pings.\n" 749 "\t-c COUNT\tSend only COUNT pings.\n" \
1281 "\t-s SIZE\t\tSend SIZE data bytes in packets (default=56).\n" 750 "\t-s SIZE\t\tSend SIZE data bytes in packets (default=56).\n" \
1282 "\t-q\t\tQuiet mode, only displays output at start\n" 751 "\t-q\t\tQuiet mode, only displays output at start\n" \
1283 "\t\t\tand when finished." 752 "\t\t\tand when finished."
1284#endif 753#endif
1285#endif
1286DO_COMMA
1287#endif
1288#endif
1289 754
1290#if defined BB_PIVOT_ROOT 755#define pivot_root_trivial_usage \
1291#if defined USAGE_ENUM
1292pivot_root_usage_index
1293#elif defined USAGE_MESSAGES
1294 "new_root put_old" 756 "new_root put_old"
1295#ifndef BB_FEATURE_TRIVIAL_HELP 757#define pivot_root_full_usage \
1296 "\n\nMove the current root file system to put_old and make new_root\n" 758 "Move the current root file system to put_old and make new_root\n" \
1297 "the new root file system." 759 "the new root file system."
1298#endif
1299#endif
1300DO_COMMA
1301#endif
1302 760
1303#if defined BB_POWEROFF 761#define poweroff_trivial_usage \
1304#if defined USAGE_ENUM
1305poweroff_usage_index
1306#elif defined USAGE_MESSAGES
1307 "" 762 ""
1308#ifndef BB_FEATURE_TRIVIAL_HELP 763#define poweroff_full_usage \
1309 "\n\nHalt the system and request that the kernel shut off the power." 764 "Halt the system and request that the kernel shut off the power."
1310#endif
1311#endif
1312DO_COMMA
1313#endif
1314 765
1315#if defined BB_PRINTF 766#define printf_trivial_usage \
1316#if defined USAGE_ENUM
1317printf_usage_index
1318#elif defined USAGE_MESSAGES
1319 "FORMAT [ARGUMENT...]" 767 "FORMAT [ARGUMENT...]"
1320#ifndef BB_FEATURE_TRIVIAL_HELP 768#define printf_full_usage \
1321 "\n\nFormats and prints ARGUMENT(s) according to FORMAT,\n" 769 "Formats and prints ARGUMENT(s) according to FORMAT,\n" \
1322 "Where FORMAT controls the output exactly as in C printf." 770 "Where FORMAT controls the output exactly as in C printf."
1323#endif
1324#endif
1325DO_COMMA
1326#endif
1327 771
1328#if defined BB_PS 772#define ps_trivial_usage \
1329#if defined USAGE_ENUM
1330ps_usage_index
1331#elif defined USAGE_MESSAGES
1332 "" 773 ""
1333#ifndef BB_FEATURE_TRIVIAL_HELP 774#define ps_full_usage \
1334 "\n\nReport process status\n" 775 "Report process status\n" \
1335 "\nThis version of ps accepts no options." 776 "\nThis version of ps accepts no options."
1336#endif
1337#endif
1338DO_COMMA
1339#endif
1340 777
1341#if defined BB_PWD 778#define pwd_trivial_usage \
1342#if defined USAGE_ENUM
1343pwd_usage_index
1344#elif defined USAGE_MESSAGES
1345 "" 779 ""
1346#ifndef BB_FEATURE_TRIVIAL_HELP 780#define pwd_full_usage \
1347 "\n\nPrint the full filename of the current working directory." 781 "Print the full filename of the current working directory."
1348#endif
1349#endif
1350DO_COMMA
1351#endif
1352 782
1353#if defined BB_RDATE 783#define rdate_trivial_usage \
1354#if defined USAGE_ENUM
1355rdate_usage_index
1356#elif defined USAGE_MESSAGES
1357 "[OPTION] HOST" 784 "[OPTION] HOST"
1358#ifndef BB_FEATURE_TRIVIAL_HELP 785#define rdate_full_usage \
1359 "\n\nGet and possibly set the system date and time from a remote HOST.\n" 786 "Get and possibly set the system date and time from a remote HOST.\n" \
1360 "Options:\n" 787 "Options:\n" \
1361 "\t-s\tSet the system date and time (default).\n" 788 "\t-s\tSet the system date and time (default).\n" \
1362 "\t-p\tPrint the date and time." 789 "\t-p\tPrint the date and time."
1363#endif
1364#endif
1365DO_COMMA
1366#endif
1367 790
1368#if defined BB_READLINK 791#define readlink_trivial_usage \
1369#if defined USAGE_ENUM
1370readlink_usage_index
1371#elif defined USAGE_MESSAGES
1372 "" 792 ""
1373#ifndef BB_FEATURE_TRIVIAL_HELP 793#define readlink_full_usage \
1374 "\n\nRead a symbolic link." 794 "Read a symbolic link."
1375#endif
1376#endif
1377DO_COMMA
1378#endif
1379 795
1380#if defined BB_REBOOT 796#define reboot_trivial_usage \
1381#if defined USAGE_ENUM
1382reboot_usage_index
1383#elif defined USAGE_MESSAGES
1384 "" 797 ""
1385#ifndef BB_FEATURE_TRIVIAL_HELP 798#define reboot_full_usage \
1386 "\n\nReboot the system." 799 "Reboot the system."
1387#endif 800
1388#endif 801#define renice_trivial_usage \
1389DO_COMMA
1390#endif
1391
1392#if defined BB_RENICE
1393#if defined USAGE_ENUM
1394renice_usage_index
1395#elif defined USAGE_MESSAGES
1396 "priority pid [pid ...]" 802 "priority pid [pid ...]"
1397#ifndef BB_FEATURE_TRIVIAL_HELP 803#define renice_full_usage \
1398 "\n\nChanges priority of running processes. Allowed priorities range\n" 804 "Changes priority of running processes. Allowed priorities range\n" \
1399 "from 20 (the process runs only when nothing else is running) to 0\n" 805 "from 20 (the process runs only when nothing else is running) to 0\n" \
1400 "(default priority) to -20 (almost nothing else ever gets to run)." 806 "(default priority) to -20 (almost nothing else ever gets to run)."
1401#endif
1402#endif
1403DO_COMMA
1404#endif
1405
1406 807
1407#if defined BB_RESET 808#define reset_trivial_usage \
1408#if defined USAGE_ENUM
1409reset_usage_index
1410#elif defined USAGE_MESSAGES
1411 "" 809 ""
1412#ifndef BB_FEATURE_TRIVIAL_HELP 810#define reset_full_usage \
1413 "\n\nResets the screen." 811 "Resets the screen."
1414#endif
1415#endif
1416DO_COMMA
1417#endif
1418 812
1419#if defined BB_RM 813#define rm_trivial_usage \
1420#if defined USAGE_ENUM
1421rm_usage_index
1422#elif defined USAGE_MESSAGES
1423 "[OPTION]... FILE..." 814 "[OPTION]... FILE..."
1424#ifndef BB_FEATURE_TRIVIAL_HELP 815#define rm_full_usage \
1425 "\n\nRemove (unlink) the FILE(s). You may use '--' to\n" 816 "Remove (unlink) the FILE(s). You may use '--' to\n" \
1426 "indicate that all following arguments are non-options.\n\n" 817 "indicate that all following arguments are non-options.\n\n" \
1427 "Options:\n" 818 "Options:\n" \
1428 "\t-f\t\tremove existing destinations, never prompt\n" 819 "\t-f\t\tremove existing destinations, never prompt\n" \
1429 "\t-r or -R\tremove the contents of directories recursively" 820 "\t-r or -R\tremove the contents of directories recursively"
1430#endif
1431#endif
1432DO_COMMA
1433#endif
1434 821
1435#if defined BB_RMDIR 822#define rmdir_trivial_usage \
1436#if defined USAGE_ENUM
1437rmdir_usage_index
1438#elif defined USAGE_MESSAGES
1439 "[OPTION]... DIRECTORY..." 823 "[OPTION]... DIRECTORY..."
1440#ifndef BB_FEATURE_TRIVIAL_HELP 824#define rmdir_full_usage \
1441 "\n\nRemove the DIRECTORY(ies), if they are empty." 825 "Remove the DIRECTORY(ies), if they are empty."
1442#endif
1443#endif
1444DO_COMMA
1445#endif
1446 826
1447#if defined BB_RMMOD 827#define rmmod_trivial_usage \
1448#if defined USAGE_ENUM
1449rmmod_usage_index
1450#elif defined USAGE_MESSAGES
1451 "[OPTION]... [MODULE]..." 828 "[OPTION]... [MODULE]..."
1452#ifndef BB_FEATURE_TRIVIAL_HELP 829#define rmmod_full_usage \
1453 "\n\nUnloads the specified kernel modules from the kernel.\n\n" 830 "Unloads the specified kernel modules from the kernel.\n\n" \
1454 "Options:\n" 831 "Options:\n" \
1455 "\t-a\tTry to remove all unused kernel modules." 832 "\t-a\tTry to remove all unused kernel modules."
1456#endif
1457#endif
1458DO_COMMA
1459#endif
1460 833
1461#if defined BB_ROUTE 834#define route_trivial_usage \
1462#if defined USAGE_ENUM
1463route_usage_index
1464#elif defined USAGE_MESSAGES
1465 "[{add|del|flush}]" 835 "[{add|del|flush}]"
1466#ifndef BB_FEATURE_TRIVIAL_HELP 836#define route_full_usage \
1467 "\n\nEdit the kernel's routing tables" 837 "Edit the kernel's routing tables"
1468#endif
1469#endif
1470DO_COMMA
1471#endif
1472 838
1473#if defined BB_RPMUNPACK 839#define rpmunpack_trivial_usage \
1474#if defined USAGE_ENUM
1475rpmunpack_usage_index
1476#elif defined USAGE_MESSAGES
1477 "< package.rpm | gunzip | cpio -idmuv" 840 "< package.rpm | gunzip | cpio -idmuv"
1478#ifndef BB_FEATURE_TRIVIAL_HELP 841#define rpmunpack_full_usage \
1479 "\n\nExtracts an rpm archive." 842 "Extracts an rpm archive."
1480#endif
1481#endif
1482DO_COMMA
1483#endif
1484 843
1485#if defined BB_SED 844#define sed_trivial_usage \
1486#if defined USAGE_ENUM
1487sed_usage_index
1488#elif defined USAGE_MESSAGES
1489 "[-Vhnef] pattern [files...]" 845 "[-Vhnef] pattern [files...]"
1490#ifndef BB_FEATURE_TRIVIAL_HELP 846#define sed_full_usage \
1491 "\n\n" 847 "-n\t\tsuppress automatic printing of pattern space\n" \
1492 "-n\t\tsuppress automatic printing of pattern space\n" 848 "-e script\tadd the script to the commands to be executed\n" \
1493 "-e script\tadd the script to the commands to be executed\n" 849 "-f scriptfile\tadd the contents of script-file to the commands to be executed\n" \
1494 "-f scriptfile\tadd the contents of script-file to the commands to be executed\n" 850 "-h\t\tdisplay this help message\n" \
1495 "\n" 851 "\n" \
1496 "If no -e or -f is given, the first non-option argument is taken as the\n" 852 "If no -e or -f is given, the first non-option argument is taken as the\n" \
1497 "sed script to interpret. All remaining arguments are names of input\n" 853 "sed script to interpret. All remaining arguments are names of input\n" \
1498 "files; if no input files are specified, then the standard input is read." 854 "files; if no input files are specified, then the standard input is read."
1499#endif
1500#endif
1501DO_COMMA
1502#endif
1503 855
1504#if defined BB_SETKEYCODES 856#define setkeycodes_trivial_usage \
1505#if defined USAGE_ENUM
1506setkeycodes_usage_index
1507#elif defined USAGE_MESSAGES
1508 "SCANCODE KEYCODE ..." 857 "SCANCODE KEYCODE ..."
1509#ifndef BB_FEATURE_TRIVIAL_HELP 858#define setkeycodes_full_usage \
1510 "\n\nSet entries into the kernel's scancode-to-keycode map,\n" 859 "Set entries into the kernel's scancode-to-keycode map,\n" \
1511 "allowing unusual keyboards to generate usable keycodes.\n\n" 860 "allowing unusual keyboards to generate usable keycodes.\n\n" \
1512 "SCANCODE may be either xx or e0xx (hexadecimal),\n" 861 "SCANCODE may be either xx or e0xx (hexadecimal),\n" \
1513 "and KEYCODE is given in decimal" 862 "and KEYCODE is given in decimal"
1514#endif
1515#endif
1516DO_COMMA
1517#endif
1518 863
1519#if defined BB_SH 864#define sh_trivial_usage \
1520#if defined USAGE_ENUM 865 "[FILE]...\n or: sh -c command [args]..."
1521shell_usage_index 866#define sh_full_usage \
1522#elif defined USAGE_MESSAGES 867 "lash: The BusyBox command interpreter (shell)."
1523 "[FILE]...\n"
1524 " or: sh -c command [args]..."
1525#ifndef BB_FEATURE_TRIVIAL_HELP
1526 "\n\nlash: The BusyBox command interpreter (shell)."
1527#endif
1528#endif
1529DO_COMMA
1530#endif
1531 868
1532#if defined BB_SLEEP 869#define sleep_trivial_usage \
1533#if defined USAGE_ENUM 870 "N"
1534sleep_usage_index 871#define sleep_full_usage \
1535#elif defined USAGE_MESSAGES 872 "Pause for N seconds."
1536 "N"
1537#ifndef BB_FEATURE_TRIVIAL_HELP
1538 "\n\nPause for N seconds."
1539#endif
1540#endif
1541DO_COMMA
1542#endif
1543 873
1544#if defined BB_SORT
1545#if defined USAGE_ENUM
1546sort_usage_index
1547#elif defined USAGE_MESSAGES
1548 "[-n]"
1549#ifdef BB_FEATURE_SORT_REVERSE
1550 " [-r]"
1551#endif
1552 " [FILE]..."
1553#ifndef BB_FEATURE_TRIVIAL_HELP
1554 "\n\nSorts lines of text in the specified files"
1555#endif
1556#endif
1557DO_COMMA
1558#endif
1559 874
1560#if defined BB_STTY 875#ifdef BB_FEATURE_SORT_REVERSE
1561#if defined USAGE_ENUM 876 #define USAGE_SORT_REVERSE(a) a
1562stty_usage_index 877#else
1563#elif defined USAGE_MESSAGES 878 #define USAGE_SORT_REVERSE(a)
1564 "stty [-a|g] [-F device] [SETTING]..." 879#endif
1565#ifndef BB_FEATURE_TRIVIAL_HELP 880#define sort_trivial_usage \
1566 "\n\nWithout arguments, prints baud rate, line discipline," 881 "[-n]" USAGE_SORT_REVERSE(" [-r]") " [FILE]..."
1567 "\nand deviations from stty sane." 882#define sort_full_usage \
1568 "\n -F device open and use the specified device instead of stdin" 883 "Sorts lines of text in the specified files"
1569 "\n -a print all current settings in human-readable form. Or" 884
1570 "\n -g print in a stty-readable form" 885#define stty_trivial_usage \
886 "[-a|g] [-F device] [SETTING]..."
887#define stty_full_usage \
888 "Without arguments, prints baud rate, line discipline," \
889 "\nand deviations from stty sane." \
890 "\n -F device open and use the specified device instead of stdin" \
891 "\n -a print all current settings in human-readable form. Or" \
892 "\n -g print in a stty-readable form" \
1571 "\n [SETTING] see in documentation" 893 "\n [SETTING] see in documentation"
1572#endif
1573#endif
1574DO_COMMA
1575#endif
1576 894
1577#if defined BB_SWAPONOFF 895#define swapoff_trivial_usage \
1578#if defined USAGE_ENUM
1579swapoff_usage_index
1580#elif defined USAGE_MESSAGES
1581 "[OPTION] [device]" 896 "[OPTION] [device]"
1582#ifndef BB_FEATURE_TRIVIAL_HELP 897#define swapoff_full_usage \
1583 "\n\nStop swapping virtual memory pages on the given device.\n\n" 898 "Stop swapping virtual memory pages on the given device.\n\n" \
1584 "Options:\n" 899 "Options:\n" \
1585 "\t-a\tStop swapping on all swap devices" 900 "\t-a\tStop swapping on all swap devices"
1586#endif
1587#endif
1588DO_COMMA
1589#endif
1590 901
1591#if defined BB_SWAPONOFF 902#define swapon_trivial_usage \
1592#if defined USAGE_ENUM
1593swapon_usage_index
1594#elif defined USAGE_MESSAGES
1595 "[OPTION] [device]" 903 "[OPTION] [device]"
1596#ifndef BB_FEATURE_TRIVIAL_HELP 904#define swapon_full_usage \
1597 "\n\nStart swapping virtual memory pages on the given device.\n\n" 905 "Start swapping virtual memory pages on the given device.\n\n" \
1598 "Options:\n" 906 "Options:\n" \
1599 "\t-a\tStart swapping on all swap devices" 907 "\t-a\tStart swapping on all swap devices"
1600#endif
1601#endif
1602DO_COMMA
1603#endif
1604 908
1605#if defined BB_SYNC 909#define sync_trivial_usage \
1606#if defined USAGE_ENUM
1607sync_usage_index
1608#elif defined USAGE_MESSAGES
1609 "" 910 ""
1610#ifndef BB_FEATURE_TRIVIAL_HELP 911#define sync_full_usage \
1611 "\n\nWrite all buffered filesystem blocks to disk." 912 "Write all buffered filesystem blocks to disk."
1612#endif 913
1613#endif
1614DO_COMMA
1615#endif
1616 914
1617#if defined BB_SYSLOGD
1618#if defined USAGE_ENUM
1619syslogd_usage_index
1620#elif defined USAGE_MESSAGES
1621 "[OPTION]..."
1622#ifndef BB_FEATURE_TRIVIAL_HELP
1623 "\n\nLinux system and kernel (provides klogd) logging utility.\n"
1624 "Note that this version of syslogd/klogd ignores /etc/syslog.conf.\n\n"
1625 "Options:\n"
1626 "\t-m NUM\t\tInterval between MARK lines (default=20min, 0=off)\n"
1627 "\t-n\t\tRun as a foreground process\n"
1628#ifdef BB_FEATURE_KLOGD 915#ifdef BB_FEATURE_KLOGD
1629 "\t-K\t\tDo not start up the klogd process\n" 916 #define USAGE_KLOGD(a) a
917#else
918 #define USAGE_KLOGD(a)
1630#endif 919#endif
1631 "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)"
1632#ifdef BB_FEATURE_REMOTE_LOG 920#ifdef BB_FEATURE_REMOTE_LOG
1633 "\n\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n" 921 #define USAGE_REMOTE_LOG(a) a
1634 "\t-L\t\tLog locally as well as network logging (default is network only)" 922#else
1635#endif 923 #define USAGE_REMOTE_LOG(a)
1636#endif
1637#endif 924#endif
1638DO_COMMA 925#define syslogd_trivial_usage \
926 "[OPTION]..."
927#define syslogd_full_usage \
928 "Linux system and kernel (provides klogd) logging utility.\n" \
929 "Note that this version of syslogd/klogd ignores /etc/syslog.conf.\n\n" \
930 "Options:\n" \
931 "\t-m NUM\t\tInterval between MARK lines (default=20min, 0=off)\n" \
932 "\t-n\t\tRun as a foreground process\n" \
933USAGE_KLOGD("\t-K\t\tDo not start up the klogd process\n") \
934 "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)" \
935USAGE_REMOTE_LOG( \
936 "\n\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n" \
937 "\t-L\t\tLog locally as well as network logging (default is network only)")
938
939
940#ifdef BB_FEATURE_SIMPLE_TAIL
941 #define USAGE_UNSIMPLE_TAIL(a)
942#else
943 #define USAGE_UNSIMPLE_TAIL(a) a
1639#endif 944#endif
1640 945#define tail_trivial_usage \
1641#if defined BB_TAIL
1642#if defined USAGE_ENUM
1643tail_usage_index
1644#elif defined USAGE_MESSAGES
1645 "[OPTION]... [FILE]..." 946 "[OPTION]... [FILE]..."
1646#ifndef BB_FEATURE_TRIVIAL_HELP 947#define tail_full_usage \
1647 "\n\nPrint last 10 lines of each FILE to standard output.\n" 948 "Print last 10 lines of each FILE to standard output.\n" \
1648 "With more than one FILE, precede each with a header giving the\n" 949 "With more than one FILE, precede each with a header giving the\n" \
1649 "file name. With no FILE, or when FILE is -, read standard input.\n\n" 950 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
1650 "Options:\n" 951 "Options:\n" \
1651#ifndef BB_FEATURE_SIMPLE_TAIL 952USAGE_UNSIMPLE_TAIL("\t-c N[kbm]\toutput the last N bytes\n") \
1652 "\t-c N[kbm]\toutput the last N bytes\n" 953 "\t-n N[kbm]\tprint last N lines instead of last 10\n" \
1653#endif 954 "\t-f\t\toutput data as the file grows" \
1654 "\t-n N[kbm]\tprint last N lines instead of last 10\n" 955USAGE_UNSIMPLE_TAIL( \
1655 "\t-f\t\toutput data as the file grows" 956 "\n\t-q\t\tnever output headers giving file names\n" \
1656#ifndef BB_FEATURE_SIMPLE_TAIL 957 "\t-s SEC\t\twait SEC seconds between reads with -f\n" \
1657 "\n\t-q\t\tnever output headers giving file names\n" 958 "\t-v\t\talways output headers giving file names\n\n" \
1658 "\t-s SEC\t\twait SEC seconds between reads with -f\n" 959 "If the first character of N (bytes or lines) is a `+', output begins with \n" \
1659 "\t-v\t\talways output headers giving file names\n\n" 960 "the Nth item from the start of each file, otherwise, print the last N items\n" \
1660 "If the first character of N (bytes or lines) is a `+', output begins with \n" 961 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." \
1661 "the Nth item from the start of each file, otherwise, print the last N items\n" 962 )
1662 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)."
1663//#else
1664// "\nIf the first character of N (bytes or lines) is a `+', output begins with \n"
1665// "the Nth item from the start of each file."
1666#endif
1667#endif
1668#endif
1669DO_COMMA
1670#endif
1671 963
1672#if defined BB_TAR
1673#if defined USAGE_ENUM
1674tar_usage_index
1675#elif defined USAGE_MESSAGES
1676#ifdef BB_FEATURE_TAR_CREATE 964#ifdef BB_FEATURE_TAR_CREATE
1677 "-[cxtvO] " 965 #define USAGE_TAR_CREATE(a) a
1678#else 966#else
1679 "-[xtvO] " 967 #define USAGE_TAR_CREATE(a)
1680#endif 968#endif
1681#if defined BB_FEATURE_TAR_EXCLUDE 969#ifdef BB_FEATURE_TAR_EXCLUDE
1682 "[--exclude File] " 970 #define USAGE_TAR_EXCLUDE(a) a
1683 "[-X File]" 971#else
972 #define USAGE_TAR_EXCLUDE(a)
1684#endif 973#endif
974#define tar_trivial_usage \
975 "-[" USAGE_TAR_CREATE("c") "xtvO] " \
976 USAGE_TAR_EXCLUDE("[--exclude File] [-X File]") \
1685 "[-f tarFile] [FILE(s)] ..." 977 "[-f tarFile] [FILE(s)] ..."
1686#ifndef BB_FEATURE_TRIVIAL_HELP 978#define tar_full_usage \
1687 "\n\nCreate, extract, or list files from a tar file.\n\n" 979 "Create, extract, or list files from a tar file.\n\n" \
1688 "Main operation mode:\n" 980 "Main operation mode:\n" \
1689#ifdef BB_FEATURE_TAR_CREATE 981USAGE_TAR_CREATE("\tc\t\tcreate\n") \
1690 "\tc\t\tcreate\n" 982 "\tx\t\textract\n" \
1691#endif 983 "\tt\t\tlist\n" \
1692 "\tx\t\textract\n" 984 "\nFile selection:\n" \
1693 "\tt\t\tlist\n" 985 "\tf\t\tname of tarfile or \"-\" for stdin\n" \
1694 "\nFile selection:\n" 986 "\tO\t\textract to stdout\n" \
1695 "\tf\t\tname of tarfile or \"-\" for stdin\n" 987USAGE_TAR_EXCLUDE( \
1696 "\tO\t\textract to stdout\n" 988 "\texclude\t\tfile to exclude\n" \
1697#if defined BB_FEATURE_TAR_EXCLUDE 989 "\tX\t\tfile with names to exclude\n" \
1698 "\texclude\t\tfile to exclude\n" 990 ) \
1699 "\tX\t\tfile with names to exclude\n" 991 "\nInformative output:\n" \
1700#endif
1701 "\nInformative output:\n"
1702 "\tv\t\tverbosely list files processed" 992 "\tv\t\tverbosely list files processed"
1703#endif
1704#endif
1705DO_COMMA
1706#endif
1707 993
1708#if defined BB_TEE 994#define tee_trivial_usage \
1709#if defined USAGE_ENUM
1710tee_usage_index
1711#elif defined USAGE_MESSAGES
1712 "[OPTION]... [FILE]..." 995 "[OPTION]... [FILE]..."
1713#ifndef BB_FEATURE_TRIVIAL_HELP 996#define tee_full_usage \
1714 "\n\nCopy standard input to each FILE, and also to standard output.\n\n" 997 "Copy standard input to each FILE, and also to standard output.\n\n" \
1715 "Options:\n" "\t-a\tappend to the given FILEs, do not overwrite" 998 "Options:\n" "\t-a\tappend to the given FILEs, do not overwrite"
1716#endif
1717#endif
1718DO_COMMA
1719#endif
1720 999
1721#if defined BB_TELNET 1000#define telnet_trivial_usage \
1722#if defined USAGE_ENUM
1723telnet_usage_index
1724#elif defined USAGE_MESSAGES
1725 "host [port]" 1001 "host [port]"
1726#ifndef BB_FEATURE_TRIVIAL_HELP 1002#define telnet_full_usage \
1727 "\n\nTelnet is used to establish interactive communication with another\n" 1003 "Telnet is used to establish interactive communication with another\n"\
1728 "computer over a network using the TELNET protocol." 1004 "computer over a network using the TELNET protocol."
1729#endif
1730#endif
1731DO_COMMA
1732#endif
1733 1005
1734#if defined BB_TEST 1006#define test_trivial_usage \
1735#if defined USAGE_ENUM 1007 "EXPRESSION\n or [ EXPRESSION ]"
1736test_usage_index 1008#define test_full_usage \
1737#elif defined USAGE_MESSAGES 1009 "Checks file types and compares values returning an exit\n" \
1738 "\ntest EXPRESSION\n"
1739 "or [ EXPRESSION ]"
1740#ifndef BB_FEATURE_TRIVIAL_HELP
1741 "\n\nChecks file types and compares values returning an exit\n"
1742 "code determined by the value of EXPRESSION." 1010 "code determined by the value of EXPRESSION."
1743#endif
1744#endif
1745DO_COMMA
1746#endif
1747 1011
1748#if defined BB_TOUCH 1012#define touch_trivial_usage \
1749#if defined USAGE_ENUM
1750touch_usage_index
1751#elif defined USAGE_MESSAGES
1752 "[-c] file [file ...]" 1013 "[-c] file [file ...]"
1753#ifndef BB_FEATURE_TRIVIAL_HELP 1014#define touch_full_usage \
1754 "\n\nUpdate the last-modified date on the given file[s].\n\n" 1015 "Update the last-modified date on the given file[s].\n\n" \
1755 "Options:\n" 1016 "Options:\n" \
1756 "\t-c\tDo not create any files" 1017 "\t-c\tDo not create any files"
1757#endif
1758#endif
1759DO_COMMA
1760#endif
1761 1018
1762#if defined BB_TR 1019#define tr_trivial_usage \
1763#if defined USAGE_ENUM
1764tr_usage_index
1765#elif defined USAGE_MESSAGES
1766 "[-cds] STRING1 [STRING2]" 1020 "[-cds] STRING1 [STRING2]"
1767#ifndef BB_FEATURE_TRIVIAL_HELP 1021#define tr_full_usage \
1768 "\n\nTranslate, squeeze, and/or delete characters from\n" 1022 "Translate, squeeze, and/or delete characters from\n" \
1769 "standard input, writing to standard output.\n\n" 1023 "standard input, writing to standard output.\n\n" \
1770 "Options:\n" 1024 "Options:\n" \
1771 "\t-c\ttake complement of STRING1\n" 1025 "\t-c\ttake complement of STRING1\n" \
1772 "\t-d\tdelete input characters coded STRING1\n" 1026 "\t-d\tdelete input characters coded STRING1\n" \
1773 "\t-s\tsqueeze multiple output characters of STRING2 into one character" 1027 "\t-s\tsqueeze multiple output characters of STRING2 into one character"
1774#endif
1775#endif
1776DO_COMMA
1777#endif
1778 1028
1779#if defined BB_TRUE_FALSE 1029#define true_trivial_usage \
1780#if defined USAGE_ENUM
1781true_usage_index
1782#elif defined USAGE_MESSAGES
1783 "" 1030 ""
1784#ifndef BB_FEATURE_TRIVIAL_HELP 1031#define true_full_usage \
1785 "\n\nReturn an exit code of TRUE (0)." 1032 "Return an exit code of TRUE (0)."
1786#endif
1787#endif
1788DO_COMMA
1789#endif
1790 1033
1791#if defined BB_TTY 1034#define tty_trivial_usage \
1792#if defined USAGE_ENUM
1793tty_usage_index
1794#elif defined USAGE_MESSAGES
1795 "" 1035 ""
1796#ifndef BB_FEATURE_TRIVIAL_HELP 1036#define tty_full_usage \
1797 "\n\nPrint the file name of the terminal connected to standard input.\n\n" 1037 "Print the file name of the terminal connected to standard input.\n\n"\
1798 "Options:\n" 1038 "Options:\n" \
1799 "\t-s\tprint nothing, only return an exit status" 1039 "\t-s\tprint nothing, only return an exit status"
1800#endif
1801#endif
1802DO_COMMA
1803#endif
1804 1040
1805#if defined BB_UMOUNT 1041#ifdef BB_FEATURE_MOUNT_FORCE
1806#if defined USAGE_ENUM 1042 #define USAGE_MOUNT_FORCE(a) a
1807umount_usage_index
1808#elif defined USAGE_MESSAGES
1809 "[flags] filesystem|directory"
1810#ifndef BB_FEATURE_TRIVIAL_HELP
1811 "\nUnmount file systems\n"
1812 "\nFlags:\n" "\t-a:\tUnmount all file systems"
1813#ifdef BB_MTAB
1814 " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n"
1815#else 1043#else
1816 "\n" 1044 #define USAGE_MOUNT_FORCE(a)
1817#endif
1818 "\t-r:\tTry to remount devices as read-only if mount is busy"
1819#if defined BB_FEATURE_MOUNT_FORCE
1820 "\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)"
1821#endif
1822#if defined BB_FEATURE_MOUNT_LOOP
1823 "\n\t-l:\tDo not free loop device (if a loop device has been used)"
1824#endif 1045#endif
1825#endif 1046#define umount_trivial_usage \
1826#endif 1047 "[flags] filesystem|directory"
1827DO_COMMA 1048#define umount_full_usage \
1828#endif 1049 "Unmount file systems\n" \
1829 1050 "\nFlags:\n" "\t-a:\tUnmount all file systems" \
1830#if defined BB_UNAME 1051USAGE_MTAB(" in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries") \
1831#if defined USAGE_ENUM 1052 "\n\t-r:\tTry to remount devices as read-only if mount is busy" \
1832uname_usage_index 1053USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \
1833#elif defined USAGE_MESSAGES 1054USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)" \
1055 )
1056
1057#define uname_trivial_usage \
1834 "[OPTION]..." 1058 "[OPTION]..."
1835#ifndef BB_FEATURE_TRIVIAL_HELP 1059#define uname_full_usage \
1836 "\n\nPrint certain system information. With no OPTION, same as -s.\n\n" 1060 "Print certain system information. With no OPTION, same as -s.\n\n" \
1837 "Options:\n" 1061 "Options:\n" \
1838 "\t-a\tprint all information\n" 1062 "\t-a\tprint all information\n" \
1839 "\t-m\tthe machine (hardware) type\n" 1063 "\t-m\tthe machine (hardware) type\n" \
1840 "\t-n\tprint the machine's network node hostname\n" 1064 "\t-n\tprint the machine's network node hostname\n" \
1841 "\t-r\tprint the operating system release\n" 1065 "\t-r\tprint the operating system release\n" \
1842 "\t-s\tprint the operating system name\n" 1066 "\t-s\tprint the operating system name\n" \
1843 1067 "\t-p\tprint the host processor type\n" \
1844 "\t-p\tprint the host processor type\n"
1845 "\t-v\tprint the operating system version" 1068 "\t-v\tprint the operating system version"
1846#endif
1847#endif
1848DO_COMMA
1849#endif
1850 1069
1851#if defined BB_UNIQ 1070#define uniq_trivial_usage \
1852#if defined USAGE_ENUM
1853uniq_usage_index
1854#elif defined USAGE_MESSAGES
1855 "[OPTION]... [INPUT [OUTPUT]]" 1071 "[OPTION]... [INPUT [OUTPUT]]"
1856#ifndef BB_FEATURE_TRIVIAL_HELP 1072#define uniq_full_usage \
1857 "\n\nDiscard all but one of successive identical lines from INPUT\n" 1073 "Discard all but one of successive identical lines from INPUT\n" \
1858 "(or standard input), writing to OUTPUT (or standard output).\n" 1074 "(or standard input), writing to OUTPUT (or standard output).\n" \
1859 "Options:\n" 1075 "Options:\n" \
1860 "\t-c\tprefix lines by the number of occurrences\n" 1076 "\t-c\tprefix lines by the number of occurrences\n" \
1861 "\t-d\tonly print duplicate lines\n" 1077 "\t-d\tonly print duplicate lines\n" \
1862 "\t-u\tonly print unique lines" 1078 "\t-u\tonly print unique lines"
1863#endif
1864#endif
1865DO_COMMA
1866#endif
1867 1079
1868#if defined BB_UNIX2DOS 1080#define unix2dos_trivial_usage \
1869#if defined USAGE_ENUM
1870unix2dos_usage_index
1871#elif defined USAGE_MESSAGES
1872 "< unixfile > dosfile" 1081 "< unixfile > dosfile"
1873#ifndef BB_FEATURE_TRIVIAL_HELP 1082#define unix2dos_full_usage \
1874 "\n\nConverts a text file from unix format to dos format." 1083 "Converts a text file from unix format to dos format."
1875#endif
1876#endif
1877DO_COMMA
1878#endif
1879 1084
1880#if defined BB_UPDATE 1085#define update_trivial_usage \
1881#if defined USAGE_ENUM
1882update_usage_index
1883#elif defined USAGE_MESSAGES
1884 "[options]" 1086 "[options]"
1885#ifndef BB_FEATURE_TRIVIAL_HELP 1087#define update_full_usage \
1886 "\n\nPeriodically flushes filesystem buffers.\n\n" 1088 "Periodically flushes filesystem buffers.\n\n" \
1887 "Options:\n" 1089 "Options:\n" \
1888 "\t-S\tforce use of sync(2) instead of flushing\n" 1090 "\t-S\tforce use of sync(2) instead of flushing\n" \
1889 "\t-s SECS\tcall sync this often (default 30)\n" 1091 "\t-s SECS\tcall sync this often (default 30)\n" \
1890 "\t-f SECS\tflush some buffers this often (default 5)" 1092 "\t-f SECS\tflush some buffers this often (default 5)"
1891#endif
1892#endif
1893DO_COMMA
1894#endif
1895 1093
1896#if defined BB_UPTIME 1094#define uptime_trivial_usage \
1897#if defined USAGE_ENUM
1898uptime_usage_index
1899#elif defined USAGE_MESSAGES
1900 "" 1095 ""
1901#ifndef BB_FEATURE_TRIVIAL_HELP 1096#define uptime_full_usage \
1902 "\n\nDisplay the time since the last boot." 1097 "Display the time since the last boot."
1903#endif
1904#endif
1905DO_COMMA
1906#endif
1907 1098
1908#if defined BB_USLEEP 1099#define usleep_trivial_usage \
1909#if defined USAGE_ENUM
1910usleep_usage_index
1911#elif defined USAGE_MESSAGES
1912 "N" 1100 "N"
1913#ifndef BB_FEATURE_TRIVIAL_HELP 1101#define usleep_full_usage \
1914 "\n\nPause for N microseconds." 1102 "Pause for N microseconds."
1915#endif
1916#endif
1917DO_COMMA
1918#endif
1919 1103
1920#if defined BB_UUDECODE 1104#define uudecode_trivial_usage \
1921#if defined USAGE_ENUM
1922uudecode_usage_index
1923#elif defined USAGE_MESSAGES
1924 "[FILE]..." 1105 "[FILE]..."
1925#ifndef BB_FEATURE_TRIVIAL_HELP 1106#define uudecode_full_usage \
1926 "\n\nUudecode a file that is uuencoded.\n\n" 1107 "Uudecode a file that is uuencoded.\n\n" \
1927 "Options:\n" 1108 "Options:\n" \
1928 "\t-o FILE\tdirect output to FILE" 1109 "\t-o FILE\tdirect output to FILE" \
1929#endif
1930#endif
1931DO_COMMA
1932#endif
1933 1110
1934#if defined BB_UUENCODE 1111#define uuencode_trivial_usage \
1935#if defined USAGE_ENUM
1936uuencode_usage_index
1937#elif defined USAGE_MESSAGES
1938 "[OPTION] [INFILE] REMOTEFILE" 1112 "[OPTION] [INFILE] REMOTEFILE"
1939#ifndef BB_FEATURE_TRIVIAL_HELP 1113#define uuencode_full_usage \
1940 "\n\nUuencode a file.\n\n" 1114 "Uuencode a file.\n\n" \
1941 "Options:\n" 1115 "Options:\n" \
1942 "\t-m\tuse base64 encoding as of RFC1521" 1116 "\t-m\tuse base64 encoding as of RFC1521"
1943#endif
1944#endif
1945DO_COMMA
1946#endif
1947 1117
1948#if defined BB_WATCHDOG 1118#define watchdog_trivial_usage \
1949#if defined USAGE_ENUM
1950watchdog_usage_index
1951#elif defined USAGE_MESSAGES
1952 "dev" 1119 "dev"
1953#ifndef BB_FEATURE_TRIVIAL_HELP 1120#define watchdog_full_usage \
1954 "\n\nPeriodically write to watchdog device \"dev\"" 1121 "Periodically write to watchdog device \"dev\""
1955#endif
1956#endif
1957DO_COMMA
1958#endif
1959 1122
1960#if defined BB_WC 1123#define wc_trivial_usage \
1961#if defined USAGE_ENUM
1962wc_usage_index
1963#elif defined USAGE_MESSAGES
1964 "[OPTION]... [FILE]..." 1124 "[OPTION]... [FILE]..."
1965#ifndef BB_FEATURE_TRIVIAL_HELP 1125#define wc_full_usage \
1966 "\n\nPrint line, word, and byte counts for each FILE, and a total line if\n" 1126 "Print line, word, and byte counts for each FILE, and a total line if\n" \
1967 "more than one FILE is specified. With no FILE, read standard input.\n\n" 1127 "more than one FILE is specified. With no FILE, read standard input.\n\n" \
1968 "Options:\n" 1128 "Options:\n" \
1969 "\t-c\tprint the byte counts\n" 1129 "\t-c\tprint the byte counts\n" \
1970 "\t-l\tprint the newline counts\n" 1130 "\t-l\tprint the newline counts\n" \
1971 1131 "\t-L\tprint the length of the longest line\n" \
1972 "\t-L\tprint the length of the longest line\n"
1973 "\t-w\tprint the word counts" 1132 "\t-w\tprint the word counts"
1974#endif
1975#endif
1976DO_COMMA
1977#endif
1978 1133
1979#if defined BB_WGET 1134#define wget_trivial_usage \
1980#if defined USAGE_ENUM 1135 "[-c] [-O file] url"
1981wget_usage_index 1136#define wget_full_usage \
1982#elif defined USAGE_MESSAGES 1137 "wget retrieves files via HTTP\n\n" \
1983 "[-c] [-O file] url" 1138 "Options:\n" \
1984#ifndef BB_FEATURE_TRIVIAL_HELP 1139 "\t-c\tcontinue retrieval of aborted transfers\n" \
1985 "\n\nwget retrieves files via HTTP\n\n"
1986 "Options:\n"
1987 "\t-c\tcontinue retrieval of aborted transfers\n"
1988 "\t-O\tsave to filename ('-' for stdout)" 1140 "\t-O\tsave to filename ('-' for stdout)"
1989#endif
1990#endif
1991DO_COMMA
1992#endif
1993 1141
1994#if defined BB_WHICH 1142#define which_trivial_usage \
1995#if defined USAGE_ENUM
1996which_usage_index
1997#elif defined USAGE_MESSAGES
1998 "[COMMAND ...]" 1143 "[COMMAND ...]"
1999#ifndef BB_FEATURE_TRIVIAL_HELP 1144#define which_full_usage \
2000 "\n\nLocates a COMMAND." 1145 "Locates a COMMAND."
2001#endif
2002#endif
2003DO_COMMA
2004#endif
2005 1146
2006#if defined BB_WHOAMI 1147#define whoami_trivial_usage \
2007#if defined USAGE_ENUM
2008whoami_usage_index
2009#elif defined USAGE_MESSAGES
2010 "" 1148 ""
2011#ifndef BB_FEATURE_TRIVIAL_HELP 1149#define whoami_full_usage \
2012 "\n\nPrints the user name associated with the current effective user id." 1150 "Prints the user name associated with the current effective user id."
2013#endif
2014#endif
2015DO_COMMA
2016#endif
2017 1151
2018#if defined BB_XARGS 1152#define xargs_trivial_usage \
2019#if defined USAGE_ENUM 1153 "[COMMAND] [ARGS...]"
2020xargs_usage_index 1154#define xargs_full_usage \
2021#elif defined USAGE_MESSAGES 1155 "Executes COMMAND on every item given by standard input."
2022 "[COMMAND] [ARGS...]"
2023#ifndef BB_FEATURE_TRIVIAL_HELP
2024 "\n\nExecutes COMMAND on every item given by standard input."
2025#endif
2026#endif
2027DO_COMMA
2028#endif
2029 1156
2030#if defined BB_YES 1157#define yes_trivial_usage \
2031#if defined USAGE_ENUM
2032yes_usage_index
2033#elif defined USAGE_MESSAGES
2034 "[OPTION]... [STRING]..." 1158 "[OPTION]... [STRING]..."
2035#ifndef BB_FEATURE_TRIVIAL_HELP 1159#define yes_full_usage \
2036 "\n\nRepeatedly outputs a line with all specified STRING(s), or `y'." 1160 "Repeatedly outputs a line with all specified STRING(s), or `y'."
2037#endif
2038#endif
2039DO_COMMA
2040#endif
2041
2042#if defined USAGE_ENUM || defined USAGE_MESSAGES
2043};
2044#endif
2045
2046#undef DOCOMMA
2047#undef USAGE_ENUM
2048#undef USAGE_MESSAGES
2049 1161
1162#define zcat_trivial_usage \
1163 "FILE"
1164#define zcat_full_usage \
1165 "Uncompress to stdout."
diff --git a/utility.c b/utility.c
index cf0aecc80..f96cab5b0 100644
--- a/utility.c
+++ b/utility.c
@@ -54,7 +54,6 @@
54#define bb_need_full_version 54#define bb_need_full_version
55#define BB_DECLARE_EXTERN 55#define BB_DECLARE_EXTERN
56#include "messages.c" 56#include "messages.c"
57#include "usage.h"
58 57
59#include "pwd_grp/pwd.h" 58#include "pwd_grp/pwd.h"
60#include "pwd_grp/grp.h" 59#include "pwd_grp/grp.h"
@@ -81,21 +80,20 @@ static struct BB_applet *applet_using;
81 80
82extern void show_usage(void) 81extern void show_usage(void)
83{ 82{
84 static const char no_help[] = "No help available.\n"; 83 const char *format_string;
85 84 const char *usage_string = usage_messages;
86 const char *usage_string = no_help;
87 int i; 85 int i;
88 86
89 if (applet_using->usage_index >= 0) { 87 for (i = applet_using - applets; i > 0; ) {
90 usage_string = usage_messages; 88 if (!*usage_string++) {
91 for (i=applet_using->usage_index ; i>0 ; ) { 89 --i;
92 if (!*usage_string++) {
93 --i;
94 }
95 } 90 }
96 } 91 }
97 fprintf(stderr, "%s\n\nUsage: %s %s\n\n", full_version, 92 format_string = "%s\n\nUsage: %s %s\n\n";
98 applet_using->name, usage_string); 93 if(*usage_string == 0)
94 format_string = "%s\n\nNo help available.\n\n";
95 fprintf(stderr, format_string,
96 full_version, applet_using->name, usage_string);
99 exit(EXIT_FAILURE); 97 exit(EXIT_FAILURE);
100} 98}
101 99