mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
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.
This commit is contained in:
parent
933aec2f75
commit
18ee60a576
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=61693
sys/boot/common
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user