diff options
Diffstat (limited to 'nx-X11/programs/xterm/vttests')
-rw-r--r-- | nx-X11/programs/xterm/vttests/16colors.sh | 90 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/256colors.pl | 12 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/256colors2.pl | 63 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/88colors.pl | 13 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/88colors2.pl | 66 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/8colors.sh | 78 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/acolors.sh | 64 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/doublechars.sh | 87 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/dynamic.sh | 60 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/fonts.sh | 59 | ||||
-rwxr-xr-x | nx-X11/programs/xterm/vttests/resize.pl | 100 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/resize.sh | 82 | ||||
-rwxr-xr-x | nx-X11/programs/xterm/vttests/tcapquery.pl | 162 | ||||
-rw-r--r-- | nx-X11/programs/xterm/vttests/title.sh | 55 |
14 files changed, 991 insertions, 0 deletions
diff --git a/nx-X11/programs/xterm/vttests/16colors.sh b/nx-X11/programs/xterm/vttests/16colors.sh new file mode 100644 index 000000000..f47337577 --- /dev/null +++ b/nx-X11/programs/xterm/vttests/16colors.sh @@ -0,0 +1,90 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/vttests/16colors.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $ +# +# -- Thomas Dickey (1999/3/27) +# Show a simple 16-color test pattern. It is a little more confusing than +# 8colors.sh, since everything is abbreviated to fit on an 80-column line. +# The high (8-15) combinations for foreground or background are marked with +# a '+' sign. + +ESC="" +CMD='echo' +OPT='-n' +SUF='' +TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && +for verb in printf print ; do + rm -f $TMP + eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null + if test -f $TMP ; then + if test ! -s $TMP ; then + CMD="$verb" + OPT= + SUF='\c' + break + fi + fi +done +rm -f $TMP + +if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null +then + trap '$CMD "[0m"; exit' EXIT HUP INT TRAP TERM +else + trap '$CMD "[0m"; exit' 0 1 2 5 15 +fi + +echo "[0m" +while true +do + for AT in 0 1 4 7 + do + case $AT in + 0) attr=" ";; + 1) attr="BO ";; + 4) attr="UN ";; + 7) attr="RV ";; + esac + for FG in 0 1 2 3 4 5 6 7 + do + case $FG in + 0) fcolor="BLK ";; + 1) fcolor="RED ";; + 2) fcolor="GRN ";; + 3) fcolor="YEL ";; + 4) fcolor="BLU ";; + 5) fcolor="MAG ";; + 6) fcolor="CYN ";; + 7) fcolor="WHT ";; + esac + for HI in 3 9 + do + if test $HI = 3 ; then + color=" $fcolor" + else + color="+$fcolor" + fi + $CMD $OPT "[0;${AT}m$attr$SUF" + $CMD $OPT "[${HI}${FG}m$color$SUF" + for BG in 1 2 3 4 5 6 7 + do + case $BG in + 0) bcolor="BLK ";; + 1) bcolor="RED ";; + 2) bcolor="GRN ";; + 3) bcolor="YEL ";; + 4) bcolor="BLU ";; + 5) bcolor="MAG ";; + 6) bcolor="CYN ";; + 7) bcolor="WHT ";; + esac + $CMD $OPT "[4${BG}m$bcolor$SUF" + $CMD $OPT "[10${BG}m+$bcolor$SUF" + done + echo "[0m" + done + done + sleep 1 + done +done diff --git a/nx-X11/programs/xterm/vttests/256colors.pl b/nx-X11/programs/xterm/vttests/256colors.pl new file mode 100644 index 000000000..b053b94fc --- /dev/null +++ b/nx-X11/programs/xterm/vttests/256colors.pl @@ -0,0 +1,12 @@ +#!/usr/bin/perl +# $XFree86: xc/programs/xterm/vttests/256colors.pl,v 1.1 1999/07/11 08:49:54 dawes Exp $ + +for ($bg = 0; $bg < 256; $bg++) { + print "\x1b[9;1H\x1b[2J"; + for ($fg = 0; $fg < 256; $fg++) { + print "\x1b[48;5;${bg}m\x1b[38;5;${fg}m"; + printf "%03.3d/%03.3d ", $fg, $bg; + } + sleep 1; + print "\n"; +} diff --git a/nx-X11/programs/xterm/vttests/256colors2.pl b/nx-X11/programs/xterm/vttests/256colors2.pl new file mode 100644 index 000000000..c97c2be9d --- /dev/null +++ b/nx-X11/programs/xterm/vttests/256colors2.pl @@ -0,0 +1,63 @@ +#!/usr/bin/perl +# Author: Todd Larason <jtl@molehill.org> +# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $ + +# use the resources for colors 0-15 - usually more-or-less a +# reproduction of the standard ANSI colors, but possibly more +# pleasing shades + +# colors 16-231 are a 6x6x6 color cube +for ($red = 0; $red < 6; $red++) { + for ($green = 0; $green < 6; $green++) { + for ($blue = 0; $blue < 6; $blue++) { + printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", + 16 + ($red * 36) + ($green * 6) + $blue, + ($red ? ($red * 40 + 55) : 0), + ($green ? ($green * 40 + 55) : 0), + ($blue ? ($blue * 40 + 55) : 0)); + } + } +} + +# colors 232-255 are a grayscale ramp, intentionally leaving out +# black and white +for ($gray = 0; $gray < 24; $gray++) { + $level = ($gray * 10) + 8; + printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", + 232 + $gray, $level, $level, $level); +} + + +# display the colors + +# first the system ones: +print "System colors:\n"; +for ($color = 0; $color < 8; $color++) { + print "\x1b[48;5;${color}m "; +} +print "\x1b[0m\n"; +for ($color = 8; $color < 16; $color++) { + print "\x1b[48;5;${color}m "; +} +print "\x1b[0m\n\n"; + +# now the color cube +print "Color cube, 6x6x6:\n"; +for ($green = 0; $green < 6; $green++) { + for ($red = 0; $red < 6; $red++) { + for ($blue = 0; $blue < 6; $blue++) { + $color = 16 + ($red * 36) + ($green * 6) + $blue; + print "\x1b[48;5;${color}m "; + } + print "\x1b[0m "; + } + print "\n"; +} + + +# now the grayscale ramp +print "Grayscale ramp:\n"; +for ($color = 232; $color < 256; $color++) { + print "\x1b[48;5;${color}m "; +} +print "\x1b[0m\n"; diff --git a/nx-X11/programs/xterm/vttests/88colors.pl b/nx-X11/programs/xterm/vttests/88colors.pl new file mode 100644 index 000000000..a645fc3d4 --- /dev/null +++ b/nx-X11/programs/xterm/vttests/88colors.pl @@ -0,0 +1,13 @@ +#!/usr/bin/perl +# $XFree86: xc/programs/xterm/vttests/88colors.pl,v 1.1 1999/09/25 14:38:51 dawes Exp $ +# Made from 256colors.pl + +for ($bg = 0; $bg < 88; $bg++) { + print "\x1b[9;1H\x1b[48;5;${bg}m\x1b[2J"; + for ($fg = 0; $fg < 88; $fg++) { + print "\x1b[38;5;${fg}m"; + printf "%03.3d/%03.3d ", $fg, $bg; + } + sleep 1; + print "\n"; +} diff --git a/nx-X11/programs/xterm/vttests/88colors2.pl b/nx-X11/programs/xterm/vttests/88colors2.pl new file mode 100644 index 000000000..0e4c8f529 --- /dev/null +++ b/nx-X11/programs/xterm/vttests/88colors2.pl @@ -0,0 +1,66 @@ +#!/usr/bin/perl +# Author: Steve Wall <swall@redcom.com> +# $XFree86: xc/programs/xterm/vttests/88colors2.pl,v 1.1 1999/09/25 14:38:51 dawes Exp $ +# Made from 256colors2.pl + +# use the resources for colors 0-15 - usually more-or-less a +# reproduction of the standard ANSI colors, but possibly more +# pleasing shades + +# colors 16-79 are a 4x4x4 color cube +@steps=(0,139,205,255); +for ($red = 0; $red < 4; $red++) { + for ($green = 0; $green < 4; $green++) { + for ($blue = 0; $blue < 4; $blue++) { + printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", + 16 + ($red * 16) + ($green * 4) + $blue, + int (@steps[$red]), + int (@steps[$green]), + int (@steps[$blue])); + } + } +} + +# colors 80-87 are a grayscale ramp, intentionally leaving out +# black and white +for ($gray = 0; $gray < 8; $gray++) { + $level = ($gray * 23.18181818) + 46.36363636; + if( $gray > 0 ) { $level += 23.18181818; } + printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", + 80 + $gray, int($level), int($level), int($level)); +} + + +# display the colors + +# first the system ones: +print "System colors:\n"; +for ($color = 0; $color < 8; $color++) { + print "\x1b[48;5;${color}m "; +} +print "\x1b[0m\n"; +for ($color = 8; $color < 16; $color++) { + print "\x1b[48;5;${color}m "; +} +print "\x1b[0m\n\n"; + +# now the color cube +print "Color cube, 4x4x4:\n"; +for ($green = 0; $green < 4; $green++) { + for ($red = 0; $red < 4; $red++) { + for ($blue = 0; $blue < 4; $blue++) { + $color = 16 + ($red * 16) + ($green * 4) + $blue; + print "\x1b[48;5;${color}m "; + } + print "\x1b[0m "; + } + print "\n"; +} + + +# now the grayscale ramp +print "Grayscale ramp:\n"; +for ($color = 80; $color < 88; $color++) { + print "\x1b[48;5;${color}m "; +} +print "\x1b[0m\n"; diff --git a/nx-X11/programs/xterm/vttests/8colors.sh b/nx-X11/programs/xterm/vttests/8colors.sh new file mode 100644 index 000000000..10865f730 --- /dev/null +++ b/nx-X11/programs/xterm/vttests/8colors.sh @@ -0,0 +1,78 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/vttests/8colors.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $ +# +# -- Thomas Dickey (1999/3/27) +# Show a simple 8-color test pattern + +ESC="" +CMD='echo' +OPT='-n' +SUF='' +TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && +for verb in printf print ; do + rm -f $TMP + eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null + if test -f $TMP ; then + if test ! -s $TMP ; then + CMD="$verb" + OPT= + SUF='\c' + break + fi + fi +done +rm -f $TMP + +if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null +then + trap '$CMD $OPT "[0m"; exit' EXIT HUP INT TRAP TERM +else + trap '$CMD $OPT "[0m"; exit' 0 1 2 5 15 +fi + +echo "[0m" +while true +do + for AT in 0 1 4 7 + do + case $AT in + 0) attr="normal ";; + 1) attr="bold ";; + 4) attr="under ";; + 7) attr="reverse ";; + esac + for FG in 0 1 2 3 4 5 6 7 + do + case $FG in + 0) fcolor="black ";; + 1) fcolor="red ";; + 2) fcolor="green ";; + 3) fcolor="yellow ";; + 4) fcolor="blue ";; + 5) fcolor="magenta ";; + 6) fcolor="cyan ";; + 7) fcolor="white ";; + esac + $CMD $OPT "[0;${AT}m$attr" + $CMD $OPT "[3${FG}m$fcolor" + for BG in 1 2 3 4 5 6 7 + do + case $BG in + 0) bcolor="black ";; + 1) bcolor="red ";; + 2) bcolor="green ";; + 3) bcolor="yellow ";; + 4) bcolor="blue ";; + 5) bcolor="magenta ";; + 6) bcolor="cyan ";; + 7) bcolor="white ";; + esac + $CMD $OPT "[4${BG}m$bcolor" + done + echo "[0m" + done + sleep 1 + done +done diff --git a/nx-X11/programs/xterm/vttests/acolors.sh b/nx-X11/programs/xterm/vttests/acolors.sh new file mode 100644 index 000000000..ea19a38f4 --- /dev/null +++ b/nx-X11/programs/xterm/vttests/acolors.sh @@ -0,0 +1,64 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/vttests/acolors.sh,v 1.2 2003/05/19 00:52:30 dickey Exp $ +# +# -- Thomas Dickey (1999/3/27) +# Demonstrate the use of the control sequence for changing ANSI colors. + +ESC="" +CMD='echo' +OPT='-n' +SUF='' +TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && +for verb in printf print ; do + rm -f $TMP + eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null + if test -f $TMP ; then + if test ! -s $TMP ; then + CMD="$verb" + OPT= + SUF='\c' + break + fi + fi +done +rm -f $TMP + +LIST="00 30 80 d0 ff" + +exec </dev/tty +old=`stty -g` +stty raw -echo min 0 time 5 + +$CMD $OPT "${ESC}]4;4;?${SUF}" > /dev/tty +read original +stty $old +original=${original}${SUF} + +if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null +then + trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM +else + trap '$CMD $OPT "$original" >/dev/tty; exit' 0 1 2 5 15 +fi + +$CMD "${ESC}[0;1;34mThis message is BLUE" +$CMD "${ESC}[0;1;31mThis message is RED ${ESC}[0;31m(sometimes)" +$CMD "${ESC}[0;1;32mThis message is GREEN${ESC}[0m" +while true +do + for R in $LIST + do + for G in $LIST + do + for B in $LIST + do + # color "9" is bold-red + test $R != 00 && test $G = 00 && test $B = 00 && $CMD $OPT "" >/dev/tty + $CMD $OPT "${ESC}]4;9;rgb:$R/$G/$B${SUF}" >/dev/tty + sleep 1 + done + done + done +done diff --git a/nx-X11/programs/xterm/vttests/doublechars.sh b/nx-X11/programs/xterm/vttests/doublechars.sh new file mode 100644 index 000000000..dd032ae46 --- /dev/null +++ b/nx-X11/programs/xterm/vttests/doublechars.sh @@ -0,0 +1,87 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/vttests/doublechars.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $ +# +# -- Thomas Dickey (1999/7/7) +# Illustrate the use of double-size characters by drawing successive lines in +# the commonly used video attributes. +# +# Use the -w option to force the output to wrap. It will look ugly, because +# the double-high lines will be split. + +ESC="" +CMD='echo' +OPT='-n' +SUF='' +TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && +for verb in printf print ; do + rm -f $TMP + eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null + if test -f $TMP ; then + if test ! -s $TMP ; then + CMD="$verb" + OPT= + SUF='\c' + break + fi + fi +done +rm -f $TMP + +SAVE=yes +WRAP=no +if test $# != 0 ; then + while test $# != 0 + do + case $1 in + -n) SAVE=no ;; + -w) WRAP=yes ;; + esac + shift + done +fi + +if test $SAVE = yes ; then + exec </dev/tty + old=`stty -g` + stty raw -echo min 0 time 5 + + $CMD $OPT "${ESC}[18t${SUF}" > /dev/tty + IFS=';' read junk high wide + + stty $old + + wide=`echo $wide|sed -e 's/t.*//'` + original=${ESC}[8\;${high}\;${wide}t${SUF} + + if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null + then + trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM + else + trap '$CMD $OPT "$original" >/dev/tty; exit' 0 1 2 5 15 + fi + +fi + +if test $WRAP = yes ; then + # turn on wrapping and force the screen to 80 columns + $CMD $OPT "${ESC}[?7h" >/dev/tty + $CMD $OPT "${ESC}[?40l" >/dev/tty +else + # force the screen to 132 columns + $CMD $OPT "${ESC}[?40h" >/dev/tty + $CMD $OPT "${ESC}[?3h" >/dev/tty +fi + +for SGR in 0 1 4 5 7 +do + $CMD $OPT "${ESC}[0;${SGR}m" >/dev/tty + for DBL in 5 3 4 6 5 + do + $CMD $OPT "${ESC}#${DBL}" >/dev/tty + echo "The quick brown fox jumps over the lazy dog" >/dev/tty + done + echo +done +$CMD $OPT "${ESC}[0m" >/dev/tty diff --git a/nx-X11/programs/xterm/vttests/dynamic.sh b/nx-X11/programs/xterm/vttests/dynamic.sh new file mode 100644 index 000000000..e68ebbc6c --- /dev/null +++ b/nx-X11/programs/xterm/vttests/dynamic.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/vttests/dynamic.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $ +# +# -- Thomas Dickey (1999/3/27) +# Demonstrate the use of dynamic colors by setting the background successively +# to different values. + +ESC="" +CMD='echo' +OPT='-n' +SUF='' +TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && +for verb in printf print ; do + rm -f $TMP + eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null + if test -f $TMP ; then + if test ! -s $TMP ; then + CMD="$verb" + OPT= + SUF='\c' + break + fi + fi +done +rm -f $TMP + +LIST="00 30 80 d0 ff" + +exec </dev/tty +old=`stty -g` +stty raw -echo min 0 time 5 + +$CMD $OPT "${ESC}]11;?${SUF}" > /dev/tty +read original +stty $old +original=${original}${SUF} + +if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null +then + trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM +else + trap '$CMD $OPT "$original" >/dev/tty; exit' 0 1 2 5 15 +fi + +while true +do + for R in $LIST + do + for G in $LIST + do + for B in $LIST + do + $CMD $OPT "${ESC}]11;rgb:$R/$G/$B${SUF}" >/dev/tty + sleep 1 + done + done + done +done diff --git a/nx-X11/programs/xterm/vttests/fonts.sh b/nx-X11/programs/xterm/vttests/fonts.sh new file mode 100644 index 000000000..5dd9e29f0 --- /dev/null +++ b/nx-X11/programs/xterm/vttests/fonts.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/vttests/fonts.sh,v 1.4 2003/05/19 00:52:30 dickey Exp $ +# +# -- Thomas Dickey (1999/3/27) +# Demonstrate the use of dynamic colors by setting the background successively +# to different values. + +ESC="" +CMD='echo' +OPT='-n' +SUF='' +TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && +for verb in printf print ; do + rm -f $TMP + eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null + if test -f $TMP ; then + if test ! -s $TMP ; then + CMD="$verb" + OPT= + SUF='\c' + break + fi + fi +done +rm -f $TMP + +exec </dev/tty +old=`stty -g` +stty raw -echo min 0 time 5 + +$CMD $OPT "${ESC}]50;?${SUF}" > /dev/tty +read original + +stty $old +original="${original}${SUF}" + +if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null +then + trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM +else + trap '$CMD $OPT "$original" >/dev/tty; exit' 0 1 2 5 15 +fi + +F=1 +D=1 +T=6 +while true +do + $CMD $OPT "${ESC}]50;#$F${SUF}" >/dev/tty + #sleep 1 + if test .$D = .1 ; then + test $F = $T && D=-1 + else + test $F = 1 && D=1 + fi + F=`expr $F + $D` +done diff --git a/nx-X11/programs/xterm/vttests/resize.pl b/nx-X11/programs/xterm/vttests/resize.pl new file mode 100755 index 000000000..21a18beea --- /dev/null +++ b/nx-X11/programs/xterm/vttests/resize.pl @@ -0,0 +1,100 @@ +#!/usr/bin/perl +# $XFree86: xc/programs/xterm/vttests/resize.pl,v 1.1 2004/03/04 02:21:58 dickey Exp $ +# +# -- Thomas Dickey (2004/3/3) +# resize.sh rewritten into Perl for comparison. +# See also Term::ReadKey. + +use IO::Handle; + +sub write_tty { + open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n"); + autoflush TTY 1; + print TTY @_; + close TTY; +} + +sub get_reply { + open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n"); + autoflush TTY 1; + $old=`stty -g`; + system "stty raw -echo min 0 time 5"; + + print TTY @_; + my $reply=<TTY>; + close TTY; + system "stty $old"; + return $reply; +} + +sub csi_field { + my $first = @_[0]; + my $second = @_[1]; + $first =~ s/^[^0-9]+//; + while ( --$second > 0 ) { + $first =~ s/^[\d]+//; + $first =~ s/^[^\d]+//; + } + $first =~ s/[^\d]+.*$//; + return $first; +} + +$original=get_reply("\x1b[18t"); +if ( $original =~ /\x1b\[8;\d+;\d+t/ ) { + $high=csi_field($original,2); + $wide=csi_field($original,3); + printf "parsed terminal size $high,$wide\n"; +} else { + die "Cannot get terminal size via escape sequence\n"; +} +# +$maximize=get_reply("\x1b[19t"); +if ( $maximize =~ /\x1b\[9;\d+;\d+t/ ) { + $maxhigh=csi_field($maximize,2); + $maxwide=csi_field($maximize,3); + $maxhigh != 0 or $maxhigh = $high * 2; + $maxwide != 0 or $maxwide = $wide * 2; + printf "parsed terminal maxsize $maxhigh,$maxwide\n"; +} else { + die "Cannot get terminal size via escape sequence\n"; +} + +sub catch_zap { + $zapped++; +} +$SIG{INT} = \&catch_zap; +$SIG{QUIT} = \&catch_zap; +$SIG{KILL} = \&catch_zap; +$SIG{HUP} = \&catch_zap; +$SIG{TERM} = \&catch_zap; + +$w=$wide; +$h=$high; +$a=1; +$zapped=0; +while ( $zapped == 0 ) +{ +# sleep 1 + printf "resizing to $h by $w\n"; + write_tty("\x1b[8;$h;$w" . "t"); + if ( $a == 1 ) { + if ( $w == $maxwide ) { + $h += $a; + if ( $h = $maxhigh ) { + $a = -1; + } + } else { + $w += $a; + } + } else { + if ( $w == $wide ) { + $h += $a; + if ( $h = $high ) { + $a=1; + } + } else { + $w += $a; + } + } +} +write_tty($original); diff --git a/nx-X11/programs/xterm/vttests/resize.sh b/nx-X11/programs/xterm/vttests/resize.sh new file mode 100644 index 000000000..004574949 --- /dev/null +++ b/nx-X11/programs/xterm/vttests/resize.sh @@ -0,0 +1,82 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/vttests/resize.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $ +# +# -- Thomas Dickey (1999/3/27) +# Obtain the current screen size, then resize the terminal to the nominal +# screen width/height, and restore the size. + +ESC="" +CMD='echo' +OPT='-n' +SUF='' +TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && +for verb in printf print ; do + rm -f $TMP + eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null + if test -f $TMP ; then + if test ! -s $TMP ; then + CMD="$verb" + OPT= + SUF='\c' + break + fi + fi +done +rm -f $TMP + +exec </dev/tty +old=`stty -g` +stty raw -echo min 0 time 5 + +$CMD $OPT "${ESC}[18t${SUF}" > /dev/tty +IFS=';' read junk high wide + +$CMD $OPT "${ESC}[19t${SUF}" > /dev/tty +IFS=';' read junk maxhigh maxwide + +stty $old + +wide=`echo $wide|sed -e 's/t.*//'` +maxwide=`echo $maxwide|sed -e 's/t.*//'` +original=${ESC}[8\;${high}\;${wide}t${SUF} + +test $maxwide = 0 && maxwide=`expr $wide \* 2` +test $maxhigh = 0 && maxhigh=`expr $high \* 2` + +if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null +then + trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM +else + trap '$CMD $OPT "$original" >/dev/tty; exit' 0 1 2 5 15 +fi + +w=$wide +h=$high +a=1 +while true +do +# sleep 1 + echo resizing to $h by $w + $CMD $OPT "${ESC}[8;${h};${w}t" >/dev/tty + if test $a = 1 ; then + if test $w = $maxwide ; then + h=`expr $h + $a` + if test $h = $maxhigh ; then + a=-1 + fi + else + w=`expr $w + $a` + fi + else + if test $w = $wide ; then + h=`expr $h + $a` + if test $h = $high ; then + a=1 + fi + else + w=`expr $w + $a` + fi + fi +done diff --git a/nx-X11/programs/xterm/vttests/tcapquery.pl b/nx-X11/programs/xterm/vttests/tcapquery.pl new file mode 100755 index 000000000..0cd5d9f64 --- /dev/null +++ b/nx-X11/programs/xterm/vttests/tcapquery.pl @@ -0,0 +1,162 @@ +#!/usr/bin/perl +# $XFree86: xc/programs/xterm/vttests/tcapquery.pl,v 1.2 2005/09/18 23:48:14 dickey Exp $ +# +# -- Thomas Dickey (2004/3/3) +# Test the tcap-query option of xterm. + +use strict; + +use IO::Handle; + +sub write_tty { + open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n"); + autoflush TTY 1; + print TTY @_; + close TTY; +} + +sub get_reply { + open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n"); + autoflush TTY 1; + my $old=`stty -g`; + system "stty raw -echo min 0 time 5"; + + print TTY @_; + my $reply=<TTY>; + close TTY; + system "stty $old"; + return $reply; +} + +sub csi_field { + my $first = @_[0]; + my $second = @_[1]; + $first =~ s/^[^0-9]+//; + while ( --$second > 0 ) { + $first =~ s/^[\d]+//; + $first =~ s/^[^\d]+//; + } + $first =~ s/[^\d]+.*$//; + return $first; +} + +sub hexified { + my $value = @_[0]; + my $result = ""; + my $n; + + for ( $n = 0; $n < length($value); ++$n) { + $result .= sprintf("%02X", ord substr($value,$n,1)); + } + return $result; +} + +sub query_tcap { + my $tcap = @_[0]; + my $tinfo = @_[1]; + my $param1 = hexified($tcap); + my $param2 = hexified($tinfo); + + # uncomment one of the following lines + my $reply=get_reply("\x1bP+q" . $param1 . ";" . $param2 . "\x1b\\"); + #my $reply=get_reply("\x1bP+q" . $param2 . "\x1b\\"); + + if ( $reply =~ /\x1bP1\+r[[:xdigit:]]+=[[:xdigit:]]*.*/ ) { + my $value = $reply; + my $n; + + $value =~ s/^\x1bP1\+r//; + $value =~ s/\x1b\\//; + + my $result = ""; + for ( $n = 0; $n < length($value); ) { + my $c = substr($value,$n,1); + # handle semicolon and equals + if ( $c =~ /[[:punct:]]/ ) { + $n += 1; + $result .= $c; + } else { + # handle hex-data + my $k = hex substr($value,$n,2); + if ( $k == 0x1b ) { + $result .= "\\E"; + } elsif ( $k == 0x7f ) { + $result .= "^?"; + } elsif ( $k == 32 ) { + $result .= "\\s"; + } elsif ( $k < 32 ) { + $result .= sprintf("^%c", $k + 64); + } elsif ( $k > 128 ) { + $result .= sprintf("\\%03o", $k); + } else { + $result .= chr($k); + } + $n += 2; + } + } + + printf "$result\n"; + } +} + +# See xtermcapKeycode() +query_tcap( "#2", "kHOM"); +query_tcap( "#4", "kLFT"); +query_tcap( "%1", "khlp"); +query_tcap( "%i", "kRIT"); +query_tcap( "*6", "kslt"); +query_tcap( "*7", "kEND"); +query_tcap( "@0", "kfnd"); +query_tcap( "@7", "kend"); +query_tcap( "F1", "kf11"); +query_tcap( "F2", "kf12"); +query_tcap( "F3", "kf13"); +query_tcap( "F4", "kf14"); +query_tcap( "F5", "kf15"); +query_tcap( "F6", "kf16"); +query_tcap( "F7", "kf17"); +query_tcap( "F8", "kf18"); +query_tcap( "F9", "kf19"); +query_tcap( "FA", "kf20"); +query_tcap( "FB", "kf21"); +query_tcap( "FC", "kf22"); +query_tcap( "FD", "kf23"); +query_tcap( "FE", "kf24"); +query_tcap( "FF", "kf25"); +query_tcap( "FG", "kf26"); +query_tcap( "FH", "kf27"); +query_tcap( "FI", "kf28"); +query_tcap( "FJ", "kf29"); +query_tcap( "FK", "kf30"); +query_tcap( "FL", "kf31"); +query_tcap( "FM", "kf32"); +query_tcap( "FN", "kf33"); +query_tcap( "FO", "kf34"); +query_tcap( "FP", "kf35"); +query_tcap( "FQ", "kf36"); +query_tcap( "FR", "kf37"); +query_tcap( "K1", "ka1"); +query_tcap( "K4", "kc1"); +query_tcap( "k1", "kf1"); +query_tcap( "k2", "kf2"); +query_tcap( "k3", "kf3"); +query_tcap( "k4", "kf4"); +query_tcap( "k5", "kf5"); +query_tcap( "k6", "kf6"); +query_tcap( "k7", "kf7"); +query_tcap( "k8", "kf8"); +query_tcap( "k9", "kf9"); +query_tcap( "k;", "kf10"); +query_tcap( "kB", "kcbt"); +query_tcap( "kC", "kclr"); +query_tcap( "kD", "kdch1"); +query_tcap( "kI", "kich1"); +query_tcap( "kN", "knp"); +query_tcap( "kP", "kpp"); +query_tcap( "kb", "kbs"); +query_tcap( "kd", "kcud1"); +query_tcap( "kh", "khome"); +query_tcap( "kl", "kcub1"); +query_tcap( "kr", "kcuf1"); +query_tcap( "ku", "kcuu1"); +query_tcap( "Co", "colors"); diff --git a/nx-X11/programs/xterm/vttests/title.sh b/nx-X11/programs/xterm/vttests/title.sh new file mode 100644 index 000000000..af3807783 --- /dev/null +++ b/nx-X11/programs/xterm/vttests/title.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/vttests/title.sh,v 1.6 2003/05/19 00:52:30 dickey Exp $ +# +# -- Thomas Dickey (1999/3/27) +# Obtain the current title of the window, set up a simple clock which runs +# until this script is interrupted, then restore the title. + +ESC="" +CMD='echo' +OPT='-n' +SUF='' +TMP=/tmp/xterm$$ +eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null +( test ! -f $TMP || test -s $TMP ) && +for verb in printf print ; do + rm -f $TMP + eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null + if test -f $TMP ; then + if test ! -s $TMP ; then + CMD="$verb" + OPT= + SUF='\c' + break + fi + fi +done +rm -f $TMP + +exec </dev/tty +old=`stty -g` +stty raw -echo min 0 time 5 + +$CMD $OPT "${ESC}[21t${SUF}" > /dev/tty +read original + +stty $old + +# We actually get this terminated by an <esc>backslash, but the backslash +# is lost. We may lose doublequote characters when restoring the title, +# depending on the shell. +original=`echo "$original" |sed -e 's/^...//' -e 's/.$//'` +original=${ESC}]2\;"${original}"${SUF} + +if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null +then + trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM +else + trap '$CMD $OPT "$original" >/dev/tty; exit' 0 1 2 5 15 +fi + +while true +do + sleep 1 + $CMD $OPT "${ESC}]2;`date`" >/dev/tty +done |