In article <F0A45523-30C9-11D8-BFF4-000A95676A62 / pragprog.com>,
Dave Thomas  <dave / pragprog.com> wrote:
>
>On Dec 17, 2003, at 13:25, Thomas Adam wrote:
>>
>>> Interesting.  So there's apparantly no consistant way of finding a 
>>> pager
>>> program.
>> It would be easy to do...
>> Test for either:
>>    $PAGER
>> and the like...
>> if they're defined use them, otherwise default to a generic one.
>
>Here's the code I'm using in 'ri'. Will it work across the systems that 
>folks use?
>
>     for pager in [ ENV['pager'], "less", "more <" ].compact.uniq
>       if system("#{pager} #{path}")
>         paged = true
>         break
>       end
>     end
>     if !paged
>       @options.use_stdout = true
>       puts File.read(path)
>     end

If you want to be like man etc. then you should use ENV['PAGER'], I
think.

Mike
-- 
mike / stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       | GPG PGP Key      1024D/059913DA 
mike / exegenix.com                  | Fingerprint      0570 71CD 6790 7C28 3D60
http://www.exegenix.com/           |                  75D2 9EC4 C1C0 0599 13DA