Fix regression with lua import
Don't print when we can't find a file. Copy it instead to the error buffer. Higher level routines determine if it's appropriate to print the error message. Also, remove dead code (labeled bogusly lost functionality) since we never used that functionality. Remove unused arg from interact() too. Sponsored by: Netflix
This commit is contained in:
parent
6604afe9c7
commit
c83457486b
@ -45,7 +45,7 @@ extern char command_errbuf[COMMAND_ERRBUFSZ];
|
||||
#define CMD_FATAL 4
|
||||
|
||||
/* interp.c */
|
||||
void interact(const char *rc);
|
||||
void interact(void);
|
||||
int include(const char *filename);
|
||||
|
||||
/* interp_backslash.c */
|
||||
@ -54,10 +54,6 @@ char *backslash(const char *str);
|
||||
/* interp_parse.c */
|
||||
int parse(int *argc, char ***argv, const char *str);
|
||||
|
||||
/* interp_forth.c */
|
||||
void bf_init(const char *rc);
|
||||
int bf_run(char *line);
|
||||
|
||||
/* boot.c */
|
||||
int autoboot(int timeout, char *prompt);
|
||||
void autoboot_maybe(void);
|
||||
|
@ -58,7 +58,7 @@ default_load_config(void *ctx)
|
||||
* Interactive mode
|
||||
*/
|
||||
void
|
||||
interact(const char * rc)
|
||||
interact(void)
|
||||
{
|
||||
static char input[256]; /* big enough? */
|
||||
|
||||
@ -125,6 +125,9 @@ command_include(int argc, char *argv[])
|
||||
free(argvbuf[i]);
|
||||
free(argvbuf);
|
||||
|
||||
if (res != CMD_OK)
|
||||
printf("%s", command_errbuf);
|
||||
|
||||
return(res);
|
||||
}
|
||||
|
||||
|
@ -294,21 +294,6 @@ interp_forth_init(void *ctx)
|
||||
/* Export some version numbers so that code can detect the loader/host version */
|
||||
ficlSetEnv(bf_sys, "FreeBSD_version", __FreeBSD_version);
|
||||
ficlSetEnv(bf_sys, "loader_version", bootprog_rev);
|
||||
|
||||
#if 0 /* XXX lost functionality -- imp */
|
||||
/* try to load and run init file if present */
|
||||
if (rc == NULL)
|
||||
rc = "/boot/boot.4th";
|
||||
if (*rc != '\0') {
|
||||
int fd;
|
||||
|
||||
fd = open(rc, O_RDONLY);
|
||||
if (fd != -1) {
|
||||
(void)ficlExecFD(bf_vm, fd);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -364,10 +349,12 @@ interp_forth_incl(void *ctx, const char *filename)
|
||||
|
||||
fd = open(filename, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
printf("can't open %s\n", filename);
|
||||
/* Hihger layers print the error message */
|
||||
snprintf(command_errbuf, sizeof(command_errbuf),
|
||||
"can't open %s\n", filename);
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
return (ficlExecFD(softc->bf_vm, fd));
|
||||
return (ficlExecFD(softc->bf_vm, fd) == 0 ? CMD_OK : CMD_ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -501,7 +501,7 @@ main(int argc, CHAR16 *argv[])
|
||||
#endif
|
||||
}
|
||||
|
||||
interact(NULL); /* doesn't return */
|
||||
interact(); /* doesn't return */
|
||||
|
||||
return (EFI_SUCCESS); /* keep compiler happy */
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ main(void)
|
||||
|
||||
bios_getsmap();
|
||||
|
||||
interact(NULL);
|
||||
interact();
|
||||
|
||||
/* if we ever get here, it is an error */
|
||||
return (1);
|
||||
|
@ -149,7 +149,7 @@ main(int argc, char *argv[], char *envv[], struct bootinfo *bootinfop)
|
||||
printf("bootpath=\"%s\"\n", bootpath);
|
||||
#endif
|
||||
|
||||
interact(NULL);
|
||||
interact();
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ main(int (*openfirm)(void *))
|
||||
archsw.arch_readin = ofw_readin;
|
||||
archsw.arch_autoload = ofw_autoload;
|
||||
|
||||
interact(NULL); /* doesn't return */
|
||||
interact(); /* doesn't return */
|
||||
|
||||
OF_exit();
|
||||
|
||||
|
@ -122,7 +122,7 @@ main(int argc, const char **argv)
|
||||
setenv("loaddev", bootdev, 1);
|
||||
setenv("LINES", "24", 1);
|
||||
|
||||
interact(NULL); /* doesn't return */
|
||||
interact(); /* doesn't return */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ main(void)
|
||||
setenv("LINES", "24", 1);
|
||||
setenv("hw.platform", "ps3", 1);
|
||||
|
||||
interact(NULL); /* doesn't return */
|
||||
interact(); /* doesn't return */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -902,7 +902,7 @@ main(int (*openfirm)(void *))
|
||||
printf("bootpath=\"%s\"\n", bootpath);
|
||||
|
||||
/* Give control to the machine independent loader code. */
|
||||
interact(NULL);
|
||||
interact();
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks)
|
||||
if (setjmp(jb))
|
||||
return;
|
||||
|
||||
interact(NULL); /* doesn't return */
|
||||
interact(); /* doesn't return */
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user