[sac-dev] [patch] Use a pager to show the help files

Kuang He icrazy at gmail.com
Tue Sep 16 00:42:38 PDT 2008


Dear Brian,

Thanks for the tip.

How often do systems that run SAC come without ``more''? I guess it is
rare. In this case, we can maybe use something like this

AC_CHECK_PROGS(SAC_PAGER, [$PAGER less more cat])

in configure.in, and determine which pager to use at runtime in this way:

if environment variable $PAGER is defined and is not empty
     use that (user's preference has more priority)
else
     use PAGER specified by configure script

In the worst scenario users will end up using ``cat'', which means no
paging at all -- this should hardly happen. In this case, users could
still use something like Shift + PageUp/PageDn to scroll back and
forth. The good thing about this approach is that we don't have to
maintain the original pager code any more. What do you think?

One the other hand, for users who install SAC from binary
distributions, how do we decide which pager to use if they don't have
their environment variable $PAGER set? I don't want them end up using
``cat'' or the original pager code, since many of them may already
have ``less'' or ``more'' installed. Maybe after this feature is
merged into the code, we can highly recommend them to set $PAGER in
the manual?


Best regards,

-- 
Kuang He
Department of Physics
University of Connecticut
Storrs, CT 06269-3046

Tel: +1.860.486.4919
Web: http://www.phys.uconn.edu/~he/

On Sun, Sep 14, 2008 at 1:00 PM, Brian Savage <savage at uri.edu> wrote:
> Kuang He,
>
>
> ANSI C it is. Unless someone else has any objections.
>
> To add in a check for "less" and or "more" see:
> Autoconf: Generic Program Checks
> http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_chapter/autoconf_5.html#SEC41
> Either one of these should work. You can give a list of programs to check
> for in the order you would like
> Macro: AC_CHECK_PROGS (variable, progs-to-check-for, [value-if-not-found],
> [path])
> Macro: AC_PATH_PROGS (variable, progs-to-check-for, [value-if-not-found],
> [path])
> This should go into the configure.in file, then the bootstrap needs to be
> re-run.
>
> Isolating the original pager code inside src/sac/wrhelp.c is probably the
> best place for it.


More information about the sac-dev mailing list