* grub-core/lib/legacy_parse.c: Fix handling of hercules and add

graphics console.
This commit is contained in:
Vladimir Serbinenko 2013-11-05 02:43:27 +01:00
parent 3fe63754d2
commit 386571a24b
2 changed files with 31 additions and 31 deletions

View file

@ -1,3 +1,8 @@
2013-11-05 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/legacy_parse.c: Fix handling of hercules and add
graphics console.
2013-11-05 Vladimir Serbinenko <phcoder@gmail.com> 2013-11-05 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/video/i386/pc/vga.c: Fix double bufferring and * grub-core/video/i386/pc/vga.c: Fix double bufferring and

View file

@ -77,6 +77,7 @@ static struct legacy_command legacy_commands[] =
"Initialize a network device via BOOTP. If the option `--with-configfile'" "Initialize a network device via BOOTP. If the option `--with-configfile'"
" is given, try to load a configuration file specified by the 150 vendor" " is given, try to load a configuration file specified by the 150 vendor"
" tag."}, " tag."},
/* FIXME: border unsupported. */
{"cat", "cat '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILE", {"cat", "cat '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILE",
"Print the contents of the file FILE."}, "Print the contents of the file FILE."},
{"chainloader", "chainloader %s '%s'\n", NULL, 0, {"chainloader", "chainloader %s '%s'\n", NULL, 0,
@ -295,6 +296,7 @@ static struct legacy_command legacy_commands[] =
" STOP is the length of stop bit(s). The option --device can be used only" " STOP is the length of stop bit(s). The option --device can be used only"
" in the grub shell, which specifies the file name of a tty device. The" " in the grub shell, which specifies the file name of a tty device. The"
" default values are COM1, 9600, 8N1."}, " default values are COM1, 9600, 8N1."},
/* FIXME: shade unsupported. */
/* FIXME: silent unsupported. */ /* FIXME: silent unsupported. */
/* FIXME: splashimage unsupported. */ /* FIXME: splashimage unsupported. */
/* FIXME: setkey unsupported. */ /* NUL_TERMINATE */ /* FIXME: setkey unsupported. */ /* NUL_TERMINATE */
@ -305,7 +307,7 @@ static struct legacy_command legacy_commands[] =
/* FIXME: graphics unsupported. */ /* FIXME: graphics unsupported. */
{"terminal", NULL, NULL, 0, 0, {}, FLAG_TERMINAL | FLAG_IGNORE_REST, {"terminal", NULL, NULL, 0, 0, {}, FLAG_TERMINAL | FLAG_IGNORE_REST,
"[--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] " "[--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] "
"[--silent] [console] [serial] [hercules]", "[--silent] [console] [serial] [hercules] [graphics]",
"Select a terminal. When multiple terminals are specified, wait until" "Select a terminal. When multiple terminals are specified, wait until"
" you push any key to continue. If both console and serial are specified," " you push any key to continue. If both console and serial are specified,"
" the terminal to which you input a key first will be selected. If no" " the terminal to which you input a key first will be selected. If no"
@ -346,6 +348,7 @@ static struct legacy_command legacy_commands[] =
FLAG_FALLBACK, NULL, NULL} FLAG_FALLBACK, NULL, NULL}
/* FIXME: verbose unsupported. */ /* FIXME: verbose unsupported. */
/* FIXME: version unsupported. */ /* FIXME: version unsupported. */
/* FIXME: viewport unsupported. */
}; };
char * char *
@ -544,9 +547,9 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
int no_echo = 0, no_edit = 0; int no_echo = 0, no_edit = 0;
#endif #endif
int hercules = 0; int hercules = 0;
int console = 0, serial = 0; int console = 0, serial = 0, graphics = 0;
/* Big enough for any possible resulting command. */ /* Big enough for any possible resulting command. */
char outbuf[256] = ""; char outbuf[512] = "";
char *outptr; char *outptr;
while (*ptr) while (*ptr)
{ {
@ -578,46 +581,38 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
serial = 1; serial = 1;
if (grub_memcmp (ptr, "hercules", sizeof ("hercules") - 1) == 0) if (grub_memcmp (ptr, "hercules", sizeof ("hercules") - 1) == 0)
hercules = 1; hercules = 1;
if (grub_memcmp (ptr, "graphics", sizeof ("graphics") - 1) == 0)
graphics = 1;
while (*ptr && !grub_isspace (*ptr)) while (*ptr && !grub_isspace (*ptr))
ptr++; ptr++;
while (*ptr && grub_isspace (*ptr)) while (*ptr && grub_isspace (*ptr))
ptr++; ptr++;
} }
if (!console && !serial) if (!console && !serial && !hercules && !graphics)
return grub_strdup ("terminal_input; terminal_output; terminfo\n"); return grub_strdup ("terminal_input; terminal_output; terminfo\n");
grub_strcpy (outbuf, "terminal_input "); outptr = outbuf;
outptr = outbuf + grub_strlen (outbuf);
if (graphics)
outptr = grub_stpcpy (outptr, "insmod all_video; ");
outptr = grub_stpcpy (outptr, "terminal_input ");
if (serial) if (serial)
{ outptr = grub_stpcpy (outptr, "serial ");
grub_strcpy (outptr, "serial "); if (console || hercules || graphics)
outptr += grub_strlen (outptr); outptr = grub_stpcpy (outptr, "console ");
} outptr = grub_stpcpy (outptr, "; terminal_output ");
if (console || hercules)
{
grub_strcpy (outptr, "console ");
outptr += grub_strlen (outptr);
}
grub_strcpy (outptr, "; terminal_output ");
outptr += grub_strlen (outptr);
if (serial) if (serial)
{ outptr = grub_stpcpy (outptr, "serial ");
grub_strcpy (outptr, "serial ");
outptr += grub_strlen (outptr);
}
if (console) if (console)
{ outptr = grub_stpcpy (outptr, "console ");
grub_strcpy (outptr, "console ");
outptr += grub_strlen (outptr);
}
if (hercules) if (hercules)
{ outptr = grub_stpcpy (outptr, "mda_text ");
grub_strcpy (outptr, "mda_text "); if (graphics)
outptr += grub_strlen (outptr); outptr = grub_stpcpy (outptr, "gfxterm ");
} outptr = grub_stpcpy (outptr, "; ");
grub_strcpy (outptr, "; "); *outptr = '\0';
outptr += grub_strlen (outptr);
if (serial) if (serial)
{ {
grub_snprintf (outptr, outbuf + sizeof (outbuf) - outptr, grub_snprintf (outptr, outbuf + sizeof (outbuf) - outptr,