Pause the execution (10s max) if any errors are displayed so the user
has a chance to see them. * grub-core/kern/err.c (grub_err_printed_errors): New variable. (grub_print_error): Increment grub_err_printed_errors. * grub-core/normal/menu.c (grub_menu_execute_entry): Pause the execution if any errors were displayed. (show_menu): Remove old code for pause. * grub-core/normal/menu_entry.c (run): Likewise. * grub-core/normal/term.c (grub_normal_char_counter): Removed. All users updated. (grub_normal_get_char_counter): Likewise. * include/grub/err.h (grub_err_printed_errors): New external variable. * include/grub/normal.h (grub_normal_get_char_counter): Removed.
This commit is contained in:
parent
f218b09c99
commit
38c259a76a
7 changed files with 37 additions and 32 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
||||||
|
2010-09-20 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Pause the execution (10s max) if any errors are displayed so the user
|
||||||
|
has a chance to see them.
|
||||||
|
|
||||||
|
* grub-core/kern/err.c (grub_err_printed_errors): New variable.
|
||||||
|
(grub_print_error): Increment grub_err_printed_errors.
|
||||||
|
* grub-core/normal/menu.c (grub_menu_execute_entry): Pause the
|
||||||
|
execution if any errors were displayed.
|
||||||
|
(show_menu): Remove old code for pause.
|
||||||
|
* grub-core/normal/menu_entry.c (run): Likewise.
|
||||||
|
* grub-core/normal/term.c (grub_normal_char_counter): Removed. All
|
||||||
|
users updated.
|
||||||
|
(grub_normal_get_char_counter): Likewise.
|
||||||
|
* include/grub/err.h (grub_err_printed_errors): New external variable.
|
||||||
|
* include/grub/normal.h (grub_normal_get_char_counter): Removed.
|
||||||
|
|
||||||
2010-09-20 Vladimir Serbinenko <phcoder@gmail.com>
|
2010-09-20 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Support multiboot VBE info.
|
Support multiboot VBE info.
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
grub_err_t grub_errno;
|
grub_err_t grub_errno;
|
||||||
char grub_errmsg[GRUB_MAX_ERRMSG];
|
char grub_errmsg[GRUB_MAX_ERRMSG];
|
||||||
|
int grub_err_printed_errors;
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
|
@ -122,7 +123,10 @@ grub_print_error (void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
if (grub_errno != GRUB_ERR_NONE)
|
||||||
grub_err_printf (_("error: %s.\n"), grub_errmsg);
|
{
|
||||||
|
grub_err_printf (_("error: %s.\n"), grub_errmsg);
|
||||||
|
grub_err_printed_errors++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (grub_error_pop ());
|
while (grub_error_pop ());
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,7 @@ void
|
||||||
grub_menu_execute_entry(grub_menu_entry_t entry)
|
grub_menu_execute_entry(grub_menu_entry_t entry)
|
||||||
{
|
{
|
||||||
grub_err_t err = GRUB_ERR_NONE;
|
grub_err_t err = GRUB_ERR_NONE;
|
||||||
|
int errs_before;
|
||||||
|
|
||||||
if (entry->restricted)
|
if (entry->restricted)
|
||||||
err = grub_auth_check_authentication (entry->users);
|
err = grub_auth_check_authentication (entry->users);
|
||||||
|
@ -169,9 +170,14 @@ grub_menu_execute_entry(grub_menu_entry_t entry)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errs_before = grub_err_printed_errors;
|
||||||
|
|
||||||
grub_env_set ("chosen", entry->title);
|
grub_env_set ("chosen", entry->title);
|
||||||
grub_script_execute_sourcecode (entry->sourcecode, entry->argc, entry->args);
|
grub_script_execute_sourcecode (entry->sourcecode, entry->argc, entry->args);
|
||||||
|
|
||||||
|
if (errs_before != grub_err_printed_errors)
|
||||||
|
grub_wait_after_message ();
|
||||||
|
|
||||||
if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ())
|
if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ())
|
||||||
/* Implicit execution of boot, only if something is loaded. */
|
/* Implicit execution of boot, only if something is loaded. */
|
||||||
grub_command_execute ("boot", 0, 0);
|
grub_command_execute ("boot", 0, 0);
|
||||||
|
@ -583,20 +589,9 @@ show_menu (grub_menu_t menu, int nested)
|
||||||
grub_cls ();
|
grub_cls ();
|
||||||
|
|
||||||
if (auto_boot)
|
if (auto_boot)
|
||||||
{
|
grub_menu_execute_with_fallback (menu, e, &execution_callback, 0);
|
||||||
grub_menu_execute_with_fallback (menu, e, &execution_callback, 0);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
grub_menu_execute_entry (e);
|
||||||
int chars_before = grub_normal_get_char_counter ();
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
grub_menu_execute_entry (e);
|
|
||||||
grub_print_error ();
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
if (chars_before != grub_normal_get_char_counter ())
|
|
||||||
grub_wait_after_message ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
|
@ -1161,6 +1161,7 @@ run (struct screen *screen)
|
||||||
{
|
{
|
||||||
int currline = 0;
|
int currline = 0;
|
||||||
char *nextline;
|
char *nextline;
|
||||||
|
int errs_before;
|
||||||
|
|
||||||
auto grub_err_t editor_getline (char **line, int cont);
|
auto grub_err_t editor_getline (char **line, int cont);
|
||||||
grub_err_t editor_getline (char **line, int cont __attribute__ ((unused)))
|
grub_err_t editor_getline (char **line, int cont __attribute__ ((unused)))
|
||||||
|
@ -1194,6 +1195,7 @@ run (struct screen *screen)
|
||||||
grub_printf_ (N_("Booting a command list"));
|
grub_printf_ (N_("Booting a command list"));
|
||||||
grub_printf ("\n\n");
|
grub_printf ("\n\n");
|
||||||
|
|
||||||
|
errs_before = grub_err_printed_errors;
|
||||||
|
|
||||||
/* Execute the script, line for line. */
|
/* Execute the script, line for line. */
|
||||||
while (currline < screen->num_lines)
|
while (currline < screen->num_lines)
|
||||||
|
@ -1203,6 +1205,9 @@ run (struct screen *screen)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errs_before != grub_err_printed_errors)
|
||||||
|
grub_wait_after_message ();
|
||||||
|
|
||||||
if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ())
|
if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ())
|
||||||
/* Implicit execution of boot, only if something is loaded. */
|
/* Implicit execution of boot, only if something is loaded. */
|
||||||
grub_command_execute ("boot", 0, 0);
|
grub_command_execute ("boot", 0, 0);
|
||||||
|
@ -1382,13 +1387,7 @@ grub_menu_entry_run (grub_menu_entry_t entry)
|
||||||
|
|
||||||
case GRUB_TERM_CTRL | 'x':
|
case GRUB_TERM_CTRL | 'x':
|
||||||
case GRUB_TERM_KEY_F10:
|
case GRUB_TERM_KEY_F10:
|
||||||
{
|
run (screen);
|
||||||
int chars_before = grub_normal_get_char_counter ();
|
|
||||||
run (screen);
|
|
||||||
|
|
||||||
if (chars_before != grub_normal_get_char_counter ())
|
|
||||||
grub_wait_after_message ();
|
|
||||||
}
|
|
||||||
goto refresh;
|
goto refresh;
|
||||||
|
|
||||||
case GRUB_TERM_CTRL | 'r':
|
case GRUB_TERM_CTRL | 'r':
|
||||||
|
|
|
@ -42,17 +42,9 @@ static struct term_state *term_states = NULL;
|
||||||
/* If the more pager is active. */
|
/* If the more pager is active. */
|
||||||
static int grub_more;
|
static int grub_more;
|
||||||
|
|
||||||
static int grub_normal_char_counter = 0;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
putcode_real (grub_uint32_t code, struct grub_term_output *term);
|
putcode_real (grub_uint32_t code, struct grub_term_output *term);
|
||||||
|
|
||||||
int
|
|
||||||
grub_normal_get_char_counter (void)
|
|
||||||
{
|
|
||||||
return grub_normal_char_counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_normal_reset_more (void)
|
grub_normal_reset_more (void)
|
||||||
{
|
{
|
||||||
|
@ -409,8 +401,6 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term)
|
||||||
.estimated_width = 1
|
.estimated_width = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
grub_normal_char_counter++;
|
|
||||||
|
|
||||||
if (c->base == '\t' && term->getxy)
|
if (c->base == '\t' && term->getxy)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
|
@ -66,6 +66,7 @@ void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
|
||||||
void EXPORT_FUNC(grub_error_push) (void);
|
void EXPORT_FUNC(grub_error_push) (void);
|
||||||
int EXPORT_FUNC(grub_error_pop) (void);
|
int EXPORT_FUNC(grub_error_pop) (void);
|
||||||
void EXPORT_FUNC(grub_print_error) (void);
|
void EXPORT_FUNC(grub_print_error) (void);
|
||||||
|
extern int EXPORT_VAR(grub_err_printed_errors);
|
||||||
int grub_err_printf (const char *fmt, ...)
|
int grub_err_printf (const char *fmt, ...)
|
||||||
__attribute__ ((format (printf, 1, 2)));
|
__attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,6 @@ void read_terminal_list (const char *prefix);
|
||||||
|
|
||||||
void grub_set_more (int onoff);
|
void grub_set_more (int onoff);
|
||||||
|
|
||||||
int grub_normal_get_char_counter (void);
|
|
||||||
void grub_normal_reset_more (void);
|
void grub_normal_reset_more (void);
|
||||||
|
|
||||||
void grub_xputs_normal (const char *str);
|
void grub_xputs_normal (const char *str);
|
||||||
|
|
Loading…
Reference in a new issue