home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 February / PCWorld_2000-02_cd.bin / live / usr / share / xterm / vttests / doublechars.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1999-09-19  |  2KB  |  79 lines

  1. #!/bin/sh
  2. # $XFree86: xc/programs/xterm/vttests/doublechars.sh,v 1.1 1999/07/11 08:49:54 dawes 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.  
  11. ESC=""
  12. CMD='echo'
  13. OPT='-n'
  14. SUF=''
  15. TMP=/tmp/xterm$$
  16. for verb in print printf ; do
  17.     rm -f $TMP
  18.     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
  19.     if test -f $TMP ; then
  20.     if test ! -s $TMP ; then
  21.         CMD="$verb"
  22.         OPT=
  23.         SUF='\c'
  24.         break
  25.     fi
  26.     fi
  27. done
  28. rm -f $TMP
  29.  
  30. SAVE=yes
  31. WRAP=no
  32. if test $# != 0 ; then
  33.     while test $# != 0
  34.     do
  35.         case $1 in
  36.     -n)    SAVE=no ;;
  37.     -w)    WRAP=yes ;;
  38.     esac
  39.     shift
  40.     done
  41. fi
  42.  
  43. if test $SAVE = yes ; then
  44.     exec </dev/tty
  45.     old=`stty -g`
  46.     stty raw -echo min 0  time 5
  47.  
  48.     $CMD $OPT "${ESC}[18t${SUF}" > /dev/tty
  49.     IFS=';' read junk high wide
  50.  
  51.     stty $old
  52.  
  53.     wide=`echo $wide|sed -e 's/t.*//'`
  54.     original=${ESC}[8\;${high}\;${wide}t${SUF}
  55.     trap '$CMD $OPT "$original" >/dev/tty; exit' 0 1 2 5 15
  56. fi
  57.  
  58. if test $WRAP = yes ; then
  59.     # turn on wrapping and force the screen to 80 columns
  60.     $CMD $OPT "${ESC}[?7h" >/dev/tty
  61.     $CMD $OPT "${ESC}[?40l" >/dev/tty
  62. else
  63.     # force the screen to 132 columns
  64.     $CMD $OPT "${ESC}[?40h" >/dev/tty
  65.     $CMD $OPT "${ESC}[?3h" >/dev/tty
  66. fi
  67.  
  68. for SGR in 0 1 4 5 7
  69. do
  70.     $CMD $OPT "${ESC}[0;${SGR}m" >/dev/tty
  71.     for DBL in 5 3 4 6 5
  72.     do
  73.         $CMD $OPT "${ESC}#${DBL}" >/dev/tty
  74.         echo "The quick brown fox jumps over the lazy dog" >/dev/tty
  75.     done
  76.     echo
  77. done
  78. $CMD $OPT "${ESC}[0m" >/dev/tty
  79.