# to check which Empire commands need to be documented.
#
+use strict;
+use warnings;
+
+my ($com, @list, @obsolete, @Commands);
+
open(LIST, "<player.list") || die "Can't read player.list\n";
while(<LIST>) {
close LS;
print "In list but not Commands:\n";
-for $l (@list) {
+for my $l (@list) {
print " $l\n" unless grep (/^$l$/, @Commands);
}
print "In Commands but not list:\n";
-for $c (@Commands) {
+for my $c (@Commands) {
print " $c\n" unless grep(/^$c$/, @list) || grep(/^$c$/, @obsolete);
}
#!/usr/local/bin/perl
+use strict;
+use warnings;
-$[ = 1; # set array base to 1
+my (@Fld, $str, @a);
line: while (<>) {
chop; # strip record separator
procline:
if (/^\.TH/) {
- $str=$Fld[3];
- for ($i=4;$i <= $#Fld; $i++) {
+ $str=$Fld[2];
+ for (my $i=3; $i <= $#Fld; $i++) {
$str .= " " . $Fld[$i];
}
$str = &htmlify($str);
printf("<title>%s : %s</title><h1>%s : %s</h1>\n",
- $Fld[2],$str,$Fld[2], $str);
+ $Fld[1], $str, $Fld[1], $str);
next line;
}
- if (/^\.SY/) {
+ if (/^\.SY../) {
# $i = $_ =~ "\"" && ($RLENGTH = length($&), $RSTART = length($`)+1);
# $str = substr($_, $i + 1, length($_) - $i - 1);
$str = substr($_,5);
next line;
}
- if (/^\.EX/) {
+ if (/^\.EX../) {
$str = substr($_, 5);
printf "<br><samp>[##:##] </samp><kbd>%s</kbd><p>\n", &htmlify($str);
next line;
}
- if (/^\.L/) {
+ if (/^\.L../) {
$str = substr($_, 4);
printf "<h2>%s</h2>\n", &htmlify($str);
next line;
if (/^\.SA/) {
@a = split('[: ",.]+');
- printf("See also : %s\n",&anchor($a[3]) );
- for ($i = 4; $i <= $#a ; ($i)++) {
+ printf("See also : %s\n",&anchor($a[2]) );
+ for (my $i = 3; $i <= $#a ; ($i)++) {
printf(", %s\n",&anchor($a[$i]));
}
@a = split('[: ,.]+');
@Fld = split(' ', $_, 9999);
if (/^\./) { goto procline; }
- for ($i = 1; $i <= $#a ; ($i)++) {
+ for (my $i = 0; $i <= $#a ; ($i)++) {
printf(", %s\n",&anchor($a[$i]));
}
}
if (/^(See also|See Also|see also)/) {
@a = split('[: ,.]+');
- printf("See also : %s\n",&anchor($a[3]) );
- for ($i = 4; $i <= $#a ; ($i)++) {
+ printf("See also : %s\n",&anchor($a[2]) );
+ for (my $i = 3; $i <= $#a ; ($i)++) {
printf(", %s\n",&anchor($a[$i]));
}
@a = split('[: ,.]+');
@Fld = split(' ', $_, 9999);
if (/^\./) { goto procline; }
- for ($i = 1; $i <= $#a ; ($i)++) {
+ for (my $i = 0; $i <= $#a ; ($i)++) {
printf(", %s\n",&anchor($a[$i]));
}
}
#}
sub anchor {
- local($_) = @_;
- local(@file,$file);
+ local ($_) = @_;
+ my (@file,$file);
$file = $_ . ".t";
# if (-r $file) {
if (1) {
} else {
@file = <$_*t>;
if (@file) {
- warn "Expanding $_ to $file[$[]\n";
- $file[$[] =~ s/.t$/.html/;
- return ("<a href=\"$file[$[]\">$_</a>");
+ warn "Expanding $_ to $file[0]\n";
+ $file[0] =~ s/.t$/.html/;
+ return ("<a href=\"$file[0]\">$_</a>");
} else {
warn "Unable to link $_\n";
return ( "<em>$_</em>");
# Translate HTML special characters into escape sequences
sub htmlify {
- local($_) = @_;
+ local ($_) = @_;
s/^\"(.*)\"$/$1/;
s/\\&//g; # a nothing character
s/\&/&/g;
s/\>/>/g;
while (@a = /(\\\*Q)([A-Za-z0-9\-\.]+)(\\\*U)/) {
/(\\\*Q)([A-Za-z\-]+)(\\\*U)/;
- $_ = $` . &anchor($a[2]) . $';
+ $_ = $` . &anchor($a[1]) . $';
}
while (@a = /(\\\*Q)(\"info )([A-Za-z0-9\-\.]+)(\\\*U)/) {
/(\\\*Q)(\"info )([\w\-\.]+)(\\\*U)/;
- $_ = $` . "\"info " . &anchor($a[3]) . $';
+ $_ = $` . "\"info " . &anchor($a[2]) . $';
}
while (@a = /(\"info )([A-Za-z0-9\-\.]+)/) {
/(\"info )([\w\-\.]+)/;
- $_ = $` . "\"info " . &anchor($a[2]) . $';
+ $_ = $` . "\"info " . &anchor($a[1]) . $';
}
s/\\\*Q/<em>/g;
s/\\\*U/<\/em>/g;
# flush_subj Print a row of Subjects to TOP
# error Print an integrity error to STDERR and exit with code 1.
+use strict;
+use warnings;
+
+our (@dirs, $dir, $filename, %filedir, @Subjects, $type, %desc, %level);
+our (%see_also, %subject, %largest, $subj, @rowsubj, @colsubj, @subj);
+
eval("require 5"); # Test for perl version 5
die "info.pl requires version 5 of perl.\n" if $@;
# Create %subject from %see_also
sub parse_see_also {
- local (@see_also) = split(/, /, $see_also{$filename});
+ my (@see_also) = split(/, /, $see_also{$filename});
local ($dir) = $filedir{$filename};
- local ($found); # Does this item belong to any Subject?
+ my ($found); # Does this item belong to any Subject?
for (@see_also) {
if (!(defined $filedir{$_})) { # is this entry a subject?
# Add a new entry to %subject and possibly to %largest
sub set_subject {
$subject{$_}{$dir} .= "$filename\n";
+ $largest{$_} = "" unless defined $largest{$_};
$largest{$_} = $filename if length $filename > length $largest{$_};
$largest{$_} = $dir if length $dir > length $largest{$_};
}
$subj eq 'TOP' || grep (/^$subj$/, @rowsubj);
}
- for $i (0..2) {
- for ($j = $i; $j <= $#rowsubj; $j += 3) {
+ my $k = 0;
+ for my $i (0..2) {
+ for (my $j = $i; $j <= $#rowsubj; $j += 3) {
$colsubj[$j] = $rowsubj[$k++];
}
}
# Print an integrity error message and exit with code 1
sub error {
- local ($error) = @_;
+ my ($error) = @_;
print STDERR "Error on line $. of $filedir{$filename}/$filename.t:\n";
print STDERR "$_";
#!/usr/local/bin/perl
+use strict;
+use warnings;
+
printf("<pre>\n");
while (<>) {
s/([\w\.\-]+)\.html/<a href=\"$1.html\">$1<\/a>/g;
#!/usr/local/bin/perl
+use strict;
+use warnings;
-$[ = 1; # set array base to 1
-$dome = 0;
+my $dome = 0;
+my (@Fld, $str, @a);
line: while (<>) {
chop; # strip record separator
procline:
if (/^\.TH/) {
- $str=$Fld[3];
- for ($i=4;$i <= $#Fld; $i++) {
+ $str=$Fld[2];
+ for (my $i=3; $i <= $#Fld; $i++) {
$str .= " " . $Fld[$i];
}
$str = &htmlify($str);
printf("<title>%s : %s</title><h1>%s : %s</h1>\n",
- $Fld[2],$str,$Fld[2], $str);
+ $Fld[1], $str, $Fld[1], $str);
next line;
}
- if (/^\.SY/) {
+ if (/^\.SY../) {
# $i = $_ =~ "\"" && ($RLENGTH = length($&), $RSTART = length($`)+1);
# $str = substr($_, $i + 1, length($_) - $i - 1);
$str = substr($_,5);
next line;
}
- if (/^\.EX/) {
+ if (/^\.EX../) {
$str = substr($_, 5);
printf "<br><samp>[##:##] </samp><kbd>%s</kbd><p>\n", &htmlify($str);
next line;
if (/^\.L/) {
@a = split('[: ",.]+');
- $str = &anchor($a[3]);
- $str = ("$str $a[4]");
+ $str = &anchor($a[2]);
+ $str = ("$str $a[3]") if defined $a[3];
printf("<br>%s\n", $str);
next line;
}
if ($dome == 1) {
@a = split('[: ",.]+');
- for ($i = 2; $i <= $#a ; ($i)++) {
+ for (my $i = 1; $i <= $#a ; ($i)++) {
printf("%s",&anchor($a[$i]));
- for ($j = 0; $j < 20 - length($a[$i]); $j++) {
+ for (my $j = 0; $j < 20 - length($a[$i]); $j++) {
printf(" ");
}
}
@a = split('[: ,.]+');
@Fld = split(' ', $_, 9999);
if (/^\./) { goto procline; }
- for ($i = 2; $i <= $#a ; ($i)++) {
+ for (my $i = 1; $i <= $#a ; ($i)++) {
printf("%s",&anchor($a[$i]));
- for ($j = 0; $j < 20 - length($a[$i]); $j++) {
+ for (my $j = 0; $j < 20 - length($a[$i]); $j++) {
printf(" ");
}
}
if (/^\.SA/) {
@a = split('[: ",.]+');
- printf("See also : %s\n",&anchor($a[3]) );
- for ($i = 4; $i <= $#a ; ($i)++) {
+ printf("See also : %s\n",&anchor($a[2]) );
+ for (my $i = 3; $i <= $#a ; ($i)++) {
printf(", %s\n",&anchor($a[$i]));
}
@a = split('[: ,.]+');
@Fld = split(' ', $_, 9999);
if (/^\./) { goto procline; }
- for ($i = 1; $i <= $#a ; ($i)++) {
+ for (my $i = 0; $i <= $#a ; ($i)++) {
printf(", %s\n",&anchor($a[$i]));
}
}
if (/^(See also|See Also|see also)/) {
@a = split('[: ,.]+');
- printf("See also : %s\n",&anchor($a[3]) );
- for ($i = 4; $i <= $#a ; ($i)++) {
+ printf("See also : %s\n",&anchor($a[2]) );
+ for (my $i = 3; $i <= $#a ; ($i)++) {
printf(", %s\n",&anchor($a[$i]));
}
@a = split('[: ,.]+');
@Fld = split(' ', $_, 9999);
if (/^\./) { goto procline; }
- for ($i = 1; $i <= $#a ; ($i)++) {
+ for (my $i = 0; $i <= $#a ; ($i)++) {
printf(", %s\n",&anchor($a[$i]));
}
}
#}
sub anchor {
- local($_) = @_;
- local(@file,$file);
+ local ($_) = @_;
+ my (@file, $file);
$file = $_ . ".t";
# if (-r $file) {
if (1) {
} else {
@file = <$_*t>;
if (@file) {
- warn "Expanding $_ to $file[$[]\n";
- $file[$[] =~ s/.t$/.html/;
- return ("<a href=\"$file[$[]\">$_</a>");
+ warn "Expanding $_ to $file[0]\n";
+ $file[0] =~ s/.t$/.html/;
+ return ("<a href=\"$file[0]\">$_</a>");
} else {
warn "Unable to link $_\n";
return ( "<em>$_</em>");
s/\>/>/g;
while (@a = /(\\\*Q)([A-Za-z0-9\-\.]+)(\\\*U)/) {
/(\\\*Q)([A-Za-z\-]+)(\\\*U)/;
- $_ = $` . &anchor($a[2]) . $';
+ $_ = $` . &anchor($a[1]) . $';
}
while (@a = /(\\\*Q)(\"info )([A-Za-z0-9\-\.]+)(\\\*U)/) {
/(\\\*Q)(\"info )([\w\-\.]+)(\\\*U)/;
- $_ = $` . "\"info " . &anchor($a[3]) . $';
+ $_ = $` . "\"info " . &anchor($a[2]) . $';
}
while (@a = /(\"info )([A-Za-z0-9\-\.]+)/) {
/(\"info )([\w\-\.]+)/;
- $_ = $` . "\"info " . &anchor($a[2]) . $';
+ $_ = $` . "\"info " . &anchor($a[1]) . $';
}
s/\\\*Q/<em>/g;
s/\\\*U/<\/em>/g;