doublechars.sh revision d522f475
1#!/bin/sh 2# $XFree86: xc/programs/xterm/vttests/doublechars.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $ 3# 4# -- Thomas Dickey (1999/7/7) 5# Illustrate the use of double-size characters by drawing successive lines in 6# the commonly used video attributes. 7# 8# Use the -w option to force the output to wrap. It will look ugly, because 9# the double-high lines will be split. 10 11ESC="" 12CMD='echo' 13OPT='-n' 14SUF='' 15TMP=/tmp/xterm$$ 16eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null 17( test ! -f $TMP || test -s $TMP ) && 18for verb in printf print ; do 19 rm -f $TMP 20 eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null 21 if test -f $TMP ; then 22 if test ! -s $TMP ; then 23 CMD="$verb" 24 OPT= 25 SUF='\c' 26 break 27 fi 28 fi 29done 30rm -f $TMP 31 32SAVE=yes 33WRAP=no 34if test $# != 0 ; then 35 while test $# != 0 36 do 37 case $1 in 38 -n) SAVE=no ;; 39 -w) WRAP=yes ;; 40 esac 41 shift 42 done 43fi 44 45if test $SAVE = yes ; then 46 exec </dev/tty 47 old=`stty -g` 48 stty raw -echo min 0 time 5 49 50 $CMD $OPT "${ESC}[18t${SUF}" > /dev/tty 51 IFS=';' read junk high wide 52 53 stty $old 54 55 wide=`echo $wide|sed -e 's/t.*//'` 56 original=${ESC}[8\;${high}\;${wide}t${SUF} 57 58 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null 59 then 60 trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM 61 else 62 trap '$CMD $OPT "$original" >/dev/tty; exit' 0 1 2 5 15 63 fi 64 65fi 66 67if test $WRAP = yes ; then 68 # turn on wrapping and force the screen to 80 columns 69 $CMD $OPT "${ESC}[?7h" >/dev/tty 70 $CMD $OPT "${ESC}[?40l" >/dev/tty 71else 72 # force the screen to 132 columns 73 $CMD $OPT "${ESC}[?40h" >/dev/tty 74 $CMD $OPT "${ESC}[?3h" >/dev/tty 75fi 76 77for SGR in 0 1 4 5 7 78do 79 $CMD $OPT "${ESC}[0;${SGR}m" >/dev/tty 80 for DBL in 5 3 4 6 5 81 do 82 $CMD $OPT "${ESC}#${DBL}" >/dev/tty 83 echo "The quick brown fox jumps over the lazy dog" >/dev/tty 84 done 85 echo 86done 87$CMD $OPT "${ESC}[0m" >/dev/tty 88