2
# $XTermId: dynamic.pl,v 1.2 2011/07/05 09:32:53 tom Exp $
3
# -----------------------------------------------------------------------------
4
# this file is part of xterm
6
# Copyright 2011 by Thomas E. Dickey
10
# Permission is hereby granted, free of charge, to any person obtaining a
11
# copy of this software and associated documentation files (the
12
# "Software"), to deal in the Software without restriction, including
13
# without limitation the rights to use, copy, modify, merge, publish,
14
# distribute, sublicense, and/or sell copies of the Software, and to
15
# permit persons to whom the Software is furnished to do so, subject to
16
# the following conditions:
18
# The above copyright notice and this permission notice shall be included
19
# in all copies or substantial portions of the Software.
21
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24
# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
25
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
# Except as contained in this notice, the name(s) of the above copyright
30
# holders shall not be used in advertising or otherwise to promote the
31
# sale, use or other dealings in this Software without prior written
33
# -----------------------------------------------------------------------------
34
# Test the dynamic-color query option of xterm.
35
# The programs xtermcontrol and xtermset provide more options.
43
"VT100 text foreground",
44
"VT100 text background",
48
"Tektronix foreground",
49
"Tektronix background",
50
"highlight background",
52
"highlight foreground"
56
&getopts('c:r') || die("Usage: $0 [options]\n
58
-c XXX set cursor-color
63
open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n");
66
system "stty raw -echo min 0 time 5";
74
open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n");
77
system "stty raw -echo min 0 time 5";
83
if ( defined $reply ) {
84
die("^C received\n") if ( "$reply" eq "\003" );
91
my $param1 = $code + 10;
94
$reply=get_reply("\x1b]$param1;?\007");
96
return unless defined $reply;
97
if ( $reply =~ /\x1b]$param1;.*\007/ ) {
100
$value =~ s/^\x1b]$param1;//;
103
printf "%24s = %s\n", $color_names[$code], $value;
110
for ( $n = 0; $n <= 9; ++$n) {
118
for ( $n = 0; $n <= 9; ++$n) {
120
&no_reply("\x1b]$code\007");
124
if ( defined ($opt_c) ) {
125
&no_reply("\x1b]12;$opt_c\007");
127
if ( defined ($opt_r) ) {