summaryrefslogtreecommitdiff
path: root/app/xterm/run-tic.sh
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2019-02-24 11:41:44 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2019-02-24 11:41:44 +0000
commit2e9e3612e8406c463a9d21adf22399dce17f3b1d (patch)
tree350d1dec346ec9abf0fa0b0f08ba71bb264f6597 /app/xterm/run-tic.sh
parent375ab130e495e7442b44a55ec317e190f335dabf (diff)
Update to xterm version 344. ok jsg@
Diffstat (limited to 'app/xterm/run-tic.sh')
-rw-r--r--app/xterm/run-tic.sh78
1 files changed, 69 insertions, 9 deletions
diff --git a/app/xterm/run-tic.sh b/app/xterm/run-tic.sh
index 1a224d52d..91de48caf 100644
--- a/app/xterm/run-tic.sh
+++ b/app/xterm/run-tic.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-# $XTermId: run-tic.sh,v 1.4 2007/06/17 15:30:03 tom Exp $
+# $XTermId: run-tic.sh,v 1.10 2019/01/14 23:43:02 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 2006,2007 by Thomas E. Dickey
+# Copyright 2006-2007,2019 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -36,23 +36,83 @@
# messages for the extensions which are otherwise ignored by other versions of
# tic.
-TMP=run-tic$$.log
+MYTEMP=`mktemp -d 2>/dev/null`
+if test -z "$MYTEMP"
+then
+ MYTEMP=${TMPDIR:-/tmp}/run-tic$$
+ mkdir $MYTEMP || failed "cannot mkdir $MYTEMP"
+fi
+trap "rm -rf $MYTEMP" EXIT INT QUIT HUP TERM
+
+STDERR=$MYTEMP/run-tic$$.log
VER=`tic -V 2>/dev/null`
OPT=
-case .$VER in
-.ncurses*)
+TIC_PROG=tic
+TPUT_PROG=tput
+INFOCMP_PROG=infocmp
+unset TERM
+unset TERMINFO_DIRS
+
+PASS1="$@"
+PASS2="$@"
+
+case "x$VER" in
+*ncurses*)
OPT="-x"
+ # Prefer ncurses 6.1 over 6.0 over any 5, if we can get it, to support
+ # large numbers (used in xterm-direct) and large entries (an issue with
+ # xterm-nrc).
+ case "$VER" in
+ *\ [789].*|*\ 6.[123456789].*)
+ ;;
+ *)
+ # On systems with only ncurses 5, check for development version
+ # of ncurses.
+ VER=`infocmp6 -V 2>/dev/null`
+ test -n "$VER" && INFOCMP_PROG=infocmp6
+ VER=`tic6 -V 2>/dev/null`
+ test -n "$VER" && TIC_PROG=tic6
+ ;;
+ esac
+ echo "** using tic from $VER"
+ # If this is 6.1.20180127 or later and using ABI 6, then it supports
+ # entries larger than 4096 bytes (up to 32768).
+ case "$VER" in
+ *\ [789].*|*\ 6.[123456789].*)
+ expect=" cols#100000,"
+ cat >$MYTEMP/fake.ti <<EOF
+fake|test 32-bit numbers,
+$expect
+EOF
+ TERMINFO=$MYTEMP $TIC_PROG $OPT $MYTEMP/fake.ti 2>/dev/null
+ check=`TERMINFO=$MYTEMP TERM=fake $INFOCMP_PROG -1 fake 2>/dev/null |grep "$expect"`
+ test "x$check" = "x$expect" || BIG=no
+ ;;
+ *)
+ BIG=no
+ ;;
+ esac
+ if test "$BIG" = no
+ then
+ # Trim out the SGR 1006 feature, to keep "xterm-nrc" smaller
+ # than 4096 bytes.
+ echo "...this version does not support large terminal descriptions"
+ PASS2=$MYTEMP/input
+ sed -e 's/use=xterm+sm+1006,//' -e '/^[ ][ ]*$/d' "$PASS1" >$PASS2
+ set $PASS2
+ fi
;;
esac
-echo "** tic $OPT" "$@"
-tic $OPT "$@" 2>$TMP
+echo "** $TIC_PROG $OPT" "$PASS1"
+$TIC_PROG $OPT "$PASS2" 2>$STDERR
RET=$?
-fgrep -v 'Unknown Capability' $TMP | \
+sed -e "s%$PASS2%$PASS1%" $STDERR | \
+fgrep -v 'Unknown Capability' | \
fgrep -v 'Capability is not recognized:' | \
fgrep -v 'tic: Warning near line ' >&2
-rm -f $TMP
+rm -f $STDERR
exit $RET