diff options
author | dcs <dcs@FreeBSD.org> | 2000-06-14 19:37:00 +0000 |
---|---|---|
committer | dcs <dcs@FreeBSD.org> | 2000-06-14 19:37:00 +0000 |
commit | cb251cf529d74a7b1721edb7f1bf22b19f4c6f7f (patch) | |
tree | af934eb090c3b69ebadfedd1a7e88e7971d21b70 | |
parent | ce281cb5af1b2e03c9ab0f9655f5b1115637da37 (diff) | |
download | FreeBSD-src-cb251cf529d74a7b1721edb7f1bf22b19f4c6f7f.zip FreeBSD-src-cb251cf529d74a7b1721edb7f1bf22b19f4c6f7f.tar.gz |
Remove the setting of sourceid from bf_vm(), as bf_vm() really has
no clue.
Set sourceid to 0 when booting, which is the correct setting for stdin.
Set sourceid to an arbitrary fd when include'ing, preserving and restoring
the previous sourceid. This is possibly broken(), as 0 is a valid fd. Maybe
we should +1 to this value.
This fixes the version problem widely reported.
-rw-r--r-- | sys/boot/common/interp.c | 8 | ||||
-rw-r--r-- | sys/boot/common/interp_forth.c | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sys/boot/common/interp.c b/sys/boot/common/interp.c index e93e35a..880910b 100644 --- a/sys/boot/common/interp.c +++ b/sys/boot/common/interp.c @@ -122,6 +122,7 @@ interact(void) prompt(); ngets(input, sizeof(input)); #ifdef BOOT_FORTH + bf_vm->sourceID.i = 0; bf_run(input); #else if (!parse(&argc, &argv, input)) { @@ -189,7 +190,7 @@ include(char *filename) #ifdef BOOT_FORTH int res; char *cp; - int fd, line; + int prevsrcid, fd, line; #else int argc,res; char **argv, *cp; @@ -252,6 +253,9 @@ include(char *filename) */ #ifndef BOOT_FORTH argv = NULL; +#else + prevsrcid = bf_vm->sourceID.i; + bf_vm->sourceID.i = fd; #endif res = CMD_OK; for (sp = script; sp != NULL; sp = sp->next) { @@ -293,6 +297,8 @@ include(char *filename) #ifndef BOOT_FORTH if (argv != NULL) free(argv); +#else + bf_vm->sourceID.i = prevsrcid; #endif while(script != NULL) { se = script; diff --git a/sys/boot/common/interp_forth.c b/sys/boot/common/interp_forth.c index fa7925a..1cf60c4 100644 --- a/sys/boot/common/interp_forth.c +++ b/sys/boot/common/interp_forth.c @@ -273,12 +273,8 @@ int bf_run(char *line) { int result; - CELL id; - id = bf_vm->sourceID; - bf_vm->sourceID.i = -1; result = ficlExec(bf_vm, line); - bf_vm->sourceID = id; DEBUG("ficlExec '%s' = %d", line, result); switch (result) { |