2005-02-27 Yoshinori K. Okuji <okuji@enbug.org>
* commands/default.h: New file. * commands/timeout.h: Likewise. * normal/context.c: Likewise. * util/misc.c: Do not include sys/times.h. Include sys/time.h and grub/machine/time.h. (grub_get_rtc): Rewritten with gettimeofday. * util/grub-emu.c (main): Call grub_default_init and grub_timeout_init before grub_normal_init, and call grub_timeout_fini and grub_default_fini after grub_main. * util/console.c (grub_ncurses_checkkey): Return the read character or -1. * normal/menu.c (run_menu): Set MENU->TIMEOUT to -1 once it timeouts. * normal/main.c (read_config_file): Push MENU. If this fails, print an error and wait for a user input. Print an error only if GRUB_ERRNO is not GRUB_ERR_NONE. If a menu is empty or an error occurs, pop MENU. (grub_normal_execute): Pop and free MENU after grub_menu_run returns. * kern/loader.c (grub_loader_boot): Call grub_machine_fini. * include/grub/powerpc/ieee1275/time.h [GRUB_UTIL]: Do not include time.h. [GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as without GRUB_UTIL. * include/grub/i386/pc/time.h [GRUB_UTIL]: Do not include time.h. [GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as without GRUB_UTIL. * include/grub/normal.h (struct grub_menu_list): New struct. (grub_menu_list_t): New type. (struct grub_context): New struct. (grub_context_t): New type. (grub_register_command): Got rid of EXPORT_FUNC. (grub_unregister_command): Likewise. (grub_context_get): New prototype. (grub_context_get_current_menu): Likewise. (grub_context_push_menu): Likewise. (grub_context_pop_menu): Likewise. [GRUB_UTIL] (grub_default_init): Likewise. [GRUB_UTIL] (grub_default_fini): Likewise. [GRUB_UTIL] (grub_timeout_init): Likewise. [GRUB_UTIL] (grub_timeout_fini): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Added commands/default.c, commands/timeout.c and normal/context.c. (pkgdata_MODULES): Added default.mod and timeout.mod. (normal_mod_SOURCES): Added normal/context.c. (default_mod_SOURCES): New variable. (default_mod_CFLAGS): Likewise. (timeout_mod_SOURCES): Likewise. (timeout_mod_CFLAGS): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Copied from conf/i386-pc.rmk. (pkgdata_MODULES): Added default.mod and timeout.mod. (normal_mod_SOURCES): Added normal/context.c. (default_mod_SOURCES): New variable. (default_mod_CFLAGS): Likewise. (timeout_mod_SOURCES): Likewise. (timeout_mod_CFLAGS): Likewise. * Makefile.in (all-local): Added $(MKFILES).
This commit is contained in:
parent
4ed2e1dd1c
commit
93f3a1d868
18 changed files with 895 additions and 273 deletions
|
@ -1,7 +1,7 @@
|
|||
/* main.c - the normal mode main routine */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2000,2001,2002,2003 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2000,2001,2002,2003,2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -154,6 +154,21 @@ read_config_file (const char *config)
|
|||
menu->size = 0;
|
||||
menu->entry_list = 0;
|
||||
|
||||
if (! grub_context_push_menu (menu))
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
free_menu (menu);
|
||||
grub_file_close (file);
|
||||
|
||||
/* Wait until the user pushes any key so that the user
|
||||
can see what happened. */
|
||||
grub_printf ("\nPress any key to continue...");
|
||||
(void) grub_getkey ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
next_entry = &(menu->entry_list);
|
||||
next_cmd = 0;
|
||||
|
||||
|
@ -207,8 +222,11 @@ read_config_file (const char *config)
|
|||
if (cmd->flags & GRUB_COMMAND_FLAG_MENU)
|
||||
{
|
||||
grub_command_execute (cmdline);
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
if (grub_errno != GRUB_ERR_NONE)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -245,6 +263,7 @@ read_config_file (const char *config)
|
|||
/* If no entry was found or any error occurred, return NULL. */
|
||||
if (menu->size == 0 || grub_errno != GRUB_ERR_NONE)
|
||||
{
|
||||
grub_context_pop_menu ();
|
||||
free_menu (menu);
|
||||
return 0;
|
||||
}
|
||||
|
@ -301,7 +320,11 @@ grub_normal_execute (const char *config, int nested)
|
|||
}
|
||||
|
||||
if (menu)
|
||||
grub_menu_run (menu, nested);
|
||||
{
|
||||
grub_menu_run (menu, nested);
|
||||
grub_context_pop_menu ();
|
||||
free_menu (menu);
|
||||
}
|
||||
else
|
||||
grub_cmdline_run (nested);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue