gno/doc/describe/mkindex
gdr a029903025 Added a "fudge list" for utilities where we know which class(es) they're
in, but that for some reason don't reference the describe database in
the .index.src files.
1998-01-17 21:26:42 +00:00

104 lines
2.8 KiB
Perl
Executable File

#! /usr/bin/perl
# This script makes the index listing used sort describe entries by
# category. It gets most of its information from where utilities
# reside in the GNO ftp hierarchy.
#
# Devin Reade, January 1998
#
# $Id: mkindex,v 1.2 1998/01/17 21:26:42 gdr Exp $
#
$dirroot = "/ftp/pub/apple2/gs.specific";
$dirlist = "gno orca";
# This is a list of describe entries which we want to force into a
# given category. This should only be used when a utility doesn't have
# an entry of its own in the .index.src files as a result of being
# archived with another utility. For example, we fudge "descc" and
# "descu" because they are archived in with "describe".
$fudgelist{"cclean"} = "gno/programming"; # with occ
$fudgelist{"ccprep"} = "gno/programming"; # with occ
$fudgelist{"cjpeg"} = "gno/graphics"; # part of jpeg tools
$fudgelist{"djpeg"} = "gno/graphics"; # part of jpeg tools
$fudgelist{"jpegtran"} = "gno/graphics"; # part of jpeg tools
$fudgelist{"rdjpgcom"} = "gno/graphics"; # part of jpeg tools
$fudgelist{"wrjpgcom"} = "gno/graphics"; # part of jpeg tools
$fudgelist{"descc"} = "gno/doc.utils"; # with describe
$fudgelist{"descu"} = "gno/doc.utils"; # with describe
$fudgelist{"fortune"} = "gno/games"; # resolve fortuna-[abc]
# $fudgelist{""} = "";
#
# Get the list of .index.src files. We will look in here for references
# to the describe database.
#
open(fp, "(cd $dirroot; find $dirlist -name .index.src -print)|") ||
die("couldn't get file list");
@indexfiles = <fp>;
close(fp);
# extract all the program names from the db source file.
while(<>) {
chop;
if (/^Name:\s+(.*)/) {
$name = $1;
$name =~ s/\s+$//;
if ($name =~ /\s+/) {
printf(stderr "%s:%d: Multi-word program name \"%s\". Skipped.\n",
$ARGV, $., $name);
} else {
$name =~ tr/A-Z/a-z/;
$namelist{$name} = ':';
}
}
}
foreach $f (@indexfiles) {
chop($f);
if (open(fp, "$dirroot/$f")) {
$f2 = $f;
$f2 =~ s,/.index.src$,,;
while ($_ = <fp>) {
if (/%%describe%%([^%]+)%%/) {
$ref = $1;
$ref =~ tr/A-Z/a-z/;
if (defined($namelist{$ref})) {
($namelist{$ref} .= "$f2:")
unless ($namelist{$ref} =~ /:$f2:/);
} else {
printf(stderr
"%s/%s:%d: Warning: Reference to program (\"%s\") ".
"not in database. Entry skipped.\n",
$dirroot, $f, $., $ref);
}
}
}
} else {
printf("couldn't open %s/%s: file skipped", $dirroot, $f);
}
}
# print out the results.
@keylist = keys(%namelist);
foreach $k (@keylist) {
$s = $namelist{$k};
if ($s eq ':') {
if (defined($fudgelist{$k})) {
$s = ':' . $fudgelist{$k} . ':';
} else {
$s = ':unsorted:';
}
} elsif (defined($fudgelist{$k})) {
printf(stderr
"WARNING: %s should no longer be in the fudge list\n", $k);
}
printf("%s\t%s\n", $k, $s);
}