msh: stop trying to parse variables in "msh SCRIPT VAR=val param".
authorDenis Vlasenko <vda.linux@googlemail.com>
Tue, 12 Feb 2008 10:12:18 +0000 (10:12 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Tue, 12 Feb 2008 10:12:18 +0000 (10:12 -0000)
They should be passed as ordinary parameters.

shell/msh.c

index ee54ef2d43c17cd6c44193adf9aedd839ee9f5ad..65556043dcd7cf53428b2034afa52a601d7c6806 100644 (file)
@@ -5337,19 +5337,22 @@ int msh_main(int argc, char **argv)
 
        if (signal(SIGINT, SIG_IGN) != SIG_IGN)
                signal(SIGINT, onintr);
+
+/* Handle "msh SCRIPT VAR=val params..." */
+/* Disabled: bash does not do it! */
+#if 0
+       argv++;
+       /* skip leading args of the form VAR=val */
+       while (*argv && assign(*argv, !COPYV)) {
+               argc--;
+               argv++;
+       }
+       argv--;
+#endif
        dolv = argv;
        dolc = argc;
        dolv[0] = name;
-       if (dolc > 1) {
-               for (ap = ++argv; --argc > 0;) {
-                       *ap = *argv++;
-                       if (assign(*ap, !COPYV)) {
-                               dolc--;                 /* keyword */
-                       } else {
-                               ap++;
-                       }
-               }
-       }
+
        setval(lookup("#"), putn((--dolc < 0) ? (dolc = 0) : dolc));
 
        DBGPRINTF(("MSH_MAIN: begin FOR loop, interactive %d, global_env.iop %p, iostack %p\n", interactive, global_env.iop, iostack));