aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 1a0e0aa6e..977ae4647 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8125,21 +8125,40 @@ find_dot_file(char *name)
8125 /* NOTREACHED */ 8125 /* NOTREACHED */
8126} 8126}
8127 8127
8128int 8128static int dotcmd(int argc, char **argv)
8129dotcmd(int argc, char **argv)
8130{ 8129{
8130 struct strlist *sp;
8131 volatile struct shparam saveparam;
8132
8131 exitstatus = 0; 8133 exitstatus = 0;
8132 8134
8133 if (argc >= 2) { /* That's what SVR2 does */ 8135 for (sp = cmdenviron; sp; sp = sp->next)
8136 setvareq(bb_xstrdup(sp->text), VSTRFIXED | VTEXTFIXED);
8137
8138 if (argc >= 2) { /* That's what SVR2 does */
8134 char *fullname; 8139 char *fullname;
8135 struct stackmark smark; 8140 struct stackmark smark;
8136 8141
8137 setstackmark(&smark); 8142 setstackmark(&smark);
8138 fullname = find_dot_file(argv[1]); 8143 fullname = find_dot_file(argv[1]);
8144
8145 if (argc > 2) {
8146 saveparam = shellparam;
8147 shellparam.malloc = 0;
8148 shellparam.nparam = argc - 2;
8149 shellparam.p = argv + 2;
8150 };
8151
8139 setinputfile(fullname, 1); 8152 setinputfile(fullname, 1);
8140 commandname = fullname; 8153 commandname = fullname;
8141 cmdloop(0); 8154 cmdloop(0);
8142 popfile(); 8155 popfile();
8156
8157 if (argc > 2) {
8158 freeparam(&shellparam);
8159 shellparam = saveparam;
8160 };
8161
8143 popstackmark(&smark); 8162 popstackmark(&smark);
8144 } 8163 }
8145 return exitstatus; 8164 return exitstatus;