diff options
author | Matt Kraai <kraai@debian.org> | 2000-07-14 23:28:47 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2000-07-14 23:28:47 +0000 |
commit | 3bd8bd89ee9d0b65bf279e1ecad826a5f2f0a217 (patch) | |
tree | 6a217bf17e7c00e98a47f657015535f21b53cedd | |
parent | 464c5de00d3dfb5f01e866f703d95bbb2bb9443c (diff) | |
download | busybox-w32-3bd8bd89ee9d0b65bf279e1ecad826a5f2f0a217.tar.gz busybox-w32-3bd8bd89ee9d0b65bf279e1ecad826a5f2f0a217.tar.bz2 busybox-w32-3bd8bd89ee9d0b65bf279e1ecad826a5f2f0a217.zip |
Don't use strings directly in calls to usage(). This is in preparation
for their extraction to a separate file.
-rw-r--r-- | chvt.c | 15 | ||||
-rw-r--r-- | console-tools/chvt.c | 15 | ||||
-rw-r--r-- | console-tools/deallocvt.c | 16 | ||||
-rw-r--r-- | coreutils/cut.c | 26 | ||||
-rw-r--r-- | coreutils/dirname.c | 16 | ||||
-rw-r--r-- | coreutils/length.c | 16 | ||||
-rw-r--r-- | coreutils/rmdir.c | 16 | ||||
-rw-r--r-- | coreutils/sync.c | 16 | ||||
-rw-r--r-- | coreutils/test.c | 20 | ||||
-rw-r--r-- | coreutils/yes.c | 16 | ||||
-rw-r--r-- | cp_mv.c | 34 | ||||
-rw-r--r-- | cut.c | 26 | ||||
-rw-r--r-- | deallocvt.c | 16 | ||||
-rw-r--r-- | dirname.c | 16 | ||||
-rw-r--r-- | findutils/which.c | 15 | ||||
-rw-r--r-- | free.c | 16 | ||||
-rw-r--r-- | fsck_minix.c | 33 | ||||
-rw-r--r-- | length.c | 16 | ||||
-rw-r--r-- | miscutils/mktemp.c | 16 | ||||
-rw-r--r-- | mkfs_minix.c | 32 | ||||
-rw-r--r-- | mktemp.c | 16 | ||||
-rw-r--r-- | procps/free.c | 16 | ||||
-rw-r--r-- | procps/ps.c | 19 | ||||
-rw-r--r-- | ps.c | 19 | ||||
-rw-r--r-- | rmdir.c | 16 | ||||
-rw-r--r-- | sync.c | 16 | ||||
-rw-r--r-- | test.c | 20 | ||||
-rw-r--r-- | util-linux/fsck_minix.c | 33 | ||||
-rw-r--r-- | util-linux/mkfs_minix.c | 32 | ||||
-rw-r--r-- | which.c | 15 | ||||
-rw-r--r-- | yes.c | 16 |
31 files changed, 321 insertions, 289 deletions
@@ -15,18 +15,19 @@ | |||
15 | #define VT_ACTIVATE 0x5606 /* make vt active */ | 15 | #define VT_ACTIVATE 0x5606 /* make vt active */ |
16 | #define VT_WAITACTIVE 0x5607 /* wait for vt active */ | 16 | #define VT_WAITACTIVE 0x5607 /* wait for vt active */ |
17 | 17 | ||
18 | const char chvt_usage[] = | ||
19 | "chvt N\n" | ||
20 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
21 | "\nChanges the foreground virtual terminal to /dev/ttyN\n" | ||
22 | #endif | ||
23 | ; | ||
18 | 24 | ||
19 | int chvt_main(int argc, char **argv) | 25 | int chvt_main(int argc, char **argv) |
20 | { | 26 | { |
21 | int fd, num; | 27 | int fd, num; |
22 | 28 | ||
23 | if ((argc != 2) || (**(argv + 1) == '-')) { | 29 | if ((argc != 2) || (**(argv + 1) == '-')) |
24 | usage ("chvt N\n" | 30 | usage (chvt_usage); |
25 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
26 | "\nChanges the foreground virtual terminal to /dev/ttyN\n" | ||
27 | #endif | ||
28 | ); | ||
29 | } | ||
30 | fd = get_console_fd("/dev/console"); | 31 | fd = get_console_fd("/dev/console"); |
31 | num = atoi(argv[1]); | 32 | num = atoi(argv[1]); |
32 | if (ioctl(fd, VT_ACTIVATE, num)) { | 33 | if (ioctl(fd, VT_ACTIVATE, num)) { |
diff --git a/console-tools/chvt.c b/console-tools/chvt.c index c5c86b613..ab0e9218f 100644 --- a/console-tools/chvt.c +++ b/console-tools/chvt.c | |||
@@ -15,18 +15,19 @@ | |||
15 | #define VT_ACTIVATE 0x5606 /* make vt active */ | 15 | #define VT_ACTIVATE 0x5606 /* make vt active */ |
16 | #define VT_WAITACTIVE 0x5607 /* wait for vt active */ | 16 | #define VT_WAITACTIVE 0x5607 /* wait for vt active */ |
17 | 17 | ||
18 | const char chvt_usage[] = | ||
19 | "chvt N\n" | ||
20 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
21 | "\nChanges the foreground virtual terminal to /dev/ttyN\n" | ||
22 | #endif | ||
23 | ; | ||
18 | 24 | ||
19 | int chvt_main(int argc, char **argv) | 25 | int chvt_main(int argc, char **argv) |
20 | { | 26 | { |
21 | int fd, num; | 27 | int fd, num; |
22 | 28 | ||
23 | if ((argc != 2) || (**(argv + 1) == '-')) { | 29 | if ((argc != 2) || (**(argv + 1) == '-')) |
24 | usage ("chvt N\n" | 30 | usage (chvt_usage); |
25 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
26 | "\nChanges the foreground virtual terminal to /dev/ttyN\n" | ||
27 | #endif | ||
28 | ); | ||
29 | } | ||
30 | fd = get_console_fd("/dev/console"); | 31 | fd = get_console_fd("/dev/console"); |
31 | num = atoi(argv[1]); | 32 | num = atoi(argv[1]); |
32 | if (ioctl(fd, VT_ACTIVATE, num)) { | 33 | if (ioctl(fd, VT_ACTIVATE, num)) { |
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index 906f3a9fa..042de8649 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c | |||
@@ -13,19 +13,19 @@ | |||
13 | /* From <linux/vt.h> */ | 13 | /* From <linux/vt.h> */ |
14 | #define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ | 14 | #define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ |
15 | 15 | ||
16 | const char deallocvt_usage[] = | ||
17 | "deallocvt N\n" | ||
18 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
19 | "\nDeallocate unused virtual terminal /dev/ttyN\n" | ||
20 | #endif | ||
21 | ; | ||
16 | 22 | ||
17 | int deallocvt_main(int argc, char *argv[]) | 23 | int deallocvt_main(int argc, char *argv[]) |
18 | { | 24 | { |
19 | int fd, num, i; | 25 | int fd, num, i; |
20 | 26 | ||
21 | if ((argc != 2) || (**(argv + 1) == '-')) { | 27 | if ((argc != 2) || (**(argv + 1) == '-')) |
22 | usage | 28 | usage(deallocvt_usage); |
23 | ("deallocvt N\n" | ||
24 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
25 | "\nDeallocate unused virtual terminal /dev/ttyN\n" | ||
26 | #endif | ||
27 | ); | ||
28 | } | ||
29 | 29 | ||
30 | fd = get_console_fd("/dev/console"); | 30 | fd = get_console_fd("/dev/console"); |
31 | 31 | ||
diff --git a/coreutils/cut.c b/coreutils/cut.c index 783d526a5..08b4586a4 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -206,6 +206,19 @@ void cut() | |||
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | const char cut_usage[] = | ||
210 | "cut [OPTION]... [FILE]...\n" | ||
211 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
212 | "\nPrints selected fields from each input FILE to standard output.\n\n" | ||
213 | "Options:\n" | ||
214 | "\t-b LIST\tOutput only bytes from LIST\n" | ||
215 | "\t-c LIST\tOutput only characters from LIST\n" | ||
216 | "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n" | ||
217 | "\t-s\tOnly output Lines if the include DELIM\n" | ||
218 | "\t-f N\tPrint only these fields\n" | ||
219 | "\t-n\tIgnored\n" | ||
220 | #endif | ||
221 | ; | ||
209 | 222 | ||
210 | int cut_main(int argc, char **argv) | 223 | int cut_main(int argc, char **argv) |
211 | { | 224 | { |
@@ -213,18 +226,7 @@ int cut_main(int argc, char **argv) | |||
213 | int numberFilenames = 0; | 226 | int numberFilenames = 0; |
214 | 227 | ||
215 | if (argc == 1 || strcmp(argv[1], dash_dash_help)==0) | 228 | if (argc == 1 || strcmp(argv[1], dash_dash_help)==0) |
216 | usage( "cut [OPTION]... [FILE]...\n" | 229 | usage(cut_usage); |
217 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
218 | "\nPrints selected fields from each input FILE to standard output.\n\n" | ||
219 | "Options:\n" | ||
220 | "\t-b LIST\tOutput only bytes from LIST\n" | ||
221 | "\t-c LIST\tOutput only characters from LIST\n" | ||
222 | "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n" | ||
223 | "\t-s\tOnly output Lines if the include DELIM\n" | ||
224 | "\t-f N\tPrint only these fields\n" | ||
225 | "\t-n\tIgnored\n" | ||
226 | #endif | ||
227 | ); | ||
228 | 230 | ||
229 | while (i < argc) { | 231 | while (i < argc) { |
230 | if (argv[i][0] == '-') { | 232 | if (argv[i][0] == '-') { |
diff --git a/coreutils/dirname.c b/coreutils/dirname.c index 847842eab..0b60ceb88 100644 --- a/coreutils/dirname.c +++ b/coreutils/dirname.c | |||
@@ -23,17 +23,19 @@ | |||
23 | #include "internal.h" | 23 | #include "internal.h" |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | 25 | ||
26 | const char dirname_usage[] = | ||
27 | "dirname [FILENAME ...]\n" | ||
28 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
29 | "\nStrips non-directory suffix from FILENAME\n" | ||
30 | #endif | ||
31 | ; | ||
32 | |||
26 | extern int dirname_main(int argc, char **argv) | 33 | extern int dirname_main(int argc, char **argv) |
27 | { | 34 | { |
28 | char* s; | 35 | char* s; |
29 | 36 | ||
30 | if ((argc < 2) || (**(argv + 1) == '-')) { | 37 | if ((argc < 2) || (**(argv + 1) == '-')) |
31 | usage("dirname [FILENAME ...]\n" | 38 | usage(dirname_usage); |
32 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
33 | "\nStrips non-directory suffix from FILENAME\n" | ||
34 | #endif | ||
35 | ); | ||
36 | } | ||
37 | argv++; | 39 | argv++; |
38 | 40 | ||
39 | s=*argv+strlen(*argv)-1; | 41 | s=*argv+strlen(*argv)-1; |
diff --git a/coreutils/length.c b/coreutils/length.c index c7df21611..82f50c159 100644 --- a/coreutils/length.c +++ b/coreutils/length.c | |||
@@ -4,15 +4,17 @@ | |||
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include <stdio.h> | 5 | #include <stdio.h> |
6 | 6 | ||
7 | extern int length_main(int argc, char **argv) | 7 | const char length_usage[] = |
8 | { | 8 | "length STRING\n" |
9 | if (argc != 2 || **(argv + 1) == '-') { | ||
10 | usage("length STRING\n" | ||
11 | #ifndef BB_FEATURE_TRIVIAL_HELP | 9 | #ifndef BB_FEATURE_TRIVIAL_HELP |
12 | "\nPrints out the length of the specified STRING.\n" | 10 | "\nPrints out the length of the specified STRING.\n" |
13 | #endif | 11 | #endif |
14 | ); | 12 | ; |
15 | } | 13 | |
14 | extern int length_main(int argc, char **argv) | ||
15 | { | ||
16 | if (argc != 2 || **(argv + 1) == '-') | ||
17 | usage(length_usage); | ||
16 | printf("%lu\n", (long)strlen(argv[1])); | 18 | printf("%lu\n", (long)strlen(argv[1])); |
17 | return (TRUE); | 19 | return (TRUE); |
18 | } | 20 | } |
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index 4edb9b6b3..3c3533fae 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c | |||
@@ -26,17 +26,17 @@ | |||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | const char rmdir_usage[] = | ||
30 | "rmdir [OPTION]... DIRECTORY...\n" | ||
31 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
32 | "\nRemove the DIRECTORY(ies), if they are empty.\n" | ||
33 | #endif | ||
34 | ; | ||
29 | 35 | ||
30 | extern int rmdir_main(int argc, char **argv) | 36 | extern int rmdir_main(int argc, char **argv) |
31 | { | 37 | { |
32 | if (argc == 1 || **(argv + 1) == '-') { | 38 | if (argc == 1 || **(argv + 1) == '-') |
33 | usage | 39 | usage(rmdir_usage); |
34 | ("rmdir [OPTION]... DIRECTORY...\n" | ||
35 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
36 | "\nRemove the DIRECTORY(ies), if they are empty.\n" | ||
37 | #endif | ||
38 | ); | ||
39 | } | ||
40 | 40 | ||
41 | while (--argc > 0) { | 41 | while (--argc > 0) { |
42 | if (rmdir(*(++argv)) == -1) { | 42 | if (rmdir(*(++argv)) == -1) { |
diff --git a/coreutils/sync.c b/coreutils/sync.c index db35d72fa..f7c14b04c 100644 --- a/coreutils/sync.c +++ b/coreutils/sync.c | |||
@@ -24,14 +24,16 @@ | |||
24 | #include "internal.h" | 24 | #include "internal.h" |
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | 26 | ||
27 | extern int sync_main(int argc, char **argv) | 27 | const char sync_usage[] = |
28 | { | 28 | "sync\n" |
29 | if (argc > 1 && **(argv + 1) == '-') { | ||
30 | usage("sync\n" | ||
31 | #ifndef BB_FEATURE_TRIVIAL_HELP | 29 | #ifndef BB_FEATURE_TRIVIAL_HELP |
32 | "\nWrite all buffered filesystem blocks to disk.\n" | 30 | "\nWrite all buffered filesystem blocks to disk.\n" |
33 | #endif | 31 | #endif |
34 | ); | 32 | ; |
35 | } | 33 | |
34 | extern int sync_main(int argc, char **argv) | ||
35 | { | ||
36 | if (argc > 1 && **(argv + 1) == '-') | ||
37 | usage(sync_usage); | ||
36 | return(sync()); | 38 | return(sync()); |
37 | } | 39 | } |
diff --git a/coreutils/test.c b/coreutils/test.c index 175cb5d05..bf1622cde 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -178,6 +178,15 @@ static int test_eaccess(); | |||
178 | static int is_a_group_member(); | 178 | static int is_a_group_member(); |
179 | static void initialize_group_array(); | 179 | static void initialize_group_array(); |
180 | 180 | ||
181 | const char test_usage[] = | ||
182 | "test EXPRESSION\n" | ||
183 | "or [ EXPRESSION ]\n" | ||
184 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
185 | "\nChecks file types and compares values returning an exit\n" | ||
186 | "code determined by the value of EXPRESSION.\n" | ||
187 | #endif | ||
188 | ; | ||
189 | |||
181 | extern int | 190 | extern int |
182 | test_main(int argc, char** argv) | 191 | test_main(int argc, char** argv) |
183 | { | 192 | { |
@@ -188,15 +197,8 @@ test_main(int argc, char** argv) | |||
188 | fatalError("missing ]\n"); | 197 | fatalError("missing ]\n"); |
189 | argv[argc] = NULL; | 198 | argv[argc] = NULL; |
190 | } | 199 | } |
191 | if (strcmp(argv[1], dash_dash_help) == 0) { | 200 | if (strcmp(argv[1], dash_dash_help) == 0) |
192 | usage("test EXPRESSION\n" | 201 | usage(test_usage); |
193 | "or [ EXPRESSION ]\n" | ||
194 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
195 | "\nChecks file types and compares values returning an exit\n" | ||
196 | "code determined by the value of EXPRESSION.\n" | ||
197 | #endif | ||
198 | ); | ||
199 | } | ||
200 | 202 | ||
201 | /* Implement special cases from POSIX.2, section 4.62.4 */ | 203 | /* Implement special cases from POSIX.2, section 4.62.4 */ |
202 | switch (argc) { | 204 | switch (argc) { |
diff --git a/coreutils/yes.c b/coreutils/yes.c index 1718af4bb..0191bb003 100644 --- a/coreutils/yes.c +++ b/coreutils/yes.c | |||
@@ -23,17 +23,19 @@ | |||
23 | #include "internal.h" | 23 | #include "internal.h" |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | 25 | ||
26 | const char yes_usage[] = | ||
27 | "yes [OPTION]... [STRING]...\n" | ||
28 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
29 | "\nRepeatedly outputs a line with all specified STRING(s), or `y'.\n" | ||
30 | #endif | ||
31 | ; | ||
32 | |||
26 | extern int yes_main(int argc, char **argv) | 33 | extern int yes_main(int argc, char **argv) |
27 | { | 34 | { |
28 | int i; | 35 | int i; |
29 | 36 | ||
30 | if (argc >= 2 && *argv[1] == '-') { | 37 | if (argc >= 2 && *argv[1] == '-') |
31 | usage("yes [OPTION]... [STRING]...\n" | 38 | usage(yes_usage); |
32 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
33 | "\nRepeatedly outputs a line with all specified STRING(s), or `y'.\n" | ||
34 | #endif | ||
35 | ); | ||
36 | } | ||
37 | 39 | ||
38 | if (argc == 1) { | 40 | if (argc == 1) { |
39 | while (1) | 41 | while (1) |
@@ -46,25 +46,33 @@ | |||
46 | #define is_cp 0 | 46 | #define is_cp 0 |
47 | #define is_mv 1 | 47 | #define is_mv 1 |
48 | static int dz_i; /* index into cp_mv_usage */ | 48 | static int dz_i; /* index into cp_mv_usage */ |
49 | static const char *cp_mv_usage[] = /* .rodata */ | 49 | |
50 | { | 50 | const char cp_usage[] = |
51 | "cp [OPTION]... SOURCE DEST\n" | 51 | "cp [OPTION]... SOURCE DEST\n" |
52 | " or: cp [OPTION]... SOURCE... DIRECTORY\n" | 52 | " or: cp [OPTION]... SOURCE... DIRECTORY\n" |
53 | #ifndef BB_FEATURE_TRIVIAL_HELP | 53 | #ifndef BB_FEATURE_TRIVIAL_HELP |
54 | "\nCopies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" | 54 | "\nCopies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" |
55 | "\n" | 55 | "\n" |
56 | "\t-a\tSame as -dpR\n" | 56 | "\t-a\tSame as -dpR\n" |
57 | "\t-d\tPreserves links\n" | 57 | "\t-d\tPreserves links\n" |
58 | "\t-p\tPreserves file attributes if possible\n" | 58 | "\t-p\tPreserves file attributes if possible\n" |
59 | "\t-f\tforce (implied; ignored) - always set\n" | 59 | "\t-f\tforce (implied; ignored) - always set\n" |
60 | "\t-R\tCopies directories recursively\n" | 60 | "\t-R\tCopies directories recursively\n" |
61 | #endif | 61 | #endif |
62 | , | 62 | ; |
63 | |||
64 | const char mv_usage[] = | ||
63 | "mv SOURCE DEST\n" | 65 | "mv SOURCE DEST\n" |
64 | " or: mv SOURCE... DIRECTORY\n" | 66 | " or: mv SOURCE... DIRECTORY\n" |
65 | #ifndef BB_FEATURE_TRIVIAL_HELP | 67 | #ifndef BB_FEATURE_TRIVIAL_HELP |
66 | "\nRename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n" | 68 | "\nRename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n" |
67 | #endif | 69 | #endif |
70 | ; | ||
71 | |||
72 | static const char *cp_mv_usage[] = /* .rodata */ | ||
73 | { | ||
74 | cp_usage, | ||
75 | mv_usage | ||
68 | }; | 76 | }; |
69 | 77 | ||
70 | static int recursiveFlag; | 78 | static int recursiveFlag; |
@@ -206,6 +206,19 @@ void cut() | |||
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | const char cut_usage[] = | ||
210 | "cut [OPTION]... [FILE]...\n" | ||
211 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
212 | "\nPrints selected fields from each input FILE to standard output.\n\n" | ||
213 | "Options:\n" | ||
214 | "\t-b LIST\tOutput only bytes from LIST\n" | ||
215 | "\t-c LIST\tOutput only characters from LIST\n" | ||
216 | "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n" | ||
217 | "\t-s\tOnly output Lines if the include DELIM\n" | ||
218 | "\t-f N\tPrint only these fields\n" | ||
219 | "\t-n\tIgnored\n" | ||
220 | #endif | ||
221 | ; | ||
209 | 222 | ||
210 | int cut_main(int argc, char **argv) | 223 | int cut_main(int argc, char **argv) |
211 | { | 224 | { |
@@ -213,18 +226,7 @@ int cut_main(int argc, char **argv) | |||
213 | int numberFilenames = 0; | 226 | int numberFilenames = 0; |
214 | 227 | ||
215 | if (argc == 1 || strcmp(argv[1], dash_dash_help)==0) | 228 | if (argc == 1 || strcmp(argv[1], dash_dash_help)==0) |
216 | usage( "cut [OPTION]... [FILE]...\n" | 229 | usage(cut_usage); |
217 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
218 | "\nPrints selected fields from each input FILE to standard output.\n\n" | ||
219 | "Options:\n" | ||
220 | "\t-b LIST\tOutput only bytes from LIST\n" | ||
221 | "\t-c LIST\tOutput only characters from LIST\n" | ||
222 | "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n" | ||
223 | "\t-s\tOnly output Lines if the include DELIM\n" | ||
224 | "\t-f N\tPrint only these fields\n" | ||
225 | "\t-n\tIgnored\n" | ||
226 | #endif | ||
227 | ); | ||
228 | 230 | ||
229 | while (i < argc) { | 231 | while (i < argc) { |
230 | if (argv[i][0] == '-') { | 232 | if (argv[i][0] == '-') { |
diff --git a/deallocvt.c b/deallocvt.c index 906f3a9fa..042de8649 100644 --- a/deallocvt.c +++ b/deallocvt.c | |||
@@ -13,19 +13,19 @@ | |||
13 | /* From <linux/vt.h> */ | 13 | /* From <linux/vt.h> */ |
14 | #define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ | 14 | #define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ |
15 | 15 | ||
16 | const char deallocvt_usage[] = | ||
17 | "deallocvt N\n" | ||
18 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
19 | "\nDeallocate unused virtual terminal /dev/ttyN\n" | ||
20 | #endif | ||
21 | ; | ||
16 | 22 | ||
17 | int deallocvt_main(int argc, char *argv[]) | 23 | int deallocvt_main(int argc, char *argv[]) |
18 | { | 24 | { |
19 | int fd, num, i; | 25 | int fd, num, i; |
20 | 26 | ||
21 | if ((argc != 2) || (**(argv + 1) == '-')) { | 27 | if ((argc != 2) || (**(argv + 1) == '-')) |
22 | usage | 28 | usage(deallocvt_usage); |
23 | ("deallocvt N\n" | ||
24 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
25 | "\nDeallocate unused virtual terminal /dev/ttyN\n" | ||
26 | #endif | ||
27 | ); | ||
28 | } | ||
29 | 29 | ||
30 | fd = get_console_fd("/dev/console"); | 30 | fd = get_console_fd("/dev/console"); |
31 | 31 | ||
@@ -23,17 +23,19 @@ | |||
23 | #include "internal.h" | 23 | #include "internal.h" |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | 25 | ||
26 | const char dirname_usage[] = | ||
27 | "dirname [FILENAME ...]\n" | ||
28 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
29 | "\nStrips non-directory suffix from FILENAME\n" | ||
30 | #endif | ||
31 | ; | ||
32 | |||
26 | extern int dirname_main(int argc, char **argv) | 33 | extern int dirname_main(int argc, char **argv) |
27 | { | 34 | { |
28 | char* s; | 35 | char* s; |
29 | 36 | ||
30 | if ((argc < 2) || (**(argv + 1) == '-')) { | 37 | if ((argc < 2) || (**(argv + 1) == '-')) |
31 | usage("dirname [FILENAME ...]\n" | 38 | usage(dirname_usage); |
32 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
33 | "\nStrips non-directory suffix from FILENAME\n" | ||
34 | #endif | ||
35 | ); | ||
36 | } | ||
37 | argv++; | 39 | argv++; |
38 | 40 | ||
39 | s=*argv+strlen(*argv)-1; | 41 | s=*argv+strlen(*argv)-1; |
diff --git a/findutils/which.c b/findutils/which.c index 8d4422a78..186bfdad7 100644 --- a/findutils/which.c +++ b/findutils/which.c | |||
@@ -26,6 +26,12 @@ | |||
26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
27 | #include <sys/param.h> | 27 | #include <sys/param.h> |
28 | 28 | ||
29 | const char which_usage[] = | ||
30 | "which [COMMAND ...]\n" | ||
31 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
32 | "\nLocates a COMMAND.\n" | ||
33 | #endif | ||
34 | ; | ||
29 | 35 | ||
30 | extern int which_main(int argc, char **argv) | 36 | extern int which_main(int argc, char **argv) |
31 | { | 37 | { |
@@ -34,13 +40,8 @@ extern int which_main(int argc, char **argv) | |||
34 | struct stat filestat; | 40 | struct stat filestat; |
35 | int count = 0; | 41 | int count = 0; |
36 | 42 | ||
37 | if (argc <= 1 || **(argv + 1) == '-') { | 43 | if (argc <= 1 || **(argv + 1) == '-') |
38 | usage("which [COMMAND ...]\n" | 44 | usage(which_usage); |
39 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
40 | "\nLocates a COMMAND.\n" | ||
41 | #endif | ||
42 | ); | ||
43 | } | ||
44 | argc--; | 45 | argc--; |
45 | 46 | ||
46 | path_list = getenv("PATH"); | 47 | path_list = getenv("PATH"); |
@@ -25,6 +25,12 @@ | |||
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | #include <errno.h> | 26 | #include <errno.h> |
27 | 27 | ||
28 | const char free_usage[] = | ||
29 | "free\n" | ||
30 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
31 | "\nDisplays the amount of free and used system memory\n" | ||
32 | #endif | ||
33 | ; | ||
28 | 34 | ||
29 | extern int free_main(int argc, char **argv) | 35 | extern int free_main(int argc, char **argv) |
30 | { | 36 | { |
@@ -53,14 +59,8 @@ extern int free_main(int argc, char **argv) | |||
53 | info.sharedram*=info.mem_unit; | 59 | info.sharedram*=info.mem_unit; |
54 | info.bufferram*=info.mem_unit; | 60 | info.bufferram*=info.mem_unit; |
55 | } | 61 | } |
56 | if (argc > 1 && **(argv + 1) == '-') { | 62 | if (argc > 1 && **(argv + 1) == '-') |
57 | usage("free\n" | 63 | usage(free_usage); |
58 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
59 | "\nDisplays the amount of free and used system memory\n" | ||
60 | #endif | ||
61 | ); | ||
62 | } | ||
63 | |||
64 | 64 | ||
65 | printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free", | 65 | printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free", |
66 | "shared", "buffers"); | 66 | "shared", "buffers"); |
diff --git a/fsck_minix.c b/fsck_minix.c index 74281a71e..ea27c236c 100644 --- a/fsck_minix.c +++ b/fsck_minix.c | |||
@@ -288,25 +288,24 @@ static void leave(int status) | |||
288 | exit(status); | 288 | exit(status); |
289 | } | 289 | } |
290 | 290 | ||
291 | static void show_usage(void) | 291 | const char fsck_minix_usage[] = |
292 | { | 292 | "Usage: fsck.minix [-larvsmf] /dev/name\n" |
293 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", | ||
294 | BB_VER, BB_BT); | ||
295 | fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n", applet_name); | ||
296 | #ifndef BB_FEATURE_TRIVIAL_HELP | 293 | #ifndef BB_FEATURE_TRIVIAL_HELP |
297 | fprintf(stderr, | 294 | "\nPerforms a consistency check for MINIX filesystems.\n\n" |
298 | "\nPerforms a consistency check for MINIX filesystems.\n\n"); | 295 | "Options:\n" |
299 | fprintf(stderr, "Options:\n"); | 296 | "\t-l\tLists all filenames\n" |
300 | fprintf(stderr, "\t-l\tLists all filenames\n"); | 297 | "\t-r\tPerform interactive repairs\n" |
301 | fprintf(stderr, "\t-r\tPerform interactive repairs\n"); | 298 | "\t-a\tPerform automatic repairs\n" |
302 | fprintf(stderr, "\t-a\tPerform automatic repairs\n"); | 299 | "\t-v\tverbose\n" |
303 | fprintf(stderr, "\t-v\tverbose\n"); | 300 | "\t-s\tOutputs super-block information\n" |
304 | fprintf(stderr, "\t-s\tOutputs super-block information\n"); | 301 | "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n" |
305 | fprintf(stderr, | 302 | "\t-f\tForce file system check.\n\n" |
306 | "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n"); | ||
307 | fprintf(stderr, "\t-f\tForce file system check.\n\n"); | ||
308 | #endif | 303 | #endif |
309 | leave(16); | 304 | ; |
305 | |||
306 | static void show_usage(void) | ||
307 | { | ||
308 | usage(fsck_minix_usage); | ||
310 | } | 309 | } |
311 | 310 | ||
312 | static void die(const char *str) | 311 | static void die(const char *str) |
@@ -4,15 +4,17 @@ | |||
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include <stdio.h> | 5 | #include <stdio.h> |
6 | 6 | ||
7 | extern int length_main(int argc, char **argv) | 7 | const char length_usage[] = |
8 | { | 8 | "length STRING\n" |
9 | if (argc != 2 || **(argv + 1) == '-') { | ||
10 | usage("length STRING\n" | ||
11 | #ifndef BB_FEATURE_TRIVIAL_HELP | 9 | #ifndef BB_FEATURE_TRIVIAL_HELP |
12 | "\nPrints out the length of the specified STRING.\n" | 10 | "\nPrints out the length of the specified STRING.\n" |
13 | #endif | 11 | #endif |
14 | ); | 12 | ; |
15 | } | 13 | |
14 | extern int length_main(int argc, char **argv) | ||
15 | { | ||
16 | if (argc != 2 || **(argv + 1) == '-') | ||
17 | usage(length_usage); | ||
16 | printf("%lu\n", (long)strlen(argv[1])); | 18 | printf("%lu\n", (long)strlen(argv[1])); |
17 | return (TRUE); | 19 | return (TRUE); |
18 | } | 20 | } |
diff --git a/miscutils/mktemp.c b/miscutils/mktemp.c index 87792cb18..247d16d24 100644 --- a/miscutils/mktemp.c +++ b/miscutils/mktemp.c | |||
@@ -26,18 +26,20 @@ | |||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | const char mktemp_usage[] = | ||
30 | "mktemp [-q] TEMPLATE\n" | ||
31 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
32 | "\nCreates a temporary file with its name based on TEMPLATE.\n" | ||
33 | "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX).\n" | ||
34 | #endif | ||
35 | ; | ||
29 | 36 | ||
30 | extern int mktemp_main(int argc, char **argv) | 37 | extern int mktemp_main(int argc, char **argv) |
31 | { | 38 | { |
32 | if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q"))) | 39 | if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q"))) |
33 | usage ("mktemp [-q] TEMPLATE\n" | 40 | usage(mktemp_usage); |
34 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
35 | "\nCreates a temporary file with its name based on TEMPLATE.\n" | ||
36 | "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX).\n" | ||
37 | #endif | ||
38 | ); | ||
39 | if(mkstemp(argv[argc-1]) < 0) | 41 | if(mkstemp(argv[argc-1]) < 0) |
40 | exit(FALSE); | 42 | exit(FALSE); |
41 | (void) puts(argv[argc-1]); | 43 | (void) puts(argv[argc-1]); |
42 | return(TRUE); | 44 | return(TRUE); |
43 | } | 45 | } |
diff --git a/mkfs_minix.c b/mkfs_minix.c index e4dedaf82..9ae4b569c 100644 --- a/mkfs_minix.c +++ b/mkfs_minix.c | |||
@@ -267,27 +267,23 @@ static volatile void die(char *str) | |||
267 | exit(8); | 267 | exit(8); |
268 | } | 268 | } |
269 | 269 | ||
270 | const char mkfs_minix_usage[] = | ||
271 | "mkfs.minix [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n" | ||
272 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
273 | "\nMake a MINIX filesystem.\n\n" | ||
274 | "Options:\n" | ||
275 | "\t-c\t\tCheck the device for bad blocks\n" | ||
276 | "\t-n [14|30]\tSpecify the maximum length of filenames\n" | ||
277 | "\t-i INODES\tSpecify the number of inodes for the filesystem\n" | ||
278 | "\t-l FILENAME\tRead the bad blocks list from FILENAME\n" | ||
279 | "\t-v\t\tMake a Minix version 2 filesystem\n\n" | ||
280 | #endif | ||
281 | ; | ||
282 | |||
270 | static volatile void show_usage() __attribute__ ((noreturn)); | 283 | static volatile void show_usage() __attribute__ ((noreturn)); |
271 | static volatile void show_usage() | 284 | static volatile void show_usage() |
272 | { | 285 | { |
273 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", | 286 | usage(mkfs_minix_usage); |
274 | BB_VER, BB_BT); | ||
275 | fprintf(stderr, | ||
276 | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", | ||
277 | applet_name); | ||
278 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
279 | fprintf(stderr, "\nMake a MINIX filesystem.\n\n"); | ||
280 | fprintf(stderr, "Options:\n"); | ||
281 | fprintf(stderr, "\t-c\t\tCheck the device for bad blocks\n"); | ||
282 | fprintf(stderr, | ||
283 | "\t-n [14|30]\tSpecify the maximum length of filenames\n"); | ||
284 | fprintf(stderr, | ||
285 | "\t-i INODES\tSpecify the number of inodes for the filesystem\n"); | ||
286 | fprintf(stderr, | ||
287 | "\t-l FILENAME\tRead the bad blocks list from FILENAME\n"); | ||
288 | fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n"); | ||
289 | #endif | ||
290 | exit(16); | ||
291 | } | 287 | } |
292 | 288 | ||
293 | /* | 289 | /* |
@@ -26,18 +26,20 @@ | |||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | const char mktemp_usage[] = | ||
30 | "mktemp [-q] TEMPLATE\n" | ||
31 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
32 | "\nCreates a temporary file with its name based on TEMPLATE.\n" | ||
33 | "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX).\n" | ||
34 | #endif | ||
35 | ; | ||
29 | 36 | ||
30 | extern int mktemp_main(int argc, char **argv) | 37 | extern int mktemp_main(int argc, char **argv) |
31 | { | 38 | { |
32 | if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q"))) | 39 | if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q"))) |
33 | usage ("mktemp [-q] TEMPLATE\n" | 40 | usage(mktemp_usage); |
34 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
35 | "\nCreates a temporary file with its name based on TEMPLATE.\n" | ||
36 | "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX).\n" | ||
37 | #endif | ||
38 | ); | ||
39 | if(mkstemp(argv[argc-1]) < 0) | 41 | if(mkstemp(argv[argc-1]) < 0) |
40 | exit(FALSE); | 42 | exit(FALSE); |
41 | (void) puts(argv[argc-1]); | 43 | (void) puts(argv[argc-1]); |
42 | return(TRUE); | 44 | return(TRUE); |
43 | } | 45 | } |
diff --git a/procps/free.c b/procps/free.c index 997430b39..7c9d7f10a 100644 --- a/procps/free.c +++ b/procps/free.c | |||
@@ -25,6 +25,12 @@ | |||
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | #include <errno.h> | 26 | #include <errno.h> |
27 | 27 | ||
28 | const char free_usage[] = | ||
29 | "free\n" | ||
30 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
31 | "\nDisplays the amount of free and used system memory\n" | ||
32 | #endif | ||
33 | ; | ||
28 | 34 | ||
29 | extern int free_main(int argc, char **argv) | 35 | extern int free_main(int argc, char **argv) |
30 | { | 36 | { |
@@ -53,14 +59,8 @@ extern int free_main(int argc, char **argv) | |||
53 | info.sharedram*=info.mem_unit; | 59 | info.sharedram*=info.mem_unit; |
54 | info.bufferram*=info.mem_unit; | 60 | info.bufferram*=info.mem_unit; |
55 | } | 61 | } |
56 | if (argc > 1 && **(argv + 1) == '-') { | 62 | if (argc > 1 && **(argv + 1) == '-') |
57 | usage("free\n" | 63 | usage(free_usage); |
58 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
59 | "\nDisplays the amount of free and used system memory\n" | ||
60 | #endif | ||
61 | ); | ||
62 | } | ||
63 | |||
64 | 64 | ||
65 | printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free", | 65 | printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free", |
66 | "shared", "buffers"); | 66 | "shared", "buffers"); |
diff --git a/procps/ps.c b/procps/ps.c index b070e3984..74e79f5f8 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -114,6 +114,13 @@ static void parse_proc_status(char *S, proc_t * P) | |||
114 | 114 | ||
115 | } | 115 | } |
116 | 116 | ||
117 | const char ps_usage[] = | ||
118 | "ps\n" | ||
119 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
120 | "\nReport process status\n" | ||
121 | "\nThis version of ps accepts no options.\n" | ||
122 | #endif | ||
123 | ; | ||
117 | 124 | ||
118 | extern int ps_main(int argc, char **argv) | 125 | extern int ps_main(int argc, char **argv) |
119 | { | 126 | { |
@@ -134,14 +141,8 @@ extern int ps_main(int argc, char **argv) | |||
134 | 141 | ||
135 | 142 | ||
136 | 143 | ||
137 | if (argc > 1 && strcmp(argv[1], dash_dash_help) == 0) { | 144 | if (argc > 1 && strcmp(argv[1], dash_dash_help) == 0) |
138 | usage ("ps\n" | 145 | usage(ps_usage); |
139 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
140 | "\nReport process status\n" | ||
141 | "\nThis version of ps accepts no options.\n" | ||
142 | #endif | ||
143 | ); | ||
144 | } | ||
145 | 146 | ||
146 | dir = opendir("/proc"); | 147 | dir = opendir("/proc"); |
147 | if (!dir) | 148 | if (!dir) |
@@ -223,7 +224,7 @@ extern int ps_main(int argc, char **argv) | |||
223 | #endif | 224 | #endif |
224 | 225 | ||
225 | if (argc > 1 && **(argv + 1) == '-') | 226 | if (argc > 1 && **(argv + 1) == '-') |
226 | usage("ps-devps\n\nReport process status\n\nThis version of ps accepts no options.\n\n"); | 227 | usage(ps_usage); |
227 | 228 | ||
228 | /* open device */ | 229 | /* open device */ |
229 | fd = open(device, O_RDONLY); | 230 | fd = open(device, O_RDONLY); |
@@ -114,6 +114,13 @@ static void parse_proc_status(char *S, proc_t * P) | |||
114 | 114 | ||
115 | } | 115 | } |
116 | 116 | ||
117 | const char ps_usage[] = | ||
118 | "ps\n" | ||
119 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
120 | "\nReport process status\n" | ||
121 | "\nThis version of ps accepts no options.\n" | ||
122 | #endif | ||
123 | ; | ||
117 | 124 | ||
118 | extern int ps_main(int argc, char **argv) | 125 | extern int ps_main(int argc, char **argv) |
119 | { | 126 | { |
@@ -134,14 +141,8 @@ extern int ps_main(int argc, char **argv) | |||
134 | 141 | ||
135 | 142 | ||
136 | 143 | ||
137 | if (argc > 1 && strcmp(argv[1], dash_dash_help) == 0) { | 144 | if (argc > 1 && strcmp(argv[1], dash_dash_help) == 0) |
138 | usage ("ps\n" | 145 | usage(ps_usage); |
139 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
140 | "\nReport process status\n" | ||
141 | "\nThis version of ps accepts no options.\n" | ||
142 | #endif | ||
143 | ); | ||
144 | } | ||
145 | 146 | ||
146 | dir = opendir("/proc"); | 147 | dir = opendir("/proc"); |
147 | if (!dir) | 148 | if (!dir) |
@@ -223,7 +224,7 @@ extern int ps_main(int argc, char **argv) | |||
223 | #endif | 224 | #endif |
224 | 225 | ||
225 | if (argc > 1 && **(argv + 1) == '-') | 226 | if (argc > 1 && **(argv + 1) == '-') |
226 | usage("ps-devps\n\nReport process status\n\nThis version of ps accepts no options.\n\n"); | 227 | usage(ps_usage); |
227 | 228 | ||
228 | /* open device */ | 229 | /* open device */ |
229 | fd = open(device, O_RDONLY); | 230 | fd = open(device, O_RDONLY); |
@@ -26,17 +26,17 @@ | |||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | const char rmdir_usage[] = | ||
30 | "rmdir [OPTION]... DIRECTORY...\n" | ||
31 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
32 | "\nRemove the DIRECTORY(ies), if they are empty.\n" | ||
33 | #endif | ||
34 | ; | ||
29 | 35 | ||
30 | extern int rmdir_main(int argc, char **argv) | 36 | extern int rmdir_main(int argc, char **argv) |
31 | { | 37 | { |
32 | if (argc == 1 || **(argv + 1) == '-') { | 38 | if (argc == 1 || **(argv + 1) == '-') |
33 | usage | 39 | usage(rmdir_usage); |
34 | ("rmdir [OPTION]... DIRECTORY...\n" | ||
35 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
36 | "\nRemove the DIRECTORY(ies), if they are empty.\n" | ||
37 | #endif | ||
38 | ); | ||
39 | } | ||
40 | 40 | ||
41 | while (--argc > 0) { | 41 | while (--argc > 0) { |
42 | if (rmdir(*(++argv)) == -1) { | 42 | if (rmdir(*(++argv)) == -1) { |
@@ -24,14 +24,16 @@ | |||
24 | #include "internal.h" | 24 | #include "internal.h" |
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | 26 | ||
27 | extern int sync_main(int argc, char **argv) | 27 | const char sync_usage[] = |
28 | { | 28 | "sync\n" |
29 | if (argc > 1 && **(argv + 1) == '-') { | ||
30 | usage("sync\n" | ||
31 | #ifndef BB_FEATURE_TRIVIAL_HELP | 29 | #ifndef BB_FEATURE_TRIVIAL_HELP |
32 | "\nWrite all buffered filesystem blocks to disk.\n" | 30 | "\nWrite all buffered filesystem blocks to disk.\n" |
33 | #endif | 31 | #endif |
34 | ); | 32 | ; |
35 | } | 33 | |
34 | extern int sync_main(int argc, char **argv) | ||
35 | { | ||
36 | if (argc > 1 && **(argv + 1) == '-') | ||
37 | usage(sync_usage); | ||
36 | return(sync()); | 38 | return(sync()); |
37 | } | 39 | } |
@@ -178,6 +178,15 @@ static int test_eaccess(); | |||
178 | static int is_a_group_member(); | 178 | static int is_a_group_member(); |
179 | static void initialize_group_array(); | 179 | static void initialize_group_array(); |
180 | 180 | ||
181 | const char test_usage[] = | ||
182 | "test EXPRESSION\n" | ||
183 | "or [ EXPRESSION ]\n" | ||
184 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
185 | "\nChecks file types and compares values returning an exit\n" | ||
186 | "code determined by the value of EXPRESSION.\n" | ||
187 | #endif | ||
188 | ; | ||
189 | |||
181 | extern int | 190 | extern int |
182 | test_main(int argc, char** argv) | 191 | test_main(int argc, char** argv) |
183 | { | 192 | { |
@@ -188,15 +197,8 @@ test_main(int argc, char** argv) | |||
188 | fatalError("missing ]\n"); | 197 | fatalError("missing ]\n"); |
189 | argv[argc] = NULL; | 198 | argv[argc] = NULL; |
190 | } | 199 | } |
191 | if (strcmp(argv[1], dash_dash_help) == 0) { | 200 | if (strcmp(argv[1], dash_dash_help) == 0) |
192 | usage("test EXPRESSION\n" | 201 | usage(test_usage); |
193 | "or [ EXPRESSION ]\n" | ||
194 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
195 | "\nChecks file types and compares values returning an exit\n" | ||
196 | "code determined by the value of EXPRESSION.\n" | ||
197 | #endif | ||
198 | ); | ||
199 | } | ||
200 | 202 | ||
201 | /* Implement special cases from POSIX.2, section 4.62.4 */ | 203 | /* Implement special cases from POSIX.2, section 4.62.4 */ |
202 | switch (argc) { | 204 | switch (argc) { |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 74281a71e..ea27c236c 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -288,25 +288,24 @@ static void leave(int status) | |||
288 | exit(status); | 288 | exit(status); |
289 | } | 289 | } |
290 | 290 | ||
291 | static void show_usage(void) | 291 | const char fsck_minix_usage[] = |
292 | { | 292 | "Usage: fsck.minix [-larvsmf] /dev/name\n" |
293 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", | ||
294 | BB_VER, BB_BT); | ||
295 | fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n", applet_name); | ||
296 | #ifndef BB_FEATURE_TRIVIAL_HELP | 293 | #ifndef BB_FEATURE_TRIVIAL_HELP |
297 | fprintf(stderr, | 294 | "\nPerforms a consistency check for MINIX filesystems.\n\n" |
298 | "\nPerforms a consistency check for MINIX filesystems.\n\n"); | 295 | "Options:\n" |
299 | fprintf(stderr, "Options:\n"); | 296 | "\t-l\tLists all filenames\n" |
300 | fprintf(stderr, "\t-l\tLists all filenames\n"); | 297 | "\t-r\tPerform interactive repairs\n" |
301 | fprintf(stderr, "\t-r\tPerform interactive repairs\n"); | 298 | "\t-a\tPerform automatic repairs\n" |
302 | fprintf(stderr, "\t-a\tPerform automatic repairs\n"); | 299 | "\t-v\tverbose\n" |
303 | fprintf(stderr, "\t-v\tverbose\n"); | 300 | "\t-s\tOutputs super-block information\n" |
304 | fprintf(stderr, "\t-s\tOutputs super-block information\n"); | 301 | "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n" |
305 | fprintf(stderr, | 302 | "\t-f\tForce file system check.\n\n" |
306 | "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n"); | ||
307 | fprintf(stderr, "\t-f\tForce file system check.\n\n"); | ||
308 | #endif | 303 | #endif |
309 | leave(16); | 304 | ; |
305 | |||
306 | static void show_usage(void) | ||
307 | { | ||
308 | usage(fsck_minix_usage); | ||
310 | } | 309 | } |
311 | 310 | ||
312 | static void die(const char *str) | 311 | static void die(const char *str) |
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index e4dedaf82..9ae4b569c 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
@@ -267,27 +267,23 @@ static volatile void die(char *str) | |||
267 | exit(8); | 267 | exit(8); |
268 | } | 268 | } |
269 | 269 | ||
270 | const char mkfs_minix_usage[] = | ||
271 | "mkfs.minix [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n" | ||
272 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
273 | "\nMake a MINIX filesystem.\n\n" | ||
274 | "Options:\n" | ||
275 | "\t-c\t\tCheck the device for bad blocks\n" | ||
276 | "\t-n [14|30]\tSpecify the maximum length of filenames\n" | ||
277 | "\t-i INODES\tSpecify the number of inodes for the filesystem\n" | ||
278 | "\t-l FILENAME\tRead the bad blocks list from FILENAME\n" | ||
279 | "\t-v\t\tMake a Minix version 2 filesystem\n\n" | ||
280 | #endif | ||
281 | ; | ||
282 | |||
270 | static volatile void show_usage() __attribute__ ((noreturn)); | 283 | static volatile void show_usage() __attribute__ ((noreturn)); |
271 | static volatile void show_usage() | 284 | static volatile void show_usage() |
272 | { | 285 | { |
273 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", | 286 | usage(mkfs_minix_usage); |
274 | BB_VER, BB_BT); | ||
275 | fprintf(stderr, | ||
276 | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", | ||
277 | applet_name); | ||
278 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
279 | fprintf(stderr, "\nMake a MINIX filesystem.\n\n"); | ||
280 | fprintf(stderr, "Options:\n"); | ||
281 | fprintf(stderr, "\t-c\t\tCheck the device for bad blocks\n"); | ||
282 | fprintf(stderr, | ||
283 | "\t-n [14|30]\tSpecify the maximum length of filenames\n"); | ||
284 | fprintf(stderr, | ||
285 | "\t-i INODES\tSpecify the number of inodes for the filesystem\n"); | ||
286 | fprintf(stderr, | ||
287 | "\t-l FILENAME\tRead the bad blocks list from FILENAME\n"); | ||
288 | fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n"); | ||
289 | #endif | ||
290 | exit(16); | ||
291 | } | 287 | } |
292 | 288 | ||
293 | /* | 289 | /* |
@@ -26,6 +26,12 @@ | |||
26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
27 | #include <sys/param.h> | 27 | #include <sys/param.h> |
28 | 28 | ||
29 | const char which_usage[] = | ||
30 | "which [COMMAND ...]\n" | ||
31 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
32 | "\nLocates a COMMAND.\n" | ||
33 | #endif | ||
34 | ; | ||
29 | 35 | ||
30 | extern int which_main(int argc, char **argv) | 36 | extern int which_main(int argc, char **argv) |
31 | { | 37 | { |
@@ -34,13 +40,8 @@ extern int which_main(int argc, char **argv) | |||
34 | struct stat filestat; | 40 | struct stat filestat; |
35 | int count = 0; | 41 | int count = 0; |
36 | 42 | ||
37 | if (argc <= 1 || **(argv + 1) == '-') { | 43 | if (argc <= 1 || **(argv + 1) == '-') |
38 | usage("which [COMMAND ...]\n" | 44 | usage(which_usage); |
39 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
40 | "\nLocates a COMMAND.\n" | ||
41 | #endif | ||
42 | ); | ||
43 | } | ||
44 | argc--; | 45 | argc--; |
45 | 46 | ||
46 | path_list = getenv("PATH"); | 47 | path_list = getenv("PATH"); |
@@ -23,17 +23,19 @@ | |||
23 | #include "internal.h" | 23 | #include "internal.h" |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | 25 | ||
26 | const char yes_usage[] = | ||
27 | "yes [OPTION]... [STRING]...\n" | ||
28 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
29 | "\nRepeatedly outputs a line with all specified STRING(s), or `y'.\n" | ||
30 | #endif | ||
31 | ; | ||
32 | |||
26 | extern int yes_main(int argc, char **argv) | 33 | extern int yes_main(int argc, char **argv) |
27 | { | 34 | { |
28 | int i; | 35 | int i; |
29 | 36 | ||
30 | if (argc >= 2 && *argv[1] == '-') { | 37 | if (argc >= 2 && *argv[1] == '-') |
31 | usage("yes [OPTION]... [STRING]...\n" | 38 | usage(yes_usage); |
32 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
33 | "\nRepeatedly outputs a line with all specified STRING(s), or `y'.\n" | ||
34 | #endif | ||
35 | ); | ||
36 | } | ||
37 | 39 | ||
38 | if (argc == 1) { | 40 | if (argc == 1) { |
39 | while (1) | 41 | while (1) |