Here goes a pseudo-patch for a modified version of grub 0.97 with image
support.
The following are some functions so that the command cat pauses at each
screen when the file that concatenates to screen is bigger than the screen.
This is the normal behaviour when pager is on and you call the cat
command from the grub command line. But if you call cat command from a
menu it does not stop at each screen. With this pseudo-patch it will stop.
I think it does not stop at the last "page" of the file. So you will
have to add a pause manually after the cat command manually.
I will use this feature to cat to screen the GPL license from my Super
Grub Disk ( http://adrian15.raulete.net/ ). Previously I had chopped it
into 20 pieces. :)
Enjoy it!
adrian15
cat from stage2/builtins.c:
=========================
/* cat */
static int
cat_func (char *arg, int flags)
{
int temporal_count_lines;
char c;
temporal_count_lines=count_lines; // Fetch value of count_lines
count_lines=0; // Force cat to count lines even when called from inside
a menu
if (! grub_open (arg))
return 1;
while (grub_read (&c, 1))
{
/* Because running "cat" with a binary file can confuse the terminal,
print only some characters as they are. */
//if (isspace (c) || (c >= ' ' && c <= '~'))
grub_putchar (c);
//else
//grub_putchar ('?');
}
grub_close ();
count_lines=temporal_count_lines; // Restore value of count_lines
return 0;
}
static struct builtin builtin_cat =
{
"cat",
cat_func,
BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
"cat FILE",
"Print the contents of the file FILE."
};
do_more from stage2/char_io.c
==============================
/* Internal pager. */
int
do_more (void)
{
if (count_lines >= 0)
{
count_lines++;
if (count_lines >= max_lines - 2)
{
int tmp;
/* It's important to disable the feature temporarily, because
the following grub_printf call will print newlines. */
count_lines = -1;
grub_printf("\n");
if (current_term->setcolorstate)
current_term->setcolorstate (COLOR_STATE_HIGHLIGHT);
grub_printf ("[Hit return to continue]");
if (current_term->setcolorstate)
current_term->setcolorstate (COLOR_STATE_STANDARD);
do
{
tmp = ASCII_CHAR (getkey ());
}
while (tmp != '\n' && tmp != '\r');
grub_printf ("\r \r");
/* Restart to count lines. */
count_lines = 0;
return 1;
}
}
return 0;
}
_______________________________________________
Bug-grub mailing list
Bug-grub@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-grub