diff --git a/Changelog b/Changelog index e9d260593..d6f7a489c 100644 --- a/Changelog +++ b/Changelog @@ -55,6 +55,8 @@ * 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 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 specified. It used to revert to non-loop after the first try. * all mallocs now use xmalloc (and so are OOM error safe), and diff --git a/Makefile b/Makefile index 30fd718f1..6a4b41b01 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ export VERSION # Set the following to `true' to make a debuggable build. # Leave this set to `false' for production use. # eg: `make DODEBUG=true tests' -DODEBUG = false +DODEBUG = true # If you want a static binary, turn this on. DOSTATIC = false @@ -108,7 +108,7 @@ docs: $(MAKE) -C docs 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: cd tests && $(MAKE) all diff --git a/archival/tar.c b/archival/tar.c index 9b3cb7d81..2284fd06d 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -70,13 +70,13 @@ static const char tar_usage[] = #endif "\tx\t\textract\n" "\tt\t\tlist\n" - "File selection:\n" + "\nFile selection:\n" "\tf\t\tname of tarfile or \"-\" for stdin\n" "\tO\t\textract to stdout\n" #if defined BB_FEATURE_TAR_EXCLUDE "\t--exclude\tfile to exclude\n" #endif - "Informative output:\n" + "\nInformative output:\n" "\tv\t\tverbosely list files processed\n" ; @@ -184,7 +184,7 @@ extern int tar_main(int argc, char **argv) usage(tar_usage); /* Parse any options */ - while (--argc > 0 && **(++argv) == '-') { + while (--argc > 0 && (**(++argv) != '\0')) { stopIt=FALSE; while (stopIt==FALSE && *(++(*argv))) { switch (**argv) { @@ -245,7 +245,6 @@ extern int tar_main(int argc, char **argv) break; } #endif - usage(tar_usage); break; default: diff --git a/procps/ps.c b/procps/ps.c index 1b3f4fb6c..8d59700fd 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -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"); + } dir = opendir("/proc"); if (!dir) diff --git a/ps.c b/ps.c index 1b3f4fb6c..8d59700fd 100644 --- a/ps.c +++ b/ps.c @@ -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"); + } dir = opendir("/proc"); if (!dir) diff --git a/tar.c b/tar.c index 9b3cb7d81..2284fd06d 100644 --- a/tar.c +++ b/tar.c @@ -70,13 +70,13 @@ static const char tar_usage[] = #endif "\tx\t\textract\n" "\tt\t\tlist\n" - "File selection:\n" + "\nFile selection:\n" "\tf\t\tname of tarfile or \"-\" for stdin\n" "\tO\t\textract to stdout\n" #if defined BB_FEATURE_TAR_EXCLUDE "\t--exclude\tfile to exclude\n" #endif - "Informative output:\n" + "\nInformative output:\n" "\tv\t\tverbosely list files processed\n" ; @@ -184,7 +184,7 @@ extern int tar_main(int argc, char **argv) usage(tar_usage); /* Parse any options */ - while (--argc > 0 && **(++argv) == '-') { + while (--argc > 0 && (**(++argv) != '\0')) { stopIt=FALSE; while (stopIt==FALSE && *(++(*argv))) { switch (**argv) { @@ -245,7 +245,6 @@ extern int tar_main(int argc, char **argv) break; } #endif - usage(tar_usage); break; default: