Fixes from Okuji
This commit is contained in:
parent
eea6c34440
commit
4cf606a18e
3 changed files with 27 additions and 3 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
1999-03-25 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||
|
||||
* 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 <gord@trick.fig.org>
|
||||
|
||||
* shared_src/cmdline.c (enter_cmdline): Check the return value of
|
||||
|
|
13
grub/main.c
13
grub/main.c
|
@ -23,17 +23,20 @@ int grub_stage2 (void);
|
|||
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
|
||||
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 ());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue