Fixed bug where

$ cat foo
echo $FOO

$ FOO=1 . ./foo
$ echo $FOO

Did not echo 1 at all. Now variable assignments before sourced scripts
are honored during and after the execution of the script.
This commit is contained in:
christos 1995-05-28 18:09:48 +00:00
parent 488bc82ac3
commit 58e18fc330
1 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.19 1995/05/19 15:08:58 christos Exp $ */ /* $NetBSD: main.c,v 1.20 1995/05/28 18:09:48 christos Exp $ */
/*- /*-
* Copyright (c) 1991, 1993 * Copyright (c) 1991, 1993
@ -44,9 +44,9 @@ static char copyright[] =
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.5 (Berkeley) 5/19/95"; static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/28/95";
#else #else
static char rcsid[] = "$Header: /cvsroot/src/bin/sh/main.c,v 1.19 1995/05/19 15:08:58 christos Exp $"; static char rcsid[] = "$NetBSD: main.c,v 1.20 1995/05/28 18:09:48 christos Exp $";
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -64,6 +64,7 @@ static char rcsid[] = "$Header: /cvsroot/src/bin/sh/main.c,v 1.19 1995/05/19 15:
#include "output.h" #include "output.h"
#include "parser.h" #include "parser.h"
#include "nodes.h" #include "nodes.h"
#include "expand.h"
#include "eval.h" #include "eval.h"
#include "jobs.h" #include "jobs.h"
#include "input.h" #include "input.h"
@ -317,9 +318,15 @@ dotcmd(argc, argv)
int argc; int argc;
char **argv; char **argv;
{ {
struct strlist *sp;
exitstatus = 0; exitstatus = 0;
for (sp = cmdenviron; sp ; sp = sp->next)
setvareq(savestr(sp->text), VSTRFIXED|VTEXTFIXED);
if (argc >= 2) { /* That's what SVR2 does */ if (argc >= 2) { /* That's what SVR2 does */
char *fullname = find_dot_file(argv[1]); char *fullname = find_dot_file(argv[1]);
setinputfile(fullname, 1); setinputfile(fullname, 1);
commandname = fullname; commandname = fullname;
cmdloop(0); cmdloop(0);