From 67283798801d226b00acf19bf20081799e38b8a1 Mon Sep 17 00:00:00 2001 From: okuji Date: Fri, 1 Sep 2000 22:47:21 +0000 Subject: [PATCH] fix a bug in the option --speed for the command serial, fix the cursor position after displaying the menu, add the keys v and ^ to move the corsor in the menu. --- ChangeLog | 27 +++++++++++++++++++++++++++ docs/grub-install.8 | 2 +- docs/grub.8 | 2 +- docs/mbchk.1 | 2 +- stage2/builtins.c | 2 +- stage2/stage2.c | 45 ++++++++++++++++++++++++++++++++++----------- 6 files changed, 65 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed7b7590d..b2488a70c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2000-09-02 OKUJI Yoshinori + + * stage2/stage2.c (run_menu): Don't use either `p' or `n' to + move the cursor, because `p' is already used for another + purpose (password). + (run_menu) [SUPPORT_SERIAL]: Don't set the variables DISP_UP and + DISP_DOWN at the start time. Instead, set them just before using + them actually, because TERMINAL may change when running a menu. + +2000-09-01 Klaus Reichl + + * stage2/stage2.c (run_menu): Setup and use disp_up, disp_down + depending on the terminal mode. + (run_menu): Allow '^' (resp. 'p') and 'v' (resp 'n') keys we + described in our help above (resp. authors preferences). + +2000-08-31 Klaus Reichl + + * stage2/stage2.c (set_line): Go back one char, which is + consistent with the original situation, when a timeout was + running. + (run_menu): If GRUB_TIMEOUT is stopped don't loop busy over + CHECKKEY, just relax in GETKEY. + + * stage2/builtins.c (serial_func): --speed handling: corrected + typo: set SPEED instead of PORT. + 2000-08-31 OKUJI Yoshinori * stage2/builtins.c (terminal_func): Added two new options, diff --git a/docs/grub-install.8 b/docs/grub-install.8 index f28a3f1dd..a38e312eb 100644 --- a/docs/grub-install.8 +++ b/docs/grub-install.8 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020. -.TH GRUB-INSTALL "8" "August 2000" "grub-install (GNU GRUB 0.5.96)" FSF +.TH GRUB-INSTALL "8" "September 2000" "grub-install (GNU GRUB 0.5.96)" FSF .SH NAME grub-install \- install GRUB on your drive .SH SYNOPSIS diff --git a/docs/grub.8 b/docs/grub.8 index d2b6b32ac..d3adbe027 100644 --- a/docs/grub.8 +++ b/docs/grub.8 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020. -.TH GRUB "8" "August 2000" "grub (GNU GRUB 0.5.96)" FSF +.TH GRUB "8" "September 2000" "grub (GNU GRUB 0.5.96)" FSF .SH NAME grub \- the grub shell .SH SYNOPSIS diff --git a/docs/mbchk.1 b/docs/mbchk.1 index 146963032..9e7867429 100644 --- a/docs/mbchk.1 +++ b/docs/mbchk.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020. -.TH MBCHK "1" "August 2000" "mbchk (GNU GRUB 0.5.96)" FSF +.TH MBCHK "1" "September 2000" "mbchk (GNU GRUB 0.5.96)" FSF .SH NAME mbchk \- check the format of a Multiboot kernel .SH SYNOPSIS diff --git a/stage2/builtins.c b/stage2/builtins.c index 8ad25c69a..f12e3f033 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -2695,7 +2695,7 @@ serial_func (char *arg, int flags) if (! safe_parse_maxint (&p, &num)) return 1; - port = (unsigned short) num; + speed = (unsigned short) num; } else if (grub_memcmp (arg, "--word=", sizeof ("--word=") - 1) == 0) { diff --git a/stage2/stage2.c b/stage2/stage2.c index f35c22701..f6356bc8b 100644 --- a/stage2/stage2.c +++ b/stage2/stage2.c @@ -195,6 +195,8 @@ set_line (int y, int entryno, int attr, char *menu_entries) set_attrib (attr); } } + + gotoxy (74, y); } /* Set the attribute of the line Y to normal state. */ @@ -235,7 +237,9 @@ run_menu (char *menu_entries, char *config_entries, int num_entries, { int c, time1, time2 = -1, first_entry = 0; char *cur_entry = 0; - + int disp_up = DISP_UP; + int disp_down = DISP_DOWN; + /* * Main loop for menu UI. */ @@ -243,8 +247,8 @@ run_menu (char *menu_entries, char *config_entries, int num_entries, restart: while (entryno > 11) { - first_entry ++; - entryno --; + first_entry++; + entryno--; } /* If SHOW_MENU is false, don't display the menu until ESC is pressed. */ @@ -300,12 +304,24 @@ restart: #ifdef GRUB_UTIL grub_printf ("\n\ Use the up and down arrows to select which entry is highlighted.\n"); -#else +#else /* ! GRUB_UTIL */ +# ifdef SUPPORT_SERIAL + if (terminal & TERMINAL_CONSOLE) + { + disp_up = DISP_UP; + disp_down = DISP_DOWN; + } + else + { + disp_up = ACS_UARROW; + disp_down = ACS_DARROW; + } +# endif /* SUPPORT_SERIAL */ grub_printf ("\n\ Use the %c and %c keys to select which entry is highlighted.\n", - DISP_UP, DISP_DOWN); -#endif - + disp_up, disp_down); +#endif /* ! GRUB_UTIL */ + if (! auth && password) { printf ("\ @@ -337,7 +353,7 @@ restart: while (1) { - /* initilize to NULL just in case... */ + /* Initialize to NULL just in case... */ cur_entry = NULL; if (grub_timeout >= 0 && (time1 = getrtsecs()) != time2 && time1 != 0xFF) @@ -356,7 +372,12 @@ restart: grub_timeout--; } - if (checkkey () != -1) + /* Check for a keypress, however if TIMEOUT has been expired + (GRUB_TIMEOUT == -1) relax in GETKEY even if no key has been + pressed. + This avoids polling (relevant in the grub-shell and later on + in grub if interrupt driven I/O is done). */ + if ((checkkey () != -1) || (grub_timeout == -1)) { c = translate_keycode (getkey ()); @@ -369,7 +390,9 @@ restart: gotoxy (74, 4 + entryno); } - if (c == 16) + /* We told them above (at least in SUPPORT_SERIAL) to use + '^' or 'v' so accept these keys. */ + if (c == 16 || c == '^') { if (entryno > 0) { @@ -386,7 +409,7 @@ restart: set_line_highlight (4, first_entry + entryno, menu_entries); } } - if (c == 14 && (first_entry + entryno + 1) < num_entries) + if ((c == 14 || c == 'v') && first_entry + entryno + 1 < num_entries) { if (entryno < 11) {