diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index 5d6a63db2b11..87543c0a8190 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -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); diff --git a/stand/common/interp.c b/stand/common/interp.c index a6b010a81041..8e284e97993b 100644 --- a/stand/common/interp.c +++ b/stand/common/interp.c @@ -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); } diff --git a/stand/common/interp_forth.c b/stand/common/interp_forth.c index 4d30303ff533..d06807a475a2 100644 --- a/stand/common/interp_forth.c +++ b/stand/common/interp_forth.c @@ -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); } diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index f367f292d387..516c47e37705 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -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 */ } diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c index 81bc2ff55dd0..543dae1af71a 100644 --- a/stand/i386/loader/main.c +++ b/stand/i386/loader/main.c @@ -232,7 +232,7 @@ main(void) bios_getsmap(); - interact(NULL); + interact(); /* if we ever get here, it is an error */ return (1); diff --git a/stand/mips/beri/loader/main.c b/stand/mips/beri/loader/main.c index 2d201d8011ee..71b69b781572 100644 --- a/stand/mips/beri/loader/main.c +++ b/stand/mips/beri/loader/main.c @@ -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); } diff --git a/stand/ofw/common/main.c b/stand/ofw/common/main.c index 3c0bbdf97a26..128542c922f3 100644 --- a/stand/ofw/common/main.c +++ b/stand/ofw/common/main.c @@ -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(); diff --git a/stand/powerpc/kboot/main.c b/stand/powerpc/kboot/main.c index 7a24c163d5c4..e72a7482046c 100644 --- a/stand/powerpc/kboot/main.c +++ b/stand/powerpc/kboot/main.c @@ -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); } diff --git a/stand/powerpc/ps3/main.c b/stand/powerpc/ps3/main.c index be8708aadefa..db9ea50959fa 100644 --- a/stand/powerpc/ps3/main.c +++ b/stand/powerpc/ps3/main.c @@ -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); } diff --git a/stand/sparc64/loader/main.c b/stand/sparc64/loader/main.c index d3c17c5ea6cc..140885d50e8e 100644 --- a/stand/sparc64/loader/main.c +++ b/stand/sparc64/loader/main.c @@ -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); } diff --git a/stand/userboot/userboot/main.c b/stand/userboot/userboot/main.c index 7f59eb7c3bdd..95bff1745a0f 100644 --- a/stand/userboot/userboot/main.c +++ b/stand/userboot/userboot/main.c @@ -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); }