make ps accept (and ignore) all options (--help works of course).
authorErik Andersen <andersen@codepoet.org>
Wed, 19 Apr 2000 03:38:01 +0000 (03:38 -0000)
committerErik Andersen <andersen@codepoet.org>
Wed, 19 Apr 2000 03:38:01 +0000 (03:38 -0000)
tar now works with or without the leading "-" on the options.
 -Erik

Changelog
Makefile
archival/tar.c
procps/ps.c
ps.c
tar.c

index e9d2605..d6f7a48 100644 (file)
--- 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
index 30fd718..6a4b41b 100644 (file)
--- 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
index 9b3cb7d..2284fd0 100644 (file)
@@ -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:
index 1b3f4fb..8d59700 100644 (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");
+       }
 
        dir = opendir("/proc");
        if (!dir)
diff --git a/ps.c b/ps.c
index 1b3f4fb..8d59700 100644 (file)
--- 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 9b3cb7d..2284fd0 100644 (file)
--- 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: