make ps accept (and ignore) all options (--help works of course).

tar now works with or without the leading "-" on the options.
 -Erik
This commit is contained in:
Erik Andersen 2000-04-19 03:38:01 +00:00
parent f13df3752c
commit a3e57ca700
6 changed files with 14 additions and 12 deletions

View File

@ -55,6 +55,8 @@
* Fixed a bug where "sed 's/foo/bar/g'" (i.e. a script w/o a "-e") * Fixed a bug where "sed 's/foo/bar/g'" (i.e. a script w/o a "-e")
* ps now supports BB_FEATURE_AUTOWIDTH, and can adjust its width * ps now supports BB_FEATURE_AUTOWIDTH, and can adjust its width
to match the terminal (defaults to width=79 when this is off). to match the terminal (defaults to width=79 when this is off).
* ps now accepts (and ignores) all options except for "--help" (which
as would be expected displays help).
* Fixed mount'ing loop devices when the filesystem type was not * Fixed mount'ing loop devices when the filesystem type was not
specified. It used to revert to non-loop after the first try. specified. It used to revert to non-loop after the first try.
* all mallocs now use xmalloc (and so are OOM error safe), and * all mallocs now use xmalloc (and so are OOM error safe), and

View File

@ -26,7 +26,7 @@ export VERSION
# Set the following to `true' to make a debuggable build. # Set the following to `true' to make a debuggable build.
# Leave this set to `false' for production use. # Leave this set to `false' for production use.
# eg: `make DODEBUG=true tests' # eg: `make DODEBUG=true tests'
DODEBUG = false DODEBUG = true
# If you want a static binary, turn this on. # If you want a static binary, turn this on.
DOSTATIC = false DOSTATIC = false
@ -108,7 +108,7 @@ docs:
$(MAKE) -C docs $(MAKE) -C docs
regexp.o nfsmount.o: %.o: %.h regexp.o nfsmount.o: %.o: %.h
$(OBJECTS): %.o: busybox.def.h internal.h %.c $(OBJECTS): %.o: busybox.def.h internal.h %.c Makefile
test tests: test tests:
cd tests && $(MAKE) all cd tests && $(MAKE) all

View File

@ -70,13 +70,13 @@ static const char tar_usage[] =
#endif #endif
"\tx\t\textract\n" "\tx\t\textract\n"
"\tt\t\tlist\n" "\tt\t\tlist\n"
"File selection:\n" "\nFile selection:\n"
"\tf\t\tname of tarfile or \"-\" for stdin\n" "\tf\t\tname of tarfile or \"-\" for stdin\n"
"\tO\t\textract to stdout\n" "\tO\t\textract to stdout\n"
#if defined BB_FEATURE_TAR_EXCLUDE #if defined BB_FEATURE_TAR_EXCLUDE
"\t--exclude\tfile to exclude\n" "\t--exclude\tfile to exclude\n"
#endif #endif
"Informative output:\n" "\nInformative output:\n"
"\tv\t\tverbosely list files processed\n" "\tv\t\tverbosely list files processed\n"
; ;
@ -184,7 +184,7 @@ extern int tar_main(int argc, char **argv)
usage(tar_usage); usage(tar_usage);
/* Parse any options */ /* Parse any options */
while (--argc > 0 && **(++argv) == '-') { while (--argc > 0 && (**(++argv) != '\0')) {
stopIt=FALSE; stopIt=FALSE;
while (stopIt==FALSE && *(++(*argv))) { while (stopIt==FALSE && *(++(*argv))) {
switch (**argv) { switch (**argv) {
@ -245,7 +245,6 @@ extern int tar_main(int argc, char **argv)
break; break;
} }
#endif #endif
usage(tar_usage);
break; break;
default: default:

View File

@ -128,8 +128,9 @@ extern int ps_main(int argc, char **argv)
if (argc > 1 && **(argv + 1) == '-') if (argc > 1 && strcmp(argv[1], "--help") == 0) {
usage ("ps\n\nReport process status\n\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"); dir = opendir("/proc");
if (!dir) if (!dir)

3
ps.c
View File

@ -128,8 +128,9 @@ extern int ps_main(int argc, char **argv)
if (argc > 1 && **(argv + 1) == '-') if (argc > 1 && strcmp(argv[1], "--help") == 0) {
usage ("ps\n\nReport process status\n\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"); dir = opendir("/proc");
if (!dir) if (!dir)

7
tar.c
View File

@ -70,13 +70,13 @@ static const char tar_usage[] =
#endif #endif
"\tx\t\textract\n" "\tx\t\textract\n"
"\tt\t\tlist\n" "\tt\t\tlist\n"
"File selection:\n" "\nFile selection:\n"
"\tf\t\tname of tarfile or \"-\" for stdin\n" "\tf\t\tname of tarfile or \"-\" for stdin\n"
"\tO\t\textract to stdout\n" "\tO\t\textract to stdout\n"
#if defined BB_FEATURE_TAR_EXCLUDE #if defined BB_FEATURE_TAR_EXCLUDE
"\t--exclude\tfile to exclude\n" "\t--exclude\tfile to exclude\n"
#endif #endif
"Informative output:\n" "\nInformative output:\n"
"\tv\t\tverbosely list files processed\n" "\tv\t\tverbosely list files processed\n"
; ;
@ -184,7 +184,7 @@ extern int tar_main(int argc, char **argv)
usage(tar_usage); usage(tar_usage);
/* Parse any options */ /* Parse any options */
while (--argc > 0 && **(++argv) == '-') { while (--argc > 0 && (**(++argv) != '\0')) {
stopIt=FALSE; stopIt=FALSE;
while (stopIt==FALSE && *(++(*argv))) { while (stopIt==FALSE && *(++(*argv))) {
switch (**argv) { switch (**argv) {
@ -245,7 +245,6 @@ extern int tar_main(int argc, char **argv)
break; break;
} }
#endif #endif
usage(tar_usage);
break; break;
default: default: