Skip to contentSkip to conversation

Pager does work from a menu?

DISCUSSION adrian15 2 participants 4 messages Jun 12, 2007 – Jun 13, 2007

lore
Share & tools
lore

adrian15

author
#0 lore raw

This code from: normal/command.c

  /* Enable the pager if the environment pager is set to 1.  */
  if (interactive)
    pager = grub_env_get ("pager");
  else
    pager = 0;
  if (pager && (! grub_strcmp (pager, "1")))
    grub_set_more (1);

Can anyone confirm my suspictions that even the pager variable set to 1 there is NO stop on the screen when running a grub option that has the cat command inside it with a big file?

I am suspecting because in grub legacy there was the same stupid behaviour which I fixed of course.

I also do not like the way that pager is run. I mean, putting a getkey inside the

void
grub_putcode (grub_uint32_t code)

function from: kern/term.c

it seems to me a bit childish although I do not know so far a better solution.

adrian15

#1 lore raw
Quoted 10 lines · On Tue, Jun 12, 2007 at 01:57:42PM +0200, adrian15 wrote:

This code from: normal/command.c

  /* Enable the pager if the environment pager is set to 1.  */
  if (interactive)
    pager = grub_env_get ("pager");
  else
    pager = 0;
  if (pager && (! grub_strcmp (pager, "1")))
    grub_set_more (1);
Quoted 3 lines

Can anyone confirm my suspictions that even the pager variable set to 1 there is NO stop on the screen when running a grub option that has the cat command inside it with a big file?

Can you ellaborate? From the code you pasted, I just see that when "interactive" is set to 0, this has the same effect as pager being set to the "0" string.

(btw, this pager = 0 assignment looks a bit confusing; I changed it to NULL altogether with the other two I spotted earlier)

Quoted 6 lines

I am suspecting because in grub legacy there was the same stupid behaviour which I fixed of course.

I also do not like the way that pager is run. I mean, putting a getkey inside the

Quoted 7 lines

void
grub_putcode (grub_uint32_t code)

function from: kern/term.c

it seems to me a bit childish although I do not know so far a better solution.

Please try to tear down that language! "stupid" and "childish" are in general not very appropiate words for a development list.

I suppose you're referring to:

          grub_printf ("--MORE--");
          grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);

          key = grub_getkey ();

What do you find wrong in this code? AFAICS, the message is printed and then we use grub_getkey to block untill a key is pressed. Sounds like normal pager-ish behaviour to me..

Signature · 4 lines
Robert Millan

My spam trap is [email protected].  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.
author
#2 lore raw
Quoted 11 lines · Robert Millan
Quoted 10 lines · On Tue, Jun 12, 2007 at 01:57:42PM +0200, adrian15 wrote:

This code from: normal/command.c

  /* Enable the pager if the environment pager is set to 1.  */
  if (interactive)
    pager = grub_env_get ("pager");
  else
    pager = 0;
  if (pager && (! grub_strcmp (pager, "1")))
    grub_set_more (1);
Quoted 7 lines
Quoted 3 lines

Can anyone confirm my suspictions that even the pager variable set to 1 there is NO stop on the screen when running a grub option that has the cat command inside it with a big file?

Can you ellaborate? From the code you pasted, I just see that when "interactive" is set to 0, this has the same effect as pager being set to the "0" string.

That's what I mean. I think that interactive for grub2 means being in the grub2 shell (not in a menu). If you are in a menu (non interactive) then there is no stop between pages.

But you know I am a bit lazy. I should at last try to do a grub.cfg and test it on my test floppy and see if I am right or not.

Quoted 9 lines
Quoted 9 lines

I am suspecting because in grub legacy there was the same stupid behaviour which I fixed of course.

I also do not like the way that pager is run. I mean, putting a getkey inside the

void
grub_putcode (grub_uint32_t code)

Quoted 7 lines
Quoted 4 lines

function from: kern/term.c

it seems to me a bit childish although I do not know so far a better solution.

Please try to tear down that language! "stupid" and "childish" are in general not very appropiate words for a development list.

Written down. Sorry, I'll try to use more formal synonims next time.

Quoted 11 lines

I suppose you're referring to:

          grub_printf ("--MORE--");
          grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);

          key = grub_getkey ();

What do you find wrong in this code? AFAICS, the message is printed and then we use grub_getkey to block untill a key is pressed. Sounds like normal pager-ish behaviour to me..

The code is ok. What I do not find ok is that the screen pause happens in a function which works it is to put a character on the screen. I do not quite understand why a function that only has to print a character on the screen has also to deal with the screen by screen stop problem.

In my opinion this screen by screen stop problem should be solved in another part of the source code but so far I do not know where.

adrian15

#3 lore raw
Quoted 8 lines · On Tue, Jun 12, 2007 at 04:16:59PM +0200, adrian15 wrote:
Quoted 4 lines

Can you ellaborate? From the code you pasted, I just see that when "interactive" is set to 0, this has the same effect as pager being set to the "0" string.

That's what I mean. I think that interactive for grub2 means being in the grub2 shell (not in a menu). If you are in a menu (non interactive) then there is no stop between pages.

Ah, yes. Sounds like it. Not sure if there was a reason for this, maybe the ChangeLog shows something?

Quoted 2 lines

But you know I am a bit lazy. I should at last try to do a grub.cfg and test it on my test floppy and see if I am right or not.

Btw, do you know grub-emu? It can probably help you with testing (rather than grabbing to a floppy and reboot).

Ah, and there's also qemu (building a floppy image should be much easier now, with grub-mkrescue).

Quoted 11 lines
Quoted 10 lines
         grub_printf ("--MORE--");
         grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);

         key = grub_getkey ();

What do you find wrong in this code? AFAICS, the message is printed and then
we use grub_getkey to block untill a key is pressed. Sounds like normal pager-ish behaviour to me..

Quoted 8 lines

The code is ok. What I do not find ok is that the screen pause happens in a function which works it is to put a character on the screen. I do not quite understand why a function that only has to print a character on the screen has also to deal with the screen by screen stop problem.

In my opinion this screen by screen stop problem should be solved in another part of the source code but so far I do not know where.

You can move the code that handles screen stops somewhere else, but it's still the code that prints something that has to trigger it, since screen stops happen precisely when '\n' is printed. What would basicaly change is that instead of getkey() you call something else (e.g. pause()).

You can also move it to a lower layer (grub_cur_term->putchar), but then you have to duplicate code (which is bad).

Signature · 4 lines
Robert Millan

My spam trap is [email protected].  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.