Newbie questions

Well, that’s only set on some portion of Linux boxes. As you mentioned
earlier, there isn’t really a standard, unless it could be said that the
standard is to use ‘more’ (which is what nearly all commercial Unices do).
Linux is nice here in that it’s doing things that are better, but it
should definitely be understood that these things won’t work on non-linux
boxes (and won’t actually work on all linux machines).

Luke

···

On Thu, 18 Dec 2003, Derek Lewis wrote:

Looks good, but you might want to throw “/usr/bin/pager” after the ENV.


“Love is a snowmobile racing across the tundra and then suddenly it
flips over, pinning you underneath. At night, the ice weasels come.”
–Matt Groening

— Dave Thomas dave@pragprog.com wrote: >

···

On Dec 17, 2003, at 13:50, Derek Lewis wrote:

Looks good, but you might want to throw “/usr/bin/pager” after the
ENV.

Is that a distinct program, or just an alias for ‘less’? If it’s
separate, I’ll add it.

I’m also trying to avoid absolute paths: I want it to work on Windows
too…

It is a symbolic link in Debian to Debian’s alternatives (man
update-alternatives).

I would add it only if /etc/debian_version exists.

– Thomas Adam

=====
“The Linux Weekend Mechanic” – http://linuxgazette.net
“TAG Editor” – http://linuxgazette.net

“ We’ll just save up your sins, Thomas and punish you for all of them at
once when you get better. The experience will probably kill you. :)”

– Benjamin A. Okopnik (Linux Gazette Contributing Editor)


BT Yahoo! Broadband - Save £80 when you order online today. Hurry! Offer ends 21st December 2003. The way the internet was meant to be. http://uk.rd.yahoo.com/evt=21064/*http://btyahoo.yahoo.co.uk

Looks good, but you might want to throw “/usr/bin/pager” after the ENV.

Is that a distinct program, or just an alias for ‘less’? If it’s
separate, I’ll add it.

That depends on the system configuration. It’s usually a symlink to
‘less’ or ‘more’, depending on configuration. The thing is, it may be
pointing to something the user specificly prefers for some reason, so we
should probably be checking it.

I’m also trying to avoid absolute paths: I want it to work on Windows
too…

Hmm… I’d kind of forgotten about that. But… trying to
run “/usr/bin/pager” would just behave the same as it would on Unix if
that file didn’t exist, wouldn’t it? Which would be (I think) the
behavior we would want, so it just goes on to try the next pager program.

Hmm… I’m looking at perldoc, and it looks like there’s some hefty OS
checking going on in their pager selection.

(my $pager = <<‘/…/’) =~ s/\s*\z//;
/usr/bin/sensible-pager
/…/
my @pagers = ();
push @pagers, $pager if -x $pager;

if ($Is_MSWin32) {
push @pagers, qw( more< less notepad );
unshift @pagers, $ENV{PAGER} if $ENV{PAGER};
for (@found) { s,/,\,g }
}
elsif ($Is_VMS) {
push @pagers, qw( most more less type/page );
}
elsif ($Is_Dos) {
push @pagers, qw( less.exe more.com< );
unshift @pagers, $ENV{PAGER} if $ENV{PAGER};
}
else {
if ($^O eq ‘os2’) {
unshift @pagers, ‘less’, ‘cmd /c more <’;
}
push @pagers, qw( more less pg view cat );
unshift @pagers, $ENV{PAGER} if $ENV{PAGER};
}
unshift @pagers, $ENV{PERLDOC_PAGER} if $ENV{PERLDOC_PAGER};

lewisd@derlewi:~$ cat /usr/bin/sensible-pager
#!/bin/bash
shopt -s execfail
exec ${PAGER:-pager} “$@”
exec more “$@”
echo “Couldn’t find a pager!” 1>&2
echo “Set the $PAGER environment variable to your desired pager.” 1>&2
exit 1
lewisd@derlewi:~$

I don’t know any perl, so I can’t really comment too much on how all that
works, other than that it’s using a different pager list for different
OS’s.

Can/should we do something similar?
(Maybe “can” is a moot question, seeing as ruby seems to be able to do
anything I’ve asked it to, short of dishes or laundry :wink:

Derek Lewis

···

On Thu, 18 Dec 2003, Dave Thomas wrote:

On Dec 17, 2003, at 13:50, Derek Lewis wrote:

===================================================================
Java Web-Application Developer

  Email    : email@lewisd.com
  Cellular : 604.312.2846
  Website  : http://www.lewisd.com

“If you’ve got a 5000-line JSP page that has “all in one” support
for three input forms and four follow-up screens, all controlled
by “if” statements in scriptlets, well … please don’t show it
to me :-). Its almost dinner time, and I don’t want to lose my
appetite :-).”
- Craig R. McClanahan

What’s important to me (and maybe I’m way off target here :slight_smile: is not that
it works everywhere, but that it works where it can, and doesn’t break
anything elsewhere.

ie. If it can find /usr/bin/pager, great, because that’s probably what
the user expects. If it can’t find it, then just carry on trying to find
something else.

Derek Lewis

···

On Thu, 18 Dec 2003, Luke A. Kanies wrote:

On Thu, 18 Dec 2003, Derek Lewis wrote:

Looks good, but you might want to throw “/usr/bin/pager” after the ENV.

Well, that’s only set on some portion of Linux boxes. As you mentioned
earlier, there isn’t really a standard, unless it could be said that the
standard is to use ‘more’ (which is what nearly all commercial Unices do).
Linux is nice here in that it’s doing things that are better, but it
should definitely be understood that these things won’t work on non-linux
boxes (and won’t actually work on all linux machines).

===================================================================
Java Web-Application Developer

  Email    : email@lewisd.com
  Cellular : 604.312.2846
  Website  : http://www.lewisd.com

“If you’ve got a 5000-line JSP page that has “all in one” support
for three input forms and four follow-up screens, all controlled
by “if” statements in scriptlets, well … please don’t show it
to me :-). Its almost dinner time, and I don’t want to lose my
appetite :-).”
- Craig R. McClanahan