From 4cf606a18e809c411277062d4f152b534f897f60 Mon Sep 17 00:00:00 2001 From: gord Date: Thu, 25 Mar 1999 04:05:04 +0000 Subject: [PATCH] Fixes from Okuji --- ChangeLog | 10 ++++++++++ grub/main.c | 13 +++++++++++++ shared_src/char_io.c | 7 ++++--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7adc5e55..2a9fad0ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +1999-03-25 OKUJI Yoshinori + + * char_io.c (get_cmdline): Call cl_setcpos even if lpos == llen, + because ncurses won't update the cursor position. + + * grub/main.c (OPT_HOLD): New macro. + (longopts): New option --hold. + (usage): Add the documentation about --hold. + (main): Set hold if --hold is specified. Wait until cleared. + 1999-03-22 Gordon Matzigkeit * shared_src/cmdline.c (enter_cmdline): Check the return value of diff --git a/grub/main.c b/grub/main.c index 47b7c747a..50b90edac 100644 --- a/grub/main.c +++ b/grub/main.c @@ -23,17 +23,20 @@ int grub_stage2 (void); #include #include +#include char *program_name = 0; #define OPT_HELP -2 #define OPT_VERSION -3 +#define OPT_HOLD -4 #define OPTSTRING "" static struct option longopts[] = { {"help", no_argument, 0, OPT_HELP}, {"version", no_argument, 0, OPT_VERSION}, + {"hold", no_argument, 0, OPT_HOLD}, {0}, }; @@ -51,6 +54,7 @@ Usage: %s [OPTION]...\n\ Enter the GRand Unified Bootloader command shell.\n\ \n\ --help display this message and exit\n\ + --hold wait forever so that a debugger may be attached\n\ --version print version information and exit\n\ ", program_name); @@ -63,6 +67,7 @@ int main (int argc, char **argv) { int c; + int hold = 0; program_name = argv[0]; /* Parse command-line options. */ @@ -75,6 +80,10 @@ main (int argc, char **argv) /* Fall through the bottom of the loop. */ break; + case OPT_HOLD: + hold = 1; + break; + case OPT_HELP: usage (0); break; @@ -90,6 +99,10 @@ main (int argc, char **argv) } while (c != EOF); + /* Wait until the HOLD variable is cleared by an attached debugger. */ + while (hold) + sleep (1); + /* Transfer control to the stage2 simulator. */ exit (grub_stage2 ()); } diff --git a/shared_src/char_io.c b/shared_src/char_io.c index 7db5903b9..7cf5ea843 100644 --- a/shared_src/char_io.c +++ b/shared_src/char_io.c @@ -293,7 +293,7 @@ get_cmdline (char *prompt, char *commands, char *cmdline, int maxlen) case 6: /* C-f forward one character */ if (lpos < llen) { - lpos++; + lpos ++; cl_setcpos (); } break; @@ -307,7 +307,7 @@ get_cmdline (char *prompt, char *commands, char *cmdline, int maxlen) case 4: /* C-d delete character under cursor */ if (lpos == llen) break; - lpos++; + lpos ++; /* fallthrough is on purpose! */ case 8: /* C-h backspace */ if (lpos > 0) @@ -361,7 +361,8 @@ get_cmdline (char *prompt, char *commands, char *cmdline, int maxlen) cmdline[lpos] = c; cmdline[lpos + 1] = 0; cl_print (cmdline + lpos); - lpos++; + lpos ++; + cl_setcpos (); } else {