2 # To be invoked in a directory where a tree of XML files of the HELM library is
3 # rooted. This script will then creates INDEX files in all directories of the
6 my $index_fname = "INDEX";
12 sub add_trailing_slash($) {
14 return $dir if ($dir =~ /\/$/);
19 return 1 if ($fname =~ /\.(ind|types|body|var|theory).xml/);
22 my @todo = (getcwd());
23 while (my $dir = shift @todo) {
25 chdir $dir or die "Can't chdir to $dir\n";
26 open LS, 'ls | sed \'s/\\.gz//\' | sort | uniq |';
27 open INDEX, "> $index_fname"
28 or die "Can't open $index_fname in " . getcwd() . "\n";
29 while (my $entry = <LS>) {
32 print INDEX add_trailing_slash($entry) . "\n";
33 push @todo, getcwd() . "/$entry";
35 print INDEX "$entry\n" if indexable($entry);