improve the dumb terminal support and fix some bugs related to the support.
This commit is contained in:
parent
9015cd0364
commit
36854134df
5 changed files with 118 additions and 26 deletions
41
ChangeLog
41
ChangeLog
|
@ -1,3 +1,44 @@
|
||||||
|
2000-09-04 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
|
* stage2/stage2.c (run_menu) [GRUB_UTIL]: Set DISP_UP and
|
||||||
|
DISP_DOWN to ACS_UARROW and ACS_DARROW, respectively. Don't call
|
||||||
|
grub_printf here.
|
||||||
|
(run_menu) [!GRUB_UTIL]: Don't call grub_printf here. Instead,
|
||||||
|
call it...
|
||||||
|
(run_menu): ... here.
|
||||||
|
* stage2/shared.h (ACS_ULCORNER): Always define this ourselves,
|
||||||
|
whether your curses library has the definition.
|
||||||
|
(ACS_URCORNER): Likewise.
|
||||||
|
(ACS_LLCORNER): Likewise.
|
||||||
|
(ACS_LRCORNER): Likewise.
|
||||||
|
(ACS_HLINE): Likewise.
|
||||||
|
(ACS_VLINE): Likewise.
|
||||||
|
(ACS_LARROW): Likewise.
|
||||||
|
(ACS_RARROW): Likewise.
|
||||||
|
(ACS_UARROW): Likewise.
|
||||||
|
(ACS_DARROW): Likewise.
|
||||||
|
|
||||||
|
* stage2/char_io.c [SUPPORT_SERIAL] (serial_cls): If the
|
||||||
|
terminal is dumb, just put a newline.
|
||||||
|
* stage2/builtins.c (terminal_func) [SUPPORT_SERIAL]: When
|
||||||
|
choosing a terminal, don't set TERMINAL to the type of the
|
||||||
|
terminal. Instead, apply a logical AND operation with
|
||||||
|
TERMINAL_DUMB, since previous code brushed off the dumb
|
||||||
|
attribute.
|
||||||
|
|
||||||
|
2000-09-04 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
|
* stage2/stage2.c (run_menu): If SHOW_MENU is zero, print a
|
||||||
|
message with the timeout per second.
|
||||||
|
If GRUB_TIMEOUT is negative, set SHOW_MENU to one, since the
|
||||||
|
condition "no timeout and no interface" is nonsense.
|
||||||
|
If GRUB_TIMEOUT is equal to or greater than zero and the
|
||||||
|
terminal is dumb, set SHOW_MENU to zero.
|
||||||
|
If SHOW_MENU is non-zero and the terminal is dumb, enter the
|
||||||
|
command-line interface instead. If AUTH is false and PASSWORD is
|
||||||
|
non-NULL, prompt the user to enter a password until the entered
|
||||||
|
password is identical to PASSWORD.
|
||||||
|
|
||||||
2000-09-03 OKUJI Yoshinori <okuji@gnu.org>
|
2000-09-03 OKUJI Yoshinori <okuji@gnu.org>
|
||||||
|
|
||||||
* util/grub-install.in: Fix a typo: grub_dir -> grubdir.
|
* util/grub-install.in: Fix a typo: grub_dir -> grubdir.
|
||||||
|
|
|
@ -3364,13 +3364,13 @@ terminal_func (char *arg, int flags)
|
||||||
{
|
{
|
||||||
if ((terminal & TERMINAL_CONSOLE) && console_checkkey () != -1)
|
if ((terminal & TERMINAL_CONSOLE) && console_checkkey () != -1)
|
||||||
{
|
{
|
||||||
terminal = TERMINAL_CONSOLE;
|
terminal &= (TERMINAL_CONSOLE | TERMINAL_DUMB);
|
||||||
(void) getkey ();
|
(void) getkey ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ((terminal & TERMINAL_SERIAL) && serial_checkkey () != -1)
|
else if ((terminal & TERMINAL_SERIAL) && serial_checkkey () != -1)
|
||||||
{
|
{
|
||||||
terminal = TERMINAL_SERIAL;
|
terminal &= (TERMINAL_SERIAL | TERMINAL_DUMB);
|
||||||
(void) getkey ();
|
(void) getkey ();
|
||||||
|
|
||||||
/* If the interface is currently the command-line, restart
|
/* If the interface is currently the command-line, restart
|
||||||
|
@ -3392,8 +3392,7 @@ terminal_func (char *arg, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Expired. */
|
/* Expired. */
|
||||||
terminal &= TERMINAL_DUMB;
|
terminal &= (default_terminal | TERMINAL_DUMB);
|
||||||
terminal |= default_terminal;
|
|
||||||
}
|
}
|
||||||
#endif /* SUPPORT_SERIAL */
|
#endif /* SUPPORT_SERIAL */
|
||||||
|
|
||||||
|
|
|
@ -1215,7 +1215,11 @@ cls (void)
|
||||||
void
|
void
|
||||||
serial_cls (void)
|
serial_cls (void)
|
||||||
{
|
{
|
||||||
grub_printf ("\e[H\e[J");
|
/* If the terminal is dumb, there is no way to clean the terminal. */
|
||||||
|
if (terminal & TERMINAL_DUMB)
|
||||||
|
grub_putchar ('\n');
|
||||||
|
else
|
||||||
|
grub_printf ("\e[H\e[J");
|
||||||
}
|
}
|
||||||
#endif /* SUPPORT_SERIAL */
|
#endif /* SUPPORT_SERIAL */
|
||||||
#endif /* ! STAGE1_5 */
|
#endif /* ! STAGE1_5 */
|
||||||
|
|
|
@ -298,19 +298,29 @@ extern char *grub_scratch_mem;
|
||||||
# endif /* ! A_STANDOUT */
|
# endif /* ! A_STANDOUT */
|
||||||
#endif /* ! A_REVERSE */
|
#endif /* ! A_REVERSE */
|
||||||
|
|
||||||
/* Make sure that ACS_* are defined. */
|
/* Define ACS_* ourselves, since the definitions are not consistent among
|
||||||
#ifndef ACS_ULCORNER
|
various curses implementations. */
|
||||||
# define ACS_ULCORNER '+'
|
#undef ACS_ULCORNER
|
||||||
# define ACS_URCORNER '+'
|
#undef ACS_URCORNER
|
||||||
# define ACS_LLCORNER '+'
|
#undef ACS_LLCORNER
|
||||||
# define ACS_LRCORNER '+'
|
#undef ACS_LRCORNER
|
||||||
# define ACS_HLINE '-'
|
#undef ACS_HLINE
|
||||||
# define ACS_VLINE '|'
|
#undef ACS_VLINE
|
||||||
# define ACS_LARROW '<'
|
#undef ACS_LARROW
|
||||||
# define ACS_RARROW '>'
|
#undef ACS_RARROW
|
||||||
# define ACS_UARROW '^'
|
#undef ACS_UARROW
|
||||||
# define ACS_DARROW 'v'
|
#undef ACS_DARROW
|
||||||
#endif /* ! ACS_ULCORNER */
|
|
||||||
|
#define ACS_ULCORNER '+'
|
||||||
|
#define ACS_URCORNER '+'
|
||||||
|
#define ACS_LLCORNER '+'
|
||||||
|
#define ACS_LRCORNER '+'
|
||||||
|
#define ACS_HLINE '-'
|
||||||
|
#define ACS_VLINE '|'
|
||||||
|
#define ACS_LARROW '<'
|
||||||
|
#define ACS_RARROW '>'
|
||||||
|
#define ACS_UARROW '^'
|
||||||
|
#define ACS_DARROW 'v'
|
||||||
|
|
||||||
/* Special graphics characters for IBM displays. */
|
/* Special graphics characters for IBM displays. */
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
|
|
|
@ -239,7 +239,7 @@ run_menu (char *menu_entries, char *config_entries, int num_entries,
|
||||||
char *cur_entry = 0;
|
char *cur_entry = 0;
|
||||||
int disp_up = DISP_UP;
|
int disp_up = DISP_UP;
|
||||||
int disp_down = DISP_DOWN;
|
int disp_down = DISP_DOWN;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main loop for menu UI.
|
* Main loop for menu UI.
|
||||||
*/
|
*/
|
||||||
|
@ -251,12 +251,18 @@ restart:
|
||||||
entryno--;
|
entryno--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the timeout was expired or wasn't set, force to show the menu
|
||||||
|
interface. If the terminal is dumb and the timeout is set, hide
|
||||||
|
the menu to boot the default entry automatically when the timeout
|
||||||
|
is expired. */
|
||||||
|
if (grub_timeout < 0)
|
||||||
|
show_menu = 1;
|
||||||
|
else if (terminal & TERMINAL_DUMB)
|
||||||
|
show_menu = 0;
|
||||||
|
|
||||||
/* If SHOW_MENU is false, don't display the menu until ESC is pressed. */
|
/* If SHOW_MENU is false, don't display the menu until ESC is pressed. */
|
||||||
if (! show_menu)
|
if (! show_menu)
|
||||||
{
|
{
|
||||||
/* Print a message. */
|
|
||||||
grub_printf ("Press `ESC' to enter the menu...\n");
|
|
||||||
|
|
||||||
/* Get current time. */
|
/* Get current time. */
|
||||||
while ((time1 = getrtsecs ()) == 0xFF)
|
while ((time1 = getrtsecs ()) == 0xFF)
|
||||||
;
|
;
|
||||||
|
@ -284,10 +290,40 @@ restart:
|
||||||
|
|
||||||
time2 = time1;
|
time2 = time1;
|
||||||
grub_timeout--;
|
grub_timeout--;
|
||||||
|
|
||||||
|
/* Print a message. */
|
||||||
|
if (terminal & TERMINAL_DUMB)
|
||||||
|
grub_printf ("\rPress `ESC' to enter the command-line... %d ",
|
||||||
|
grub_timeout);
|
||||||
|
else
|
||||||
|
grub_printf ("\rPress `ESC' to enter the menu... %d ",
|
||||||
|
grub_timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the terminal is dumb, enter the command-line interface instead. */
|
||||||
|
if (show_menu && (terminal & TERMINAL_DUMB))
|
||||||
|
{
|
||||||
|
if (! auth && password)
|
||||||
|
{
|
||||||
|
/* The user must enter a correct password. */
|
||||||
|
char entered[32];
|
||||||
|
|
||||||
|
/* Make sure that PASSWORD is NUL-terminated. */
|
||||||
|
nul_terminate (password);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
grub_memset (entered, 0, sizeof (entered));
|
||||||
|
get_cmdline ("Password: ", entered, 31, '*', 0);
|
||||||
|
}
|
||||||
|
while (grub_strcmp (password, entered) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
enter_cmdline (heap, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Only display the menu if the user wants to see it. */
|
/* Only display the menu if the user wants to see it. */
|
||||||
if (show_menu)
|
if (show_menu)
|
||||||
{
|
{
|
||||||
|
@ -302,8 +338,9 @@ restart:
|
||||||
print_border (3, 12);
|
print_border (3, 12);
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
grub_printf ("\n\
|
/* In the grub shell, always use ACS_*. */
|
||||||
Use the up and down arrows to select which entry is highlighted.\n");
|
disp_up = ACS_UARROW;
|
||||||
|
disp_down = ACS_DARROW;
|
||||||
#else /* ! GRUB_UTIL */
|
#else /* ! GRUB_UTIL */
|
||||||
# ifdef SUPPORT_SERIAL
|
# ifdef SUPPORT_SERIAL
|
||||||
if (terminal & TERMINAL_CONSOLE)
|
if (terminal & TERMINAL_CONSOLE)
|
||||||
|
@ -317,10 +354,11 @@ restart:
|
||||||
disp_down = ACS_DARROW;
|
disp_down = ACS_DARROW;
|
||||||
}
|
}
|
||||||
# endif /* SUPPORT_SERIAL */
|
# endif /* SUPPORT_SERIAL */
|
||||||
|
#endif /* ! GRUB_UTIL */
|
||||||
|
|
||||||
grub_printf ("\n\
|
grub_printf ("\n\
|
||||||
Use the %c and %c keys to select which entry is highlighted.\n",
|
Use the %c and %c keys to select which entry is highlighted.\n",
|
||||||
disp_up, disp_down);
|
disp_up, disp_down);
|
||||||
#endif /* ! GRUB_UTIL */
|
|
||||||
|
|
||||||
if (! auth && password)
|
if (! auth && password)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue