diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-11-10 23:13:02 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-11-10 23:13:02 +0000 |
commit | d73dc5b07390fb90e7f605871c993a28eedf1d46 (patch) | |
tree | 3e448e6550da52d2709e5f52fbae56e9df9462cc | |
parent | 84d85680712573c7a8bd7d0491c3f944dc08ad10 (diff) | |
download | busybox-w32-d73dc5b07390fb90e7f605871c993a28eedf1d46.tar.gz busybox-w32-d73dc5b07390fb90e7f605871c993a28eedf1d46.tar.bz2 busybox-w32-d73dc5b07390fb90e7f605871c993a28eedf1d46.zip |
Updates to usage, and made tar work.
-Erik
-rw-r--r-- | Changelog | 9 | ||||
-rw-r--r-- | applets/busybox.c | 8 | ||||
-rw-r--r-- | archival/tar.c | 51 | ||||
-rw-r--r-- | busybox.c | 8 | ||||
-rw-r--r-- | busybox.def.h | 25 | ||||
-rw-r--r-- | chmod_chown_chgrp.c | 24 | ||||
-rw-r--r-- | chroot.c | 2 | ||||
-rw-r--r-- | chvt.c | 2 | ||||
-rw-r--r-- | console-tools/chvt.c | 2 | ||||
-rw-r--r-- | console-tools/deallocvt.c | 6 | ||||
-rw-r--r-- | coreutils/chroot.c | 2 | ||||
-rw-r--r-- | coreutils/cp.c | 2 | ||||
-rw-r--r-- | coreutils/date.c | 2 | ||||
-rw-r--r-- | coreutils/dd.c | 5 | ||||
-rw-r--r-- | coreutils/ln.c | 6 | ||||
-rw-r--r-- | coreutils/mkdir.c | 7 | ||||
-rw-r--r-- | coreutils/mknod.c | 6 | ||||
-rw-r--r-- | coreutils/mv.c | 2 | ||||
-rw-r--r-- | coreutils/rm.c | 3 | ||||
-rw-r--r-- | coreutils/rmdir.c | 2 | ||||
-rw-r--r-- | coreutils/sleep.c | 4 | ||||
-rw-r--r-- | coreutils/sync.c | 2 | ||||
-rw-r--r-- | coreutils/touch.c | 4 | ||||
-rw-r--r-- | coreutils/uname.c | 5 | ||||
-rw-r--r-- | cp.c | 2 | ||||
-rw-r--r-- | date.c | 2 | ||||
-rw-r--r-- | dd.c | 5 | ||||
-rw-r--r-- | deallocvt.c | 6 | ||||
-rw-r--r-- | editors/sed.c | 14 | ||||
-rw-r--r-- | find.c | 15 | ||||
-rw-r--r-- | findutils/find.c | 15 | ||||
-rw-r--r-- | findutils/grep.c | 7 | ||||
-rw-r--r-- | fsck_minix.c | 14 | ||||
-rw-r--r-- | grep.c | 7 | ||||
-rw-r--r-- | init.c | 7 | ||||
-rw-r--r-- | init/init.c | 7 | ||||
-rw-r--r-- | internal.h | 2 | ||||
-rw-r--r-- | ln.c | 6 | ||||
-rw-r--r-- | mkdir.c | 7 | ||||
-rw-r--r-- | mkfs_minix.c | 13 | ||||
-rw-r--r-- | mknod.c | 6 | ||||
-rw-r--r-- | mkswap.c | 9 | ||||
-rw-r--r-- | more.c | 2 | ||||
-rw-r--r-- | mount.c | 21 | ||||
-rw-r--r-- | mv.c | 2 | ||||
-rw-r--r-- | procps/ps.c | 2 | ||||
-rw-r--r-- | ps.c | 2 | ||||
-rw-r--r-- | rm.c | 3 | ||||
-rw-r--r-- | rmdir.c | 2 | ||||
-rw-r--r-- | sed.c | 14 | ||||
-rw-r--r-- | sleep.c | 4 | ||||
-rw-r--r-- | sync.c | 2 | ||||
-rw-r--r-- | tar.c | 51 | ||||
-rw-r--r-- | touch.c | 4 | ||||
-rw-r--r-- | umount.c | 6 | ||||
-rw-r--r-- | uname.c | 5 | ||||
-rw-r--r-- | util-linux/fsck_minix.c | 14 | ||||
-rw-r--r-- | util-linux/mkfs_minix.c | 13 | ||||
-rw-r--r-- | util-linux/mkswap.c | 9 | ||||
-rw-r--r-- | util-linux/more.c | 2 | ||||
-rw-r--r-- | util-linux/mount.c | 21 | ||||
-rw-r--r-- | util-linux/umount.c | 6 | ||||
-rw-r--r-- | utility.c | 2 |
63 files changed, 290 insertions, 230 deletions
@@ -1,3 +1,12 @@ | |||
1 | 0.35 | ||
2 | * Fixed tar so it now works as expected (it had TRUE/FALSE backwards) | ||
3 | * tar now accepts --help | ||
4 | * chmod, chown, and chgrp usage now works | ||
5 | * General usage cleanups in most apps | ||
6 | * umount now parses options correctly | ||
7 | |||
8 | -Erik Andersen | ||
9 | |||
1 | 0.34 | 10 | 0.34 |
2 | * ls -l now displays link names outside the current directory, | 11 | * ls -l now displays link names outside the current directory, |
3 | Patch thanks to Eric Delaunay | 12 | Patch thanks to Eric Delaunay |
diff --git a/applets/busybox.c b/applets/busybox.c index 29a112b12..c45d0c7e2 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
@@ -220,12 +220,12 @@ int busybox_main(int argc, char **argv) | |||
220 | 220 | ||
221 | if (been_there_done_that == 1 || argc < 1) { | 221 | if (been_there_done_that == 1 || argc < 1) { |
222 | const struct Applet *a = applets; | 222 | const struct Applet *a = applets; |
223 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n", | 223 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
224 | BB_VER, BB_BT); | 224 | BB_VER, BB_BT); |
225 | fprintf(stderr, "\nUsage:\t[function] [arguments]...\n"); | 225 | fprintf(stderr, "Usage: busybox [function] [arguments]...\n"); |
226 | fprintf(stderr, "\tbusybox [function] [arguments]...\n"); | 226 | fprintf(stderr, " or: [function] [arguments]...\n\n"); |
227 | fprintf(stderr, | 227 | fprintf(stderr, |
228 | "\n\tMost people will create a symlink to busybox for each\n" | 228 | "\tMost people will create a symlink to busybox for each\n" |
229 | "\tfunction name, and busybox will act like whatever you invoke it as.\n"); | 229 | "\tfunction name, and busybox will act like whatever you invoke it as.\n"); |
230 | fprintf(stderr, "\nCurrently defined functions:\n"); | 230 | fprintf(stderr, "\nCurrently defined functions:\n"); |
231 | 231 | ||
diff --git a/archival/tar.c b/archival/tar.c index c23805993..ed6f3b6b5 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -35,22 +35,13 @@ | |||
35 | #include <signal.h> | 35 | #include <signal.h> |
36 | #include <time.h> | 36 | #include <time.h> |
37 | 37 | ||
38 | /* Note that tar.c expects TRUE and FALSE to be defined | ||
39 | * exactly the opposite of how they are used everywhere else. | ||
40 | * Some time this should be integrated a bit better, but this | ||
41 | * does the job for now. | ||
42 | */ | ||
43 | //#undef FALSE | ||
44 | //#undef TRUE | ||
45 | //#define FALSE ((int) 0) | ||
46 | //#define TRUE ((int) 1) | ||
47 | |||
48 | 38 | ||
49 | static const char tar_usage[] = | 39 | static const char tar_usage[] = |
50 | "tar -[cxtvOf] [tarFileName] [FILE] ...\n" | 40 | "tar -[cxtvOf] [tarFileName] [FILE] ...\n\n" |
51 | "Create, extract, or list files from a tar file\n\n" | 41 | "Create, extract, or list files from a tar file\n\n" |
52 | "\tc=create, x=extract, t=list contents, v=verbose,\n" | 42 | "Options:\n" |
53 | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; | 43 | "\tc=create, x=extract, t=list contents, v=verbose,\n" |
44 | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; | ||
54 | 45 | ||
55 | 46 | ||
56 | 47 | ||
@@ -96,18 +87,18 @@ typedef struct { | |||
96 | /* | 87 | /* |
97 | * Static data. | 88 | * Static data. |
98 | */ | 89 | */ |
99 | static int listFlag; // | 90 | static int listFlag; |
100 | static int extractFlag; // | 91 | static int extractFlag; |
101 | static int createFlag; // | 92 | static int createFlag; |
102 | static int verboseFlag; // | 93 | static int verboseFlag; |
103 | static int tostdoutFlag; // | 94 | static int tostdoutFlag; |
104 | 95 | ||
105 | static int inHeader; // <- check me | 96 | static int inHeader; // <- check me |
106 | static int badHeader; // | 97 | static int badHeader; |
107 | static int errorFlag; // | 98 | static int errorFlag; |
108 | static int skipFileFlag; // | 99 | static int skipFileFlag; |
109 | static int warnedRoot; // | 100 | static int warnedRoot; |
110 | static int eofFlag; // | 101 | static int eofFlag; |
111 | static long dataCc; | 102 | static long dataCc; |
112 | static int outFd; | 103 | static int outFd; |
113 | static char outName[TAR_NAME_SIZE]; | 104 | static char outName[TAR_NAME_SIZE]; |
@@ -136,7 +127,7 @@ static void readHeader (const TarHeader * hp, | |||
136 | /* | 127 | /* |
137 | * Local procedures to save files into a tar file. | 128 | * Local procedures to save files into a tar file. |
138 | */ | 129 | */ |
139 | static void saveFile (const char *fileName, int seeLinks); // | 130 | static void saveFile (const char *fileName, int seeLinks); |
140 | 131 | ||
141 | static void saveRegularFile (const char *fileName, | 132 | static void saveRegularFile (const char *fileName, |
142 | const struct stat *statbuf); | 133 | const struct stat *statbuf); |
@@ -145,13 +136,13 @@ static void saveDirectory (const char *fileName, | |||
145 | const struct stat *statbuf); | 136 | const struct stat *statbuf); |
146 | 137 | ||
147 | static int wantFileName (const char *fileName, | 138 | static int wantFileName (const char *fileName, |
148 | int fileCount, char **fileTable); // | 139 | int fileCount, char **fileTable); |
149 | 140 | ||
150 | static void writeHeader (const char *fileName, const struct stat *statbuf); | 141 | static void writeHeader (const char *fileName, const struct stat *statbuf); |
151 | 142 | ||
152 | static void writeTarFile (int fileCount, char **fileTable); | 143 | static void writeTarFile (int fileCount, char **fileTable); |
153 | static void writeTarBlock (const char *buf, int len); | 144 | static void writeTarBlock (const char *buf, int len); |
154 | static int putOctal (char *cp, int len, long value); // | 145 | static int putOctal (char *cp, int len, long value); |
155 | 146 | ||
156 | 147 | ||
157 | extern int tar_main (int argc, char **argv) | 148 | extern int tar_main (int argc, char **argv) |
@@ -217,10 +208,13 @@ extern int tar_main (int argc, char **argv) | |||
217 | break; | 208 | break; |
218 | 209 | ||
219 | case '-': | 210 | case '-': |
211 | usage( tar_usage); | ||
220 | break; | 212 | break; |
221 | 213 | ||
222 | default: | 214 | default: |
223 | fprintf (stderr, "Unknown tar flag '%c'\n", *options); | 215 | fprintf (stderr, "Unknown tar flag '%c'\n" |
216 | "Try `tar --help' for more information\n", | ||
217 | *options); | ||
224 | 218 | ||
225 | exit (FALSE); | 219 | exit (FALSE); |
226 | } | 220 | } |
@@ -230,7 +224,6 @@ extern int tar_main (int argc, char **argv) | |||
230 | /* | 224 | /* |
231 | * Validate the options. | 225 | * Validate the options. |
232 | */ | 226 | */ |
233 | fprintf(stderr, "TRUE=%d FALSE=%d\n", TRUE, FALSE); | ||
234 | if (extractFlag + listFlag + createFlag != (TRUE+FALSE+FALSE)) { | 227 | if (extractFlag + listFlag + createFlag != (TRUE+FALSE+FALSE)) { |
235 | fprintf (stderr, | 228 | fprintf (stderr, |
236 | "Exactly one of 'c', 'x' or 't' must be specified\n"); | 229 | "Exactly one of 'c', 'x' or 't' must be specified\n"); |
@@ -220,12 +220,12 @@ int busybox_main(int argc, char **argv) | |||
220 | 220 | ||
221 | if (been_there_done_that == 1 || argc < 1) { | 221 | if (been_there_done_that == 1 || argc < 1) { |
222 | const struct Applet *a = applets; | 222 | const struct Applet *a = applets; |
223 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n", | 223 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
224 | BB_VER, BB_BT); | 224 | BB_VER, BB_BT); |
225 | fprintf(stderr, "\nUsage:\t[function] [arguments]...\n"); | 225 | fprintf(stderr, "Usage: busybox [function] [arguments]...\n"); |
226 | fprintf(stderr, "\tbusybox [function] [arguments]...\n"); | 226 | fprintf(stderr, " or: [function] [arguments]...\n\n"); |
227 | fprintf(stderr, | 227 | fprintf(stderr, |
228 | "\n\tMost people will create a symlink to busybox for each\n" | 228 | "\tMost people will create a symlink to busybox for each\n" |
229 | "\tfunction name, and busybox will act like whatever you invoke it as.\n"); | 229 | "\tfunction name, and busybox will act like whatever you invoke it as.\n"); |
230 | fprintf(stderr, "\nCurrently defined functions:\n"); | 230 | fprintf(stderr, "\nCurrently defined functions:\n"); |
231 | 231 | ||
diff --git a/busybox.def.h b/busybox.def.h index 615289b81..79cbb27f1 100644 --- a/busybox.def.h +++ b/busybox.def.h | |||
@@ -2,6 +2,7 @@ | |||
2 | * This file is parsed by sed. You MUST use single line comments. | 2 | * This file is parsed by sed. You MUST use single line comments. |
3 | * IE //#define BB_BLAH | 3 | * IE //#define BB_BLAH |
4 | */ | 4 | */ |
5 | |||
5 | #define BB_BUSYBOX | 6 | #define BB_BUSYBOX |
6 | #define BB_CAT | 7 | #define BB_CAT |
7 | #define BB_CHMOD_CHOWN_CHGRP | 8 | #define BB_CHMOD_CHOWN_CHGRP |
@@ -12,48 +13,48 @@ | |||
12 | #define BB_DD | 13 | #define BB_DD |
13 | #define BB_DF | 14 | #define BB_DF |
14 | #define BB_DMESG | 15 | #define BB_DMESG |
15 | #define BB_DUTMP | 16 | //#define BB_DUTMP |
16 | #define BB_FDFLUSH | 17 | //#define BB_FDFLUSH |
17 | #define BB_FIND | 18 | #define BB_FIND |
18 | #define BB_FSCK_MINIX | 19 | #define BB_FSCK_MINIX |
19 | #define BB_MKFS_MINIX | 20 | #define BB_MKFS_MINIX |
20 | #define BB_CHVT | 21 | #define BB_CHVT |
21 | #define BB_DEALLOCVT | 22 | #define BB_DEALLOCVT |
22 | #define BB_GREP | 23 | #define BB_GREP |
23 | #define BB_HALT | 24 | //#define BB_HALT |
24 | #define BB_INIT | 25 | #define BB_INIT |
25 | #define BB_KILL | 26 | #define BB_KILL |
26 | #define BB_LENGTH | 27 | //#define BB_LENGTH |
27 | #define BB_LN | 28 | #define BB_LN |
28 | #define BB_LOADFONT | 29 | #define BB_LOADFONT |
29 | #define BB_LOADKMAP | 30 | #define BB_LOADKMAP |
30 | #define BB_LS | 31 | #define BB_LS |
31 | #define BB_MAKEDEVS | 32 | //#define BB_MAKEDEVS |
32 | #define BB_MATH | 33 | //#define BB_MATH |
33 | #define BB_MKDIR | 34 | #define BB_MKDIR |
34 | #define BB_MKNOD | 35 | #define BB_MKNOD |
35 | #define BB_MKSWAP | 36 | #define BB_MKSWAP |
36 | #define BB_MNC | 37 | //#define BB_MNC |
37 | #define BB_MORE | 38 | #define BB_MORE |
38 | #define BB_MOUNT | 39 | #define BB_MOUNT |
39 | #define BB_MT | 40 | //#define BB_MT |
40 | #define BB_MTAB | 41 | //#define BB_MTAB |
41 | #define BB_MV | 42 | #define BB_MV |
42 | #define BB_PRINTF | 43 | //#define BB_PRINTF |
43 | #define BB_PS | 44 | #define BB_PS |
44 | #define BB_PWD | 45 | #define BB_PWD |
45 | #define BB_REGEXP | 46 | #define BB_REGEXP |
46 | #define BB_REBOOT | 47 | #define BB_REBOOT |
47 | #define BB_RM | 48 | #define BB_RM |
48 | #define BB_RMDIR | 49 | #define BB_RMDIR |
49 | #define BB_SFDISK | 50 | //#define BB_SFDISK |
50 | #define BB_SED | 51 | #define BB_SED |
51 | #define BB_SLEEP | 52 | #define BB_SLEEP |
52 | #define BB_SWAPONOFF | 53 | #define BB_SWAPONOFF |
53 | #define BB_SYNC | 54 | #define BB_SYNC |
54 | #define BB_TAR | 55 | #define BB_TAR |
55 | #define BB_TOUCH | 56 | #define BB_TOUCH |
56 | #define BB_TRUE_FALSE | 57 | //#define BB_TRUE_FALSE // Supplied by ash |
57 | #define BB_UMOUNT | 58 | #define BB_UMOUNT |
58 | #define BB_UPDATE | 59 | #define BB_UPDATE |
59 | #define BB_UNAME | 60 | #define BB_UNAME |
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c index da3ba8d50..e9704fff8 100644 --- a/chmod_chown_chgrp.c +++ b/chmod_chown_chgrp.c | |||
@@ -38,16 +38,16 @@ static mode_t mode=0644; | |||
38 | #define CHOWN_APP 2 | 38 | #define CHOWN_APP 2 |
39 | #define CHMOD_APP 3 | 39 | #define CHMOD_APP 3 |
40 | 40 | ||
41 | static const char chgrp_usage[] = "[OPTION]... GROUP FILE...\n" | 41 | static const char chgrp_usage[] = "chgrp [OPTION]... GROUP FILE...\n\n" |
42 | "Change the group membership of each FILE to GROUP.\n" | 42 | "Change the group membership of each FILE to GROUP.\n" |
43 | "\n\tOptions:\n" "\t-R\tchange files and directories recursively\n"; | 43 | "\nOptions:\n\t-R\tchange files and directories recursively\n"; |
44 | static const char chown_usage[] = "[OPTION]... OWNER[.[GROUP] FILE...\n" | 44 | static const char chown_usage[] = "chown [OPTION]... OWNER[.[GROUP] FILE...\n\n" |
45 | "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" | 45 | "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" |
46 | "\n\tOptions:\n" "\t-R\tchange files and directories recursively\n"; | 46 | "\nOptions:\n\t-R\tchange files and directories recursively\n"; |
47 | static const char chmod_usage[] = "[-R] MODE[,MODE]... FILE...\n" | 47 | static const char chmod_usage[] = "chmod [-R] MODE[,MODE]... FILE...\n\n" |
48 | "Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n" | 48 | "Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n" |
49 | "one or more of the letters rwxst.\n\n" | 49 | "one or more of the letters rwxst.\n\n" |
50 | "\t-R\tchange files and directories recursively.\n"; | 50 | "\nOptions:\n\t-R\tchange files and directories recursively.\n"; |
51 | 51 | ||
52 | 52 | ||
53 | static int fileAction(const char *fileName, struct stat* statbuf) | 53 | static int fileAction(const char *fileName, struct stat* statbuf) |
@@ -73,14 +73,14 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
73 | { | 73 | { |
74 | int recursiveFlag=FALSE; | 74 | int recursiveFlag=FALSE; |
75 | char *groupName; | 75 | char *groupName; |
76 | const char *appUsage; | ||
76 | 77 | ||
77 | whichApp = (strcmp(*argv, "chown")==0)? CHOWN_APP : (strcmp(*argv, "chmod")==0)? CHMOD_APP : CHGRP_APP; | 78 | whichApp = (strcmp(*argv, "chown")==0)? CHOWN_APP : (strcmp(*argv, "chmod")==0)? CHMOD_APP : CHGRP_APP; |
78 | 79 | ||
79 | if (argc < 2) { | 80 | appUsage = (whichApp==CHOWN_APP)? chown_usage : (whichApp==CHMOD_APP)? chmod_usage : chgrp_usage; |
80 | fprintf(stderr, "Usage: %s %s", *argv, | 81 | |
81 | (whichApp==TRUE)? chown_usage : chgrp_usage); | 82 | if (argc < 2) |
82 | exit( FALSE); | 83 | usage( appUsage); |
83 | } | ||
84 | invocationName=*argv; | 84 | invocationName=*argv; |
85 | argc--; | 85 | argc--; |
86 | argv++; | 86 | argv++; |
@@ -93,7 +93,7 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
93 | break; | 93 | break; |
94 | default: | 94 | default: |
95 | fprintf(stderr, "Unknown option: %c\n", **argv); | 95 | fprintf(stderr, "Unknown option: %c\n", **argv); |
96 | exit( FALSE); | 96 | usage( appUsage); |
97 | } | 97 | } |
98 | argc--; | 98 | argc--; |
99 | argv++; | 99 | argv++; |
@@ -27,7 +27,7 @@ | |||
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | 29 | ||
30 | static const char chroot_usage[] = "NEWROOT [COMMAND...]\n" | 30 | static const char chroot_usage[] = "chroot NEWROOT [COMMAND...]\n\n" |
31 | "Run COMMAND with root directory set to NEWROOT.\n"; | 31 | "Run COMMAND with root directory set to NEWROOT.\n"; |
32 | 32 | ||
33 | 33 | ||
@@ -19,7 +19,7 @@ chvt_main(int argc, char** argv) | |||
19 | int fd, num; | 19 | int fd, num; |
20 | 20 | ||
21 | if ( ( argc != 2) || (**(argv+1) == '-' ) ) { | 21 | if ( ( argc != 2) || (**(argv+1) == '-' ) ) { |
22 | usage ("chvt </dev/ttyN>\n"); | 22 | usage ("chvt N\n\nChange foreground virtual terminal to /dev/ttyN\n"); |
23 | } | 23 | } |
24 | fd = get_console_fd("/dev/console"); | 24 | fd = get_console_fd("/dev/console"); |
25 | num = atoi(argv[1]); | 25 | num = atoi(argv[1]); |
diff --git a/console-tools/chvt.c b/console-tools/chvt.c index 81d199527..bea00ea83 100644 --- a/console-tools/chvt.c +++ b/console-tools/chvt.c | |||
@@ -19,7 +19,7 @@ chvt_main(int argc, char** argv) | |||
19 | int fd, num; | 19 | int fd, num; |
20 | 20 | ||
21 | if ( ( argc != 2) || (**(argv+1) == '-' ) ) { | 21 | if ( ( argc != 2) || (**(argv+1) == '-' ) ) { |
22 | usage ("chvt </dev/ttyN>\n"); | 22 | usage ("chvt N\n\nChange foreground virtual terminal to /dev/ttyN\n"); |
23 | } | 23 | } |
24 | fd = get_console_fd("/dev/console"); | 24 | fd = get_console_fd("/dev/console"); |
25 | num = atoi(argv[1]); | 25 | num = atoi(argv[1]); |
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index ae4dbb5a8..1e13ff69c 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c | |||
@@ -17,8 +17,10 @@ int | |||
17 | deallocvt_main(int argc, char *argv[]) { | 17 | deallocvt_main(int argc, char *argv[]) { |
18 | int fd, num, i; | 18 | int fd, num, i; |
19 | 19 | ||
20 | if (argc < 1) /* unlikely */ | 20 | if ( ( argc != 2) || (**(argv+1) == '-' ) ) { |
21 | exit(1); | 21 | usage ("deallocvt N\n\nDeallocate unused virtual terminal /dev/ttyN\n"); |
22 | } | ||
23 | |||
22 | progname = argv[0]; | 24 | progname = argv[0]; |
23 | 25 | ||
24 | fd = get_console_fd("/dev/console"); | 26 | fd = get_console_fd("/dev/console"); |
diff --git a/coreutils/chroot.c b/coreutils/chroot.c index 8e432b36c..16524d92e 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | 29 | ||
30 | static const char chroot_usage[] = "NEWROOT [COMMAND...]\n" | 30 | static const char chroot_usage[] = "chroot NEWROOT [COMMAND...]\n\n" |
31 | "Run COMMAND with root directory set to NEWROOT.\n"; | 31 | "Run COMMAND with root directory set to NEWROOT.\n"; |
32 | 32 | ||
33 | 33 | ||
diff --git a/coreutils/cp.c b/coreutils/cp.c index 9dac2afbc..57158c820 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <dirent.h> | 28 | #include <dirent.h> |
29 | 29 | ||
30 | static const char cp_usage[] = "cp [OPTION]... SOURCE DEST\n" | 30 | static const char cp_usage[] = "cp [OPTION]... SOURCE DEST\n" |
31 | " or: cp [OPTION]... SOURCE... DIRECTORY\n" | 31 | " or: cp [OPTION]... SOURCE... DIRECTORY\n\n" |
32 | "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" | 32 | "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" |
33 | "\n" | 33 | "\n" |
34 | "\t-a\tsame as -dpR\n" | 34 | "\t-a\tsame as -dpR\n" |
diff --git a/coreutils/date.c b/coreutils/date.c index 501ccc28f..6be89df3e 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -35,7 +35,7 @@ | |||
35 | mail commands */ | 35 | mail commands */ |
36 | 36 | ||
37 | static const char date_usage[] = "date [OPTION]... [+FORMAT]\n" | 37 | static const char date_usage[] = "date [OPTION]... [+FORMAT]\n" |
38 | " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n" | 38 | " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n\n" |
39 | "Display the current time in the given FORMAT, or set the system date.\n" | 39 | "Display the current time in the given FORMAT, or set the system date.\n" |
40 | "\nOptions:\n\t-R\t\toutput RFC-822 compliant date string\n" | 40 | "\nOptions:\n\t-R\t\toutput RFC-822 compliant date string\n" |
41 | "\t-s\t\tset time described by STRING\n" | 41 | "\t-s\t\tset time described by STRING\n" |
diff --git a/coreutils/dd.c b/coreutils/dd.c index 33c45940e..800ed59f8 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <errno.h> | 34 | #include <errno.h> |
35 | 35 | ||
36 | static const char dd_usage[] = | 36 | static const char dd_usage[] = |
37 | "dd [if=name] [of=name] [bs=n] [count=n]\n" | 37 | "dd [if=name] [of=name] [bs=n] [count=n]\n\n" |
38 | "Copy a file, converting and formatting according to options\n\n" | 38 | "Copy a file, converting and formatting according to options\n\n" |
39 | "\tif=FILE\tread from FILE instead of stdin\n" | 39 | "\tif=FILE\tread from FILE instead of stdin\n" |
40 | "\tof=FILE\twrite to FILE instead of stout\n" | 40 | "\tof=FILE\twrite to FILE instead of stout\n" |
@@ -227,8 +227,7 @@ extern int dd_main (int argc, char **argv) | |||
227 | exit( TRUE); | 227 | exit( TRUE); |
228 | usage: | 228 | usage: |
229 | 229 | ||
230 | fprintf (stderr, "%s", dd_usage); | 230 | usage( dd_usage); |
231 | exit( FALSE); | ||
232 | } | 231 | } |
233 | 232 | ||
234 | 233 | ||
diff --git a/coreutils/ln.c b/coreutils/ln.c index 62496fba0..60fe39438 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -27,9 +27,9 @@ | |||
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | 29 | ||
30 | static const char ln_usage[] = "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n" | 30 | static const char ln_usage[] = "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n" |
31 | "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n" | 31 | "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n\n" |
32 | "\nOptions:\n" | 32 | "Options:\n" |
33 | "\t-s\tmake symbolic links instead of hard links\n" | 33 | "\t-s\tmake symbolic links instead of hard links\n" |
34 | "\t-f\tremove existing destination files\n"; | 34 | "\t-f\tremove existing destination files\n"; |
35 | 35 | ||
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 0d0a90ec3..4c7ebed6a 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -26,10 +26,11 @@ | |||
26 | #include <errno.h> | 26 | #include <errno.h> |
27 | #include <sys/param.h> | 27 | #include <sys/param.h> |
28 | 28 | ||
29 | static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n" | 29 | static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n\n" |
30 | "Create the DIRECTORY(ies), if they do not already exist\n\n" | 30 | "Create the DIRECTORY(ies), if they do not already exist\n\n" |
31 | "-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" | 31 | "Options:\n" |
32 | "-p\tno error if existing, make parent directories as needed\n"; | 32 | "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" |
33 | "\t-p\tno error if existing, make parent directories as needed\n"; | ||
33 | 34 | ||
34 | 35 | ||
35 | static int parentFlag = FALSE; | 36 | static int parentFlag = FALSE; |
diff --git a/coreutils/mknod.c b/coreutils/mknod.c index 81c846b98..c3389cc71 100644 --- a/coreutils/mknod.c +++ b/coreutils/mknod.c | |||
@@ -27,9 +27,9 @@ | |||
27 | #include <fcntl.h> | 27 | #include <fcntl.h> |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | 29 | ||
30 | static const char mknod_usage[] = "mknod file b|c|u|p major minor\n" | 30 | static const char mknod_usage[] = "mknod [OPTION]... NAME TYPE MAJOR MINOR\n\n" |
31 | "\tMake special files.\n" | 31 | "Make block or character special files.\n\n" |
32 | "\n" | 32 | "Options:\n" |
33 | "\tb:\tMake a block (buffered) device.\n" | 33 | "\tb:\tMake a block (buffered) device.\n" |
34 | "\tc or u:\tMake a character (un-buffered) device.\n" | 34 | "\tc or u:\tMake a character (un-buffered) device.\n" |
35 | "\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n"; | 35 | "\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n"; |
diff --git a/coreutils/mv.c b/coreutils/mv.c index e502250ec..b861ab7e6 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | static const char mv_usage[] = "mv SOURCE DEST\n" | 31 | static const char mv_usage[] = "mv SOURCE DEST\n" |
32 | " or: mv SOURCE... DIRECTORY\n" | 32 | " or: mv SOURCE... DIRECTORY\n\n" |
33 | "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n"; | 33 | "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n"; |
34 | 34 | ||
35 | 35 | ||
diff --git a/coreutils/rm.c b/coreutils/rm.c index 077e792f9..e6132ab35 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c | |||
@@ -27,8 +27,9 @@ | |||
27 | #include <utime.h> | 27 | #include <utime.h> |
28 | #include <dirent.h> | 28 | #include <dirent.h> |
29 | 29 | ||
30 | static const char* rm_usage = "rm [OPTION]... FILE...\n" | 30 | static const char* rm_usage = "rm [OPTION]... FILE...\n\n" |
31 | "Remove (unlink) the FILE(s).\n\n" | 31 | "Remove (unlink) the FILE(s).\n\n" |
32 | "Options:\n" | ||
32 | "\t-f\tremove existing destinations, never prompt\n" | 33 | "\t-f\tremove existing destinations, never prompt\n" |
33 | "\t-r\tremove the contents of directories recursively\n"; | 34 | "\t-r\tremove the contents of directories recursively\n"; |
34 | 35 | ||
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index 56b838736..013fef1a4 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c | |||
@@ -29,7 +29,7 @@ | |||
29 | extern int rmdir_main(int argc, char **argv) | 29 | extern int rmdir_main(int argc, char **argv) |
30 | { | 30 | { |
31 | if ( argc==1 || **(argv+1) == '-' ) { | 31 | if ( argc==1 || **(argv+1) == '-' ) { |
32 | usage( "rmdir [OPTION]... DIRECTORY...\nRemove the DIRECTORY(ies), if they are empty."); | 32 | usage( "rmdir [OPTION]... DIRECTORY...\n\nRemove the DIRECTORY(ies), if they are empty.\n"); |
33 | } | 33 | } |
34 | 34 | ||
35 | while (--argc > 0) { | 35 | while (--argc > 0) { |
diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 826697824..bfbb78f61 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c | |||
@@ -23,8 +23,8 @@ | |||
23 | #include "internal.h" | 23 | #include "internal.h" |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | 25 | ||
26 | const char sleep_usage[] = " NUMBER\n" | 26 | const char sleep_usage[] = "sleep N\n\n" |
27 | "Pause for NUMBER seconds.\n"; | 27 | "Pause for N seconds.\n"; |
28 | 28 | ||
29 | extern int | 29 | extern int |
30 | sleep_main(int argc, char * * argv) | 30 | sleep_main(int argc, char * * argv) |
diff --git a/coreutils/sync.c b/coreutils/sync.c index cb4690c02..145ed1eda 100644 --- a/coreutils/sync.c +++ b/coreutils/sync.c | |||
@@ -27,7 +27,7 @@ extern int | |||
27 | sync_main(int argc, char * * argv) | 27 | sync_main(int argc, char * * argv) |
28 | { | 28 | { |
29 | if ( argc>1 && **(argv+1) == '-' ) { | 29 | if ( argc>1 && **(argv+1) == '-' ) { |
30 | usage( "sync\nWrite all buffered filesystem blocks to disk.\n"); | 30 | usage( "sync\n\nWrite all buffered filesystem blocks to disk.\n"); |
31 | } | 31 | } |
32 | exit( sync()); | 32 | exit( sync()); |
33 | } | 33 | } |
diff --git a/coreutils/touch.c b/coreutils/touch.c index b98a2e4c8..d2d3e9484 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | 32 | ||
33 | static const char touch_usage[] = "touch [-c] file [file ...]\n\n" | 33 | static const char touch_usage[] = "touch [-c] file [file ...]\n\n" |
34 | "\tUpdate the last-modified date on the given file[s].\n"; | 34 | "Update the last-modified date on the given file[s].\n"; |
35 | 35 | ||
36 | 36 | ||
37 | 37 | ||
@@ -54,7 +54,7 @@ touch_main(int argc, char **argv) | |||
54 | create = FALSE; | 54 | create = FALSE; |
55 | break; | 55 | break; |
56 | default: | 56 | default: |
57 | fprintf(stderr, "Unknown option: %c\n", **argv); | 57 | usage( touch_usage); |
58 | exit( FALSE); | 58 | exit( FALSE); |
59 | } | 59 | } |
60 | argc--; | 60 | argc--; |
diff --git a/coreutils/uname.c b/coreutils/uname.c index b54deb345..9083edb04 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c | |||
@@ -41,8 +41,9 @@ | |||
41 | 41 | ||
42 | 42 | ||
43 | static const char uname_usage[] = | 43 | static const char uname_usage[] = |
44 | "uname [OPTION]...\n" | 44 | "uname [OPTION]...\n\n" |
45 | "Print certain system information. With no OPTION, same as -s.\n" | 45 | "Print certain system information. With no OPTION, same as -s.\n\n" |
46 | "Options:\n" | ||
46 | "\t-a\tprint all information\n" | 47 | "\t-a\tprint all information\n" |
47 | "\t-m\tthe machine (hardware) type\n" | 48 | "\t-m\tthe machine (hardware) type\n" |
48 | "\t-n\tprint the machine's network node hostname\n" | 49 | "\t-n\tprint the machine's network node hostname\n" |
@@ -28,7 +28,7 @@ | |||
28 | #include <dirent.h> | 28 | #include <dirent.h> |
29 | 29 | ||
30 | static const char cp_usage[] = "cp [OPTION]... SOURCE DEST\n" | 30 | static const char cp_usage[] = "cp [OPTION]... SOURCE DEST\n" |
31 | " or: cp [OPTION]... SOURCE... DIRECTORY\n" | 31 | " or: cp [OPTION]... SOURCE... DIRECTORY\n\n" |
32 | "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" | 32 | "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" |
33 | "\n" | 33 | "\n" |
34 | "\t-a\tsame as -dpR\n" | 34 | "\t-a\tsame as -dpR\n" |
@@ -35,7 +35,7 @@ | |||
35 | mail commands */ | 35 | mail commands */ |
36 | 36 | ||
37 | static const char date_usage[] = "date [OPTION]... [+FORMAT]\n" | 37 | static const char date_usage[] = "date [OPTION]... [+FORMAT]\n" |
38 | " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n" | 38 | " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n\n" |
39 | "Display the current time in the given FORMAT, or set the system date.\n" | 39 | "Display the current time in the given FORMAT, or set the system date.\n" |
40 | "\nOptions:\n\t-R\t\toutput RFC-822 compliant date string\n" | 40 | "\nOptions:\n\t-R\t\toutput RFC-822 compliant date string\n" |
41 | "\t-s\t\tset time described by STRING\n" | 41 | "\t-s\t\tset time described by STRING\n" |
@@ -34,7 +34,7 @@ | |||
34 | #include <errno.h> | 34 | #include <errno.h> |
35 | 35 | ||
36 | static const char dd_usage[] = | 36 | static const char dd_usage[] = |
37 | "dd [if=name] [of=name] [bs=n] [count=n]\n" | 37 | "dd [if=name] [of=name] [bs=n] [count=n]\n\n" |
38 | "Copy a file, converting and formatting according to options\n\n" | 38 | "Copy a file, converting and formatting according to options\n\n" |
39 | "\tif=FILE\tread from FILE instead of stdin\n" | 39 | "\tif=FILE\tread from FILE instead of stdin\n" |
40 | "\tof=FILE\twrite to FILE instead of stout\n" | 40 | "\tof=FILE\twrite to FILE instead of stout\n" |
@@ -227,8 +227,7 @@ extern int dd_main (int argc, char **argv) | |||
227 | exit( TRUE); | 227 | exit( TRUE); |
228 | usage: | 228 | usage: |
229 | 229 | ||
230 | fprintf (stderr, "%s", dd_usage); | 230 | usage( dd_usage); |
231 | exit( FALSE); | ||
232 | } | 231 | } |
233 | 232 | ||
234 | 233 | ||
diff --git a/deallocvt.c b/deallocvt.c index ae4dbb5a8..1e13ff69c 100644 --- a/deallocvt.c +++ b/deallocvt.c | |||
@@ -17,8 +17,10 @@ int | |||
17 | deallocvt_main(int argc, char *argv[]) { | 17 | deallocvt_main(int argc, char *argv[]) { |
18 | int fd, num, i; | 18 | int fd, num, i; |
19 | 19 | ||
20 | if (argc < 1) /* unlikely */ | 20 | if ( ( argc != 2) || (**(argv+1) == '-' ) ) { |
21 | exit(1); | 21 | usage ("deallocvt N\n\nDeallocate unused virtual terminal /dev/ttyN\n"); |
22 | } | ||
23 | |||
22 | progname = argv[0]; | 24 | progname = argv[0]; |
23 | 25 | ||
24 | fd = get_console_fd("/dev/console"); | 26 | fd = get_console_fd("/dev/console"); |
diff --git a/editors/sed.c b/editors/sed.c index 34756e09a..4dfc0246c 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -32,18 +32,18 @@ | |||
32 | #include <ctype.h> | 32 | #include <ctype.h> |
33 | 33 | ||
34 | static const char sed_usage[] = | 34 | static const char sed_usage[] = |
35 | "sed [-n] [-e script] [file...]\n" | 35 | "sed [-n] [-e script] [file...]\n\n" |
36 | "Allowed scripts come in the following form:\n\n" | 36 | "Allowed sed scripts come in the following form:\n" |
37 | "'s/regexp/replacement/[gp]'\n" | 37 | "\t's/regexp/replacement/[gp]'\n" |
38 | "\tattempt to match regexp against the pattern space\n" | 38 | "which attempt to match regexp against the pattern space\n" |
39 | "\tand if successful replaces the matched portion with replacement.\n\n" | 39 | "and if successful replaces the matched portion with replacement.\n\n" |
40 | "Options:\n" | 40 | "Options:\n" |
41 | "-e\tadd the script to the commands to be executed\n" | 41 | "-e\tadd the script to the commands to be executed\n" |
42 | "-n\tsuppress automatic printing of pattern space\n\n" | 42 | "-n\tsuppress automatic printing of pattern space\n\n" |
43 | #if defined BB_REGEXP | 43 | #if defined BB_REGEXP |
44 | "This version of sed matches full regexps.\n"; | 44 | "This version of sed matches full regular expresions.\n"; |
45 | #else | 45 | #else |
46 | "This version of sed matches strings (not full regexps).\n"; | 46 | "This version of sed matches strings (not full regular expresions).\n"; |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | 49 | ||
@@ -32,9 +32,18 @@ static char* pattern=NULL; | |||
32 | static char* directory="."; | 32 | static char* directory="."; |
33 | static int dereferenceFlag=FALSE; | 33 | static int dereferenceFlag=FALSE; |
34 | 34 | ||
35 | static const char find_usage[] = "find [path...] [expression]\n" | 35 | static const char find_usage[] = "find [PATH...] [EXPRESSION]\n\n" |
36 | "default path is the current directory; default expression is -print\n" | 36 | "Search for files in a directory hierarchy. The default PATH is\n" |
37 | "expression may consist of:\n"; | 37 | "the current directory; default EXPRESSION is '-print'\n\n" |
38 | "\nEXPRESSION may consist of:\n" | ||
39 | "\t-follow\n\t\tDereference symbolic links.\n" | ||
40 | "\t-name PATTERN\n\t\tFile name (with leading directories removed) matches PATTERN.\n" | ||
41 | "\t-print\n\t\tprint the full file name followed by a newline to stdout.\n\n" | ||
42 | #if defined BB_REGEXP | ||
43 | "This version of find matches full regular expresions.\n"; | ||
44 | #else | ||
45 | "This version of find matches strings (not regular expresions).\n"; | ||
46 | #endif | ||
38 | 47 | ||
39 | 48 | ||
40 | 49 | ||
diff --git a/findutils/find.c b/findutils/find.c index ab9ebf434..0f1f5f189 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -32,9 +32,18 @@ static char* pattern=NULL; | |||
32 | static char* directory="."; | 32 | static char* directory="."; |
33 | static int dereferenceFlag=FALSE; | 33 | static int dereferenceFlag=FALSE; |
34 | 34 | ||
35 | static const char find_usage[] = "find [path...] [expression]\n" | 35 | static const char find_usage[] = "find [PATH...] [EXPRESSION]\n\n" |
36 | "default path is the current directory; default expression is -print\n" | 36 | "Search for files in a directory hierarchy. The default PATH is\n" |
37 | "expression may consist of:\n"; | 37 | "the current directory; default EXPRESSION is '-print'\n\n" |
38 | "\nEXPRESSION may consist of:\n" | ||
39 | "\t-follow\n\t\tDereference symbolic links.\n" | ||
40 | "\t-name PATTERN\n\t\tFile name (with leading directories removed) matches PATTERN.\n" | ||
41 | "\t-print\n\t\tprint the full file name followed by a newline to stdout.\n\n" | ||
42 | #if defined BB_REGEXP | ||
43 | "This version of find matches full regular expresions.\n"; | ||
44 | #else | ||
45 | "This version of find matches strings (not regular expresions).\n"; | ||
46 | #endif | ||
38 | 47 | ||
39 | 48 | ||
40 | 49 | ||
diff --git a/findutils/grep.c b/findutils/grep.c index 8dcff0586..84bb99667 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -32,15 +32,16 @@ | |||
32 | #include <ctype.h> | 32 | #include <ctype.h> |
33 | 33 | ||
34 | static const char grep_usage[] = | 34 | static const char grep_usage[] = |
35 | "grep [-ihn]... PATTERN [FILE]...\n" | 35 | "grep [OPTIONS]... PATTERN [FILE]...\n\n" |
36 | "Search for PATTERN in each FILE or standard input.\n\n" | 36 | "Search for PATTERN in each FILE or standard input.\n\n" |
37 | "OPTIONS:\n" | ||
37 | "\t-h\tsuppress the prefixing filename on output\n" | 38 | "\t-h\tsuppress the prefixing filename on output\n" |
38 | "\t-i\tignore case distinctions\n" | 39 | "\t-i\tignore case distinctions\n" |
39 | "\t-n\tprint line number with output lines\n\n" | 40 | "\t-n\tprint line number with output lines\n\n" |
40 | #if defined BB_REGEXP | 41 | #if defined BB_REGEXP |
41 | "This version of grep matches full regexps.\n"; | 42 | "This version of grep matches full regular expresions.\n"; |
42 | #else | 43 | #else |
43 | "This version of grep matches strings (not regexps).\n"; | 44 | "This version of grep matches strings (not regular expresions).\n"; |
44 | #endif | 45 | #endif |
45 | 46 | ||
46 | 47 | ||
diff --git a/fsck_minix.c b/fsck_minix.c index 125274734..d31de20a8 100644 --- a/fsck_minix.c +++ b/fsck_minix.c | |||
@@ -191,9 +191,17 @@ static void leave(int status) | |||
191 | } | 191 | } |
192 | 192 | ||
193 | static void show_usage(void) { | 193 | static void show_usage(void) { |
194 | fprintf(stderr, | 194 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); |
195 | "Usage: %s [-larvsmf] /dev/name\n", | 195 | fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n\n", program_name); |
196 | program_name); | 196 | fprintf(stderr, "Performs a consistency check for MINIX filesystems.\n\n"); |
197 | fprintf(stderr, "OPTIONS:\n"); | ||
198 | fprintf(stderr, "\t-l\tLists all filenames\n"); | ||
199 | fprintf(stderr, "\t-r\tPerform interactive repairs\n"); | ||
200 | fprintf(stderr, "\t-a\tPerform automatic repairs\n"); | ||
201 | fprintf(stderr, "\t-v\tverbose\n"); | ||
202 | fprintf(stderr, "\t-s\tOutputs super-block information\n"); | ||
203 | fprintf(stderr, "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n"); | ||
204 | fprintf(stderr, "\t-f\tForce file system check.\n\n"); | ||
197 | leave(16); | 205 | leave(16); |
198 | } | 206 | } |
199 | 207 | ||
@@ -32,15 +32,16 @@ | |||
32 | #include <ctype.h> | 32 | #include <ctype.h> |
33 | 33 | ||
34 | static const char grep_usage[] = | 34 | static const char grep_usage[] = |
35 | "grep [-ihn]... PATTERN [FILE]...\n" | 35 | "grep [OPTIONS]... PATTERN [FILE]...\n\n" |
36 | "Search for PATTERN in each FILE or standard input.\n\n" | 36 | "Search for PATTERN in each FILE or standard input.\n\n" |
37 | "OPTIONS:\n" | ||
37 | "\t-h\tsuppress the prefixing filename on output\n" | 38 | "\t-h\tsuppress the prefixing filename on output\n" |
38 | "\t-i\tignore case distinctions\n" | 39 | "\t-i\tignore case distinctions\n" |
39 | "\t-n\tprint line number with output lines\n\n" | 40 | "\t-n\tprint line number with output lines\n\n" |
40 | #if defined BB_REGEXP | 41 | #if defined BB_REGEXP |
41 | "This version of grep matches full regexps.\n"; | 42 | "This version of grep matches full regular expresions.\n"; |
42 | #else | 43 | #else |
43 | "This version of grep matches strings (not regexps).\n"; | 44 | "This version of grep matches strings (not regular expresions).\n"; |
44 | #endif | 45 | #endif |
45 | 46 | ||
46 | 47 | ||
@@ -430,6 +430,13 @@ extern int init_main(int argc, char **argv) | |||
430 | #endif | 430 | #endif |
431 | 431 | ||
432 | 432 | ||
433 | #ifndef DEBUG_INIT | ||
434 | if (getpid() != 1) { | ||
435 | usage( "init\n\nInit is the parent of all processes.\n\n" | ||
436 | "This version of init is designed to be run only by the kernel\n"); | ||
437 | } | ||
438 | #endif | ||
439 | |||
433 | /* Check if we are supposed to be in single user mode */ | 440 | /* Check if we are supposed to be in single user mode */ |
434 | if ( argc > 1 && (!strcmp(argv[1], "single") || | 441 | if ( argc > 1 && (!strcmp(argv[1], "single") || |
435 | !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) { | 442 | !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) { |
diff --git a/init/init.c b/init/init.c index a354f8a75..e70d5a15d 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -430,6 +430,13 @@ extern int init_main(int argc, char **argv) | |||
430 | #endif | 430 | #endif |
431 | 431 | ||
432 | 432 | ||
433 | #ifndef DEBUG_INIT | ||
434 | if (getpid() != 1) { | ||
435 | usage( "init\n\nInit is the parent of all processes.\n\n" | ||
436 | "This version of init is designed to be run only by the kernel\n"); | ||
437 | } | ||
438 | #endif | ||
439 | |||
433 | /* Check if we are supposed to be in single user mode */ | 440 | /* Check if we are supposed to be in single user mode */ |
434 | if ( argc > 1 && (!strcmp(argv[1], "single") || | 441 | if ( argc > 1 && (!strcmp(argv[1], "single") || |
435 | !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) { | 442 | !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) { |
diff --git a/internal.h b/internal.h index 8d111a6c9..0e7054f14 100644 --- a/internal.h +++ b/internal.h | |||
@@ -138,7 +138,7 @@ const char* timeString(time_t timeVal); | |||
138 | 138 | ||
139 | extern void createPath (const char *name, int mode); | 139 | extern void createPath (const char *name, int mode); |
140 | extern int parse_mode( const char* s, mode_t* theMode); | 140 | extern int parse_mode( const char* s, mode_t* theMode); |
141 | extern volatile void usage(const char *usage); | 141 | extern void usage(const char *usage) __attribute__ ((noreturn)); |
142 | 142 | ||
143 | extern uid_t my_getpwnam(char *name); | 143 | extern uid_t my_getpwnam(char *name); |
144 | extern gid_t my_getgrnam(char *name); | 144 | extern gid_t my_getgrnam(char *name); |
@@ -27,9 +27,9 @@ | |||
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | 29 | ||
30 | static const char ln_usage[] = "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n" | 30 | static const char ln_usage[] = "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n" |
31 | "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n" | 31 | "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n\n" |
32 | "\nOptions:\n" | 32 | "Options:\n" |
33 | "\t-s\tmake symbolic links instead of hard links\n" | 33 | "\t-s\tmake symbolic links instead of hard links\n" |
34 | "\t-f\tremove existing destination files\n"; | 34 | "\t-f\tremove existing destination files\n"; |
35 | 35 | ||
@@ -26,10 +26,11 @@ | |||
26 | #include <errno.h> | 26 | #include <errno.h> |
27 | #include <sys/param.h> | 27 | #include <sys/param.h> |
28 | 28 | ||
29 | static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n" | 29 | static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n\n" |
30 | "Create the DIRECTORY(ies), if they do not already exist\n\n" | 30 | "Create the DIRECTORY(ies), if they do not already exist\n\n" |
31 | "-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" | 31 | "Options:\n" |
32 | "-p\tno error if existing, make parent directories as needed\n"; | 32 | "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" |
33 | "\t-p\tno error if existing, make parent directories as needed\n"; | ||
33 | 34 | ||
34 | 35 | ||
35 | static int parentFlag = FALSE; | 36 | static int parentFlag = FALSE; |
diff --git a/mkfs_minix.c b/mkfs_minix.c index 926a023b4..b90d3a700 100644 --- a/mkfs_minix.c +++ b/mkfs_minix.c | |||
@@ -171,10 +171,15 @@ static volatile void die(char *str) { | |||
171 | 171 | ||
172 | static volatile void show_usage() | 172 | static volatile void show_usage() |
173 | { | 173 | { |
174 | fprintf(stderr, "%s\n", program_name); | 174 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); |
175 | fprintf(stderr, | 175 | fprintf(stderr, "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n\n", program_name); |
176 | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", | 176 | fprintf(stderr, "Make a MINIX filesystem.\n\n"); |
177 | program_name); | 177 | fprintf(stderr, "OPTIONS:\n"); |
178 | fprintf(stderr, "\t-c\t\tCheck the device for bad blocks\n"); | ||
179 | fprintf(stderr, "\t-n [14|30]\tSpecify the maximum length of filenames\n"); | ||
180 | fprintf(stderr, "\t-i\t\tSpecify the number of inodes for the filesystem\n"); | ||
181 | fprintf(stderr, "\t-l FILENAME\tRead the bad blocks list from FILENAME\n"); | ||
182 | fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n"); | ||
178 | exit(16); | 183 | exit(16); |
179 | } | 184 | } |
180 | 185 | ||
@@ -27,9 +27,9 @@ | |||
27 | #include <fcntl.h> | 27 | #include <fcntl.h> |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | 29 | ||
30 | static const char mknod_usage[] = "mknod file b|c|u|p major minor\n" | 30 | static const char mknod_usage[] = "mknod [OPTION]... NAME TYPE MAJOR MINOR\n\n" |
31 | "\tMake special files.\n" | 31 | "Make block or character special files.\n\n" |
32 | "\n" | 32 | "Options:\n" |
33 | "\tb:\tMake a block (buffered) device.\n" | 33 | "\tb:\tMake a block (buffered) device.\n" |
34 | "\tc or u:\tMake a character (un-buffered) device.\n" | 34 | "\tc or u:\tMake a character (un-buffered) device.\n" |
35 | "\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n"; | 35 | "\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n"; |
@@ -47,11 +47,12 @@ | |||
47 | /* we also get PAGE_SIZE via getpagesize() */ | 47 | /* we also get PAGE_SIZE via getpagesize() */ |
48 | 48 | ||
49 | 49 | ||
50 | static const char mkswap_usage[] = "mkswap [-c] [-v0|-v1] device [block-count]\n" | 50 | static const char mkswap_usage[] = "mkswap [-c] [-v0|-v1] device [block-count]\n\n" |
51 | "Prepare a disk partition to be used as a swap partition.\n\n" | 51 | "Prepare a disk partition to be used as a swap partition.\n\n" |
52 | "\t-c\tCheck for read-ability.\n" | 52 | "Options:\n" |
53 | "\t-v0\tMake version 0 swap [max 128 Megs].\n" | 53 | "\t-c\t\tCheck for read-ability.\n" |
54 | "\t-v1\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" | 54 | "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" |
55 | "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" | ||
55 | "\tblock-count\tNumber of block to use (default is entire partition).\n"; | 56 | "\tblock-count\tNumber of block to use (default is entire partition).\n"; |
56 | 57 | ||
57 | 58 | ||
@@ -37,7 +37,7 @@ | |||
37 | #include <signal.h> | 37 | #include <signal.h> |
38 | #include <sys/ioctl.h> | 38 | #include <sys/ioctl.h> |
39 | 39 | ||
40 | static const char more_usage[] = "[file ...]"; | 40 | static const char more_usage[] = "more [file ...]\n"; |
41 | 41 | ||
42 | /* ED: sparc termios is broken: revert back to old termio handling. */ | 42 | /* ED: sparc termios is broken: revert back to old termio handling. */ |
43 | #ifdef BB_FEATURE_USE_TERMIOS | 43 | #ifdef BB_FEATURE_USE_TERMIOS |
@@ -43,7 +43,7 @@ | |||
43 | 43 | ||
44 | extern const char mtab_file[]; /* Defined in utility.c */ | 44 | extern const char mtab_file[]; /* Defined in utility.c */ |
45 | 45 | ||
46 | static const char mount_usage[] = "Usage:\tmount [flags]\n" | 46 | static const char mount_usage[] = "\tmount [flags]\n" |
47 | "\tmount [flags] device directory [-o options,more-options]\n" | 47 | "\tmount [flags] device directory [-o options,more-options]\n" |
48 | "\n" | 48 | "\n" |
49 | "Flags:\n" | 49 | "Flags:\n" |
@@ -248,8 +248,7 @@ extern int mount_main (int argc, char **argv) | |||
248 | while (i>0 && *++(*argv)) switch (**argv) { | 248 | while (i>0 && *++(*argv)) switch (**argv) { |
249 | case 'o': | 249 | case 'o': |
250 | if (--i == 0) { | 250 | if (--i == 0) { |
251 | fprintf (stderr, "%s\n", mount_usage); | 251 | goto goodbye; |
252 | exit( FALSE); | ||
253 | } | 252 | } |
254 | parse_mount_options (*(++argv), &flags, string_flags); | 253 | parse_mount_options (*(++argv), &flags, string_flags); |
255 | --i; | 254 | --i; |
@@ -260,8 +259,7 @@ extern int mount_main (int argc, char **argv) | |||
260 | break; | 259 | break; |
261 | case 't': | 260 | case 't': |
262 | if (--i == 0) { | 261 | if (--i == 0) { |
263 | fprintf (stderr, "%s\n", mount_usage); | 262 | goto goodbye; |
264 | exit( FALSE); | ||
265 | } | 263 | } |
266 | filesystemType = *(++argv); | 264 | filesystemType = *(++argv); |
267 | --i; | 265 | --i; |
@@ -284,9 +282,7 @@ extern int mount_main (int argc, char **argv) | |||
284 | case 'v': | 282 | case 'v': |
285 | case 'h': | 283 | case 'h': |
286 | case '-': | 284 | case '-': |
287 | fprintf (stderr, "%s\n", mount_usage); | 285 | goto goodbye; |
288 | exit( TRUE); | ||
289 | break; | ||
290 | } | 286 | } |
291 | } else { | 287 | } else { |
292 | if (device == NULL) | 288 | if (device == NULL) |
@@ -294,8 +290,7 @@ extern int mount_main (int argc, char **argv) | |||
294 | else if (directory == NULL) | 290 | else if (directory == NULL) |
295 | directory=*argv; | 291 | directory=*argv; |
296 | else { | 292 | else { |
297 | fprintf (stderr, "%s\n", mount_usage); | 293 | goto goodbye; |
298 | exit( TRUE); | ||
299 | } | 294 | } |
300 | } | 295 | } |
301 | i--; | 296 | i--; |
@@ -331,9 +326,11 @@ extern int mount_main (int argc, char **argv) | |||
331 | exit (mount_one (device, directory, filesystemType, | 326 | exit (mount_one (device, directory, filesystemType, |
332 | flags, string_flags, useMtab, fakeIt)); | 327 | flags, string_flags, useMtab, fakeIt)); |
333 | } else { | 328 | } else { |
334 | fprintf (stderr, "%s\n", mount_usage); | 329 | goto goodbye; |
335 | exit( FALSE); | ||
336 | } | 330 | } |
337 | } | 331 | } |
338 | exit( TRUE); | 332 | exit( TRUE); |
333 | |||
334 | goodbye: | ||
335 | usage( mount_usage); | ||
339 | } | 336 | } |
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | static const char mv_usage[] = "mv SOURCE DEST\n" | 31 | static const char mv_usage[] = "mv SOURCE DEST\n" |
32 | " or: mv SOURCE... DIRECTORY\n" | 32 | " or: mv SOURCE... DIRECTORY\n\n" |
33 | "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n"; | 33 | "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n"; |
34 | 34 | ||
35 | 35 | ||
diff --git a/procps/ps.c b/procps/ps.c index 55439dada..1f6175318 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -100,7 +100,7 @@ extern int ps_main(int argc, char **argv) | |||
100 | int i, c; | 100 | int i, c; |
101 | 101 | ||
102 | if ( argc>1 && **(argv+1) == '-' ) { | 102 | if ( argc>1 && **(argv+1) == '-' ) { |
103 | usage ("ps - report process status\nThis version of ps accepts no options.\n"); | 103 | usage ("ps\n\nReport process status\n\nThis version of ps accepts no options.\n"); |
104 | } | 104 | } |
105 | 105 | ||
106 | dir = opendir("/proc"); | 106 | dir = opendir("/proc"); |
@@ -100,7 +100,7 @@ extern int ps_main(int argc, char **argv) | |||
100 | int i, c; | 100 | int i, c; |
101 | 101 | ||
102 | if ( argc>1 && **(argv+1) == '-' ) { | 102 | if ( argc>1 && **(argv+1) == '-' ) { |
103 | usage ("ps - report process status\nThis version of ps accepts no options.\n"); | 103 | usage ("ps\n\nReport process status\n\nThis version of ps accepts no options.\n"); |
104 | } | 104 | } |
105 | 105 | ||
106 | dir = opendir("/proc"); | 106 | dir = opendir("/proc"); |
@@ -27,8 +27,9 @@ | |||
27 | #include <utime.h> | 27 | #include <utime.h> |
28 | #include <dirent.h> | 28 | #include <dirent.h> |
29 | 29 | ||
30 | static const char* rm_usage = "rm [OPTION]... FILE...\n" | 30 | static const char* rm_usage = "rm [OPTION]... FILE...\n\n" |
31 | "Remove (unlink) the FILE(s).\n\n" | 31 | "Remove (unlink) the FILE(s).\n\n" |
32 | "Options:\n" | ||
32 | "\t-f\tremove existing destinations, never prompt\n" | 33 | "\t-f\tremove existing destinations, never prompt\n" |
33 | "\t-r\tremove the contents of directories recursively\n"; | 34 | "\t-r\tremove the contents of directories recursively\n"; |
34 | 35 | ||
@@ -29,7 +29,7 @@ | |||
29 | extern int rmdir_main(int argc, char **argv) | 29 | extern int rmdir_main(int argc, char **argv) |
30 | { | 30 | { |
31 | if ( argc==1 || **(argv+1) == '-' ) { | 31 | if ( argc==1 || **(argv+1) == '-' ) { |
32 | usage( "rmdir [OPTION]... DIRECTORY...\nRemove the DIRECTORY(ies), if they are empty."); | 32 | usage( "rmdir [OPTION]... DIRECTORY...\n\nRemove the DIRECTORY(ies), if they are empty.\n"); |
33 | } | 33 | } |
34 | 34 | ||
35 | while (--argc > 0) { | 35 | while (--argc > 0) { |
@@ -32,18 +32,18 @@ | |||
32 | #include <ctype.h> | 32 | #include <ctype.h> |
33 | 33 | ||
34 | static const char sed_usage[] = | 34 | static const char sed_usage[] = |
35 | "sed [-n] [-e script] [file...]\n" | 35 | "sed [-n] [-e script] [file...]\n\n" |
36 | "Allowed scripts come in the following form:\n\n" | 36 | "Allowed sed scripts come in the following form:\n" |
37 | "'s/regexp/replacement/[gp]'\n" | 37 | "\t's/regexp/replacement/[gp]'\n" |
38 | "\tattempt to match regexp against the pattern space\n" | 38 | "which attempt to match regexp against the pattern space\n" |
39 | "\tand if successful replaces the matched portion with replacement.\n\n" | 39 | "and if successful replaces the matched portion with replacement.\n\n" |
40 | "Options:\n" | 40 | "Options:\n" |
41 | "-e\tadd the script to the commands to be executed\n" | 41 | "-e\tadd the script to the commands to be executed\n" |
42 | "-n\tsuppress automatic printing of pattern space\n\n" | 42 | "-n\tsuppress automatic printing of pattern space\n\n" |
43 | #if defined BB_REGEXP | 43 | #if defined BB_REGEXP |
44 | "This version of sed matches full regexps.\n"; | 44 | "This version of sed matches full regular expresions.\n"; |
45 | #else | 45 | #else |
46 | "This version of sed matches strings (not full regexps).\n"; | 46 | "This version of sed matches strings (not full regular expresions).\n"; |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | 49 | ||
@@ -23,8 +23,8 @@ | |||
23 | #include "internal.h" | 23 | #include "internal.h" |
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | 25 | ||
26 | const char sleep_usage[] = " NUMBER\n" | 26 | const char sleep_usage[] = "sleep N\n\n" |
27 | "Pause for NUMBER seconds.\n"; | 27 | "Pause for N seconds.\n"; |
28 | 28 | ||
29 | extern int | 29 | extern int |
30 | sleep_main(int argc, char * * argv) | 30 | sleep_main(int argc, char * * argv) |
@@ -27,7 +27,7 @@ extern int | |||
27 | sync_main(int argc, char * * argv) | 27 | sync_main(int argc, char * * argv) |
28 | { | 28 | { |
29 | if ( argc>1 && **(argv+1) == '-' ) { | 29 | if ( argc>1 && **(argv+1) == '-' ) { |
30 | usage( "sync\nWrite all buffered filesystem blocks to disk.\n"); | 30 | usage( "sync\n\nWrite all buffered filesystem blocks to disk.\n"); |
31 | } | 31 | } |
32 | exit( sync()); | 32 | exit( sync()); |
33 | } | 33 | } |
@@ -35,22 +35,13 @@ | |||
35 | #include <signal.h> | 35 | #include <signal.h> |
36 | #include <time.h> | 36 | #include <time.h> |
37 | 37 | ||
38 | /* Note that tar.c expects TRUE and FALSE to be defined | ||
39 | * exactly the opposite of how they are used everywhere else. | ||
40 | * Some time this should be integrated a bit better, but this | ||
41 | * does the job for now. | ||
42 | */ | ||
43 | //#undef FALSE | ||
44 | //#undef TRUE | ||
45 | //#define FALSE ((int) 0) | ||
46 | //#define TRUE ((int) 1) | ||
47 | |||
48 | 38 | ||
49 | static const char tar_usage[] = | 39 | static const char tar_usage[] = |
50 | "tar -[cxtvOf] [tarFileName] [FILE] ...\n" | 40 | "tar -[cxtvOf] [tarFileName] [FILE] ...\n\n" |
51 | "Create, extract, or list files from a tar file\n\n" | 41 | "Create, extract, or list files from a tar file\n\n" |
52 | "\tc=create, x=extract, t=list contents, v=verbose,\n" | 42 | "Options:\n" |
53 | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; | 43 | "\tc=create, x=extract, t=list contents, v=verbose,\n" |
44 | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; | ||
54 | 45 | ||
55 | 46 | ||
56 | 47 | ||
@@ -96,18 +87,18 @@ typedef struct { | |||
96 | /* | 87 | /* |
97 | * Static data. | 88 | * Static data. |
98 | */ | 89 | */ |
99 | static int listFlag; // | 90 | static int listFlag; |
100 | static int extractFlag; // | 91 | static int extractFlag; |
101 | static int createFlag; // | 92 | static int createFlag; |
102 | static int verboseFlag; // | 93 | static int verboseFlag; |
103 | static int tostdoutFlag; // | 94 | static int tostdoutFlag; |
104 | 95 | ||
105 | static int inHeader; // <- check me | 96 | static int inHeader; // <- check me |
106 | static int badHeader; // | 97 | static int badHeader; |
107 | static int errorFlag; // | 98 | static int errorFlag; |
108 | static int skipFileFlag; // | 99 | static int skipFileFlag; |
109 | static int warnedRoot; // | 100 | static int warnedRoot; |
110 | static int eofFlag; // | 101 | static int eofFlag; |
111 | static long dataCc; | 102 | static long dataCc; |
112 | static int outFd; | 103 | static int outFd; |
113 | static char outName[TAR_NAME_SIZE]; | 104 | static char outName[TAR_NAME_SIZE]; |
@@ -136,7 +127,7 @@ static void readHeader (const TarHeader * hp, | |||
136 | /* | 127 | /* |
137 | * Local procedures to save files into a tar file. | 128 | * Local procedures to save files into a tar file. |
138 | */ | 129 | */ |
139 | static void saveFile (const char *fileName, int seeLinks); // | 130 | static void saveFile (const char *fileName, int seeLinks); |
140 | 131 | ||
141 | static void saveRegularFile (const char *fileName, | 132 | static void saveRegularFile (const char *fileName, |
142 | const struct stat *statbuf); | 133 | const struct stat *statbuf); |
@@ -145,13 +136,13 @@ static void saveDirectory (const char *fileName, | |||
145 | const struct stat *statbuf); | 136 | const struct stat *statbuf); |
146 | 137 | ||
147 | static int wantFileName (const char *fileName, | 138 | static int wantFileName (const char *fileName, |
148 | int fileCount, char **fileTable); // | 139 | int fileCount, char **fileTable); |
149 | 140 | ||
150 | static void writeHeader (const char *fileName, const struct stat *statbuf); | 141 | static void writeHeader (const char *fileName, const struct stat *statbuf); |
151 | 142 | ||
152 | static void writeTarFile (int fileCount, char **fileTable); | 143 | static void writeTarFile (int fileCount, char **fileTable); |
153 | static void writeTarBlock (const char *buf, int len); | 144 | static void writeTarBlock (const char *buf, int len); |
154 | static int putOctal (char *cp, int len, long value); // | 145 | static int putOctal (char *cp, int len, long value); |
155 | 146 | ||
156 | 147 | ||
157 | extern int tar_main (int argc, char **argv) | 148 | extern int tar_main (int argc, char **argv) |
@@ -217,10 +208,13 @@ extern int tar_main (int argc, char **argv) | |||
217 | break; | 208 | break; |
218 | 209 | ||
219 | case '-': | 210 | case '-': |
211 | usage( tar_usage); | ||
220 | break; | 212 | break; |
221 | 213 | ||
222 | default: | 214 | default: |
223 | fprintf (stderr, "Unknown tar flag '%c'\n", *options); | 215 | fprintf (stderr, "Unknown tar flag '%c'\n" |
216 | "Try `tar --help' for more information\n", | ||
217 | *options); | ||
224 | 218 | ||
225 | exit (FALSE); | 219 | exit (FALSE); |
226 | } | 220 | } |
@@ -230,7 +224,6 @@ extern int tar_main (int argc, char **argv) | |||
230 | /* | 224 | /* |
231 | * Validate the options. | 225 | * Validate the options. |
232 | */ | 226 | */ |
233 | fprintf(stderr, "TRUE=%d FALSE=%d\n", TRUE, FALSE); | ||
234 | if (extractFlag + listFlag + createFlag != (TRUE+FALSE+FALSE)) { | 227 | if (extractFlag + listFlag + createFlag != (TRUE+FALSE+FALSE)) { |
235 | fprintf (stderr, | 228 | fprintf (stderr, |
236 | "Exactly one of 'c', 'x' or 't' must be specified\n"); | 229 | "Exactly one of 'c', 'x' or 't' must be specified\n"); |
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | 32 | ||
33 | static const char touch_usage[] = "touch [-c] file [file ...]\n\n" | 33 | static const char touch_usage[] = "touch [-c] file [file ...]\n\n" |
34 | "\tUpdate the last-modified date on the given file[s].\n"; | 34 | "Update the last-modified date on the given file[s].\n"; |
35 | 35 | ||
36 | 36 | ||
37 | 37 | ||
@@ -54,7 +54,7 @@ touch_main(int argc, char **argv) | |||
54 | create = FALSE; | 54 | create = FALSE; |
55 | break; | 55 | break; |
56 | default: | 56 | default: |
57 | fprintf(stderr, "Unknown option: %c\n", **argv); | 57 | usage( touch_usage); |
58 | exit( FALSE); | 58 | exit( FALSE); |
59 | } | 59 | } |
60 | argc--; | 60 | argc--; |
@@ -29,8 +29,8 @@ | |||
29 | #include <errno.h> | 29 | #include <errno.h> |
30 | 30 | ||
31 | static const char umount_usage[] = | 31 | static const char umount_usage[] = |
32 | "Usage: umount [flags] filesystem|directory\n" | 32 | "Usage: umount [flags] filesystem|directory\n\n" |
33 | "Optional Flags:\n" | 33 | "Flags:\n" |
34 | "\t-a:\tUnmount all file systems" | 34 | "\t-a:\tUnmount all file systems" |
35 | #ifdef BB_MTAB | 35 | #ifdef BB_MTAB |
36 | " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n" | 36 | " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n" |
@@ -108,7 +108,7 @@ umount_main(int argc, char** argv) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | /* Parse any options */ | 110 | /* Parse any options */ |
111 | while (argc-- > 0 && **(argv++) == '-') { | 111 | while (--argc > 0 && **(++argv) == '-') { |
112 | while (*++(*argv)) switch (**argv) { | 112 | while (*++(*argv)) switch (**argv) { |
113 | case 'a': | 113 | case 'a': |
114 | umountAll = TRUE; | 114 | umountAll = TRUE; |
@@ -41,8 +41,9 @@ | |||
41 | 41 | ||
42 | 42 | ||
43 | static const char uname_usage[] = | 43 | static const char uname_usage[] = |
44 | "uname [OPTION]...\n" | 44 | "uname [OPTION]...\n\n" |
45 | "Print certain system information. With no OPTION, same as -s.\n" | 45 | "Print certain system information. With no OPTION, same as -s.\n\n" |
46 | "Options:\n" | ||
46 | "\t-a\tprint all information\n" | 47 | "\t-a\tprint all information\n" |
47 | "\t-m\tthe machine (hardware) type\n" | 48 | "\t-m\tthe machine (hardware) type\n" |
48 | "\t-n\tprint the machine's network node hostname\n" | 49 | "\t-n\tprint the machine's network node hostname\n" |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 125274734..d31de20a8 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -191,9 +191,17 @@ static void leave(int status) | |||
191 | } | 191 | } |
192 | 192 | ||
193 | static void show_usage(void) { | 193 | static void show_usage(void) { |
194 | fprintf(stderr, | 194 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); |
195 | "Usage: %s [-larvsmf] /dev/name\n", | 195 | fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n\n", program_name); |
196 | program_name); | 196 | fprintf(stderr, "Performs a consistency check for MINIX filesystems.\n\n"); |
197 | fprintf(stderr, "OPTIONS:\n"); | ||
198 | fprintf(stderr, "\t-l\tLists all filenames\n"); | ||
199 | fprintf(stderr, "\t-r\tPerform interactive repairs\n"); | ||
200 | fprintf(stderr, "\t-a\tPerform automatic repairs\n"); | ||
201 | fprintf(stderr, "\t-v\tverbose\n"); | ||
202 | fprintf(stderr, "\t-s\tOutputs super-block information\n"); | ||
203 | fprintf(stderr, "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n"); | ||
204 | fprintf(stderr, "\t-f\tForce file system check.\n\n"); | ||
197 | leave(16); | 205 | leave(16); |
198 | } | 206 | } |
199 | 207 | ||
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 926a023b4..b90d3a700 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
@@ -171,10 +171,15 @@ static volatile void die(char *str) { | |||
171 | 171 | ||
172 | static volatile void show_usage() | 172 | static volatile void show_usage() |
173 | { | 173 | { |
174 | fprintf(stderr, "%s\n", program_name); | 174 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); |
175 | fprintf(stderr, | 175 | fprintf(stderr, "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n\n", program_name); |
176 | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", | 176 | fprintf(stderr, "Make a MINIX filesystem.\n\n"); |
177 | program_name); | 177 | fprintf(stderr, "OPTIONS:\n"); |
178 | fprintf(stderr, "\t-c\t\tCheck the device for bad blocks\n"); | ||
179 | fprintf(stderr, "\t-n [14|30]\tSpecify the maximum length of filenames\n"); | ||
180 | fprintf(stderr, "\t-i\t\tSpecify the number of inodes for the filesystem\n"); | ||
181 | fprintf(stderr, "\t-l FILENAME\tRead the bad blocks list from FILENAME\n"); | ||
182 | fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n"); | ||
178 | exit(16); | 183 | exit(16); |
179 | } | 184 | } |
180 | 185 | ||
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index fceeb28dd..601188f86 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c | |||
@@ -47,11 +47,12 @@ | |||
47 | /* we also get PAGE_SIZE via getpagesize() */ | 47 | /* we also get PAGE_SIZE via getpagesize() */ |
48 | 48 | ||
49 | 49 | ||
50 | static const char mkswap_usage[] = "mkswap [-c] [-v0|-v1] device [block-count]\n" | 50 | static const char mkswap_usage[] = "mkswap [-c] [-v0|-v1] device [block-count]\n\n" |
51 | "Prepare a disk partition to be used as a swap partition.\n\n" | 51 | "Prepare a disk partition to be used as a swap partition.\n\n" |
52 | "\t-c\tCheck for read-ability.\n" | 52 | "Options:\n" |
53 | "\t-v0\tMake version 0 swap [max 128 Megs].\n" | 53 | "\t-c\t\tCheck for read-ability.\n" |
54 | "\t-v1\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" | 54 | "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" |
55 | "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" | ||
55 | "\tblock-count\tNumber of block to use (default is entire partition).\n"; | 56 | "\tblock-count\tNumber of block to use (default is entire partition).\n"; |
56 | 57 | ||
57 | 58 | ||
diff --git a/util-linux/more.c b/util-linux/more.c index 469316128..515857e0f 100644 --- a/util-linux/more.c +++ b/util-linux/more.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <signal.h> | 37 | #include <signal.h> |
38 | #include <sys/ioctl.h> | 38 | #include <sys/ioctl.h> |
39 | 39 | ||
40 | static const char more_usage[] = "[file ...]"; | 40 | static const char more_usage[] = "more [file ...]\n"; |
41 | 41 | ||
42 | /* ED: sparc termios is broken: revert back to old termio handling. */ | 42 | /* ED: sparc termios is broken: revert back to old termio handling. */ |
43 | #ifdef BB_FEATURE_USE_TERMIOS | 43 | #ifdef BB_FEATURE_USE_TERMIOS |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 4c085d01b..827a56f0a 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -43,7 +43,7 @@ | |||
43 | 43 | ||
44 | extern const char mtab_file[]; /* Defined in utility.c */ | 44 | extern const char mtab_file[]; /* Defined in utility.c */ |
45 | 45 | ||
46 | static const char mount_usage[] = "Usage:\tmount [flags]\n" | 46 | static const char mount_usage[] = "\tmount [flags]\n" |
47 | "\tmount [flags] device directory [-o options,more-options]\n" | 47 | "\tmount [flags] device directory [-o options,more-options]\n" |
48 | "\n" | 48 | "\n" |
49 | "Flags:\n" | 49 | "Flags:\n" |
@@ -248,8 +248,7 @@ extern int mount_main (int argc, char **argv) | |||
248 | while (i>0 && *++(*argv)) switch (**argv) { | 248 | while (i>0 && *++(*argv)) switch (**argv) { |
249 | case 'o': | 249 | case 'o': |
250 | if (--i == 0) { | 250 | if (--i == 0) { |
251 | fprintf (stderr, "%s\n", mount_usage); | 251 | goto goodbye; |
252 | exit( FALSE); | ||
253 | } | 252 | } |
254 | parse_mount_options (*(++argv), &flags, string_flags); | 253 | parse_mount_options (*(++argv), &flags, string_flags); |
255 | --i; | 254 | --i; |
@@ -260,8 +259,7 @@ extern int mount_main (int argc, char **argv) | |||
260 | break; | 259 | break; |
261 | case 't': | 260 | case 't': |
262 | if (--i == 0) { | 261 | if (--i == 0) { |
263 | fprintf (stderr, "%s\n", mount_usage); | 262 | goto goodbye; |
264 | exit( FALSE); | ||
265 | } | 263 | } |
266 | filesystemType = *(++argv); | 264 | filesystemType = *(++argv); |
267 | --i; | 265 | --i; |
@@ -284,9 +282,7 @@ extern int mount_main (int argc, char **argv) | |||
284 | case 'v': | 282 | case 'v': |
285 | case 'h': | 283 | case 'h': |
286 | case '-': | 284 | case '-': |
287 | fprintf (stderr, "%s\n", mount_usage); | 285 | goto goodbye; |
288 | exit( TRUE); | ||
289 | break; | ||
290 | } | 286 | } |
291 | } else { | 287 | } else { |
292 | if (device == NULL) | 288 | if (device == NULL) |
@@ -294,8 +290,7 @@ extern int mount_main (int argc, char **argv) | |||
294 | else if (directory == NULL) | 290 | else if (directory == NULL) |
295 | directory=*argv; | 291 | directory=*argv; |
296 | else { | 292 | else { |
297 | fprintf (stderr, "%s\n", mount_usage); | 293 | goto goodbye; |
298 | exit( TRUE); | ||
299 | } | 294 | } |
300 | } | 295 | } |
301 | i--; | 296 | i--; |
@@ -331,9 +326,11 @@ extern int mount_main (int argc, char **argv) | |||
331 | exit (mount_one (device, directory, filesystemType, | 326 | exit (mount_one (device, directory, filesystemType, |
332 | flags, string_flags, useMtab, fakeIt)); | 327 | flags, string_flags, useMtab, fakeIt)); |
333 | } else { | 328 | } else { |
334 | fprintf (stderr, "%s\n", mount_usage); | 329 | goto goodbye; |
335 | exit( FALSE); | ||
336 | } | 330 | } |
337 | } | 331 | } |
338 | exit( TRUE); | 332 | exit( TRUE); |
333 | |||
334 | goodbye: | ||
335 | usage( mount_usage); | ||
339 | } | 336 | } |
diff --git a/util-linux/umount.c b/util-linux/umount.c index 89c59f9ee..0d105d9c1 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
@@ -29,8 +29,8 @@ | |||
29 | #include <errno.h> | 29 | #include <errno.h> |
30 | 30 | ||
31 | static const char umount_usage[] = | 31 | static const char umount_usage[] = |
32 | "Usage: umount [flags] filesystem|directory\n" | 32 | "Usage: umount [flags] filesystem|directory\n\n" |
33 | "Optional Flags:\n" | 33 | "Flags:\n" |
34 | "\t-a:\tUnmount all file systems" | 34 | "\t-a:\tUnmount all file systems" |
35 | #ifdef BB_MTAB | 35 | #ifdef BB_MTAB |
36 | " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n" | 36 | " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n" |
@@ -108,7 +108,7 @@ umount_main(int argc, char** argv) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | /* Parse any options */ | 110 | /* Parse any options */ |
111 | while (argc-- > 0 && **(argv++) == '-') { | 111 | while (--argc > 0 && **(++argv) == '-') { |
112 | while (*++(*argv)) switch (**argv) { | 112 | while (*++(*argv)) switch (**argv) { |
113 | case 'a': | 113 | case 'a': |
114 | umountAll = TRUE; | 114 | umountAll = TRUE; |
@@ -46,7 +46,7 @@ const char mtab_file[] = "/proc/mounts"; | |||
46 | 46 | ||
47 | 47 | ||
48 | /* volatile so gcc knows this is the enod of the line */ | 48 | /* volatile so gcc knows this is the enod of the line */ |
49 | volatile void usage(const char *usage) | 49 | extern void usage(const char *usage) |
50 | { | 50 | { |
51 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); | 51 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); |
52 | fprintf(stderr, "Usage: %s\n", usage); | 52 | fprintf(stderr, "Usage: %s\n", usage); |