diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cut.c | 372 | ||||
-rw-r--r-- | coreutils/head.c | 11 | ||||
-rw-r--r-- | coreutils/id.c | 9 | ||||
-rw-r--r-- | coreutils/length.c | 6 | ||||
-rw-r--r-- | coreutils/ln.c | 9 | ||||
-rw-r--r-- | coreutils/logname.c | 8 | ||||
-rw-r--r-- | coreutils/ls.c | 5 | ||||
-rw-r--r-- | coreutils/mkdir.c | 9 | ||||
-rw-r--r-- | coreutils/mkfifo.c | 10 | ||||
-rw-r--r-- | coreutils/mknod.c | 9 | ||||
-rw-r--r-- | coreutils/printf.c | 7 | ||||
-rw-r--r-- | coreutils/pwd.c | 7 | ||||
-rw-r--r-- | coreutils/rm.c | 10 | ||||
-rw-r--r-- | coreutils/rmdir.c | 6 | ||||
-rw-r--r-- | coreutils/sleep.c | 6 | ||||
-rw-r--r-- | coreutils/sort.c | 8 | ||||
-rw-r--r-- | coreutils/sync.c | 6 | ||||
-rw-r--r-- | coreutils/tail.c | 23 | ||||
-rw-r--r-- | coreutils/tee.c | 8 | ||||
-rw-r--r-- | coreutils/test.c | 14 | ||||
-rw-r--r-- | coreutils/touch.c | 8 | ||||
-rw-r--r-- | coreutils/tty.c | 9 | ||||
-rw-r--r-- | coreutils/uniq.c | 11 | ||||
-rw-r--r-- | coreutils/usleep.c | 6 | ||||
-rw-r--r-- | coreutils/wc.c | 9 | ||||
-rw-r--r-- | coreutils/whoami.c | 7 | ||||
-rw-r--r-- | coreutils/yes.c | 7 |
27 files changed, 528 insertions, 72 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c new file mode 100644 index 000000000..89a934e76 --- /dev/null +++ b/coreutils/cut.c | |||
@@ -0,0 +1,372 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * cut implementation for busybox | ||
4 | * | ||
5 | * Copyright (c) Michael J. Holme | ||
6 | * | ||
7 | * This version of cut is adapted from Minix cut and was modified | ||
8 | * by Erik Andersen <andersee@debian.org> to be used in busybox. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
18 | * General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | * | ||
24 | * Original copyright notice is retained at the end of this file. | ||
25 | */ | ||
26 | |||
27 | #include "internal.h" | ||
28 | #include <sys/types.h> | ||
29 | #include <ctype.h> | ||
30 | #include <string.h> | ||
31 | #include <errno.h> | ||
32 | #include <stdlib.h> | ||
33 | #include <stdio.h> | ||
34 | #define BB_DECLARE_EXTERN | ||
35 | #define bb_need_help | ||
36 | #include "messages.c" | ||
37 | |||
38 | #define MAX_FIELD 80 /* Pointers to the beginning of each field | ||
39 | * are stored in columns[], if a line holds | ||
40 | * more than MAX_FIELD columns the array | ||
41 | * boundary is exceed. But unlikely at 80 */ | ||
42 | |||
43 | #define MAX_ARGS 32 /* Maximum number of fields following -f or | ||
44 | * -c switches */ | ||
45 | int args[MAX_ARGS * 2]; | ||
46 | int num_args; | ||
47 | |||
48 | /* Lots of new defines, should easen maintainance... */ | ||
49 | #define DUMP_STDIN 0 /* define for mode: no options */ | ||
50 | #define OPTIONF 1 /* define for mode: option -f */ | ||
51 | #define OPTIONC 2 /* define for mode: option -c */ | ||
52 | #define OPTIONB 3 /* define for mode: option -b */ | ||
53 | #define NOTSET 0 /* option not selected */ | ||
54 | #define SET 1 /* option selected */ | ||
55 | |||
56 | /* Defines for the warnings */ | ||
57 | #define DELIMITER_NOT_APPLICABLE 0 | ||
58 | #define OVERRIDING_PREVIOUS_MODE 1 | ||
59 | #define OPTION_NOT_APPLICABLE 2 | ||
60 | #define UNKNOWN_OPTION 3 | ||
61 | #define FILE_NOT_READABLE 4 | ||
62 | |||
63 | /* Defines for the fatal errors */ | ||
64 | #define SYNTAX_ERROR 101 | ||
65 | #define POSITION_ERROR 102 | ||
66 | #define LINE_TO_LONG_ERROR 103 | ||
67 | #define RANGE_ERROR 104 | ||
68 | #define MAX_FIELDS_EXEEDED_ERROR 105 | ||
69 | #define MAX_ARGS_EXEEDED_ERROR 106 | ||
70 | |||
71 | |||
72 | int mode; /* 0 = dump stdin to stdout, 1=-f, 2=-c */ | ||
73 | char delim = '\t'; /* default delimiting character */ | ||
74 | FILE *fd; | ||
75 | char *name; | ||
76 | char line[BUFSIZ]; | ||
77 | int exit_status; | ||
78 | |||
79 | int cut_main(int argc, char **argv); | ||
80 | void warn(int warn_number, char *option); | ||
81 | void cuterror(int err); | ||
82 | void get_args(void); | ||
83 | void cut(void); | ||
84 | |||
85 | void warn(int warn_number, char *option) | ||
86 | { | ||
87 | static char *warn_msg[] = { | ||
88 | "%s: Option -d allowed only with -f\n", | ||
89 | "%s: -%s overrides earlier option\n", | ||
90 | "%s: -%s not allowed in current mode\n", | ||
91 | "%s: Cannot open %s\n" | ||
92 | }; | ||
93 | |||
94 | fprintf(stderr, warn_msg[warn_number], name, option); | ||
95 | exit_status = warn_number + 1; | ||
96 | |||
97 | } | ||
98 | |||
99 | void cuterror(int err) | ||
100 | { | ||
101 | static char *err_mes[] = { | ||
102 | "%s: syntax error\n", | ||
103 | "%s: position must be >0\n", | ||
104 | "%s: line longer than BUFSIZ\n", | ||
105 | "%s: range must not decrease from left to right\n", | ||
106 | "%s: MAX_FIELD exceeded\n", | ||
107 | "%s: MAX_ARGS exceeded\n" | ||
108 | }; | ||
109 | |||
110 | fprintf(stderr, err_mes[err - 101], name); | ||
111 | exit(err); | ||
112 | } | ||
113 | |||
114 | |||
115 | void get_args() | ||
116 | { | ||
117 | int i = 0; | ||
118 | int arg_ptr = 0; | ||
119 | int flag; | ||
120 | |||
121 | num_args = 0; | ||
122 | do { | ||
123 | if (num_args == MAX_ARGS) | ||
124 | cuterror(MAX_ARGS_EXEEDED_ERROR); | ||
125 | if (!isdigit(line[i]) && line[i] != '-') | ||
126 | cuterror(SYNTAX_ERROR); | ||
127 | |||
128 | args[arg_ptr] = 1; | ||
129 | args[arg_ptr + 1] = BUFSIZ; | ||
130 | flag = 1; | ||
131 | |||
132 | while (line[i] != ',' && line[i] != 0) { | ||
133 | if (isdigit(line[i])) { | ||
134 | args[arg_ptr] = 0; | ||
135 | while (isdigit(line[i])) | ||
136 | args[arg_ptr] = 10 * args[arg_ptr] + line[i++] - '0'; | ||
137 | if (!args[arg_ptr]) | ||
138 | cuterror(POSITION_ERROR); | ||
139 | arg_ptr++; | ||
140 | } | ||
141 | if (line[i] == '-') { | ||
142 | arg_ptr |= 1; | ||
143 | i++; | ||
144 | flag = 0; | ||
145 | } | ||
146 | } | ||
147 | if (flag && arg_ptr & 1) | ||
148 | args[arg_ptr] = args[arg_ptr - 1]; | ||
149 | if (args[num_args * 2] > args[num_args * 2 + 1]) | ||
150 | cuterror(RANGE_ERROR); | ||
151 | num_args++; | ||
152 | arg_ptr = num_args * 2; | ||
153 | } | ||
154 | while (line[i++]); | ||
155 | } | ||
156 | |||
157 | |||
158 | void cut() | ||
159 | { | ||
160 | int i, j, length, maxcol=0; | ||
161 | char *columns[MAX_FIELD]; | ||
162 | |||
163 | while (fgets(line, BUFSIZ, fd)) { | ||
164 | length = strlen(line) - 1; | ||
165 | *(line + length) = 0; | ||
166 | switch (mode) { | ||
167 | case DUMP_STDIN: | ||
168 | printf("%s", line); | ||
169 | break; | ||
170 | case OPTIONF: | ||
171 | columns[maxcol++] = line; | ||
172 | for (i = 0; i < length; i++) { | ||
173 | if (*(line + i) == delim) { | ||
174 | *(line + i) = 0; | ||
175 | if (maxcol == MAX_FIELD) | ||
176 | cuterror(MAX_FIELDS_EXEEDED_ERROR); | ||
177 | columns[maxcol] = line + i + 1; | ||
178 | maxcol++; | ||
179 | } | ||
180 | } | ||
181 | if (maxcol != 1) { | ||
182 | for (i = 0; i < num_args; i++) { | ||
183 | for (j = args[i * 2]; j <= args[i * 2 + 1]; j++) | ||
184 | if (j <= maxcol) { | ||
185 | printf("%s", columns[j - 1]); | ||
186 | if (i != num_args - 1 || j != args[i * 2 + 1]) | ||
187 | putchar(delim); | ||
188 | } | ||
189 | } | ||
190 | } | ||
191 | break; | ||
192 | case OPTIONC: | ||
193 | for (i = 0; i < num_args; i++) { | ||
194 | for (j = args[i * 2]; | ||
195 | j <= (args[i * 2 + 1] > | ||
196 | length ? length : args[i * 2 + 1]); j++) | ||
197 | putchar(*(line + j - 1)); | ||
198 | } | ||
199 | } | ||
200 | if (maxcol != 1) | ||
201 | putchar('\n'); | ||
202 | } | ||
203 | } | ||
204 | |||
205 | |||
206 | int cut_main(int argc, char **argv) | ||
207 | { | ||
208 | int i = 1; | ||
209 | int numberFilenames = 0; | ||
210 | |||
211 | name = argv[0]; | ||
212 | |||
213 | if (argc == 1 || strcmp(argv[1], dash_dash_help)==0) | ||
214 | usage( "cut [OPTION]... [FILE]...\n" | ||
215 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
216 | "\nPrints selected fields from each input FILE to standard output.\n\n" | ||
217 | "Options:\n" | ||
218 | "\t-b LIST\tOutput only bytes from LIST\n" | ||
219 | "\t-c LIST\tOutput only characters from LIST\n" | ||
220 | "\t-d DELIM\tUse DELIM instead of tab as the field delimiter\n" | ||
221 | "\t-f N\tPrint only these fields\n" | ||
222 | "\t-n\tIgnored\n" | ||
223 | #endif | ||
224 | ); | ||
225 | |||
226 | while (i < argc) { | ||
227 | if (argv[i][0] == '-') { | ||
228 | switch (argv[i++][1]) { | ||
229 | case 'd': | ||
230 | if (mode == OPTIONC || mode == OPTIONB) | ||
231 | warn(DELIMITER_NOT_APPLICABLE, "d"); | ||
232 | delim = argv[i++][0]; | ||
233 | break; | ||
234 | case 'f': | ||
235 | sprintf(line, "%s", argv[i++]); | ||
236 | if (mode == OPTIONC || mode == OPTIONB) | ||
237 | warn(OVERRIDING_PREVIOUS_MODE, "f"); | ||
238 | mode = OPTIONF; | ||
239 | break; | ||
240 | case 'b': | ||
241 | sprintf(line, "%s", argv[i++]); | ||
242 | if (mode == OPTIONF || mode == OPTIONC) | ||
243 | warn(OVERRIDING_PREVIOUS_MODE, "b"); | ||
244 | mode = OPTIONB; | ||
245 | break; | ||
246 | case 'c': | ||
247 | sprintf(line, "%s", argv[i++]); | ||
248 | if (mode == OPTIONF || mode == OPTIONB) | ||
249 | warn(OVERRIDING_PREVIOUS_MODE, "c"); | ||
250 | mode = OPTIONC; | ||
251 | break; | ||
252 | case '\0': /* - means: read from stdin */ | ||
253 | numberFilenames++; | ||
254 | break; | ||
255 | case 'n': /* needed for Posix, but no effect here */ | ||
256 | if (mode != OPTIONB) | ||
257 | warn(OPTION_NOT_APPLICABLE, "n"); | ||
258 | break; | ||
259 | default: | ||
260 | warn(UNKNOWN_OPTION, &(argv[i - 1][1])); | ||
261 | } | ||
262 | } else { | ||
263 | i++; | ||
264 | numberFilenames++; | ||
265 | } | ||
266 | } | ||
267 | |||
268 | /* Here follow the checks, if the selected options are reasonable. */ | ||
269 | if (mode == OPTIONB) /* since in Minix char := byte */ | ||
270 | mode = OPTIONC; | ||
271 | get_args(); | ||
272 | if (numberFilenames != 0) { | ||
273 | i = 1; | ||
274 | while (i < argc) { | ||
275 | if (argv[i][0] == '-') { | ||
276 | switch (argv[i][1]) { | ||
277 | case 'f': | ||
278 | case 'c': | ||
279 | case 'b': | ||
280 | case 'd': | ||
281 | i += 2; | ||
282 | break; | ||
283 | case 'n': | ||
284 | case 'i': | ||
285 | case 's': | ||
286 | i++; | ||
287 | break; | ||
288 | case '\0': | ||
289 | fd = stdin; | ||
290 | i++; | ||
291 | cut(); | ||
292 | break; | ||
293 | default: | ||
294 | i++; | ||
295 | } | ||
296 | } else { | ||
297 | if ((fd = fopen(argv[i++], "r")) == NULL) { | ||
298 | warn(FILE_NOT_READABLE, argv[i - 1]); | ||
299 | } else { | ||
300 | cut(); | ||
301 | fclose(fd); | ||
302 | } | ||
303 | } | ||
304 | } | ||
305 | } else { | ||
306 | fd = stdin; | ||
307 | cut(); | ||
308 | } | ||
309 | |||
310 | exit(exit_status); | ||
311 | } | ||
312 | |||
313 | /* cut - extract columns from a file or stdin. Author: Michael J. Holme | ||
314 | * | ||
315 | * Copyright 1989, Michael John Holme, All rights reserved. | ||
316 | * This code may be freely distributed, provided that this notice | ||
317 | * remains intact. | ||
318 | * | ||
319 | * V1.1: 6th September 1989 | ||
320 | * | ||
321 | * Bugs, criticisms, etc, | ||
322 | * c/o Mark Powell | ||
323 | * JANET sq79@uk.ac.liv | ||
324 | * ARPA sq79%liv.ac.uk@nsfnet-relay.ac.uk | ||
325 | * UUCP ...!mcvax!ukc!liv.ac.uk!sq79 | ||
326 | *------------------------------------------------------------------------- | ||
327 | * Changed for POSIX1003.2/Draft10 conformance | ||
328 | * Thomas Brupbacher (tobr@mw.lpc.ethz.ch), September 1990. | ||
329 | * Changes: | ||
330 | * - separation of error messages ( stderr) and output (stdout). | ||
331 | * - support for -b and -n (no effect, -b acts as -c) | ||
332 | * - support for -s | ||
333 | *------------------------------------------------------------------------- | ||
334 | */ | ||
335 | |||
336 | /* | ||
337 | * Copyright (c) 1987,1997, Prentice Hall | ||
338 | * All rights reserved. | ||
339 | * | ||
340 | * Redistribution and use of the MINIX operating system in source and | ||
341 | * binary forms, with or without modification, are permitted provided | ||
342 | * that the following conditions are met: | ||
343 | * | ||
344 | * Redistributions of source code must retain the above copyright | ||
345 | * notice, this list of conditions and the following disclaimer. | ||
346 | * | ||
347 | * Redistributions in binary form must reproduce the above | ||
348 | * copyright notice, this list of conditions and the following | ||
349 | * disclaimer in the documentation and/or other materials provided | ||
350 | * with the distribution. | ||
351 | * | ||
352 | * Neither the name of Prentice Hall nor the names of the software | ||
353 | * authors or contributors may be used to endorse or promote | ||
354 | * products derived from this software without specific prior | ||
355 | * written permission. | ||
356 | * | ||
357 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND | ||
358 | * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
359 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
360 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
361 | * IN NO EVENT SHALL PRENTICE HALL OR ANY AUTHORS OR CONTRIBUTORS BE | ||
362 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
363 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
364 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
365 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
366 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
367 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
368 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
369 | * | ||
370 | */ | ||
371 | |||
372 | |||
diff --git a/coreutils/head.c b/coreutils/head.c index 3db64b3bc..f4ebe05c9 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -27,12 +27,15 @@ | |||
27 | #include <stdio.h> | 27 | #include <stdio.h> |
28 | 28 | ||
29 | const char head_usage[] = | 29 | const char head_usage[] = |
30 | "head [OPTION] [FILE]...\n\n" | 30 | "head [OPTION] [FILE]...\n" |
31 | "Print first 10 lines of each FILE to standard output.\n" | 31 | #ifndef BB_FEATURE_TRIVIAL_HELP |
32 | "\nPrint first 10 lines of each FILE to standard output.\n" | ||
32 | "With more than one FILE, precede each with a header giving the\n" | 33 | "With more than one FILE, precede each with a header giving the\n" |
33 | "file name. With no FILE, or when FILE is -, read standard input.\n\n" | 34 | "file name. With no FILE, or when FILE is -, read standard input.\n\n" |
34 | 35 | ||
35 | "Options:\n" "\t-n NUM\t\tPrint first NUM lines instead of first 10\n"; | 36 | "Options:\n" "\t-n NUM\t\tPrint first NUM lines instead of first 10\n" |
37 | #endif | ||
38 | ; | ||
36 | 39 | ||
37 | int head(int len, FILE * src) | 40 | int head(int len, FILE * src) |
38 | { | 41 | { |
@@ -109,4 +112,4 @@ int head_main(int argc, char **argv) | |||
109 | exit(0); | 112 | exit(0); |
110 | } | 113 | } |
111 | 114 | ||
112 | /* $Id: head.c,v 1.9 2000/04/13 01:18:56 erik Exp $ */ | 115 | /* $Id: head.c,v 1.10 2000/05/12 19:41:47 erik Exp $ */ |
diff --git a/coreutils/id.c b/coreutils/id.c index 8ded0e521..542f86566 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
@@ -29,11 +29,14 @@ | |||
29 | #include <sys/types.h> | 29 | #include <sys/types.h> |
30 | 30 | ||
31 | static const char id_usage[] = | 31 | static const char id_usage[] = |
32 | "id [OPTIONS]... [USERNAME]\n\n" | 32 | "id [OPTIONS]... [USERNAME]\n" |
33 | "Print information for USERNAME or the current user\n\n" | 33 | #ifndef BB_FEATURE_TRIVIAL_HELP |
34 | "\nPrint information for USERNAME or the current user\n\n" | ||
34 | "\t-g\tprints only the group ID\n" | 35 | "\t-g\tprints only the group ID\n" |
35 | "\t-u\tprints only the user ID\n" | 36 | "\t-u\tprints only the user ID\n" |
36 | "\t-r\tprints the real user ID instead of the effective ID (with -ug)\n\n"; | 37 | "\t-r\tprints the real user ID instead of the effective ID (with -ug)\n\n" |
38 | #endif | ||
39 | ; | ||
37 | 40 | ||
38 | extern int id_main(int argc, char **argv) | 41 | extern int id_main(int argc, char **argv) |
39 | { | 42 | { |
diff --git a/coreutils/length.c b/coreutils/length.c index 4cbe7e17b..c7df21611 100644 --- a/coreutils/length.c +++ b/coreutils/length.c | |||
@@ -7,7 +7,11 @@ | |||
7 | extern int length_main(int argc, char **argv) | 7 | extern int length_main(int argc, char **argv) |
8 | { | 8 | { |
9 | if (argc != 2 || **(argv + 1) == '-') { | 9 | if (argc != 2 || **(argv + 1) == '-') { |
10 | usage("length string\n"); | 10 | usage("length STRING\n" |
11 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
12 | "\nPrints out the length of the specified STRING.\n" | ||
13 | #endif | ||
14 | ); | ||
11 | } | 15 | } |
12 | printf("%lu\n", (long)strlen(argv[1])); | 16 | printf("%lu\n", (long)strlen(argv[1])); |
13 | return (TRUE); | 17 | return (TRUE); |
diff --git a/coreutils/ln.c b/coreutils/ln.c index eb7c99608..29ff93863 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -32,13 +32,16 @@ | |||
32 | #include <errno.h> | 32 | #include <errno.h> |
33 | 33 | ||
34 | static const char ln_usage[] = | 34 | static const char ln_usage[] = |
35 | "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n" | 35 | "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n" |
36 | "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n\n" | 36 | #ifndef BB_FEATURE_TRIVIAL_HELP |
37 | "\nCreate a link named LINK_NAME or DIRECTORY to the specified TARGET\n\n" | ||
37 | "Options:\n" | 38 | "Options:\n" |
38 | "\t-s\tmake symbolic links instead of hard links\n" | 39 | "\t-s\tmake symbolic links instead of hard links\n" |
39 | 40 | ||
40 | "\t-f\tremove existing destination files\n" | 41 | "\t-f\tremove existing destination files\n" |
41 | "\t-n\tno dereference symlinks - treat like normal file\n"; | 42 | "\t-n\tno dereference symlinks - treat like normal file\n" |
43 | #endif | ||
44 | ; | ||
42 | 45 | ||
43 | static int symlinkFlag = FALSE; | 46 | static int symlinkFlag = FALSE; |
44 | static int removeoldFlag = FALSE; | 47 | static int removeoldFlag = FALSE; |
diff --git a/coreutils/logname.c b/coreutils/logname.c index bde1752ba..7c6153f64 100644 --- a/coreutils/logname.c +++ b/coreutils/logname.c | |||
@@ -23,9 +23,11 @@ | |||
23 | #include "internal.h" | 23 | #include "internal.h" |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | 25 | ||
26 | static const char logname_usage[] = "logname\n\n" | 26 | static const char logname_usage[] = "logname\n" |
27 | 27 | #ifndef BB_FEATURE_TRIVIAL_HELP | |
28 | "Print the name of the current user.\n"; | 28 | "\nPrint the name of the current user.\n" |
29 | #endif | ||
30 | ; | ||
29 | 31 | ||
30 | extern int logname_main(int argc, char **argv) | 32 | extern int logname_main(int argc, char **argv) |
31 | { | 33 | { |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 3c518ab28..6ab11c4e5 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -449,7 +449,9 @@ static const char ls_usage[] = "ls [-1a" | |||
449 | #ifdef BB_FEATURE_LS_FILETYPES | 449 | #ifdef BB_FEATURE_LS_FILETYPES |
450 | "F" | 450 | "F" |
451 | #endif | 451 | #endif |
452 | "] [filenames...]\n\n" | 452 | "] [filenames...]\n" |
453 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
454 | "\nList directory contents\n\n" | ||
453 | "Options:\n" | 455 | "Options:\n" |
454 | "\t-a\tdo not hide entries starting with .\n" | 456 | "\t-a\tdo not hide entries starting with .\n" |
455 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 457 | #ifdef BB_FEATURE_LS_TIMESTAMPS |
@@ -475,6 +477,7 @@ static const char ls_usage[] = "ls [-1a" | |||
475 | #ifdef BB_FEATURE_LS_FILETYPES | 477 | #ifdef BB_FEATURE_LS_FILETYPES |
476 | "\t-F\tappend indicator (one of */=@|) to entries\n" | 478 | "\t-F\tappend indicator (one of */=@|) to entries\n" |
477 | #endif | 479 | #endif |
480 | #endif | ||
478 | ; | 481 | ; |
479 | 482 | ||
480 | extern int ls_main(int argc, char **argv) | 483 | extern int ls_main(int argc, char **argv) |
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 54d9b7241..96649868d 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -30,12 +30,15 @@ | |||
30 | #include <errno.h> | 30 | #include <errno.h> |
31 | 31 | ||
32 | static const char mkdir_usage[] = | 32 | static const char mkdir_usage[] = |
33 | "mkdir [OPTION] DIRECTORY...\n\n" | 33 | "mkdir [OPTION] DIRECTORY...\n" |
34 | "Create the DIRECTORY(ies), if they do not already exist\n\n" | 34 | #ifndef BB_FEATURE_TRIVIAL_HELP |
35 | "\nCreate the DIRECTORY(ies), if they do not already exist\n\n" | ||
35 | "Options:\n" | 36 | "Options:\n" |
36 | 37 | ||
37 | "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" | 38 | "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" |
38 | "\t-p\tno error if existing, make parent directories as needed\n"; | 39 | "\t-p\tno error if existing, make parent directories as needed\n" |
40 | #endif | ||
41 | ; | ||
39 | 42 | ||
40 | 43 | ||
41 | static int parentFlag = FALSE; | 44 | static int parentFlag = FALSE; |
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c index b273df046..ef3d667e2 100644 --- a/coreutils/mkfifo.c +++ b/coreutils/mkfifo.c | |||
@@ -26,11 +26,13 @@ | |||
26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n" | 29 | static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n" |
30 | "Creates a named pipe (identical to 'mknod name p')\n\n" | 30 | #ifndef BB_FEATURE_TRIVIAL_HELP |
31 | 31 | "\nCreates a named pipe (identical to 'mknod name p')\n\n" | |
32 | "Options:\n" | 32 | "Options:\n" |
33 | "\t-m\tcreate the pipe using the specified mode (default a=rw)\n"; | 33 | "\t-m\tcreate the pipe using the specified mode (default a=rw)\n" |
34 | #endif | ||
35 | ; | ||
34 | 36 | ||
35 | extern int mkfifo_main(int argc, char **argv) | 37 | extern int mkfifo_main(int argc, char **argv) |
36 | { | 38 | { |
diff --git a/coreutils/mknod.c b/coreutils/mknod.c index caa234f1f..8f411a341 100644 --- a/coreutils/mknod.c +++ b/coreutils/mknod.c | |||
@@ -28,14 +28,17 @@ | |||
28 | #include <fcntl.h> | 28 | #include <fcntl.h> |
29 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | 30 | ||
31 | static const char mknod_usage[] = "mknod [OPTIONS] NAME TYPE MAJOR MINOR\n\n" | 31 | static const char mknod_usage[] = "mknod [OPTIONS] NAME TYPE MAJOR MINOR\n" |
32 | "Create a special file (block, character, or pipe).\n\n" | 32 | #ifndef BB_FEATURE_TRIVIAL_HELP |
33 | "\nCreate a special file (block, character, or pipe).\n\n" | ||
33 | "Options:\n" | 34 | "Options:\n" |
34 | "\t-m\tcreate the special file using the specified mode (default a=rw)\n\n" | 35 | "\t-m\tcreate the special file using the specified mode (default a=rw)\n\n" |
35 | "TYPEs include:\n" | 36 | "TYPEs include:\n" |
36 | "\tb:\tMake a block (buffered) device.\n" | 37 | "\tb:\tMake a block (buffered) device.\n" |
37 | "\tc or u:\tMake a character (un-buffered) device.\n" | 38 | "\tc or u:\tMake a character (un-buffered) device.\n" |
38 | "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n"; | 39 | "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes.\n" |
40 | #endif | ||
41 | ; | ||
39 | 42 | ||
40 | int mknod_main(int argc, char **argv) | 43 | int mknod_main(int argc, char **argv) |
41 | { | 44 | { |
diff --git a/coreutils/printf.c b/coreutils/printf.c index bfe408175..28a011dcd 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c | |||
@@ -139,7 +139,12 @@ static void verify __P((char *s, char *end)); | |||
139 | /* The value to return to the calling program. */ | 139 | /* The value to return to the calling program. */ |
140 | static int exit_status; | 140 | static int exit_status; |
141 | 141 | ||
142 | static const char printf_usage[] = "printf format [argument...]\n\nFormats and prints the given data.\n"; | 142 | static const char printf_usage[] = "printf FORMAT [ARGUMENT...]\n" |
143 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
144 | "\nFormats and prints ARGUMENT(s) according to FORMAT,\n" | ||
145 | "Where FORMAT controls the output exactly as in C printf.\n" | ||
146 | #endif | ||
147 | ; | ||
143 | 148 | ||
144 | int printf_main(int argc, char **argv) | 149 | int printf_main(int argc, char **argv) |
145 | { | 150 | { |
diff --git a/coreutils/pwd.c b/coreutils/pwd.c index e77a0ca70..19494a96c 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c | |||
@@ -24,15 +24,14 @@ | |||
24 | #include "internal.h" | 24 | #include "internal.h" |
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | #include <dirent.h> | 26 | #include <dirent.h> |
27 | #include <errno.h> | ||
27 | 28 | ||
28 | extern int pwd_main(int argc, char **argv) | 29 | extern int pwd_main(int argc, char **argv) |
29 | { | 30 | { |
30 | char buf[BUFSIZ + 1]; | 31 | char buf[BUFSIZ + 1]; |
31 | 32 | ||
32 | if (getcwd(buf, sizeof(buf)) == NULL) { | 33 | if (getcwd(buf, sizeof(buf)) == NULL) |
33 | perror("get working directory"); | 34 | fatalError("pwd: %s", strerror(errno)); |
34 | exit(FALSE); | ||
35 | } | ||
36 | 35 | ||
37 | printf("%s\n", buf); | 36 | printf("%s\n", buf); |
38 | exit(TRUE); | 37 | exit(TRUE); |
diff --git a/coreutils/rm.c b/coreutils/rm.c index 0cd795661..c62d68aba 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c | |||
@@ -29,12 +29,14 @@ | |||
29 | #include <dirent.h> | 29 | #include <dirent.h> |
30 | #include <errno.h> | 30 | #include <errno.h> |
31 | 31 | ||
32 | static const char *rm_usage = "rm [OPTION]... FILE...\n\n" | 32 | static const char *rm_usage = "rm [OPTION]... FILE...\n" |
33 | "Remove (unlink) the FILE(s).\n\n" | 33 | #ifndef BB_FEATURE_TRIVIAL_HELP |
34 | "\nRemove (unlink) the FILE(s).\n\n" | ||
34 | "Options:\n" | 35 | "Options:\n" |
35 | |||
36 | "\t-f\t\tremove existing destinations, never prompt\n" | 36 | "\t-f\t\tremove existing destinations, never prompt\n" |
37 | "\t-r or -R\tremove the contents of directories recursively\n"; | 37 | "\t-r or -R\tremove the contents of directories recursively\n" |
38 | #endif | ||
39 | ; | ||
38 | 40 | ||
39 | 41 | ||
40 | static int recursiveFlag = FALSE; | 42 | static int recursiveFlag = FALSE; |
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index 1d88de322..61d7f2aa5 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c | |||
@@ -31,7 +31,11 @@ extern int rmdir_main(int argc, char **argv) | |||
31 | { | 31 | { |
32 | if (argc == 1 || **(argv + 1) == '-') { | 32 | if (argc == 1 || **(argv + 1) == '-') { |
33 | usage | 33 | usage |
34 | ("rmdir [OPTION]... DIRECTORY...\n\nRemove the DIRECTORY(ies), if they are empty.\n"); | 34 | ("rmdir [OPTION]... DIRECTORY...\n" |
35 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
36 | "\nRemove the DIRECTORY(ies), if they are empty.\n" | ||
37 | #endif | ||
38 | ); | ||
35 | } | 39 | } |
36 | 40 | ||
37 | while (--argc > 0) { | 41 | while (--argc > 0) { |
diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 9687b8446..13f07c02f 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c | |||
@@ -24,7 +24,11 @@ | |||
24 | #include "internal.h" | 24 | #include "internal.h" |
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | 26 | ||
27 | const char sleep_usage[] = "sleep N\n\n" "Pause for N seconds.\n"; | 27 | const char sleep_usage[] = "sleep N\n" |
28 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
29 | "\nPause for N seconds.\n" | ||
30 | #endif | ||
31 | ; | ||
28 | 32 | ||
29 | extern int sleep_main(int argc, char **argv) | 33 | extern int sleep_main(int argc, char **argv) |
30 | { | 34 | { |
diff --git a/coreutils/sort.c b/coreutils/sort.c index 49eb4fd72..1edc7d1ca 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -33,7 +33,11 @@ static const char sort_usage[] = "sort [-n]" | |||
33 | #ifdef BB_FEATURE_SORT_REVERSE | 33 | #ifdef BB_FEATURE_SORT_REVERSE |
34 | " [-r]" | 34 | " [-r]" |
35 | #endif | 35 | #endif |
36 | " [FILE]...\n\nSorts lines of text in the specified files\n"; | 36 | " [FILE]...\n" |
37 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
38 | "\nSorts lines of text in the specified files\n" | ||
39 | #endif | ||
40 | ; | ||
37 | 41 | ||
38 | #ifdef BB_FEATURE_SORT_REVERSE | 42 | #ifdef BB_FEATURE_SORT_REVERSE |
39 | #define APPLY_REVERSE(x) (reverse ? -(x) : (x)) | 43 | #define APPLY_REVERSE(x) (reverse ? -(x) : (x)) |
@@ -300,4 +304,4 @@ int sort_main(int argc, char **argv) | |||
300 | exit(0); | 304 | exit(0); |
301 | } | 305 | } |
302 | 306 | ||
303 | /* $Id: sort.c,v 1.15 2000/04/17 04:22:09 beppu Exp $ */ | 307 | /* $Id: sort.c,v 1.16 2000/05/12 19:41:47 erik Exp $ */ |
diff --git a/coreutils/sync.c b/coreutils/sync.c index f8160c8dc..33c79228d 100644 --- a/coreutils/sync.c +++ b/coreutils/sync.c | |||
@@ -27,7 +27,11 @@ | |||
27 | extern int sync_main(int argc, char **argv) | 27 | extern int sync_main(int argc, char **argv) |
28 | { | 28 | { |
29 | if (argc > 1 && **(argv + 1) == '-') { | 29 | if (argc > 1 && **(argv + 1) == '-') { |
30 | usage("sync\n\nWrite all buffered filesystem blocks to disk.\n"); | 30 | usage("sync\n" |
31 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
32 | "\nWrite all buffered filesystem blocks to disk.\n" | ||
33 | #endif | ||
34 | ); | ||
31 | } | 35 | } |
32 | exit(sync()); | 36 | exit(sync()); |
33 | } | 37 | } |
diff --git a/coreutils/tail.c b/coreutils/tail.c index 321c5c4b2..3b3e2f56c 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -47,6 +47,9 @@ | |||
47 | #include <sys/stat.h> | 47 | #include <sys/stat.h> |
48 | #include <fcntl.h> | 48 | #include <fcntl.h> |
49 | #include <ctype.h> | 49 | #include <ctype.h> |
50 | #define BB_DECLARE_EXTERN | ||
51 | #define bb_need_help | ||
52 | #include "messages.c" | ||
50 | 53 | ||
51 | 54 | ||
52 | #define XWRITE(fd, buffer, n_bytes) \ | 55 | #define XWRITE(fd, buffer, n_bytes) \ |
@@ -70,15 +73,18 @@ static int forever; | |||
70 | static int print_headers; | 73 | static int print_headers; |
71 | 74 | ||
72 | const char tail_usage[] = | 75 | const char tail_usage[] = |
73 | "tail [OPTION] [FILE]...\n\n" | 76 | "tail [OPTION] [FILE]...\n" |
74 | "Print last 10 lines of each FILE to standard output.\n" | 77 | #ifndef BB_FEATURE_TRIVIAL_HELP |
78 | "\nPrint last 10 lines of each FILE to standard output.\n" | ||
75 | "With more than one FILE, precede each with a header giving the\n" | 79 | "With more than one FILE, precede each with a header giving the\n" |
76 | "file name. With no FILE, or when FILE is -, read standard input.\n\n" | 80 | "file name. With no FILE, or when FILE is -, read standard input.\n\n" |
77 | "Options:\n" | 81 | "Options:\n" |
78 | "\t-n NUM\t\tPrint last NUM lines instead of first 10\n" | 82 | "\t-n NUM\t\tPrint last NUM lines instead of first 10\n" |
79 | 83 | ||
80 | "\t-f\t\tOutput data as the file grows. This version\n" | 84 | "\t-f\t\tOutput data as the file grows. This version\n" |
81 | "\t\t\tof 'tail -f' supports only one file at a time.\n"; | 85 | "\t\t\tof 'tail -f' supports only one file at a time.\n" |
86 | #endif | ||
87 | ; | ||
82 | 88 | ||
83 | 89 | ||
84 | static void write_header(const char *filename) | 90 | static void write_header(const char *filename) |
@@ -512,9 +518,9 @@ char *program_name; | |||
512 | static int have_read_stdin; | 518 | static int have_read_stdin; |
513 | 519 | ||
514 | 520 | ||
515 | static const char tail_usage[] = "tail [OPTION]... [FILE]...\n\ | 521 | static const char tail_usage[] = "tail [OPTION]... [FILE]...\n" |
516 | \n\ | 522 | #ifndef BB_FEATURE_TRIVIAL_HELP |
517 | Print last 10 lines of each FILE to standard output.\n\ | 523 | "\nPrint last 10 lines of each FILE to standard output.\n\ |
518 | With more than one FILE, precede each with a header giving the file name.\n\ | 524 | With more than one FILE, precede each with a header giving the file name.\n\ |
519 | With no FILE, or when FILE is -, read standard input.\n\ | 525 | With no FILE, or when FILE is -, read standard input.\n\ |
520 | \n\ | 526 | \n\ |
@@ -523,11 +529,12 @@ With no FILE, or when FILE is -, read standard input.\n\ | |||
523 | -n=N output the last N lines, instead of last 10\n\ | 529 | -n=N output the last N lines, instead of last 10\n\ |
524 | -q never output headers giving file names\n\ | 530 | -q never output headers giving file names\n\ |
525 | -v always output headers giving file names\n\ | 531 | -v always output headers giving file names\n\ |
526 | --help display this help and exit\n\ | ||
527 | \n\ | 532 | \n\ |
528 | If the first character of N (bytes or lines) is a `+', output begins with \n\ | 533 | If the first character of N (bytes or lines) is a `+', output begins with \n\ |
529 | the Nth item from the start of each file, otherwise, print the last N items\n\ | 534 | the Nth item from the start of each file, otherwise, print the last N items\n\ |
530 | in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2).\n\n"; | 535 | in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2).\n" |
536 | #endif | ||
537 | ; | ||
531 | 538 | ||
532 | static void write_header(const char *filename, const char *comment) | 539 | static void write_header(const char *filename, const char *comment) |
533 | { | 540 | { |
diff --git a/coreutils/tee.c b/coreutils/tee.c index 95b75edd7..a78edc039 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -27,12 +27,14 @@ | |||
27 | #include <stdio.h> | 27 | #include <stdio.h> |
28 | 28 | ||
29 | static const char tee_usage[] = | 29 | static const char tee_usage[] = |
30 | "tee [OPTION]... [FILE]...\n\n" | 30 | "tee [OPTION]... [FILE]...\n" |
31 | "Copy standard input to each FILE, and also to standard output.\n\n" | 31 | #ifndef BB_FEATURE_TRIVIAL_HELP |
32 | "\nCopy standard input to each FILE, and also to standard output.\n\n" | ||
32 | "Options:\n" "\t-a\tappend to the given FILEs, do not overwrite\n" | 33 | "Options:\n" "\t-a\tappend to the given FILEs, do not overwrite\n" |
33 | #if 0 | 34 | #if 0 |
34 | "\t-i\tignore interrupt signals\n" | 35 | "\t-i\tignore interrupt signals\n" |
35 | #endif | 36 | #endif |
37 | #endif | ||
36 | ; | 38 | ; |
37 | 39 | ||
38 | 40 | ||
@@ -131,4 +133,4 @@ int tee_main(int argc, char **argv) | |||
131 | exit(0); | 133 | exit(0); |
132 | } | 134 | } |
133 | 135 | ||
134 | /* $Id: tee.c,v 1.9 2000/04/13 01:18:56 erik Exp $ */ | 136 | /* $Id: tee.c,v 1.10 2000/05/12 19:41:47 erik Exp $ */ |
diff --git a/coreutils/test.c b/coreutils/test.c index 0ed777194..9b541e33e 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -39,6 +39,9 @@ | |||
39 | #include <errno.h> | 39 | #include <errno.h> |
40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
41 | #include <string.h> | 41 | #include <string.h> |
42 | #define BB_DECLARE_EXTERN | ||
43 | #define bb_need_help | ||
44 | #include "messages.c" | ||
42 | 45 | ||
43 | /* test(1) accepts the following grammar: | 46 | /* test(1) accepts the following grammar: |
44 | oexpr ::= aexpr | aexpr "-o" oexpr ; | 47 | oexpr ::= aexpr | aexpr "-o" oexpr ; |
@@ -185,11 +188,14 @@ test_main(int argc, char** argv) | |||
185 | fatalError("missing ]"); | 188 | fatalError("missing ]"); |
186 | argv[argc] = NULL; | 189 | argv[argc] = NULL; |
187 | } | 190 | } |
188 | if (strcmp(argv[1], "--help") == 0) { | 191 | if (strcmp(argv[1], dash_dash_help) == 0) { |
189 | usage("test EXPRESSION\n" | 192 | usage("test EXPRESSION\n" |
190 | "or [ EXPRESSION ]\n\n" | 193 | "or [ EXPRESSION ]\n" |
191 | "Checks file types and compares values returning an exit\n" | 194 | #ifndef BB_FEATURE_TRIVIAL_HELP |
192 | "code determined by the value of EXPRESSION.\n"); | 195 | "\nChecks file types and compares values returning an exit\n" |
196 | "code determined by the value of EXPRESSION.\n" | ||
197 | #endif | ||
198 | ); | ||
193 | } | 199 | } |
194 | 200 | ||
195 | /* Implement special cases from POSIX.2, section 4.62.4 */ | 201 | /* Implement special cases from POSIX.2, section 4.62.4 */ |
diff --git a/coreutils/touch.c b/coreutils/touch.c index f8972dcf6..207692826 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -31,9 +31,11 @@ | |||
31 | #include <errno.h> | 31 | #include <errno.h> |
32 | 32 | ||
33 | 33 | ||
34 | static const char touch_usage[] = "touch [-c] file [file ...]\n\n" | 34 | static const char touch_usage[] = "touch [-c] file [file ...]\n" |
35 | 35 | #ifndef BB_FEATURE_TRIVIAL_HELP | |
36 | "Update the last-modified date on the given file[s].\n"; | 36 | "\nUpdate the last-modified date on the given file[s].\n" |
37 | #endif | ||
38 | ; | ||
37 | 39 | ||
38 | 40 | ||
39 | 41 | ||
diff --git a/coreutils/tty.c b/coreutils/tty.c index 6f98d1b79..3a318ebba 100644 --- a/coreutils/tty.c +++ b/coreutils/tty.c | |||
@@ -24,10 +24,13 @@ | |||
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | #include <sys/types.h> | 25 | #include <sys/types.h> |
26 | 26 | ||
27 | static const char tty_usage[] = "tty\n\n" | 27 | static const char tty_usage[] = "tty\n" |
28 | "Print the file name of the terminal connected to standard input.\n\n" | 28 | #ifndef BB_FEATURE_TRIVIAL_HELP |
29 | "\nPrint the file name of the terminal connected to standard input.\n\n" | ||
29 | "Options:\n" | 30 | "Options:\n" |
30 | "\t-s\tprint nothing, only return an exit status\n"; | 31 | "\t-s\tprint nothing, only return an exit status\n" |
32 | #endif | ||
33 | ; | ||
31 | 34 | ||
32 | extern int tty_main(int argc, char **argv) | 35 | extern int tty_main(int argc, char **argv) |
33 | { | 36 | { |
diff --git a/coreutils/uniq.c b/coreutils/uniq.c index 0324856fd..0cccbd5e7 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c | |||
@@ -28,9 +28,12 @@ | |||
28 | #include <errno.h> | 28 | #include <errno.h> |
29 | 29 | ||
30 | static const char uniq_usage[] = | 30 | static const char uniq_usage[] = |
31 | "uniq [OPTION]... [INPUT [OUTPUT]]\n\n" | 31 | "uniq [OPTION]... [INPUT [OUTPUT]]\n" |
32 | "Discard all but one of successive identical lines from INPUT\n" | 32 | #ifndef BB_FEATURE_TRIVIAL_HELP |
33 | "(or standard input), writing to OUTPUT (or standard output).\n"; | 33 | "\nDiscard all but one of successive identical lines from INPUT\n" |
34 | "(or standard input), writing to OUTPUT (or standard output).\n" | ||
35 | #endif | ||
36 | ; | ||
34 | 37 | ||
35 | /* max chars in line */ | 38 | /* max chars in line */ |
36 | #define UNIQ_MAX 4096 | 39 | #define UNIQ_MAX 4096 |
@@ -184,4 +187,4 @@ int uniq_main(int argc, char **argv) | |||
184 | exit(0); | 187 | exit(0); |
185 | } | 188 | } |
186 | 189 | ||
187 | /* $Id: uniq.c,v 1.9 2000/04/17 16:16:10 erik Exp $ */ | 190 | /* $Id: uniq.c,v 1.10 2000/05/12 19:41:47 erik Exp $ */ |
diff --git a/coreutils/usleep.c b/coreutils/usleep.c index dcb40d65a..34008a638 100644 --- a/coreutils/usleep.c +++ b/coreutils/usleep.c | |||
@@ -25,7 +25,11 @@ | |||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | 27 | ||
28 | const char usleep_usage[] = "usleep N\n\n" "Pause for N microseconds.\n"; | 28 | const char usleep_usage[] = "usleep N\n" |
29 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
30 | "\nPause for N microseconds.\n" | ||
31 | #endif | ||
32 | ; | ||
29 | 33 | ||
30 | extern int usleep_main(int argc, char **argv) | 34 | extern int usleep_main(int argc, char **argv) |
31 | { | 35 | { |
diff --git a/coreutils/wc.c b/coreutils/wc.c index 030afa9d6..57bc7135a 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
@@ -23,15 +23,18 @@ | |||
23 | #include "internal.h" | 23 | #include "internal.h" |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | 25 | ||
26 | static const char wc_usage[] = "wc [OPTION]... [FILE]...\n\n" | 26 | static const char wc_usage[] = "wc [OPTION]... [FILE]...\n" |
27 | "Print line, word, and byte counts for each FILE, and a total line if\n" | 27 | #ifndef BB_FEATURE_TRIVIAL_HELP |
28 | "\nPrint line, word, and byte counts for each FILE, and a total line if\n" | ||
28 | "more than one FILE is specified. With no FILE, read standard input.\n\n" | 29 | "more than one FILE is specified. With no FILE, read standard input.\n\n" |
29 | "Options:\n" | 30 | "Options:\n" |
30 | "\t-c\tprint the byte counts\n" | 31 | "\t-c\tprint the byte counts\n" |
31 | "\t-l\tprint the newline counts\n" | 32 | "\t-l\tprint the newline counts\n" |
32 | 33 | ||
33 | "\t-L\tprint the length of the longest line\n" | 34 | "\t-L\tprint the length of the longest line\n" |
34 | "\t-w\tprint the word counts\n"; | 35 | "\t-w\tprint the word counts\n" |
36 | #endif | ||
37 | ; | ||
35 | 38 | ||
36 | static int total_lines, total_words, total_chars, max_length; | 39 | static int total_lines, total_words, total_chars, max_length; |
37 | static int print_lines, print_words, print_chars, print_length; | 40 | static int print_lines, print_words, print_chars, print_length; |
diff --git a/coreutils/whoami.c b/coreutils/whoami.c index f9d3f286a..da584790d 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c | |||
@@ -24,8 +24,11 @@ | |||
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | #include <pwd.h> | 25 | #include <pwd.h> |
26 | 26 | ||
27 | static const char whoami_usage[] = "whoami\n\n" | 27 | static const char whoami_usage[] = "whoami\n" |
28 | "Prints the user name associated with the current effective user id.\n"; | 28 | #ifndef BB_FEATURE_TRIVIAL_HELP |
29 | "\nPrints the user name associated with the current effective user id.\n" | ||
30 | #endif | ||
31 | ; | ||
29 | 32 | ||
30 | extern int whoami_main(int argc, char **argv) | 33 | extern int whoami_main(int argc, char **argv) |
31 | { | 34 | { |
diff --git a/coreutils/yes.c b/coreutils/yes.c index a822ebc1d..97b6f653c 100644 --- a/coreutils/yes.c +++ b/coreutils/yes.c | |||
@@ -28,8 +28,11 @@ extern int yes_main(int argc, char **argv) | |||
28 | int i; | 28 | int i; |
29 | 29 | ||
30 | if (argc >=1 && *argv[1]=='-') { | 30 | if (argc >=1 && *argv[1]=='-') { |
31 | usage("yes [OPTION]... [STRING]...\n\n" | 31 | usage("yes [OPTION]... [STRING]...\n" |
32 | "Repeatedly outputs a line with all specified STRING(s), or `y'.\n"); | 32 | #ifndef BB_FEATURE_TRIVIAL_HELP |
33 | "\nRepeatedly outputs a line with all specified STRING(s), or `y'.\n" | ||
34 | #endif | ||
35 | ); | ||
33 | } | 36 | } |
34 | 37 | ||
35 | if (argc == 1) { | 38 | if (argc == 1) { |