diff options
author | jkh <jkh@FreeBSD.org> | 1998-11-07 06:18:00 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1998-11-07 06:18:00 +0000 |
commit | 0ba901f49f8ddba427868dcec9f2ab5d46dabf79 (patch) | |
tree | a84e6d601c10e9775113d73c504db2372dd2295b /sys/boot/common/interp_forth.c | |
parent | 4a9e91d8fe8586042778debc782b65bbdfe49d5c (diff) | |
download | FreeBSD-src-0ba901f49f8ddba427868dcec9f2ab5d46dabf79.zip FreeBSD-src-0ba901f49f8ddba427868dcec9f2ab5d46dabf79.tar.gz |
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.
Diffstat (limited to 'sys/boot/common/interp_forth.c')
-rw-r--r-- | sys/boot/common/interp_forth.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/boot/common/interp_forth.c b/sys/boot/common/interp_forth.c index a2dbbea..9da74a5 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 <stand.h> @@ -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); + } } /* |