summaryrefslogtreecommitdiffstats
path: root/sys/boot/forth/menu.4th
diff options
context:
space:
mode:
authorpluknet <pluknet@FreeBSD.org>2011-12-30 06:24:59 +0000
committerpluknet <pluknet@FreeBSD.org>2011-12-30 06:24:59 +0000
commit497a36490e30a6122984307435307feddaa785ce (patch)
tree8f0de51cfeb03e3fd44c326d04bcce015cba4fba /sys/boot/forth/menu.4th
parentca7ad903dc7d84736e5be31d5285163cf16e4f48 (diff)
downloadFreeBSD-src-497a36490e30a6122984307435307feddaa785ce.zip
FreeBSD-src-497a36490e30a6122984307435307feddaa785ce.tar.gz
Unset the environment variables associated with individual menu items
before invoking the kernel. Quoting submitter: The issue is with the new boot loader menu. It adds many loader variables including ones that contain ANSI color escapes. Obviously, these ANSI codes don't play well with serial consoles when kenv(1) is executed without arguments (reports vary as to what happens, but it's never pretty). The net-effect is that kenv(1) no longer reports menu-related variables. In essence, kenv(1) output should now appear the same as on RELENG_8 (which lacks the new boot loader and didn't use any such variables). Thus, restoring serial console glory. Submitted by: Devin Teske <devin dott teske fisglobal.com> MFC after: 2 weeks
Diffstat (limited to 'sys/boot/forth/menu.4th')
-rw-r--r--sys/boot/forth/menu.4th70
1 files changed, 59 insertions, 11 deletions
diff --git a/sys/boot/forth/menu.4th b/sys/boot/forth/menu.4th
index fbb6c16..daac6c8 100644
--- a/sys/boot/forth/menu.4th
+++ b/sys/boot/forth/menu.4th
@@ -131,11 +131,11 @@ create init_text8 255 allot
\ Print the value of menuidx
loader_color? if
- ." "
+ ." " (  )
then
menuidx @ .
loader_color? if
- ." "
+ ." " (  )
then
\ Move the cursor forward 1 column
@@ -897,22 +897,60 @@ create init_text8 255 allot
;
\ This function unsets all the possible environment variables associated with
-\ creating the interactive menu. Call this when you want to clear the menu
-\ area in preparation for another menu.
+\ creating the interactive menu.
\
-: menu-clear ( -- )
+: menu-unset ( -- )
49 \ Iterator start (loop range 49 to 56; ASCII '1' to '8')
begin
- \ basename for caption variable
- loader_color? if
- s" ansi_caption[x]"
- else
- s" menu_caption[x]"
- then
+ \ Unset variables in-order of appearance in menu.4th(8)
+
+ s" menu_caption[x]" \ basename for caption variable
-rot 2dup 13 + c! rot \ replace 'x' with current iteration
unsetenv \ not erroneous to unset unknown var
+ s" menu_command[x]" \ command basename
+ -rot 2dup 13 + c! rot \ replace 'x'
+ unsetenv
+
+ s" menu_keycode[x]" \ keycode basename
+ -rot 2dup 13 + c! rot \ replace 'x'
+ unsetenv
+
+ s" ansi_caption[x]" \ ANSI caption basename
+ -rot 2dup 13 + c! rot \ replace 'x'
+ unsetenv
+
+ s" toggled_text[x]" \ toggle_menuitem caption basename
+ -rot 2dup 13 + c! rot \ replace 'x'
+ unsetenv
+
+ s" toggled_ansi[x]" \ toggle_menuitem ANSI caption basename
+ -rot 2dup 13 + c! rot \ replace 'x'
+ unsetenv
+
+ s" menu_caption[x][y]" \ cycle_menuitem caption
+ -rot 2dup 13 + c! rot \ replace 'x'
+ 49 -rot
+ begin
+ 16 2over rot + c! \ replace 'y'
+ 2dup unsetenv
+
+ rot 1+ dup 56 > 2swap rot
+ until
+ 2drop drop
+
+ s" ansi_caption[x][y]" \ cycle_menuitem ANSI caption
+ -rot 2dup 13 + c! rot \ replace 'x'
+ 49 -rot
+ begin
+ 16 2over rot + c! \ replace 'y'
+ 2dup unsetenv
+
+ rot 1+ dup 56 > 2swap rot
+ until
+ 2drop drop
+
s" 0 menukeyN !" \ basename for key association var
-rot 2dup 9 + c! rot \ replace 'N' with current iteration
evaluate \ assign zero (0) to key assoc. var
@@ -921,6 +959,9 @@ create init_text8 255 allot
until
drop \ iterator
+ \ unset the timeout command
+ s" menu_timeout_command" unsetenv
+
\ clear the "Reboot" menu option flag
s" menu_reboot" unsetenv
0 menureboot !
@@ -933,6 +974,13 @@ create init_text8 255 allot
s" menu_options" unsetenv
0 menuoptions !
+;
+
+\ This function both unsets menu variables and visually erases the menu area
+\ in-preparation for another menu.
+\
+: menu-clear ( -- )
+ menu-unset
menu-erase
;
OpenPOWER on IntegriCloud