1998-01-14 05:10:21 +00:00
|
|
|
#! /usr/bin/perl
|
|
|
|
|
1998-01-17 21:27:25 +00:00
|
|
|
# This script makes the generated files used by the describe(1) web
|
|
|
|
# page. It's not pretty, but it works.
|
|
|
|
#
|
|
|
|
# Devin Reade, January 1998.
|
|
|
|
#
|
1999-07-03 16:55:42 +00:00
|
|
|
# $Id: mkgen,v 1.5 1999/07/03 16:55:42 gdr-ftp Exp $
|
1998-01-17 21:27:25 +00:00
|
|
|
#
|
|
|
|
|
1998-01-14 05:10:21 +00:00
|
|
|
$gnohome_internal = "/home/gno/public_html";
|
1998-04-11 19:08:30 +00:00
|
|
|
$gnohome_external = "http://www.gno.org/~gno";
|
1998-01-14 05:10:21 +00:00
|
|
|
|
1998-01-17 21:27:25 +00:00
|
|
|
$gendir = "describe/gen"; # relative to $gnohome_*
|
1998-01-14 05:10:21 +00:00
|
|
|
$entrydir = "describe/entry"; # relative to $gnohome_*
|
1998-01-17 21:27:25 +00:00
|
|
|
$basedir = $gnohome_internal . '/' . $gendir;
|
|
|
|
|
|
|
|
$headinfo =
|
|
|
|
'<!-- This page is auto-generated -->' . "\n" .
|
|
|
|
'<META name="description" content="List of Utilities for GNO/ME">' . "\n".
|
|
|
|
'<META name="keywords" content="Apple IIgs ORCA/Shell James Brookes">'
|
|
|
|
. "\n".
|
|
|
|
'<BASE HREF="http://www.gno.org/">'. "\n";
|
|
|
|
$bodyinfo =
|
|
|
|
'<BODY background="icons/bluebg.jpg" text="#000000" bgcolor="#00C0FF"'.
|
|
|
|
' link="#0000FF" alink="#001177" vlink="#001177">' . "\n";
|
|
|
|
$tailinfo =
|
|
|
|
'<hr>' . "\n" .
|
|
|
|
'Comments on this page should be forwarded to Devin Reade at' . "\n" .
|
1999-01-29 07:03:57 +00:00
|
|
|
'<A HREF="mailto:gdr@trenco.gno.org">gdr@trenco.gno.org</A>' . "\n" .
|
1998-01-17 21:27:25 +00:00
|
|
|
'<p>' . "\n" .
|
|
|
|
'<img alt="Apple II Viewable Page" height=31 width=88 border=0' . "\n" .
|
1999-01-29 07:03:57 +00:00
|
|
|
'src="icons/a2viewable.gif">' . "\n" .
|
1998-01-17 21:27:25 +00:00
|
|
|
'<br>' . "\n" .
|
|
|
|
'</body>' . "\n" .
|
|
|
|
'</html>';
|
|
|
|
|
|
|
|
$categoryMap{""} = "";
|
|
|
|
$categoryMap{"gno/archive"} = "archive";
|
|
|
|
$categoryMap{"gno/comm"} = "comm";
|
1999-01-29 07:03:57 +00:00
|
|
|
$categoryMap{"gno/crypto"} = "crypto";
|
1998-01-17 21:27:25 +00:00
|
|
|
$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";
|
1999-07-03 16:55:42 +00:00
|
|
|
$categoryMap{"gno/productivity"} = "productivity";
|
1998-01-17 21:27:25 +00:00
|
|
|
$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";
|
1999-01-29 07:03:57 +00:00
|
|
|
$categoryNames{"crypto"} = "Cryptography";
|
1998-01-17 21:27:25 +00:00
|
|
|
$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";
|
1999-07-03 16:55:42 +00:00
|
|
|
$categoryNames{"productivity"} = "Productivity";
|
1998-01-17 21:27:25 +00:00
|
|
|
$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";
|
1998-01-14 05:10:21 +00:00
|
|
|
|
|
|
|
while (<>) {
|
|
|
|
($name, $classes) = split;
|
|
|
|
$namelist{$name} = $classes;
|
|
|
|
}
|
|
|
|
|
|
|
|
@keylist = keys(%namelist);
|
|
|
|
@sorted = sort(@keylist);
|
|
|
|
$currentLetter = '';
|
|
|
|
|
|
|
|
foreach $f (@sorted) {
|
1998-01-17 21:27:25 +00:00
|
|
|
|
1998-01-14 05:10:21 +00:00
|
|
|
# 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
|
|
|
|
"<html>\n" .
|
|
|
|
"<head>\n" .
|
1998-01-17 21:27:25 +00:00
|
|
|
"<title>Apple IIgs Describe Database -- %s</title>\n" .
|
|
|
|
"</head>%s" .
|
1998-01-14 05:10:21 +00:00
|
|
|
"<body bgcolor=#ffffff>\n" .
|
1998-01-17 21:27:25 +00:00
|
|
|
"<h1>Describe Entry for %s</h1>\n" .
|
|
|
|
"<pre>\n",
|
|
|
|
$f, $headinfo, $f);
|
1998-01-14 05:10:21 +00:00
|
|
|
while($_ = <pp>) {
|
|
|
|
printf(fp2 "%s", $_);
|
|
|
|
}
|
1998-01-17 21:27:25 +00:00
|
|
|
printf(fp2 "</pre>\n%s\n", $tailinfo);
|
1998-01-14 05:10:21 +00:00
|
|
|
close(fp2);
|
|
|
|
close(pp);
|
|
|
|
|
|
|
|
# make the index-by-name page
|
|
|
|
$l = substr($f, 0, 1);
|
|
|
|
if ($l ne $currentLetter) {
|
|
|
|
($currentLetter eq '') ||
|
1998-01-17 21:27:25 +00:00
|
|
|
(printf(fp "</ul>%s\n", $tailinfo) && close(fp));
|
1998-01-14 05:10:21 +00:00
|
|
|
$filename = $basedir . '/' . $l . '.html';
|
|
|
|
open(fp, "> $filename") || die("couldn't open $filename");
|
|
|
|
$currentLetter = $l;
|
|
|
|
$cap = $l;
|
|
|
|
$cap =~ tr/a-z/A-Z/;
|
|
|
|
printf(fp
|
|
|
|
"<html>\n" .
|
|
|
|
"<head>\n" .
|
1998-01-17 21:27:25 +00:00
|
|
|
"<title>Apple IIgs Describe Database -- Index by %s</title>\n".
|
|
|
|
"%s\n" .
|
1998-01-14 05:10:21 +00:00
|
|
|
"</head>\n" .
|
1998-01-17 21:27:25 +00:00
|
|
|
"%s\n" .
|
|
|
|
"<h1>Describe Entries by Name: %s</h1>\n" .
|
|
|
|
"<ul>\n",
|
|
|
|
$cap, $headinfo, $bodyinfo, $cap);
|
1998-01-14 05:10:21 +00:00
|
|
|
}
|
|
|
|
printf(fp "<li><A HREF=\"%s/%s/%s.html\">%s</A>\n",
|
|
|
|
$gnohome_external, $entrydir, $f, $f);
|
1998-01-17 21:27:25 +00:00
|
|
|
|
|
|
|
# save the category for later
|
|
|
|
@catlist = split(/:/, $namelist{$f});
|
|
|
|
foreach $catentry (@catlist) {
|
|
|
|
if (!defined($categoryMap{$catentry})) {
|
|
|
|
printf(stderr "WARNING: Unregistered category \"%s\" for %s: " .
|
|
|
|
"skipped\n",
|
|
|
|
$catentry, $f);
|
|
|
|
} elsif ($categoryMap{$catentry} ne '') {
|
|
|
|
$categories{$categoryMap{$catentry}} .= $f . ':';
|
|
|
|
}
|
|
|
|
}
|
1998-01-14 05:10:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
($currentLetter eq '') ||
|
1998-01-17 21:27:25 +00:00
|
|
|
(printf(fp "</ul>\n%s\n", $tailinfo) && close(fp));
|
1998-01-14 05:10:21 +00:00
|
|
|
|
|
|
|
$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
|
|
|
|
"<html>\n" .
|
|
|
|
"<!-- This page is auto-generated -->\n" .
|
|
|
|
"<head>\n" .
|
|
|
|
"<title>Apple IIgs Describe Database -- Index by " . $cap .
|
|
|
|
"</title>\n" .
|
|
|
|
"</head>\n" .
|
|
|
|
"<body bgcolor=#ffffff>\n" .
|
|
|
|
"<H1>Empty Page</H1>\n" .
|
|
|
|
"There are currently no utilities registered that begin ".
|
1998-01-17 21:27:25 +00:00
|
|
|
"with " . $cap . ".<p>%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
|
|
|
|
"<html>\n" .
|
|
|
|
"<head>\n" .
|
|
|
|
"<title>Apple IIgs Describe Database -- By Category</title>\n" .
|
|
|
|
"%s\n" .
|
|
|
|
"</head>\n" .
|
|
|
|
"%s\n",
|
|
|
|
$headinfo, $bodyinfo);
|
|
|
|
if (defined($categoryNames{$k})) {
|
|
|
|
printf(fp
|
|
|
|
"<h1>%s</h1><hr>\n",
|
|
|
|
$categoryNames{$k});
|
|
|
|
} else {
|
|
|
|
printf(stderr "WARNING: No category name for \"%s\"\n", $k);
|
|
|
|
}
|
|
|
|
printf(fp "<ul>\n");
|
|
|
|
@files = sort(split(/:/, $categories{$k}));
|
|
|
|
foreach $f (@files) {
|
|
|
|
printf(fp "<li><A HREF=\"%s/%s/%s.html\">%s</A>\n",
|
|
|
|
$gnohome_external, $entrydir, $f, $f);
|
|
|
|
}
|
|
|
|
printf(fp "</ul>\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
|
|
|
|
"<html>\n" .
|
|
|
|
"<!-- This page is auto-generated -->\n" .
|
|
|
|
"<head>\n" .
|
|
|
|
"<title>Apple IIgs Describe Database -- By Category</title>\n" .
|
|
|
|
"%s\n" .
|
|
|
|
"</head>\n" .
|
|
|
|
"%s\n",
|
|
|
|
$headinfo, $bodyinfo);
|
|
|
|
if (defined($categoryNames{$k})) {
|
|
|
|
printf(fp
|
|
|
|
"<h1>%s</h1><hr>\n",
|
|
|
|
$categoryNames{$k});
|
|
|
|
} else {
|
|
|
|
printf(stderr "WARNING: No category name for \"%s\"\n", $k);
|
|
|
|
}
|
|
|
|
printf(fp
|
|
|
|
"There are currently no <b>describe</b>(1) entries in this ".
|
|
|
|
"category.\n" .
|
|
|
|
"%s\n", $tailinfo);
|
1998-01-14 05:10:21 +00:00
|
|
|
close(fp);
|
|
|
|
}
|
|
|
|
}
|