aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-11-10 23:13:02 +0000
committerEric Andersen <andersen@codepoet.org>1999-11-10 23:13:02 +0000
commitd73dc5b07390fb90e7f605871c993a28eedf1d46 (patch)
tree3e448e6550da52d2709e5f52fbae56e9df9462cc
parent84d85680712573c7a8bd7d0491c3f944dc08ad10 (diff)
downloadbusybox-w32-d73dc5b07390fb90e7f605871c993a28eedf1d46.tar.gz
busybox-w32-d73dc5b07390fb90e7f605871c993a28eedf1d46.tar.bz2
busybox-w32-d73dc5b07390fb90e7f605871c993a28eedf1d46.zip
Updates to usage, and made tar work.
-Erik
-rw-r--r--Changelog9
-rw-r--r--applets/busybox.c8
-rw-r--r--archival/tar.c51
-rw-r--r--busybox.c8
-rw-r--r--busybox.def.h25
-rw-r--r--chmod_chown_chgrp.c24
-rw-r--r--chroot.c2
-rw-r--r--chvt.c2
-rw-r--r--console-tools/chvt.c2
-rw-r--r--console-tools/deallocvt.c6
-rw-r--r--coreutils/chroot.c2
-rw-r--r--coreutils/cp.c2
-rw-r--r--coreutils/date.c2
-rw-r--r--coreutils/dd.c5
-rw-r--r--coreutils/ln.c6
-rw-r--r--coreutils/mkdir.c7
-rw-r--r--coreutils/mknod.c6
-rw-r--r--coreutils/mv.c2
-rw-r--r--coreutils/rm.c3
-rw-r--r--coreutils/rmdir.c2
-rw-r--r--coreutils/sleep.c4
-rw-r--r--coreutils/sync.c2
-rw-r--r--coreutils/touch.c4
-rw-r--r--coreutils/uname.c5
-rw-r--r--cp.c2
-rw-r--r--date.c2
-rw-r--r--dd.c5
-rw-r--r--deallocvt.c6
-rw-r--r--editors/sed.c14
-rw-r--r--find.c15
-rw-r--r--findutils/find.c15
-rw-r--r--findutils/grep.c7
-rw-r--r--fsck_minix.c14
-rw-r--r--grep.c7
-rw-r--r--init.c7
-rw-r--r--init/init.c7
-rw-r--r--internal.h2
-rw-r--r--ln.c6
-rw-r--r--mkdir.c7
-rw-r--r--mkfs_minix.c13
-rw-r--r--mknod.c6
-rw-r--r--mkswap.c9
-rw-r--r--more.c2
-rw-r--r--mount.c21
-rw-r--r--mv.c2
-rw-r--r--procps/ps.c2
-rw-r--r--ps.c2
-rw-r--r--rm.c3
-rw-r--r--rmdir.c2
-rw-r--r--sed.c14
-rw-r--r--sleep.c4
-rw-r--r--sync.c2
-rw-r--r--tar.c51
-rw-r--r--touch.c4
-rw-r--r--umount.c6
-rw-r--r--uname.c5
-rw-r--r--util-linux/fsck_minix.c14
-rw-r--r--util-linux/mkfs_minix.c13
-rw-r--r--util-linux/mkswap.c9
-rw-r--r--util-linux/more.c2
-rw-r--r--util-linux/mount.c21
-rw-r--r--util-linux/umount.c6
-rw-r--r--utility.c2
63 files changed, 290 insertions, 230 deletions
diff --git a/Changelog b/Changelog
index 916e6940c..7279efe64 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,12 @@
10.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
10.34 100.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
49static const char tar_usage[] = 39static 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 */
99static int listFlag; // 90static int listFlag;
100static int extractFlag; // 91static int extractFlag;
101static int createFlag; // 92static int createFlag;
102static int verboseFlag; // 93static int verboseFlag;
103static int tostdoutFlag; // 94static int tostdoutFlag;
104 95
105static int inHeader; // <- check me 96static int inHeader; // <- check me
106static int badHeader; // 97static int badHeader;
107static int errorFlag; // 98static int errorFlag;
108static int skipFileFlag; // 99static int skipFileFlag;
109static int warnedRoot; // 100static int warnedRoot;
110static int eofFlag; // 101static int eofFlag;
111static long dataCc; 102static long dataCc;
112static int outFd; 103static int outFd;
113static char outName[TAR_NAME_SIZE]; 104static 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 */
139static void saveFile (const char *fileName, int seeLinks); // 130static void saveFile (const char *fileName, int seeLinks);
140 131
141static void saveRegularFile (const char *fileName, 132static 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
147static int wantFileName (const char *fileName, 138static int wantFileName (const char *fileName,
148 int fileCount, char **fileTable); // 139 int fileCount, char **fileTable);
149 140
150static void writeHeader (const char *fileName, const struct stat *statbuf); 141static void writeHeader (const char *fileName, const struct stat *statbuf);
151 142
152static void writeTarFile (int fileCount, char **fileTable); 143static void writeTarFile (int fileCount, char **fileTable);
153static void writeTarBlock (const char *buf, int len); 144static void writeTarBlock (const char *buf, int len);
154static int putOctal (char *cp, int len, long value); // 145static int putOctal (char *cp, int len, long value);
155 146
156 147
157extern int tar_main (int argc, char **argv) 148extern 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");
diff --git a/busybox.c b/busybox.c
index 29a112b12..c45d0c7e2 100644
--- a/busybox.c
+++ b/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/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
41static const char chgrp_usage[] = "[OPTION]... GROUP FILE...\n" 41static 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";
44static const char chown_usage[] = "[OPTION]... OWNER[.[GROUP] FILE...\n" 44static 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";
47static const char chmod_usage[] = "[-R] MODE[,MODE]... FILE...\n" 47static 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
53static int fileAction(const char *fileName, struct stat* statbuf) 53static 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++;
diff --git a/chroot.c b/chroot.c
index 8e432b36c..16524d92e 100644
--- a/chroot.c
+++ b/chroot.c
@@ -27,7 +27,7 @@
27#include <errno.h> 27#include <errno.h>
28 28
29 29
30static const char chroot_usage[] = "NEWROOT [COMMAND...]\n" 30static 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/chvt.c b/chvt.c
index 81d199527..bea00ea83 100644
--- a/chvt.c
+++ b/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/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
17deallocvt_main(int argc, char *argv[]) { 17deallocvt_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
30static const char chroot_usage[] = "NEWROOT [COMMAND...]\n" 30static 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
30static const char cp_usage[] = "cp [OPTION]... SOURCE DEST\n" 30static 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
37static const char date_usage[] = "date [OPTION]... [+FORMAT]\n" 37static 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
36static const char dd_usage[] = 36static 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
30static const char ln_usage[] = "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n" 30static 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
29static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n" 29static 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
35static int parentFlag = FALSE; 36static 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
30static const char mknod_usage[] = "mknod file b|c|u|p major minor\n" 30static 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
31static const char mv_usage[] = "mv SOURCE DEST\n" 31static 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
30static const char* rm_usage = "rm [OPTION]... FILE...\n" 30static 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 @@
29extern int rmdir_main(int argc, char **argv) 29extern 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
26const char sleep_usage[] = " NUMBER\n" 26const char sleep_usage[] = "sleep N\n\n"
27"Pause for NUMBER seconds.\n"; 27"Pause for N seconds.\n";
28 28
29extern int 29extern int
30sleep_main(int argc, char * * argv) 30sleep_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
27sync_main(int argc, char * * argv) 27sync_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
33static const char touch_usage[] = "touch [-c] file [file ...]\n\n" 33static 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
43static const char uname_usage[] = 43static 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/cp.c b/cp.c
index 9dac2afbc..57158c820 100644
--- a/cp.c
+++ b/cp.c
@@ -28,7 +28,7 @@
28#include <dirent.h> 28#include <dirent.h>
29 29
30static const char cp_usage[] = "cp [OPTION]... SOURCE DEST\n" 30static 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/date.c b/date.c
index 501ccc28f..6be89df3e 100644
--- a/date.c
+++ b/date.c
@@ -35,7 +35,7 @@
35 mail commands */ 35 mail commands */
36 36
37static const char date_usage[] = "date [OPTION]... [+FORMAT]\n" 37static 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/dd.c b/dd.c
index 33c45940e..800ed59f8 100644
--- a/dd.c
+++ b/dd.c
@@ -34,7 +34,7 @@
34#include <errno.h> 34#include <errno.h>
35 35
36static const char dd_usage[] = 36static 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
17deallocvt_main(int argc, char *argv[]) { 17deallocvt_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
34static const char sed_usage[] = 34static 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
diff --git a/find.c b/find.c
index ab9ebf434..0f1f5f189 100644
--- a/find.c
+++ b/find.c
@@ -32,9 +32,18 @@ static char* pattern=NULL;
32static char* directory="."; 32static char* directory=".";
33static int dereferenceFlag=FALSE; 33static int dereferenceFlag=FALSE;
34 34
35static const char find_usage[] = "find [path...] [expression]\n" 35static 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;
32static char* directory="."; 32static char* directory=".";
33static int dereferenceFlag=FALSE; 33static int dereferenceFlag=FALSE;
34 34
35static const char find_usage[] = "find [path...] [expression]\n" 35static 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
34static const char grep_usage[] = 34static 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
193static void show_usage(void) { 193static 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/grep.c b/grep.c
index 8dcff0586..84bb99667 100644
--- a/grep.c
+++ b/grep.c
@@ -32,15 +32,16 @@
32#include <ctype.h> 32#include <ctype.h>
33 33
34static const char grep_usage[] = 34static 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/init.c b/init.c
index a354f8a75..e70d5a15d 100644
--- a/init.c
+++ b/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/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
139extern void createPath (const char *name, int mode); 139extern void createPath (const char *name, int mode);
140extern int parse_mode( const char* s, mode_t* theMode); 140extern int parse_mode( const char* s, mode_t* theMode);
141extern volatile void usage(const char *usage); 141extern void usage(const char *usage) __attribute__ ((noreturn));
142 142
143extern uid_t my_getpwnam(char *name); 143extern uid_t my_getpwnam(char *name);
144extern gid_t my_getgrnam(char *name); 144extern gid_t my_getgrnam(char *name);
diff --git a/ln.c b/ln.c
index 62496fba0..60fe39438 100644
--- a/ln.c
+++ b/ln.c
@@ -27,9 +27,9 @@
27#include <errno.h> 27#include <errno.h>
28 28
29 29
30static const char ln_usage[] = "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n" 30static 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/mkdir.c b/mkdir.c
index 0d0a90ec3..4c7ebed6a 100644
--- a/mkdir.c
+++ b/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
29static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n" 29static 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
35static int parentFlag = FALSE; 36static 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
172static volatile void show_usage() 172static 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/mknod.c b/mknod.c
index 81c846b98..c3389cc71 100644
--- a/mknod.c
+++ b/mknod.c
@@ -27,9 +27,9 @@
27#include <fcntl.h> 27#include <fcntl.h>
28#include <unistd.h> 28#include <unistd.h>
29 29
30static const char mknod_usage[] = "mknod file b|c|u|p major minor\n" 30static 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/mkswap.c b/mkswap.c
index fceeb28dd..601188f86 100644
--- a/mkswap.c
+++ b/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
50static const char mkswap_usage[] = "mkswap [-c] [-v0|-v1] device [block-count]\n" 50static 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/more.c b/more.c
index 469316128..515857e0f 100644
--- a/more.c
+++ b/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
40static const char more_usage[] = "[file ...]"; 40static 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/mount.c b/mount.c
index 4c085d01b..827a56f0a 100644
--- a/mount.c
+++ b/mount.c
@@ -43,7 +43,7 @@
43 43
44extern const char mtab_file[]; /* Defined in utility.c */ 44extern const char mtab_file[]; /* Defined in utility.c */
45 45
46static const char mount_usage[] = "Usage:\tmount [flags]\n" 46static 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
334goodbye:
335 usage( mount_usage);
339} 336}
diff --git a/mv.c b/mv.c
index e502250ec..b861ab7e6 100644
--- a/mv.c
+++ b/mv.c
@@ -29,7 +29,7 @@
29 29
30 30
31static const char mv_usage[] = "mv SOURCE DEST\n" 31static 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");
diff --git a/ps.c b/ps.c
index 55439dada..1f6175318 100644
--- a/ps.c
+++ b/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");
diff --git a/rm.c b/rm.c
index 077e792f9..e6132ab35 100644
--- a/rm.c
+++ b/rm.c
@@ -27,8 +27,9 @@
27#include <utime.h> 27#include <utime.h>
28#include <dirent.h> 28#include <dirent.h>
29 29
30static const char* rm_usage = "rm [OPTION]... FILE...\n" 30static 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/rmdir.c b/rmdir.c
index 56b838736..013fef1a4 100644
--- a/rmdir.c
+++ b/rmdir.c
@@ -29,7 +29,7 @@
29extern int rmdir_main(int argc, char **argv) 29extern 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/sed.c b/sed.c
index 34756e09a..4dfc0246c 100644
--- a/sed.c
+++ b/sed.c
@@ -32,18 +32,18 @@
32#include <ctype.h> 32#include <ctype.h>
33 33
34static const char sed_usage[] = 34static 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
diff --git a/sleep.c b/sleep.c
index 826697824..bfbb78f61 100644
--- a/sleep.c
+++ b/sleep.c
@@ -23,8 +23,8 @@
23#include "internal.h" 23#include "internal.h"
24#include <stdio.h> 24#include <stdio.h>
25 25
26const char sleep_usage[] = " NUMBER\n" 26const char sleep_usage[] = "sleep N\n\n"
27"Pause for NUMBER seconds.\n"; 27"Pause for N seconds.\n";
28 28
29extern int 29extern int
30sleep_main(int argc, char * * argv) 30sleep_main(int argc, char * * argv)
diff --git a/sync.c b/sync.c
index cb4690c02..145ed1eda 100644
--- a/sync.c
+++ b/sync.c
@@ -27,7 +27,7 @@ extern int
27sync_main(int argc, char * * argv) 27sync_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/tar.c b/tar.c
index c23805993..ed6f3b6b5 100644
--- a/tar.c
+++ b/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
49static const char tar_usage[] = 39static 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 */
99static int listFlag; // 90static int listFlag;
100static int extractFlag; // 91static int extractFlag;
101static int createFlag; // 92static int createFlag;
102static int verboseFlag; // 93static int verboseFlag;
103static int tostdoutFlag; // 94static int tostdoutFlag;
104 95
105static int inHeader; // <- check me 96static int inHeader; // <- check me
106static int badHeader; // 97static int badHeader;
107static int errorFlag; // 98static int errorFlag;
108static int skipFileFlag; // 99static int skipFileFlag;
109static int warnedRoot; // 100static int warnedRoot;
110static int eofFlag; // 101static int eofFlag;
111static long dataCc; 102static long dataCc;
112static int outFd; 103static int outFd;
113static char outName[TAR_NAME_SIZE]; 104static 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 */
139static void saveFile (const char *fileName, int seeLinks); // 130static void saveFile (const char *fileName, int seeLinks);
140 131
141static void saveRegularFile (const char *fileName, 132static 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
147static int wantFileName (const char *fileName, 138static int wantFileName (const char *fileName,
148 int fileCount, char **fileTable); // 139 int fileCount, char **fileTable);
149 140
150static void writeHeader (const char *fileName, const struct stat *statbuf); 141static void writeHeader (const char *fileName, const struct stat *statbuf);
151 142
152static void writeTarFile (int fileCount, char **fileTable); 143static void writeTarFile (int fileCount, char **fileTable);
153static void writeTarBlock (const char *buf, int len); 144static void writeTarBlock (const char *buf, int len);
154static int putOctal (char *cp, int len, long value); // 145static int putOctal (char *cp, int len, long value);
155 146
156 147
157extern int tar_main (int argc, char **argv) 148extern 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");
diff --git a/touch.c b/touch.c
index b98a2e4c8..d2d3e9484 100644
--- a/touch.c
+++ b/touch.c
@@ -31,7 +31,7 @@
31 31
32 32
33static const char touch_usage[] = "touch [-c] file [file ...]\n\n" 33static 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/umount.c b/umount.c
index 89c59f9ee..0d105d9c1 100644
--- a/umount.c
+++ b/umount.c
@@ -29,8 +29,8 @@
29#include <errno.h> 29#include <errno.h>
30 30
31static const char umount_usage[] = 31static 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;
diff --git a/uname.c b/uname.c
index b54deb345..9083edb04 100644
--- a/uname.c
+++ b/uname.c
@@ -41,8 +41,9 @@
41 41
42 42
43static const char uname_usage[] = 43static 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
193static void show_usage(void) { 193static 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
172static volatile void show_usage() 172static 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
50static const char mkswap_usage[] = "mkswap [-c] [-v0|-v1] device [block-count]\n" 50static 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
40static const char more_usage[] = "[file ...]"; 40static 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
44extern const char mtab_file[]; /* Defined in utility.c */ 44extern const char mtab_file[]; /* Defined in utility.c */
45 45
46static const char mount_usage[] = "Usage:\tmount [flags]\n" 46static 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
334goodbye:
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
31static const char umount_usage[] = 31static 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;
diff --git a/utility.c b/utility.c
index cdf027a02..77eb5f2dd 100644
--- a/utility.c
+++ b/utility.c
@@ -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 */
49volatile void usage(const char *usage) 49extern 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);