aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-10-18 22:28:26 +0000
committerEric Andersen <andersen@codepoet.org>1999-10-18 22:28:26 +0000
commitb0e9a709ba1ae1724d413a77f5b67b1a3e6c6cb7 (patch)
treeb951f34000ebdef0491eecd9386e5ea3e535171a
parent703c62da63aa31d665a8215f373b26e4b54f1bf4 (diff)
downloadbusybox-b0e9a709ba1ae1724d413a77f5b67b1a3e6c6cb7.tar.gz
More stuff.
-Erik
-rw-r--r--applets/busybox.c3
-rw-r--r--busybox.c3
-rw-r--r--busybox.def.h21
-rw-r--r--cat.c3
-rw-r--r--chroot.c3
-rw-r--r--console-tools/loadkmap.c2
-rw-r--r--coreutils/cat.c3
-rw-r--r--coreutils/chroot.c3
-rw-r--r--coreutils/cp.c6
-rw-r--r--coreutils/date.c16
-rw-r--r--coreutils/length.c3
-rw-r--r--coreutils/ln.c6
-rw-r--r--coreutils/ls.c9
-rw-r--r--coreutils/mkdir.c6
-rw-r--r--coreutils/mknod.c15
-rw-r--r--coreutils/mv.c3
-rw-r--r--coreutils/printf.c14
-rw-r--r--coreutils/rm.c8
-rw-r--r--coreutils/rmdir.c3
-rw-r--r--coreutils/sleep.c3
-rw-r--r--coreutils/sync.c5
-rw-r--r--coreutils/touch.c3
-rw-r--r--cp.c6
-rw-r--r--date.c16
-rw-r--r--dmesg.c2
-rw-r--r--dutmp.c3
-rw-r--r--fdflush.c3
-rw-r--r--find.c6
-rw-r--r--findutils/find.c6
-rw-r--r--internal.h2
-rw-r--r--kill.c3
-rw-r--r--length.c3
-rw-r--r--ln.c6
-rw-r--r--loadkmap.c2
-rw-r--r--ls.c9
-rw-r--r--makedevs.c4
-rw-r--r--miscutils/dutmp.c3
-rw-r--r--miscutils/makedevs.c4
-rw-r--r--miscutils/mt.c17
-rw-r--r--mkdir.c6
-rw-r--r--mknod.c15
-rw-r--r--mkswap.c17
-rw-r--r--more.c3
-rw-r--r--mt.c17
-rw-r--r--mv.c3
-rw-r--r--printf.c14
-rw-r--r--procps/kill.c3
-rw-r--r--rm.c8
-rw-r--r--rmdir.c3
-rw-r--r--sleep.c3
-rw-r--r--swaponoff.c10
-rw-r--r--sync.c5
-rw-r--r--touch.c3
-rw-r--r--umount.c6
-rw-r--r--util-linux/dmesg.c2
-rw-r--r--util-linux/fdflush.c3
-rw-r--r--util-linux/mkswap.c17
-rw-r--r--util-linux/more.c3
-rw-r--r--util-linux/swaponoff.c10
-rw-r--r--util-linux/umount.c6
-rw-r--r--utility.c8
61 files changed, 168 insertions, 233 deletions
diff --git a/applets/busybox.c b/applets/busybox.c
index 6bc223a1d..16ccce67e 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -75,9 +75,6 @@ static const struct Applet applets[] = {
#ifdef BB_LOADKMAP //sbin
{"loadkmap", loadkmap_main},
#endif
-#ifdef BB_LOSETUP //sbin
- {"losetup", losetup_main},
-#endif
#ifdef BB_LS //bin
{"ls", ls_main},
#endif
diff --git a/busybox.c b/busybox.c
index 6bc223a1d..16ccce67e 100644
--- a/busybox.c
+++ b/busybox.c
@@ -75,9 +75,6 @@ static const struct Applet applets[] = {
#ifdef BB_LOADKMAP //sbin
{"loadkmap", loadkmap_main},
#endif
-#ifdef BB_LOSETUP //sbin
- {"losetup", losetup_main},
-#endif
#ifdef BB_LS //bin
{"ls", ls_main},
#endif
diff --git a/busybox.def.h b/busybox.def.h
index c278f4ce0..7ca522b3a 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -18,25 +18,24 @@
#define BB_FDFLUSH
#define BB_FIND
#define BB_GREP
-#define BB_HALT
+//#define BB_HALT
#define BB_INIT
#define BB_KILL
-#define BB_LENGTH
+//#define BB_LENGTH
#define BB_LN
-//#define BB_LOADKMAP
-////#define BB_LOSETUP
+#define BB_LOADKMAP
#define BB_LS
-//#define BB_MAKEDEVS
-#define BB_MATH
+#define BB_MAKEDEVS
+//#define BB_MATH
#define BB_MKDIR
-//#define BB_MKNOD
-////#define BB_MKSWAP
+#define BB_MKNOD
+//#define BB_MKSWAP
#define BB_MNC
#define BB_MORE
#define BB_MOUNT
-////#define BB_MT
+//#define BB_MT
#define BB_MV
-//#define BB_PRINTF
+#define BB_PRINTF
#define BB_PWD
#define BB_REBOOT
#define BB_RM
@@ -51,4 +50,4 @@
#define BB_UPDATE
#define BB_UTILITY
#define BB_ZCAT
-//#define BB_GZIP
+#define BB_GZIP
diff --git a/cat.c b/cat.c
index 5c54c4941..38078d505 100644
--- a/cat.c
+++ b/cat.c
@@ -42,8 +42,7 @@ extern int cat_more_main(int argc, char **argv)
}
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: cat [file ...]\n");
- exit(FALSE);
+ usage ("cat [file ...]\n");
}
argc--;
argv++;
diff --git a/chroot.c b/chroot.c
index 3b6fdae3b..15f446881 100644
--- a/chroot.c
+++ b/chroot.c
@@ -33,8 +33,7 @@ static const char chroot_usage[] = "NEWROOT [COMMAND...]\n"
int chroot_main(int argc, char **argv)
{
if ( (argc < 2) || (**(argv+1) == '-') ) {
- fprintf(stderr, "Usage: %s %s", *argv, chroot_usage);
- exit( FALSE);
+ usage( chroot_usage);
}
argc--;
argv++;
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c
index 0f092d193..eb5a5dd4a 100644
--- a/console-tools/loadkmap.c
+++ b/console-tools/loadkmap.c
@@ -14,7 +14,7 @@ const char loadkmap_usage[] = "loadkmap\n"
int
-loadkmap_main(struct FileInfo * info, int argc, char * * argv)
+loadkmap_main(int argc, char * * argv)
{
struct kbentry ke;
u_short *ibuff;
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 5c54c4941..38078d505 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -42,8 +42,7 @@ extern int cat_more_main(int argc, char **argv)
}
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: cat [file ...]\n");
- exit(FALSE);
+ usage ("cat [file ...]\n");
}
argc--;
argv++;
diff --git a/coreutils/chroot.c b/coreutils/chroot.c
index 3b6fdae3b..15f446881 100644
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
@@ -33,8 +33,7 @@ static const char chroot_usage[] = "NEWROOT [COMMAND...]\n"
int chroot_main(int argc, char **argv)
{
if ( (argc < 2) || (**(argv+1) == '-') ) {
- fprintf(stderr, "Usage: %s %s", *argv, chroot_usage);
- exit( FALSE);
+ usage( chroot_usage);
}
argc--;
argv++;
diff --git a/coreutils/cp.c b/coreutils/cp.c
index c5e34d333..11c76825c 100644
--- a/coreutils/cp.c
+++ b/coreutils/cp.c
@@ -60,8 +60,7 @@ extern int cp_main(int argc, char **argv)
{
if (argc < 3) {
- fprintf(stderr, "Usage: %s", cp_usage);
- exit (FALSE);
+ usage (cp_usage);
}
argc--;
argv++;
@@ -85,8 +84,7 @@ extern int cp_main(int argc, char **argv)
recursiveFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", cp_usage);
- exit(FALSE);
+ usage (cp_usage);
}
argc--;
argv++;
diff --git a/coreutils/date.c b/coreutils/date.c
index 2df9e0cc7..70d5dd5c6 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -34,7 +34,7 @@
an RFC 822 complient date output for shell scripting
mail commands */
-const char date_usage[] = "Usage: date [OPTION]... [+FORMAT]\n"
+const char date_usage[] = "date [OPTION]... [+FORMAT]\n"
" or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n"
"Display the current time in the given FORMAT, or set the system date.\n"
"\nOptions:\n\t-R\t\toutput RFC-822 compliant date string\n"
@@ -159,12 +159,6 @@ date_conv_ftime(struct tm *tm_time, const char *t_string) {
}
-void
-date_err(void) {
- fprintf (stderr, "%s\n", date_usage);
- exit( FALSE);
-}
-
int
date_main(int argc, char * * argv)
{
@@ -190,7 +184,7 @@ date_main(int argc, char * * argv)
break;
case 's':
set_time = 1;
- if(date_str != NULL) date_err();
+ if(date_str != NULL) usage ( date_usage);
date_str = optarg;
break;
case 'u':
@@ -202,11 +196,11 @@ date_main(int argc, char * * argv)
/* Look ma, no break. Don't fix it either. */
case 'd':
use_arg = 1;
- if(date_str != NULL) date_err();
+ if(date_str != NULL) usage ( date_usage);
date_str = optarg;
break;
case '-':
- date_err();
+ usage ( date_usage);
}
} else {
if ( (date_fmt == NULL) && (strcmp(*argv, "+")==0) )
@@ -215,7 +209,7 @@ date_main(int argc, char * * argv)
set_time = 1;
date_str=*argv;
} else {
- date_err();
+ usage ( date_usage);
}
}
i--;
diff --git a/coreutils/length.c b/coreutils/length.c
index f2dadd25c..46242b529 100644
--- a/coreutils/length.c
+++ b/coreutils/length.c
@@ -7,8 +7,7 @@ extern int
length_main(int argc, char * * argv)
{
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: length string\n");
- exit(FALSE);
+ usage("length string\n");
}
printf("%d\n", strlen(argv[1]));
return( TRUE);
diff --git a/coreutils/ln.c b/coreutils/ln.c
index cd3cb4e45..8f7719fa4 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -44,8 +44,7 @@ extern int ln_main(int argc, char **argv)
char newdestName[NAME_MAX];
if (argc < 3) {
- fprintf(stderr, "Usage: %s", ln_usage);
- exit (FALSE);
+ usage (ln_usage);
}
argc--;
argv++;
@@ -61,8 +60,7 @@ extern int ln_main(int argc, char **argv)
removeoldFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", ln_usage);
- exit(FALSE);
+ usage (ln_usage);
}
argc--;
argv++;
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 2e3d50e9f..0adc35de1 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -19,6 +19,8 @@
*
*/
+// I started writing a newer small one, but it isn't done yet....
+// -Erik
#if fooBar
#include <stdio.h>
@@ -110,8 +112,7 @@ int ls_main(int argc, char **argv)
recursiveFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", ls_usage);
- exit( FALSE);
+ usage (ls_usage);
}
argc--;
argv++;
@@ -571,7 +572,7 @@ listerr:
return 1;
}
-const char ls_usage[] = "Usage: ls [-1a"
+const char ls_usage[] = "ls [-1a"
#ifdef FEATURE_TIMESTAMPS
"c"
#endif
@@ -668,7 +669,7 @@ ls_main(int argc, char * * argv)
exit( i);
print_usage_message:
- fprintf(stderr, "Usage: %s\n", ls_usage);
+ usage (ls_usage);
exit( FALSE);
}
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 61d35d5cd..b42899a4a 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -51,8 +51,7 @@ extern int mkdir_main(int argc, char **argv)
parentFlag = TRUE;
break;
default:
- fprintf(stderr, "%s\n", mkdir_usage);
- exit(FALSE);
+ usage( mkdir_usage);
}
argc--;
argv++;
@@ -60,8 +59,7 @@ extern int mkdir_main(int argc, char **argv)
if (argc < 1) {
- fprintf(stderr, "%s\n", mkdir_usage);
- exit (FALSE);
+ usage( mkdir_usage);
}
while (--argc > 0) {
diff --git a/coreutils/mknod.c b/coreutils/mknod.c
index b18394bec..95d7de360 100644
--- a/coreutils/mknod.c
+++ b/coreutils/mknod.c
@@ -1,4 +1,5 @@
#include "internal.h"
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -13,7 +14,7 @@ const char mknod_usage[] = "mknod file b|c|u|p major minor\n"
"\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n";
int
-mknod_main(struct FileInfo * i, int argc, char * * argv)
+mknod_main(int argc, char** argv)
{
mode_t mode = 0;
dev_t dev = 0;
@@ -30,23 +31,21 @@ mknod_main(struct FileInfo * i, int argc, char * * argv)
mode = S_IFIFO;
break;
default:
- usage(mknod_usage);
- return 1;
+ usage (mknod_usage);
}
if ( mode == S_IFCHR || mode == S_IFBLK ) {
dev = (atoi(argv[3]) << 8) | atoi(argv[4]);
if ( argc != 5 ) {
- usage(mknod_usage);
- return 1;
+ usage (mknod_usage);
}
}
mode |= 0666;
if ( mknod(argv[1], mode, dev) != 0 ) {
- name_and_error(argv[1]);
- return 1;
+ perror(argv[1]);
+ return( FALSE);
}
- return 0;
+ return( TRUE);
}
diff --git a/coreutils/mv.c b/coreutils/mv.c
index 2a7c8c1f3..ab3fc2bd5 100644
--- a/coreutils/mv.c
+++ b/coreutils/mv.c
@@ -42,8 +42,7 @@ extern int mv_main(int argc, char **argv)
char newdestName[NAME_MAX];
if (argc < 3) {
- fprintf(stderr, "Usage: %s", mv_usage);
- exit (FALSE);
+ usage (mv_usage);
}
argc--;
argv++;
diff --git a/coreutils/printf.c b/coreutils/printf.c
index e79843c80..4d4465943 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -1,8 +1,3 @@
-// I may still need some more cleaning...fix my error checking
-
-#include "internal.h"
-#ifdef BB_PRINTF
-
/* printf - format and print data
Copyright (C) 90, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
@@ -51,6 +46,7 @@
// 19990508 Busy Boxed! Dave Cinege
+#include "internal.h"
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
@@ -140,15 +136,18 @@ static void verify __P ((char *s, char *end));
/* The value to return to the calling program. */
static int exit_status;
-const char printf_usage[] = "Usage: printf format [argument...]\n";
+const char printf_usage[] = "printf format [argument...]\n";
int
-printf_main(struct FileInfo * i, int argc, char * * argv)
+printf_main(int argc, char** argv)
{
char *format;
int args_used;
exit_status = 0;
+ if ( **(argv+1) == '-' ) {
+ usage (printf_usage);
+ }
format = argv[1];
argc -= 2;
@@ -528,4 +527,3 @@ verify (char *s, char *end)
}
}
-#endif
diff --git a/coreutils/rm.c b/coreutils/rm.c
index 477d3af59..dd8dfa4e6 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
@@ -25,7 +25,7 @@
#include <utime.h>
#include <dirent.h>
-static const char* rm_usage = "Usage: rm [OPTION]... FILE...\n"
+static const char* rm_usage = "rm [OPTION]... FILE...\n"
"Remove (unlink) the FILE(s).\n\n"
"\t-f\tremove existing destinations, never prompt\n"
"\t-r\tremove the contents of directories recursively\n";
@@ -58,8 +58,7 @@ extern int rm_main(int argc, char **argv)
{
if (argc < 2) {
- fprintf(stderr, "Usage: %s", rm_usage);
- exit (FALSE);
+ usage( rm_usage);
}
argc--;
argv++;
@@ -75,8 +74,7 @@ extern int rm_main(int argc, char **argv)
forceFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", rm_usage);
- exit(FALSE);
+ usage( rm_usage);
}
argc--;
argv++;
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index b4da03f12..666e0476a 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -27,8 +27,7 @@
extern int rmdir_main(int argc, char **argv)
{
if ( argc==1 || **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: rmdir [OPTION]... DIRECTORY...\nRemove the DIRECTORY(ies), if they are empty.");
- exit(FALSE);
+ usage( "rmdir [OPTION]... DIRECTORY...\nRemove the DIRECTORY(ies), if they are empty.");
}
while (--argc > 0) {
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index 53fe5a0c2..7e38a3667 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -8,8 +8,7 @@ extern int
sleep_main(int argc, char * * argv)
{
if ( (argc < 2) || (**(argv+1) == '-') ) {
- fprintf(stderr, "Usage: %s %s", *argv, sleep_usage);
- exit(FALSE);
+ usage( sleep_usage );
}
if ( sleep(atoi(*(++argv))) != 0 ) {
diff --git a/coreutils/sync.c b/coreutils/sync.c
index 572d74924..8800f2e76 100644
--- a/coreutils/sync.c
+++ b/coreutils/sync.c
@@ -5,9 +5,8 @@ extern int
sync_main(int argc, char * * argv)
{
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: sync\nWrite all buffered filesystem blocks to disk.\n");
- exit(FALSE);
+ usage( "sync\nWrite all buffered filesystem blocks to disk.\n");
}
- return sync();
+ return sync();
}
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 8dac10294..c36ffca90 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -40,8 +40,7 @@ touch_main(int argc, char **argv)
int create=TRUE;
if (argc < 2) {
- fprintf(stderr, "Usage: %s %s", *argv, touch_usage);
- exit( FALSE);
+ usage( touch_usage);
}
argc--;
argv++;
diff --git a/cp.c b/cp.c
index c5e34d333..11c76825c 100644
--- a/cp.c
+++ b/cp.c
@@ -60,8 +60,7 @@ extern int cp_main(int argc, char **argv)
{
if (argc < 3) {
- fprintf(stderr, "Usage: %s", cp_usage);
- exit (FALSE);
+ usage (cp_usage);
}
argc--;
argv++;
@@ -85,8 +84,7 @@ extern int cp_main(int argc, char **argv)
recursiveFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", cp_usage);
- exit(FALSE);
+ usage (cp_usage);
}
argc--;
argv++;
diff --git a/date.c b/date.c
index 2df9e0cc7..70d5dd5c6 100644
--- a/date.c
+++ b/date.c
@@ -34,7 +34,7 @@
an RFC 822 complient date output for shell scripting
mail commands */
-const char date_usage[] = "Usage: date [OPTION]... [+FORMAT]\n"
+const char date_usage[] = "date [OPTION]... [+FORMAT]\n"
" or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n"
"Display the current time in the given FORMAT, or set the system date.\n"
"\nOptions:\n\t-R\t\toutput RFC-822 compliant date string\n"
@@ -159,12 +159,6 @@ date_conv_ftime(struct tm *tm_time, const char *t_string) {
}
-void
-date_err(void) {
- fprintf (stderr, "%s\n", date_usage);
- exit( FALSE);
-}
-
int
date_main(int argc, char * * argv)
{
@@ -190,7 +184,7 @@ date_main(int argc, char * * argv)
break;
case 's':
set_time = 1;
- if(date_str != NULL) date_err();
+ if(date_str != NULL) usage ( date_usage);
date_str = optarg;
break;
case 'u':
@@ -202,11 +196,11 @@ date_main(int argc, char * * argv)
/* Look ma, no break. Don't fix it either. */
case 'd':
use_arg = 1;
- if(date_str != NULL) date_err();
+ if(date_str != NULL) usage ( date_usage);
date_str = optarg;
break;
case '-':
- date_err();
+ usage ( date_usage);
}
} else {
if ( (date_fmt == NULL) && (strcmp(*argv, "+")==0) )
@@ -215,7 +209,7 @@ date_main(int argc, char * * argv)
set_time = 1;
date_str=*argv;
} else {
- date_err();
+ usage ( date_usage);
}
}
i--;
diff --git a/dmesg.c b/dmesg.c
index 64265b473..e5d403f7a 100644
--- a/dmesg.c
+++ b/dmesg.c
@@ -93,6 +93,6 @@ int dmesg_main (int argc, char **argv)
exit (TRUE);
end:
- fprintf (stderr, "Usage: %s\n", dmesg_usage);
+ usage( dmesg_usage);
exit (FALSE);
}
diff --git a/dutmp.c b/dutmp.c
index 2dad7d4a5..7dd5b91fa 100644
--- a/dutmp.c
+++ b/dutmp.c
@@ -26,8 +26,7 @@ extern int dutmp_fn (int argc, char **argv)
struct utmp ut;
if ((argc < 2) || (**(argv + 1) == '-')) {
- fprintf (stderr, "Usage: %s %s\n", *argv, dutmp_usage);
- exit (FALSE);
+ usage( dutmp_usage);
}
if ( **(++argv) == 0 ) {
diff --git a/fdflush.c b/fdflush.c
index ce6870cd1..58b8b37d6 100644
--- a/fdflush.c
+++ b/fdflush.c
@@ -32,8 +32,7 @@ extern int fdflush_main(int argc, char **argv)
int value;
int fd;
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: fdflush device\n");
- exit(FALSE);
+ usage( "fdflush device\n");
}
fd = open(*argv, 0);
diff --git a/find.c b/find.c
index 1fb219496..51b8707da 100644
--- a/find.c
+++ b/find.c
@@ -100,8 +100,7 @@ int find_main(int argc, char **argv)
pattern=*(++argv);
stopit=-TRUE;
} else {
- fprintf(stderr, "Usage: %s\n", find_usage);
- exit( FALSE);
+ usage (find_usage);
}
}
break;
@@ -109,8 +108,7 @@ int find_main(int argc, char **argv)
/* Ignore all long options */
break;
default:
- fprintf(stderr, "Usage: %s\n", find_usage);
- exit( FALSE);
+ usage (find_usage);
}
if (argc-- > 1)
argv++;
diff --git a/findutils/find.c b/findutils/find.c
index 1fb219496..51b8707da 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -100,8 +100,7 @@ int find_main(int argc, char **argv)
pattern=*(++argv);
stopit=-TRUE;
} else {
- fprintf(stderr, "Usage: %s\n", find_usage);
- exit( FALSE);
+ usage (find_usage);
}
}
break;
@@ -109,8 +108,7 @@ int find_main(int argc, char **argv)
/* Ignore all long options */
break;
default:
- fprintf(stderr, "Usage: %s\n", find_usage);
- exit( FALSE);
+ usage (find_usage);
}
if (argc-- > 1)
argv++;
diff --git a/internal.h b/internal.h
index b676e5f86..a77ac38bb 100644
--- a/internal.h
+++ b/internal.h
@@ -130,6 +130,8 @@ const char* timeString(time_t timeVal);
extern void createPath (const char *name, int mode);
extern int parse_mode( const char* s, mode_t* theMode);
+extern volatile void usage(const char *usage);
+
#endif
diff --git a/kill.c b/kill.c
index 58dc8a986..00f10f91f 100644
--- a/kill.c
+++ b/kill.c
@@ -130,8 +130,7 @@ extern int kill_main (int argc, char **argv)
}
if (had_error) {
end:
- fprintf(stderr, "Usage: %s\n", kill_usage);
- exit ( FALSE);
+ usage (kill_usage);
}
exit (TRUE);
}
diff --git a/length.c b/length.c
index f2dadd25c..46242b529 100644
--- a/length.c
+++ b/length.c
@@ -7,8 +7,7 @@ extern int
length_main(int argc, char * * argv)
{
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: length string\n");
- exit(FALSE);
+ usage("length string\n");
}
printf("%d\n", strlen(argv[1]));
return( TRUE);
diff --git a/ln.c b/ln.c
index cd3cb4e45..8f7719fa4 100644
--- a/ln.c
+++ b/ln.c
@@ -44,8 +44,7 @@ extern int ln_main(int argc, char **argv)
char newdestName[NAME_MAX];
if (argc < 3) {
- fprintf(stderr, "Usage: %s", ln_usage);
- exit (FALSE);
+ usage (ln_usage);
}
argc--;
argv++;
@@ -61,8 +60,7 @@ extern int ln_main(int argc, char **argv)
removeoldFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", ln_usage);
- exit(FALSE);
+ usage (ln_usage);
}
argc--;
argv++;
diff --git a/loadkmap.c b/loadkmap.c
index 0f092d193..eb5a5dd4a 100644
--- a/loadkmap.c
+++ b/loadkmap.c
@@ -14,7 +14,7 @@ const char loadkmap_usage[] = "loadkmap\n"
int
-loadkmap_main(struct FileInfo * info, int argc, char * * argv)
+loadkmap_main(int argc, char * * argv)
{
struct kbentry ke;
u_short *ibuff;
diff --git a/ls.c b/ls.c
index 2e3d50e9f..0adc35de1 100644
--- a/ls.c
+++ b/ls.c
@@ -19,6 +19,8 @@
*
*/
+// I started writing a newer small one, but it isn't done yet....
+// -Erik
#if fooBar
#include <stdio.h>
@@ -110,8 +112,7 @@ int ls_main(int argc, char **argv)
recursiveFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", ls_usage);
- exit( FALSE);
+ usage (ls_usage);
}
argc--;
argv++;
@@ -571,7 +572,7 @@ listerr:
return 1;
}
-const char ls_usage[] = "Usage: ls [-1a"
+const char ls_usage[] = "ls [-1a"
#ifdef FEATURE_TIMESTAMPS
"c"
#endif
@@ -668,7 +669,7 @@ ls_main(int argc, char * * argv)
exit( i);
print_usage_message:
- fprintf(stderr, "Usage: %s\n", ls_usage);
+ usage (ls_usage);
exit( FALSE);
}
diff --git a/makedevs.c b/makedevs.c
index 691236e29..00f0066ff 100644
--- a/makedevs.c
+++ b/makedevs.c
@@ -21,7 +21,7 @@ const char makedevs_usage[] =
"\tmakedevs /dev/hda b 3 0 0 8 s (hda,hda1-hda8)\n";
int
-makedevs_main(struct FileInfo * i, int argc, char * * argv)
+makedevs_main(int argc, char * * argv)
{
const char *basedev = argv[1];
@@ -45,7 +45,7 @@ char buf[255];
case 'f':
mode = S_IFIFO; break;
default:
- usage(makedevs_usage);
+ fprintf(stderr, "Usage: %s\n", makedevs_usage);
return 2;
}
mode |= 0660;
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c
index 2dad7d4a5..7dd5b91fa 100644
--- a/miscutils/dutmp.c
+++ b/miscutils/dutmp.c
@@ -26,8 +26,7 @@ extern int dutmp_fn (int argc, char **argv)
struct utmp ut;
if ((argc < 2) || (**(argv + 1) == '-')) {
- fprintf (stderr, "Usage: %s %s\n", *argv, dutmp_usage);
- exit (FALSE);
+ usage( dutmp_usage);
}
if ( **(++argv) == 0 ) {
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 691236e29..00f0066ff 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -21,7 +21,7 @@ const char makedevs_usage[] =
"\tmakedevs /dev/hda b 3 0 0 8 s (hda,hda1-hda8)\n";
int
-makedevs_main(struct FileInfo * i, int argc, char * * argv)
+makedevs_main(int argc, char * * argv)
{
const char *basedev = argv[1];
@@ -45,7 +45,7 @@ char buf[255];
case 'f':
mode = S_IFIFO; break;
default:
- usage(makedevs_usage);
+ fprintf(stderr, "Usage: %s\n", makedevs_usage);
return 2;
}
mode |= 0660;
diff --git a/miscutils/mt.c b/miscutils/mt.c
index 7d75fbd3d..a61ad5a40 100644
--- a/miscutils/mt.c
+++ b/miscutils/mt.c
@@ -50,7 +50,7 @@ static const struct mt_opcodes opcodes[] = {
};
extern int
-mt_main(struct FileInfo * i, int argc, char * * argv)
+mt_main(int argc, char** argv)
{
const char * file = "/dev/tape";
const struct mt_opcodes * code = opcodes;
@@ -59,8 +59,7 @@ mt_main(struct FileInfo * i, int argc, char * * argv)
if ( strcmp(argv[1], "-f") == 0 ) {
if ( argc < 4 ) {
- usage(mt_usage);
- return 1;
+ usage (mt_usage);
}
file = argv[2];
argv += 2;
@@ -75,7 +74,7 @@ mt_main(struct FileInfo * i, int argc, char * * argv)
if ( code->name == 0 ) {
fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
- return 1;
+ return( FALSE);
}
op.mt_op = code->value;
@@ -85,14 +84,14 @@ mt_main(struct FileInfo * i, int argc, char * * argv)
op.mt_count = 1; /* One, not zero, right? */
if ( (fd = open(file, O_RDONLY, 0)) < 0 ) {
- name_and_error(file);
- return 1;
+ perror(file);
+ return( FALSE);
}
if ( ioctl(fd, MTIOCTOP, &op) != 0 ) {
- name_and_error(file);
- return 1;
+ perror(file);
+ return( FALSE);
}
- return 0;
+ return( TRUE);
}
diff --git a/mkdir.c b/mkdir.c
index 61d35d5cd..b42899a4a 100644
--- a/mkdir.c
+++ b/mkdir.c
@@ -51,8 +51,7 @@ extern int mkdir_main(int argc, char **argv)
parentFlag = TRUE;
break;
default:
- fprintf(stderr, "%s\n", mkdir_usage);
- exit(FALSE);
+ usage( mkdir_usage);
}
argc--;
argv++;
@@ -60,8 +59,7 @@ extern int mkdir_main(int argc, char **argv)
if (argc < 1) {
- fprintf(stderr, "%s\n", mkdir_usage);
- exit (FALSE);
+ usage( mkdir_usage);
}
while (--argc > 0) {
diff --git a/mknod.c b/mknod.c
index b18394bec..95d7de360 100644
--- a/mknod.c
+++ b/mknod.c
@@ -1,4 +1,5 @@
#include "internal.h"
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -13,7 +14,7 @@ const char mknod_usage[] = "mknod file b|c|u|p major minor\n"
"\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n";
int
-mknod_main(struct FileInfo * i, int argc, char * * argv)
+mknod_main(int argc, char** argv)
{
mode_t mode = 0;
dev_t dev = 0;
@@ -30,23 +31,21 @@ mknod_main(struct FileInfo * i, int argc, char * * argv)
mode = S_IFIFO;
break;
default:
- usage(mknod_usage);
- return 1;
+ usage (mknod_usage);
}
if ( mode == S_IFCHR || mode == S_IFBLK ) {
dev = (atoi(argv[3]) << 8) | atoi(argv[4]);
if ( argc != 5 ) {
- usage(mknod_usage);
- return 1;
+ usage (mknod_usage);
}
}
mode |= 0666;
if ( mknod(argv[1], mode, dev) != 0 ) {
- name_and_error(argv[1]);
- return 1;
+ perror(argv[1]);
+ return( FALSE);
}
- return 0;
+ return( TRUE);
}
diff --git a/mkswap.c b/mkswap.c
index f797d1395..8c0c4dec7 100644
--- a/mkswap.c
+++ b/mkswap.c
@@ -83,7 +83,7 @@ static int bit_test_and_clear (unsigned int *addr, unsigned int nr)
volatile void fatal_error(const char * fmt_string)
{
fprintf(stderr,fmt_string,program_name,device_name);
- exit(1);
+ exit(FALSE);
}
#define die(str) fatal_error("%s: " str "\n")
@@ -170,7 +170,7 @@ static int get_size(const char *file)
}
int
-mkswap(char *device_name, int pages, int check)
+mkswap(const char *device_name, int pages, int check)
{
struct stat statbuf;
int goodpages;
@@ -219,10 +219,10 @@ mkswap(char *device_name, int pages, int check)
die("unable to write signature page");
close(DEV);
- return 0;
+ return (TRUE);
}
-int mkswap_main(struct FileInfo * unnecessary, int argc, char ** argv)
+int mkswap_main(int argc, char ** argv)
{
char * tmp;
long int pages=0;
@@ -237,17 +237,16 @@ int mkswap_main(struct FileInfo * unnecessary, int argc, char ** argv)
if (device_name) {
pages = strtol(argv[0],&tmp,0)>>(PAGE_SHIFT-10);
if (*tmp) {
- usage(mkswap_usage);
- exit(1);
+ usage (mkswap_usage);
}
} else
device_name = argv[0];
else while (*++argv[0])
switch (argv[0][0]) {
case 'c': check=1; break;
- default: usage(mkswap_usage);
- exit(1);
+ default: usage (mkswap_usage);
+ exit( TRUE);
}
}
- return mkswap(device_name, pages, check);
+ exit( mkswap(device_name, pages, check));
}
diff --git a/more.c b/more.c
index a56ce97d7..53437ed58 100644
--- a/more.c
+++ b/more.c
@@ -59,8 +59,7 @@ extern int more_main(int argc, char **argv)
FILE *file = stdin;
if ( strcmp(*argv,"--help")==0 || strcmp(*argv,"-h")==0 ) {
- fprintf(stderr, "Usage: %s %s", *argv, more_usage);
- exit(FALSE);
+ usage (more_usage);
}
argc--;
argv++;
diff --git a/mt.c b/mt.c
index 7d75fbd3d..a61ad5a40 100644
--- a/mt.c
+++ b/mt.c
@@ -50,7 +50,7 @@ static const struct mt_opcodes opcodes[] = {
};
extern int
-mt_main(struct FileInfo * i, int argc, char * * argv)
+mt_main(int argc, char** argv)
{
const char * file = "/dev/tape";
const struct mt_opcodes * code = opcodes;
@@ -59,8 +59,7 @@ mt_main(struct FileInfo * i, int argc, char * * argv)
if ( strcmp(argv[1], "-f") == 0 ) {
if ( argc < 4 ) {
- usage(mt_usage);
- return 1;
+ usage (mt_usage);
}
file = argv[2];
argv += 2;
@@ -75,7 +74,7 @@ mt_main(struct FileInfo * i, int argc, char * * argv)
if ( code->name == 0 ) {
fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
- return 1;
+ return( FALSE);
}
op.mt_op = code->value;
@@ -85,14 +84,14 @@ mt_main(struct FileInfo * i, int argc, char * * argv)
op.mt_count = 1; /* One, not zero, right? */
if ( (fd = open(file, O_RDONLY, 0)) < 0 ) {
- name_and_error(file);
- return 1;
+ perror(file);
+ return( FALSE);
}
if ( ioctl(fd, MTIOCTOP, &op) != 0 ) {
- name_and_error(file);
- return 1;
+ perror(file);
+ return( FALSE);
}
- return 0;
+ return( TRUE);
}
diff --git a/mv.c b/mv.c
index 2a7c8c1f3..ab3fc2bd5 100644
--- a/mv.c
+++ b/mv.c
@@ -42,8 +42,7 @@ extern int mv_main(int argc, char **argv)
char newdestName[NAME_MAX];
if (argc < 3) {
- fprintf(stderr, "Usage: %s", mv_usage);
- exit (FALSE);
+ usage (mv_usage);
}
argc--;
argv++;
diff --git a/printf.c b/printf.c
index e79843c80..4d4465943 100644
--- a/printf.c
+++ b/printf.c
@@ -1,8 +1,3 @@
-// I may still need some more cleaning...fix my error checking
-
-#include "internal.h"
-#ifdef BB_PRINTF
-
/* printf - format and print data
Copyright (C) 90, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
@@ -51,6 +46,7 @@
// 19990508 Busy Boxed! Dave Cinege
+#include "internal.h"
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
@@ -140,15 +136,18 @@ static void verify __P ((char *s, char *end));
/* The value to return to the calling program. */
static int exit_status;
-const char printf_usage[] = "Usage: printf format [argument...]\n";
+const char printf_usage[] = "printf format [argument...]\n";
int
-printf_main(struct FileInfo * i, int argc, char * * argv)
+printf_main(int argc, char** argv)
{
char *format;
int args_used;
exit_status = 0;
+ if ( **(argv+1) == '-' ) {
+ usage (printf_usage);
+ }
format = argv[1];
argc -= 2;
@@ -528,4 +527,3 @@ verify (char *s, char *end)
}
}
-#endif
diff --git a/procps/kill.c b/procps/kill.c
index 58dc8a986..00f10f91f 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -130,8 +130,7 @@ extern int kill_main (int argc, char **argv)
}
if (had_error) {
end:
- fprintf(stderr, "Usage: %s\n", kill_usage);
- exit ( FALSE);
+ usage (kill_usage);
}
exit (TRUE);
}
diff --git a/rm.c b/rm.c
index 477d3af59..dd8dfa4e6 100644
--- a/rm.c
+++ b/rm.c
@@ -25,7 +25,7 @@
#include <utime.h>
#include <dirent.h>
-static const char* rm_usage = "Usage: rm [OPTION]... FILE...\n"
+static const char* rm_usage = "rm [OPTION]... FILE...\n"
"Remove (unlink) the FILE(s).\n\n"
"\t-f\tremove existing destinations, never prompt\n"
"\t-r\tremove the contents of directories recursively\n";
@@ -58,8 +58,7 @@ extern int rm_main(int argc, char **argv)
{
if (argc < 2) {
- fprintf(stderr, "Usage: %s", rm_usage);
- exit (FALSE);
+ usage( rm_usage);
}
argc--;
argv++;
@@ -75,8 +74,7 @@ extern int rm_main(int argc, char **argv)
forceFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", rm_usage);
- exit(FALSE);
+ usage( rm_usage);
}
argc--;
argv++;
diff --git a/rmdir.c b/rmdir.c
index b4da03f12..666e0476a 100644
--- a/rmdir.c
+++ b/rmdir.c
@@ -27,8 +27,7 @@
extern int rmdir_main(int argc, char **argv)
{
if ( argc==1 || **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: rmdir [OPTION]... DIRECTORY...\nRemove the DIRECTORY(ies), if they are empty.");
- exit(FALSE);
+ usage( "rmdir [OPTION]... DIRECTORY...\nRemove the DIRECTORY(ies), if they are empty.");
}
while (--argc > 0) {
diff --git a/sleep.c b/sleep.c
index 53fe5a0c2..7e38a3667 100644
--- a/sleep.c
+++ b/sleep.c
@@ -8,8 +8,7 @@ extern int
sleep_main(int argc, char * * argv)
{
if ( (argc < 2) || (**(argv+1) == '-') ) {
- fprintf(stderr, "Usage: %s %s", *argv, sleep_usage);
- exit(FALSE);
+ usage( sleep_usage );
}
if ( sleep(atoi(*(++argv))) != 0 ) {
diff --git a/swaponoff.c b/swaponoff.c
index 56f93b393..5a2d735ad 100644
--- a/swaponoff.c
+++ b/swaponoff.c
@@ -33,10 +33,10 @@ static int whichApp;
static const char* appName;
static const char swapoff_usage[] =
-"Usage: swapoff device\n"
+"swapoff device\n"
"\nStop swapping virtual memory pages on the given device.\n";
static const char swapon_usage[] =
-"Usage: swapon device\n"
+"swapon device\n"
"\nStart swapping virtual memory pages on the given device.\n";
@@ -112,10 +112,10 @@ swap_on_off_main(int argc, char * * argv)
}
}
swap_enable_disable(*argv);
- //exit( TRUE);
+ exit( TRUE);
usage_and_exit:
- fprintf(stderr, "Usage: %s", (whichApp==SWAPON_APP)? swapon_usage : swapoff_usage);
- exit(FALSE);
+ usage( (whichApp==SWAPON_APP)? swapon_usage : swapoff_usage);
+ exit( FALSE);
}
diff --git a/sync.c b/sync.c
index 572d74924..8800f2e76 100644
--- a/sync.c
+++ b/sync.c
@@ -5,9 +5,8 @@ extern int
sync_main(int argc, char * * argv)
{
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: sync\nWrite all buffered filesystem blocks to disk.\n");
- exit(FALSE);
+ usage( "sync\nWrite all buffered filesystem blocks to disk.\n");
}
- return sync();
+ return sync();
}
diff --git a/touch.c b/touch.c
index 8dac10294..c36ffca90 100644
--- a/touch.c
+++ b/touch.c
@@ -40,8 +40,7 @@ touch_main(int argc, char **argv)
int create=TRUE;
if (argc < 2) {
- fprintf(stderr, "Usage: %s %s", *argv, touch_usage);
- exit( FALSE);
+ usage( touch_usage);
}
argc--;
argv++;
diff --git a/umount.c b/umount.c
index a83a508f7..625fcfab9 100644
--- a/umount.c
+++ b/umount.c
@@ -71,8 +71,7 @@ umount_main(int argc, char * * argv)
{
if (argc < 2) {
- fprintf(stderr, "Usage: %s", umount_usage);
- exit(FALSE);
+ usage( umount_usage);
}
argc--;
argv++;
@@ -84,8 +83,7 @@ umount_main(int argc, char * * argv)
exit ( umount_all() );
break;
default:
- fprintf(stderr, "Usage: %s\n", umount_usage);
- exit( FALSE);
+ usage( umount_usage);
}
}
if ( umount(*argv) == 0 )
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 64265b473..e5d403f7a 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -93,6 +93,6 @@ int dmesg_main (int argc, char **argv)
exit (TRUE);
end:
- fprintf (stderr, "Usage: %s\n", dmesg_usage);
+ usage( dmesg_usage);
exit (FALSE);
}
diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c
index ce6870cd1..58b8b37d6 100644
--- a/util-linux/fdflush.c
+++ b/util-linux/fdflush.c
@@ -32,8 +32,7 @@ extern int fdflush_main(int argc, char **argv)
int value;
int fd;
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: fdflush device\n");
- exit(FALSE);
+ usage( "fdflush device\n");
}
fd = open(*argv, 0);
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index f797d1395..8c0c4dec7 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -83,7 +83,7 @@ static int bit_test_and_clear (unsigned int *addr, unsigned int nr)
volatile void fatal_error(const char * fmt_string)
{
fprintf(stderr,fmt_string,program_name,device_name);
- exit(1);
+ exit(FALSE);
}
#define die(str) fatal_error("%s: " str "\n")
@@ -170,7 +170,7 @@ static int get_size(const char *file)
}
int
-mkswap(char *device_name, int pages, int check)
+mkswap(const char *device_name, int pages, int check)
{
struct stat statbuf;
int goodpages;
@@ -219,10 +219,10 @@ mkswap(char *device_name, int pages, int check)
die("unable to write signature page");
close(DEV);
- return 0;
+ return (TRUE);
}
-int mkswap_main(struct FileInfo * unnecessary, int argc, char ** argv)
+int mkswap_main(int argc, char ** argv)
{
char * tmp;
long int pages=0;
@@ -237,17 +237,16 @@ int mkswap_main(struct FileInfo * unnecessary, int argc, char ** argv)
if (device_name) {
pages = strtol(argv[0],&tmp,0)>>(PAGE_SHIFT-10);
if (*tmp) {
- usage(mkswap_usage);
- exit(1);
+ usage (mkswap_usage);
}
} else
device_name = argv[0];
else while (*++argv[0])
switch (argv[0][0]) {
case 'c': check=1; break;
- default: usage(mkswap_usage);
- exit(1);
+ default: usage (mkswap_usage);
+ exit( TRUE);
}
}
- return mkswap(device_name, pages, check);
+ exit( mkswap(device_name, pages, check));
}
diff --git a/util-linux/more.c b/util-linux/more.c
index a56ce97d7..53437ed58 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -59,8 +59,7 @@ extern int more_main(int argc, char **argv)
FILE *file = stdin;
if ( strcmp(*argv,"--help")==0 || strcmp(*argv,"-h")==0 ) {
- fprintf(stderr, "Usage: %s %s", *argv, more_usage);
- exit(FALSE);
+ usage (more_usage);
}
argc--;
argv++;
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index 56f93b393..5a2d735ad 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -33,10 +33,10 @@ static int whichApp;
static const char* appName;
static const char swapoff_usage[] =
-"Usage: swapoff device\n"
+"swapoff device\n"
"\nStop swapping virtual memory pages on the given device.\n";
static const char swapon_usage[] =
-"Usage: swapon device\n"
+"swapon device\n"
"\nStart swapping virtual memory pages on the given device.\n";
@@ -112,10 +112,10 @@ swap_on_off_main(int argc, char * * argv)
}
}
swap_enable_disable(*argv);
- //exit( TRUE);
+ exit( TRUE);
usage_and_exit:
- fprintf(stderr, "Usage: %s", (whichApp==SWAPON_APP)? swapon_usage : swapoff_usage);
- exit(FALSE);
+ usage( (whichApp==SWAPON_APP)? swapon_usage : swapoff_usage);
+ exit( FALSE);
}
diff --git a/util-linux/umount.c b/util-linux/umount.c
index a83a508f7..625fcfab9 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -71,8 +71,7 @@ umount_main(int argc, char * * argv)
{
if (argc < 2) {
- fprintf(stderr, "Usage: %s", umount_usage);
- exit(FALSE);
+ usage( umount_usage);
}
argc--;
argv++;
@@ -84,8 +83,7 @@ umount_main(int argc, char * * argv)
exit ( umount_all() );
break;
default:
- fprintf(stderr, "Usage: %s\n", umount_usage);
- exit( FALSE);
+ usage( umount_usage);
}
}
if ( umount(*argv) == 0 )
diff --git a/utility.c b/utility.c
index c6121cb11..f86216eb1 100644
--- a/utility.c
+++ b/utility.c
@@ -34,6 +34,14 @@
#include <unistd.h>
+/* volatile so gcc knows this is the enod of the line */
+volatile void usage(const char *usage)
+{
+ fprintf(stderr, "Usage: %s\n", usage);
+ exit(FALSE);
+}
+
+
#if defined (BB_CP) || defined (BB_MV)
/*