From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Roland Jesse <jesse@prinz-atm.CS.Uni-Magdeburg.De>,
zsh-users@math.gatech.edu
Subject: Re: clear terminal after display of less, <, and apropos
Date: Thu, 15 Oct 1998 11:09:35 -0700 [thread overview]
Message-ID: <981015110935.ZM24779@candle.brasslantern.com> (raw)
In-Reply-To: <9810151322.AA14146@ezdzit.zko.dec.com>
On Oct 15, 9:22am, Paul Lew wrote:
} Subject: Re: clear terminal after display of less, <, and apropos
}
} function notite {
} TERMCAP=$(printenv TERMCAP | sed 's/:ti=[^:]*//; s/:te=[^:]*//;')
} }
Unfortunately, that doesn't work for programs that use the terminfo
database. For example, on my RedHat Linux 4.2 system, changing TERMCAP
affects "less" but does not affect "vim". The only way to be sure of
getting the effect is to change either the terminal type or both the
termcap and terminfo definitions for it.
However -- and to keep this discussion relevant to zsh-users -- I just
remembered a little zsh script called "fixinfo" that I wrote long ago
to clean up a braindamaged terminfo database. I had to tweak it a bit
because, contrary to the documentation, my "captoinfo" program ignores
$TERMCAP and always process the entire /etc/termcap file, unles you
give it an explicit file name. With the above function and the one
below:
notite ; fixinfo ${TERM}-notite
should deal with everything.
I wrote this before zsh had getopts, so there's other modernizing that
could be done.
#! /usr/local/bin/zsh -f
function fixinfo() {
# Temporarily fix up a bad terminfo database
# This is designed to make a terminfo entry match the termcap entry,
# or to add a missing terminfo entry by compiling the termcap entry.
# It requires "tic" and "captoinfo" e.g. from the ncurses package.
#
# If the termcap entry is correct but terminfo is wrong or missing:
# fixinfo
# If the /etc/termcap entry is wrong but $TERMCAP is correct, use:
# fixinfo newtermname
# where "newtermname" is a name that doesn't appear in /etc/termcap, so
# ill-behaved programs can't accidentally get the old description.
#
# This is intended to be an autoloaded function. If you can't autoload
# it, or want to use it from some shell other than zsh (still requires
# that zsh be installed) then use:
# eval `fixinfo`
# or:
# eval `fixinfo newtermname`
#
# Add the -f option to forcibly replace descriptions previously written
# by this program.
[[ -n "${TERMCAP:-}" ]] || { echo TERMCAP not set 1>&2; return 1 }
local force=false newterm=$TERM
while (($# > 0))
do
case $1 in
-f) force=true;;
*-help)
echo "Usage: fixinfo [newname [newname ...]]" 2>&1
return 0
;;
*)
if [[ ! -f "$TERMCAP" ]]
then
TERMCAP=$(echo "$TERMCAP" | sed -e 's/\\$//' -e "s/^/$1|/")
newterm="$1"
fi
;;
esac
shift
done
TERMINFO=${TERMINFO:-/tmp/tinfo-$EUID}
[[ -d $TERMINFO ]] || mkdir -p $TERMINFO || return 1
[[ -w $TERMINFO ]] || return 1
export TERMCAP TERMINFO
if [[ -f $TERMINFO/$newterm[1]/$newterm ]]
then
export TERM="$newterm"
$force || return 0
fi
if [[ -f "$TERMCAP" ]]
then tic =(captoinfo)
else tic =(captoinfo =(<<<"$TERMCAP")) # Requires 3.0.something for <<<
fi
export TERM="$newterm"
[[ -t 1 ]] || echo export TERM=\""$newterm"\"\; export TERMCAP=\""$TERMCAP"\"
return 0
}
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
next prev parent reply other threads:[~1998-10-15 18:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-14 21:33 Roland Jesse
1998-10-15 1:25 ` Bart Schaefer
1998-10-15 2:22 ` Geoff Wing
1998-10-15 9:11 ` Mircea Damian
1998-10-15 13:22 ` Paul Lew
1998-10-15 14:46 ` Zoltan Hidvegi
1998-10-15 18:09 ` Bart Schaefer [this message]
1998-10-15 19:29 ` Bart Schaefer
1998-12-15 2:08 ` problem with prompt Brian Harvell
1998-12-15 3:50 ` Bart Schaefer
1998-10-15 14:58 ` clear terminal after display of less, <, and apropos Greg Badros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=981015110935.ZM24779@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=jesse@prinz-atm.CS.Uni-Magdeburg.De \
--cc=zsh-users@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).