9981 loader: add set-module-path to support scripting the module load path change
Reviewed by: Rob Johnston <rob.johnston@joyent.com>
Approved by: Joshua M. Clulow <josh@sysmgr.org>
diff --git a/usr/src/boot/sys/boot/forth/loader.4th b/usr/src/boot/sys/boot/forth/loader.4th
index cdcacc8..92c742c 100644
--- a/usr/src/boot/sys/boot/forth/loader.4th
+++ b/usr/src/boot/sys/boot/forth/loader.4th
@@ -590,6 +590,12 @@
: show-module ( <module> -- ) find-module ?dup if show-one-module then ;
+: set-module-path ( addr len <module> -- )
+ find-module ?dup if
+ module.loadname string=
+ then
+;
+
\ Words to be used inside configuration files
: retry false ; \ For use in load error commands
diff --git a/usr/src/boot/sys/boot/forth/support.4th b/usr/src/boot/sys/boot/forth/support.4th
index 4049276..17c4ac0 100644
--- a/usr/src/boot/sys/boot/forth/support.4th
+++ b/usr/src/boot/sys/boot/forth/support.4th
@@ -985,6 +985,8 @@
\ find a module name, leave addr on the stack (0 if not found)
: find-module ( <module> -- ptr | 0 )
bl parse ( addr len )
+ dup 0= if 2drop then ( parse did not find argument, try stack )
+ depth 2 < if 0 exit then
module_options @ >r ( store current pointer )
begin
r@