Date: Mon, 24 Sep 2001 23:42:46 +0300 From: Giorgos Keramidas <charon@labs.gr> To: hackers@freebsd.org Subject: termcap sources Message-ID: <20010924234245.B14545@hades.hell.gr>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
I saw a duplicate in one of the capabilities that wer submitted to -bugs earlier.
This had me thinking. What happens when a duplicate capability exists in termcap?
Are there any other duplicates in termcap.src? If yes, which?
The first attachment is a perl script that strips all cruft from termcap.src
(fed through stdin) and makes every terminal entry occupy a single line of
text. This is necessary for the second attachment to work correctly.
The second attachment is a perl script that splits capability names of each
input line in an array, and performs the (boring for a human to do by reading
through the termcap sources) duplicate check in all the elements of the array.
The third attachment is the output of the command (termcap.src,v 1.109):
% cat termcap.src | ./tstrip.pl | ./tdupcheck.pl
As you can see there are quite a few terminals that have capabilities defined
more than once! I don't have THAT many terminals to check, but I'm open to
suggestions. Should we do something about this? If yes, what?
-giorgos
[-- Attachment #2 --]
#!/usr/bin/perl -w
#
# $Id$
#
# Strip comments from termcap files. Also join all continuation lines (those
# ending with backslash) in one long line of text. Use this to prepare input
# for the tdupcheck.pl program (the duplicate capability checker).
$buf = "";
LINE:
while (defined($line = <STDIN>)) {
chomp $line;
# skip empty and comment lines
next LINE if ($line =~ m/^[\s]*$/ || $line =~ m/^[\s]*#/);
# terminal continuation lines (ending in backslash)
if ($line =~ m/^[\s]+.*\\$/) {
$line =~ s/^[\s]+//;
$line =~ s/^://;
$line =~ s/\\$//;
$buf .= $line;
next LINE;
}
# terminal continuation lines (final of a terminal entry)
if ($line =~ m/^[\s]+/) {
$line =~ s/^[\s]+//;
$line =~ s/^://;
$buf .= $line;
next LINE;
}
# terminal entry starting line
# print collected terminal entry in $buf, and start all over
if (defined($buf)) {
print "$buf\n";
$line =~ s/\\$//;
$buf = $line;
next LINE;
}
}
# print any left-over contents of the output buffer
if (defined($buf)) {
print "$buf\n";
}
[-- Attachment #3 --]
#!/usr/bin/perl -w
#
# $Id$
#
# Check for duplicate capabilities in terminal entries fed to us through the
# standard input. Feed the termcap source to tstrip.pl before giving it to
# this program, for example:
#
# % cat /usr/src/share/termcap/termcap.src | ./tstrip.pl | ./tdupcheck.pl
#
LINE:
while (defined($line = <STDIN>)) {
chomp $line;
# protect "\:" from being used in split() as a separator.
$line =~ s/\\:/\001/g;
@cap = split /:/,$line;
# cleanup all @cap members from capability values.
# we only care for their names.
for ($c = 0; $c <= $#cap; $c++) {
$cap[$c] =~ s/=.*//;
$cap[$c] =~ s/#.*//;
}
# do the (slow) check for duplicates
if ($#cap >= 0) {
$term = $cap[0];
$term =~ s/\|.*$//;
shift @cap;
@dups = ();
for ($c = 0; $c <= $#cap; $c++) {
for ($i = $c + 1; $i <= $#cap; $i++) {
if ($cap[$c] eq $cap[$i]) {
push @dups, $cap[$c];
}
}
}
if ($#dups >= 0) {
printf "$term - " . join(":",@dups) . "\n";
}
}
}
[-- Attachment #4 --]
q101 - cl
5410 - k4
AT386 - IC
h1510 - do
h1520 - do
ibm3163 - ds:es:fs:hs
abm80 - do
d132 - ic
tec400 - do
f200 - ds:ts
sol - ho
it2 - do
mdl110 - cd
wsiris - cl:ho
intext - le
c100 - us:ue
dtterm - op
h29 - do
z29a - mb:mr
ztx - sr
adm5 - do
mime - do
sexidy - le
ttyWilliams - do
tvi950 - do
tvi955 - do
abm85 - kd
fos - bs
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010924234245.B14545>
