[GRASS5] PAGER changed to GRASS_PAGER

Hello all

I have changed references to PAGER to GRASS_PAGER as per discussions on
this list a while ago. Also, PAGER should now be recognized by GRASS
programs if it is defined before starting grass (so man inside the grass
shell should still behave properly). Please let me know of any
difficulties.

--
Sincerely,

Jazzman (a.k.a. Justin Hickey) e-mail: jhickey@hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand

People who think they know everything are very irritating to those
of us who do. ---Anonymous

Jazz and Trek Rule!!!

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Justin Hickey wrote:

I have changed references to PAGER to GRASS_PAGER as per discussions on
this list a while ago. Also, PAGER should now be recognized by GRASS
programs if it is defined before starting grass (so man inside the grass
shell should still behave properly). Please let me know of any
difficulties.

Should G_list_element (src/libes/gis/list.c) be changed? Currently it
has:

    if (isatty(1))
    {
  more = G_popen ("more","w");
  if (!more) more = stdout;
    }
    else
  more = stdout;

I would have just gone ahead and changed it, but then I thought that
there might be a specific reason why $PAGER wasn't being used here.

--
Glynn Clements <glynn.clements@virgin.net>

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Justin Hickey wrote:

I have changed references to PAGER to GRASS_PAGER as per discussions on
this list a while ago. Also, PAGER should now be recognized by GRASS
programs if it is defined before starting grass (so man inside the grass
shell should still behave properly). Please let me know of any
difficulties.

It appears that many files have hardcoded references to "more":

/usr/src/grass/src/general/g.setproj/get_stp.c:170: sprintf(buff, "more %s", Tmp_file1);
/usr/src/grass/src/general/g.setproj/get_stp.c:282: sprintf(buff, "more %s", Tmp_file1);
/usr/src/grass/src/libes/gis/get_datum_name.c:55: sprintf(buff,"more %s",Tmp_file);
/usr/src/grass/src/libes/gis/get_ell_name.c:36: sprintf(buff,"more %s",Tmp_file);
/usr/src/grass/src/libes/gis/get_projname.c:51: sprintf(buff,"more %s",Tmp_file);
/usr/src/grass/src/libes/gis/gishelp.c:33: sprintf(buffer, "more %s", file) ;
/usr/src/grass/src/libes/gis/list.c:67: more = G_popen ("more","w");
/usr/src/grass/src/libes/gis/TESTS/try13.c:19: more = popen ("more","w");
/usr/src/grass/src/misc/m.proj/get_stp.c:160: sprintf(buff, "more %s", Tmp_file1);
/usr/src/grass/src/misc/m.proj/get_stp.c:262: sprintf(buff, "more %s", Tmp_file1);
/usr/src/grass/src/raster/r.coin/cmd/inter.c:70: sprintf(command,"more -d %s",dumpname);
/usr/src/grass/src/raster/r.combine/cmd/get_cats.c:53: sprintf (command, "more %s", tempfile);
/usr/src/grass/src/raster/r.report/inter/run_report.c:84: build_command(command,full,0,"|","more",nv, as_int, cat_ranges, nsteps, fp);
/usr/src/grass/src/raster/r.support/inter/check_un.c:43: sprintf (command, "more %s", tempfile);
/usr/src/grass/src/raster/r.weight/inter/list_anal.c:91: sprintf (command, "%s %s", print?"lpr":"more",tempfile);
/usr/src/grass/src/raster/r.weight/inter/list_cats.c:54: sprintf (command, "more -d %s", tempfile);
/usr/src/grass/src.contrib/SCS/vector/v.report/inter/run_report.c:40: sprintf(name,"more %s",temp_file);

I would suspect that most of the actual programs can be changed,
although more consideration needs to be given to library functions. It
seems conceivable that spawning "less" in the wrong place (e.g. from
within an interactive program) might cause problems.

--
Glynn Clements <glynn.clements@virgin.net>

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Hi Glynn

Glynn Clements wrote:

I would suspect that most of the actual programs can be changed,
although more consideration needs to be given to library functions.
It seems conceivable that spawning "less" in the wrong place (e.g.
from within an interactive program) might cause problems.

Hmmm. Then we probably should list this as a TODO item and leave
changing "more" to "GRASS_PAGER" until after 5.0. Markus, any comments?

--
Sincerely,

Jazzman (a.k.a. Justin Hickey) e-mail: jhickey@hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand

People who think they know everything are very irritating to those
of us who do. ---Anonymous

Jazz and Trek Rule!!!

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

On Tue, May 01, 2001 at 02:16:07PM +0700, Justin Hickey wrote:

Hi Glynn

Glynn Clements wrote:
> I would suspect that most of the actual programs can be changed,
> although more consideration needs to be given to library functions.
> It seems conceivable that spawning "less" in the wrong place (e.g.
> from within an interactive program) might cause problems.

Hmmm. Then we probably should list this as a TODO item and leave
changing "more" to "GRASS_PAGER" until after 5.0. Markus, any comments?

Of course we should experiment too much now... However, I dislike the
"less" behaviour in i.group and others, if you "list" the existing
groups. reason: "less" doesn't exit immediately but waits for the user
pressing "q" to quit. That's very inconvenient. If I switch to "more",
the available groups are listed and "more" is left.

Markus

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Markus Neteler wrote:

> > I would suspect that most of the actual programs can be changed,
> > although more consideration needs to be given to library functions.
> > It seems conceivable that spawning "less" in the wrong place (e.g.
> > from within an interactive program) might cause problems.
>
> Hmmm. Then we probably should list this as a TODO item and leave
> changing "more" to "GRASS_PAGER" until after 5.0. Markus, any comments?

Of course we should experiment too much now... However, I dislike the
"less" behaviour in i.group and others, if you "list" the existing
groups. reason: "less" doesn't exit immediately but waits for the user
pressing "q" to quit. That's very inconvenient. If I switch to "more",
the available groups are listed and "more" is left.

Does setting GRASS_PAGER to "less -F" help? From the less manpage:

       -F or --quit-if-one-screen
              Causes less to automatically exit if the entire
              file can be displayed on the first screen.

Or does this screw other cases?

In any case, I wasn't suggesting hard-coding "more" in cases where
"less" was "not ideal". I was more concerned about the possibility of
it trashing terminal settings. I don't see this as an issue within
individual programs; If it occurs, the program can be modified to
reset the terminal to the desired state afterwards.

I was more concerned about ensuring that library functions don't have
undesirable side effects.

--
Glynn Clements <glynn.clements@virgin.net>

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

On Sat, May 05, 2001 at 12:34:49AM +0100, Glynn Clements wrote:

Markus Neteler wrote:

> > > I would suspect that most of the actual programs can be changed,
> > > although more consideration needs to be given to library functions.
> > > It seems conceivable that spawning "less" in the wrong place (e.g.
> > > from within an interactive program) might cause problems.
> >
> > Hmmm. Then we probably should list this as a TODO item and leave
> > changing "more" to "GRASS_PAGER" until after 5.0. Markus, any comments?
>
> Of course we should experiment too much now... However, I dislike the
> "less" behaviour in i.group and others, if you "list" the existing
> groups. reason: "less" doesn't exit immediately but waits for the user
> pressing "q" to quit. That's very inconvenient. If I switch to "more",
> the available groups are listed and "more" is left.

Does setting GRASS_PAGER to "less -F" help? From the less manpage:

       -F or --quit-if-one-screen
              Causes less to automatically exit if the entire
              file can be displayed on the first screen.

Or does this screw other cases?

Glynn,

no, this doesn't work:

if you run "i.group" and enter "list" into the first screen, you
would get:

hit RETURN to continue -->

instead of (using "more"):

Available groups
---------------------------------
no group files available
---------------------------------
hit RETURN to continue -->

The less -F erases the screen when quiting while more keeps it.

In any case, I wasn't suggesting hard-coding "more" in cases where
"less" was "not ideal". I was more concerned about the possibility of
it trashing terminal settings. I don't see this as an issue within
individual programs; If it occurs, the program can be modified to
reset the terminal to the desired state afterwards.

I was more concerned about ensuring that library functions don't have
undesirable side effects.

Yes, agreed. Thanks for the other fixes. This problem seems not to be
trivial...

Markus

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Markus Neteler wrote:

> > Of course we should experiment too much now... However, I dislike the
> > "less" behaviour in i.group and others, if you "list" the existing
> > groups. reason: "less" doesn't exit immediately but waits for the user
> > pressing "q" to quit. That's very inconvenient. If I switch to "more",
> > the available groups are listed and "more" is left.
>
> Does setting GRASS_PAGER to "less -F" help? From the less manpage:
>
> -F or --quit-if-one-screen
> Causes less to automatically exit if the entire
> file can be displayed on the first screen.
>
> Or does this screw other cases?

Glynn,

no, this doesn't work:

if you run "i.group" and enter "list" into the first screen, you
would get:

hit RETURN to continue -->

instead of (using "more"):

Available groups
---------------------------------
no group files available
---------------------------------
hit RETURN to continue -->

The less -F erases the screen when quiting while more keeps it.

Hmm; that seems to make "less -F" pretty useless.

In which case, there are two choices; either:

a) users who set GRASS_PAGER to "less" accept its behaviour "for
better or for worse", or

b) we "split" GRASS_PAGER into e.g. GRASS_SHORT_PAGER and
GRASS_LONG_PAGER, and pick one or the other depending upon the likely
amount of output. The former would always default to "more" whilst the
latter would default to $PAGER.

Actually, we should have another one to determine the pager used by
the library functions (with a note that pointing it at a curses
program "voids your warranty"). That way, those of us with terminal
emulators which *do* have scrollback buffers can use "/bin/cat" there
as well.

--
Glynn Clements <glynn.clements@virgin.net>

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'