From: Rasputin Date: 2003-12-18T06:40:39+09:00 Subject: Re: paging (was Newbie questions) Dave Thomas 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 that 'for' list gets much, it'll soon be easier to just write your own terminal handler :) But it sounds like every *NIX has its own custom variable/binary. My 2 euro is just choose an environment variable (I think PAGER is traditional) and use it. Platform specific installers can set it if need be. If its not set print a warning to set it maybe? -- Rasputin :: Jack of All Trades - Master of Nuns