add a new command hiddenmenu.

This commit is contained in:
okuji 2000-06-21 07:35:37 +00:00
parent 5ad5c7796a
commit 21236a8556
5 changed files with 85 additions and 4 deletions

View file

@ -1,3 +1,20 @@
2000-06-21 OKUJI Yoshinori <okuji@gnu.org>
* stage2/stage2.c (run_menu): Initialize CUR_ENTRY at the
definition.
If SHOW_MENU is zero, don't display the menu interface. Instead,
wait until the timeout is expired and then boot the default
entry. If the user presses `ESC' during the timeout, set
SHOW_MENU to one and break the loop.
Display the menu if SHOW_MENU is true, instead of if
GRUB_TIMEOUT is non-zero.
Set SHOW_MENU to one before go to the label `restart'.
* stage2/builtins.c (show_menu): New global variable.
(hiddenmenu_func): New function.
(builtin_hiddenmenu): New variable.
(builtin_table): Added a pointer to BUILTIN_HIDDENMENU.
* stage2/shared.h (show_menu): Declared.
2000-06-19 OKUJI Yoshinori <okuji@gnu.org>
* docs/mdate-sh: Moved to ...

2
NEWS
View file

@ -2,6 +2,8 @@ NEWS - list of user-visible changes between releases of GRUB
New in 0.5.96 - XXXX-XX-XX:
* New commands, "reboot" and "halt".
* New command, "hiddenmenu". You can hide the menu interface by default
with this command.
New in 0.5.95 - XXXX-XX-XX:
* NetBSD ELF kernel support is added. You have to specify the new option

View file

@ -52,6 +52,8 @@ int normal_color;
int highlight_color;
/* The timeout. */
int grub_timeout = -1;
/* Whether to show the menu or not. */
int show_menu = 1;
/* The BIOS drive map. */
static unsigned short bios_drive_map[DRIVE_MAP_SIZE + 1];
@ -1329,6 +1331,26 @@ static struct builtin builtin_help =
"Display helpful information about builtin commands."
};
/* hiddenmenu */
static int
hiddenmenu_func (char *arg, int flags)
{
show_menu = 0;
return 0;
}
static struct builtin builtin_hiddenmenu =
{
"hiddenmenu",
hiddenmenu_func,
BUILTIN_MENU,
#if 0
"hiddenmenu",
"Hide the menu."
#endif
};
/* hide */
static int
@ -3133,6 +3155,7 @@ struct builtin *builtin_table[] =
&builtin_geometry,
&builtin_halt,
&builtin_help,
&builtin_hiddenmenu,
&builtin_hide,
&builtin_impsprobe,
&builtin_initrd,

View file

@ -688,6 +688,7 @@ typedef enum
kernel_t;
extern kernel_t kernel_type;
extern int show_menu;
extern int grub_timeout;
void init_builtins (void);

View file

@ -173,7 +173,7 @@ run_menu (char *menu_entries, char *config_entries, int num_entries,
char *heap, int entryno)
{
int c, time1, time2 = -1, first_entry = 0;
char *cur_entry;
char *cur_entry = 0;
/*
* Main loop for menu UI.
@ -186,8 +186,45 @@ restart:
entryno --;
}
/* Only display the menu if we're not out of time. */
if (grub_timeout != 0)
/* If SHOW_MENU is false, don't display the menu until ESC is pressed. */
if (! show_menu)
{
/* Print a message. */
grub_printf ("Press `ESC' to enter the menu...\n");
/* Get current time. */
while ((time1 = getrtsecs ()) == 0xFF)
;
while (1)
{
/* Check if ESC is pressed. */
if (checkkey () != -1 && getkey () == 27)
{
grub_timeout = -1;
show_menu = 1;
break;
}
/* If GRUB_TIMEOUT is expired, boot the default entry. */
if (grub_timeout >=0
&& (time1 = getrtsecs ()) != time2
&& time1 != 0xFF)
{
if (grub_timeout <= 0)
{
grub_timeout = -1;
goto boot_entry;
}
time2 = time1;
grub_timeout--;
}
}
}
/* Only display the menu if the user wants to see it. */
if (show_menu)
{
init_page ();
#ifndef GRUB_UTIL
@ -519,7 +556,7 @@ restart:
/*
* Attempt to boot an entry.
*/
boot_entry:
while (1)
{
cls ();
@ -549,6 +586,7 @@ restart:
break;
}
show_menu = 1;
goto restart;
}