#! /usr/bin/perl # This script makes the generated files used by the describe(1) web # page. It's not pretty, but it works. # # Devin Reade, January 1998. # # $Id: mkgen,v 1.5 1999/07/03 16:55:42 gdr-ftp Exp $ # $gnohome_internal = "/home/gno/public_html"; $gnohome_external = "http://www.gno.org/~gno"; $gendir = "describe/gen"; # relative to $gnohome_* $entrydir = "describe/entry"; # relative to $gnohome_* $basedir = $gnohome_internal . '/' . $gendir; $headinfo = '' . "\n" . '' . "\n". '' . "\n". ''. "\n"; $bodyinfo = '' . "\n"; $tailinfo = '
' . "\n" . 'Comments on this page should be forwarded to Devin Reade at' . "\n" . 'gdr@trenco.gno.org' . "\n" . '

' . "\n" . 'Apple II Viewable Page' . "\n" . '
' . "\n" . '' . "\n" . ''; $categoryMap{""} = ""; $categoryMap{"gno/archive"} = "archive"; $categoryMap{"gno/comm"} = "comm"; $categoryMap{"gno/crypto"} = "crypto"; $categoryMap{"gno/daemons"} = "daemon"; $categoryMap{"gno/doc.utils"} = "docutil"; $categoryMap{"gno/editors"} = "edit"; $categoryMap{"gno/file.convert"} = "file.convert"; $categoryMap{"gno/file.manip"} = "file.manip"; $categoryMap{"gno/games"} = "games"; $categoryMap{"gno/graphics"} = "graphics"; $categoryMap{"gno/gui"} = "gui"; $categoryMap{"gno/languages"} = "lang"; $categoryMap{"gno/libraries"} = "lib"; $categoryMap{"gno/mail"} = "mail"; $categoryMap{"gno/network"} = "network"; $categoryMap{"gno/news"} = "news"; $categoryMap{"gno/patches"} = "patch"; $categoryMap{"gno/productivity"} = "productivity"; $categoryMap{"gno/programming"} = "prog"; $categoryMap{"gno/scripting"} = "script"; $categoryMap{"gno/shells"} = "shells"; $categoryMap{"gno/sounds"} = "sound"; $categoryMap{"gno/sys"} = "sys"; $categoryMap{"gno/sysadmin"} = "sysadmin"; $categoryMap{"gno/text.utils"} = "text"; $categoryMap{"orca/scripting"} = "script"; $categoryMap{"unsorted"} = "unsorted"; $categoryNames{"archive"} = "Archiving Utilities"; $categoryNames{"comm"} = "Communications Utilities"; $categoryNames{"crypto"} = "Cryptography"; $categoryNames{"daemon"} = "Daemons"; $categoryNames{"docutil"} = "Documentation Utilities"; $categoryNames{"edit"} = "Editors, Word Processors, and Document " . "Viewers"; $categoryNames{"file.convert"} = "File Conversion Utilities"; $categoryNames{"file.manip"} = "File Manipulation Utilities"; $categoryNames{"games"} = "Games"; $categoryNames{"graphics"} = "Graphics Programs"; $categoryNames{"gui"} = "GUI"; $categoryNames{"lang"} = "Programming Languages"; $categoryNames{"lib"} = "Libraries"; $categoryNames{"mail"} = "Mail Readers"; $categoryNames{"network"} = "Networking Utilities"; $categoryNames{"news"} = "News Readers"; $categoryNames{"patch"} = "Patch Programs"; $categoryNames{"productivity"} = "Productivity"; $categoryNames{"prog"} = "Programming Utilities"; $categoryNames{"script"} = "Scripting Utilities"; $categoryNames{"shells"} = "Shells"; $categoryNames{"sound"} = "Sound and Music Utilities"; $categoryNames{"sys"} = "System Utilities"; $categoryNames{"sysadmin"} = "System Administration Utilities"; $categoryNames{"text"} = "Text Manipulation Utilities"; $categoryNames{"unsorted"} = "Utilities Not Yet Sorted"; while (<>) { ($name, $classes) = split; $namelist{$name} = $classes; } @keylist = keys(%namelist); @sorted = sort(@keylist); $currentLetter = ''; foreach $f (@sorted) { # create the describe entry open(pp, "/usr/local/bin/describe $f|") || die ("couldn't open pipe to 'describe $f'"); $filename = "$gnohome_internal/$entrydir/$f.html"; open(fp2, "> $filename") || die("couldn't open $filename"); printf(fp2 "\n" . "\n" . "Apple IIgs Describe Database -- %s\n" . "%s" . "\n" . "

Describe Entry for %s

\n" . "
\n",
	   $f, $headinfo, $f);
    while($_ = ) {
	printf(fp2 "%s", $_);
    }
    printf(fp2 "
\n%s\n", $tailinfo); close(fp2); close(pp); # make the index-by-name page $l = substr($f, 0, 1); if ($l ne $currentLetter) { ($currentLetter eq '') || (printf(fp "%s\n", $tailinfo) && close(fp)); $filename = $basedir . '/' . $l . '.html'; open(fp, "> $filename") || die("couldn't open $filename"); $currentLetter = $l; $cap = $l; $cap =~ tr/a-z/A-Z/; printf(fp "\n" . "\n" . "Apple IIgs Describe Database -- Index by %s\n". "%s\n" . "\n" . "%s\n" . "

Describe Entries by Name: %s

\n" . "\n%s\n", $tailinfo) && close(fp)); $letters = "a b c d e f g h i j k l m n o p q r s t u v w x y z"; @letter = split(/\s+/, $letters); foreach $l (@letter) { $cap = $l; $cap =~ tr/a-z/A-Z/; $filename = "$basedir/$l.html"; if (! -f $filename) { open(fp, "> $filename") || die("couldn't open $filename"); printf(fp "\n" . "\n" . "\n" . "Apple IIgs Describe Database -- Index by " . $cap . "\n" . "\n" . "\n" . "

Empty Page

\n" . "There are currently no utilities registered that begin ". "with " . $cap . ".

%s\n", $tailinfo); close(fp); } } # # Now do them by category # @catkeys = keys(%categories); foreach $k (@catkeys) { $file = $basedir . '/' . $k . '.html'; open(fp, "> $basedir/$k.html") || die("could not open $basedir/$k.html"); printf(fp "\n" . "\n" . "Apple IIgs Describe Database -- By Category\n" . "%s\n" . "\n" . "%s\n", $headinfo, $bodyinfo); if (defined($categoryNames{$k})) { printf(fp "

%s


\n", $categoryNames{$k}); } else { printf(stderr "WARNING: No category name for \"%s\"\n", $k); } printf(fp "\n%s\n", $tailinfo); close(fp); } # make category pages for which there is no entry @catkeys = values(%categoryMap); foreach $k (@catkeys) { $filename = $basedir . "/" . $k . '.html'; if (! -f $filename) { open(fp, ">$filename") || die("couldn't open $filename: $!"); printf(fp "\n" . "\n" . "\n" . "Apple IIgs Describe Database -- By Category\n" . "%s\n" . "\n" . "%s\n", $headinfo, $bodyinfo); if (defined($categoryNames{$k})) { printf(fp "

%s


\n", $categoryNames{$k}); } else { printf(stderr "WARNING: No category name for \"%s\"\n", $k); } printf(fp "There are currently no describe(1) entries in this ". "category.\n" . "%s\n", $tailinfo); close(fp); } }