[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
proposition for more
From: |
Jani Averbach |
Subject: |
proposition for more |
Date: |
Mon, 11 Feb 2002 02:47:00 +0200 (EET) |
Hi!
I have made a little modification to grub, so that it's cat has some of
more's capabilities
(space = next screen, return = next line, esc = ending, line wrapping).
What do you think, does grub need more? =)
And if it does, cat with more or cat and more?
Q1: How should I print to place (x,y) = (80,y) in the screen?
grub_putchar() seems make shift when place 80 has been reached.
Q2: There is no predefined max size for terminal, is there?
Here is the story so far:
(builtins.c: 402)
#define JAA_TERM_X_SIZE 80
#define JAA_TERM_Y_SIZE 25
/* cat */
static int
cat_func (char *arg, int flags)
{
char c;
int key;
int lines = 0;
int linechars = 0;
if (! grub_open (arg))
return 1;
while (grub_read (&c, 1)){
if ('\n' == c){
linechars = 0;
++lines;
}
if (linechars > JAA_TERM_X_SIZE-1){
grub_putchar ('\n');
++lines;
linechars = 0;
}
else
++linechars;
if (lines > JAA_TERM_Y_SIZE-1){
key = getkey();
/* If ESC is returned, then abort this entry. */
if (ASCII_CHAR (key) == 27)
break;
/* if ENTER is returned, then scroll down by one */
else if(ASCII_CHAR (key) == 10 || ASCII_CHAR(key) == 13)
--lines;
else
lines = 0;
}
grub_putchar (c);
}
grub_close ();
return 0;
}
#undef JAA_TERM_X_SIZE 80
#undef JAA_TERM_Y_SIZE 25
BR, Jani
--
Jani Averbach
- proposition for more,
Jani Averbach <=