diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/dump.h | 11 | ||||
-rw-r--r-- | include/libbb.h | 216 | ||||
-rw-r--r-- | include/usage.h | 97 |
3 files changed, 214 insertions, 110 deletions
diff --git a/include/dump.h b/include/dump.h index 0e8dbe07f..3f4b480b2 100644 --- a/include/dump.h +++ b/include/dump.h | |||
@@ -38,5 +38,12 @@ typedef struct _fs { /* format strings */ | |||
38 | int bcnt; | 38 | int bcnt; |
39 | } FS; | 39 | } FS; |
40 | 40 | ||
41 | void add(char *fmt); | 41 | extern void bb_dump_add(const char *fmt); |
42 | int dump (char **argv); | 42 | extern int bb_dump_dump (char **argv); |
43 | extern int bb_dump_size(FS * fs); | ||
44 | |||
45 | extern FS *bb_dump_fshead; /* head of format strings */ | ||
46 | extern int bb_dump_blocksize; /* data block size */ | ||
47 | extern int bb_dump_length; /* max bytes to read */ | ||
48 | extern enum _vflag bb_dump_vflag; | ||
49 | extern off_t bb_dump_skip; /* bytes to skip */ | ||
diff --git a/include/libbb.h b/include/libbb.h index 8cb72de8b..f79def321 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <stdarg.h> | 28 | #include <stdarg.h> |
29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
30 | #include <sys/types.h> | 30 | #include <sys/types.h> |
31 | #include <termios.h> | ||
31 | 32 | ||
32 | #include <netdb.h> | 33 | #include <netdb.h> |
33 | 34 | ||
@@ -86,84 +87,132 @@ char *strtok_r(char *s, const char *delim, char **ptrptr); | |||
86 | #define MAX(a,b) (((a)>(b))?(a):(b)) | 87 | #define MAX(a,b) (((a)>(b))?(a):(b)) |
87 | #endif | 88 | #endif |
88 | 89 | ||
89 | extern void show_usage(void) __attribute__ ((noreturn)); | 90 | extern void bb_show_usage(void) __attribute__ ((noreturn)); |
90 | extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 91 | extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
91 | extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 92 | extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
92 | extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 93 | extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
93 | extern void perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 94 | extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
94 | extern void vherror_msg(const char *s, va_list p); | 95 | extern void bb_vherror_msg(const char *s, va_list p); |
95 | extern void herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 96 | extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
96 | extern void herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 97 | extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
98 | |||
99 | extern void bb_perror_nomsg_and_die(void) __attribute__ ((noreturn)); | ||
100 | extern void bb_perror_nomsg(void); | ||
97 | 101 | ||
98 | /* These two are used internally -- you shouldn't need to use them */ | 102 | /* These two are used internally -- you shouldn't need to use them */ |
99 | extern void verror_msg(const char *s, va_list p); | 103 | extern void bb_verror_msg(const char *s, va_list p) __attribute__ ((format (printf, 1, 0))); |
100 | extern void vperror_msg(const char *s, va_list p); | 104 | extern void bb_vperror_msg(const char *s, va_list p) __attribute__ ((format (printf, 1, 0))); |
101 | 105 | ||
102 | const char *mode_string(int mode); | 106 | extern const char *bb_mode_string(int mode); |
103 | const char *time_string(time_t timeVal); | 107 | extern int is_directory(const char *name, int followLinks, struct stat *statBuf); |
104 | int is_directory(const char *name, int followLinks, struct stat *statBuf); | 108 | |
105 | int isDevice(const char *name); | 109 | extern int remove_file(const char *path, int flags); |
106 | 110 | extern int copy_file(const char *source, const char *dest, int flags); | |
107 | int remove_file(const char *path, int flags); | 111 | extern ssize_t safe_read(int fd, void *buf, size_t count); |
108 | int copy_file(const char *source, const char *dest, int flags); | 112 | extern ssize_t bb_full_write(int fd, const void *buf, size_t len); |
109 | int copy_file_chunk(FILE *src_file, FILE *dst_file, unsigned long long chunksize); | 113 | extern ssize_t bb_full_read(int fd, void *buf, size_t len); |
110 | char *buildName(const char *dirName, const char *fileName); | 114 | extern int recursive_action(const char *fileName, int recurse, |
111 | int makeString(int argc, const char **argv, char *buf, int bufLen); | 115 | int followLinks, int depthFirst, |
112 | char *getChunk(int size); | ||
113 | char *chunkstrdup(const char *str); | ||
114 | void freeChunks(void); | ||
115 | ssize_t safe_read(int fd, void *buf, size_t count); | ||
116 | int full_write(int fd, const char *buf, int len); | ||
117 | int full_read(int fd, char *buf, int len); | ||
118 | int recursive_action(const char *fileName, int recurse, int followLinks, int depthFirst, | ||
119 | int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData), | 116 | int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData), |
120 | int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData), | 117 | int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData), |
121 | void* userData); | 118 | void* userData); |
122 | 119 | ||
123 | extern int parse_mode( const char* s, mode_t* theMode); | 120 | extern int bb_parse_mode( const char* s, mode_t* theMode); |
124 | extern long bb_xgetlarg(char *arg, int base, long lower, long upper); | 121 | extern long bb_xgetlarg(char *arg, int base, long lower, long upper); |
125 | 122 | ||
123 | extern unsigned long bb_baud_to_value(speed_t speed); | ||
124 | extern speed_t bb_value_to_baud(unsigned long value); | ||
125 | |||
126 | extern int get_kernel_revision(void); | 126 | extern int get_kernel_revision(void); |
127 | 127 | ||
128 | extern int get_console_fd(void); | 128 | extern int get_console_fd(void); |
129 | extern struct mntent *find_mount_point(const char *name, const char *table); | 129 | extern struct mntent *find_mount_point(const char *name, const char *table); |
130 | extern void write_mtab(char* blockDevice, char* directory, | 130 | extern void write_mtab(char* blockDevice, char* directory, |
131 | char* filesystemType, long flags, char* string_flags); | 131 | char* filesystemType, long flags, char* string_flags); |
132 | extern void erase_mtab(const char * name); | 132 | extern void erase_mtab(const char * name); |
133 | extern long atoi_w_units (const char *cp); | 133 | extern long *find_pid_by_name( const char* pidName); |
134 | extern long* find_pid_by_name( const char* pidName); | ||
135 | extern char *find_real_root_device_name(const char* name); | 134 | extern char *find_real_root_device_name(const char* name); |
136 | extern char *get_line_from_file(FILE *file); | 135 | extern char *bb_get_line_from_file(FILE *file); |
137 | extern void print_file(FILE *file); | 136 | extern char *bb_get_chomped_line_from_file(FILE *file); |
138 | extern int copyfd(int fd1, int fd2, const off_t chunksize); | 137 | extern int bb_copyfd(int fd1, int fd2, const off_t chunksize); |
139 | extern int print_file_by_name(char *filename); | 138 | extern void bb_xprint_and_close_file(FILE *file); |
140 | extern char process_escape_sequence(const char **ptr); | 139 | extern int bb_xprint_file_by_name(const char *filename); |
141 | extern char *get_last_path_component(char *path); | 140 | extern char bb_process_escape_sequence(const char **ptr); |
142 | extern FILE *wfopen(const char *path, const char *mode); | 141 | extern char *bb_get_last_path_component(char *path); |
143 | extern FILE *xfopen(const char *path, const char *mode); | 142 | extern FILE *bb_wfopen(const char *path, const char *mode); |
143 | extern FILE *bb_xfopen(const char *path, const char *mode); | ||
144 | |||
145 | //#warning rename? | ||
146 | extern int bb_fclose_nonstdin(FILE *f); | ||
147 | extern void bb_fflush_stdout_and_exit(int retval) __attribute__ ((noreturn)); | ||
148 | extern unsigned long bb_getopt_ulflags(int argc, char **argv, const char *applet_opts); | ||
149 | //#warning rename? | ||
150 | extern FILE *bb_wfopen_input(const char *filename); | ||
151 | |||
152 | extern int bb_vfprintf(FILE * __restrict stream, const char * __restrict format, | ||
153 | va_list arg) __attribute__ ((format (printf, 2, 0))); | ||
154 | extern int bb_vprintf(const char * __restrict format, va_list arg) | ||
155 | __attribute__ ((format (printf, 1, 0))); | ||
156 | extern int bb_fprintf(FILE * __restrict stream, const char * __restrict format, ...) | ||
157 | __attribute__ ((format (printf, 2, 3))); | ||
158 | extern int bb_printf(const char * __restrict format, ...) | ||
159 | __attribute__ ((format (printf, 1, 2))); | ||
160 | |||
161 | //#warning rename to xferror_filename? | ||
162 | extern void bb_xferror(FILE *fp, const char *fn); | ||
163 | extern void bb_xferror_stdout(void); | ||
164 | extern void bb_xfflush_stdout(void); | ||
165 | |||
166 | extern void bb_warn_ignoring_args(int n); | ||
167 | |||
144 | extern void chomp(char *s); | 168 | extern void chomp(char *s); |
145 | extern void trim(char *s); | 169 | extern void trim(char *s); |
170 | extern const char *bb_skip_whitespace(const char *); | ||
171 | |||
146 | extern struct BB_applet *find_applet_by_name(const char *name); | 172 | extern struct BB_applet *find_applet_by_name(const char *name); |
147 | void run_applet_by_name(const char *name, int argc, char **argv); | 173 | void run_applet_by_name(const char *name, int argc, char **argv); |
148 | 174 | ||
175 | //#warning is this needed anymore? | ||
149 | #ifndef DMALLOC | 176 | #ifndef DMALLOC |
150 | extern void *xmalloc (size_t size); | 177 | extern void *xmalloc (size_t size); |
151 | extern void *xrealloc(void *old, size_t size); | 178 | extern void *xrealloc(void *old, size_t size); |
152 | extern void *xcalloc(size_t nmemb, size_t size); | 179 | extern void *xcalloc(size_t nmemb, size_t size); |
153 | extern char *xstrdup (const char *s); | 180 | extern char *bb_xstrdup (const char *s); |
154 | #endif | 181 | #endif |
155 | extern char *xstrndup (const char *s, int n); | 182 | extern char *bb_xstrndup (const char *s, int n); |
156 | extern char * safe_strncpy(char *dst, const char *src, size_t size); | 183 | extern char * safe_strncpy(char *dst, const char *src, size_t size); |
157 | 184 | ||
158 | struct suffix_mult { | 185 | struct suffix_mult { |
159 | const char *suffix; | 186 | const char *suffix; |
160 | int mult; | 187 | unsigned int mult; |
161 | }; | 188 | }; |
162 | 189 | ||
163 | extern unsigned long parse_number(const char *numstr, | 190 | extern unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base, |
191 | unsigned long lower, | ||
192 | unsigned long upper, | ||
193 | const struct suffix_mult *suffixes); | ||
194 | extern unsigned long bb_xgetularg_bnd(const char *arg, int base, | ||
195 | unsigned long lower, | ||
196 | unsigned long upper); | ||
197 | extern unsigned long bb_xgetularg10_bnd(const char *arg, | ||
198 | unsigned long lower, | ||
199 | unsigned long upper); | ||
200 | extern unsigned long bb_xgetularg10(const char *arg); | ||
201 | |||
202 | extern long bb_xgetlarg_bnd_sfx(const char *arg, int base, | ||
203 | long lower, | ||
204 | long upper, | ||
205 | const struct suffix_mult *suffixes); | ||
206 | extern long bb_xgetlarg10_sfx(const char *arg, const struct suffix_mult *suffixes); | ||
207 | |||
208 | |||
209 | //#warning pitchable now? | ||
210 | extern unsigned long bb_xparse_number(const char *numstr, | ||
164 | const struct suffix_mult *suffixes); | 211 | const struct suffix_mult *suffixes); |
165 | 212 | ||
166 | 213 | ||
214 | //#warning change names? | ||
215 | |||
167 | /* These parse entries in /etc/passwd and /etc/group. This is desirable | 216 | /* These parse entries in /etc/passwd and /etc/group. This is desirable |
168 | * for BusyBox since we want to avoid using the glibc NSS stuff, which | 217 | * for BusyBox since we want to avoid using the glibc NSS stuff, which |
169 | * increases target size and is often not needed embedded systems. */ | 218 | * increases target size and is often not needed embedded systems. */ |
@@ -217,7 +266,7 @@ enum { | |||
217 | }; | 266 | }; |
218 | const char *make_human_readable_str(unsigned long size, unsigned long block_size, unsigned long display_unit); | 267 | const char *make_human_readable_str(unsigned long size, unsigned long block_size, unsigned long display_unit); |
219 | 268 | ||
220 | int ask_confirmation(void); | 269 | int bb_ask_confirmation(void); |
221 | int klogctl(int type, char * b, int len); | 270 | int klogctl(int type, char * b, int len); |
222 | 271 | ||
223 | char *xgetcwd(char *cwd); | 272 | char *xgetcwd(char *cwd); |
@@ -228,6 +277,7 @@ char *last_char_is(const char *s, int c); | |||
228 | extern long arith (const char *startbuf, int *errcode); | 277 | extern long arith (const char *startbuf, int *errcode); |
229 | 278 | ||
230 | int read_package_field(const char *package_buffer, char **field_name, char **field_value); | 279 | int read_package_field(const char *package_buffer, char **field_name, char **field_value); |
280 | //#warning yuk! | ||
231 | char *fgets_str(FILE *file, const char *terminating_string); | 281 | char *fgets_str(FILE *file, const char *terminating_string); |
232 | 282 | ||
233 | extern int uncompress(int fd_in, int fd_out); | 283 | extern int uncompress(int fd_in, int fd_out); |
@@ -239,19 +289,15 @@ extern int create_icmp_socket(void); | |||
239 | extern int create_icmp6_socket(void); | 289 | extern int create_icmp6_socket(void); |
240 | extern int xconnect(const char *host, const char *port); | 290 | extern int xconnect(const char *host, const char *port); |
241 | 291 | ||
292 | //#warning wrap this? | ||
242 | char *dirname (char *path); | 293 | char *dirname (char *path); |
243 | 294 | ||
244 | int make_directory (char *path, long mode, int flags); | 295 | int bb_make_directory (char *path, long mode, int flags); |
245 | 296 | ||
246 | const char *u_signal_names(const char *str_sig, int *signo, int startnum); | 297 | const char *u_signal_names(const char *str_sig, int *signo, int startnum); |
247 | char *simplify_path(const char *path); | 298 | char *bb_simplify_path(const char *path); |
248 | |||
249 | #define CT_AUTO 0 | ||
250 | #define CT_UNIX2DOS 1 | ||
251 | #define CT_DOS2UNIX 2 | ||
252 | /* extern int convert(char *fn, int ConvType); */ | ||
253 | 299 | ||
254 | enum { | 300 | enum { /* DO NOT CHANGE THESE VALUES! cp.c depends on them. */ |
255 | FILEUTILS_PRESERVE_STATUS = 1, | 301 | FILEUTILS_PRESERVE_STATUS = 1, |
256 | FILEUTILS_DEREFERENCE = 2, | 302 | FILEUTILS_DEREFERENCE = 2, |
257 | FILEUTILS_RECUR = 4, | 303 | FILEUTILS_RECUR = 4, |
@@ -259,29 +305,31 @@ enum { | |||
259 | FILEUTILS_INTERACTIVE = 16 | 305 | FILEUTILS_INTERACTIVE = 16 |
260 | }; | 306 | }; |
261 | 307 | ||
262 | extern const char *applet_name; | 308 | extern const char *bb_applet_name; |
263 | extern const char * const full_version; | 309 | |
264 | extern const char * const name_too_long; | 310 | extern const char * const bb_msg_full_version; |
265 | extern const char * const omitting_directory; | 311 | extern const char * const bb_msg_memory_exhausted; |
266 | extern const char * const not_a_directory; | 312 | extern const char * const bb_msg_invalid_date; |
267 | extern const char * const memory_exhausted; | 313 | extern const char * const bb_msg_io_error; |
268 | extern const char * const invalid_date; | 314 | extern const char * const bb_msg_write_error; |
269 | extern const char * const invalid_option; | 315 | extern const char * const bb_msg_name_longer_than_foo; |
270 | extern const char * const io_error; | 316 | extern const char * const bb_msg_unknown; |
271 | extern const char * const dash_dash_help; | 317 | extern const char * const bb_msg_can_not_create_raw_socket; |
272 | extern const char * const write_error; | 318 | extern const char * const bb_msg_perm_denied_are_you_root; |
273 | extern const char * const too_few_args; | 319 | extern const char * const bb_msg_standard_input; |
274 | extern const char * const name_longer_than_foo; | 320 | extern const char * const bb_msg_standard_output; |
275 | extern const char * const unknown; | 321 | |
276 | extern const char * const can_not_create_raw_socket; | 322 | extern const char * const bb_path_nologin_file; |
277 | extern const char * const nologin_file; | 323 | extern const char * const bb_path_passwd_file; |
278 | extern const char * const passwd_file; | 324 | extern const char * const bb_path_shadow_file; |
279 | extern const char * const shadow_file; | 325 | extern const char * const bb_path_gshadow_file; |
280 | extern const char * const gshadow_file; | 326 | extern const char * const bb_path_group_file; |
281 | extern const char * const group_file; | 327 | extern const char * const bb_path_securetty_file; |
282 | extern const char * const securetty_file; | 328 | extern const char * const bb_path_motd_file; |
283 | extern const char * const motd_file; | 329 | |
284 | extern const char * const _path_login; | 330 | extern const char bb_path_mtab_file[]; |
331 | |||
332 | extern int bb_default_error_retval; | ||
285 | 333 | ||
286 | #ifdef CONFIG_FEATURE_DEVFS | 334 | #ifdef CONFIG_FEATURE_DEVFS |
287 | # define CURRENT_VC "/dev/vc/0" | 335 | # define CURRENT_VC "/dev/vc/0" |
@@ -309,6 +357,8 @@ extern const char * const _path_login; | |||
309 | # define LOOP_FORMAT "/dev/loop%d" | 357 | # define LOOP_FORMAT "/dev/loop%d" |
310 | #endif | 358 | #endif |
311 | 359 | ||
360 | //#warning put these in .o files | ||
361 | |||
312 | /* The following devices are the same on devfs and non-devfs systems. */ | 362 | /* The following devices are the same on devfs and non-devfs systems. */ |
313 | #define CURRENT_TTY "/dev/tty" | 363 | #define CURRENT_TTY "/dev/tty" |
314 | #define CONSOLE_DEV "/dev/console" | 364 | #define CONSOLE_DEV "/dev/console" |
@@ -318,10 +368,10 @@ void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); | |||
318 | void reset_ino_dev_hashtable(void); | 368 | void reset_ino_dev_hashtable(void); |
319 | 369 | ||
320 | /* Stupid gcc always includes its own builtin strlen()... */ | 370 | /* Stupid gcc always includes its own builtin strlen()... */ |
321 | extern size_t xstrlen(const char *string); | 371 | extern size_t bb_strlen(const char *string); |
322 | #define strlen(x) xstrlen(x) | 372 | #define strlen(x) bb_strlen(x) |
323 | 373 | ||
324 | void bb_asprintf(char **string_ptr, const char *format, ...) __attribute__ ((format (printf, 2, 3))); | 374 | void bb_xasprintf(char **string_ptr, const char *format, ...) __attribute__ ((format (printf, 2, 3))); |
325 | 375 | ||
326 | 376 | ||
327 | #define FAIL_DELAY 3 | 377 | #define FAIL_DELAY 3 |
@@ -335,10 +385,10 @@ extern char *pw_encrypt(const char *clear, const char *salt); | |||
335 | extern struct spwd *pwd_to_spwd(const struct passwd *pw); | 385 | extern struct spwd *pwd_to_spwd(const struct passwd *pw); |
336 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp); | 386 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp); |
337 | 387 | ||
338 | extern int xopen(const char *pathname, int flags); | 388 | extern int bb_xopen(const char *pathname, int flags); |
339 | extern ssize_t xread(int fd, void *buf, size_t count); | 389 | extern ssize_t bb_xread(int fd, void *buf, size_t count); |
340 | extern void xread_all(int fd, void *buf, size_t count); | 390 | extern void bb_xread_all(int fd, void *buf, size_t count); |
341 | extern unsigned char xread_char(int fd); | 391 | extern unsigned char bb_xread_char(int fd); |
342 | 392 | ||
343 | typedef struct { | 393 | typedef struct { |
344 | int pid; | 394 | int pid; |
diff --git a/include/usage.h b/include/usage.h index 8fc12f151..bbc0babfc 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -98,9 +98,11 @@ | |||
98 | "\t-y\tDisplay the entire year." | 98 | "\t-y\tDisplay the entire year." |
99 | 99 | ||
100 | #define cat_trivial_usage \ | 100 | #define cat_trivial_usage \ |
101 | "[FILE]..." | 101 | "[-u] [FILE]..." |
102 | #define cat_full_usage \ | 102 | #define cat_full_usage \ |
103 | "Concatenates FILE(s) and prints them to stdout." | 103 | "Concatenates FILE(s) and prints them to stdout.\n\n" \ |
104 | "Options:\n" \ | ||
105 | "\t-u\tignored since unbuffered i/o is always used" | ||
104 | #define cat_example_usage \ | 106 | #define cat_example_usage \ |
105 | "$ cat /proc/uptime\n" \ | 107 | "$ cat /proc/uptime\n" \ |
106 | "110716.72 17.67" | 108 | "110716.72 17.67" |
@@ -397,20 +399,34 @@ | |||
397 | #define dpkg_deb_example_usage \ | 399 | #define dpkg_deb_example_usage \ |
398 | "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" | 400 | "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" |
399 | 401 | ||
402 | #ifdef CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K | ||
403 | #define USAGE_DU_DEFALT_BLOCKSIZE_1k(a) a | ||
404 | #define USAGE_NOT_DU_DEFALT_BLOCKSIZE_1k(a) | ||
405 | #else | ||
406 | #define USAGE_DU_DEFALT_BLOCKSIZE_1k(a) | ||
407 | #define USAGE_NOT_DU_DEFALT_BLOCKSIZE_1k(a) a | ||
408 | #endif | ||
409 | |||
400 | #define du_trivial_usage \ | 410 | #define du_trivial_usage \ |
401 | "[-lsx" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..." | 411 | "[-aHLdclsx" USAGE_HUMAN_READABLE("hm") "k] [FILE]..." |
402 | #define du_full_usage \ | 412 | #define du_full_usage \ |
403 | "Summarizes disk space used for each FILE and/or directory.\n" \ | 413 | "Summarizes disk space used for each FILE and/or directory.\n" \ |
404 | "Disk space is printed in units of 1024 bytes.\n\n" \ | 414 | "Disk space is printed in units of " \ |
405 | "Options:\n" \ | 415 | USAGE_DU_DEFALT_BLOCKSIZE_1k("1024") USAGE_NOT_DU_DEFALT_BLOCKSIZE_1k("512") \ |
416 | " bytes.\n\n" \ | ||
417 | "Options:\n" \ | ||
418 | "\t-a\tshow sizes of files in addition to directories\n" \ | ||
419 | "\t-H\tfollow symbolic links that are FILE command line args\n" \ | ||
420 | "\t-L\tfollow all symbolic links encountered\n" \ | ||
421 | "\t-d N\tlimit output to directories (and files with -a) of depth < N\n" \ | ||
422 | "\t-c\toutput a grand total\n" \ | ||
406 | "\t-l\tcount sizes many times if hard linked\n" \ | 423 | "\t-l\tcount sizes many times if hard linked\n" \ |
407 | "\t-s\tdisplay only a total for each argument" \ | 424 | "\t-s\tdisplay only a total for each argument\n" \ |
408 | USAGE_HUMAN_READABLE( \ | ||
409 | "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \ | ||
410 | "\t-m\tprint sizes in megabytes\n" \ | ||
411 | "\t-x\tskip directories on different filesystems\n" \ | 425 | "\t-x\tskip directories on different filesystems\n" \ |
412 | "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \ | 426 | USAGE_HUMAN_READABLE( \ |
413 | "\n\t-k\tprint sizes in kilobytes(compatibility)") | 427 | "\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \ |
428 | "\t-m\tprint sizes in megabytes\n" ) \ | ||
429 | "\t-k\tprint sizes in kilobytes" USAGE_DU_DEFALT_BLOCKSIZE_1k("(default)") | ||
414 | #define du_example_usage \ | 430 | #define du_example_usage \ |
415 | "$ du\n" \ | 431 | "$ du\n" \ |
416 | "16 ./CVS\n" \ | 432 | "16 ./CVS\n" \ |
@@ -451,25 +467,31 @@ | |||
451 | "8|125||l4|||0|0|0|955637629|998367|0\n" \ | 467 | "8|125||l4|||0|0|0|955637629|998367|0\n" \ |
452 | "6|245|tty1|1|LOGIN||0|0|0|955637630|998974|0\n" \ | 468 | "6|245|tty1|1|LOGIN||0|0|0|955637630|998974|0\n" \ |
453 | "6|246|tty2|2|LOGIN||0|0|0|955637630|999498|0\n" \ | 469 | "6|246|tty2|2|LOGIN||0|0|0|955637630|999498|0\n" \ |
454 | "7|336|pts/0|vt00andersen|andersen|:0.0|0|0|0|955637763|0|0\n" | 470 | "7|336|pts/0|vt00|andersen|:0.0|0|0|0|955637763|0|0\n" |
471 | |||
472 | #ifdef CONFIG_FEATURE_FANCY_ECHO | ||
473 | #define USAGE_FANCY_ECHO(a) a | ||
474 | #else | ||
475 | #define USAGE_FANCY_ECHO(a) | ||
476 | #endif | ||
455 | 477 | ||
456 | #define echo_trivial_usage \ | 478 | #define echo_trivial_usage \ |
457 | "[-neE] [ARG ...]" | 479 | USAGE_FANCY_ECHO("[-neE] ") "[ARG ...]" |
458 | #define echo_full_usage \ | 480 | #define echo_full_usage \ |
459 | "Prints the specified ARGs to stdout\n\n" \ | 481 | "Prints the specified ARGs to stdout\n\n" \ |
460 | "Options:\n" \ | 482 | USAGE_FANCY_ECHO("Options:\n" \ |
461 | "\t-n\tsuppress trailing newline\n" \ | 483 | "\t-n\tsuppress trailing newline\n" \ |
462 | "\t-e\tinterpret backslash-escaped characters (i.e., \\t=tab)\n" \ | 484 | "\t-e\tinterpret backslash-escaped characters (i.e., \\t=tab)\n" \ |
463 | "\t-E\tdisable interpretation of backslash-escaped characters" | 485 | "\t-E\tdisable interpretation of backslash-escaped characters") |
464 | #define echo_example_usage \ | 486 | #define echo_example_usage \ |
465 | "$ echo "Erik is cool"\n" \ | 487 | "$ echo "Erik is cool"\n" \ |
466 | "Erik is cool\n" \ | 488 | "Erik is cool\n" \ |
467 | "$ echo -e "Erik\\nis\\ncool"\n" \ | 489 | USAGE_FANCY_ECHO("$ echo -e "Erik\\nis\\ncool"\n" \ |
468 | "Erik\n" \ | 490 | "Erik\n" \ |
469 | "is\n" \ | 491 | "is\n" \ |
470 | "cool\n" \ | 492 | "cool\n" \ |
471 | "$ echo "Erik\\nis\\ncool"\n" \ | 493 | "$ echo "Erik\\nis\\ncool"\n" \ |
472 | "Erik\\nis\\ncool\n" | 494 | "Erik\\nis\\ncool\n") |
473 | 495 | ||
474 | #define env_trivial_usage \ | 496 | #define env_trivial_usage \ |
475 | "[-iu] [-] [name=value]... [command]" | 497 | "[-iu] [-] [name=value]... [command]" |
@@ -757,6 +779,12 @@ | |||
757 | #define halt_full_usage \ | 779 | #define halt_full_usage \ |
758 | "Halt the system." | 780 | "Halt the system." |
759 | 781 | ||
782 | #ifdef CONFIG_FEATURE_FANCY_HEAD | ||
783 | #define USAGE_FANCY_HEAD(a) a | ||
784 | #else | ||
785 | #define USAGE_FANCY_HEAD(a) | ||
786 | #endif | ||
787 | |||
760 | #define head_trivial_usage \ | 788 | #define head_trivial_usage \ |
761 | "[OPTION] [FILE]..." | 789 | "[OPTION] [FILE]..." |
762 | #define head_full_usage \ | 790 | #define head_full_usage \ |
@@ -764,7 +792,11 @@ | |||
764 | "With more than one FILE, precede each with a header giving the\n" \ | 792 | "With more than one FILE, precede each with a header giving the\n" \ |
765 | "file name. With no FILE, or when FILE is -, read standard input.\n\n" \ | 793 | "file name. With no FILE, or when FILE is -, read standard input.\n\n" \ |
766 | "Options:\n" \ | 794 | "Options:\n" \ |
767 | "\t-n NUM\t\tPrint first NUM lines instead of first 10" | 795 | "\t-n NUM\t\tPrint first NUM lines instead of first 10" \ |
796 | USAGE_FANCY_HEAD( \ | ||
797 | "\n\t-c NUM\t\toutput the first NUM bytes\n" \ | ||
798 | "\t-q\t\tnever output headers giving file names\n" \ | ||
799 | "\t-v\t\talways output headers giving file names" ) | ||
768 | #define head_example_usage \ | 800 | #define head_example_usage \ |
769 | "$ head -n 2 /etc/passwd\n" \ | 801 | "$ head -n 2 /etc/passwd\n" \ |
770 | "root:x:0:0:root:/root:/bin/bash\n" \ | 802 | "root:x:0:0:root:/root:/bin/bash\n" \ |
@@ -1762,7 +1794,7 @@ | |||
1762 | "Remove (unlink) the FILE(s). You may use '--' to\n" \ | 1794 | "Remove (unlink) the FILE(s). You may use '--' to\n" \ |
1763 | "indicate that all following arguments are non-options.\n\n" \ | 1795 | "indicate that all following arguments are non-options.\n\n" \ |
1764 | "Options:\n" \ | 1796 | "Options:\n" \ |
1765 | "\t-i\t\talways prompt before removing each destination" \ | 1797 | "\t-i\t\talways prompt before removing each destination\n" \ |
1766 | "\t-f\t\tremove existing destinations, never prompt\n" \ | 1798 | "\t-f\t\tremove existing destinations, never prompt\n" \ |
1767 | "\t-r or -R\tremove the contents of directories recursively" | 1799 | "\t-r or -R\tremove the contents of directories recursively" |
1768 | #define rm_example_usage \ | 1800 | #define rm_example_usage \ |
@@ -1864,14 +1896,26 @@ | |||
1864 | #define sha1sum_full_usage \ | 1896 | #define sha1sum_full_usage \ |
1865 | "[OPTION] [FILE]" | 1897 | "[OPTION] [FILE]" |
1866 | 1898 | ||
1899 | #ifdef CONFIG_FEATURE_FANCY_SLEEP | ||
1900 | #define USAGE_FANCY_SLEEP(a) a | ||
1901 | #define USAGE_NOT_FANCY_SLEEP(a) | ||
1902 | #else | ||
1903 | #define USAGE_FANCY_SLEEP(a) | ||
1904 | #define USAGE_NOT_FANCY_SLEEP(a) a | ||
1905 | #endif | ||
1906 | |||
1867 | #define sleep_trivial_usage \ | 1907 | #define sleep_trivial_usage \ |
1868 | "N" | 1908 | USAGE_FANCY_SLEEP("[") "N" USAGE_FANCY_SLEEP("]...") |
1869 | #define sleep_full_usage \ | 1909 | #define sleep_full_usage \ |
1870 | "Pause for N seconds." | 1910 | USAGE_NOT_FANCY_SLEEP("Pause for N seconds.") \ |
1911 | USAGE_FANCY_SLEEP( \ | ||
1912 | "Pause for a time equal to the total of the args given, where each arg can\n" \ | ||
1913 | "have an optional suffix of (s)econds, (m)inutes, (h)ours, or (d)ays.") | ||
1871 | #define sleep_example_usage \ | 1914 | #define sleep_example_usage \ |
1872 | "$ sleep 2\n" \ | 1915 | "$ sleep 2\n" \ |
1873 | "[2 second delay results]\n" | 1916 | "[2 second delay results]\n" \ |
1874 | 1917 | USAGE_FANCY_SLEEP("$ sleep 1d 3h 22m 8s\n" \ | |
1918 | "[98528 second delay results]\n") | ||
1875 | 1919 | ||
1876 | #ifdef CONFIG_FEATURE_SORT_UNIQUE | 1920 | #ifdef CONFIG_FEATURE_SORT_UNIQUE |
1877 | #define USAGE_SORT_UNIQUE(a) a | 1921 | #define USAGE_SORT_UNIQUE(a) a |
@@ -2077,7 +2121,8 @@ | |||
2077 | #define tee_full_usage \ | 2121 | #define tee_full_usage \ |
2078 | "Copy standard input to each FILE, and also to standard output.\n\n" \ | 2122 | "Copy standard input to each FILE, and also to standard output.\n\n" \ |
2079 | "Options:\n" \ | 2123 | "Options:\n" \ |
2080 | "\t-a\tappend to the given FILEs, do not overwrite" | 2124 | "\t-a\tappend to the given FILEs, do not overwrite\n" \ |
2125 | "\t-i\tignore interrupt signals (SIGINT)" | ||
2081 | #define tee_example_usage \ | 2126 | #define tee_example_usage \ |
2082 | "$ echo "Hello" | tee /tmp/foo\n" \ | 2127 | "$ echo "Hello" | tee /tmp/foo\n" \ |
2083 | "$ cat /tmp/foo\n" \ | 2128 | "$ cat /tmp/foo\n" \ |
@@ -2312,7 +2357,9 @@ | |||
2312 | "Options:\n" \ | 2357 | "Options:\n" \ |
2313 | "\t-c\tprefix lines by the number of occurrences\n" \ | 2358 | "\t-c\tprefix lines by the number of occurrences\n" \ |
2314 | "\t-d\tonly print duplicate lines\n" \ | 2359 | "\t-d\tonly print duplicate lines\n" \ |
2315 | "\t-u\tonly print unique lines" | 2360 | "\t-u\tonly print unique lines\n" \ |
2361 | "\t-f N\tskip the first N fields\n" \ | ||
2362 | "\t-s N\tskip the first N chars (after any skipped fields)" | ||
2316 | #define uniq_example_usage \ | 2363 | #define uniq_example_usage \ |
2317 | "$ echo -e \"a\\na\\nb\\nc\\nc\\na\" | sort | uniq\n" \ | 2364 | "$ echo -e \"a\\na\\nb\\nc\\nc\\na\" | sort | uniq\n" \ |
2318 | "a\n" \ | 2365 | "a\n" \ |