projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
703c62d
)
More stuff.
author
Eric Andersen
<andersen@codepoet.org>
Mon, 18 Oct 1999 22:28:26 +0000
(22:28 -0000)
committer
Eric Andersen
<andersen@codepoet.org>
Mon, 18 Oct 1999 22:28:26 +0000
(22:28 -0000)
-Erik
61 files changed:
applets/busybox.c
patch
|
blob
|
history
busybox.c
patch
|
blob
|
history
busybox.def.h
patch
|
blob
|
history
cat.c
patch
|
blob
|
history
chroot.c
patch
|
blob
|
history
console-tools/loadkmap.c
patch
|
blob
|
history
coreutils/cat.c
patch
|
blob
|
history
coreutils/chroot.c
patch
|
blob
|
history
coreutils/cp.c
patch
|
blob
|
history
coreutils/date.c
patch
|
blob
|
history
coreutils/length.c
patch
|
blob
|
history
coreutils/ln.c
patch
|
blob
|
history
coreutils/ls.c
patch
|
blob
|
history
coreutils/mkdir.c
patch
|
blob
|
history
coreutils/mknod.c
patch
|
blob
|
history
coreutils/mv.c
patch
|
blob
|
history
coreutils/printf.c
patch
|
blob
|
history
coreutils/rm.c
patch
|
blob
|
history
coreutils/rmdir.c
patch
|
blob
|
history
coreutils/sleep.c
patch
|
blob
|
history
coreutils/sync.c
patch
|
blob
|
history
coreutils/touch.c
patch
|
blob
|
history
cp.c
patch
|
blob
|
history
date.c
patch
|
blob
|
history
dmesg.c
patch
|
blob
|
history
dutmp.c
patch
|
blob
|
history
fdflush.c
patch
|
blob
|
history
find.c
patch
|
blob
|
history
findutils/find.c
patch
|
blob
|
history
internal.h
patch
|
blob
|
history
kill.c
patch
|
blob
|
history
length.c
patch
|
blob
|
history
ln.c
patch
|
blob
|
history
loadkmap.c
patch
|
blob
|
history
ls.c
patch
|
blob
|
history
makedevs.c
patch
|
blob
|
history
miscutils/dutmp.c
patch
|
blob
|
history
miscutils/makedevs.c
patch
|
blob
|
history
miscutils/mt.c
patch
|
blob
|
history
mkdir.c
patch
|
blob
|
history
mknod.c
patch
|
blob
|
history
mkswap.c
patch
|
blob
|
history
more.c
patch
|
blob
|
history
mt.c
patch
|
blob
|
history
mv.c
patch
|
blob
|
history
printf.c
patch
|
blob
|
history
procps/kill.c
patch
|
blob
|
history
rm.c
patch
|
blob
|
history
rmdir.c
patch
|
blob
|
history
sleep.c
patch
|
blob
|
history
swaponoff.c
patch
|
blob
|
history
sync.c
patch
|
blob
|
history
touch.c
patch
|
blob
|
history
umount.c
patch
|
blob
|
history
util-linux/dmesg.c
patch
|
blob
|
history
util-linux/fdflush.c
patch
|
blob
|
history
util-linux/mkswap.c
patch
|
blob
|
history
util-linux/more.c
patch
|
blob
|
history
util-linux/swaponoff.c
patch
|
blob
|
history
util-linux/umount.c
patch
|
blob
|
history
utility.c
patch
|
blob
|
history
diff --git
a/applets/busybox.c
b/applets/busybox.c
index 6bc223a1d194ac3df06979864211d0a3e1af6b8b..16ccce67ed0e35271174dc6d8865a58b32e6357c 100644
(file)
--- 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_LOADKMAP //sbin
{"loadkmap", loadkmap_main},
#endif
-#ifdef BB_LOSETUP //sbin
- {"losetup", losetup_main},
-#endif
#ifdef BB_LS //bin
{"ls", ls_main},
#endif
#ifdef BB_LS //bin
{"ls", ls_main},
#endif
diff --git
a/busybox.c
b/busybox.c
index 6bc223a1d194ac3df06979864211d0a3e1af6b8b..16ccce67ed0e35271174dc6d8865a58b32e6357c 100644
(file)
--- 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_LOADKMAP //sbin
{"loadkmap", loadkmap_main},
#endif
-#ifdef BB_LOSETUP //sbin
- {"losetup", losetup_main},
-#endif
#ifdef BB_LS //bin
{"ls", ls_main},
#endif
#ifdef BB_LS //bin
{"ls", ls_main},
#endif
diff --git
a/busybox.def.h
b/busybox.def.h
index c278f4ce072f588f78f49009cee73672d77267ce..7ca522b3afa2e35caa66ff65c256e8c4dee2a228 100644
(file)
--- a/
busybox.def.h
+++ b/
busybox.def.h
@@
-18,25
+18,24
@@
#define BB_FDFLUSH
#define BB_FIND
#define BB_GREP
#define BB_FDFLUSH
#define BB_FIND
#define BB_GREP
-#define BB_HALT
+
//
#define BB_HALT
#define BB_INIT
#define BB_KILL
#define BB_INIT
#define BB_KILL
-#define BB_LENGTH
+
//
#define BB_LENGTH
#define BB_LN
#define BB_LN
-//#define BB_LOADKMAP
-////#define BB_LOSETUP
+#define BB_LOADKMAP
#define BB_LS
#define BB_LS
-
//
#define BB_MAKEDEVS
-#define BB_MATH
+#define BB_MAKEDEVS
+
//
#define BB_MATH
#define BB_MKDIR
#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_MNC
#define BB_MORE
#define BB_MOUNT
-//
//
#define BB_MT
+//#define BB_MT
#define BB_MV
#define BB_MV
-
//
#define BB_PRINTF
+#define BB_PRINTF
#define BB_PWD
#define BB_REBOOT
#define BB_RM
#define BB_PWD
#define BB_REBOOT
#define BB_RM
@@
-51,4
+50,4
@@
#define BB_UPDATE
#define BB_UTILITY
#define BB_ZCAT
#define BB_UPDATE
#define BB_UTILITY
#define BB_ZCAT
-
//
#define BB_GZIP
+#define BB_GZIP
diff --git
a/cat.c
b/cat.c
index 5c54c494105990c498383addbb75e993a26eb1c9..38078d505e0b5d2874126dae9c13f6f4d1dedab0 100644
(file)
--- a/
cat.c
+++ b/
cat.c
@@
-42,8
+42,7
@@
extern int cat_more_main(int argc, char **argv)
}
if ( **(argv+1) == '-' ) {
}
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: cat [file ...]\n");
- exit(FALSE);
+ usage ("cat [file ...]\n");
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/chroot.c
b/chroot.c
index 3b6fdae3b295f09f2ddc4bb951b02f39ef65b15a..15f44688103c73fe880a21a533ddf85e3f578fbe 100644
(file)
--- 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) == '-') ) {
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++;
}
argc--;
argv++;
diff --git
a/console-tools/loadkmap.c
b/console-tools/loadkmap.c
index 0f092d1932e4058f1fd7cc647b36fafa05731d4d..eb5a5dd4a5b7f846f0b34af9215f62b6f83dbb05 100644
(file)
--- a/
console-tools/loadkmap.c
+++ b/
console-tools/loadkmap.c
@@
-14,7
+14,7
@@
const char loadkmap_usage[] = "loadkmap\n"
int
int
-loadkmap_main(
struct FileInfo * info,
int argc, char * * argv)
+loadkmap_main(int argc, char * * argv)
{
struct kbentry ke;
u_short *ibuff;
{
struct kbentry ke;
u_short *ibuff;
diff --git
a/coreutils/cat.c
b/coreutils/cat.c
index 5c54c494105990c498383addbb75e993a26eb1c9..38078d505e0b5d2874126dae9c13f6f4d1dedab0 100644
(file)
--- a/
coreutils/cat.c
+++ b/
coreutils/cat.c
@@
-42,8
+42,7
@@
extern int cat_more_main(int argc, char **argv)
}
if ( **(argv+1) == '-' ) {
}
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: cat [file ...]\n");
- exit(FALSE);
+ usage ("cat [file ...]\n");
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/coreutils/chroot.c
b/coreutils/chroot.c
index 3b6fdae3b295f09f2ddc4bb951b02f39ef65b15a..15f44688103c73fe880a21a533ddf85e3f578fbe 100644
(file)
--- 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) == '-') ) {
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++;
}
argc--;
argv++;
diff --git
a/coreutils/cp.c
b/coreutils/cp.c
index c5e34d33347801759d3a5ea7243a86cdf84fb200..11c76825cce1cad2cc3d8b90bc8ac5278e098f87 100644
(file)
--- a/
coreutils/cp.c
+++ b/
coreutils/cp.c
@@
-60,8
+60,7
@@
extern int cp_main(int argc, char **argv)
{
if (argc < 3) {
{
if (argc < 3) {
- fprintf(stderr, "Usage: %s", cp_usage);
- exit (FALSE);
+ usage (cp_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-85,8
+84,7
@@
extern int cp_main(int argc, char **argv)
recursiveFlag = TRUE;
break;
default:
recursiveFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", cp_usage);
- exit(FALSE);
+ usage (cp_usage);
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/coreutils/date.c
b/coreutils/date.c
index 2df9e0cc7a63661d385b66d39a3b14d6ac7adf62..70d5dd5c6b154ea94138ea267081b124ab62d75f 100644
(file)
--- a/
coreutils/date.c
+++ b/
coreutils/date.c
@@
-34,7
+34,7
@@
an RFC 822 complient date output for shell scripting
mail commands */
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"
" 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)
{
int
date_main(int argc, char * * argv)
{
@@
-190,7
+184,7
@@
date_main(int argc, char * * argv)
break;
case 's':
set_time = 1;
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':
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;
/* 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_str = optarg;
break;
case '-':
-
date_err(
);
+
usage ( date_usage
);
}
} else {
if ( (date_fmt == NULL) && (strcmp(*argv, "+")==0) )
}
} 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 {
set_time = 1;
date_str=*argv;
} else {
-
date_err(
);
+
usage ( date_usage
);
}
}
i--;
}
}
i--;
diff --git
a/coreutils/length.c
b/coreutils/length.c
index f2dadd25c8958d231069231b63e77a10332d5682..46242b529eb7f5d9b37092b37c948f15179cf50e 100644
(file)
--- a/
coreutils/length.c
+++ b/
coreutils/length.c
@@
-7,8
+7,7
@@
extern int
length_main(int argc, char * * argv)
{
if ( **(argv+1) == '-' ) {
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);
}
printf("%d\n", strlen(argv[1]));
return( TRUE);
diff --git
a/coreutils/ln.c
b/coreutils/ln.c
index cd3cb4e450f86e12caa3b1ca48f183c8e29e8df2..8f7719fa466f5bb79066f36a2ef5c629df0f1441 100644
(file)
--- 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) {
char newdestName[NAME_MAX];
if (argc < 3) {
- fprintf(stderr, "Usage: %s", ln_usage);
- exit (FALSE);
+ usage (ln_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-61,8
+60,7
@@
extern int ln_main(int argc, char **argv)
removeoldFlag = TRUE;
break;
default:
removeoldFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", ln_usage);
- exit(FALSE);
+ usage (ln_usage);
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/coreutils/ls.c
b/coreutils/ls.c
index 2e3d50e9f2d78c2b50058aa58171b0ba5d0d0ded..0adc35de18ee76608a1250057584e99422f5ac24 100644
(file)
--- 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>
#if fooBar
#include <stdio.h>
@@
-110,8
+112,7
@@
int ls_main(int argc, char **argv)
recursiveFlag = TRUE;
break;
default:
recursiveFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", ls_usage);
- exit( FALSE);
+ usage (ls_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-571,7
+572,7
@@
listerr:
return 1;
}
return 1;
}
-const char ls_usage[] = "
Usage:
ls [-1a"
+const char ls_usage[] = "ls [-1a"
#ifdef FEATURE_TIMESTAMPS
"c"
#endif
#ifdef FEATURE_TIMESTAMPS
"c"
#endif
@@
-668,7
+669,7
@@
ls_main(int argc, char * * argv)
exit( i);
print_usage_message:
exit( i);
print_usage_message:
-
fprintf(stderr, "Usage: %s\n",
ls_usage);
+
usage (
ls_usage);
exit( FALSE);
}
exit( FALSE);
}
diff --git
a/coreutils/mkdir.c
b/coreutils/mkdir.c
index 61d35d5cda1249235b1e918c87d3a4f675bc52c4..b42899a4a890180a16eeb901f4f6ec3b2e12a25b 100644
(file)
--- a/
coreutils/mkdir.c
+++ b/
coreutils/mkdir.c
@@
-51,8
+51,7
@@
extern int mkdir_main(int argc, char **argv)
parentFlag = TRUE;
break;
default:
parentFlag = TRUE;
break;
default:
- fprintf(stderr, "%s\n", mkdir_usage);
- exit(FALSE);
+ usage( mkdir_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-60,8
+59,7
@@
extern int mkdir_main(int argc, char **argv)
if (argc < 1) {
if (argc < 1) {
- fprintf(stderr, "%s\n", mkdir_usage);
- exit (FALSE);
+ usage( mkdir_usage);
}
while (--argc > 0) {
}
while (--argc > 0) {
diff --git
a/coreutils/mknod.c
b/coreutils/mknod.c
index b18394bec34116ab58041cc1d0a20746a2baaf82..95d7de360d2c521345a2f5014e64d9eb7e7afa87 100644
(file)
--- a/
coreutils/mknod.c
+++ b/
coreutils/mknod.c
@@
-1,4
+1,5
@@
#include "internal.h"
#include "internal.h"
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.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
"\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;
{
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:
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 ) {
}
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 ) {
}
}
mode |= 0666;
if ( mknod(argv[1], mode, dev) != 0 ) {
-
name_and_
error(argv[1]);
- return
1
;
+
p
error(argv[1]);
+ return
( FALSE)
;
}
}
- return
0
;
+ return
( TRUE)
;
}
}
diff --git
a/coreutils/mv.c
b/coreutils/mv.c
index 2a7c8c1f3b8ef20c7ae24ee00cd9cf62dcd1d8f0..ab3fc2bd5194e67cf2a59b23ba946d8cab05c581 100644
(file)
--- 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) {
char newdestName[NAME_MAX];
if (argc < 3) {
- fprintf(stderr, "Usage: %s", mv_usage);
- exit (FALSE);
+ usage (mv_usage);
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/coreutils/printf.c
b/coreutils/printf.c
index e79843c80ababd3964e9cbd16f7f5e1b70c5a1a8..4d4465943b227d28b541578544b126c8945a901e 100644
(file)
--- 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.
/* 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
// 19990508 Busy Boxed! Dave Cinege
+#include "internal.h"
#include <unistd.h>
#include <stdio.h>
#include <sys/types.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;
/* 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
int
-printf_main(
struct FileInfo * i, int argc, char *
* argv)
+printf_main(
int argc, char*
* argv)
{
char *format;
int args_used;
exit_status = 0;
{
char *format;
int args_used;
exit_status = 0;
+ if ( **(argv+1) == '-' ) {
+ usage (printf_usage);
+ }
format = argv[1];
argc -= 2;
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 477d3af598bfe09d012ec606b49e80101b234fbe..dd8dfa4e6e0634250a2bae12e8b697b6a1b6a1f5 100644
(file)
--- a/
coreutils/rm.c
+++ b/
coreutils/rm.c
@@
-25,7
+25,7
@@
#include <utime.h>
#include <dirent.h>
#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";
"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) {
{
if (argc < 2) {
- fprintf(stderr, "Usage: %s", rm_usage);
- exit (FALSE);
+ usage( rm_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-75,8
+74,7
@@
extern int rm_main(int argc, char **argv)
forceFlag = TRUE;
break;
default:
forceFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", rm_usage);
- exit(FALSE);
+ usage( rm_usage);
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/coreutils/rmdir.c
b/coreutils/rmdir.c
index b4da03f1296ea85fe1b5dfc553cc0d95101faf09..666e0476a5cb18eab10868f8fdfa0b2b1f06d858 100644
(file)
--- 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) == '-' ) {
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) {
}
while (--argc > 0) {
diff --git
a/coreutils/sleep.c
b/coreutils/sleep.c
index 53fe5a0c2bf8b6085a208ee9c83bb2b53a54c627..7e38a366757e2ce103ae5df7a54b237412285a57 100644
(file)
--- 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) == '-') ) {
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 ) {
}
if ( sleep(atoi(*(++argv))) != 0 ) {
diff --git
a/coreutils/sync.c
b/coreutils/sync.c
index 572d749245972afa18ff1c42586400e72829f4e5..8800f2e762bbb6b093c84832e1cc5a974826f915 100644
(file)
--- a/
coreutils/sync.c
+++ b/
coreutils/sync.c
@@
-5,9
+5,8
@@
extern int
sync_main(int argc, char * * argv)
{
if ( **(argv+1) == '-' ) {
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 8dac1029474e7ad7152ee75419c7573bcb01ad7e..c36ffca90ffe72a9a35d14097ee4eb065a3e1b67 100644
(file)
--- a/
coreutils/touch.c
+++ b/
coreutils/touch.c
@@
-40,8
+40,7
@@
touch_main(int argc, char **argv)
int create=TRUE;
if (argc < 2) {
int create=TRUE;
if (argc < 2) {
- fprintf(stderr, "Usage: %s %s", *argv, touch_usage);
- exit( FALSE);
+ usage( touch_usage);
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/cp.c
b/cp.c
index c5e34d33347801759d3a5ea7243a86cdf84fb200..11c76825cce1cad2cc3d8b90bc8ac5278e098f87 100644
(file)
--- a/
cp.c
+++ b/
cp.c
@@
-60,8
+60,7
@@
extern int cp_main(int argc, char **argv)
{
if (argc < 3) {
{
if (argc < 3) {
- fprintf(stderr, "Usage: %s", cp_usage);
- exit (FALSE);
+ usage (cp_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-85,8
+84,7
@@
extern int cp_main(int argc, char **argv)
recursiveFlag = TRUE;
break;
default:
recursiveFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", cp_usage);
- exit(FALSE);
+ usage (cp_usage);
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/date.c
b/date.c
index 2df9e0cc7a63661d385b66d39a3b14d6ac7adf62..70d5dd5c6b154ea94138ea267081b124ab62d75f 100644
(file)
--- a/
date.c
+++ b/
date.c
@@
-34,7
+34,7
@@
an RFC 822 complient date output for shell scripting
mail commands */
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"
" 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)
{
int
date_main(int argc, char * * argv)
{
@@
-190,7
+184,7
@@
date_main(int argc, char * * argv)
break;
case 's':
set_time = 1;
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':
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;
/* 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_str = optarg;
break;
case '-':
-
date_err(
);
+
usage ( date_usage
);
}
} else {
if ( (date_fmt == NULL) && (strcmp(*argv, "+")==0) )
}
} 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 {
set_time = 1;
date_str=*argv;
} else {
-
date_err(
);
+
usage ( date_usage
);
}
}
i--;
}
}
i--;
diff --git
a/dmesg.c
b/dmesg.c
index 64265b473e6049a560f324ae2c70f0067570dbc1..e5d403f7acd77b36ed73b478e2dbee6795579c54 100644
(file)
--- a/
dmesg.c
+++ b/
dmesg.c
@@
-93,6
+93,6
@@
int dmesg_main (int argc, char **argv)
exit (TRUE);
end:
exit (TRUE);
end:
-
fprintf (stderr, "Usage: %s\n",
dmesg_usage);
+
usage(
dmesg_usage);
exit (FALSE);
}
exit (FALSE);
}
diff --git
a/dutmp.c
b/dutmp.c
index 2dad7d4a5600290524b16393b34afecefa5df01f..7dd5b91fa01b1569c8262709fbce87d4a814c382 100644
(file)
--- 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) == '-')) {
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 ) {
}
if ( **(++argv) == 0 ) {
diff --git
a/fdflush.c
b/fdflush.c
index ce6870cd1128178698d77513de9996b772972638..58b8b37d6ab0a3b045d0b5d9a2b6d6bda20673b1 100644
(file)
--- 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) == '-' ) {
int value;
int fd;
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: fdflush device\n");
- exit(FALSE);
+ usage( "fdflush device\n");
}
fd = open(*argv, 0);
}
fd = open(*argv, 0);
diff --git
a/find.c
b/find.c
index 1fb219496ec0942f5026e92136f0cf098f8e7ebc..51b8707daa295f29862feabd44bc7d6086731ef6 100644
(file)
--- a/
find.c
+++ b/
find.c
@@
-100,8
+100,7
@@
int find_main(int argc, char **argv)
pattern=*(++argv);
stopit=-TRUE;
} else {
pattern=*(++argv);
stopit=-TRUE;
} else {
- fprintf(stderr, "Usage: %s\n", find_usage);
- exit( FALSE);
+ usage (find_usage);
}
}
break;
}
}
break;
@@
-109,8
+108,7
@@
int find_main(int argc, char **argv)
/* Ignore all long options */
break;
default:
/* Ignore all long options */
break;
default:
- fprintf(stderr, "Usage: %s\n", find_usage);
- exit( FALSE);
+ usage (find_usage);
}
if (argc-- > 1)
argv++;
}
if (argc-- > 1)
argv++;
diff --git
a/findutils/find.c
b/findutils/find.c
index 1fb219496ec0942f5026e92136f0cf098f8e7ebc..51b8707daa295f29862feabd44bc7d6086731ef6 100644
(file)
--- a/
findutils/find.c
+++ b/
findutils/find.c
@@
-100,8
+100,7
@@
int find_main(int argc, char **argv)
pattern=*(++argv);
stopit=-TRUE;
} else {
pattern=*(++argv);
stopit=-TRUE;
} else {
- fprintf(stderr, "Usage: %s\n", find_usage);
- exit( FALSE);
+ usage (find_usage);
}
}
break;
}
}
break;
@@
-109,8
+108,7
@@
int find_main(int argc, char **argv)
/* Ignore all long options */
break;
default:
/* Ignore all long options */
break;
default:
- fprintf(stderr, "Usage: %s\n", find_usage);
- exit( FALSE);
+ usage (find_usage);
}
if (argc-- > 1)
argv++;
}
if (argc-- > 1)
argv++;
diff --git
a/internal.h
b/internal.h
index b676e5f864573f8407e9320f041a0e4eef6bbc82..a77ac38bbbd3385f392d71d105d0155ec291c00a 100644
(file)
--- 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 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
#endif
diff --git
a/kill.c
b/kill.c
index 58dc8a98632dd3475dfc4f4272bc3171af159b78..00f10f91f364160a8a34bcc71fabb81280d71c95 100644
(file)
--- a/
kill.c
+++ b/
kill.c
@@
-130,8
+130,7
@@
extern int kill_main (int argc, char **argv)
}
if (had_error) {
end:
}
if (had_error) {
end:
- fprintf(stderr, "Usage: %s\n", kill_usage);
- exit ( FALSE);
+ usage (kill_usage);
}
exit (TRUE);
}
}
exit (TRUE);
}
diff --git
a/length.c
b/length.c
index f2dadd25c8958d231069231b63e77a10332d5682..46242b529eb7f5d9b37092b37c948f15179cf50e 100644
(file)
--- a/
length.c
+++ b/
length.c
@@
-7,8
+7,7
@@
extern int
length_main(int argc, char * * argv)
{
if ( **(argv+1) == '-' ) {
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);
}
printf("%d\n", strlen(argv[1]));
return( TRUE);
diff --git
a/ln.c
b/ln.c
index cd3cb4e450f86e12caa3b1ca48f183c8e29e8df2..8f7719fa466f5bb79066f36a2ef5c629df0f1441 100644
(file)
--- 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) {
char newdestName[NAME_MAX];
if (argc < 3) {
- fprintf(stderr, "Usage: %s", ln_usage);
- exit (FALSE);
+ usage (ln_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-61,8
+60,7
@@
extern int ln_main(int argc, char **argv)
removeoldFlag = TRUE;
break;
default:
removeoldFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", ln_usage);
- exit(FALSE);
+ usage (ln_usage);
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/loadkmap.c
b/loadkmap.c
index 0f092d1932e4058f1fd7cc647b36fafa05731d4d..eb5a5dd4a5b7f846f0b34af9215f62b6f83dbb05 100644
(file)
--- a/
loadkmap.c
+++ b/
loadkmap.c
@@
-14,7
+14,7
@@
const char loadkmap_usage[] = "loadkmap\n"
int
int
-loadkmap_main(
struct FileInfo * info,
int argc, char * * argv)
+loadkmap_main(int argc, char * * argv)
{
struct kbentry ke;
u_short *ibuff;
{
struct kbentry ke;
u_short *ibuff;
diff --git
a/ls.c
b/ls.c
index 2e3d50e9f2d78c2b50058aa58171b0ba5d0d0ded..0adc35de18ee76608a1250057584e99422f5ac24 100644
(file)
--- 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>
#if fooBar
#include <stdio.h>
@@
-110,8
+112,7
@@
int ls_main(int argc, char **argv)
recursiveFlag = TRUE;
break;
default:
recursiveFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", ls_usage);
- exit( FALSE);
+ usage (ls_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-571,7
+572,7
@@
listerr:
return 1;
}
return 1;
}
-const char ls_usage[] = "
Usage:
ls [-1a"
+const char ls_usage[] = "ls [-1a"
#ifdef FEATURE_TIMESTAMPS
"c"
#endif
#ifdef FEATURE_TIMESTAMPS
"c"
#endif
@@
-668,7
+669,7
@@
ls_main(int argc, char * * argv)
exit( i);
print_usage_message:
exit( i);
print_usage_message:
-
fprintf(stderr, "Usage: %s\n",
ls_usage);
+
usage (
ls_usage);
exit( FALSE);
}
exit( FALSE);
}
diff --git
a/makedevs.c
b/makedevs.c
index 691236e298694ff6c2da489792b1dc94ca861e71..00f0066ff5ff9b42e2aa7b85f66c992f7969aabf 100644
(file)
--- 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
"\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];
{
const char *basedev = argv[1];
@@
-45,7
+45,7
@@
char buf[255];
case 'f':
mode = S_IFIFO; break;
default:
case 'f':
mode = S_IFIFO; break;
default:
-
usage(
makedevs_usage);
+
fprintf(stderr, "Usage: %s\n",
makedevs_usage);
return 2;
}
mode |= 0660;
return 2;
}
mode |= 0660;
diff --git
a/miscutils/dutmp.c
b/miscutils/dutmp.c
index 2dad7d4a5600290524b16393b34afecefa5df01f..7dd5b91fa01b1569c8262709fbce87d4a814c382 100644
(file)
--- 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) == '-')) {
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 ) {
}
if ( **(++argv) == 0 ) {
diff --git
a/miscutils/makedevs.c
b/miscutils/makedevs.c
index 691236e298694ff6c2da489792b1dc94ca861e71..00f0066ff5ff9b42e2aa7b85f66c992f7969aabf 100644
(file)
--- 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
"\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];
{
const char *basedev = argv[1];
@@
-45,7
+45,7
@@
char buf[255];
case 'f':
mode = S_IFIFO; break;
default:
case 'f':
mode = S_IFIFO; break;
default:
-
usage(
makedevs_usage);
+
fprintf(stderr, "Usage: %s\n",
makedevs_usage);
return 2;
}
mode |= 0660;
return 2;
}
mode |= 0660;
diff --git
a/miscutils/mt.c
b/miscutils/mt.c
index 7d75fbd3d50d9a298b0937cf07c6149a23735370..a61ad5a40cbe7c6c0ffc55000c8f2e39e07c9d5a 100644
(file)
--- a/
miscutils/mt.c
+++ b/
miscutils/mt.c
@@
-50,7
+50,7
@@
static const struct mt_opcodes opcodes[] = {
};
extern int
};
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;
{
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 ) {
if ( strcmp(argv[1], "-f") == 0 ) {
if ( argc < 4 ) {
- usage(mt_usage);
- return 1;
+ usage (mt_usage);
}
file = argv[2];
argv += 2;
}
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]);
if ( code->name == 0 ) {
fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
- return
1
;
+ return
( FALSE)
;
}
op.mt_op = code->value;
}
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 ) {
op.mt_count = 1; /* One, not zero, right? */
if ( (fd = open(file, O_RDONLY, 0)) < 0 ) {
-
name_and_
error(file);
- return
1
;
+
p
error(file);
+ return
( FALSE)
;
}
if ( ioctl(fd, MTIOCTOP, &op) != 0 ) {
}
if ( ioctl(fd, MTIOCTOP, &op) != 0 ) {
-
name_and_
error(file);
- return
1
;
+
p
error(file);
+ return
( FALSE)
;
}
}
- return
0
;
+ return
( TRUE)
;
}
}
diff --git
a/mkdir.c
b/mkdir.c
index 61d35d5cda1249235b1e918c87d3a4f675bc52c4..b42899a4a890180a16eeb901f4f6ec3b2e12a25b 100644
(file)
--- a/
mkdir.c
+++ b/
mkdir.c
@@
-51,8
+51,7
@@
extern int mkdir_main(int argc, char **argv)
parentFlag = TRUE;
break;
default:
parentFlag = TRUE;
break;
default:
- fprintf(stderr, "%s\n", mkdir_usage);
- exit(FALSE);
+ usage( mkdir_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-60,8
+59,7
@@
extern int mkdir_main(int argc, char **argv)
if (argc < 1) {
if (argc < 1) {
- fprintf(stderr, "%s\n", mkdir_usage);
- exit (FALSE);
+ usage( mkdir_usage);
}
while (--argc > 0) {
}
while (--argc > 0) {
diff --git
a/mknod.c
b/mknod.c
index b18394bec34116ab58041cc1d0a20746a2baaf82..95d7de360d2c521345a2f5014e64d9eb7e7afa87 100644
(file)
--- a/
mknod.c
+++ b/
mknod.c
@@
-1,4
+1,5
@@
#include "internal.h"
#include "internal.h"
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.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
"\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;
{
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:
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 ) {
}
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 ) {
}
}
mode |= 0666;
if ( mknod(argv[1], mode, dev) != 0 ) {
-
name_and_
error(argv[1]);
- return
1
;
+
p
error(argv[1]);
+ return
( FALSE)
;
}
}
- return
0
;
+ return
( TRUE)
;
}
}
diff --git
a/mkswap.c
b/mkswap.c
index f797d1395bef45a86a571efc369c1f0eb5a33067..8c0c4dec78756dc06149710f31e7d1102a6c698e 100644
(file)
--- 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);
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")
}
#define die(str) fatal_error("%s: " str "\n")
@@
-170,7
+170,7
@@
static int get_size(const char *file)
}
int
}
int
-mkswap(char *device_name, int pages, int check)
+mkswap(c
onst c
har *device_name, int pages, int check)
{
struct stat statbuf;
int goodpages;
{
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);
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;
{
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) {
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;
}
} 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 a56ce97d7c2038f0f3af60052bf94ccddbf787c0..53437ed58c50deed4e14e44c5a3b4a6066d13c34 100644
(file)
--- 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 ) {
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++;
}
argc--;
argv++;
diff --git
a/mt.c
b/mt.c
index 7d75fbd3d50d9a298b0937cf07c6149a23735370..a61ad5a40cbe7c6c0ffc55000c8f2e39e07c9d5a 100644
(file)
--- a/
mt.c
+++ b/
mt.c
@@
-50,7
+50,7
@@
static const struct mt_opcodes opcodes[] = {
};
extern int
};
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;
{
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 ) {
if ( strcmp(argv[1], "-f") == 0 ) {
if ( argc < 4 ) {
- usage(mt_usage);
- return 1;
+ usage (mt_usage);
}
file = argv[2];
argv += 2;
}
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]);
if ( code->name == 0 ) {
fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
- return
1
;
+ return
( FALSE)
;
}
op.mt_op = code->value;
}
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 ) {
op.mt_count = 1; /* One, not zero, right? */
if ( (fd = open(file, O_RDONLY, 0)) < 0 ) {
-
name_and_
error(file);
- return
1
;
+
p
error(file);
+ return
( FALSE)
;
}
if ( ioctl(fd, MTIOCTOP, &op) != 0 ) {
}
if ( ioctl(fd, MTIOCTOP, &op) != 0 ) {
-
name_and_
error(file);
- return
1
;
+
p
error(file);
+ return
( FALSE)
;
}
}
- return
0
;
+ return
( TRUE)
;
}
}
diff --git
a/mv.c
b/mv.c
index 2a7c8c1f3b8ef20c7ae24ee00cd9cf62dcd1d8f0..ab3fc2bd5194e67cf2a59b23ba946d8cab05c581 100644
(file)
--- 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) {
char newdestName[NAME_MAX];
if (argc < 3) {
- fprintf(stderr, "Usage: %s", mv_usage);
- exit (FALSE);
+ usage (mv_usage);
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/printf.c
b/printf.c
index e79843c80ababd3964e9cbd16f7f5e1b70c5a1a8..4d4465943b227d28b541578544b126c8945a901e 100644
(file)
--- 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.
/* 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
// 19990508 Busy Boxed! Dave Cinege
+#include "internal.h"
#include <unistd.h>
#include <stdio.h>
#include <sys/types.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;
/* 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
int
-printf_main(
struct FileInfo * i, int argc, char *
* argv)
+printf_main(
int argc, char*
* argv)
{
char *format;
int args_used;
exit_status = 0;
{
char *format;
int args_used;
exit_status = 0;
+ if ( **(argv+1) == '-' ) {
+ usage (printf_usage);
+ }
format = argv[1];
argc -= 2;
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 58dc8a98632dd3475dfc4f4272bc3171af159b78..00f10f91f364160a8a34bcc71fabb81280d71c95 100644
(file)
--- a/
procps/kill.c
+++ b/
procps/kill.c
@@
-130,8
+130,7
@@
extern int kill_main (int argc, char **argv)
}
if (had_error) {
end:
}
if (had_error) {
end:
- fprintf(stderr, "Usage: %s\n", kill_usage);
- exit ( FALSE);
+ usage (kill_usage);
}
exit (TRUE);
}
}
exit (TRUE);
}
diff --git
a/rm.c
b/rm.c
index 477d3af598bfe09d012ec606b49e80101b234fbe..dd8dfa4e6e0634250a2bae12e8b697b6a1b6a1f5 100644
(file)
--- a/
rm.c
+++ b/
rm.c
@@
-25,7
+25,7
@@
#include <utime.h>
#include <dirent.h>
#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";
"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) {
{
if (argc < 2) {
- fprintf(stderr, "Usage: %s", rm_usage);
- exit (FALSE);
+ usage( rm_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-75,8
+74,7
@@
extern int rm_main(int argc, char **argv)
forceFlag = TRUE;
break;
default:
forceFlag = TRUE;
break;
default:
- fprintf(stderr, "Usage: %s\n", rm_usage);
- exit(FALSE);
+ usage( rm_usage);
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/rmdir.c
b/rmdir.c
index b4da03f1296ea85fe1b5dfc553cc0d95101faf09..666e0476a5cb18eab10868f8fdfa0b2b1f06d858 100644
(file)
--- a/
rmdir.c
+++ b/
rmdir.c
@@
-27,8
+27,7
@@
extern int rmdir_main(int argc, char **argv)
{
if ( argc==1 || **(argv+1) == '-' ) {
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) {
}
while (--argc > 0) {
diff --git
a/sleep.c
b/sleep.c
index 53fe5a0c2bf8b6085a208ee9c83bb2b53a54c627..7e38a366757e2ce103ae5df7a54b237412285a57 100644
(file)
--- a/
sleep.c
+++ b/
sleep.c
@@
-8,8
+8,7
@@
extern int
sleep_main(int argc, char * * argv)
{
if ( (argc < 2) || (**(argv+1) == '-') ) {
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 ) {
}
if ( sleep(atoi(*(++argv))) != 0 ) {
diff --git
a/swaponoff.c
b/swaponoff.c
index 56f93b393d46d25384af9d42af9ce22f445a6403..5a2d735ad8f65fca130ee51a131829393799aa9a 100644
(file)
--- a/
swaponoff.c
+++ b/
swaponoff.c
@@
-33,10
+33,10
@@
static int whichApp;
static const char* appName;
static const char swapoff_usage[] =
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[] =
"\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";
"\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);
}
}
swap_enable_disable(*argv);
-
//
exit( TRUE);
+ exit( TRUE);
usage_and_exit:
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 572d749245972afa18ff1c42586400e72829f4e5..8800f2e762bbb6b093c84832e1cc5a974826f915 100644
(file)
--- a/
sync.c
+++ b/
sync.c
@@
-5,9
+5,8
@@
extern int
sync_main(int argc, char * * argv)
{
if ( **(argv+1) == '-' ) {
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 8dac1029474e7ad7152ee75419c7573bcb01ad7e..c36ffca90ffe72a9a35d14097ee4eb065a3e1b67 100644
(file)
--- a/
touch.c
+++ b/
touch.c
@@
-40,8
+40,7
@@
touch_main(int argc, char **argv)
int create=TRUE;
if (argc < 2) {
int create=TRUE;
if (argc < 2) {
- fprintf(stderr, "Usage: %s %s", *argv, touch_usage);
- exit( FALSE);
+ usage( touch_usage);
}
argc--;
argv++;
}
argc--;
argv++;
diff --git
a/umount.c
b/umount.c
index a83a508f7c6d00965a1485dd32953c136b3cb356..625fcfab94d6813466ecff888afd91bbfeadfc08 100644
(file)
--- a/
umount.c
+++ b/
umount.c
@@
-71,8
+71,7
@@
umount_main(int argc, char * * argv)
{
if (argc < 2) {
{
if (argc < 2) {
- fprintf(stderr, "Usage: %s", umount_usage);
- exit(FALSE);
+ usage( umount_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-84,8
+83,7
@@
umount_main(int argc, char * * argv)
exit ( umount_all() );
break;
default:
exit ( umount_all() );
break;
default:
- fprintf(stderr, "Usage: %s\n", umount_usage);
- exit( FALSE);
+ usage( umount_usage);
}
}
if ( umount(*argv) == 0 )
}
}
if ( umount(*argv) == 0 )
diff --git
a/util-linux/dmesg.c
b/util-linux/dmesg.c
index 64265b473e6049a560f324ae2c70f0067570dbc1..e5d403f7acd77b36ed73b478e2dbee6795579c54 100644
(file)
--- a/
util-linux/dmesg.c
+++ b/
util-linux/dmesg.c
@@
-93,6
+93,6
@@
int dmesg_main (int argc, char **argv)
exit (TRUE);
end:
exit (TRUE);
end:
-
fprintf (stderr, "Usage: %s\n",
dmesg_usage);
+
usage(
dmesg_usage);
exit (FALSE);
}
exit (FALSE);
}
diff --git
a/util-linux/fdflush.c
b/util-linux/fdflush.c
index ce6870cd1128178698d77513de9996b772972638..58b8b37d6ab0a3b045d0b5d9a2b6d6bda20673b1 100644
(file)
--- 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) == '-' ) {
int value;
int fd;
if ( **(argv+1) == '-' ) {
- fprintf(stderr, "Usage: fdflush device\n");
- exit(FALSE);
+ usage( "fdflush device\n");
}
fd = open(*argv, 0);
}
fd = open(*argv, 0);
diff --git
a/util-linux/mkswap.c
b/util-linux/mkswap.c
index f797d1395bef45a86a571efc369c1f0eb5a33067..8c0c4dec78756dc06149710f31e7d1102a6c698e 100644
(file)
--- 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);
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")
}
#define die(str) fatal_error("%s: " str "\n")
@@
-170,7
+170,7
@@
static int get_size(const char *file)
}
int
}
int
-mkswap(char *device_name, int pages, int check)
+mkswap(c
onst c
har *device_name, int pages, int check)
{
struct stat statbuf;
int goodpages;
{
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);
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;
{
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) {
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;
}
} 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 a56ce97d7c2038f0f3af60052bf94ccddbf787c0..53437ed58c50deed4e14e44c5a3b4a6066d13c34 100644
(file)
--- 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 ) {
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++;
}
argc--;
argv++;
diff --git
a/util-linux/swaponoff.c
b/util-linux/swaponoff.c
index 56f93b393d46d25384af9d42af9ce22f445a6403..5a2d735ad8f65fca130ee51a131829393799aa9a 100644
(file)
--- 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[] =
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[] =
"\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";
"\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);
}
}
swap_enable_disable(*argv);
-
//
exit( TRUE);
+ exit( TRUE);
usage_and_exit:
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 a83a508f7c6d00965a1485dd32953c136b3cb356..625fcfab94d6813466ecff888afd91bbfeadfc08 100644
(file)
--- a/
util-linux/umount.c
+++ b/
util-linux/umount.c
@@
-71,8
+71,7
@@
umount_main(int argc, char * * argv)
{
if (argc < 2) {
{
if (argc < 2) {
- fprintf(stderr, "Usage: %s", umount_usage);
- exit(FALSE);
+ usage( umount_usage);
}
argc--;
argv++;
}
argc--;
argv++;
@@
-84,8
+83,7
@@
umount_main(int argc, char * * argv)
exit ( umount_all() );
break;
default:
exit ( umount_all() );
break;
default:
- fprintf(stderr, "Usage: %s\n", umount_usage);
- exit( FALSE);
+ usage( umount_usage);
}
}
if ( umount(*argv) == 0 )
}
}
if ( umount(*argv) == 0 )
diff --git
a/utility.c
b/utility.c
index c6121cb11322ba3a9b42a04add578b7656cb303a..f86216eb1303a972d2e2e38ff581768019613293 100644
(file)
--- a/
utility.c
+++ b/
utility.c
@@
-34,6
+34,14
@@
#include <unistd.h>
#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)
/*
#if defined (BB_CP) || defined (BB_MV)
/*