-
Notifications
You must be signed in to change notification settings - Fork 2
/
cvtinfo.pl
executable file
·51 lines (44 loc) · 1.21 KB
/
cvtinfo.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/local/bin/perl
#Display additional information of GEOS files.
while ($#ARGV >= 0)
{
$FILE = shift(@ARGV);
open FILE or die "Can't open $FILE!\n";
read FILE,$header,254;
read FILE,$info,254;
close FILE;
($name, $id) = (unpack ("A3A16A11A*", $header)) [1, 3];
chop $name while ($name =~ /\240$/);
$name .= ".cvt";
($type, $class, $author, $needsclass, $desc) =
unpack ("x67Cx7A20A20A20x23a*", $info);
if ($type == 8)
{
$author = "";
$needsclass = "";
}
$class =~ s/\0.*$//;
$author =~ s/\0.*$//;
$needsclass =~ s/\0.*$//;
$class =~ tr/\240/ /;
$author =~ tr/\240/ /;
$needsclass =~ tr/\240/ /;
$desc =~ tr/\240/ /;
$class =~ tr/ //s;
$author =~ tr/ //s;
$needsclass =~ tr/ //s;
$desc =~ s/\0.*$//;
$desc =~ s/\r/ \n /gm;
$desc =~ tr/\0-\11\14-\37//d;
if ($id =~ /^(PRG|SEQ) formatted GEOS file/) {
print $name, "\n";
if ($needsclass ne "") {
print " $needsclass document.";
}
elsif ($class ne "") {
print " ", $class, $author ne "" ? " by $author." : ".";
}
print "\n $desc" unless $desc eq "";
print "\n\n";
}
}