From ed82a24960c517b57900e77ebad824edfd845424 Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Sat, 7 Nov 1998 06:18:00 +0000 Subject: [PATCH] Eliminate much code cruft by extending simple file I/O API to include fopen and fclose. Also look for /boot/boot.4th now and, if found, load its contents. --- sys/boot/common/interp_forth.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/boot/common/interp_forth.c b/sys/boot/common/interp_forth.c index a2dbbeafbdca..9da74a52f77f 100644 --- a/sys/boot/common/interp_forth.c +++ b/sys/boot/common/interp_forth.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: interp_forth.c,v 1.5 1998/11/06 03:50:44 msmith Exp $ + * $Id: interp_forth.c,v 1.6 1998/11/07 03:44:10 jkh Exp $ */ #include @@ -106,15 +106,20 @@ void bf_init(void) { struct bootblk_command **cmdp; - + int fd; + ficlInitSystem(4000); /* Default dictionary ~4000 cells */ bf_vm = ficlNewVM(); /* make all commands appear as Forth words */ SET_FOREACH(cmdp, Xcommand_set) ficlBuild((*cmdp)->c_name, bf_command, FW_DEFAULT); - /* run the init word from softcore */ - ficlExec(bf_vm, "init"); + + /* try to load and run init file if present */ + if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) { + (void)ficlExecFD(bf_vm, fd); + close(fd); + } } /*