mirror of
https://github.com/topjohnwu/ndk-busybox.git
synced 2024-11-23 19:59:41 +00:00
More stuff.
-Erik
This commit is contained in:
parent
703c62da63
commit
b0e9a709ba
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
3
cat.c
3
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++;
|
||||
|
3
chroot.c
3
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++;
|
||||
|
@ -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;
|
||||
|
@ -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++;
|
||||
|
@ -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++;
|
||||
|
@ -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++;
|
||||
|
@ -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--;
|
||||
|
@ -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);
|
||||
|
@ -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++;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
@ -31,22 +32,20 @@ mknod_main(struct FileInfo * i, int argc, char * * argv)
|
||||
break;
|
||||
default:
|
||||
usage (mknod_usage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( mode == S_IFCHR || mode == S_IFBLK ) {
|
||||
dev = (atoi(argv[3]) << 8) | atoi(argv[4]);
|
||||
if ( argc != 5 ) {
|
||||
usage (mknod_usage);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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++;
|
||||
|
@ -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
|
||||
|
@ -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++;
|
||||
|
@ -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) {
|
||||
|
@ -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 ) {
|
||||
|
@ -5,8 +5,7 @@ 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();
|
||||
}
|
||||
|
@ -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++;
|
||||
|
6
cp.c
6
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++;
|
||||
|
16
date.c
16
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--;
|
||||
|
2
dmesg.c
2
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);
|
||||
}
|
||||
|
3
dutmp.c
3
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 ) {
|
||||
|
@ -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);
|
||||
|
6
find.c
6
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++;
|
||||
|
@ -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++;
|
||||
|
@ -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
|
||||
|
||||
|
3
kill.c
3
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);
|
||||
}
|
||||
|
3
length.c
3
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);
|
||||
|
6
ln.c
6
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++;
|
||||
|
@ -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;
|
||||
|
9
ls.c
9
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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 ) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -60,7 +60,6 @@ mt_main(struct FileInfo * i, int argc, char * * argv)
|
||||
if ( strcmp(argv[1], "-f") == 0 ) {
|
||||
if ( argc < 4 ) {
|
||||
usage (mt_usage);
|
||||
return 1;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
6
mkdir.c
6
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) {
|
||||
|
11
mknod.c
11
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;
|
||||
@ -31,22 +32,20 @@ mknod_main(struct FileInfo * i, int argc, char * * argv)
|
||||
break;
|
||||
default:
|
||||
usage (mknod_usage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( mode == S_IFCHR || mode == S_IFBLK ) {
|
||||
dev = (atoi(argv[3]) << 8) | atoi(argv[4]);
|
||||
if ( argc != 5 ) {
|
||||
usage (mknod_usage);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
13
mkswap.c
13
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;
|
||||
@ -238,7 +238,6 @@ int mkswap_main(struct FileInfo * unnecessary, int argc, char ** argv)
|
||||
pages = strtol(argv[0],&tmp,0)>>(PAGE_SHIFT-10);
|
||||
if (*tmp) {
|
||||
usage (mkswap_usage);
|
||||
exit(1);
|
||||
}
|
||||
} else
|
||||
device_name = argv[0];
|
||||
@ -246,8 +245,8 @@ int mkswap_main(struct FileInfo * unnecessary, int argc, char ** argv)
|
||||
switch (argv[0][0]) {
|
||||
case 'c': check=1; break;
|
||||
default: usage (mkswap_usage);
|
||||
exit(1);
|
||||
exit( TRUE);
|
||||
}
|
||||
}
|
||||
return mkswap(device_name, pages, check);
|
||||
exit( mkswap(device_name, pages, check));
|
||||
}
|
||||
|
3
more.c
3
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++;
|
||||
|
15
mt.c
15
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;
|
||||
@ -60,7 +60,6 @@ mt_main(struct FileInfo * i, int argc, char * * argv)
|
||||
if ( strcmp(argv[1], "-f") == 0 ) {
|
||||
if ( argc < 4 ) {
|
||||
usage (mt_usage);
|
||||
return 1;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
3
mv.c
3
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++;
|
||||
|
14
printf.c
14
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
|
||||
|
@ -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);
|
||||
}
|
||||
|
8
rm.c
8
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++;
|
||||
|
3
rmdir.c
3
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) {
|
||||
|
3
sleep.c
3
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 ) {
|
||||
|
@ -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);
|
||||
usage( (whichApp==SWAPON_APP)? swapon_usage : swapoff_usage);
|
||||
exit( FALSE);
|
||||
}
|
||||
|
||||
|
3
sync.c
3
sync.c
@ -5,8 +5,7 @@ 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();
|
||||
}
|
||||
|
3
touch.c
3
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++;
|
||||
|
6
umount.c
6
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 )
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
@ -238,7 +238,6 @@ int mkswap_main(struct FileInfo * unnecessary, int argc, char ** argv)
|
||||
pages = strtol(argv[0],&tmp,0)>>(PAGE_SHIFT-10);
|
||||
if (*tmp) {
|
||||
usage (mkswap_usage);
|
||||
exit(1);
|
||||
}
|
||||
} else
|
||||
device_name = argv[0];
|
||||
@ -246,8 +245,8 @@ int mkswap_main(struct FileInfo * unnecessary, int argc, char ** argv)
|
||||
switch (argv[0][0]) {
|
||||
case 'c': check=1; break;
|
||||
default: usage (mkswap_usage);
|
||||
exit(1);
|
||||
exit( TRUE);
|
||||
}
|
||||
}
|
||||
return mkswap(device_name, pages, check);
|
||||
exit( mkswap(device_name, pages, check));
|
||||
}
|
||||
|
@ -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++;
|
||||
|
@ -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);
|
||||
usage( (whichApp==SWAPON_APP)? swapon_usage : swapoff_usage);
|
||||
exit( FALSE);
|
||||
}
|
||||
|
||||
|
@ -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 )
|
||||
|
Loading…
Reference in New Issue
Block a user