Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!pdn!tscs!tct!chip From: chip@tct.com (Chip Salzenberg) Newsgroups: comp.unix.sysv386 Subject: Re: Less misbehaves when used for "man" pager... Message-ID: <2819D925.241D@tct.com> Date: 27 Apr 91 20:03:49 GMT References: <30370@cs.yale.edu> Organization: Teltronics/TCT, Sarasota, FL Lines: 59 As has already been described by other posters, the SCO "man" command clobbers the TERM environment variable when running the pager of choice. I fixed it locally by (1) creating /u/local/bin/man which is in the search path first, which sets the environment variable REALTERM to the value of TERM before running /usr/bin/man, (2) in /etc/default/man setting PAGER=/usr/man/bin/less-term, and (3) in the less-term script, setting TERM from REALTERM. As a bonus, if REALTERM is not set, it checks the terminal type in /etc/ttytype. Here is the less-term script. Shar and enjoy. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'less-term' <<'END_OF_FILE' X: less-term X# "man" pager to get around the nroff TERM=lp hack. X# Also snarf up all input before displaying, X# to avoid partially-formatted man pages. X Xcase "$REALTERM" in X"") X tty=`tty 0<&2 | sed 's#/dev/##'` || exit 1 X term=`awk '$2 == "'"$tty"'" { print $1; exit }' /etc/ttytype` || exit 1 X TERM=$term ; export TERM X ;; X*) X TERM="$REALTERM" ; export TERM X ;; Xesac X XT=/tmp/man.$$ Xtrap 'rm -f $T' 0 Xtrap 'exit 1' 1 2 3 13 15 X Xcat >$T X/u/local/bin/less -e $T END_OF_FILE if test 459 -ne `wc -c <'less-term'`; then echo shar: \"'less-term'\" unpacked with wrong size! fi chmod +x 'less-term' # end of 'less-term' fi echo shar: End of shell archive. exit 0