summaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/shell/ash.c b/shell/ash.c
index ea813e02f..641a14035 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12031,37 +12031,42 @@ find_dot_file(char *name)
12031static int FAST_FUNC 12031static int FAST_FUNC
12032dotcmd(int argc, char **argv) 12032dotcmd(int argc, char **argv)
12033{ 12033{
12034 char *fullname;
12034 struct strlist *sp; 12035 struct strlist *sp;
12035 volatile struct shparam saveparam; 12036 volatile struct shparam saveparam;
12036 12037
12037 for (sp = cmdenviron; sp; sp = sp->next) 12038 for (sp = cmdenviron; sp; sp = sp->next)
12038 setvareq(ckstrdup(sp->text), VSTRFIXED | VTEXTFIXED); 12039 setvareq(ckstrdup(sp->text), VSTRFIXED | VTEXTFIXED);
12039 12040
12041 if (!argv[1]) {
12042 /* bash says: "bash: .: filename argument required" */
12043 return 2; /* bash compat */
12044 }
12045
12040 /* "false; . empty_file; echo $?" should print 0, not 1: */ 12046 /* "false; . empty_file; echo $?" should print 0, not 1: */
12041 exitstatus = 0; 12047 exitstatus = 0;
12042 12048
12043 if (argv[1]) { /* That's what SVR2 does */ 12049 fullname = find_dot_file(argv[1]);
12044 char *fullname = find_dot_file(argv[1]);
12045 12050
12046 argv += 2; 12051 argv += 2;
12047 argc -= 2; 12052 argc -= 2;
12048 if (argc) { /* argc > 0, argv[0] != NULL */ 12053 if (argc) { /* argc > 0, argv[0] != NULL */
12049 saveparam = shellparam; 12054 saveparam = shellparam;
12050 shellparam.malloced = 0; 12055 shellparam.malloced = 0;
12051 shellparam.nparam = argc; 12056 shellparam.nparam = argc;
12052 shellparam.p = argv; 12057 shellparam.p = argv;
12053 }; 12058 };
12054 12059
12055 setinputfile(fullname, INPUT_PUSH_FILE); 12060 setinputfile(fullname, INPUT_PUSH_FILE);
12056 commandname = fullname; 12061 commandname = fullname;
12057 cmdloop(0); 12062 cmdloop(0);
12058 popfile(); 12063 popfile();
12064
12065 if (argc) {
12066 freeparam(&shellparam);
12067 shellparam = saveparam;
12068 };
12059 12069
12060 if (argc) {
12061 freeparam(&shellparam);
12062 shellparam = saveparam;
12063 };
12064 }
12065 return exitstatus; 12070 return exitstatus;
12066} 12071}
12067 12072