]> git.pond.sub.org Git - empserver/blob - info/checklist.pl
Use strict & warnings. Fix several minor bugs uncovered by it.
[empserver] / info / checklist.pl
1 #!/usr/local/bin/perl
2 #
3 # checklist.pl
4 #
5 # By Ken Stevens <children@empire.net>
6 #
7 # HOW TO RUN IT:
8 # In empire, redirect the output of the player "list" command to a file called
9 # "player.list".  Similarly, make a file listing deity commands and call it
10 # deity.list.  Put both these files in this directory, and then run this script
11 # to check which Empire commands need to be documented.
12 #
13
14 use strict;
15 use warnings;
16
17 my ($com, @list, @obsolete, @Commands);
18
19 open(LIST, "<player.list") || die "Can't read player.list\n";
20
21 while(<LIST>) {
22   last if /^  <TYPE>/;
23 }
24
25 while(<LIST>) {
26   last if /^For further info on command syntax see/;
27   $_ = substr($_, 5);
28   ($com) = split;
29   push (@list, $com);
30 }
31 close LIST;
32
33 push(@list, "break");
34
35 open(LIST, "<deity.list") || die "Can't read deity.list\n";
36
37 while(<LIST>) {
38   last if /^  <TYPE>/;
39 }
40
41 while(<LIST>) {
42   last if /^For further info on command syntax see/;
43   $_ = substr($_, 5);
44   ($com) = split;
45   push (@list, $com);
46 }
47 close LIST;
48
49 open(OBSOLETE, "<Subjects/Obsolete.t") ||
50   die "Can't read Subjects/Obsolete.t\n";
51
52 while (<OBSOLETE>) {
53   push(@obsolete, $1) if /^.L (\S+)$/;
54 }
55
56 close OBSOLETE;
57
58 open (LS, "ls Commands|");
59
60 while (<LS>) {    
61   chop;
62   next unless /^(\S+).t/;
63   push(@Commands, $1);
64 }
65 close LS;
66
67 print "In list but not Commands:\n";
68 for my $l (@list) {
69   print "  $l\n" unless grep (/^$l$/, @Commands);
70 }
71 print "In Commands but not list:\n";
72 for my $c (@Commands) {
73   print "  $c\n" unless grep(/^$c$/, @list) || grep(/^$c$/, @obsolete);
74 }