~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/xterm/vttests/doublechars.sh

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# $XFree86: xc/programs/xterm/vttests/doublechars.sh,v 1.4 2002/09/30 00:39:08 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
 
 
11
ESC=""
 
12
CMD='echo'
 
13
OPT='-n'
 
14
SUF=''
 
15
TMP=/tmp/xterm$$
 
16
eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
 
17
( test ! -f $TMP || test -s $TMP ) &&
 
18
for 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
 
29
done
 
30
rm -f $TMP
 
31
 
 
32
SAVE=yes
 
33
WRAP=no
 
34
if 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
 
43
fi
 
44
 
 
45
if 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
    trap '$CMD $OPT "$original" >/dev/tty; exit' 0 1 2 5 15
 
58
fi
 
59
 
 
60
if test $WRAP = yes ; then
 
61
        # turn on wrapping and force the screen to 80 columns
 
62
        $CMD $OPT "${ESC}[?7h" >/dev/tty
 
63
        $CMD $OPT "${ESC}[?40l" >/dev/tty
 
64
else
 
65
        # force the screen to 132 columns
 
66
        $CMD $OPT "${ESC}[?40h" >/dev/tty
 
67
        $CMD $OPT "${ESC}[?3h" >/dev/tty
 
68
fi
 
69
 
 
70
for SGR in 0 1 4 5 7
 
71
do
 
72
        $CMD $OPT "${ESC}[0;${SGR}m" >/dev/tty
 
73
        for DBL in 5 3 4 6 5
 
74
        do
 
75
                $CMD $OPT "${ESC}#${DBL}" >/dev/tty
 
76
                echo "The quick brown fox jumps over the lazy dog" >/dev/tty
 
77
        done
 
78
        echo
 
79
done
 
80
$CMD $OPT "${ESC}[0m" >/dev/tty