Updates to usage, and made tar work. -Erik
No binary (build failed)
—
(log yok)
| @@ -1,3 +1,12 @@ | |
| + | 0.35 |
| + | * Fixed tar so it now works as expected (it had TRUE/FALSE backwards) |
| + | * tar now accepts --help |
| + | * chmod, chown, and chgrp usage now works |
| + | * General usage cleanups in most apps |
| + | * umount now parses options correctly |
| + | |
| + | -Erik Andersen |
| + | |
| 0.34 | |
| * ls -l now displays link names outside the current directory, | |
| Patch thanks to Eric Delaunay | |
| @@ -220,12 +220,12 @@ int busybox_main(int argc, char **argv) | |
| if (been_there_done_that == 1 || argc < 1) { | |
| const struct Applet *a = applets; | |
| - | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n", |
| + | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
| BB_VER, BB_BT); | |
| - | fprintf(stderr, "\nUsage:\t[function] [arguments]...\n"); |
| - | fprintf(stderr, "\tbusybox [function] [arguments]...\n"); |
| + | fprintf(stderr, "Usage: busybox [function] [arguments]...\n"); |
| + | fprintf(stderr, " or: [function] [arguments]...\n\n"); |
| fprintf(stderr, | |
| - | "\n\tMost people will create a symlink to busybox for each\n" |
| + | "\tMost people will create a symlink to busybox for each\n" |
| "\tfunction name, and busybox will act like whatever you invoke it as.\n"); | |
| fprintf(stderr, "\nCurrently defined functions:\n"); | |
| @@ -35,22 +35,13 @@ | |
| #include <signal.h> | |
| #include <time.h> | |
| - | /* Note that tar.c expects TRUE and FALSE to be defined |
| - | * exactly the opposite of how they are used everywhere else. |
| - | * Some time this should be integrated a bit better, but this |
| - | * does the job for now. |
| - | */ |
| - | //#undef FALSE |
| - | //#undef TRUE |
| - | //#define FALSE ((int) 0) |
| - | //#define TRUE ((int) 1) |
| - | |
| static const char tar_usage[] = | |
| - | "tar -[cxtvOf] [tarFileName] [FILE] ...\n" |
| - | "Create, extract, or list files from a tar file\n\n" |
| - | "\tc=create, x=extract, t=list contents, v=verbose,\n" |
| - | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; |
| + | "tar -[cxtvOf] [tarFileName] [FILE] ...\n\n" |
| + | "Create, extract, or list files from a tar file\n\n" |
| + | "Options:\n" |
| + | "\tc=create, x=extract, t=list contents, v=verbose,\n" |
| + | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; |
| @@ -96,18 +87,18 @@ typedef struct { | |
| /* | |
| * Static data. | |
| */ | |
| - | static int listFlag; // |
| - | static int extractFlag; // |
| - | static int createFlag; // |
| - | static int verboseFlag; // |
| - | static int tostdoutFlag; // |
| + | static int listFlag; |
| + | static int extractFlag; |
| + | static int createFlag; |
| + | static int verboseFlag; |
| + | static int tostdoutFlag; |
| static int inHeader; // <- check me | |
| - | static int badHeader; // |
| - | static int errorFlag; // |
| - | static int skipFileFlag; // |
| - | static int warnedRoot; // |
| - | static int eofFlag; // |
| + | static int badHeader; |
| + | static int errorFlag; |
| + | static int skipFileFlag; |
| + | static int warnedRoot; |
| + | static int eofFlag; |
| static long dataCc; | |
| static int outFd; | |
| static char outName[TAR_NAME_SIZE]; | |
| @@ -136,7 +127,7 @@ static void readHeader (const TarHeader * hp, | |
| /* | |
| * Local procedures to save files into a tar file. | |
| */ | |
| - | static void saveFile (const char *fileName, int seeLinks); // |
| + | static void saveFile (const char *fileName, int seeLinks); |
| static void saveRegularFile (const char *fileName, | |
| const struct stat *statbuf); | |
| @@ -145,13 +136,13 @@ static void saveDirectory (const char *fileName, | |
| const struct stat *statbuf); | |
| static int wantFileName (const char *fileName, | |
| - | int fileCount, char **fileTable); // |
| + | int fileCount, char **fileTable); |
| static void writeHeader (const char *fileName, const struct stat *statbuf); | |
| static void writeTarFile (int fileCount, char **fileTable); | |
| static void writeTarBlock (const char *buf, int len); | |
| - | static int putOctal (char *cp, int len, long value); // |
| + | static int putOctal (char *cp, int len, long value); |
| extern int tar_main (int argc, char **argv) | |
| @@ -217,10 +208,13 @@ extern int tar_main (int argc, char **argv) | |
| break; | |
| case '-': | |
| + | usage( tar_usage); |
| break; | |
| default: | |
| - | fprintf (stderr, "Unknown tar flag '%c'\n", *options); |
| + | fprintf (stderr, "Unknown tar flag '%c'\n" |
| + | "Try `tar --help' for more information\n", |
| + | *options); |
| exit (FALSE); | |
| } | |
| @@ -230,7 +224,6 @@ extern int tar_main (int argc, char **argv) | |
| /* | |
| * Validate the options. | |
| */ | |
| - | fprintf(stderr, "TRUE=%d FALSE=%d\n", TRUE, FALSE); |
| if (extractFlag + listFlag + createFlag != (TRUE+FALSE+FALSE)) { | |
| fprintf (stderr, | |
| "Exactly one of 'c', 'x' or 't' must be specified\n"); | |
| @@ -220,12 +220,12 @@ int busybox_main(int argc, char **argv) | |
| if (been_there_done_that == 1 || argc < 1) { | |
| const struct Applet *a = applets; | |
| - | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n", |
| + | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
| BB_VER, BB_BT); | |
| - | fprintf(stderr, "\nUsage:\t[function] [arguments]...\n"); |
| - | fprintf(stderr, "\tbusybox [function] [arguments]...\n"); |
| + | fprintf(stderr, "Usage: busybox [function] [arguments]...\n"); |
| + | fprintf(stderr, " or: [function] [arguments]...\n\n"); |
| fprintf(stderr, | |
| - | "\n\tMost people will create a symlink to busybox for each\n" |
| + | "\tMost people will create a symlink to busybox for each\n" |
| "\tfunction name, and busybox will act like whatever you invoke it as.\n"); | |
| fprintf(stderr, "\nCurrently defined functions:\n"); | |
| @@ -2,6 +2,7 @@ | |
| * This file is parsed by sed. You MUST use single line comments. | |
| * IE //#define BB_BLAH | |
| */ | |
| + | |
| #define BB_BUSYBOX | |
| #define BB_CAT | |
| #define BB_CHMOD_CHOWN_CHGRP | |
| @@ -12,48 +13,48 @@ | |
| #define BB_DD | |
| #define BB_DF | |
| #define BB_DMESG | |
| - | #define BB_DUTMP |
| - | #define BB_FDFLUSH |
| + | //#define BB_DUTMP |
| + | //#define BB_FDFLUSH |
| #define BB_FIND | |
| #define BB_FSCK_MINIX | |
| #define BB_MKFS_MINIX | |
| #define BB_CHVT | |
| #define BB_DEALLOCVT | |
| #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_LOADFONT | |
| #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_MNC |
| + | //#define BB_MNC |
| #define BB_MORE | |
| #define BB_MOUNT | |
| - | #define BB_MT |
| - | #define BB_MTAB |
| + | //#define BB_MT |
| + | //#define BB_MTAB |
| #define BB_MV | |
| - | #define BB_PRINTF |
| + | //#define BB_PRINTF |
| #define BB_PS | |
| #define BB_PWD | |
| #define BB_REGEXP | |
| #define BB_REBOOT | |
| #define BB_RM | |
| #define BB_RMDIR | |
| - | #define BB_SFDISK |
| + | //#define BB_SFDISK |
| #define BB_SED | |
| #define BB_SLEEP | |
| #define BB_SWAPONOFF | |
| #define BB_SYNC | |
| #define BB_TAR | |
| #define BB_TOUCH | |
| - | #define BB_TRUE_FALSE |
| + | //#define BB_TRUE_FALSE // Supplied by ash |
| #define BB_UMOUNT | |
| #define BB_UPDATE | |
| #define BB_UNAME | |
| @@ -38,16 +38,16 @@ static mode_t mode=0644; | |
| #define CHOWN_APP 2 | |
| #define CHMOD_APP 3 | |
| - | static const char chgrp_usage[] = "[OPTION]... GROUP FILE...\n" |
| + | static const char chgrp_usage[] = "chgrp [OPTION]... GROUP FILE...\n\n" |
| "Change the group membership of each FILE to GROUP.\n" | |
| - | "\n\tOptions:\n" "\t-R\tchange files and directories recursively\n"; |
| - | static const char chown_usage[] = "[OPTION]... OWNER[.[GROUP] FILE...\n" |
| + | "\nOptions:\n\t-R\tchange files and directories recursively\n"; |
| + | static const char chown_usage[] = "chown [OPTION]... OWNER[.[GROUP] FILE...\n\n" |
| "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" | |
| - | "\n\tOptions:\n" "\t-R\tchange files and directories recursively\n"; |
| - | static const char chmod_usage[] = "[-R] MODE[,MODE]... FILE...\n" |
| + | "\nOptions:\n\t-R\tchange files and directories recursively\n"; |
| + | static const char chmod_usage[] = "chmod [-R] MODE[,MODE]... FILE...\n\n" |
| "Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n" | |
| "one or more of the letters rwxst.\n\n" | |
| - | "\t-R\tchange files and directories recursively.\n"; |
| + | "\nOptions:\n\t-R\tchange files and directories recursively.\n"; |
| static int fileAction(const char *fileName, struct stat* statbuf) | |
| @@ -73,14 +73,14 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |
| { | |
| int recursiveFlag=FALSE; | |
| char *groupName; | |
| + | const char *appUsage; |
| whichApp = (strcmp(*argv, "chown")==0)? CHOWN_APP : (strcmp(*argv, "chmod")==0)? CHMOD_APP : CHGRP_APP; | |
| - | if (argc < 2) { |
| - | fprintf(stderr, "Usage: %s %s", *argv, |
| - | (whichApp==TRUE)? chown_usage : chgrp_usage); |
| - | exit( FALSE); |
| - | } |
| + | appUsage = (whichApp==CHOWN_APP)? chown_usage : (whichApp==CHMOD_APP)? chmod_usage : chgrp_usage; |
| + | |
| + | if (argc < 2) |
| + | usage( appUsage); |
| invocationName=*argv; | |
| argc--; | |
| argv++; | |
| @@ -93,7 +93,7 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |
| break; | |
| default: | |
| fprintf(stderr, "Unknown option: %c\n", **argv); | |
| - | exit( FALSE); |
| + | usage( appUsage); |
| } | |
| argc--; | |
| argv++; | |
| @@ -27,7 +27,7 @@ | |
| #include <errno.h> | |
| - | static const char chroot_usage[] = "NEWROOT [COMMAND...]\n" |
| + | static const char chroot_usage[] = "chroot NEWROOT [COMMAND...]\n\n" |
| "Run COMMAND with root directory set to NEWROOT.\n"; | |
| @@ -19,7 +19,7 @@ chvt_main(int argc, char** argv) | |
| int fd, num; | |
| if ( ( argc != 2) || (**(argv+1) == '-' ) ) { | |
| - | usage ("chvt </dev/ttyN>\n"); |
| + | usage ("chvt N\n\nChange foreground virtual terminal to /dev/ttyN\n"); |
| } | |
| fd = get_console_fd("/dev/console"); | |
| num = atoi(argv[1]); | |
| @@ -19,7 +19,7 @@ chvt_main(int argc, char** argv) | |
| int fd, num; | |
| if ( ( argc != 2) || (**(argv+1) == '-' ) ) { | |
| - | usage ("chvt </dev/ttyN>\n"); |
| + | usage ("chvt N\n\nChange foreground virtual terminal to /dev/ttyN\n"); |
| } | |
| fd = get_console_fd("/dev/console"); | |
| num = atoi(argv[1]); | |
| @@ -17,8 +17,10 @@ int | |
| deallocvt_main(int argc, char *argv[]) { | |
| int fd, num, i; | |
| - | if (argc < 1) /* unlikely */ |
| - | exit(1); |
| + | if ( ( argc != 2) || (**(argv+1) == '-' ) ) { |
| + | usage ("deallocvt N\n\nDeallocate unused virtual terminal /dev/ttyN\n"); |
| + | } |
| + | |
| progname = argv[0]; | |
| fd = get_console_fd("/dev/console"); | |
| @@ -27,7 +27,7 @@ | |
| #include <errno.h> | |
| - | static const char chroot_usage[] = "NEWROOT [COMMAND...]\n" |
| + | static const char chroot_usage[] = "chroot NEWROOT [COMMAND...]\n\n" |
| "Run COMMAND with root directory set to NEWROOT.\n"; | |
| @@ -28,7 +28,7 @@ | |
| #include <dirent.h> | |
| static const char cp_usage[] = "cp [OPTION]... SOURCE DEST\n" | |
| - | " or: cp [OPTION]... SOURCE... DIRECTORY\n" |
| + | " or: cp [OPTION]... SOURCE... DIRECTORY\n\n" |
| "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" | |
| "\n" | |
| "\t-a\tsame as -dpR\n" | |
| @@ -35,7 +35,7 @@ | |
| mail commands */ | |
| static const char date_usage[] = "date [OPTION]... [+FORMAT]\n" | |
| - | " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n" |
| + | " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n\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" | |
| "\t-s\t\tset time described by STRING\n" | |
| @@ -34,7 +34,7 @@ | |
| #include <errno.h> | |
| static const char dd_usage[] = | |
| - | "dd [if=name] [of=name] [bs=n] [count=n]\n" |
| + | "dd [if=name] [of=name] [bs=n] [count=n]\n\n" |
| "Copy a file, converting and formatting according to options\n\n" | |
| "\tif=FILE\tread from FILE instead of stdin\n" | |
| "\tof=FILE\twrite to FILE instead of stout\n" | |
| @@ -227,8 +227,7 @@ extern int dd_main (int argc, char **argv) | |
| exit( TRUE); | |
| usage: | |
| - | fprintf (stderr, "%s", dd_usage); |
| - | exit( FALSE); |
| + | usage( dd_usage); |
| } | |
| @@ -27,9 +27,9 @@ | |
| #include <errno.h> | |
| - | static const char ln_usage[] = "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n" |
| - | "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n" |
| - | "\nOptions:\n" |
| + | static const char ln_usage[] = "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n" |
| + | "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n\n" |
| + | "Options:\n" |
| "\t-s\tmake symbolic links instead of hard links\n" | |
| "\t-f\tremove existing destination files\n"; | |
| @@ -26,10 +26,11 @@ | |
| #include <errno.h> | |
| #include <sys/param.h> | |
| - | static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n" |
| + | static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n\n" |
| "Create the DIRECTORY(ies), if they do not already exist\n\n" | |
| - | "-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" |
| - | "-p\tno error if existing, make parent directories as needed\n"; |
| + | "Options:\n" |
| + | "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" |
| + | "\t-p\tno error if existing, make parent directories as needed\n"; |
| static int parentFlag = FALSE; | |
| @@ -27,9 +27,9 @@ | |
| #include <fcntl.h> | |
| #include <unistd.h> | |
| - | static const char mknod_usage[] = "mknod file b|c|u|p major minor\n" |
| - | "\tMake special files.\n" |
| - | "\n" |
| + | static const char mknod_usage[] = "mknod [OPTION]... NAME TYPE MAJOR MINOR\n\n" |
| + | "Make block or character special files.\n\n" |
| + | "Options:\n" |
| "\tb:\tMake a block (buffered) device.\n" | |
| "\tc or u:\tMake a character (un-buffered) device.\n" | |
| "\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n"; | |
| @@ -29,7 +29,7 @@ | |
| static const char mv_usage[] = "mv SOURCE DEST\n" | |
| - | " or: mv SOURCE... DIRECTORY\n" |
| + | " or: mv SOURCE... DIRECTORY\n\n" |
| "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n"; | |
| @@ -27,8 +27,9 @@ | |
| #include <utime.h> | |
| #include <dirent.h> | |
| - | static const char* rm_usage = "rm [OPTION]... FILE...\n" |
| + | static const char* rm_usage = "rm [OPTION]... FILE...\n\n" |
| "Remove (unlink) the FILE(s).\n\n" | |
| + | "Options:\n" |
| "\t-f\tremove existing destinations, never prompt\n" | |
| "\t-r\tremove the contents of directories recursively\n"; | |
| @@ -29,7 +29,7 @@ | |
| extern int rmdir_main(int argc, char **argv) | |
| { | |
| if ( argc==1 || **(argv+1) == '-' ) { | |
| - | usage( "rmdir [OPTION]... DIRECTORY...\nRemove the DIRECTORY(ies), if they are empty."); |
| + | usage( "rmdir [OPTION]... DIRECTORY...\n\nRemove the DIRECTORY(ies), if they are empty.\n"); |
| } | |
| while (--argc > 0) { | |
| @@ -23,8 +23,8 @@ | |
| #include "internal.h" | |
| #include <stdio.h> | |
| - | const char sleep_usage[] = " NUMBER\n" |
| - | "Pause for NUMBER seconds.\n"; |
| + | const char sleep_usage[] = "sleep N\n\n" |
| + | "Pause for N seconds.\n"; |
| extern int | |
| sleep_main(int argc, char * * argv) | |
| @@ -27,7 +27,7 @@ extern int | |
| sync_main(int argc, char * * argv) | |
| { | |
| if ( argc>1 && **(argv+1) == '-' ) { | |
| - | usage( "sync\nWrite all buffered filesystem blocks to disk.\n"); |
| + | usage( "sync\n\nWrite all buffered filesystem blocks to disk.\n"); |
| } | |
| exit( sync()); | |
| } | |
| @@ -31,7 +31,7 @@ | |
| static const char touch_usage[] = "touch [-c] file [file ...]\n\n" | |
| - | "\tUpdate the last-modified date on the given file[s].\n"; |
| + | "Update the last-modified date on the given file[s].\n"; |
| @@ -54,7 +54,7 @@ touch_main(int argc, char **argv) | |
| create = FALSE; | |
| break; | |
| default: | |
| - | fprintf(stderr, "Unknown option: %c\n", **argv); |
| + | usage( touch_usage); |
| exit( FALSE); | |
| } | |
| argc--; | |
| @@ -41,8 +41,9 @@ | |
| static const char uname_usage[] = | |
| - | "uname [OPTION]...\n" |
| - | "Print certain system information. With no OPTION, same as -s.\n" |
| + | "uname [OPTION]...\n\n" |
| + | "Print certain system information. With no OPTION, same as -s.\n\n" |
| + | "Options:\n" |
| "\t-a\tprint all information\n" | |
| "\t-m\tthe machine (hardware) type\n" | |
| "\t-n\tprint the machine's network node hostname\n" | |
| @@ -28,7 +28,7 @@ | |
| #include <dirent.h> | |
| static const char cp_usage[] = "cp [OPTION]... SOURCE DEST\n" | |
| - | " or: cp [OPTION]... SOURCE... DIRECTORY\n" |
| + | " or: cp [OPTION]... SOURCE... DIRECTORY\n\n" |
| "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" | |
| "\n" | |
| "\t-a\tsame as -dpR\n" | |
| @@ -35,7 +35,7 @@ | |
| mail commands */ | |
| static const char date_usage[] = "date [OPTION]... [+FORMAT]\n" | |
| - | " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n" |
| + | " or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n\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" | |
| "\t-s\t\tset time described by STRING\n" | |
| @@ -34,7 +34,7 @@ | |
| #include <errno.h> | |
| static const char dd_usage[] = | |
| - | "dd [if=name] [of=name] [bs=n] [count=n]\n" |
| + | "dd [if=name] [of=name] [bs=n] [count=n]\n\n" |
| "Copy a file, converting and formatting according to options\n\n" | |
| "\tif=FILE\tread from FILE instead of stdin\n" | |
| "\tof=FILE\twrite to FILE instead of stout\n" | |
| @@ -227,8 +227,7 @@ extern int dd_main (int argc, char **argv) | |
| exit( TRUE); | |
| usage: | |
| - | fprintf (stderr, "%s", dd_usage); |
| - | exit( FALSE); |
| + | usage( dd_usage); |
| } | |
| @@ -17,8 +17,10 @@ int | |
| deallocvt_main(int argc, char *argv[]) { | |
| int fd, num, i; | |
| - | if (argc < 1) /* unlikely */ |
| - | exit(1); |
| + | if ( ( argc != 2) || (**(argv+1) == '-' ) ) { |
| + | usage ("deallocvt N\n\nDeallocate unused virtual terminal /dev/ttyN\n"); |
| + | } |
| + | |
| progname = argv[0]; | |
| fd = get_console_fd("/dev/console"); | |
| @@ -32,18 +32,18 @@ | |
| #include <ctype.h> | |
| static const char sed_usage[] = | |
| - | "sed [-n] [-e script] [file...]\n" |
| - | "Allowed scripts come in the following form:\n\n" |
| - | "'s/regexp/replacement/[gp]'\n" |
| - | "\tattempt to match regexp against the pattern space\n" |
| - | "\tand if successful replaces the matched portion with replacement.\n\n" |
| + | "sed [-n] [-e script] [file...]\n\n" |
| + | "Allowed sed scripts come in the following form:\n" |
| + | "\t's/regexp/replacement/[gp]'\n" |
| + | "which attempt to match regexp against the pattern space\n" |
| + | "and if successful replaces the matched portion with replacement.\n\n" |
| "Options:\n" | |
| "-e\tadd the script to the commands to be executed\n" | |
| "-n\tsuppress automatic printing of pattern space\n\n" | |
| #if defined BB_REGEXP | |
| - | "This version of sed matches full regexps.\n"; |
| + | "This version of sed matches full regular expresions.\n"; |
| #else | |
| - | "This version of sed matches strings (not full regexps).\n"; |
| + | "This version of sed matches strings (not full regular expresions).\n"; |
| #endif | |
| @@ -32,9 +32,18 @@ static char* pattern=NULL; | |
| static char* directory="."; | |
| static int dereferenceFlag=FALSE; | |
| - | static const char find_usage[] = "find [path...] [expression]\n" |
| - | "default path is the current directory; default expression is -print\n" |
| - | "expression may consist of:\n"; |
| + | static const char find_usage[] = "find [PATH...] [EXPRESSION]\n\n" |
| + | "Search for files in a directory hierarchy. The default PATH is\n" |
| + | "the current directory; default EXPRESSION is '-print'\n\n" |
| + | "\nEXPRESSION may consist of:\n" |
| + | "\t-follow\n\t\tDereference symbolic links.\n" |
| + | "\t-name PATTERN\n\t\tFile name (with leading directories removed) matches PATTERN.\n" |
| + | "\t-print\n\t\tprint the full file name followed by a newline to stdout.\n\n" |
| + | #if defined BB_REGEXP |
| + | "This version of find matches full regular expresions.\n"; |
| + | #else |
| + | "This version of find matches strings (not regular expresions).\n"; |
| + | #endif |
| @@ -32,9 +32,18 @@ static char* pattern=NULL; | |
| static char* directory="."; | |
| static int dereferenceFlag=FALSE; | |
| - | static const char find_usage[] = "find [path...] [expression]\n" |
| - | "default path is the current directory; default expression is -print\n" |
| - | "expression may consist of:\n"; |
| + | static const char find_usage[] = "find [PATH...] [EXPRESSION]\n\n" |
| + | "Search for files in a directory hierarchy. The default PATH is\n" |
| + | "the current directory; default EXPRESSION is '-print'\n\n" |
| + | "\nEXPRESSION may consist of:\n" |
| + | "\t-follow\n\t\tDereference symbolic links.\n" |
| + | "\t-name PATTERN\n\t\tFile name (with leading directories removed) matches PATTERN.\n" |
| + | "\t-print\n\t\tprint the full file name followed by a newline to stdout.\n\n" |
| + | #if defined BB_REGEXP |
| + | "This version of find matches full regular expresions.\n"; |
| + | #else |
| + | "This version of find matches strings (not regular expresions).\n"; |
| + | #endif |
| @@ -32,15 +32,16 @@ | |
| #include <ctype.h> | |
| static const char grep_usage[] = | |
| - | "grep [-ihn]... PATTERN [FILE]...\n" |
| + | "grep [OPTIONS]... PATTERN [FILE]...\n\n" |
| "Search for PATTERN in each FILE or standard input.\n\n" | |
| + | "OPTIONS:\n" |
| "\t-h\tsuppress the prefixing filename on output\n" | |
| "\t-i\tignore case distinctions\n" | |
| "\t-n\tprint line number with output lines\n\n" | |
| #if defined BB_REGEXP | |
| - | "This version of grep matches full regexps.\n"; |
| + | "This version of grep matches full regular expresions.\n"; |
| #else | |
| - | "This version of grep matches strings (not regexps).\n"; |
| + | "This version of grep matches strings (not regular expresions).\n"; |
| #endif | |
| @@ -191,9 +191,17 @@ static void leave(int status) | |
| } | |
| static void show_usage(void) { | |
| - | fprintf(stderr, |
| - | "Usage: %s [-larvsmf] /dev/name\n", |
| - | program_name); |
| + | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); |
| + | fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n\n", program_name); |
| + | fprintf(stderr, "Performs a consistency check for MINIX filesystems.\n\n"); |
| + | fprintf(stderr, "OPTIONS:\n"); |
| + | fprintf(stderr, "\t-l\tLists all filenames\n"); |
| + | fprintf(stderr, "\t-r\tPerform interactive repairs\n"); |
| + | fprintf(stderr, "\t-a\tPerform automatic repairs\n"); |
| + | fprintf(stderr, "\t-v\tverbose\n"); |
| + | fprintf(stderr, "\t-s\tOutputs super-block information\n"); |
| + | fprintf(stderr, "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n"); |
| + | fprintf(stderr, "\t-f\tForce file system check.\n\n"); |
| leave(16); | |
| } | |
| @@ -32,15 +32,16 @@ | |
| #include <ctype.h> | |
| static const char grep_usage[] = | |
| - | "grep [-ihn]... PATTERN [FILE]...\n" |
| + | "grep [OPTIONS]... PATTERN [FILE]...\n\n" |
| "Search for PATTERN in each FILE or standard input.\n\n" | |
| + | "OPTIONS:\n" |
| "\t-h\tsuppress the prefixing filename on output\n" | |
| "\t-i\tignore case distinctions\n" | |
| "\t-n\tprint line number with output lines\n\n" | |
| #if defined BB_REGEXP | |
| - | "This version of grep matches full regexps.\n"; |
| + | "This version of grep matches full regular expresions.\n"; |
| #else | |
| - | "This version of grep matches strings (not regexps).\n"; |
| + | "This version of grep matches strings (not regular expresions).\n"; |
| #endif | |
| @@ -430,6 +430,13 @@ extern int init_main(int argc, char **argv) | |
| #endif | |
| + | #ifndef DEBUG_INIT |
| + | if (getpid() != 1) { |
| + | usage( "init\n\nInit is the parent of all processes.\n\n" |
| + | "This version of init is designed to be run only by the kernel\n"); |
| + | } |
| + | #endif |
| + | |
| /* Check if we are supposed to be in single user mode */ | |
| if ( argc > 1 && (!strcmp(argv[1], "single") || | |
| !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) { | |
| @@ -430,6 +430,13 @@ extern int init_main(int argc, char **argv) | |
| #endif | |
| + | #ifndef DEBUG_INIT |
| + | if (getpid() != 1) { |
| + | usage( "init\n\nInit is the parent of all processes.\n\n" |
| + | "This version of init is designed to be run only by the kernel\n"); |
| + | } |
| + | #endif |
| + | |
| /* Check if we are supposed to be in single user mode */ | |
| if ( argc > 1 && (!strcmp(argv[1], "single") || | |
| !strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) { | |
| @@ -138,7 +138,7 @@ 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); |
| + | extern void usage(const char *usage) __attribute__ ((noreturn)); |
| extern uid_t my_getpwnam(char *name); | |
| extern gid_t my_getgrnam(char *name); | |
| @@ -27,9 +27,9 @@ | |
| #include <errno.h> | |
| - | static const char ln_usage[] = "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n" |
| - | "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n" |
| - | "\nOptions:\n" |
| + | static const char ln_usage[] = "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n" |
| + | "Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n\n" |
| + | "Options:\n" |
| "\t-s\tmake symbolic links instead of hard links\n" | |
| "\t-f\tremove existing destination files\n"; | |
| @@ -26,10 +26,11 @@ | |
| #include <errno.h> | |
| #include <sys/param.h> | |
| - | static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n" |
| + | static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n\n" |
| "Create the DIRECTORY(ies), if they do not already exist\n\n" | |
| - | "-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" |
| - | "-p\tno error if existing, make parent directories as needed\n"; |
| + | "Options:\n" |
| + | "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" |
| + | "\t-p\tno error if existing, make parent directories as needed\n"; |
| static int parentFlag = FALSE; | |
| @@ -171,10 +171,15 @@ static volatile void die(char *str) { | |
| static volatile void show_usage() | |
| { | |
| - | fprintf(stderr, "%s\n", program_name); |
| - | fprintf(stderr, |
| - | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", |
| - | program_name); |
| + | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); |
| + | fprintf(stderr, "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n\n", program_name); |
| + | fprintf(stderr, "Make a MINIX filesystem.\n\n"); |
| + | fprintf(stderr, "OPTIONS:\n"); |
| + | fprintf(stderr, "\t-c\t\tCheck the device for bad blocks\n"); |
| + | fprintf(stderr, "\t-n [14|30]\tSpecify the maximum length of filenames\n"); |
| + | fprintf(stderr, "\t-i\t\tSpecify the number of inodes for the filesystem\n"); |
| + | fprintf(stderr, "\t-l FILENAME\tRead the bad blocks list from FILENAME\n"); |
| + | fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n"); |
| exit(16); | |
| } | |
| @@ -27,9 +27,9 @@ | |
| #include <fcntl.h> | |
| #include <unistd.h> | |
| - | static const char mknod_usage[] = "mknod file b|c|u|p major minor\n" |
| - | "\tMake special files.\n" |
| - | "\n" |
| + | static const char mknod_usage[] = "mknod [OPTION]... NAME TYPE MAJOR MINOR\n\n" |
| + | "Make block or character special files.\n\n" |
| + | "Options:\n" |
| "\tb:\tMake a block (buffered) device.\n" | |
| "\tc or u:\tMake a character (un-buffered) device.\n" | |
| "\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n"; | |
| @@ -47,11 +47,12 @@ | |
| /* we also get PAGE_SIZE via getpagesize() */ | |
| - | static const char mkswap_usage[] = "mkswap [-c] [-v0|-v1] device [block-count]\n" |
| + | static const char mkswap_usage[] = "mkswap [-c] [-v0|-v1] device [block-count]\n\n" |
| "Prepare a disk partition to be used as a swap partition.\n\n" | |
| - | "\t-c\tCheck for read-ability.\n" |
| - | "\t-v0\tMake version 0 swap [max 128 Megs].\n" |
| - | "\t-v1\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" |
| + | "Options:\n" |
| + | "\t-c\t\tCheck for read-ability.\n" |
| + | "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" |
| + | "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" |
| "\tblock-count\tNumber of block to use (default is entire partition).\n"; | |
| @@ -37,7 +37,7 @@ | |
| #include <signal.h> | |
| #include <sys/ioctl.h> | |
| - | static const char more_usage[] = "[file ...]"; |
| + | static const char more_usage[] = "more [file ...]\n"; |
| /* ED: sparc termios is broken: revert back to old termio handling. */ | |
| #ifdef BB_FEATURE_USE_TERMIOS | |
| @@ -43,7 +43,7 @@ | |
| extern const char mtab_file[]; /* Defined in utility.c */ | |
| - | static const char mount_usage[] = "Usage:\tmount [flags]\n" |
| + | static const char mount_usage[] = "\tmount [flags]\n" |
| "\tmount [flags] device directory [-o options,more-options]\n" | |
| "\n" | |
| "Flags:\n" | |
| @@ -248,8 +248,7 @@ extern int mount_main (int argc, char **argv) | |
| while (i>0 && *++(*argv)) switch (**argv) { | |
| case 'o': | |
| if (--i == 0) { | |
| - | fprintf (stderr, "%s\n", mount_usage); |
| - | exit( FALSE); |
| + | goto goodbye; |
| } | |
| parse_mount_options (*(++argv), &flags, string_flags); | |
| --i; | |
| @@ -260,8 +259,7 @@ extern int mount_main (int argc, char **argv) | |
| break; | |
| case 't': | |
| if (--i == 0) { | |
| - | fprintf (stderr, "%s\n", mount_usage); |
| - | exit( FALSE); |
| + | goto goodbye; |
| } | |
| filesystemType = *(++argv); | |
| --i; | |
| @@ -284,9 +282,7 @@ extern int mount_main (int argc, char **argv) | |
| case 'v': | |
| case 'h': | |
| case '-': | |
| - | fprintf (stderr, "%s\n", mount_usage); |
| - | exit( TRUE); |
| - | break; |
| + | goto goodbye; |
| } | |
| } else { | |
| if (device == NULL) | |
| @@ -294,8 +290,7 @@ extern int mount_main (int argc, char **argv) | |
| else if (directory == NULL) | |
| directory=*argv; | |
| else { | |
| - | fprintf (stderr, "%s\n", mount_usage); |
| - | exit( TRUE); |
| + | goto goodbye; |
| } | |
| } | |
| i--; | |
| @@ -331,9 +326,11 @@ extern int mount_main (int argc, char **argv) | |
| exit (mount_one (device, directory, filesystemType, | |
| flags, string_flags, useMtab, fakeIt)); | |
| } else { | |
| - | fprintf (stderr, "%s\n", mount_usage); |
| - | exit( FALSE); |
| + | goto goodbye; |
| } | |
| } | |
| exit( TRUE); | |
| + | |
| + | goodbye: |
| + | usage( mount_usage); |
| } | |
| @@ -29,7 +29,7 @@ | |
| static const char mv_usage[] = "mv SOURCE DEST\n" | |
| - | " or: mv SOURCE... DIRECTORY\n" |
| + | " or: mv SOURCE... DIRECTORY\n\n" |
| "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n"; | |
| @@ -100,7 +100,7 @@ extern int ps_main(int argc, char **argv) | |
| int i, c; | |
| if ( argc>1 && **(argv+1) == '-' ) { | |
| - | usage ("ps - report process status\nThis version of ps accepts no options.\n"); |
| + | usage ("ps\n\nReport process status\n\nThis version of ps accepts no options.\n"); |
| } | |
| dir = opendir("/proc"); | |
| @@ -100,7 +100,7 @@ extern int ps_main(int argc, char **argv) | |
| int i, c; | |
| if ( argc>1 && **(argv+1) == '-' ) { | |
| - | usage ("ps - report process status\nThis version of ps accepts no options.\n"); |
| + | usage ("ps\n\nReport process status\n\nThis version of ps accepts no options.\n"); |
| } | |
| dir = opendir("/proc"); | |
| @@ -27,8 +27,9 @@ | |
| #include <utime.h> | |
| #include <dirent.h> | |
| - | static const char* rm_usage = "rm [OPTION]... FILE...\n" |
| + | static const char* rm_usage = "rm [OPTION]... FILE...\n\n" |
| "Remove (unlink) the FILE(s).\n\n" | |
| + | "Options:\n" |
| "\t-f\tremove existing destinations, never prompt\n" | |
| "\t-r\tremove the contents of directories recursively\n"; | |
| @@ -29,7 +29,7 @@ | |
| extern int rmdir_main(int argc, char **argv) | |
| { | |
| if ( argc==1 || **(argv+1) == '-' ) { | |
| - | usage( "rmdir [OPTION]... DIRECTORY...\nRemove the DIRECTORY(ies), if they are empty."); |
| + | usage( "rmdir [OPTION]... DIRECTORY...\n\nRemove the DIRECTORY(ies), if they are empty.\n"); |
| } | |
| while (--argc > 0) { | |
| @@ -32,18 +32,18 @@ | |
| #include <ctype.h> | |
| static const char sed_usage[] = | |
| - | "sed [-n] [-e script] [file...]\n" |
| - | "Allowed scripts come in the following form:\n\n" |
| - | "'s/regexp/replacement/[gp]'\n" |
| - | "\tattempt to match regexp against the pattern space\n" |
| - | "\tand if successful replaces the matched portion with replacement.\n\n" |
| + | "sed [-n] [-e script] [file...]\n\n" |
| + | "Allowed sed scripts come in the following form:\n" |
| + | "\t's/regexp/replacement/[gp]'\n" |
| + | "which attempt to match regexp against the pattern space\n" |
| + | "and if successful replaces the matched portion with replacement.\n\n" |
| "Options:\n" | |
| "-e\tadd the script to the commands to be executed\n" | |
| "-n\tsuppress automatic printing of pattern space\n\n" | |
| #if defined BB_REGEXP | |
| - | "This version of sed matches full regexps.\n"; |
| + | "This version of sed matches full regular expresions.\n"; |
| #else | |
| - | "This version of sed matches strings (not full regexps).\n"; |
| + | "This version of sed matches strings (not full regular expresions).\n"; |
| #endif | |
| @@ -23,8 +23,8 @@ | |
| #include "internal.h" | |
| #include <stdio.h> | |
| - | const char sleep_usage[] = " NUMBER\n" |
| - | "Pause for NUMBER seconds.\n"; |
| + | const char sleep_usage[] = "sleep N\n\n" |
| + | "Pause for N seconds.\n"; |
| extern int | |
| sleep_main(int argc, char * * argv) | |
| @@ -27,7 +27,7 @@ extern int | |
| sync_main(int argc, char * * argv) | |
| { | |
| if ( argc>1 && **(argv+1) == '-' ) { | |
| - | usage( "sync\nWrite all buffered filesystem blocks to disk.\n"); |
| + | usage( "sync\n\nWrite all buffered filesystem blocks to disk.\n"); |
| } | |
| exit( sync()); | |
| } | |
| @@ -35,22 +35,13 @@ | |
| #include <signal.h> | |
| #include <time.h> | |
| - | /* Note that tar.c expects TRUE and FALSE to be defined |
| - | * exactly the opposite of how they are used everywhere else. |
| - | * Some time this should be integrated a bit better, but this |
| - | * does the job for now. |
| - | */ |
| - | //#undef FALSE |
| - | //#undef TRUE |
| - | //#define FALSE ((int) 0) |
| - | //#define TRUE ((int) 1) |
| - | |
| static const char tar_usage[] = | |
| - | "tar -[cxtvOf] [tarFileName] [FILE] ...\n" |
| - | "Create, extract, or list files from a tar file\n\n" |
| - | "\tc=create, x=extract, t=list contents, v=verbose,\n" |
| - | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; |
| + | "tar -[cxtvOf] [tarFileName] [FILE] ...\n\n" |
| + | "Create, extract, or list files from a tar file\n\n" |
| + | "Options:\n" |
| + | "\tc=create, x=extract, t=list contents, v=verbose,\n" |
| + | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; |
| @@ -96,18 +87,18 @@ typedef struct { | |
| /* | |
| * Static data. | |
| */ | |
| - | static int listFlag; // |
| - | static int extractFlag; // |
| - | static int createFlag; // |
| - | static int verboseFlag; // |
| - | static int tostdoutFlag; // |
| + | static int listFlag; |
| + | static int extractFlag; |
| + | static int createFlag; |
| + | static int verboseFlag; |
| + | static int tostdoutFlag; |
| static int inHeader; // <- check me | |
| - | static int badHeader; // |
| - | static int errorFlag; // |
| - | static int skipFileFlag; // |
| - | static int warnedRoot; // |
| - | static int eofFlag; // |
| + | static int badHeader; |
| + | static int errorFlag; |
| + | static int skipFileFlag; |
| + | static int warnedRoot; |
| + | static int eofFlag; |
| static long dataCc; | |
| static int outFd; | |
| static char outName[TAR_NAME_SIZE]; | |
| @@ -136,7 +127,7 @@ static void readHeader (const TarHeader * hp, | |
| /* | |
| * Local procedures to save files into a tar file. | |
| */ | |
| - | static void saveFile (const char *fileName, int seeLinks); // |
| + | static void saveFile (const char *fileName, int seeLinks); |
| static void saveRegularFile (const char *fileName, | |
| const struct stat *statbuf); | |
| @@ -145,13 +136,13 @@ static void saveDirectory (const char *fileName, | |
| const struct stat *statbuf); | |
| static int wantFileName (const char *fileName, | |
| - | int fileCount, char **fileTable); // |
| + | int fileCount, char **fileTable); |
| static void writeHeader (const char *fileName, const struct stat *statbuf); | |
| static void writeTarFile (int fileCount, char **fileTable); | |
| static void writeTarBlock (const char *buf, int len); | |
| - | static int putOctal (char *cp, int len, long value); // |
| + | static int putOctal (char *cp, int len, long value); |
| extern int tar_main (int argc, char **argv) | |
| @@ -217,10 +208,13 @@ extern int tar_main (int argc, char **argv) | |
| break; | |
| case '-': | |
| + | usage( tar_usage); |
| break; | |
| default: | |
| - | fprintf (stderr, "Unknown tar flag '%c'\n", *options); |
| + | fprintf (stderr, "Unknown tar flag '%c'\n" |
| + | "Try `tar --help' for more information\n", |
| + | *options); |
| exit (FALSE); | |
| } | |
| @@ -230,7 +224,6 @@ extern int tar_main (int argc, char **argv) | |
| /* | |
| * Validate the options. | |
| */ | |
| - | fprintf(stderr, "TRUE=%d FALSE=%d\n", TRUE, FALSE); |
| if (extractFlag + listFlag + createFlag != (TRUE+FALSE+FALSE)) { | |
| fprintf (stderr, | |
| "Exactly one of 'c', 'x' or 't' must be specified\n"); | |
| @@ -31,7 +31,7 @@ | |
| static const char touch_usage[] = "touch [-c] file [file ...]\n\n" | |
| - | "\tUpdate the last-modified date on the given file[s].\n"; |
| + | "Update the last-modified date on the given file[s].\n"; |
| @@ -54,7 +54,7 @@ touch_main(int argc, char **argv) | |
| create = FALSE; | |
| break; | |
| default: | |
| - | fprintf(stderr, "Unknown option: %c\n", **argv); |
| + | usage( touch_usage); |
| exit( FALSE); | |
| } | |
| argc--; | |
| @@ -29,8 +29,8 @@ | |
| #include <errno.h> | |
| static const char umount_usage[] = | |
| - | "Usage: umount [flags] filesystem|directory\n" |
| - | "Optional Flags:\n" |
| + | "Usage: umount [flags] filesystem|directory\n\n" |
| + | "Flags:\n" |
| "\t-a:\tUnmount all file systems" | |
| #ifdef BB_MTAB | |
| " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n" | |
| @@ -108,7 +108,7 @@ umount_main(int argc, char** argv) | |
| } | |
| /* Parse any options */ | |
| - | while (argc-- > 0 && **(argv++) == '-') { |
| + | while (--argc > 0 && **(++argv) == '-') { |
| while (*++(*argv)) switch (**argv) { | |
| case 'a': | |
| umountAll = TRUE; | |
| @@ -41,8 +41,9 @@ | |
| static const char uname_usage[] = | |
| - | "uname [OPTION]...\n" |
| - | "Print certain system information. With no OPTION, same as -s.\n" |
| + | "uname [OPTION]...\n\n" |
| + | "Print certain system information. With no OPTION, same as -s.\n\n" |
| + | "Options:\n" |
| "\t-a\tprint all information\n" | |
| "\t-m\tthe machine (hardware) type\n" | |
| "\t-n\tprint the machine's network node hostname\n" | |
| @@ -191,9 +191,17 @@ static void leave(int status) | |
| } | |
| static void show_usage(void) { | |
| - | fprintf(stderr, |
| - | "Usage: %s [-larvsmf] /dev/name\n", |
| - | program_name); |
| + | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); |
| + | fprintf(stderr, "Usage: %s [-larvsmf] /dev/name\n\n", program_name); |
| + | fprintf(stderr, "Performs a consistency check for MINIX filesystems.\n\n"); |
| + | fprintf(stderr, "OPTIONS:\n"); |
| + | fprintf(stderr, "\t-l\tLists all filenames\n"); |
| + | fprintf(stderr, "\t-r\tPerform interactive repairs\n"); |
| + | fprintf(stderr, "\t-a\tPerform automatic repairs\n"); |
| + | fprintf(stderr, "\t-v\tverbose\n"); |
| + | fprintf(stderr, "\t-s\tOutputs super-block information\n"); |
| + | fprintf(stderr, "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n"); |
| + | fprintf(stderr, "\t-f\tForce file system check.\n\n"); |
| leave(16); | |
| } | |
| @@ -171,10 +171,15 @@ static volatile void die(char *str) { | |
| static volatile void show_usage() | |
| { | |
| - | fprintf(stderr, "%s\n", program_name); |
| - | fprintf(stderr, |
| - | "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", |
| - | program_name); |
| + | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); |
| + | fprintf(stderr, "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n\n", program_name); |
| + | fprintf(stderr, "Make a MINIX filesystem.\n\n"); |
| + | fprintf(stderr, "OPTIONS:\n"); |
| + | fprintf(stderr, "\t-c\t\tCheck the device for bad blocks\n"); |
| + | fprintf(stderr, "\t-n [14|30]\tSpecify the maximum length of filenames\n"); |
| + | fprintf(stderr, "\t-i\t\tSpecify the number of inodes for the filesystem\n"); |
| + | fprintf(stderr, "\t-l FILENAME\tRead the bad blocks list from FILENAME\n"); |
| + | fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n"); |
| exit(16); | |
| } | |
| @@ -47,11 +47,12 @@ | |
| /* we also get PAGE_SIZE via getpagesize() */ | |
| - | static const char mkswap_usage[] = "mkswap [-c] [-v0|-v1] device [block-count]\n" |
| + | static const char mkswap_usage[] = "mkswap [-c] [-v0|-v1] device [block-count]\n\n" |
| "Prepare a disk partition to be used as a swap partition.\n\n" | |
| - | "\t-c\tCheck for read-ability.\n" |
| - | "\t-v0\tMake version 0 swap [max 128 Megs].\n" |
| - | "\t-v1\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" |
| + | "Options:\n" |
| + | "\t-c\t\tCheck for read-ability.\n" |
| + | "\t-v0\t\tMake version 0 swap [max 128 Megs].\n" |
| + | "\t-v1\t\tMake version 1 swap [big!] (default for kernels > 2.1.117).\n" |
| "\tblock-count\tNumber of block to use (default is entire partition).\n"; | |
| @@ -37,7 +37,7 @@ | |
| #include <signal.h> | |
| #include <sys/ioctl.h> | |
| - | static const char more_usage[] = "[file ...]"; |
| + | static const char more_usage[] = "more [file ...]\n"; |
| /* ED: sparc termios is broken: revert back to old termio handling. */ | |
| #ifdef BB_FEATURE_USE_TERMIOS | |
| @@ -43,7 +43,7 @@ | |
| extern const char mtab_file[]; /* Defined in utility.c */ | |
| - | static const char mount_usage[] = "Usage:\tmount [flags]\n" |
| + | static const char mount_usage[] = "\tmount [flags]\n" |
| "\tmount [flags] device directory [-o options,more-options]\n" | |
| "\n" | |
| "Flags:\n" | |
| @@ -248,8 +248,7 @@ extern int mount_main (int argc, char **argv) | |
| while (i>0 && *++(*argv)) switch (**argv) { | |
| case 'o': | |
| if (--i == 0) { | |
| - | fprintf (stderr, "%s\n", mount_usage); |
| - | exit( FALSE); |
| + | goto goodbye; |
| } | |
| parse_mount_options (*(++argv), &flags, string_flags); | |
| --i; | |
| @@ -260,8 +259,7 @@ extern int mount_main (int argc, char **argv) | |
| break; | |
| case 't': | |
| if (--i == 0) { | |
| - | fprintf (stderr, "%s\n", mount_usage); |
| - | exit( FALSE); |
| + | goto goodbye; |
| } | |
| filesystemType = *(++argv); | |
| --i; | |
| @@ -284,9 +282,7 @@ extern int mount_main (int argc, char **argv) | |
| case 'v': | |
| case 'h': | |
| case '-': | |
| - | fprintf (stderr, "%s\n", mount_usage); |
| - | exit( TRUE); |
| - | break; |
| + | goto goodbye; |
| } | |
| } else { | |
| if (device == NULL) | |
| @@ -294,8 +290,7 @@ extern int mount_main (int argc, char **argv) | |
| else if (directory == NULL) | |
| directory=*argv; | |
| else { | |
| - | fprintf (stderr, "%s\n", mount_usage); |
| - | exit( TRUE); |
| + | goto goodbye; |
| } | |
| } | |
| i--; | |
| @@ -331,9 +326,11 @@ extern int mount_main (int argc, char **argv) | |
| exit (mount_one (device, directory, filesystemType, | |
| flags, string_flags, useMtab, fakeIt)); | |
| } else { | |
| - | fprintf (stderr, "%s\n", mount_usage); |
| - | exit( FALSE); |
| + | goto goodbye; |
| } | |
| } | |
| exit( TRUE); | |
| + | |
| + | goodbye: |
| + | usage( mount_usage); |
| } | |
| @@ -29,8 +29,8 @@ | |
| #include <errno.h> | |
| static const char umount_usage[] = | |
| - | "Usage: umount [flags] filesystem|directory\n" |
| - | "Optional Flags:\n" |
| + | "Usage: umount [flags] filesystem|directory\n\n" |
| + | "Flags:\n" |
| "\t-a:\tUnmount all file systems" | |
| #ifdef BB_MTAB | |
| " in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries\n" | |
| @@ -108,7 +108,7 @@ umount_main(int argc, char** argv) | |
| } | |
| /* Parse any options */ | |
| - | while (argc-- > 0 && **(argv++) == '-') { |
| + | while (--argc > 0 && **(++argv) == '-') { |
| while (*++(*argv)) switch (**argv) { | |
| case 'a': | |
| umountAll = TRUE; | |
| @@ -46,7 +46,7 @@ const char mtab_file[] = "/proc/mounts"; | |
| /* volatile so gcc knows this is the enod of the line */ | |
| - | volatile void usage(const char *usage) |
| + | extern void usage(const char *usage) |
| { | |
| fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", BB_VER, BB_BT); | |
| fprintf(stderr, "Usage: %s\n", usage); | |