Fixes an ugly result of setting timeout=0.

When this is combined with the "sleep" patch I just sent, user can implement
hiddenmenu-like functionality via scripting:

echo -n "Press `ESC' to enter the menu... "
if sleep -v -i 10 ; then
  set timeout=10
else
  set timeout=0
fi

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
	* normal/menu.c (run_menu): If timeout is set to zero, don't bother
	drawing the menu.

diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/normal/menu.c ./normal/menu.c
--- ../grub2/normal/menu.c	2008-01-15 15:05:40.000000000 +0100
+++ ./normal/menu.c	2008-02-08 17:11:41.000000000 +0100
@@ -339,6 +339,10 @@ run_menu (grub_menu_t menu, int nested)
   if (default_entry < 0 || default_entry >= menu->size)
     default_entry = 0;
 
+  /* If timeout is 0, drawing is pointless (and ugly).  */
+  if (get_timeout () == 0)
+    return default_entry;
+
   offset = default_entry;
   if (offset > GRUB_TERM_NUM_ENTRIES - 1)
     {
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to