diff options
| author | Erik Andersen <andersen@codepoet.org> | 2000-05-12 19:41:47 +0000 |
|---|---|---|
| committer | Erik Andersen <andersen@codepoet.org> | 2000-05-12 19:41:47 +0000 |
| commit | 7ab9c7ee52db8759d457819f5480378fa3aa97cc (patch) | |
| tree | 37ef0fb8b142a4925b866c7caa5207b71b4ecae6 | |
| parent | 3d427ac5efd249dc25dd03deb30520335f68911a (diff) | |
| download | busybox-w32-7ab9c7ee52db8759d457819f5480378fa3aa97cc.tar.gz busybox-w32-7ab9c7ee52db8759d457819f5480378fa3aa97cc.tar.bz2 busybox-w32-7ab9c7ee52db8759d457819f5480378fa3aa97cc.zip | |
Lots of updates. Finished implementing BB_FEATURE_TRIVIAL_HELP
which lets you compile out most of the "--help" output, saving
up to 17k.
Renamed mnc to nc.
-Erik
| -rw-r--r-- | Changelog | 8 | ||||
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | applets/busybox.c | 7 | ||||
| -rw-r--r-- | archival/gunzip.c | 17 | ||||
| -rw-r--r-- | archival/gzip.c | 17 | ||||
| -rw-r--r-- | archival/tar.c | 6 | ||||
| -rw-r--r-- | busybox.c | 7 | ||||
| -rw-r--r-- | busybox.def.h | 5 | ||||
| -rw-r--r-- | console-tools/loadacm.c | 7 | ||||
| -rw-r--r-- | console-tools/loadfont.c | 7 | ||||
| -rw-r--r-- | console-tools/loadkmap.c | 7 | ||||
| -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 | ||||
| -rw-r--r-- | cut.c | 372 | ||||
| -rw-r--r-- | docs/busybox.pod | 12 | ||||
| -rw-r--r-- | editors/sed.c | 9 | ||||
| -rw-r--r-- | fbset.c | 16 | ||||
| -rw-r--r-- | fdflush.c | 6 | ||||
| -rw-r--r-- | find.c | 9 | ||||
| -rw-r--r-- | findutils/find.c | 9 | ||||
| -rw-r--r-- | findutils/grep.c | 9 | ||||
| -rw-r--r-- | free.c | 8 | ||||
| -rw-r--r-- | freeramdisk.c | 7 | ||||
| -rw-r--r-- | fsck_minix.c | 6 | ||||
| -rw-r--r-- | grep.c | 9 | ||||
| -rw-r--r-- | gunzip.c | 17 | ||||
| -rw-r--r-- | gzip.c | 17 | ||||
| -rw-r--r-- | head.c | 11 | ||||
| -rw-r--r-- | hostname.c | 11 | ||||
| -rw-r--r-- | id.c | 9 | ||||
| -rw-r--r-- | insmod.c | 9 | ||||
| -rw-r--r-- | internal.h | 5 | ||||
| -rw-r--r-- | kill.c | 18 | ||||
| -rw-r--r-- | lash.c | 7 | ||||
| -rw-r--r-- | length.c | 6 | ||||
| -rw-r--r-- | ln.c | 9 | ||||
| -rw-r--r-- | loadacm.c | 7 | ||||
| -rw-r--r-- | loadfont.c | 7 | ||||
| -rw-r--r-- | loadkmap.c | 7 | ||||
| -rw-r--r-- | logger.c | 9 | ||||
| -rw-r--r-- | logname.c | 8 | ||||
| -rw-r--r-- | ls.c | 5 | ||||
| -rw-r--r-- | makedevs.c | 9 | ||||
| -rw-r--r-- | math.c | 9 | ||||
| -rw-r--r-- | messages.c | 12 | ||||
| -rw-r--r-- | miscutils/makedevs.c | 9 | ||||
| -rw-r--r-- | miscutils/mt.c | 7 | ||||
| -rw-r--r-- | miscutils/update.c | 9 | ||||
| -rw-r--r-- | mkdir.c | 9 | ||||
| -rw-r--r-- | mkfifo.c | 10 | ||||
| -rw-r--r-- | mkfs_minix.c | 6 | ||||
| -rw-r--r-- | mknod.c | 9 | ||||
| -rw-r--r-- | mkswap.c | 9 | ||||
| -rw-r--r-- | modutils/insmod.c | 9 | ||||
| -rw-r--r-- | modutils/rmmod.c | 11 | ||||
| -rw-r--r-- | more.c | 11 | ||||
| -rw-r--r-- | mount.c | 18 | ||||
| -rw-r--r-- | mt.c | 7 | ||||
| -rw-r--r-- | nc.c (renamed from mnc.c) | 14 | ||||
| -rw-r--r-- | networking/hostname.c | 11 | ||||
| -rw-r--r-- | networking/nc.c | 133 | ||||
| -rw-r--r-- | networking/nslookup.c | 8 | ||||
| -rw-r--r-- | networking/ping.c | 17 | ||||
| -rw-r--r-- | networking/telnet.c | 9 | ||||
| -rw-r--r-- | nslookup.c | 8 | ||||
| -rw-r--r-- | ping.c | 17 | ||||
| -rw-r--r-- | printf.c | 7 | ||||
| -rw-r--r-- | procps/free.c | 8 | ||||
| -rw-r--r-- | procps/kill.c | 18 | ||||
| -rw-r--r-- | procps/ps.c | 12 | ||||
| -rw-r--r-- | ps.c | 12 | ||||
| -rw-r--r-- | pwd.c | 7 | ||||
| -rw-r--r-- | rm.c | 10 | ||||
| -rw-r--r-- | rmdir.c | 6 | ||||
| -rw-r--r-- | rmmod.c | 11 | ||||
| -rw-r--r-- | sed.c | 9 | ||||
| -rw-r--r-- | sfdisk.c | 12 | ||||
| -rw-r--r-- | sh.c | 7 | ||||
| -rw-r--r-- | shell/lash.c | 7 | ||||
| -rw-r--r-- | sleep.c | 6 | ||||
| -rw-r--r-- | sort.c | 8 | ||||
| -rw-r--r-- | swaponoff.c | 18 | ||||
| -rw-r--r-- | sync.c | 6 | ||||
| -rw-r--r-- | sysklogd/logger.c | 9 | ||||
| -rw-r--r-- | sysklogd/syslogd.c | 9 | ||||
| -rw-r--r-- | syslogd.c | 9 | ||||
| -rw-r--r-- | tail.c | 23 | ||||
| -rw-r--r-- | tar.c | 6 | ||||
| -rw-r--r-- | tee.c | 8 | ||||
| -rw-r--r-- | telnet.c | 9 | ||||
| -rw-r--r-- | test.c | 14 | ||||
| -rw-r--r-- | touch.c | 8 | ||||
| -rw-r--r-- | tty.c | 9 | ||||
| -rw-r--r-- | umount.c | 7 | ||||
| -rw-r--r-- | uniq.c | 11 | ||||
| -rw-r--r-- | update.c | 9 | ||||
| -rw-r--r-- | usleep.c | 6 | ||||
| -rw-r--r-- | util-linux/fbset.c | 16 | ||||
| -rw-r--r-- | util-linux/fdflush.c | 6 | ||||
| -rw-r--r-- | util-linux/freeramdisk.c | 7 | ||||
| -rw-r--r-- | util-linux/fsck_minix.c | 6 | ||||
| -rw-r--r-- | util-linux/mkfs_minix.c | 6 | ||||
| -rw-r--r-- | util-linux/mkswap.c | 9 | ||||
| -rw-r--r-- | util-linux/more.c | 11 | ||||
| -rw-r--r-- | util-linux/mount.c | 18 | ||||
| -rw-r--r-- | util-linux/swaponoff.c | 18 | ||||
| -rw-r--r-- | util-linux/umount.c | 7 | ||||
| -rw-r--r-- | utility.c | 74 | ||||
| -rw-r--r-- | wc.c | 9 | ||||
| -rw-r--r-- | whoami.c | 7 | ||||
| -rw-r--r-- | yes.c | 7 |
136 files changed, 1743 insertions, 454 deletions
| @@ -3,6 +3,8 @@ | |||
| 3 | updated docs/busybox.pod accordingly. -beppu | 3 | updated docs/busybox.pod accordingly. -beppu |
| 4 | * Added mktemp, contributed by Daniel Jacobowitz <dan@debian.org> | 4 | * Added mktemp, contributed by Daniel Jacobowitz <dan@debian.org> |
| 5 | * Added setkeycodes, for those that have wierd keyboard buttons. | 5 | * Added setkeycodes, for those that have wierd keyboard buttons. |
| 6 | * Added cut and tr from minix, since due to the license change, | ||
| 7 | we can now use minix code. Minix tr saves 4k. | ||
| 6 | * Fix for ping warnings from Sascha Ziemann <szi@aibon.ping.de> | 8 | * Fix for ping warnings from Sascha Ziemann <szi@aibon.ping.de> |
| 7 | * Fixed update segfault | 9 | * Fixed update segfault |
| 8 | * Fixed mknod -- minor number was always 0 | 10 | * Fixed mknod -- minor number was always 0 |
| @@ -18,9 +20,6 @@ | |||
| 18 | * added a simple id implementation; doesn't support sup. groups yet | 20 | * added a simple id implementation; doesn't support sup. groups yet |
| 19 | * logname used getlogin(3) which uses utmp. Now it doesn't. | 21 | * logname used getlogin(3) which uses utmp. Now it doesn't. |
| 20 | * whoami used getpwuid(3) which uses libc NSS. Now it behaves. | 22 | * whoami used getpwuid(3) which uses libc NSS. Now it behaves. |
| 21 | * Due to the license change, I can now use minix code. Minux tr | ||
| 22 | replaces the BSD derived tr, saving 4k and eliminating bsearch(3) | ||
| 23 | from the list of used Libc symbols. | ||
| 24 | * Add support for "noatime" and "nodiratime" mount flags to mount. | 23 | * Add support for "noatime" and "nodiratime" mount flags to mount. |
| 25 | * Changed 'umount -f' to mean force, and actually use umount2. | 24 | * Changed 'umount -f' to mean force, and actually use umount2. |
| 26 | * Changed 'umount -l' to mean "Do not free loop device". | 25 | * Changed 'umount -l' to mean "Do not free loop device". |
| @@ -29,6 +28,9 @@ | |||
| 29 | * More doc updates | 28 | * More doc updates |
| 30 | * cp -fa now works as expected for symlinks (it didn't before) | 29 | * cp -fa now works as expected for symlinks (it didn't before) |
| 31 | * zcat now works (wasn't working since option parsing was broken) | 30 | * zcat now works (wasn't working since option parsing was broken) |
| 31 | * Renamed "mnc" to the more correct "nc". | ||
| 32 | * Added BB_FEATURE_TRIVIAL_HELP which compiles out most all of the | ||
| 33 | help messages (i.e --help). Saves 17k over a full compile. | ||
| 32 | 34 | ||
| 33 | 35 | ||
| 34 | -Erik | 36 | -Erik |
| @@ -26,7 +26,7 @@ export VERSION | |||
| 26 | # Set the following to `true' to make a debuggable build. | 26 | # Set the following to `true' to make a debuggable build. |
| 27 | # Leave this set to `false' for production use. | 27 | # Leave this set to `false' for production use. |
| 28 | # eg: `make DODEBUG=true tests' | 28 | # eg: `make DODEBUG=true tests' |
| 29 | DODEBUG = true | 29 | DODEBUG = false |
| 30 | 30 | ||
| 31 | # If you want a static binary, turn this on. | 31 | # If you want a static binary, turn this on. |
| 32 | DOSTATIC = false | 32 | DOSTATIC = false |
diff --git a/applets/busybox.c b/applets/busybox.c index d8a38ada3..85b42df23 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
| @@ -65,6 +65,9 @@ static const struct Applet applets[] = { | |||
| 65 | #ifdef BB_CP_MV | 65 | #ifdef BB_CP_MV |
| 66 | {"cp", cp_mv_main, _BB_DIR_BIN}, | 66 | {"cp", cp_mv_main, _BB_DIR_BIN}, |
| 67 | #endif | 67 | #endif |
| 68 | #ifdef BB_CUT | ||
| 69 | {"cut", cut_main, _BB_DIR_USR_BIN}, | ||
| 70 | #endif | ||
| 68 | #ifdef BB_DATE | 71 | #ifdef BB_DATE |
| 69 | {"date", date_main, _BB_DIR_BIN}, | 72 | {"date", date_main, _BB_DIR_BIN}, |
| 70 | #endif | 73 | #endif |
| @@ -203,8 +206,8 @@ static const struct Applet applets[] = { | |||
| 203 | #ifdef BB_MKTEMP | 206 | #ifdef BB_MKTEMP |
| 204 | {"mktemp", mktemp_main, _BB_DIR_BIN}, | 207 | {"mktemp", mktemp_main, _BB_DIR_BIN}, |
| 205 | #endif | 208 | #endif |
| 206 | #ifdef BB_MNC | 209 | #ifdef BB_NC |
| 207 | {"mnc", mnc_main, _BB_DIR_USR_BIN}, | 210 | {"nc", nc_main, _BB_DIR_USR_BIN}, |
| 208 | #endif | 211 | #endif |
| 209 | #ifdef BB_MORE | 212 | #ifdef BB_MORE |
| 210 | {"more", more_main, _BB_DIR_BIN}, | 213 | {"more", more_main, _BB_DIR_BIN}, |
diff --git a/archival/gunzip.c b/archival/gunzip.c index bdf8dc293..11fc3a8f9 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c | |||
| @@ -28,13 +28,17 @@ | |||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include "internal.h" | 30 | #include "internal.h" |
| 31 | |||
| 31 | static const char gunzip_usage[] = | 32 | static const char gunzip_usage[] = |
| 32 | "gunzip [OPTION]... FILE\n\n" | 33 | "gunzip [OPTION]... FILE\n" |
| 33 | "Uncompress FILE (or standard input if FILE is '-').\n\n" | 34 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 35 | "\nUncompress FILE (or standard input if FILE is '-').\n\n" | ||
| 34 | "Options:\n" | 36 | "Options:\n" |
| 35 | 37 | ||
| 36 | "\t-c\tWrite output to standard output\n" | 38 | "\t-c\tWrite output to standard output\n" |
| 37 | "\t-t\tTest compressed file integrity\n"; | 39 | "\t-t\tTest compressed file integrity\n" |
| 40 | #endif | ||
| 41 | ; | ||
| 38 | 42 | ||
| 39 | 43 | ||
| 40 | /* These defines are very important for BusyBox. Without these, | 44 | /* These defines are very important for BusyBox. Without these, |
| @@ -43,8 +47,9 @@ static const char gunzip_usage[] = | |||
| 43 | #define SMALL_MEM | 47 | #define SMALL_MEM |
| 44 | #define DYN_ALLOC | 48 | #define DYN_ALLOC |
| 45 | 49 | ||
| 46 | #define bb_need_name_too_long | ||
| 47 | #define BB_DECLARE_EXTERN | 50 | #define BB_DECLARE_EXTERN |
| 51 | #define bb_need_memory_exhausted | ||
| 52 | #define bb_need_name_too_long | ||
| 48 | #include "messages.c" | 53 | #include "messages.c" |
| 49 | 54 | ||
| 50 | 55 | ||
| @@ -206,7 +211,7 @@ extern int method; /* compression method */ | |||
| 206 | # define DECLARE(type, array, size) type * array | 211 | # define DECLARE(type, array, size) type * array |
| 207 | # define ALLOC(type, array, size) { \ | 212 | # define ALLOC(type, array, size) { \ |
| 208 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 213 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
| 209 | if (array == NULL) errorMsg("insufficient memory"); \ | 214 | if (array == NULL) errorMsg(memory_exhausted, "gunzip"); \ |
| 210 | } | 215 | } |
| 211 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 216 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
| 212 | #else | 217 | #else |
| @@ -1053,7 +1058,7 @@ int in, out; /* input and output file descriptors */ | |||
| 1053 | int res = inflate(); | 1058 | int res = inflate(); |
| 1054 | 1059 | ||
| 1055 | if (res == 3) { | 1060 | if (res == 3) { |
| 1056 | errorMsg("out of memory"); | 1061 | errorMsg(memory_exhausted, "gunzip"); |
| 1057 | } else if (res != 0) { | 1062 | } else if (res != 0) { |
| 1058 | errorMsg("invalid compressed data--format violated"); | 1063 | errorMsg("invalid compressed data--format violated"); |
| 1059 | } | 1064 | } |
diff --git a/archival/gzip.c b/archival/gzip.c index cc6868b53..17ebf6cb7 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
| @@ -30,6 +30,9 @@ | |||
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | #include "internal.h" | 32 | #include "internal.h" |
| 33 | #define BB_DECLARE_EXTERN | ||
| 34 | #define bb_need_memory_exhausted | ||
| 35 | #include "messages.c" | ||
| 33 | 36 | ||
| 34 | /* These defines are very important for BusyBox. Without these, | 37 | /* These defines are very important for BusyBox. Without these, |
| 35 | * huge chunks of ram are pre-allocated making the BusyBox bss | 38 | * huge chunks of ram are pre-allocated making the BusyBox bss |
| @@ -39,12 +42,15 @@ | |||
| 39 | 42 | ||
| 40 | 43 | ||
| 41 | static const char gzip_usage[] = | 44 | static const char gzip_usage[] = |
| 42 | "gzip [OPTION]... FILE\n\n" | 45 | "gzip [OPTION]... FILE\n" |
| 43 | "Compress FILE with maximum compression.\n" | 46 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 47 | "\nCompress FILE with maximum compression.\n" | ||
| 44 | "When FILE is '-', reads standard input. Implies -c.\n\n" | 48 | "When FILE is '-', reads standard input. Implies -c.\n\n" |
| 45 | 49 | ||
| 46 | "Options:\n" | 50 | "Options:\n" |
| 47 | "\t-c\tWrite output to standard output instead of FILE.gz\n"; | 51 | "\t-c\tWrite output to standard output instead of FILE.gz\n" |
| 52 | #endif | ||
| 53 | ; | ||
| 48 | 54 | ||
| 49 | 55 | ||
| 50 | /* I don't like nested includes, but the string and io functions are used | 56 | /* I don't like nested includes, but the string and io functions are used |
| @@ -121,7 +127,7 @@ extern int method; /* compression method */ | |||
| 121 | # define DECLARE(type, array, size) type * array | 127 | # define DECLARE(type, array, size) type * array |
| 122 | # define ALLOC(type, array, size) { \ | 128 | # define ALLOC(type, array, size) { \ |
| 123 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 129 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
| 124 | if (array == NULL) errorMsg("insufficient memory"); \ | 130 | if (array == NULL) errorMsg(memory_exhausted, "gzip"); \ |
| 125 | } | 131 | } |
| 126 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 132 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
| 127 | #else | 133 | #else |
| @@ -1778,7 +1784,6 @@ int part_nb; /* number of parts in .gz file */ | |||
| 1778 | long time_stamp; /* original time stamp (modification time) */ | 1784 | long time_stamp; /* original time stamp (modification time) */ |
| 1779 | long ifile_size; /* input file size, -1 for devices (debug only) */ | 1785 | long ifile_size; /* input file size, -1 for devices (debug only) */ |
| 1780 | char *env; /* contents of GZIP env variable */ | 1786 | char *env; /* contents of GZIP env variable */ |
| 1781 | char **args = NULL; /* argv pointer if GZIP env variable defined */ | ||
| 1782 | char z_suffix[MAX_SUFFIX + 1]; /* default suffix (can be set with --suffix) */ | 1787 | char z_suffix[MAX_SUFFIX + 1]; /* default suffix (can be set with --suffix) */ |
| 1783 | int z_len; /* strlen(z_suffix) */ | 1788 | int z_len; /* strlen(z_suffix) */ |
| 1784 | 1789 | ||
| @@ -3248,7 +3253,7 @@ char *env; /* name of environment variable */ | |||
| 3248 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); | 3253 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); |
| 3249 | 3254 | ||
| 3250 | if (nargv == NULL) | 3255 | if (nargv == NULL) |
| 3251 | errorMsg("out of memory"); | 3256 | errorMsg(memory_exhausted, "gzip"); |
| 3252 | oargv = *argvp; | 3257 | oargv = *argvp; |
| 3253 | *argvp = nargv; | 3258 | *argvp = nargv; |
| 3254 | 3259 | ||
diff --git a/archival/tar.c b/archival/tar.c index c82e51fe9..6784d80ff 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
| @@ -60,8 +60,9 @@ static const char tar_usage[] = | |||
| 60 | #if defined BB_FEATURE_TAR_EXCLUDE | 60 | #if defined BB_FEATURE_TAR_EXCLUDE |
| 61 | "[--exclude File] " | 61 | "[--exclude File] " |
| 62 | #endif | 62 | #endif |
| 63 | "[-f tarFile] [FILE] ...\n\n" | 63 | "[-f tarFile] [FILE] ...\n" |
| 64 | "Create, extract, or list files from a tar file. Note that\n" | 64 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 65 | "\nCreate, extract, or list files from a tar file. Note that\n" | ||
| 65 | "this version of tar treats hard links as separate files.\n\n" | 66 | "this version of tar treats hard links as separate files.\n\n" |
| 66 | "Main operation mode:\n" | 67 | "Main operation mode:\n" |
| 67 | #ifdef BB_FEATURE_TAR_CREATE | 68 | #ifdef BB_FEATURE_TAR_CREATE |
| @@ -77,6 +78,7 @@ static const char tar_usage[] = | |||
| 77 | #endif | 78 | #endif |
| 78 | "\nInformative output:\n" | 79 | "\nInformative output:\n" |
| 79 | "\tv\t\tverbosely list files processed\n" | 80 | "\tv\t\tverbosely list files processed\n" |
| 81 | #endif | ||
| 80 | ; | 82 | ; |
| 81 | 83 | ||
| 82 | /* Tar file constants */ | 84 | /* Tar file constants */ |
| @@ -65,6 +65,9 @@ static const struct Applet applets[] = { | |||
| 65 | #ifdef BB_CP_MV | 65 | #ifdef BB_CP_MV |
| 66 | {"cp", cp_mv_main, _BB_DIR_BIN}, | 66 | {"cp", cp_mv_main, _BB_DIR_BIN}, |
| 67 | #endif | 67 | #endif |
| 68 | #ifdef BB_CUT | ||
| 69 | {"cut", cut_main, _BB_DIR_USR_BIN}, | ||
| 70 | #endif | ||
| 68 | #ifdef BB_DATE | 71 | #ifdef BB_DATE |
| 69 | {"date", date_main, _BB_DIR_BIN}, | 72 | {"date", date_main, _BB_DIR_BIN}, |
| 70 | #endif | 73 | #endif |
| @@ -203,8 +206,8 @@ static const struct Applet applets[] = { | |||
| 203 | #ifdef BB_MKTEMP | 206 | #ifdef BB_MKTEMP |
| 204 | {"mktemp", mktemp_main, _BB_DIR_BIN}, | 207 | {"mktemp", mktemp_main, _BB_DIR_BIN}, |
| 205 | #endif | 208 | #endif |
| 206 | #ifdef BB_MNC | 209 | #ifdef BB_NC |
| 207 | {"mnc", mnc_main, _BB_DIR_USR_BIN}, | 210 | {"nc", nc_main, _BB_DIR_USR_BIN}, |
| 208 | #endif | 211 | #endif |
| 209 | #ifdef BB_MORE | 212 | #ifdef BB_MORE |
| 210 | {"more", more_main, _BB_DIR_BIN}, | 213 | {"more", more_main, _BB_DIR_BIN}, |
diff --git a/busybox.def.h b/busybox.def.h index a2d216ff7..744db85e8 100644 --- a/busybox.def.h +++ b/busybox.def.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #define BB_CHVT | 14 | #define BB_CHVT |
| 15 | #define BB_CLEAR | 15 | #define BB_CLEAR |
| 16 | #define BB_CP_MV | 16 | #define BB_CP_MV |
| 17 | #define BB_CUT | ||
| 17 | #define BB_DATE | 18 | #define BB_DATE |
| 18 | #define BB_DD | 19 | #define BB_DD |
| 19 | #define BB_DEALLOCVT | 20 | #define BB_DEALLOCVT |
| @@ -60,7 +61,7 @@ | |||
| 60 | #define BB_MKNOD | 61 | #define BB_MKNOD |
| 61 | #define BB_MKSWAP | 62 | #define BB_MKSWAP |
| 62 | #define BB_MKTEMP | 63 | #define BB_MKTEMP |
| 63 | #define BB_MNC | 64 | #define BB_NC |
| 64 | #define BB_MORE | 65 | #define BB_MORE |
| 65 | #define BB_MOUNT | 66 | #define BB_MOUNT |
| 66 | #define BB_MT | 67 | #define BB_MT |
| @@ -134,7 +135,7 @@ | |||
| 134 | // | 135 | // |
| 135 | // This compiles out everything but the most | 136 | // This compiles out everything but the most |
| 136 | // trivial --help usage information (i.e. reduces binary size) | 137 | // trivial --help usage information (i.e. reduces binary size) |
| 137 | //#define BB_FEATURE_TRIVIAL_HELP | 138 | #define BB_FEATURE_TRIVIAL_HELP |
| 138 | // | 139 | // |
| 139 | // Use termios to manipulate the screen ('more' is prettier with this on) | 140 | // Use termios to manipulate the screen ('more' is prettier with this on) |
| 140 | //#define BB_FEATURE_USE_TERMIOS | 141 | //#define BB_FEATURE_USE_TERMIOS |
diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c index 8f6923478..cca5406ee 100644 --- a/console-tools/loadacm.c +++ b/console-tools/loadacm.c | |||
| @@ -22,8 +22,11 @@ | |||
| 22 | #include <sys/ioctl.h> | 22 | #include <sys/ioctl.h> |
| 23 | #include <sys/kd.h> | 23 | #include <sys/kd.h> |
| 24 | 24 | ||
| 25 | static const char loadacm_usage[] = "loadacm\n\n" | 25 | static const char loadacm_usage[] = "loadacm\n" |
| 26 | "Loads an acm from standard input.\n"; | 26 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 27 | "\nLoads an acm from standard input.\n" | ||
| 28 | #endif | ||
| 29 | ; | ||
| 27 | 30 | ||
| 28 | typedef unsigned short unicode; | 31 | typedef unsigned short unicode; |
| 29 | 32 | ||
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 5e1f04d76..7eaf40e82 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c | |||
| @@ -30,8 +30,11 @@ | |||
| 30 | #define PSF_MAXMODE 0x03 | 30 | #define PSF_MAXMODE 0x03 |
| 31 | #define PSF_SEPARATOR 0xFFFF | 31 | #define PSF_SEPARATOR 0xFFFF |
| 32 | 32 | ||
| 33 | static const char loadfont_usage[] = "loadfont\n\n" | 33 | static const char loadfont_usage[] = "loadfont\n" |
| 34 | "Loads a console font from standard input.\n"; | 34 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 35 | "Loads a console font from standard input.\n" | ||
| 36 | #endif | ||
| 37 | ; | ||
| 35 | 38 | ||
| 36 | struct psf_header { | 39 | struct psf_header { |
| 37 | unsigned char magic1, magic2; /* Magic number */ | 40 | unsigned char magic1, magic2; /* Magic number */ |
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c index 75e52e148..99efc5101 100644 --- a/console-tools/loadkmap.c +++ b/console-tools/loadkmap.c | |||
| @@ -29,8 +29,11 @@ | |||
| 29 | #include <sys/ioctl.h> | 29 | #include <sys/ioctl.h> |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | static const char loadkmap_usage[] = "loadkmap\n\n" | 32 | static const char loadkmap_usage[] = "loadkmap\n" |
| 33 | "Loads a binary keyboard translation table from standard input.\n"; | 33 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 34 | "Loads a binary keyboard translation table from standard input.\n" | ||
| 35 | #endif | ||
| 36 | ; | ||
| 34 | 37 | ||
| 35 | 38 | ||
| 36 | int loadkmap_main(int argc, char **argv) | 39 | int loadkmap_main(int argc, char **argv) |
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) { |
| @@ -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/docs/busybox.pod b/docs/busybox.pod index ea14459ef..408bbfa72 100644 --- a/docs/busybox.pod +++ b/docs/busybox.pod | |||
| @@ -488,7 +488,7 @@ Example: | |||
| 488 | 488 | ||
| 489 | Usage: free | 489 | Usage: free |
| 490 | 490 | ||
| 491 | Displays the amount of free and used memory in the system. | 491 | Displays the amount of free and used system memory. |
| 492 | 492 | ||
| 493 | Example: | 493 | Example: |
| 494 | 494 | ||
| @@ -504,7 +504,7 @@ Example: | |||
| 504 | 504 | ||
| 505 | Usage: freeramdisk DEVICE | 505 | Usage: freeramdisk DEVICE |
| 506 | 506 | ||
| 507 | Free all memory used by the specified ramdisk. | 507 | Frees all memory used by the specified ramdisk. |
| 508 | 508 | ||
| 509 | Example: | 509 | Example: |
| 510 | 510 | ||
| @@ -799,9 +799,9 @@ Example: | |||
| 799 | 799 | ||
| 800 | =item length | 800 | =item length |
| 801 | 801 | ||
| 802 | Usage: length string | 802 | Usage: length STRING |
| 803 | 803 | ||
| 804 | Prints out the length of the specified string. | 804 | Prints out the length of the specified STRING. |
| 805 | 805 | ||
| 806 | Example: | 806 | Example: |
| 807 | 807 | ||
| @@ -1120,7 +1120,7 @@ Flags: | |||
| 1120 | -t fs-type: Specify the filesystem type. | 1120 | -t fs-type: Specify the filesystem type. |
| 1121 | -w: Mount for reading and writing (default). | 1121 | -w: Mount for reading and writing (default). |
| 1122 | 1122 | ||
| 1123 | Options for use with the "-o" flag: | 1123 | Options for use with the "B<-o>" flag: |
| 1124 | 1124 | ||
| 1125 | async/sync: Writes are asynchronous / synchronous. | 1125 | async/sync: Writes are asynchronous / synchronous. |
| 1126 | atime/noatime: Enable / disable updates to inode access times. | 1126 | atime/noatime: Enable / disable updates to inode access times. |
| @@ -1881,4 +1881,4 @@ Enrique Zanardi <ezanardi@ull.es> | |||
| 1881 | 1881 | ||
| 1882 | =cut | 1882 | =cut |
| 1883 | 1883 | ||
| 1884 | # $Id: busybox.pod,v 1.29 2000/05/10 05:00:31 erik Exp $ | 1884 | # $Id: busybox.pod,v 1.30 2000/05/12 19:41:47 erik Exp $ |
diff --git a/editors/sed.c b/editors/sed.c index 0d57a4a06..9fed6704e 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
| @@ -38,8 +38,9 @@ | |||
| 38 | #include <ctype.h> | 38 | #include <ctype.h> |
| 39 | 39 | ||
| 40 | static const char sed_usage[] = | 40 | static const char sed_usage[] = |
| 41 | "sed [-n] -e script [file...]\n\n" | 41 | "sed [-n] -e script [file...]\n" |
| 42 | "Allowed sed scripts come in the following form:\n" | 42 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 43 | "\nAllowed sed scripts come in the following form:\n" | ||
| 43 | "\t'ADDR [!] COMMAND'\n\n" | 44 | "\t'ADDR [!] COMMAND'\n\n" |
| 44 | "\twhere address ADDR can be:\n" | 45 | "\twhere address ADDR can be:\n" |
| 45 | "\t NUMBER Match specified line number\n" | 46 | "\t NUMBER Match specified line number\n" |
| @@ -58,8 +59,10 @@ static const char sed_usage[] = | |||
| 58 | #if defined BB_REGEXP | 59 | #if defined BB_REGEXP |
| 59 | "This version of sed matches full regular expresions.\n"; | 60 | "This version of sed matches full regular expresions.\n"; |
| 60 | #else | 61 | #else |
| 61 | "This version of sed matches strings (not full regular expresions).\n"; | 62 | "This version of sed matches strings (not full regular expresions).\n" |
| 62 | #endif | 63 | #endif |
| 64 | #endif | ||
| 65 | ; | ||
| 63 | 66 | ||
| 64 | /* Flags & variables */ | 67 | /* Flags & variables */ |
| 65 | 68 | ||
| @@ -105,9 +105,9 @@ struct cmdoptions_t { | |||
| 105 | "-vsync", 1, CMD_VSYNC}, { | 105 | "-vsync", 1, CMD_VSYNC}, { |
| 106 | "-laced", 1, CMD_LACED}, { | 106 | "-laced", 1, CMD_LACED}, { |
| 107 | "-double", 1, CMD_DOUBLE}, { | 107 | "-double", 1, CMD_DOUBLE}, { |
| 108 | "--help", 0, CMD_HELP}, { | 108 | "-help", 0, CMD_HELP}, { |
| 109 | #ifdef BB_FEATURE_FBSET_FANCY | 109 | #ifdef BB_FEATURE_FBSET_FANCY |
| 110 | "--help", 0, CMD_HELP}, { | 110 | "-help", 0, CMD_HELP}, { |
| 111 | "-all", 0, CMD_ALL}, { | 111 | "-all", 0, CMD_ALL}, { |
| 112 | "-xres", 1, CMD_XRES}, { | 112 | "-xres", 1, CMD_XRES}, { |
| 113 | "-yres", 1, CMD_YRES}, { | 113 | "-yres", 1, CMD_YRES}, { |
| @@ -115,7 +115,7 @@ struct cmdoptions_t { | |||
| 115 | "-vyres", 1, CMD_VYRES}, { | 115 | "-vyres", 1, CMD_VYRES}, { |
| 116 | "-depth", 1, CMD_DEPTH}, { | 116 | "-depth", 1, CMD_DEPTH}, { |
| 117 | "-match", 0, CMD_MATCH}, { | 117 | "-match", 0, CMD_MATCH}, { |
| 118 | "--geometry", 5, CMD_GEOMETRY}, { | 118 | "-geometry", 5, CMD_GEOMETRY}, { |
| 119 | "-pixclock", 1, CMD_PIXCLOCK}, { | 119 | "-pixclock", 1, CMD_PIXCLOCK}, { |
| 120 | "-left", 1, CMD_LEFT}, { | 120 | "-left", 1, CMD_LEFT}, { |
| 121 | "-right", 1, CMD_RIGHT}, { | 121 | "-right", 1, CMD_RIGHT}, { |
| @@ -123,7 +123,7 @@ struct cmdoptions_t { | |||
| 123 | "-lower", 1, CMD_LOWER}, { | 123 | "-lower", 1, CMD_LOWER}, { |
| 124 | "-hslen", 1, CMD_HSLEN}, { | 124 | "-hslen", 1, CMD_HSLEN}, { |
| 125 | "-vslen", 1, CMD_VSLEN}, { | 125 | "-vslen", 1, CMD_VSLEN}, { |
| 126 | "--timings", 7, CMD_TIMING}, { | 126 | "-timings", 7, CMD_TIMING}, { |
| 127 | "-csync", 1, CMD_CSYNC}, { | 127 | "-csync", 1, CMD_CSYNC}, { |
| 128 | "-gsync", 1, CMD_GSYNC}, { | 128 | "-gsync", 1, CMD_GSYNC}, { |
| 129 | "-extsync", 1, CMD_EXTSYNC}, { | 129 | "-extsync", 1, CMD_EXTSYNC}, { |
| @@ -221,17 +221,21 @@ static void showmode(struct fb_var_screeninfo *v) | |||
| 221 | 221 | ||
| 222 | static void fbset_usage(void) | 222 | static void fbset_usage(void) |
| 223 | { | 223 | { |
| 224 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 224 | int i; | 225 | int i; |
| 226 | #endif | ||
| 225 | 227 | ||
| 226 | #ifndef STANDALONE | 228 | #ifndef STANDALONE |
| 227 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", | 229 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
| 228 | BB_VER, BB_BT); | 230 | BB_VER, BB_BT); |
| 229 | #endif | 231 | #endif |
| 230 | fprintf(stderr, "Usage: fbset [options] [mode]\n\n"); | 232 | fprintf(stderr, "Usage: fbset [options] [mode]\n"); |
| 231 | fprintf(stderr, "Show and modify frame buffer device settings\n\n"); | 233 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 234 | fprintf(stderr, "\nShows and modifies frame buffer device settings\n\n"); | ||
| 232 | fprintf(stderr, "The following options are recognized:\n"); | 235 | fprintf(stderr, "The following options are recognized:\n"); |
| 233 | for (i = 0; g_cmdoptions[i].name; i++) | 236 | for (i = 0; g_cmdoptions[i].name; i++) |
| 234 | fprintf(stderr, "\t%s\n", g_cmdoptions[i].name); | 237 | fprintf(stderr, "\t%s\n", g_cmdoptions[i].name); |
| 238 | #endif | ||
| 235 | exit(-1); | 239 | exit(-1); |
| 236 | } | 240 | } |
| 237 | 241 | ||
| @@ -34,7 +34,11 @@ extern int fdflush_main(int argc, char **argv) | |||
| 34 | int fd; | 34 | int fd; |
| 35 | 35 | ||
| 36 | if (argc <= 1 || **(++argv) == '-') { | 36 | if (argc <= 1 || **(++argv) == '-') { |
| 37 | usage("fdflush device\n\nForce floppy disk drive to detect disk change\n"); | 37 | usage("fdflush DEVICE\n" |
| 38 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 39 | "\nForces floppy disk drive to detect disk change\n" | ||
| 40 | #endif | ||
| 41 | ); | ||
| 38 | } | 42 | } |
| 39 | 43 | ||
| 40 | fd = open(*argv, 0); | 44 | fd = open(*argv, 0); |
| @@ -33,13 +33,16 @@ static char *pattern = NULL; | |||
| 33 | static char *directory = "."; | 33 | static char *directory = "."; |
| 34 | static int dereferenceFlag = FALSE; | 34 | static int dereferenceFlag = FALSE; |
| 35 | 35 | ||
| 36 | static const char find_usage[] = "find [PATH...] [EXPRESSION]\n\n" | 36 | static const char find_usage[] = "find [PATH...] [EXPRESSION]\n" |
| 37 | "Search for files in a directory hierarchy. The default PATH is\n" | 37 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 38 | "\nSearch for files in a directory hierarchy. The default PATH is\n" | ||
| 38 | "the current directory; default EXPRESSION is '-print'\n\n" | 39 | "the current directory; default EXPRESSION is '-print'\n\n" |
| 39 | "\nEXPRESSION may consist of:\n" | 40 | "\nEXPRESSION may consist of:\n" |
| 40 | "\t-follow\t\tDereference symbolic links.\n" | 41 | "\t-follow\t\tDereference symbolic links.\n" |
| 41 | "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n" | 42 | "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n" |
| 42 | "\t-print\t\tprint the full file name followed by a newline to stdout.\n"; | 43 | "\t-print\t\tprint the full file name followed by a newline to stdout.\n" |
| 44 | #endif | ||
| 45 | ; | ||
| 43 | 46 | ||
| 44 | 47 | ||
| 45 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) | 48 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) |
diff --git a/findutils/find.c b/findutils/find.c index f6e63afb9..53b85e6b3 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
| @@ -33,13 +33,16 @@ static char *pattern = NULL; | |||
| 33 | static char *directory = "."; | 33 | static char *directory = "."; |
| 34 | static int dereferenceFlag = FALSE; | 34 | static int dereferenceFlag = FALSE; |
| 35 | 35 | ||
| 36 | static const char find_usage[] = "find [PATH...] [EXPRESSION]\n\n" | 36 | static const char find_usage[] = "find [PATH...] [EXPRESSION]\n" |
| 37 | "Search for files in a directory hierarchy. The default PATH is\n" | 37 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 38 | "\nSearch for files in a directory hierarchy. The default PATH is\n" | ||
| 38 | "the current directory; default EXPRESSION is '-print'\n\n" | 39 | "the current directory; default EXPRESSION is '-print'\n\n" |
| 39 | "\nEXPRESSION may consist of:\n" | 40 | "\nEXPRESSION may consist of:\n" |
| 40 | "\t-follow\t\tDereference symbolic links.\n" | 41 | "\t-follow\t\tDereference symbolic links.\n" |
| 41 | "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n" | 42 | "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n" |
| 42 | "\t-print\t\tprint the full file name followed by a newline to stdout.\n"; | 43 | "\t-print\t\tprint the full file name followed by a newline to stdout.\n" |
| 44 | #endif | ||
| 45 | ; | ||
| 43 | 46 | ||
| 44 | 47 | ||
| 45 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) | 48 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) |
diff --git a/findutils/grep.c b/findutils/grep.c index 06b6980bc..6872ac271 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
| @@ -41,8 +41,9 @@ | |||
| 41 | #include <ctype.h> | 41 | #include <ctype.h> |
| 42 | 42 | ||
| 43 | static const char grep_usage[] = | 43 | static const char grep_usage[] = |
| 44 | "grep [OPTIONS]... PATTERN [FILE]...\n\n" | 44 | "grep [OPTIONS]... PATTERN [FILE]...\n" |
| 45 | "Search for PATTERN in each FILE or standard input.\n\n" | 45 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 46 | "\nSearch for PATTERN in each FILE or standard input.\n\n" | ||
| 46 | "OPTIONS:\n" | 47 | "OPTIONS:\n" |
| 47 | "\t-h\tsuppress the prefixing filename on output\n" | 48 | "\t-h\tsuppress the prefixing filename on output\n" |
| 48 | "\t-i\tignore case distinctions\n" | 49 | "\t-i\tignore case distinctions\n" |
| @@ -52,8 +53,10 @@ static const char grep_usage[] = | |||
| 52 | #if defined BB_REGEXP | 53 | #if defined BB_REGEXP |
| 53 | "This version of grep matches full regular expresions.\n"; | 54 | "This version of grep matches full regular expresions.\n"; |
| 54 | #else | 55 | #else |
| 55 | "This version of grep matches strings (not regular expresions).\n"; | 56 | "This version of grep matches strings (not regular expresions).\n" |
| 56 | #endif | 57 | #endif |
| 58 | #endif | ||
| 59 | ; | ||
| 57 | 60 | ||
| 58 | static int match = FALSE, beQuiet = FALSE; | 61 | static int match = FALSE, beQuiet = FALSE; |
| 59 | 62 | ||
| @@ -37,6 +37,14 @@ extern int free_main(int argc, char **argv) | |||
| 37 | info.sharedram/=DIVISOR; | 37 | info.sharedram/=DIVISOR; |
| 38 | info.bufferram/=DIVISOR; | 38 | info.bufferram/=DIVISOR; |
| 39 | 39 | ||
| 40 | if (argc > 1 && **(argv + 1) == '-') { | ||
| 41 | usage("free\n" | ||
| 42 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 43 | "\nDisplays the amount of free and used system memory\n" | ||
| 44 | #endif | ||
| 45 | ); | ||
| 46 | } | ||
| 47 | |||
| 40 | 48 | ||
| 41 | printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free", | 49 | printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free", |
| 42 | "shared", "buffers"); | 50 | "shared", "buffers"); |
diff --git a/freeramdisk.c b/freeramdisk.c index d373bcbf7..4106cf144 100644 --- a/freeramdisk.c +++ b/freeramdisk.c | |||
| @@ -34,8 +34,11 @@ | |||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | static const char freeramdisk_usage[] = | 36 | static const char freeramdisk_usage[] = |
| 37 | "freeramdisk DEVICE\n\n" | 37 | "freeramdisk DEVICE\n" |
| 38 | "Free all memory used by the specified ramdisk.\n"; | 38 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 39 | "\nFrees all memory used by the specified ramdisk.\n" | ||
| 40 | #endif | ||
| 41 | ; | ||
| 39 | 42 | ||
| 40 | extern int | 43 | extern int |
| 41 | freeramdisk_main(int argc, char **argv) | 44 | freeramdisk_main(int argc, char **argv) |
diff --git a/fsck_minix.c b/fsck_minix.c index c890dff7d..7d27566b8 100644 --- a/fsck_minix.c +++ b/fsck_minix.c | |||
| @@ -198,9 +198,10 @@ static void show_usage(void) | |||
| 198 | { | 198 | { |
| 199 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", | 199 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
| 200 | BB_VER, BB_BT); | 200 | BB_VER, BB_BT); |
| 201 | fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n\n", program_name); | 201 | fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n", program_name); |
| 202 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 202 | fprintf(stderr, | 203 | fprintf(stderr, |
| 203 | "Performs a consistency check for MINIX filesystems.\n\n"); | 204 | "\nPerforms a consistency check for MINIX filesystems.\n\n"); |
| 204 | fprintf(stderr, "OPTIONS:\n"); | 205 | fprintf(stderr, "OPTIONS:\n"); |
| 205 | fprintf(stderr, "\t-l\tLists all filenames\n"); | 206 | fprintf(stderr, "\t-l\tLists all filenames\n"); |
| 206 | fprintf(stderr, "\t-r\tPerform interactive repairs\n"); | 207 | fprintf(stderr, "\t-r\tPerform interactive repairs\n"); |
| @@ -210,6 +211,7 @@ static void show_usage(void) | |||
| 210 | fprintf(stderr, | 211 | fprintf(stderr, |
| 211 | "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n"); | 212 | "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n"); |
| 212 | fprintf(stderr, "\t-f\tForce file system check.\n\n"); | 213 | fprintf(stderr, "\t-f\tForce file system check.\n\n"); |
| 214 | #endif | ||
| 213 | leave(16); | 215 | leave(16); |
| 214 | } | 216 | } |
| 215 | 217 | ||
| @@ -41,8 +41,9 @@ | |||
| 41 | #include <ctype.h> | 41 | #include <ctype.h> |
| 42 | 42 | ||
| 43 | static const char grep_usage[] = | 43 | static const char grep_usage[] = |
| 44 | "grep [OPTIONS]... PATTERN [FILE]...\n\n" | 44 | "grep [OPTIONS]... PATTERN [FILE]...\n" |
| 45 | "Search for PATTERN in each FILE or standard input.\n\n" | 45 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 46 | "\nSearch for PATTERN in each FILE or standard input.\n\n" | ||
| 46 | "OPTIONS:\n" | 47 | "OPTIONS:\n" |
| 47 | "\t-h\tsuppress the prefixing filename on output\n" | 48 | "\t-h\tsuppress the prefixing filename on output\n" |
| 48 | "\t-i\tignore case distinctions\n" | 49 | "\t-i\tignore case distinctions\n" |
| @@ -52,8 +53,10 @@ static const char grep_usage[] = | |||
| 52 | #if defined BB_REGEXP | 53 | #if defined BB_REGEXP |
| 53 | "This version of grep matches full regular expresions.\n"; | 54 | "This version of grep matches full regular expresions.\n"; |
| 54 | #else | 55 | #else |
| 55 | "This version of grep matches strings (not regular expresions).\n"; | 56 | "This version of grep matches strings (not regular expresions).\n" |
| 56 | #endif | 57 | #endif |
| 58 | #endif | ||
| 59 | ; | ||
| 57 | 60 | ||
| 58 | static int match = FALSE, beQuiet = FALSE; | 61 | static int match = FALSE, beQuiet = FALSE; |
| 59 | 62 | ||
| @@ -28,13 +28,17 @@ | |||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include "internal.h" | 30 | #include "internal.h" |
| 31 | |||
| 31 | static const char gunzip_usage[] = | 32 | static const char gunzip_usage[] = |
| 32 | "gunzip [OPTION]... FILE\n\n" | 33 | "gunzip [OPTION]... FILE\n" |
| 33 | "Uncompress FILE (or standard input if FILE is '-').\n\n" | 34 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 35 | "\nUncompress FILE (or standard input if FILE is '-').\n\n" | ||
| 34 | "Options:\n" | 36 | "Options:\n" |
| 35 | 37 | ||
| 36 | "\t-c\tWrite output to standard output\n" | 38 | "\t-c\tWrite output to standard output\n" |
| 37 | "\t-t\tTest compressed file integrity\n"; | 39 | "\t-t\tTest compressed file integrity\n" |
| 40 | #endif | ||
| 41 | ; | ||
| 38 | 42 | ||
| 39 | 43 | ||
| 40 | /* These defines are very important for BusyBox. Without these, | 44 | /* These defines are very important for BusyBox. Without these, |
| @@ -43,8 +47,9 @@ static const char gunzip_usage[] = | |||
| 43 | #define SMALL_MEM | 47 | #define SMALL_MEM |
| 44 | #define DYN_ALLOC | 48 | #define DYN_ALLOC |
| 45 | 49 | ||
| 46 | #define bb_need_name_too_long | ||
| 47 | #define BB_DECLARE_EXTERN | 50 | #define BB_DECLARE_EXTERN |
| 51 | #define bb_need_memory_exhausted | ||
| 52 | #define bb_need_name_too_long | ||
| 48 | #include "messages.c" | 53 | #include "messages.c" |
| 49 | 54 | ||
| 50 | 55 | ||
| @@ -206,7 +211,7 @@ extern int method; /* compression method */ | |||
| 206 | # define DECLARE(type, array, size) type * array | 211 | # define DECLARE(type, array, size) type * array |
| 207 | # define ALLOC(type, array, size) { \ | 212 | # define ALLOC(type, array, size) { \ |
| 208 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 213 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
| 209 | if (array == NULL) errorMsg("insufficient memory"); \ | 214 | if (array == NULL) errorMsg(memory_exhausted, "gunzip"); \ |
| 210 | } | 215 | } |
| 211 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 216 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
| 212 | #else | 217 | #else |
| @@ -1053,7 +1058,7 @@ int in, out; /* input and output file descriptors */ | |||
| 1053 | int res = inflate(); | 1058 | int res = inflate(); |
| 1054 | 1059 | ||
| 1055 | if (res == 3) { | 1060 | if (res == 3) { |
| 1056 | errorMsg("out of memory"); | 1061 | errorMsg(memory_exhausted, "gunzip"); |
| 1057 | } else if (res != 0) { | 1062 | } else if (res != 0) { |
| 1058 | errorMsg("invalid compressed data--format violated"); | 1063 | errorMsg("invalid compressed data--format violated"); |
| 1059 | } | 1064 | } |
| @@ -30,6 +30,9 @@ | |||
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | #include "internal.h" | 32 | #include "internal.h" |
| 33 | #define BB_DECLARE_EXTERN | ||
| 34 | #define bb_need_memory_exhausted | ||
| 35 | #include "messages.c" | ||
| 33 | 36 | ||
| 34 | /* These defines are very important for BusyBox. Without these, | 37 | /* These defines are very important for BusyBox. Without these, |
| 35 | * huge chunks of ram are pre-allocated making the BusyBox bss | 38 | * huge chunks of ram are pre-allocated making the BusyBox bss |
| @@ -39,12 +42,15 @@ | |||
| 39 | 42 | ||
| 40 | 43 | ||
| 41 | static const char gzip_usage[] = | 44 | static const char gzip_usage[] = |
| 42 | "gzip [OPTION]... FILE\n\n" | 45 | "gzip [OPTION]... FILE\n" |
| 43 | "Compress FILE with maximum compression.\n" | 46 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 47 | "\nCompress FILE with maximum compression.\n" | ||
| 44 | "When FILE is '-', reads standard input. Implies -c.\n\n" | 48 | "When FILE is '-', reads standard input. Implies -c.\n\n" |
| 45 | 49 | ||
| 46 | "Options:\n" | 50 | "Options:\n" |
| 47 | "\t-c\tWrite output to standard output instead of FILE.gz\n"; | 51 | "\t-c\tWrite output to standard output instead of FILE.gz\n" |
| 52 | #endif | ||
| 53 | ; | ||
| 48 | 54 | ||
| 49 | 55 | ||
| 50 | /* I don't like nested includes, but the string and io functions are used | 56 | /* I don't like nested includes, but the string and io functions are used |
| @@ -121,7 +127,7 @@ extern int method; /* compression method */ | |||
| 121 | # define DECLARE(type, array, size) type * array | 127 | # define DECLARE(type, array, size) type * array |
| 122 | # define ALLOC(type, array, size) { \ | 128 | # define ALLOC(type, array, size) { \ |
| 123 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 129 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
| 124 | if (array == NULL) errorMsg("insufficient memory"); \ | 130 | if (array == NULL) errorMsg(memory_exhausted, "gzip"); \ |
| 125 | } | 131 | } |
| 126 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 132 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
| 127 | #else | 133 | #else |
| @@ -1778,7 +1784,6 @@ int part_nb; /* number of parts in .gz file */ | |||
| 1778 | long time_stamp; /* original time stamp (modification time) */ | 1784 | long time_stamp; /* original time stamp (modification time) */ |
| 1779 | long ifile_size; /* input file size, -1 for devices (debug only) */ | 1785 | long ifile_size; /* input file size, -1 for devices (debug only) */ |
| 1780 | char *env; /* contents of GZIP env variable */ | 1786 | char *env; /* contents of GZIP env variable */ |
| 1781 | char **args = NULL; /* argv pointer if GZIP env variable defined */ | ||
| 1782 | char z_suffix[MAX_SUFFIX + 1]; /* default suffix (can be set with --suffix) */ | 1787 | char z_suffix[MAX_SUFFIX + 1]; /* default suffix (can be set with --suffix) */ |
| 1783 | int z_len; /* strlen(z_suffix) */ | 1788 | int z_len; /* strlen(z_suffix) */ |
| 1784 | 1789 | ||
| @@ -3248,7 +3253,7 @@ char *env; /* name of environment variable */ | |||
| 3248 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); | 3253 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); |
| 3249 | 3254 | ||
| 3250 | if (nargv == NULL) | 3255 | if (nargv == NULL) |
| 3251 | errorMsg("out of memory"); | 3256 | errorMsg(memory_exhausted, "gzip"); |
| 3252 | oargv = *argvp; | 3257 | oargv = *argvp; |
| 3253 | *argvp = nargv; | 3258 | *argvp = nargv; |
| 3254 | 3259 | ||
| @@ -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/hostname.c b/hostname.c index 8cc334da0..ef921024b 100644 --- a/hostname.c +++ b/hostname.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* | 2 | /* |
| 3 | * $Id: hostname.c,v 1.7 2000/02/08 19:58:47 erik Exp $ | 3 | * $Id: hostname.c,v 1.8 2000/05/12 19:41:47 erik Exp $ |
| 4 | * Mini hostname implementation for busybox | 4 | * Mini hostname implementation for busybox |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
| @@ -31,15 +31,18 @@ | |||
| 31 | #include <stdio.h> | 31 | #include <stdio.h> |
| 32 | 32 | ||
| 33 | static const char *hostname_usage = | 33 | static const char *hostname_usage = |
| 34 | "hostname [OPTION] {hostname | -F file}\n\n" | 34 | "hostname [OPTION] {hostname | -F file}\n" |
| 35 | "Get or set the hostname or DNS domain name. If a hostname is given\n" | 35 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 36 | "\nGet or set the hostname or DNS domain name. If a hostname is given\n" | ||
| 36 | "(or a file with the -F parameter), the host name will be set.\n\n" | 37 | "(or a file with the -F parameter), the host name will be set.\n\n" |
| 37 | "Options:\n" | 38 | "Options:\n" |
| 38 | "\t-s\t\tShort\n" | 39 | "\t-s\t\tShort\n" |
| 39 | 40 | ||
| 40 | "\t-i\t\tAddresses for the hostname\n" | 41 | "\t-i\t\tAddresses for the hostname\n" |
| 41 | "\t-d\t\tDNS domain name\n" | 42 | "\t-d\t\tDNS domain name\n" |
| 42 | "\t-F FILE\t\tUse the contents of FILE to specify the hostname\n"; | 43 | "\t-F FILE\t\tUse the contents of FILE to specify the hostname\n" |
| 44 | #endif | ||
| 45 | ; | ||
| 43 | 46 | ||
| 44 | 47 | ||
| 45 | void do_sethostname(char *s, int isfile) | 48 | void do_sethostname(char *s, int isfile) |
| @@ -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 | { |
| @@ -70,12 +70,15 @@ _syscall2(unsigned long, create_module, const char *, name, size_t, size) | |||
| 70 | static char m_filename[BUFSIZ + 1] = "\0"; | 70 | static char m_filename[BUFSIZ + 1] = "\0"; |
| 71 | static char m_fullName[BUFSIZ + 1] = "\0"; | 71 | static char m_fullName[BUFSIZ + 1] = "\0"; |
| 72 | static const char insmod_usage[] = | 72 | static const char insmod_usage[] = |
| 73 | "insmod [OPTION]... MODULE [symbol=value]...\n\n" | 73 | "insmod [OPTION]... MODULE [symbol=value]...\n" |
| 74 | "Loads the specified kernel modules into the kernel.\n\n" | 74 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 75 | "\nLoads the specified kernel modules into the kernel.\n\n" | ||
| 75 | "Options:\n" | 76 | "Options:\n" |
| 76 | 77 | ||
| 77 | "\t-f\tForce module to load into the wrong kernel version.\n" | 78 | "\t-f\tForce module to load into the wrong kernel version.\n" |
| 78 | "\t-k\tMake module autoclean-able.\n"; | 79 | "\t-k\tMake module autoclean-able.\n" |
| 80 | #endif | ||
| 81 | ; | ||
| 79 | 82 | ||
| 80 | 83 | ||
| 81 | static int findNamedModule(const char *fileName, struct stat *statbuf) | 84 | static int findNamedModule(const char *fileName, struct stat *statbuf) |
diff --git a/internal.h b/internal.h index a4014778c..a953ce2e5 100644 --- a/internal.h +++ b/internal.h | |||
| @@ -100,11 +100,12 @@ extern int basename_main(int argc, char **argv); | |||
| 100 | extern int busybox_main(int argc, char** argv); | 100 | extern int busybox_main(int argc, char** argv); |
| 101 | extern int block_device_main(int argc, char** argv); | 101 | extern int block_device_main(int argc, char** argv); |
| 102 | extern int cat_main(int argc, char** argv); | 102 | extern int cat_main(int argc, char** argv); |
| 103 | extern int cp_mv_main(int argc, char** argv); | ||
| 104 | extern int chmod_chown_chgrp_main(int argc, char** argv); | 103 | extern int chmod_chown_chgrp_main(int argc, char** argv); |
| 105 | extern int chroot_main(int argc, char** argv); | 104 | extern int chroot_main(int argc, char** argv); |
| 106 | extern int chvt_main(int argc, char** argv); | 105 | extern int chvt_main(int argc, char** argv); |
| 107 | extern int clear_main(int argc, char** argv); | 106 | extern int clear_main(int argc, char** argv); |
| 107 | extern int cp_mv_main(int argc, char** argv); | ||
| 108 | extern int cut_main(int argc, char** argv); | ||
| 108 | extern int date_main(int argc, char** argv); | 109 | extern int date_main(int argc, char** argv); |
| 109 | extern int dd_main(int argc, char** argv); | 110 | extern int dd_main(int argc, char** argv); |
| 110 | extern int dirname_main(int argc, char** argv); | 111 | extern int dirname_main(int argc, char** argv); |
| @@ -151,7 +152,7 @@ extern int mkfs_minix_main(int argc, char **argv); | |||
| 151 | extern int mknod_main(int argc, char** argv); | 152 | extern int mknod_main(int argc, char** argv); |
| 152 | extern int mkswap_main(int argc, char** argv); | 153 | extern int mkswap_main(int argc, char** argv); |
| 153 | extern int mktemp_main(int argc, char **argv); | 154 | extern int mktemp_main(int argc, char **argv); |
| 154 | extern int mnc_main(int argc, char** argv); | 155 | extern int nc_main(int argc, char** argv); |
| 155 | extern int more_main(int argc, char** argv); | 156 | extern int more_main(int argc, char** argv); |
| 156 | extern int mount_main(int argc, char** argv); | 157 | extern int mount_main(int argc, char** argv); |
| 157 | extern int mt_main(int argc, char** argv); | 158 | extern int mt_main(int argc, char** argv); |
| @@ -32,16 +32,22 @@ | |||
| 32 | #include <unistd.h> | 32 | #include <unistd.h> |
| 33 | 33 | ||
| 34 | static const char *kill_usage = | 34 | static const char *kill_usage = |
| 35 | "kill [-signal] process-id [process-id ...]\n\n" | 35 | "kill [-signal] process-id [process-id ...]\n" |
| 36 | "Send a signal (default is SIGTERM) to the specified process(es).\n\n" | 36 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 37 | "Options:\n" "\t-l\tList all signal names and numbers.\n\n"; | 37 | "\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" |
| 38 | "Options:\n" "\t-l\tList all signal names and numbers.\n\n" | ||
| 39 | #endif | ||
| 40 | ; | ||
| 38 | 41 | ||
| 39 | #ifdef BB_KILLALL | 42 | #ifdef BB_KILLALL |
| 40 | static const char *killall_usage = | 43 | static const char *killall_usage = |
| 41 | "killall [-signal] process-name [process-name ...]\n\n" | 44 | "killall [-signal] process-name [process-name ...]\n" |
| 42 | "Send a signal (default is SIGTERM) to the specified process(es).\n\n" | 45 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 43 | "Options:\n" "\t-l\tList all signal names and numbers.\n\n"; | 46 | "\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" |
| 47 | "Options:\n" "\t-l\tList all signal names and numbers.\n\n" | ||
| 48 | #endif | ||
| 44 | #endif | 49 | #endif |
| 50 | ; | ||
| 45 | 51 | ||
| 46 | #define KILL 0 | 52 | #define KILL 0 |
| 47 | #define KILLALL 1 | 53 | #define KILLALL 1 |
| @@ -127,8 +127,11 @@ static struct builtInCommand bltins[] = { | |||
| 127 | 127 | ||
| 128 | static const char shell_usage[] = | 128 | static const char shell_usage[] = |
| 129 | 129 | ||
| 130 | "sh [FILE]...\n\n" "The BusyBox command interpreter (shell).\n\n"; | 130 | "sh [FILE]...\n" |
| 131 | 131 | #ifndef BB_FEATURE_TRIVIAL_HELP | |
| 132 | "\nlash: The BusyBox command interpreter (shell).\n\n" | ||
| 133 | #endif | ||
| 134 | ; | ||
| 132 | 135 | ||
| 133 | static char cwd[1024]; | 136 | static char cwd[1024]; |
| 134 | static char *prompt = "# "; | 137 | static char *prompt = "# "; |
| @@ -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); |
| @@ -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; |
| @@ -22,8 +22,11 @@ | |||
| 22 | #include <sys/ioctl.h> | 22 | #include <sys/ioctl.h> |
| 23 | #include <sys/kd.h> | 23 | #include <sys/kd.h> |
| 24 | 24 | ||
| 25 | static const char loadacm_usage[] = "loadacm\n\n" | 25 | static const char loadacm_usage[] = "loadacm\n" |
| 26 | "Loads an acm from standard input.\n"; | 26 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 27 | "\nLoads an acm from standard input.\n" | ||
| 28 | #endif | ||
| 29 | ; | ||
| 27 | 30 | ||
| 28 | typedef unsigned short unicode; | 31 | typedef unsigned short unicode; |
| 29 | 32 | ||
diff --git a/loadfont.c b/loadfont.c index 5e1f04d76..7eaf40e82 100644 --- a/loadfont.c +++ b/loadfont.c | |||
| @@ -30,8 +30,11 @@ | |||
| 30 | #define PSF_MAXMODE 0x03 | 30 | #define PSF_MAXMODE 0x03 |
| 31 | #define PSF_SEPARATOR 0xFFFF | 31 | #define PSF_SEPARATOR 0xFFFF |
| 32 | 32 | ||
| 33 | static const char loadfont_usage[] = "loadfont\n\n" | 33 | static const char loadfont_usage[] = "loadfont\n" |
| 34 | "Loads a console font from standard input.\n"; | 34 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 35 | "Loads a console font from standard input.\n" | ||
| 36 | #endif | ||
| 37 | ; | ||
| 35 | 38 | ||
| 36 | struct psf_header { | 39 | struct psf_header { |
| 37 | unsigned char magic1, magic2; /* Magic number */ | 40 | unsigned char magic1, magic2; /* Magic number */ |
diff --git a/loadkmap.c b/loadkmap.c index 75e52e148..99efc5101 100644 --- a/loadkmap.c +++ b/loadkmap.c | |||
| @@ -29,8 +29,11 @@ | |||
| 29 | #include <sys/ioctl.h> | 29 | #include <sys/ioctl.h> |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | static const char loadkmap_usage[] = "loadkmap\n\n" | 32 | static const char loadkmap_usage[] = "loadkmap\n" |
| 33 | "Loads a binary keyboard translation table from standard input.\n"; | 33 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 34 | "Loads a binary keyboard translation table from standard input.\n" | ||
| 35 | #endif | ||
| 36 | ; | ||
| 34 | 37 | ||
| 35 | 38 | ||
| 36 | int loadkmap_main(int argc, char **argv) | 39 | int loadkmap_main(int argc, char **argv) |
| @@ -48,14 +48,17 @@ extern CODE facilitynames[]; | |||
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| 50 | static const char logger_usage[] = | 50 | static const char logger_usage[] = |
| 51 | "logger [OPTION]... [MESSAGE]\n\n" | 51 | "logger [OPTION]... [MESSAGE]\n" |
| 52 | "Write MESSAGE to the system log. If MESSAGE is '-', log stdin.\n\n" | 52 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 53 | "\nWrite MESSAGE to the system log. If MESSAGE is '-', log stdin.\n\n" | ||
| 53 | "Options:\n" | 54 | "Options:\n" |
| 54 | "\t-s\tLog to stderr as well as the system log.\n" | 55 | "\t-s\tLog to stderr as well as the system log.\n" |
| 55 | "\t-t\tLog using the specified tag (defaults to user name).\n" | 56 | "\t-t\tLog using the specified tag (defaults to user name).\n" |
| 56 | 57 | ||
| 57 | "\t-p\tEnter the message with the specified priority.\n" | 58 | "\t-p\tEnter the message with the specified priority.\n" |
| 58 | "\t\tThis may be numerical or a ``facility.level'' pair.\n"; | 59 | "\t\tThis may be numerical or a ``facility.level'' pair.\n" |
| 60 | #endif | ||
| 61 | ; | ||
| 59 | 62 | ||
| 60 | 63 | ||
| 61 | /* Decode a symbolic name to a numeric value | 64 | /* Decode a symbolic name to a numeric value |
| @@ -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 | { |
| @@ -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/makedevs.c b/makedevs.c index c8206e020..5072095b5 100644 --- a/makedevs.c +++ b/makedevs.c | |||
| @@ -17,8 +17,9 @@ | |||
| 17 | #include <sys/stat.h> | 17 | #include <sys/stat.h> |
| 18 | 18 | ||
| 19 | static const char makedevs_usage[] = | 19 | static const char makedevs_usage[] = |
| 20 | "makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n\n" | 20 | "makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n" |
| 21 | "Creates a range of block or character special files\n\n" | 21 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 22 | "\nCreates a range of block or character special files\n\n" | ||
| 22 | "TYPEs include:\n" | 23 | "TYPEs include:\n" |
| 23 | "\tb:\tMake a block (buffered) device.\n" | 24 | "\tb:\tMake a block (buffered) device.\n" |
| 24 | "\tc or u:\tMake a character (un-buffered) device.\n" | 25 | "\tc or u:\tMake a character (un-buffered) device.\n" |
| @@ -28,7 +29,9 @@ static const char makedevs_usage[] = | |||
| 28 | "If 's' is the last argument, the base device is created as well.\n\n" | 29 | "If 's' is the last argument, the base device is created as well.\n\n" |
| 29 | "For example:\n" | 30 | "For example:\n" |
| 30 | "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" | 31 | "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" |
| 31 | "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8\n"; | 32 | "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8\n" |
| 33 | #endif | ||
| 34 | ; | ||
| 32 | 35 | ||
| 33 | int makedevs_main(int argc, char **argv) | 36 | int makedevs_main(int argc, char **argv) |
| 34 | { | 37 | { |
| @@ -7,10 +7,13 @@ | |||
| 7 | 7 | ||
| 8 | /* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */ | 8 | /* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */ |
| 9 | 9 | ||
| 10 | static const char math_usage[] = "math expression ...\n\n" | 10 | static const char math_usage[] = "math expression ...\n" |
| 11 | "This is a Tiny RPN calculator that understands the\n" | 11 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 12 | "\nThis is a Tiny RPN calculator that understands the\n" | ||
| 12 | "following operations: +, -, /, *, and, or, not, eor.\n" | 13 | "following operations: +, -, /, *, and, or, not, eor.\n" |
| 13 | "i.e. 'math 2 2 add' -> 4, and 'math 8 8 \\* 2 2 + /' -> 16\n"; | 14 | "i.e. 'math 2 2 add' -> 4, and 'math 8 8 \\* 2 2 + /' -> 16\n" |
| 15 | #endif | ||
| 16 | ; | ||
| 14 | 17 | ||
| 15 | static double stack[100]; | 18 | static double stack[100]; |
| 16 | static unsigned int pointer; | 19 | static unsigned int pointer; |
diff --git a/messages.c b/messages.c index 305bcdb71..73d64276d 100644 --- a/messages.c +++ b/messages.c | |||
| @@ -26,6 +26,13 @@ | |||
| 26 | * Perhaps this will make it simpler to internationalize also, and | 26 | * Perhaps this will make it simpler to internationalize also, and |
| 27 | * may make the binary slightly smaller. | 27 | * may make the binary slightly smaller. |
| 28 | */ | 28 | */ |
| 29 | |||
| 30 | // TO use, do something like this | ||
| 31 | // | ||
| 32 | //#define BB_DECLARE_EXTERN | ||
| 33 | //#define bb_need_memory_exhausted | ||
| 34 | //#include "messages.c" | ||
| 35 | // | ||
| 29 | #ifndef _BB_MESSAGES_C | 36 | #ifndef _BB_MESSAGES_C |
| 30 | #define _BB_MESSAGES_C | 37 | #define _BB_MESSAGES_C |
| 31 | 38 | ||
| @@ -59,4 +66,9 @@ BB_DEF_MESSAGE(name_too_long, "%s: file name too long\n") | |||
| 59 | #if defined bb_need_io_error || ! defined BB_DECLARE_EXTERN | 66 | #if defined bb_need_io_error || ! defined BB_DECLARE_EXTERN |
| 60 | BB_DEF_MESSAGE(io_error, "%s: input/output error -- %s\n") | 67 | BB_DEF_MESSAGE(io_error, "%s: input/output error -- %s\n") |
| 61 | #endif | 68 | #endif |
| 69 | #if defined bb_need_help || ! defined BB_DECLARE_EXTERN | ||
| 70 | BB_DEF_MESSAGE(dash_dash_help, "--help") | ||
| 71 | #endif | ||
| 72 | |||
| 62 | #endif /* _BB_MESSAGES_C */ | 73 | #endif /* _BB_MESSAGES_C */ |
| 74 | |||
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index c8206e020..5072095b5 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c | |||
| @@ -17,8 +17,9 @@ | |||
| 17 | #include <sys/stat.h> | 17 | #include <sys/stat.h> |
| 18 | 18 | ||
| 19 | static const char makedevs_usage[] = | 19 | static const char makedevs_usage[] = |
| 20 | "makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n\n" | 20 | "makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n" |
| 21 | "Creates a range of block or character special files\n\n" | 21 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 22 | "\nCreates a range of block or character special files\n\n" | ||
| 22 | "TYPEs include:\n" | 23 | "TYPEs include:\n" |
| 23 | "\tb:\tMake a block (buffered) device.\n" | 24 | "\tb:\tMake a block (buffered) device.\n" |
| 24 | "\tc or u:\tMake a character (un-buffered) device.\n" | 25 | "\tc or u:\tMake a character (un-buffered) device.\n" |
| @@ -28,7 +29,9 @@ static const char makedevs_usage[] = | |||
| 28 | "If 's' is the last argument, the base device is created as well.\n\n" | 29 | "If 's' is the last argument, the base device is created as well.\n\n" |
| 29 | "For example:\n" | 30 | "For example:\n" |
| 30 | "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" | 31 | "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" |
| 31 | "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8\n"; | 32 | "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8\n" |
| 33 | #endif | ||
| 34 | ; | ||
| 32 | 35 | ||
| 33 | int makedevs_main(int argc, char **argv) | 36 | int makedevs_main(int argc, char **argv) |
| 34 | { | 37 | { |
diff --git a/miscutils/mt.c b/miscutils/mt.c index cf20d1711..28922f8d9 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c | |||
| @@ -4,8 +4,11 @@ | |||
| 4 | #include <sys/mtio.h> | 4 | #include <sys/mtio.h> |
| 5 | #include <sys/fcntl.h> | 5 | #include <sys/fcntl.h> |
| 6 | 6 | ||
| 7 | static const char mt_usage[] = "mt [-f device] opcode value\n\n" | 7 | static const char mt_usage[] = "mt [-f device] opcode value\n" |
| 8 | "Control magnetic tape drive operation\n"; | 8 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 9 | "\nControl magnetic tape drive operation\n" | ||
| 10 | #endif | ||
| 11 | ; | ||
| 9 | 12 | ||
| 10 | struct mt_opcodes { | 13 | struct mt_opcodes { |
| 11 | char *name; | 14 | char *name; |
diff --git a/miscutils/update.c b/miscutils/update.c index 18b13e8c9..14f1d3c20 100644 --- a/miscutils/update.c +++ b/miscutils/update.c | |||
| @@ -35,12 +35,15 @@ _syscall2(int, bdflush, int, func, int, data); | |||
| 35 | #endif /* __GLIBC__ */ | 35 | #endif /* __GLIBC__ */ |
| 36 | 36 | ||
| 37 | static char update_usage[] = | 37 | static char update_usage[] = |
| 38 | "update [options]\n\n" | 38 | "update [options]\n" |
| 39 | "Periodically flushes filesystem buffers.\n\n" | 39 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 40 | "\nPeriodically flushes filesystem buffers.\n\n" | ||
| 40 | "Options:\n" | 41 | "Options:\n" |
| 41 | "\t-S\tforce use of sync(2) instead of flushing\n" | 42 | "\t-S\tforce use of sync(2) instead of flushing\n" |
| 42 | "\t-s SECS\tcall sync this often (default 30)\n" | 43 | "\t-s SECS\tcall sync this often (default 30)\n" |
| 43 | "\t-f SECS\tflush some buffers this often (default 5)\n"; | 44 | "\t-f SECS\tflush some buffers this often (default 5)\n" |
| 45 | #endif | ||
| 46 | ; | ||
| 44 | 47 | ||
| 45 | static unsigned int sync_duration = 30; | 48 | static unsigned int sync_duration = 30; |
| 46 | static unsigned int flush_duration = 5; | 49 | static unsigned int flush_duration = 5; |
| @@ -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; |
| @@ -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/mkfs_minix.c b/mkfs_minix.c index be180a46b..bf4bda9fd 100644 --- a/mkfs_minix.c +++ b/mkfs_minix.c | |||
| @@ -179,9 +179,10 @@ static volatile void show_usage() | |||
| 179 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", | 179 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
| 180 | BB_VER, BB_BT); | 180 | BB_VER, BB_BT); |
| 181 | fprintf(stderr, | 181 | fprintf(stderr, |
| 182 | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n\n", | 182 | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", |
| 183 | program_name); | 183 | program_name); |
| 184 | fprintf(stderr, "Make a MINIX filesystem.\n\n"); | 184 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 185 | fprintf(stderr, "\nMake a MINIX filesystem.\n\n"); | ||
| 185 | fprintf(stderr, "OPTIONS:\n"); | 186 | fprintf(stderr, "OPTIONS:\n"); |
| 186 | fprintf(stderr, "\t-c\t\tCheck the device for bad blocks\n"); | 187 | fprintf(stderr, "\t-c\t\tCheck the device for bad blocks\n"); |
| 187 | fprintf(stderr, | 188 | fprintf(stderr, |
| @@ -191,6 +192,7 @@ static volatile void show_usage() | |||
| 191 | fprintf(stderr, | 192 | fprintf(stderr, |
| 192 | "\t-l FILENAME\tRead the bad blocks list from FILENAME\n"); | 193 | "\t-l FILENAME\tRead the bad blocks list from FILENAME\n"); |
| 193 | fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n"); | 194 | fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n"); |
| 195 | #endif | ||
| 194 | exit(16); | 196 | exit(16); |
| 195 | } | 197 | } |
| 196 | 198 | ||
| @@ -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 | { |
| @@ -49,13 +49,16 @@ | |||
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | static const char mkswap_usage[] = | 51 | static const char mkswap_usage[] = |
| 52 | "mkswap [-c] [-v0|-v1] device [block-count]\n\n" | 52 | "mkswap [-c] [-v0|-v1] device [block-count]\n" |
| 53 | "Prepare a disk partition to be used as a swap partition.\n\n" | 53 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 54 | "\nPrepare a disk partition to be used as a swap partition.\n\n" | ||
| 54 | "Options:\n" "\t-c\t\tCheck for read-ability.\n" | 55 | "Options:\n" "\t-c\t\tCheck for read-ability.\n" |
| 55 | "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" | 56 | "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" |
| 56 | "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" | 57 | "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" |
| 57 | 58 | ||
| 58 | "\tblock-count\tNumber of block to use (default is entire partition).\n"; | 59 | "\tblock-count\tNumber of block to use (default is entire partition).\n" |
| 60 | #endif | ||
| 61 | ; | ||
| 59 | 62 | ||
| 60 | 63 | ||
| 61 | #ifndef _IO | 64 | #ifndef _IO |
diff --git a/modutils/insmod.c b/modutils/insmod.c index eafec7d5d..9d473ca4a 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -70,12 +70,15 @@ _syscall2(unsigned long, create_module, const char *, name, size_t, size) | |||
| 70 | static char m_filename[BUFSIZ + 1] = "\0"; | 70 | static char m_filename[BUFSIZ + 1] = "\0"; |
| 71 | static char m_fullName[BUFSIZ + 1] = "\0"; | 71 | static char m_fullName[BUFSIZ + 1] = "\0"; |
| 72 | static const char insmod_usage[] = | 72 | static const char insmod_usage[] = |
| 73 | "insmod [OPTION]... MODULE [symbol=value]...\n\n" | 73 | "insmod [OPTION]... MODULE [symbol=value]...\n" |
| 74 | "Loads the specified kernel modules into the kernel.\n\n" | 74 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 75 | "\nLoads the specified kernel modules into the kernel.\n\n" | ||
| 75 | "Options:\n" | 76 | "Options:\n" |
| 76 | 77 | ||
| 77 | "\t-f\tForce module to load into the wrong kernel version.\n" | 78 | "\t-f\tForce module to load into the wrong kernel version.\n" |
| 78 | "\t-k\tMake module autoclean-able.\n"; | 79 | "\t-k\tMake module autoclean-able.\n" |
| 80 | #endif | ||
| 81 | ; | ||
| 79 | 82 | ||
| 80 | 83 | ||
| 81 | static int findNamedModule(const char *fileName, struct stat *statbuf) | 84 | static int findNamedModule(const char *fileName, struct stat *statbuf) |
diff --git a/modutils/rmmod.c b/modutils/rmmod.c index bc5c03e62..5ef4a60f8 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c | |||
| @@ -36,10 +36,13 @@ _syscall1(int, delete_module, const char *, name) | |||
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | static const char rmmod_usage[] = | 38 | static const char rmmod_usage[] = |
| 39 | "rmmod [OPTION]... [MODULE]...\n\n" | 39 | "rmmod [OPTION]... [MODULE]...\n" |
| 40 | "Unloads the specified kernel modules from the kernel.\n\n" | 40 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 41 | 41 | "\nUnloads the specified kernel modules from the kernel.\n\n" | |
| 42 | "Options:\n" "\t-a\tTry to remove all unused kernel modules.\n"; | 42 | "Options:\n" |
| 43 | "\t-a\tTry to remove all unused kernel modules.\n" | ||
| 44 | #endif | ||
| 45 | ; | ||
| 43 | 46 | ||
| 44 | 47 | ||
| 45 | 48 | ||
| @@ -30,8 +30,15 @@ | |||
| 30 | #include <fcntl.h> | 30 | #include <fcntl.h> |
| 31 | #include <signal.h> | 31 | #include <signal.h> |
| 32 | #include <sys/ioctl.h> | 32 | #include <sys/ioctl.h> |
| 33 | #define BB_DECLARE_EXTERN | ||
| 34 | #define bb_need_help | ||
| 35 | #include "messages.c" | ||
| 33 | 36 | ||
| 34 | static const char more_usage[] = "more [file ...]\n"; | 37 | static const char more_usage[] = "more [FILE ...]\n" |
| 38 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 39 | "\nMore is a filter for viewing FILE one screenful at a time.\n" | ||
| 40 | #endif | ||
| 41 | ; | ||
| 35 | 42 | ||
| 36 | /* ED: sparc termios is broken: revert back to old termio handling. */ | 43 | /* ED: sparc termios is broken: revert back to old termio handling. */ |
| 37 | #ifdef BB_FEATURE_USE_TERMIOS | 44 | #ifdef BB_FEATURE_USE_TERMIOS |
| @@ -92,7 +99,7 @@ extern int more_main(int argc, char **argv) | |||
| 92 | argv++; | 99 | argv++; |
| 93 | 100 | ||
| 94 | if (argc > 0 | 101 | if (argc > 0 |
| 95 | && (strcmp(*argv, "--help") == 0 || strcmp(*argv, "-h") == 0)) { | 102 | && (strcmp(*argv, dash_dash_help) == 0 || strcmp(*argv, "-h") == 0)) { |
| 96 | usage(more_usage); | 103 | usage(more_usage); |
| 97 | } | 104 | } |
| 98 | do { | 105 | do { |
| @@ -64,10 +64,12 @@ static int use_loop = FALSE; | |||
| 64 | 64 | ||
| 65 | extern const char mtab_file[]; /* Defined in utility.c */ | 65 | extern const char mtab_file[]; /* Defined in utility.c */ |
| 66 | 66 | ||
| 67 | static const char mount_usage[] = "\tmount [flags]\n" | 67 | static const char mount_usage[] = |
| 68 | "\tmount [flags] device directory [-o options,more-options]\n" | 68 | "mount [flags] device directory [-o options,more-options]\n" |
| 69 | "\n" "Flags:\n" | 69 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 70 | "\t-a:\t\tMount all file systems in fstab.\n" | 70 | "\nMount a filesystem\n\n" |
| 71 | "Flags:\n" | ||
| 72 | "\t-a:\t\tMount all filesystems in fstab.\n" | ||
| 71 | #ifdef BB_MTAB | 73 | #ifdef BB_MTAB |
| 72 | "\t-f:\t\t\"Fake\" mount. Add entry to mount table but don't mount it.\n" | 74 | "\t-f:\t\t\"Fake\" mount. Add entry to mount table but don't mount it.\n" |
| 73 | "\t-n:\t\tDon't write a mount table entry.\n" | 75 | "\t-n:\t\tDon't write a mount table entry.\n" |
| @@ -88,8 +90,10 @@ static const char mount_usage[] = "\tmount [flags]\n" | |||
| 88 | "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" | 90 | "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" |
| 89 | "\tremount:\tRe-mount a currently-mounted filesystem, changing its flags.\n" | 91 | "\tremount:\tRe-mount a currently-mounted filesystem, changing its flags.\n" |
| 90 | "\tro/rw:\t\tMount for read-only / read-write.\n" | 92 | "\tro/rw:\t\tMount for read-only / read-write.\n" |
| 91 | "There are EVEN MORE flags that are specific to each filesystem.\n" | 93 | "\nThere are EVEN MORE flags that are specific to each filesystem.\n" |
| 92 | "You'll have to see the written documentation for those.\n"; | 94 | "You'll have to see the written documentation for those.\n" |
| 95 | #endif | ||
| 96 | ; | ||
| 93 | 97 | ||
| 94 | 98 | ||
| 95 | struct mount_options { | 99 | struct mount_options { |
| @@ -451,7 +455,7 @@ extern int mount_main(int argc, char **argv) | |||
| 451 | fatalError( "\nCannot read /etc/fstab: %s\n", strerror (errno)); | 455 | fatalError( "\nCannot read /etc/fstab: %s\n", strerror (errno)); |
| 452 | 456 | ||
| 453 | while ((m = getmntent(f)) != NULL) { | 457 | while ((m = getmntent(f)) != NULL) { |
| 454 | // If the file system isn't noauto, | 458 | // If the filesystem isn't noauto, |
| 455 | // and isn't swap or nfs, then mount it | 459 | // and isn't swap or nfs, then mount it |
| 456 | if ((!strstr(m->mnt_opts, "noauto")) && | 460 | if ((!strstr(m->mnt_opts, "noauto")) && |
| 457 | (!strstr(m->mnt_type, "swap")) && | 461 | (!strstr(m->mnt_type, "swap")) && |
| @@ -4,8 +4,11 @@ | |||
| 4 | #include <sys/mtio.h> | 4 | #include <sys/mtio.h> |
| 5 | #include <sys/fcntl.h> | 5 | #include <sys/fcntl.h> |
| 6 | 6 | ||
| 7 | static const char mt_usage[] = "mt [-f device] opcode value\n\n" | 7 | static const char mt_usage[] = "mt [-f device] opcode value\n" |
| 8 | "Control magnetic tape drive operation\n"; | 8 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 9 | "\nControl magnetic tape drive operation\n" | ||
| 10 | #endif | ||
| 11 | ; | ||
| 9 | 12 | ||
| 10 | struct mt_opcodes { | 13 | struct mt_opcodes { |
| 11 | char *name; | 14 | char *name; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* mnc: mini-netcat - built from the ground up for LRP | 2 | /* nc: mini-netcat - built from the ground up for LRP |
| 3 | Copyright (C) 1998 Charles P. Wright | 3 | Copyright (C) 1998 Charles P. Wright |
| 4 | 4 | ||
| 5 | 0.0.1 6K It works. | 5 | 0.0.1 6K It works. |
| @@ -40,11 +40,13 @@ | |||
| 40 | 40 | ||
| 41 | #define BUFSIZE 100 | 41 | #define BUFSIZE 100 |
| 42 | 42 | ||
| 43 | static const char mnc_usage[] = | 43 | static const char nc_usage[] = "nc [IP] [port]\n" |
| 44 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 45 | "\nNetcat opens a pipe to IP:port\n" | ||
| 46 | #endif | ||
| 47 | ; | ||
| 44 | 48 | ||
| 45 | "mnc [IP] [port]\n\n" "mini-netcat opens a pipe to IP:port\n"; | 49 | int nc_main(int argc, char **argv) |
| 46 | |||
| 47 | int mnc_main(int argc, char **argv) | ||
| 48 | { | 50 | { |
| 49 | int sfd; | 51 | int sfd; |
| 50 | int result; | 52 | int result; |
| @@ -59,7 +61,7 @@ int mnc_main(int argc, char **argv) | |||
| 59 | argc--; | 61 | argc--; |
| 60 | argv++; | 62 | argv++; |
| 61 | if (argc < 2 || **(argv + 1) == '-') { | 63 | if (argc < 2 || **(argv + 1) == '-') { |
| 62 | usage(mnc_usage); | 64 | usage(nc_usage); |
| 63 | } | 65 | } |
| 64 | 66 | ||
| 65 | sfd = socket(AF_INET, SOCK_STREAM, 0); | 67 | sfd = socket(AF_INET, SOCK_STREAM, 0); |
diff --git a/networking/hostname.c b/networking/hostname.c index 8cc334da0..ef921024b 100644 --- a/networking/hostname.c +++ b/networking/hostname.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* | 2 | /* |
| 3 | * $Id: hostname.c,v 1.7 2000/02/08 19:58:47 erik Exp $ | 3 | * $Id: hostname.c,v 1.8 2000/05/12 19:41:47 erik Exp $ |
| 4 | * Mini hostname implementation for busybox | 4 | * Mini hostname implementation for busybox |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
| @@ -31,15 +31,18 @@ | |||
| 31 | #include <stdio.h> | 31 | #include <stdio.h> |
| 32 | 32 | ||
| 33 | static const char *hostname_usage = | 33 | static const char *hostname_usage = |
| 34 | "hostname [OPTION] {hostname | -F file}\n\n" | 34 | "hostname [OPTION] {hostname | -F file}\n" |
| 35 | "Get or set the hostname or DNS domain name. If a hostname is given\n" | 35 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 36 | "\nGet or set the hostname or DNS domain name. If a hostname is given\n" | ||
| 36 | "(or a file with the -F parameter), the host name will be set.\n\n" | 37 | "(or a file with the -F parameter), the host name will be set.\n\n" |
| 37 | "Options:\n" | 38 | "Options:\n" |
| 38 | "\t-s\t\tShort\n" | 39 | "\t-s\t\tShort\n" |
| 39 | 40 | ||
| 40 | "\t-i\t\tAddresses for the hostname\n" | 41 | "\t-i\t\tAddresses for the hostname\n" |
| 41 | "\t-d\t\tDNS domain name\n" | 42 | "\t-d\t\tDNS domain name\n" |
| 42 | "\t-F FILE\t\tUse the contents of FILE to specify the hostname\n"; | 43 | "\t-F FILE\t\tUse the contents of FILE to specify the hostname\n" |
| 44 | #endif | ||
| 45 | ; | ||
| 43 | 46 | ||
| 44 | 47 | ||
| 45 | void do_sethostname(char *s, int isfile) | 48 | void do_sethostname(char *s, int isfile) |
diff --git a/networking/nc.c b/networking/nc.c new file mode 100644 index 000000000..a588587fb --- /dev/null +++ b/networking/nc.c | |||
| @@ -0,0 +1,133 @@ | |||
| 1 | /* vi: set sw=4 ts=4: */ | ||
| 2 | /* nc: mini-netcat - built from the ground up for LRP | ||
| 3 | Copyright (C) 1998 Charles P. Wright | ||
| 4 | |||
| 5 | 0.0.1 6K It works. | ||
| 6 | 0.0.2 5K Smaller and you can also check the exit condition if you wish. | ||
| 7 | 0.0.3 Uses select() | ||
| 8 | |||
| 9 | 19980918 Busy Boxed! Dave Cinege | ||
| 10 | 19990512 Uses Select. Charles P. Wright | ||
| 11 | 19990513 Fixes stdin stupidity and uses buffers. Charles P. Wright | ||
| 12 | |||
| 13 | This program is free software; you can redistribute it and/or modify | ||
| 14 | it under the terms of the GNU General Public License as published by | ||
| 15 | the Free Software Foundation; either version 2 of the License, or | ||
| 16 | (at your option) any later version. | ||
| 17 | |||
| 18 | This program is distributed in the hope that it will be useful, | ||
| 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 21 | GNU General Public License for more details. | ||
| 22 | |||
| 23 | You should have received a copy of the GNU General Public License | ||
| 24 | along with this program; if not, write to the Free Software | ||
| 25 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 26 | |||
| 27 | */ | ||
| 28 | #include "internal.h" | ||
| 29 | #include <stdio.h> | ||
| 30 | #include <stdlib.h> | ||
| 31 | #include <unistd.h> | ||
| 32 | |||
| 33 | #include <sys/types.h> | ||
| 34 | #include <sys/socket.h> | ||
| 35 | #include <netinet/in.h> | ||
| 36 | #include <arpa/inet.h> | ||
| 37 | #include <netdb.h> | ||
| 38 | #include <sys/time.h> | ||
| 39 | #include <sys/ioctl.h> | ||
| 40 | |||
| 41 | #define BUFSIZE 100 | ||
| 42 | |||
| 43 | static const char nc_usage[] = "nc [IP] [port]\n" | ||
| 44 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 45 | "\nNetcat opens a pipe to IP:port\n" | ||
| 46 | #endif | ||
| 47 | ; | ||
| 48 | |||
| 49 | int nc_main(int argc, char **argv) | ||
| 50 | { | ||
| 51 | int sfd; | ||
| 52 | int result; | ||
| 53 | int len; | ||
| 54 | char ch[BUFSIZE]; | ||
| 55 | |||
| 56 | struct sockaddr_in address; | ||
| 57 | struct hostent *hostinfo; | ||
| 58 | |||
| 59 | fd_set readfds, testfds; | ||
| 60 | |||
| 61 | argc--; | ||
| 62 | argv++; | ||
| 63 | if (argc < 2 || **(argv + 1) == '-') { | ||
| 64 | usage(nc_usage); | ||
| 65 | } | ||
| 66 | |||
| 67 | sfd = socket(AF_INET, SOCK_STREAM, 0); | ||
| 68 | |||
| 69 | hostinfo = (struct hostent *) gethostbyname(*argv); | ||
| 70 | |||
| 71 | if (!hostinfo) { | ||
| 72 | exit(1); | ||
| 73 | } | ||
| 74 | |||
| 75 | address.sin_family = AF_INET; | ||
| 76 | address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list; | ||
| 77 | address.sin_port = htons(atoi(*(++argv))); | ||
| 78 | |||
| 79 | len = sizeof(address); | ||
| 80 | |||
| 81 | result = connect(sfd, (struct sockaddr *) &address, len); | ||
| 82 | |||
| 83 | if (result < 0) { | ||
| 84 | exit(2); | ||
| 85 | } | ||
| 86 | |||
| 87 | FD_ZERO(&readfds); | ||
| 88 | FD_SET(sfd, &readfds); | ||
| 89 | FD_SET(fileno(stdin), &readfds); | ||
| 90 | |||
| 91 | while (1) { | ||
| 92 | int fd; | ||
| 93 | int ofd; | ||
| 94 | int nread; | ||
| 95 | |||
| 96 | testfds = readfds; | ||
| 97 | |||
| 98 | result = | ||
| 99 | select(FD_SETSIZE, &testfds, (fd_set *) NULL, (fd_set *) NULL, | ||
| 100 | (struct timeval *) 0); | ||
| 101 | |||
| 102 | if (result < 1) { | ||
| 103 | exit(3); | ||
| 104 | } | ||
| 105 | |||
| 106 | for (fd = 0; fd < FD_SETSIZE; fd++) { | ||
| 107 | if (FD_ISSET(fd, &testfds)) { | ||
| 108 | int trn = 0; | ||
| 109 | int rn; | ||
| 110 | |||
| 111 | ioctl(fd, FIONREAD, &nread); | ||
| 112 | |||
| 113 | if (fd == sfd) { | ||
| 114 | if (nread == 0) | ||
| 115 | exit(0); | ||
| 116 | ofd = fileno(stdout); | ||
| 117 | } else { | ||
| 118 | ofd = sfd; | ||
| 119 | } | ||
| 120 | |||
| 121 | |||
| 122 | |||
| 123 | do { | ||
| 124 | rn = (BUFSIZE < nread - trn) ? BUFSIZE : nread - trn; | ||
| 125 | trn += rn; | ||
| 126 | read(fd, ch, rn); | ||
| 127 | write(ofd, ch, rn); | ||
| 128 | } | ||
| 129 | while (trn < nread); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | } | ||
| 133 | } | ||
diff --git a/networking/nslookup.c b/networking/nslookup.c index e4bf52f80..82bcf56a1 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c | |||
| @@ -41,7 +41,11 @@ | |||
| 41 | | + find out how the real nslookup gets the default name server | 41 | | + find out how the real nslookup gets the default name server |
| 42 | */ | 42 | */ |
| 43 | 43 | ||
| 44 | static const char nslookup_usage[] = "nslookup [HOST]\n\nQueries the nameserver for the IP address of the given HOST\n"; | 44 | static const char nslookup_usage[] = "nslookup [HOST]\n" |
| 45 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 46 | "\nQueries the nameserver for the IP address of the given HOST\n" | ||
| 47 | #endif | ||
| 48 | ; | ||
| 45 | 49 | ||
| 46 | 50 | ||
| 47 | /* I have to see how the real nslookup does this. | 51 | /* I have to see how the real nslookup does this. |
| @@ -173,4 +177,4 @@ int nslookup_main(int argc, char **argv) | |||
| 173 | exit( TRUE); | 177 | exit( TRUE); |
| 174 | } | 178 | } |
| 175 | 179 | ||
| 176 | /* $Id: nslookup.c,v 1.8 2000/05/02 00:07:56 erik Exp $ */ | 180 | /* $Id: nslookup.c,v 1.9 2000/05/12 19:41:47 erik Exp $ */ |
diff --git a/networking/ping.c b/networking/ping.c index 9f83002a2..14a56cd55 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* | 2 | /* |
| 3 | * $Id: ping.c,v 1.14 2000/04/25 23:24:55 erik Exp $ | 3 | * $Id: ping.c,v 1.15 2000/05/12 19:41:47 erik Exp $ |
| 4 | * Mini ping implementation for busybox | 4 | * Mini ping implementation for busybox |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
| @@ -90,7 +90,11 @@ static int in_cksum(unsigned short *buf, int sz) | |||
| 90 | 90 | ||
| 91 | /* simple version */ | 91 | /* simple version */ |
| 92 | #ifdef BB_SIMPLE_PING | 92 | #ifdef BB_SIMPLE_PING |
| 93 | static const char *ping_usage = "ping host\n\n"; | 93 | static const char *ping_usage = "ping host\n" |
| 94 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 95 | "\nSend ICMP ECHO_REQUEST packets to network hosts\n" | ||
| 96 | #endif | ||
| 97 | ; | ||
| 94 | 98 | ||
| 95 | static char *hostname = NULL; | 99 | static char *hostname = NULL; |
| 96 | 100 | ||
| @@ -179,12 +183,15 @@ extern int ping_main(int argc, char **argv) | |||
| 179 | 183 | ||
| 180 | #else | 184 | #else |
| 181 | /* full(er) version */ | 185 | /* full(er) version */ |
| 182 | static const char *ping_usage = "ping [OPTION]... host\n\n" | 186 | static const char *ping_usage = "ping [OPTION]... host\n" |
| 183 | "Send ICMP ECHO_REQUEST packets to network hosts.\n\n" | 187 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 188 | "\nSend ICMP ECHO_REQUEST packets to network hosts.\n\n" | ||
| 184 | "Options:\n" | 189 | "Options:\n" |
| 185 | "\t-c COUNT\tSend only COUNT pings.\n" | 190 | "\t-c COUNT\tSend only COUNT pings.\n" |
| 186 | "\t-q\t\tQuiet mode, only displays output at start\n" | 191 | "\t-q\t\tQuiet mode, only displays output at start\n" |
| 187 | "\t\t\tand when finished.\n"; | 192 | "\t\t\tand when finished.\n" |
| 193 | #endif | ||
| 194 | ; | ||
| 188 | 195 | ||
| 189 | static char *hostname = NULL; | 196 | static char *hostname = NULL; |
| 190 | static struct sockaddr_in pingaddr; | 197 | static struct sockaddr_in pingaddr; |
diff --git a/networking/telnet.c b/networking/telnet.c index 8c58521eb..8b6d5f5dc 100644 --- a/networking/telnet.c +++ b/networking/telnet.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: telnet.c,v 1.2 2000/05/01 19:10:52 erik Exp $ | 2 | * $Id: telnet.c,v 1.3 2000/05/12 19:41:47 erik Exp $ |
| 3 | * Mini telnet implementation for busybox | 3 | * Mini telnet implementation for busybox |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2000 by Randolph Chung <tausq@debian.org> | 5 | * Copyright (C) 2000 by Randolph Chung <tausq@debian.org> |
| @@ -46,7 +46,12 @@ | |||
| 46 | 46 | ||
| 47 | static int STDIN = 0; | 47 | static int STDIN = 0; |
| 48 | static int STDOUT = 1; | 48 | static int STDOUT = 1; |
| 49 | static const char *telnet_usage = "telnet host [port]\n\n"; | 49 | static const char *telnet_usage = "telnet host [port]\n" |
| 50 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 51 | "\nProvides interactive communication with another\n" | ||
| 52 | "networked host using the TELNET protocol\n" | ||
| 53 | #endif | ||
| 54 | ; | ||
| 50 | static struct termios saved_tc; | 55 | static struct termios saved_tc; |
| 51 | static unsigned char options[NTELOPTS]; | 56 | static unsigned char options[NTELOPTS]; |
| 52 | static char tr_state = 0; /* telnet send and receive state */ | 57 | static char tr_state = 0; /* telnet send and receive state */ |
diff --git a/nslookup.c b/nslookup.c index e4bf52f80..82bcf56a1 100644 --- a/nslookup.c +++ b/nslookup.c | |||
| @@ -41,7 +41,11 @@ | |||
| 41 | | + find out how the real nslookup gets the default name server | 41 | | + find out how the real nslookup gets the default name server |
| 42 | */ | 42 | */ |
| 43 | 43 | ||
| 44 | static const char nslookup_usage[] = "nslookup [HOST]\n\nQueries the nameserver for the IP address of the given HOST\n"; | 44 | static const char nslookup_usage[] = "nslookup [HOST]\n" |
| 45 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 46 | "\nQueries the nameserver for the IP address of the given HOST\n" | ||
| 47 | #endif | ||
| 48 | ; | ||
| 45 | 49 | ||
| 46 | 50 | ||
| 47 | /* I have to see how the real nslookup does this. | 51 | /* I have to see how the real nslookup does this. |
| @@ -173,4 +177,4 @@ int nslookup_main(int argc, char **argv) | |||
| 173 | exit( TRUE); | 177 | exit( TRUE); |
| 174 | } | 178 | } |
| 175 | 179 | ||
| 176 | /* $Id: nslookup.c,v 1.8 2000/05/02 00:07:56 erik Exp $ */ | 180 | /* $Id: nslookup.c,v 1.9 2000/05/12 19:41:47 erik Exp $ */ |
| @@ -1,6 +1,6 @@ | |||
| 1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* | 2 | /* |
| 3 | * $Id: ping.c,v 1.14 2000/04/25 23:24:55 erik Exp $ | 3 | * $Id: ping.c,v 1.15 2000/05/12 19:41:47 erik Exp $ |
| 4 | * Mini ping implementation for busybox | 4 | * Mini ping implementation for busybox |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
| @@ -90,7 +90,11 @@ static int in_cksum(unsigned short *buf, int sz) | |||
| 90 | 90 | ||
| 91 | /* simple version */ | 91 | /* simple version */ |
| 92 | #ifdef BB_SIMPLE_PING | 92 | #ifdef BB_SIMPLE_PING |
| 93 | static const char *ping_usage = "ping host\n\n"; | 93 | static const char *ping_usage = "ping host\n" |
| 94 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 95 | "\nSend ICMP ECHO_REQUEST packets to network hosts\n" | ||
| 96 | #endif | ||
| 97 | ; | ||
| 94 | 98 | ||
| 95 | static char *hostname = NULL; | 99 | static char *hostname = NULL; |
| 96 | 100 | ||
| @@ -179,12 +183,15 @@ extern int ping_main(int argc, char **argv) | |||
| 179 | 183 | ||
| 180 | #else | 184 | #else |
| 181 | /* full(er) version */ | 185 | /* full(er) version */ |
| 182 | static const char *ping_usage = "ping [OPTION]... host\n\n" | 186 | static const char *ping_usage = "ping [OPTION]... host\n" |
| 183 | "Send ICMP ECHO_REQUEST packets to network hosts.\n\n" | 187 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 188 | "\nSend ICMP ECHO_REQUEST packets to network hosts.\n\n" | ||
| 184 | "Options:\n" | 189 | "Options:\n" |
| 185 | "\t-c COUNT\tSend only COUNT pings.\n" | 190 | "\t-c COUNT\tSend only COUNT pings.\n" |
| 186 | "\t-q\t\tQuiet mode, only displays output at start\n" | 191 | "\t-q\t\tQuiet mode, only displays output at start\n" |
| 187 | "\t\t\tand when finished.\n"; | 192 | "\t\t\tand when finished.\n" |
| 193 | #endif | ||
| 194 | ; | ||
| 188 | 195 | ||
| 189 | static char *hostname = NULL; | 196 | static char *hostname = NULL; |
| 190 | static struct sockaddr_in pingaddr; | 197 | static struct sockaddr_in pingaddr; |
| @@ -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/procps/free.c b/procps/free.c index 39594dbe5..e6f130ea9 100644 --- a/procps/free.c +++ b/procps/free.c | |||
| @@ -37,6 +37,14 @@ extern int free_main(int argc, char **argv) | |||
| 37 | info.sharedram/=DIVISOR; | 37 | info.sharedram/=DIVISOR; |
| 38 | info.bufferram/=DIVISOR; | 38 | info.bufferram/=DIVISOR; |
| 39 | 39 | ||
| 40 | if (argc > 1 && **(argv + 1) == '-') { | ||
| 41 | usage("free\n" | ||
| 42 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 43 | "\nDisplays the amount of free and used system memory\n" | ||
| 44 | #endif | ||
| 45 | ); | ||
| 46 | } | ||
| 47 | |||
| 40 | 48 | ||
| 41 | printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free", | 49 | printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free", |
| 42 | "shared", "buffers"); | 50 | "shared", "buffers"); |
diff --git a/procps/kill.c b/procps/kill.c index 93f02eab4..0487f6a66 100644 --- a/procps/kill.c +++ b/procps/kill.c | |||
| @@ -32,16 +32,22 @@ | |||
| 32 | #include <unistd.h> | 32 | #include <unistd.h> |
| 33 | 33 | ||
| 34 | static const char *kill_usage = | 34 | static const char *kill_usage = |
| 35 | "kill [-signal] process-id [process-id ...]\n\n" | 35 | "kill [-signal] process-id [process-id ...]\n" |
| 36 | "Send a signal (default is SIGTERM) to the specified process(es).\n\n" | 36 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 37 | "Options:\n" "\t-l\tList all signal names and numbers.\n\n"; | 37 | "\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" |
| 38 | "Options:\n" "\t-l\tList all signal names and numbers.\n\n" | ||
| 39 | #endif | ||
| 40 | ; | ||
| 38 | 41 | ||
| 39 | #ifdef BB_KILLALL | 42 | #ifdef BB_KILLALL |
| 40 | static const char *killall_usage = | 43 | static const char *killall_usage = |
| 41 | "killall [-signal] process-name [process-name ...]\n\n" | 44 | "killall [-signal] process-name [process-name ...]\n" |
| 42 | "Send a signal (default is SIGTERM) to the specified process(es).\n\n" | 45 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 43 | "Options:\n" "\t-l\tList all signal names and numbers.\n\n"; | 46 | "\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" |
| 47 | "Options:\n" "\t-l\tList all signal names and numbers.\n\n" | ||
| 48 | #endif | ||
| 44 | #endif | 49 | #endif |
| 50 | ; | ||
| 45 | 51 | ||
| 46 | #define KILL 0 | 52 | #define KILL 0 |
| 47 | #define KILLALL 1 | 53 | #define KILLALL 1 |
diff --git a/procps/ps.c b/procps/ps.c index f8cf33b25..0842a22c2 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
| @@ -36,6 +36,9 @@ | |||
| 36 | #include <fcntl.h> | 36 | #include <fcntl.h> |
| 37 | #include <ctype.h> | 37 | #include <ctype.h> |
| 38 | #include <sys/ioctl.h> | 38 | #include <sys/ioctl.h> |
| 39 | #define BB_DECLARE_EXTERN | ||
| 40 | #define bb_need_help | ||
| 41 | #include "messages.c" | ||
| 39 | 42 | ||
| 40 | 43 | ||
| 41 | #if ! defined BB_FEATURE_USE_DEVPS_PATCH | 44 | #if ! defined BB_FEATURE_USE_DEVPS_PATCH |
| @@ -128,8 +131,13 @@ extern int ps_main(int argc, char **argv) | |||
| 128 | 131 | ||
| 129 | 132 | ||
| 130 | 133 | ||
| 131 | if (argc > 1 && strcmp(argv[1], "--help") == 0) { | 134 | if (argc > 1 && strcmp(argv[1], dash_dash_help) == 0) { |
| 132 | usage ("ps\n\nReport process status\n\nThis version of ps accepts no options.\n"); | 135 | usage ("ps\n" |
| 136 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 137 | "\nReport process status\n" | ||
| 138 | "\nThis version of ps accepts no options.\n" | ||
| 139 | #endif | ||
| 140 | ); | ||
| 133 | } | 141 | } |
| 134 | 142 | ||
| 135 | dir = opendir("/proc"); | 143 | dir = opendir("/proc"); |
| @@ -36,6 +36,9 @@ | |||
| 36 | #include <fcntl.h> | 36 | #include <fcntl.h> |
| 37 | #include <ctype.h> | 37 | #include <ctype.h> |
| 38 | #include <sys/ioctl.h> | 38 | #include <sys/ioctl.h> |
| 39 | #define BB_DECLARE_EXTERN | ||
| 40 | #define bb_need_help | ||
| 41 | #include "messages.c" | ||
| 39 | 42 | ||
| 40 | 43 | ||
| 41 | #if ! defined BB_FEATURE_USE_DEVPS_PATCH | 44 | #if ! defined BB_FEATURE_USE_DEVPS_PATCH |
| @@ -128,8 +131,13 @@ extern int ps_main(int argc, char **argv) | |||
| 128 | 131 | ||
| 129 | 132 | ||
| 130 | 133 | ||
| 131 | if (argc > 1 && strcmp(argv[1], "--help") == 0) { | 134 | if (argc > 1 && strcmp(argv[1], dash_dash_help) == 0) { |
| 132 | usage ("ps\n\nReport process status\n\nThis version of ps accepts no options.\n"); | 135 | usage ("ps\n" |
| 136 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 137 | "\nReport process status\n" | ||
| 138 | "\nThis version of ps accepts no options.\n" | ||
| 139 | #endif | ||
| 140 | ); | ||
| 133 | } | 141 | } |
| 134 | 142 | ||
| 135 | dir = opendir("/proc"); | 143 | dir = opendir("/proc"); |
| @@ -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); |
| @@ -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; |
| @@ -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) { |
| @@ -36,10 +36,13 @@ _syscall1(int, delete_module, const char *, name) | |||
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | static const char rmmod_usage[] = | 38 | static const char rmmod_usage[] = |
| 39 | "rmmod [OPTION]... [MODULE]...\n\n" | 39 | "rmmod [OPTION]... [MODULE]...\n" |
| 40 | "Unloads the specified kernel modules from the kernel.\n\n" | 40 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 41 | 41 | "\nUnloads the specified kernel modules from the kernel.\n\n" | |
| 42 | "Options:\n" "\t-a\tTry to remove all unused kernel modules.\n"; | 42 | "Options:\n" |
| 43 | "\t-a\tTry to remove all unused kernel modules.\n" | ||
| 44 | #endif | ||
| 45 | ; | ||
| 43 | 46 | ||
| 44 | 47 | ||
| 45 | 48 | ||
| @@ -38,8 +38,9 @@ | |||
| 38 | #include <ctype.h> | 38 | #include <ctype.h> |
| 39 | 39 | ||
| 40 | static const char sed_usage[] = | 40 | static const char sed_usage[] = |
| 41 | "sed [-n] -e script [file...]\n\n" | 41 | "sed [-n] -e script [file...]\n" |
| 42 | "Allowed sed scripts come in the following form:\n" | 42 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 43 | "\nAllowed sed scripts come in the following form:\n" | ||
| 43 | "\t'ADDR [!] COMMAND'\n\n" | 44 | "\t'ADDR [!] COMMAND'\n\n" |
| 44 | "\twhere address ADDR can be:\n" | 45 | "\twhere address ADDR can be:\n" |
| 45 | "\t NUMBER Match specified line number\n" | 46 | "\t NUMBER Match specified line number\n" |
| @@ -58,8 +59,10 @@ static const char sed_usage[] = | |||
| 58 | #if defined BB_REGEXP | 59 | #if defined BB_REGEXP |
| 59 | "This version of sed matches full regular expresions.\n"; | 60 | "This version of sed matches full regular expresions.\n"; |
| 60 | #else | 61 | #else |
| 61 | "This version of sed matches strings (not full regular expresions).\n"; | 62 | "This version of sed matches strings (not full regular expresions).\n" |
| 62 | #endif | 63 | #endif |
| 64 | #endif | ||
| 65 | ; | ||
| 63 | 66 | ||
| 64 | /* Flags & variables */ | 67 | /* Flags & variables */ |
| 65 | 68 | ||
| @@ -54,10 +54,14 @@ | |||
| 54 | #include <linux/hdreg.h> /* HDIO_GETGEO */ | 54 | #include <linux/hdreg.h> /* HDIO_GETGEO */ |
| 55 | #include <linux/fs.h> /* BLKGETSIZE */ | 55 | #include <linux/fs.h> /* BLKGETSIZE */ |
| 56 | 56 | ||
| 57 | #define BB_DECLARE_EXTERN | ||
| 58 | #define bb_need_memory_exhausted | ||
| 59 | #include "messages.c" | ||
| 57 | 60 | ||
| 58 | static const char sfdisk_usage[] = | 61 | static const char sfdisk_usage[] = |
| 59 | "sfdisk [options] device ...\n" | 62 | "sfdisk [options] device ...\n" |
| 60 | "device: something like /dev/hda or /dev/sda\n" | 63 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 64 | "\ndevice: something like /dev/hda or /dev/sda\n" | ||
| 61 | "useful options:\n" | 65 | "useful options:\n" |
| 62 | " -s [or --show-size]: list size of a partition\n" | 66 | " -s [or --show-size]: list size of a partition\n" |
| 63 | " -c [or --id]: print or change partition Id\n" | 67 | " -c [or --id]: print or change partition Id\n" |
| @@ -86,7 +90,9 @@ static const char sfdisk_usage[] = | |||
| 86 | " -S# [or --sectors #]: set the number of sectors to use\n" | 90 | " -S# [or --sectors #]: set the number of sectors to use\n" |
| 87 | 91 | ||
| 88 | "You can disable all consistency checking with:\n" | 92 | "You can disable all consistency checking with:\n" |
| 89 | " -f [or --force]: do what I say, even if it is stupid\n"; | 93 | " -f [or --force]: do what I say, even if it is stupid\n" |
| 94 | #endif | ||
| 95 | ; | ||
| 90 | 96 | ||
| 91 | 97 | ||
| 92 | 98 | ||
| @@ -421,7 +427,7 @@ static int restore_sectors(char *dev) | |||
| 421 | return 0; | 427 | return 0; |
| 422 | } | 428 | } |
| 423 | if (!(ss = (char *) malloc(statbuf.st_size))) { | 429 | if (!(ss = (char *) malloc(statbuf.st_size))) { |
| 424 | errorMsg("out of memory?\n"); | 430 | errorMsg(memory_exhausted, "sfdisk"); |
| 425 | return 0; | 431 | return 0; |
| 426 | } | 432 | } |
| 427 | fdin = open(restore_sector_file, O_RDONLY); | 433 | fdin = open(restore_sector_file, O_RDONLY); |
| @@ -127,8 +127,11 @@ static struct builtInCommand bltins[] = { | |||
| 127 | 127 | ||
| 128 | static const char shell_usage[] = | 128 | static const char shell_usage[] = |
| 129 | 129 | ||
| 130 | "sh [FILE]...\n\n" "The BusyBox command interpreter (shell).\n\n"; | 130 | "sh [FILE]...\n" |
| 131 | 131 | #ifndef BB_FEATURE_TRIVIAL_HELP | |
| 132 | "\nlash: The BusyBox command interpreter (shell).\n\n" | ||
| 133 | #endif | ||
| 134 | ; | ||
| 132 | 135 | ||
| 133 | static char cwd[1024]; | 136 | static char cwd[1024]; |
| 134 | static char *prompt = "# "; | 137 | static char *prompt = "# "; |
diff --git a/shell/lash.c b/shell/lash.c index b96b46456..e446ad113 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
| @@ -127,8 +127,11 @@ static struct builtInCommand bltins[] = { | |||
| 127 | 127 | ||
| 128 | static const char shell_usage[] = | 128 | static const char shell_usage[] = |
| 129 | 129 | ||
| 130 | "sh [FILE]...\n\n" "The BusyBox command interpreter (shell).\n\n"; | 130 | "sh [FILE]...\n" |
| 131 | 131 | #ifndef BB_FEATURE_TRIVIAL_HELP | |
| 132 | "\nlash: The BusyBox command interpreter (shell).\n\n" | ||
| 133 | #endif | ||
| 134 | ; | ||
| 132 | 135 | ||
| 133 | static char cwd[1024]; | 136 | static char cwd[1024]; |
| 134 | static char *prompt = "# "; | 137 | static char *prompt = "# "; |
| @@ -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 | { |
| @@ -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/swaponoff.c b/swaponoff.c index aa961dac9..0f8c4f5f3 100644 --- a/swaponoff.c +++ b/swaponoff.c | |||
| @@ -36,16 +36,22 @@ static int whichApp; | |||
| 36 | static const char *appName; | 36 | static const char *appName; |
| 37 | 37 | ||
| 38 | static const char swapoff_usage[] = | 38 | static const char swapoff_usage[] = |
| 39 | "swapoff [OPTION] [device]\n\n" | 39 | "swapoff [OPTION] [device]\n" |
| 40 | "Stop swapping virtual memory pages on the given device.\n\n" | 40 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 41 | "\nStop swapping virtual memory pages on the given device.\n\n" | ||
| 41 | "Options:\n" | 42 | "Options:\n" |
| 42 | "\t-a\tStop swapping on all swap devices\n"; | 43 | "\t-a\tStop swapping on all swap devices\n" |
| 44 | #endif | ||
| 45 | ; | ||
| 43 | 46 | ||
| 44 | static const char swapon_usage[] = | 47 | static const char swapon_usage[] = |
| 45 | "swapon [OPTION] [device]\n\n" | 48 | "swapon [OPTION] [device]\n" |
| 46 | "Start swapping virtual memory pages on the given device.\n\n" | 49 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 50 | "\nStart swapping virtual memory pages on the given device.\n\n" | ||
| 47 | "Options:\n" | 51 | "Options:\n" |
| 48 | "\t-a\tStart swapping on all swap devices\n"; | 52 | "\t-a\tStart swapping on all swap devices\n" |
| 53 | #endif | ||
| 54 | ; | ||
| 49 | 55 | ||
| 50 | 56 | ||
| 51 | #define SWAPON_APP 1 | 57 | #define SWAPON_APP 1 |
| @@ -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/sysklogd/logger.c b/sysklogd/logger.c index db6d9bfc5..118a5ded0 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c | |||
| @@ -48,14 +48,17 @@ extern CODE facilitynames[]; | |||
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| 50 | static const char logger_usage[] = | 50 | static const char logger_usage[] = |
| 51 | "logger [OPTION]... [MESSAGE]\n\n" | 51 | "logger [OPTION]... [MESSAGE]\n" |
| 52 | "Write MESSAGE to the system log. If MESSAGE is '-', log stdin.\n\n" | 52 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 53 | "\nWrite MESSAGE to the system log. If MESSAGE is '-', log stdin.\n\n" | ||
| 53 | "Options:\n" | 54 | "Options:\n" |
| 54 | "\t-s\tLog to stderr as well as the system log.\n" | 55 | "\t-s\tLog to stderr as well as the system log.\n" |
| 55 | "\t-t\tLog using the specified tag (defaults to user name).\n" | 56 | "\t-t\tLog using the specified tag (defaults to user name).\n" |
| 56 | 57 | ||
| 57 | "\t-p\tEnter the message with the specified priority.\n" | 58 | "\t-p\tEnter the message with the specified priority.\n" |
| 58 | "\t\tThis may be numerical or a ``facility.level'' pair.\n"; | 59 | "\t\tThis may be numerical or a ``facility.level'' pair.\n" |
| 60 | #endif | ||
| 61 | ; | ||
| 59 | 62 | ||
| 60 | 63 | ||
| 61 | /* Decode a symbolic name to a numeric value | 64 | /* Decode a symbolic name to a numeric value |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index cacb629e9..faa6f15e9 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
| @@ -64,8 +64,9 @@ static int MarkInterval = 20 * 60; | |||
| 64 | static char LocalHostName[32]; | 64 | static char LocalHostName[32]; |
| 65 | 65 | ||
| 66 | static const char syslogd_usage[] = | 66 | static const char syslogd_usage[] = |
| 67 | "syslogd [OPTION]...\n\n" | 67 | "syslogd [OPTION]...\n" |
| 68 | "Linux system and kernel (provides klogd) logging utility.\n" | 68 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 69 | "\nLinux system and kernel (provides klogd) logging utility.\n" | ||
| 69 | "Note that this version of syslogd/klogd ignores /etc/syslog.conf.\n\n" | 70 | "Note that this version of syslogd/klogd ignores /etc/syslog.conf.\n\n" |
| 70 | "Options:\n" | 71 | "Options:\n" |
| 71 | "\t-m\tChange the mark timestamp interval. default=20min. 0=off\n" | 72 | "\t-m\tChange the mark timestamp interval. default=20min. 0=off\n" |
| @@ -73,7 +74,9 @@ static const char syslogd_usage[] = | |||
| 73 | #ifdef BB_KLOGD | 74 | #ifdef BB_KLOGD |
| 74 | "\t-K\tDo not start up the klogd process (by default syslogd spawns klogd).\n" | 75 | "\t-K\tDo not start up the klogd process (by default syslogd spawns klogd).\n" |
| 75 | #endif | 76 | #endif |
| 76 | "\t-O\tSpecify an alternate log file. default=/var/log/messages\n"; | 77 | "\t-O\tSpecify an alternate log file. default=/var/log/messages\n" |
| 78 | #endif | ||
| 79 | ; | ||
| 77 | 80 | ||
| 78 | /* Note: There is also a function called "message()" in init.c */ | 81 | /* Note: There is also a function called "message()" in init.c */ |
| 79 | /* Print a message to the log file. */ | 82 | /* Print a message to the log file. */ |
| @@ -64,8 +64,9 @@ static int MarkInterval = 20 * 60; | |||
| 64 | static char LocalHostName[32]; | 64 | static char LocalHostName[32]; |
| 65 | 65 | ||
| 66 | static const char syslogd_usage[] = | 66 | static const char syslogd_usage[] = |
| 67 | "syslogd [OPTION]...\n\n" | 67 | "syslogd [OPTION]...\n" |
| 68 | "Linux system and kernel (provides klogd) logging utility.\n" | 68 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 69 | "\nLinux system and kernel (provides klogd) logging utility.\n" | ||
| 69 | "Note that this version of syslogd/klogd ignores /etc/syslog.conf.\n\n" | 70 | "Note that this version of syslogd/klogd ignores /etc/syslog.conf.\n\n" |
| 70 | "Options:\n" | 71 | "Options:\n" |
| 71 | "\t-m\tChange the mark timestamp interval. default=20min. 0=off\n" | 72 | "\t-m\tChange the mark timestamp interval. default=20min. 0=off\n" |
| @@ -73,7 +74,9 @@ static const char syslogd_usage[] = | |||
| 73 | #ifdef BB_KLOGD | 74 | #ifdef BB_KLOGD |
| 74 | "\t-K\tDo not start up the klogd process (by default syslogd spawns klogd).\n" | 75 | "\t-K\tDo not start up the klogd process (by default syslogd spawns klogd).\n" |
| 75 | #endif | 76 | #endif |
| 76 | "\t-O\tSpecify an alternate log file. default=/var/log/messages\n"; | 77 | "\t-O\tSpecify an alternate log file. default=/var/log/messages\n" |
| 78 | #endif | ||
| 79 | ; | ||
| 77 | 80 | ||
| 78 | /* Note: There is also a function called "message()" in init.c */ | 81 | /* Note: There is also a function called "message()" in init.c */ |
| 79 | /* Print a message to the log file. */ | 82 | /* Print a message to the log file. */ |
| @@ -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 | { |
| @@ -60,8 +60,9 @@ static const char tar_usage[] = | |||
| 60 | #if defined BB_FEATURE_TAR_EXCLUDE | 60 | #if defined BB_FEATURE_TAR_EXCLUDE |
| 61 | "[--exclude File] " | 61 | "[--exclude File] " |
| 62 | #endif | 62 | #endif |
| 63 | "[-f tarFile] [FILE] ...\n\n" | 63 | "[-f tarFile] [FILE] ...\n" |
| 64 | "Create, extract, or list files from a tar file. Note that\n" | 64 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 65 | "\nCreate, extract, or list files from a tar file. Note that\n" | ||
| 65 | "this version of tar treats hard links as separate files.\n\n" | 66 | "this version of tar treats hard links as separate files.\n\n" |
| 66 | "Main operation mode:\n" | 67 | "Main operation mode:\n" |
| 67 | #ifdef BB_FEATURE_TAR_CREATE | 68 | #ifdef BB_FEATURE_TAR_CREATE |
| @@ -77,6 +78,7 @@ static const char tar_usage[] = | |||
| 77 | #endif | 78 | #endif |
| 78 | "\nInformative output:\n" | 79 | "\nInformative output:\n" |
| 79 | "\tv\t\tverbosely list files processed\n" | 80 | "\tv\t\tverbosely list files processed\n" |
| 81 | #endif | ||
| 80 | ; | 82 | ; |
| 81 | 83 | ||
| 82 | /* Tar file constants */ | 84 | /* Tar file constants */ |
| @@ -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 $ */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: telnet.c,v 1.2 2000/05/01 19:10:52 erik Exp $ | 2 | * $Id: telnet.c,v 1.3 2000/05/12 19:41:47 erik Exp $ |
| 3 | * Mini telnet implementation for busybox | 3 | * Mini telnet implementation for busybox |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2000 by Randolph Chung <tausq@debian.org> | 5 | * Copyright (C) 2000 by Randolph Chung <tausq@debian.org> |
| @@ -46,7 +46,12 @@ | |||
| 46 | 46 | ||
| 47 | static int STDIN = 0; | 47 | static int STDIN = 0; |
| 48 | static int STDOUT = 1; | 48 | static int STDOUT = 1; |
| 49 | static const char *telnet_usage = "telnet host [port]\n\n"; | 49 | static const char *telnet_usage = "telnet host [port]\n" |
| 50 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 51 | "\nProvides interactive communication with another\n" | ||
| 52 | "networked host using the TELNET protocol\n" | ||
| 53 | #endif | ||
| 54 | ; | ||
| 50 | static struct termios saved_tc; | 55 | static struct termios saved_tc; |
| 51 | static unsigned char options[NTELOPTS]; | 56 | static unsigned char options[NTELOPTS]; |
| 52 | static char tr_state = 0; /* telnet send and receive state */ | 57 | static char tr_state = 0; /* telnet send and receive state */ |
| @@ -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 */ |
| @@ -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 | ||
| @@ -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 | { |
| @@ -30,8 +30,10 @@ | |||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | static const char umount_usage[] = | 32 | static const char umount_usage[] = |
| 33 | "umount [flags] filesystem|directory\n\n" | 33 | "umount [flags] filesystem|directory\n" |
| 34 | "Flags:\n" "\t-a:\tUnmount all file systems" | 34 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 35 | "Unmount file systems\n" | ||
| 36 | "\nFlags:\n" "\t-a:\tUnmount all file systems" | ||
| 35 | #ifdef BB_MTAB | 37 | #ifdef BB_MTAB |
| 36 | " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n" | 38 | " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n" |
| 37 | #else | 39 | #else |
| @@ -44,6 +46,7 @@ static const char umount_usage[] = | |||
| 44 | #if defined BB_FEATURE_MOUNT_LOOP | 46 | #if defined BB_FEATURE_MOUNT_LOOP |
| 45 | "\t-l:\tDo not free loop device (if a loop device has been used)\n" | 47 | "\t-l:\tDo not free loop device (if a loop device has been used)\n" |
| 46 | #endif | 48 | #endif |
| 49 | #endif | ||
| 47 | ; | 50 | ; |
| 48 | 51 | ||
| 49 | struct _mtab_entry_t { | 52 | struct _mtab_entry_t { |
| @@ -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 $ */ |
| @@ -35,12 +35,15 @@ _syscall2(int, bdflush, int, func, int, data); | |||
| 35 | #endif /* __GLIBC__ */ | 35 | #endif /* __GLIBC__ */ |
| 36 | 36 | ||
| 37 | static char update_usage[] = | 37 | static char update_usage[] = |
| 38 | "update [options]\n\n" | 38 | "update [options]\n" |
| 39 | "Periodically flushes filesystem buffers.\n\n" | 39 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 40 | "\nPeriodically flushes filesystem buffers.\n\n" | ||
| 40 | "Options:\n" | 41 | "Options:\n" |
| 41 | "\t-S\tforce use of sync(2) instead of flushing\n" | 42 | "\t-S\tforce use of sync(2) instead of flushing\n" |
| 42 | "\t-s SECS\tcall sync this often (default 30)\n" | 43 | "\t-s SECS\tcall sync this often (default 30)\n" |
| 43 | "\t-f SECS\tflush some buffers this often (default 5)\n"; | 44 | "\t-f SECS\tflush some buffers this often (default 5)\n" |
| 45 | #endif | ||
| 46 | ; | ||
| 44 | 47 | ||
| 45 | static unsigned int sync_duration = 30; | 48 | static unsigned int sync_duration = 30; |
| 46 | static unsigned int flush_duration = 5; | 49 | static unsigned int flush_duration = 5; |
| @@ -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/util-linux/fbset.c b/util-linux/fbset.c index 4e5609e41..de4c82425 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c | |||
| @@ -105,9 +105,9 @@ struct cmdoptions_t { | |||
| 105 | "-vsync", 1, CMD_VSYNC}, { | 105 | "-vsync", 1, CMD_VSYNC}, { |
| 106 | "-laced", 1, CMD_LACED}, { | 106 | "-laced", 1, CMD_LACED}, { |
| 107 | "-double", 1, CMD_DOUBLE}, { | 107 | "-double", 1, CMD_DOUBLE}, { |
| 108 | "--help", 0, CMD_HELP}, { | 108 | "-help", 0, CMD_HELP}, { |
| 109 | #ifdef BB_FEATURE_FBSET_FANCY | 109 | #ifdef BB_FEATURE_FBSET_FANCY |
| 110 | "--help", 0, CMD_HELP}, { | 110 | "-help", 0, CMD_HELP}, { |
| 111 | "-all", 0, CMD_ALL}, { | 111 | "-all", 0, CMD_ALL}, { |
| 112 | "-xres", 1, CMD_XRES}, { | 112 | "-xres", 1, CMD_XRES}, { |
| 113 | "-yres", 1, CMD_YRES}, { | 113 | "-yres", 1, CMD_YRES}, { |
| @@ -115,7 +115,7 @@ struct cmdoptions_t { | |||
| 115 | "-vyres", 1, CMD_VYRES}, { | 115 | "-vyres", 1, CMD_VYRES}, { |
| 116 | "-depth", 1, CMD_DEPTH}, { | 116 | "-depth", 1, CMD_DEPTH}, { |
| 117 | "-match", 0, CMD_MATCH}, { | 117 | "-match", 0, CMD_MATCH}, { |
| 118 | "--geometry", 5, CMD_GEOMETRY}, { | 118 | "-geometry", 5, CMD_GEOMETRY}, { |
| 119 | "-pixclock", 1, CMD_PIXCLOCK}, { | 119 | "-pixclock", 1, CMD_PIXCLOCK}, { |
| 120 | "-left", 1, CMD_LEFT}, { | 120 | "-left", 1, CMD_LEFT}, { |
| 121 | "-right", 1, CMD_RIGHT}, { | 121 | "-right", 1, CMD_RIGHT}, { |
| @@ -123,7 +123,7 @@ struct cmdoptions_t { | |||
| 123 | "-lower", 1, CMD_LOWER}, { | 123 | "-lower", 1, CMD_LOWER}, { |
| 124 | "-hslen", 1, CMD_HSLEN}, { | 124 | "-hslen", 1, CMD_HSLEN}, { |
| 125 | "-vslen", 1, CMD_VSLEN}, { | 125 | "-vslen", 1, CMD_VSLEN}, { |
| 126 | "--timings", 7, CMD_TIMING}, { | 126 | "-timings", 7, CMD_TIMING}, { |
| 127 | "-csync", 1, CMD_CSYNC}, { | 127 | "-csync", 1, CMD_CSYNC}, { |
| 128 | "-gsync", 1, CMD_GSYNC}, { | 128 | "-gsync", 1, CMD_GSYNC}, { |
| 129 | "-extsync", 1, CMD_EXTSYNC}, { | 129 | "-extsync", 1, CMD_EXTSYNC}, { |
| @@ -221,17 +221,21 @@ static void showmode(struct fb_var_screeninfo *v) | |||
| 221 | 221 | ||
| 222 | static void fbset_usage(void) | 222 | static void fbset_usage(void) |
| 223 | { | 223 | { |
| 224 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 224 | int i; | 225 | int i; |
| 226 | #endif | ||
| 225 | 227 | ||
| 226 | #ifndef STANDALONE | 228 | #ifndef STANDALONE |
| 227 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", | 229 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
| 228 | BB_VER, BB_BT); | 230 | BB_VER, BB_BT); |
| 229 | #endif | 231 | #endif |
| 230 | fprintf(stderr, "Usage: fbset [options] [mode]\n\n"); | 232 | fprintf(stderr, "Usage: fbset [options] [mode]\n"); |
| 231 | fprintf(stderr, "Show and modify frame buffer device settings\n\n"); | 233 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 234 | fprintf(stderr, "\nShows and modifies frame buffer device settings\n\n"); | ||
| 232 | fprintf(stderr, "The following options are recognized:\n"); | 235 | fprintf(stderr, "The following options are recognized:\n"); |
| 233 | for (i = 0; g_cmdoptions[i].name; i++) | 236 | for (i = 0; g_cmdoptions[i].name; i++) |
| 234 | fprintf(stderr, "\t%s\n", g_cmdoptions[i].name); | 237 | fprintf(stderr, "\t%s\n", g_cmdoptions[i].name); |
| 238 | #endif | ||
| 235 | exit(-1); | 239 | exit(-1); |
| 236 | } | 240 | } |
| 237 | 241 | ||
diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c index 56ea2244d..4ec0a8886 100644 --- a/util-linux/fdflush.c +++ b/util-linux/fdflush.c | |||
| @@ -34,7 +34,11 @@ extern int fdflush_main(int argc, char **argv) | |||
| 34 | int fd; | 34 | int fd; |
| 35 | 35 | ||
| 36 | if (argc <= 1 || **(++argv) == '-') { | 36 | if (argc <= 1 || **(++argv) == '-') { |
| 37 | usage("fdflush device\n\nForce floppy disk drive to detect disk change\n"); | 37 | usage("fdflush DEVICE\n" |
| 38 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 39 | "\nForces floppy disk drive to detect disk change\n" | ||
| 40 | #endif | ||
| 41 | ); | ||
| 38 | } | 42 | } |
| 39 | 43 | ||
| 40 | fd = open(*argv, 0); | 44 | fd = open(*argv, 0); |
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index d373bcbf7..4106cf144 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c | |||
| @@ -34,8 +34,11 @@ | |||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | static const char freeramdisk_usage[] = | 36 | static const char freeramdisk_usage[] = |
| 37 | "freeramdisk DEVICE\n\n" | 37 | "freeramdisk DEVICE\n" |
| 38 | "Free all memory used by the specified ramdisk.\n"; | 38 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 39 | "\nFrees all memory used by the specified ramdisk.\n" | ||
| 40 | #endif | ||
| 41 | ; | ||
| 39 | 42 | ||
| 40 | extern int | 43 | extern int |
| 41 | freeramdisk_main(int argc, char **argv) | 44 | freeramdisk_main(int argc, char **argv) |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index c890dff7d..7d27566b8 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
| @@ -198,9 +198,10 @@ static void show_usage(void) | |||
| 198 | { | 198 | { |
| 199 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", | 199 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
| 200 | BB_VER, BB_BT); | 200 | BB_VER, BB_BT); |
| 201 | fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n\n", program_name); | 201 | fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n", program_name); |
| 202 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 202 | fprintf(stderr, | 203 | fprintf(stderr, |
| 203 | "Performs a consistency check for MINIX filesystems.\n\n"); | 204 | "\nPerforms a consistency check for MINIX filesystems.\n\n"); |
| 204 | fprintf(stderr, "OPTIONS:\n"); | 205 | fprintf(stderr, "OPTIONS:\n"); |
| 205 | fprintf(stderr, "\t-l\tLists all filenames\n"); | 206 | fprintf(stderr, "\t-l\tLists all filenames\n"); |
| 206 | fprintf(stderr, "\t-r\tPerform interactive repairs\n"); | 207 | fprintf(stderr, "\t-r\tPerform interactive repairs\n"); |
| @@ -210,6 +211,7 @@ static void show_usage(void) | |||
| 210 | fprintf(stderr, | 211 | fprintf(stderr, |
| 211 | "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n"); | 212 | "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n"); |
| 212 | fprintf(stderr, "\t-f\tForce file system check.\n\n"); | 213 | fprintf(stderr, "\t-f\tForce file system check.\n\n"); |
| 214 | #endif | ||
| 213 | leave(16); | 215 | leave(16); |
| 214 | } | 216 | } |
| 215 | 217 | ||
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index be180a46b..bf4bda9fd 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
| @@ -179,9 +179,10 @@ static volatile void show_usage() | |||
| 179 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", | 179 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
| 180 | BB_VER, BB_BT); | 180 | BB_VER, BB_BT); |
| 181 | fprintf(stderr, | 181 | fprintf(stderr, |
| 182 | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n\n", | 182 | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", |
| 183 | program_name); | 183 | program_name); |
| 184 | fprintf(stderr, "Make a MINIX filesystem.\n\n"); | 184 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 185 | fprintf(stderr, "\nMake a MINIX filesystem.\n\n"); | ||
| 185 | fprintf(stderr, "OPTIONS:\n"); | 186 | fprintf(stderr, "OPTIONS:\n"); |
| 186 | fprintf(stderr, "\t-c\t\tCheck the device for bad blocks\n"); | 187 | fprintf(stderr, "\t-c\t\tCheck the device for bad blocks\n"); |
| 187 | fprintf(stderr, | 188 | fprintf(stderr, |
| @@ -191,6 +192,7 @@ static volatile void show_usage() | |||
| 191 | fprintf(stderr, | 192 | fprintf(stderr, |
| 192 | "\t-l FILENAME\tRead the bad blocks list from FILENAME\n"); | 193 | "\t-l FILENAME\tRead the bad blocks list from FILENAME\n"); |
| 193 | fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n"); | 194 | fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n"); |
| 195 | #endif | ||
| 194 | exit(16); | 196 | exit(16); |
| 195 | } | 197 | } |
| 196 | 198 | ||
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 17866a735..7d76916f0 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c | |||
| @@ -49,13 +49,16 @@ | |||
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | static const char mkswap_usage[] = | 51 | static const char mkswap_usage[] = |
| 52 | "mkswap [-c] [-v0|-v1] device [block-count]\n\n" | 52 | "mkswap [-c] [-v0|-v1] device [block-count]\n" |
| 53 | "Prepare a disk partition to be used as a swap partition.\n\n" | 53 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 54 | "\nPrepare a disk partition to be used as a swap partition.\n\n" | ||
| 54 | "Options:\n" "\t-c\t\tCheck for read-ability.\n" | 55 | "Options:\n" "\t-c\t\tCheck for read-ability.\n" |
| 55 | "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" | 56 | "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" |
| 56 | "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" | 57 | "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" |
| 57 | 58 | ||
| 58 | "\tblock-count\tNumber of block to use (default is entire partition).\n"; | 59 | "\tblock-count\tNumber of block to use (default is entire partition).\n" |
| 60 | #endif | ||
| 61 | ; | ||
| 59 | 62 | ||
| 60 | 63 | ||
| 61 | #ifndef _IO | 64 | #ifndef _IO |
diff --git a/util-linux/more.c b/util-linux/more.c index 30d2757cd..50446861e 100644 --- a/util-linux/more.c +++ b/util-linux/more.c | |||
| @@ -30,8 +30,15 @@ | |||
| 30 | #include <fcntl.h> | 30 | #include <fcntl.h> |
| 31 | #include <signal.h> | 31 | #include <signal.h> |
| 32 | #include <sys/ioctl.h> | 32 | #include <sys/ioctl.h> |
| 33 | #define BB_DECLARE_EXTERN | ||
| 34 | #define bb_need_help | ||
| 35 | #include "messages.c" | ||
| 33 | 36 | ||
| 34 | static const char more_usage[] = "more [file ...]\n"; | 37 | static const char more_usage[] = "more [FILE ...]\n" |
| 38 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
| 39 | "\nMore is a filter for viewing FILE one screenful at a time.\n" | ||
| 40 | #endif | ||
| 41 | ; | ||
| 35 | 42 | ||
| 36 | /* ED: sparc termios is broken: revert back to old termio handling. */ | 43 | /* ED: sparc termios is broken: revert back to old termio handling. */ |
| 37 | #ifdef BB_FEATURE_USE_TERMIOS | 44 | #ifdef BB_FEATURE_USE_TERMIOS |
| @@ -92,7 +99,7 @@ extern int more_main(int argc, char **argv) | |||
| 92 | argv++; | 99 | argv++; |
| 93 | 100 | ||
| 94 | if (argc > 0 | 101 | if (argc > 0 |
| 95 | && (strcmp(*argv, "--help") == 0 || strcmp(*argv, "-h") == 0)) { | 102 | && (strcmp(*argv, dash_dash_help) == 0 || strcmp(*argv, "-h") == 0)) { |
| 96 | usage(more_usage); | 103 | usage(more_usage); |
| 97 | } | 104 | } |
| 98 | do { | 105 | do { |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 00a774a53..bde55d155 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
| @@ -64,10 +64,12 @@ static int use_loop = FALSE; | |||
| 64 | 64 | ||
| 65 | extern const char mtab_file[]; /* Defined in utility.c */ | 65 | extern const char mtab_file[]; /* Defined in utility.c */ |
| 66 | 66 | ||
| 67 | static const char mount_usage[] = "\tmount [flags]\n" | 67 | static const char mount_usage[] = |
| 68 | "\tmount [flags] device directory [-o options,more-options]\n" | 68 | "mount [flags] device directory [-o options,more-options]\n" |
| 69 | "\n" "Flags:\n" | 69 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 70 | "\t-a:\t\tMount all file systems in fstab.\n" | 70 | "\nMount a filesystem\n\n" |
| 71 | "Flags:\n" | ||
| 72 | "\t-a:\t\tMount all filesystems in fstab.\n" | ||
| 71 | #ifdef BB_MTAB | 73 | #ifdef BB_MTAB |
| 72 | "\t-f:\t\t\"Fake\" mount. Add entry to mount table but don't mount it.\n" | 74 | "\t-f:\t\t\"Fake\" mount. Add entry to mount table but don't mount it.\n" |
| 73 | "\t-n:\t\tDon't write a mount table entry.\n" | 75 | "\t-n:\t\tDon't write a mount table entry.\n" |
| @@ -88,8 +90,10 @@ static const char mount_usage[] = "\tmount [flags]\n" | |||
| 88 | "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" | 90 | "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them.\n" |
| 89 | "\tremount:\tRe-mount a currently-mounted filesystem, changing its flags.\n" | 91 | "\tremount:\tRe-mount a currently-mounted filesystem, changing its flags.\n" |
| 90 | "\tro/rw:\t\tMount for read-only / read-write.\n" | 92 | "\tro/rw:\t\tMount for read-only / read-write.\n" |
| 91 | "There are EVEN MORE flags that are specific to each filesystem.\n" | 93 | "\nThere are EVEN MORE flags that are specific to each filesystem.\n" |
| 92 | "You'll have to see the written documentation for those.\n"; | 94 | "You'll have to see the written documentation for those.\n" |
| 95 | #endif | ||
| 96 | ; | ||
| 93 | 97 | ||
| 94 | 98 | ||
| 95 | struct mount_options { | 99 | struct mount_options { |
| @@ -451,7 +455,7 @@ extern int mount_main(int argc, char **argv) | |||
| 451 | fatalError( "\nCannot read /etc/fstab: %s\n", strerror (errno)); | 455 | fatalError( "\nCannot read /etc/fstab: %s\n", strerror (errno)); |
| 452 | 456 | ||
| 453 | while ((m = getmntent(f)) != NULL) { | 457 | while ((m = getmntent(f)) != NULL) { |
| 454 | // If the file system isn't noauto, | 458 | // If the filesystem isn't noauto, |
| 455 | // and isn't swap or nfs, then mount it | 459 | // and isn't swap or nfs, then mount it |
| 456 | if ((!strstr(m->mnt_opts, "noauto")) && | 460 | if ((!strstr(m->mnt_opts, "noauto")) && |
| 457 | (!strstr(m->mnt_type, "swap")) && | 461 | (!strstr(m->mnt_type, "swap")) && |
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index aa961dac9..0f8c4f5f3 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c | |||
| @@ -36,16 +36,22 @@ static int whichApp; | |||
| 36 | static const char *appName; | 36 | static const char *appName; |
| 37 | 37 | ||
| 38 | static const char swapoff_usage[] = | 38 | static const char swapoff_usage[] = |
| 39 | "swapoff [OPTION] [device]\n\n" | 39 | "swapoff [OPTION] [device]\n" |
| 40 | "Stop swapping virtual memory pages on the given device.\n\n" | 40 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 41 | "\nStop swapping virtual memory pages on the given device.\n\n" | ||
| 41 | "Options:\n" | 42 | "Options:\n" |
| 42 | "\t-a\tStop swapping on all swap devices\n"; | 43 | "\t-a\tStop swapping on all swap devices\n" |
| 44 | #endif | ||
| 45 | ; | ||
| 43 | 46 | ||
| 44 | static const char swapon_usage[] = | 47 | static const char swapon_usage[] = |
| 45 | "swapon [OPTION] [device]\n\n" | 48 | "swapon [OPTION] [device]\n" |
| 46 | "Start swapping virtual memory pages on the given device.\n\n" | 49 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 50 | "\nStart swapping virtual memory pages on the given device.\n\n" | ||
| 47 | "Options:\n" | 51 | "Options:\n" |
| 48 | "\t-a\tStart swapping on all swap devices\n"; | 52 | "\t-a\tStart swapping on all swap devices\n" |
| 53 | #endif | ||
| 54 | ; | ||
| 49 | 55 | ||
| 50 | 56 | ||
| 51 | #define SWAPON_APP 1 | 57 | #define SWAPON_APP 1 |
diff --git a/util-linux/umount.c b/util-linux/umount.c index 18a5afe80..86833b717 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
| @@ -30,8 +30,10 @@ | |||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | static const char umount_usage[] = | 32 | static const char umount_usage[] = |
| 33 | "umount [flags] filesystem|directory\n\n" | 33 | "umount [flags] filesystem|directory\n" |
| 34 | "Flags:\n" "\t-a:\tUnmount all file systems" | 34 | #ifndef BB_FEATURE_TRIVIAL_HELP |
| 35 | "Unmount file systems\n" | ||
| 36 | "\nFlags:\n" "\t-a:\tUnmount all file systems" | ||
| 35 | #ifdef BB_MTAB | 37 | #ifdef BB_MTAB |
| 36 | " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n" | 38 | " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n" |
| 37 | #else | 39 | #else |
| @@ -44,6 +46,7 @@ static const char umount_usage[] = | |||
| 44 | #if defined BB_FEATURE_MOUNT_LOOP | 46 | #if defined BB_FEATURE_MOUNT_LOOP |
| 45 | "\t-l:\tDo not free loop device (if a loop device has been used)\n" | 47 | "\t-l:\tDo not free loop device (if a loop device has been used)\n" |
| 46 | #endif | 48 | #endif |
| 49 | #endif | ||
| 47 | ; | 50 | ; |
| 48 | 51 | ||
| 49 | struct _mtab_entry_t { | 52 | struct _mtab_entry_t { |
| @@ -33,6 +33,7 @@ | |||
| 33 | || defined (BB_INSMOD) | 33 | || defined (BB_INSMOD) |
| 34 | /* same conditions as recursiveAction */ | 34 | /* same conditions as recursiveAction */ |
| 35 | #define bb_need_name_too_long | 35 | #define bb_need_name_too_long |
| 36 | #define bb_need_memory_exhausted | ||
| 36 | #endif | 37 | #endif |
| 37 | #define BB_DECLARE_EXTERN | 38 | #define BB_DECLARE_EXTERN |
| 38 | #include "messages.c" | 39 | #include "messages.c" |
| @@ -111,7 +112,6 @@ extern void fatalError(const char *s, ...) | |||
| 111 | exit( FALSE); | 112 | exit( FALSE); |
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | #if defined BB_INIT | ||
| 115 | /* Returns kernel version encoded as major*65536 + minor*256 + patch, | 115 | /* Returns kernel version encoded as major*65536 + minor*256 + patch, |
| 116 | * so, for example, to check if the kernel is greater than 2.2.11: | 116 | * so, for example, to check if the kernel is greater than 2.2.11: |
| 117 | * if (get_kernel_revision() <= 2*65536+2*256+11) { <stuff> } | 117 | * if (get_kernel_revision() <= 2*65536+2*256+11) { <stuff> } |
| @@ -128,9 +128,7 @@ extern int get_kernel_revision(void) | |||
| 128 | sscanf(name.version, "%d.%d.%d", &major, &minor, &patch); | 128 | sscanf(name.version, "%d.%d.%d", &major, &minor, &patch); |
| 129 | return major * 65536 + minor * 256 + patch; | 129 | return major * 65536 + minor * 256 + patch; |
| 130 | } | 130 | } |
| 131 | #endif /* BB_INIT */ | ||
| 132 | 131 | ||
| 133 | #if defined (BB_CP_MV) || defined (BB_DU) | ||
| 134 | 132 | ||
| 135 | #define HASH_SIZE 311 /* Should be prime */ | 133 | #define HASH_SIZE 311 /* Should be prime */ |
| 136 | #define hash_inode(i) ((i) % HASH_SIZE) | 134 | #define hash_inode(i) ((i) % HASH_SIZE) |
| @@ -197,9 +195,7 @@ void reset_ino_dev_hashtable(void) | |||
| 197 | } | 195 | } |
| 198 | } | 196 | } |
| 199 | 197 | ||
| 200 | #endif /* BB_CP_MV || BB_DU */ | ||
| 201 | 198 | ||
| 202 | #if defined (BB_CP_MV) || defined (BB_DU) || defined (BB_LN) | ||
| 203 | /* | 199 | /* |
| 204 | * Return TRUE if a fileName is a directory. | 200 | * Return TRUE if a fileName is a directory. |
| 205 | * Nonexistant files return FALSE. | 201 | * Nonexistant files return FALSE. |
| @@ -230,9 +226,7 @@ int isDirectory(const char *fileName, const int followLinks, struct stat *statBu | |||
| 230 | } | 226 | } |
| 231 | return status; | 227 | return status; |
| 232 | } | 228 | } |
| 233 | #endif | ||
| 234 | 229 | ||
| 235 | #if defined (BB_CP_MV) | ||
| 236 | /* | 230 | /* |
| 237 | * Copy one file to another, while possibly preserving its modes, times, and | 231 | * Copy one file to another, while possibly preserving its modes, times, and |
| 238 | * modes. Returns TRUE if successful, or FALSE on a failure with an error | 232 | * modes. Returns TRUE if successful, or FALSE on a failure with an error |
| @@ -382,11 +376,8 @@ copyFile(const char *srcName, const char *destName, | |||
| 382 | 376 | ||
| 383 | return FALSE; | 377 | return FALSE; |
| 384 | } | 378 | } |
| 385 | #endif /* BB_CP_MV */ | ||
| 386 | |||
| 387 | 379 | ||
| 388 | 380 | ||
| 389 | #if defined BB_TAR || defined BB_LS | ||
| 390 | 381 | ||
| 391 | #define TYPEINDEX(mode) (((mode) >> 12) & 0x0f) | 382 | #define TYPEINDEX(mode) (((mode) >> 12) & 0x0f) |
| 392 | #define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)]) | 383 | #define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)]) |
| @@ -429,10 +420,8 @@ const char *modeString(int mode) | |||
| 429 | } | 420 | } |
| 430 | return buf; | 421 | return buf; |
| 431 | } | 422 | } |
| 432 | #endif /* BB_TAR || BB_LS */ | ||
| 433 | 423 | ||
| 434 | 424 | ||
| 435 | #if defined BB_TAR | ||
| 436 | /* | 425 | /* |
| 437 | * Return the standard ls-like time string from a time_t | 426 | * Return the standard ls-like time string from a time_t |
| 438 | * This is static and so is overwritten on each call. | 427 | * This is static and so is overwritten on each call. |
| @@ -457,9 +446,7 @@ const char *timeString(time_t timeVal) | |||
| 457 | 446 | ||
| 458 | return buf; | 447 | return buf; |
| 459 | } | 448 | } |
| 460 | #endif /* BB_TAR */ | ||
| 461 | 449 | ||
| 462 | #if defined BB_TAR || defined BB_CP_MV | ||
| 463 | /* | 450 | /* |
| 464 | * Write all of the supplied buffer out to a file. | 451 | * Write all of the supplied buffer out to a file. |
| 465 | * This does multiple writes as necessary. | 452 | * This does multiple writes as necessary. |
| @@ -485,10 +472,8 @@ int fullWrite(int fd, const char *buf, int len) | |||
| 485 | 472 | ||
| 486 | return total; | 473 | return total; |
| 487 | } | 474 | } |
| 488 | #endif /* BB_TAR || BB_CP_MV */ | ||
| 489 | 475 | ||
| 490 | 476 | ||
| 491 | #if defined BB_TAR || defined BB_TAIL | ||
| 492 | /* | 477 | /* |
| 493 | * Read all of the supplied buffer from a file. | 478 | * Read all of the supplied buffer from a file. |
| 494 | * This does multiple reads as necessary. | 479 | * This does multiple reads as necessary. |
| @@ -518,16 +503,8 @@ int fullRead(int fd, char *buf, int len) | |||
| 518 | 503 | ||
| 519 | return total; | 504 | return total; |
| 520 | } | 505 | } |
| 521 | #endif /* BB_TAR || BB_TAIL */ | ||
| 522 | 506 | ||
| 523 | 507 | ||
| 524 | #if defined (BB_CHMOD_CHOWN_CHGRP) \ | ||
| 525 | || defined (BB_CP_MV) \ | ||
| 526 | || defined (BB_FIND) \ | ||
| 527 | || defined (BB_INSMOD) \ | ||
| 528 | || defined (BB_RM) \ | ||
| 529 | || defined (BB_TAR) | ||
| 530 | |||
| 531 | /* | 508 | /* |
| 532 | * Walk down all the directories under the specified | 509 | * Walk down all the directories under the specified |
| 533 | * location, and do something (something specified | 510 | * location, and do something (something specified |
| @@ -640,11 +617,9 @@ int recursiveAction(const char *fileName, | |||
| 640 | return TRUE; | 617 | return TRUE; |
| 641 | } | 618 | } |
| 642 | 619 | ||
| 643 | #endif /* BB_CHMOD_CHOWN_CHGRP || BB_CP_MV || BB_FIND || BB_LS || BB_INSMOD */ | ||
| 644 | 620 | ||
| 645 | 621 | ||
| 646 | 622 | ||
| 647 | #if defined (BB_TAR) || defined (BB_MKDIR) | ||
| 648 | /* | 623 | /* |
| 649 | * Attempt to create the directories along the specified path, except for | 624 | * Attempt to create the directories along the specified path, except for |
| 650 | * the final component. The mode is given for the final directory only, | 625 | * the final component. The mode is given for the final directory only, |
| @@ -674,15 +649,10 @@ extern int createPath(const char *name, int mode) | |||
| 674 | } | 649 | } |
| 675 | return TRUE; | 650 | return TRUE; |
| 676 | } | 651 | } |
| 677 | #endif /* BB_TAR || BB_MKDIR */ | ||
| 678 | 652 | ||
| 679 | 653 | ||
| 680 | 654 | ||
| 681 | #if defined (BB_CHMOD_CHOWN_CHGRP) || defined (BB_MKDIR) | ||
| 682 | /* [ugoa]{+|-|=}[rwxst] */ | 655 | /* [ugoa]{+|-|=}[rwxst] */ |
| 683 | |||
| 684 | |||
| 685 | |||
| 686 | extern int parse_mode(const char *s, mode_t * theMode) | 656 | extern int parse_mode(const char *s, mode_t * theMode) |
| 687 | { | 657 | { |
| 688 | mode_t andMode = | 658 | mode_t andMode = |
| @@ -775,14 +745,9 @@ extern int parse_mode(const char *s, mode_t * theMode) | |||
| 775 | } | 745 | } |
| 776 | 746 | ||
| 777 | 747 | ||
| 778 | #endif /* BB_CHMOD_CHOWN_CHGRP || BB_MKDIR */ | ||
| 779 | |||
| 780 | |||
| 781 | 748 | ||
| 782 | 749 | ||
| 783 | 750 | ||
| 784 | #if defined BB_CHMOD_CHOWN_CHGRP || defined BB_PS || defined BB_LS || defined BB_TAR || defined BB_ID | ||
| 785 | |||
| 786 | /* This parses entries in /etc/passwd and /etc/group. This is desirable | 751 | /* This parses entries in /etc/passwd and /etc/group. This is desirable |
| 787 | * for BusyBox, since we want to avoid using the glibc NSS stuff, which | 752 | * for BusyBox, since we want to avoid using the glibc NSS stuff, which |
| 788 | * increases target size and is often not needed or wanted for embedded | 753 | * increases target size and is often not needed or wanted for embedded |
| @@ -887,10 +852,6 @@ gid_t my_getpwnamegid(char *name) | |||
| 887 | return gid; | 852 | return gid; |
| 888 | } | 853 | } |
| 889 | 854 | ||
| 890 | #endif /* BB_CHMOD_CHOWN_CHGRP || BB_PS || BB_LS || BB_TAR || BB_ID */ | ||
| 891 | |||
| 892 | |||
| 893 | #if (defined BB_CHVT) || (defined BB_DEALLOCVT) | ||
| 894 | 855 | ||
| 895 | 856 | ||
| 896 | #include <linux/kd.h> | 857 | #include <linux/kd.h> |
| @@ -975,11 +936,9 @@ int get_console_fd(char *tty_name) | |||
| 975 | } | 936 | } |
| 976 | 937 | ||
| 977 | 938 | ||
| 978 | #endif /* BB_CHVT || BB_DEALLOCVT */ | ||
| 979 | 939 | ||
| 980 | 940 | ||
| 981 | #if !defined BB_REGEXP && (defined BB_GREP || defined BB_SED) | 941 | #if !defined BB_REGEXP |
| 982 | |||
| 983 | /* Do a case insensitive strstr() */ | 942 | /* Do a case insensitive strstr() */ |
| 984 | char *stristr(char *haystack, const char *needle) | 943 | char *stristr(char *haystack, const char *needle) |
| 985 | { | 944 | { |
| @@ -1050,11 +1009,9 @@ extern int replace_match(char *haystack, char *needle, char *newNeedle, | |||
| 1050 | else | 1009 | else |
| 1051 | return FALSE; | 1010 | return FALSE; |
| 1052 | } | 1011 | } |
| 1053 | 1012 | #endif /* ! BB_REGEXP */ | |
| 1054 | #endif /* ! BB_REGEXP && (BB_GREP || BB_SED) */ | ||
| 1055 | 1013 | ||
| 1056 | 1014 | ||
| 1057 | #if defined BB_FIND | ||
| 1058 | /* | 1015 | /* |
| 1059 | * Routine to see if a text string is matched by a wildcard pattern. | 1016 | * Routine to see if a text string is matched by a wildcard pattern. |
| 1060 | * Returns TRUE if the text is matched, or FALSE if it is not matched | 1017 | * Returns TRUE if the text is matched, or FALSE if it is not matched |
| @@ -1154,12 +1111,10 @@ extern int check_wildcard_match(const char *text, const char *pattern) | |||
| 1154 | 1111 | ||
| 1155 | return TRUE; | 1112 | return TRUE; |
| 1156 | } | 1113 | } |
| 1157 | #endif /* BB_FIND */ | ||
| 1158 | 1114 | ||
| 1159 | 1115 | ||
| 1160 | 1116 | ||
| 1161 | 1117 | ||
| 1162 | #if defined BB_DF || defined BB_MTAB | ||
| 1163 | /* | 1118 | /* |
| 1164 | * Given a block device, find the mount table entry if that block device | 1119 | * Given a block device, find the mount table entry if that block device |
| 1165 | * is mounted. | 1120 | * is mounted. |
| @@ -1198,11 +1153,9 @@ extern struct mntent *findMountPoint(const char *name, const char *table) | |||
| 1198 | endmntent(mountTable); | 1153 | endmntent(mountTable); |
| 1199 | return mountEntry; | 1154 | return mountEntry; |
| 1200 | } | 1155 | } |
| 1201 | #endif /* BB_DF || BB_MTAB */ | ||
| 1202 | 1156 | ||
| 1203 | 1157 | ||
| 1204 | 1158 | ||
| 1205 | #if defined BB_DD || defined BB_TAIL | ||
| 1206 | /* | 1159 | /* |
| 1207 | * Read a number with a possible multiplier. | 1160 | * Read a number with a possible multiplier. |
| 1208 | * Returns -1 if the number format is illegal. | 1161 | * Returns -1 if the number format is illegal. |
| @@ -1249,10 +1202,8 @@ extern long getNum(const char *cp) | |||
| 1249 | 1202 | ||
| 1250 | return value; | 1203 | return value; |
| 1251 | } | 1204 | } |
| 1252 | #endif /* BB_DD || BB_TAIL */ | ||
| 1253 | 1205 | ||
| 1254 | 1206 | ||
| 1255 | #if defined BB_INIT || defined BB_SYSLOGD | ||
| 1256 | /* try to open up the specified device */ | 1207 | /* try to open up the specified device */ |
| 1257 | extern int device_open(char *device, int mode) | 1208 | extern int device_open(char *device, int mode) |
| 1258 | { | 1209 | { |
| @@ -1271,15 +1222,11 @@ extern int device_open(char *device, int mode) | |||
| 1271 | fcntl(fd, F_SETFL, mode); | 1222 | fcntl(fd, F_SETFL, mode); |
| 1272 | return fd; | 1223 | return fd; |
| 1273 | } | 1224 | } |
| 1274 | #endif /* BB_INIT BB_SYSLOGD */ | ||
| 1275 | 1225 | ||
| 1276 | 1226 | ||
| 1277 | #if defined BB_KILLALL || ( defined BB_FEATURE_LINUXRC && ( defined BB_HALT || defined BB_REBOOT || defined BB_POWEROFF )) | ||
| 1278 | #ifdef BB_FEATURE_USE_DEVPS_PATCH | 1227 | #ifdef BB_FEATURE_USE_DEVPS_PATCH |
| 1279 | #include <linux/devps.h> | 1228 | #include <linux/devps.h> |
| 1280 | #endif | ||
| 1281 | 1229 | ||
| 1282 | #if defined BB_FEATURE_USE_DEVPS_PATCH | ||
| 1283 | /* findPidByName() | 1230 | /* findPidByName() |
| 1284 | * | 1231 | * |
| 1285 | * This finds the pid of the specified process, | 1232 | * This finds the pid of the specified process, |
| @@ -1336,7 +1283,7 @@ extern pid_t* findPidByName( char* pidName) | |||
| 1336 | && (strlen(pidName) == strlen(info.command_line))) { | 1283 | && (strlen(pidName) == strlen(info.command_line))) { |
| 1337 | pidList=realloc( pidList, sizeof(pid_t) * (j+2)); | 1284 | pidList=realloc( pidList, sizeof(pid_t) * (j+2)); |
| 1338 | if (pidList==NULL) | 1285 | if (pidList==NULL) |
| 1339 | fatalError("out of memory\n"); | 1286 | fatalError(memory_exhausted, ""); |
| 1340 | pidList[j++]=info.pid; | 1287 | pidList[j++]=info.pid; |
| 1341 | } | 1288 | } |
| 1342 | } | 1289 | } |
| @@ -1409,7 +1356,7 @@ extern pid_t* findPidByName( char* pidName) | |||
| 1409 | && (strlen(pidName) == strlen(p))) { | 1356 | && (strlen(pidName) == strlen(p))) { |
| 1410 | pidList=realloc( pidList, sizeof(pid_t) * (i+2)); | 1357 | pidList=realloc( pidList, sizeof(pid_t) * (i+2)); |
| 1411 | if (pidList==NULL) | 1358 | if (pidList==NULL) |
| 1412 | fatalError("out of memory\n"); | 1359 | fatalError(memory_exhausted, ""); |
| 1413 | pidList[i++]=strtol(next->d_name, NULL, 0); | 1360 | pidList[i++]=strtol(next->d_name, NULL, 0); |
| 1414 | } | 1361 | } |
| 1415 | } | 1362 | } |
| @@ -1418,7 +1365,6 @@ extern pid_t* findPidByName( char* pidName) | |||
| 1418 | return pidList; | 1365 | return pidList; |
| 1419 | } | 1366 | } |
| 1420 | #endif /* BB_FEATURE_USE_DEVPS_PATCH */ | 1367 | #endif /* BB_FEATURE_USE_DEVPS_PATCH */ |
| 1421 | #endif /* BB_KILLALL || ( BB_FEATURE_LINUXRC && ( BB_HALT || BB_REBOOT || BB_POWEROFF )) */ | ||
| 1422 | 1368 | ||
| 1423 | /* this should really be farmed out to libbusybox.a */ | 1369 | /* this should really be farmed out to libbusybox.a */ |
| 1424 | extern void *xmalloc(size_t size) | 1370 | extern void *xmalloc(size_t size) |
| @@ -1426,11 +1372,11 @@ extern void *xmalloc(size_t size) | |||
| 1426 | void *cp = malloc(size); | 1372 | void *cp = malloc(size); |
| 1427 | 1373 | ||
| 1428 | if (cp == NULL) | 1374 | if (cp == NULL) |
| 1429 | fatalError("out of memory\n"); | 1375 | fatalError(memory_exhausted, ""); |
| 1430 | return cp; | 1376 | return cp; |
| 1431 | } | 1377 | } |
| 1432 | 1378 | ||
| 1433 | #if (__GLIBC__ < 2) && (defined BB_SYSLOGD || defined BB_INIT) | 1379 | #if (__GLIBC__ < 2) |
| 1434 | extern int vdprintf(int d, const char *format, va_list ap) | 1380 | extern int vdprintf(int d, const char *format, va_list ap) |
| 1435 | { | 1381 | { |
| 1436 | char buf[BUF_SIZE]; | 1382 | char buf[BUF_SIZE]; |
| @@ -1439,9 +1385,8 @@ extern int vdprintf(int d, const char *format, va_list ap) | |||
| 1439 | len = vsprintf(buf, format, ap); | 1385 | len = vsprintf(buf, format, ap); |
| 1440 | return write(d, buf, len); | 1386 | return write(d, buf, len); |
| 1441 | } | 1387 | } |
| 1442 | #endif /* BB_SYSLOGD */ | 1388 | #endif |
| 1443 | 1389 | ||
| 1444 | #if defined BB_FEATURE_MOUNT_LOOP | ||
| 1445 | extern int del_loop(const char *device) | 1390 | extern int del_loop(const char *device) |
| 1446 | { | 1391 | { |
| 1447 | int fd; | 1392 | int fd; |
| @@ -1525,9 +1470,7 @@ extern char *find_unused_loop_device(void) | |||
| 1525 | } | 1470 | } |
| 1526 | return NULL; | 1471 | return NULL; |
| 1527 | } | 1472 | } |
| 1528 | #endif /* BB_FEATURE_MOUNT_LOOP */ | ||
| 1529 | 1473 | ||
| 1530 | #if defined BB_MOUNT || defined BB_DF || ( defined BB_UMOUNT && ! defined BB_MTAB) | ||
| 1531 | extern int find_real_root_device_name(char* name) | 1474 | extern int find_real_root_device_name(char* name) |
| 1532 | { | 1475 | { |
| 1533 | DIR *dir; | 1476 | DIR *dir; |
| @@ -1569,7 +1512,6 @@ extern int find_real_root_device_name(char* name) | |||
| 1569 | 1512 | ||
| 1570 | return( FALSE); | 1513 | return( FALSE); |
| 1571 | } | 1514 | } |
| 1572 | #endif | ||
| 1573 | 1515 | ||
| 1574 | const unsigned int CSTRING_BUFFER_LENGTH = 128; | 1516 | const unsigned int CSTRING_BUFFER_LENGTH = 128; |
| 1575 | /* recursive parser that returns cstrings of arbitrary length | 1517 | /* recursive parser that returns cstrings of arbitrary length |
| @@ -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; |
| @@ -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 | { |
| @@ -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) { |
