Apply last_patch51_3 from vodz
authorEric Andersen <andersen@codepoet.org>
Tue, 22 Oct 2002 11:58:59 +0000 (11:58 -0000)
committerEric Andersen <andersen@codepoet.org>
Tue, 22 Oct 2002 11:58:59 +0000 (11:58 -0000)
shell/ash.c

index 216780c9d8599a114ac16201cb38c6fbd183276c..f0729ed4d4c6f64f6897a06acf829efeaaf18c0b 100644 (file)
@@ -2418,9 +2418,23 @@ static void evalcommand(union node *cmd, int flags)
        for (argp = cmd->ncmd.assign; argp; argp = argp->narg.next) {
                expandarg(argp, &varlist, EXP_VARTILDE);
        }
-       for (argp = cmd->ncmd.args; argp; argp = argp->narg.next) {
+       for (argp = cmd->ncmd.args; argp && !arglist.list; argp = argp->narg.next) {
                expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
        }
+       if (argp) {
+               struct builtincmd *bcmd;
+               int pseudovarflag;
+
+               bcmd = find_builtin(arglist.list->text);
+               pseudovarflag = bcmd && IS_BUILTIN_ASSIGN(bcmd);
+               for (; argp; argp = argp->narg.next) {
+                       if (pseudovarflag && isassignment(argp->narg.text)) {
+                               expandarg(argp, &arglist, EXP_VARTILDE);
+                               continue;
+                       }
+                       expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
+               }
+       }
        *arglist.lastp = NULL;
        *varlist.lastp = NULL;
        expredir(cmd->ncmd.redirect);