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

Kuang He icrazy at gmail.com
Tue Sep 16 19:52:31 PDT 2008


On Tue, Sep 16, 2008 at 5:22 PM, Kuang He <icrazy at gmail.com> wrote:
> To solve this problem, I propose that we check for pager programs at
> runtime, following the practice of ``man''. So when SAC starts, it'll
> run through this decision process:
>
> if the environment variable $PAGER is set to a non-empty value {
>    use it
> } else {
>   SAC will look for executable files at these locations one by one
>        /usr/bin/less
>        /bin/less
>        /usr/bin/more
>        /bin/more
>        and will use the first one available.
>   If none of the above pages are available, SAC will fall back to its
> original paging code.
> }

I've implemented the above algorithm, and the patch (against v101.2)
is attached.

If you have applied the previous patch included in:
http://www.iris.washington.edu/pipermail/sac-dev/2008-September/000100.html

You need to reverse that patch first using ``patch -R'', before
applying this patch.

In this patch:

- The original paging code has been isolated to internal_pager(), in
file src/ucf/wrhelp.c

- SAC will try to determine which pager to use and whether to use the
internal pager or not during the initialization stage

- When the user has a broken setting of $PAGER, the error message is clearer:

$ export PAGER=xxxx
$ sac
SAC> h
sh: xxxx: not found
Error loading pager xxxx!

- A global variable pager has been defined in src/top/initsac.c, and I
don't know whether there is a better place for that.


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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pager-help-file2.diff
Type: application/octet-stream
Size: 7192 bytes
Desc: not available
URL: <http://www.iris.washington.edu/pipermail/sac-dev/attachments/20080916/7b57a3c9/attachment.obj>


More information about the sac-dev mailing list