#! /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.3 1999/04/05 19:56:02 gdr-ftp 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{"newuserv"} = "gno/sysadmin"; # with newuser # $fudgelist{""} = ""; # Actually, another possibility is that the file is not up for ftp in the # pre-packaged directories, but is rather part of the GNO base distribution. $fudgelist{"aroff"} = "gno/doc.utils"; $fudgelist{"asml"} = "gno/programming"; $fudgelist{"assemble"} = "gno/programming"; $fudgelist{"aw30"} = "gno/doc.utils"; $fudgelist{"binprint"} = "gno/editors"; $fudgelist{"blist"} = "gno/editors"; $fudgelist{"cal"} = "gno/games"; $fudgelist{"cat"} = "gno/editors"; $fudgelist{"chtyp"} = "gno/file.manip"; $fudgelist{"cksum"} = "gno/archive"; $fudgelist{"cmp"} = "gno/text.utils"; $fudgelist{"cmpl"} = "gno/programming"; $fudgelist{"colcrt"} = "gno/doc.utils"; $fudgelist{"compile"} = "gno/programming"; $fudgelist{"ctags"} = "gno/programming"; $fudgelist{"cu"} = "gno/network"; $fudgelist{"df"} = "gno/sys"; $fudgelist{"dial"} = "gno/network"; $fudgelist{"duplex"} = "gno/network"; $fudgelist{"eps"} = "gno/sys"; $fudgelist{"expr"} = "gno/scripting"; $fudgelist{"false"} = "gno/scripting"; $fudgelist{"fmt"} = "gno/editors"; $fudgelist{"ftp"} = "gno/network"; $fudgelist{"gsh"} = "gno/shells"; $fudgelist{"head"} = "gno/editors"; $fudgelist{"help"} = "gno/doc.utils"; $fudgelist{"inetd"} = "gno/network"; $fudgelist{"init"} = "gno/daemons"; $fudgelist{"kill"} = "gno/sys"; $fudgelist{"link"} = "gno/programming"; $fudgelist{"list"} = "gno/doc.utils"; $fudgelist{"logger"} = "gno/scripting"; $fudgelist{"login"} = "gno/daemons"; $fudgelist{"lseg"} = "gno/programming"; $fudgelist{"mkfs"} = "gno/sysadmin"; $fudgelist{"mkso"} = "gno/sysadmin"; $fudgelist{"phone"} = "gno/mail"; $fudgelist{"pwd"} = "gno/sys"; $fudgelist{"rcp"} = "gno/network"; $fudgelist{"remote"} = "gno/network"; $fudgelist{"removerez"} = "gno/file.convert"; $fudgelist{"rlogin"} = "gno/network"; $fudgelist{"rsh"} = "gno/network"; $fudgelist{"rtf2text"} = "gno/file.convert"; # # 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 = ; 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 ($_ = ) { 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); }