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

Brian Savage savage at uri.edu
Tue Sep 16 09:13:53 PDT 2008


Kuang He

Looks like less is available on Linux and OSX (the GNU version)
I cannot find a version of less on Solaris, but Solaris does have the  
more command.
I would propose doing a check like

AC_CHECK_PROGS(SAC_PAGER, [ less more ])
It would be nice to remove this code as the capability exists  
elsewhere outside of SAC.
There is similar code in src/dfm/xlh.c to do paging for the listhdr  
command, but it is
coupled to the output of the command.  Same for the news command.  
Would you suggest
that we change the way these commands operate as well ?  This could  
be done with a
pipe to the pager.  It might be more trouble than it is worth.  This  
also modifies the current behavior of SAC.

I still think having a fallback to the original SAC paging code is  
the safest thing to do.

Cheers
Brian

On Sep 16, 2008, at  3:42 AM , Kuang He wrote:

> 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.
> _______________________________________________
> sac-dev mailing list
> sac-dev at iris.washington.edu
> http://www.iris.washington.edu/mailman/listinfo/sac-dev
>



More information about the sac-dev mailing list