mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-26 00:59:55 +00:00
2002-02-08 Yoshinori K. Okuji <okuji@enbug.org>
An internal pager is implemented. * stage2/builtins.c (pager_func): New function. (builtin_pager): New variable. (terminal_func): New option, "--lines=LINES" is added. If this option is specified, set MAX_LINES to the value. Otherwise, set MAX_LINES to 24. (vbeprobe_func): Remove the pager code specific to this function. (builtin_table): Added a pointer to BUILTIN_PAGER. * stage2/char_io.c (max_lines) [!STAGE1_5]: New variable. (count_lines) [!STAGE1_5]: Likewise. (use_pager) [!STAGE1_5]: Likewise. (grub_putchar) [!STAGE1_5]: if C is a newline and COUNT_LINES is not -1, count up the number of lines. If it exceeds the maximum number of lines minus 2, show a message and wait for input of return key. "minus 2" is to reserve space for the message printed by this internal pager. * stage2/cmdline.c (enter_cmdline): If USE_PAGER is true, set COUNT_LINES to zero, before running a command, and reset COUNT_LINES to -1 after that. * stage2/shared.h (max_lines) [!STAGE1_5]: Declared. (count_lines) [!STAGE1_5]: Likewise. (use_pager) [!STAGE1_5]: Likewise.
This commit is contained in:
1 parent
9f4689e21d
commit
b0c95fd0d4
6 files changed
+134
-15
No files matched your search
+32
-1
@@ -1,7 +1,7 @@
|
||||
/* char_io.c - basic console input and output */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,6 +30,9 @@
|
||||
|
||||
#ifndef STAGE1_5
|
||||
int auto_fill = 1;
|
||||
int max_lines = 24;
|
||||
int count_lines = -1;
|
||||
int use_pager = 1;
|
||||
#endif
|
||||
|
||||
void
|
||||
@@ -1123,6 +1126,34 @@ grub_putchar (int c)
|
||||
|
||||
col++;
|
||||
}
|
||||
else if (c == '\n')
|
||||
{
|
||||
/* Internal `more'-like feature. */
|
||||
if (count_lines != -1)
|
||||
{
|
||||
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\n[Hit return to continue]");
|
||||
do
|
||||
{
|
||||
tmp = ASCII_CHAR (getkey ());
|
||||
}
|
||||
while (tmp != '\n' && tmp != '\r');
|
||||
grub_printf ("\n\n");
|
||||
|
||||
/* Restart to count lines. */
|
||||
count_lines = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (terminal & TERMINAL_CONSOLE)
|
||||
console_putchar (c);
|
||||
|
||||
Reference in new issue
Block a user