head	1.15;
access;
symbols
	v1_0:1.1.1.1
	JFIEBER:1.1.1;
locks; strict;
comment	@# @;


1.15
date	98.08.04.17.24.03;	author wosch;	state dead;
branches;
next	1.14;

1.14
date	98.06.10.15.52.30;	author wosch;	state Exp;
branches;
next	1.13;

1.13
date	98.05.16.06.13.27;	author wosch;	state Exp;
branches;
next	1.12;

1.12
date	98.04.01.18.32.43;	author wosch;	state Exp;
branches;
next	1.11;

1.11
date	97.10.24.13.07.44;	author jfieber;	state Exp;
branches;
next	1.10;

1.10
date	97.10.24.03.51.37;	author jfieber;	state Exp;
branches;
next	1.9;

1.9
date	97.10.24.00.21.11;	author jkh;	state Exp;
branches;
next	1.8;

1.8
date	97.09.08.20.17.48;	author wosch;	state Exp;
branches;
next	1.7;

1.7
date	97.08.27.14.45.07;	author jfieber;	state Exp;
branches;
next	1.6;

1.6
date	97.08.25.13.54.07;	author max;	state Exp;
branches;
next	1.5;

1.5
date	97.06.10.12.17.05;	author jfieber;	state Exp;
branches;
next	1.4;

1.4
date	97.04.25.13.44.50;	author wosch;	state Exp;
branches;
next	1.3;

1.3
date	97.02.04.15.28.45;	author jfieber;	state Exp;
branches;
next	1.2;

1.2
date	97.02.04.15.17.47;	author jfieber;	state Exp;
branches;
next	1.1;

1.1
date	96.09.24.17.45.46;	author jfieber;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	96.09.24.17.45.46;	author jfieber;	state Exp;
branches;
next	;


desc
@@


1.15
log
@The  repository copy www/data  -> www/en is done.
@
text
@#!/usr/bin/perl

# convert a ports INDEX file to HTML
#
# by John Fieber <jfieber@@freebsd.org>
# Mon May 13 10:31:58 EST 1996

############################################################

# This is the base of where we ftp stuff from
$base = "ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current";
$baseHTTP = "http://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current";
$urlcgi = 'http://www.freebsd.org/cgi/url.cgi';
$packagesURL = 'ftp://ftp.freebsd.org/pub/FreeBSD/packages-stable/All/';

# better layout and link to the sources
if ($urlcgi) {
    $baseHTTP = $urlcgi . '?' . $baseHTTP;
}

$today = &getdate;

&packages_exist('packages.exists', *packages);
&main;

sub getdate {
    @@months = ("January", "February", "March", "April", "May","June",
	       "July", "August", "September", "October", "November", "December");
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
    $year += 1900;
    return "Updated $months[$mon] $mday, $year";
}

sub header {
    local ($fh, $htext) = @@_;
    print $fh "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 3.2//EN\" [\n";
    print $fh "<!ENTITY base CDATA '..'>";
    print $fh "<!ENTITY date  \"<em>$today</em>\">\n";
    print $fh "<!ENTITY title '$htext'>";
    print $fh "<!ENTITY blurb  SYSTEM \"ports.inc\">\n";
    print $fh "<!ENTITY % includes SYSTEM \"../includes.sgml\">\n";
    print $fh "<!ENTITY email 'ports'>";
    print $fh "%includes;\n";
    print $fh "]>\n";
    print $fh "<html>&header;\n";
}

sub footer {
    local ($fh, $ftext) = @@_;
    print $fh "\n$ftext\n";
    print $fh "&footer;\n";
    print $fh "</BODY>\n</HTML>\n";
}

sub packages_exist {
    local($file, *p) = @@_;

    open(P, $file) || do {
	warn "open $file: $!\n";
	warn "Cannot create packages links\n";
	return 1;
    };

    while(<P>) {
	chop;
	$p{$_} = 1;
    }
    close P;
    return 0;
}

sub main {

    $sep = "<B>:</B>";

    while (<>) {
	chop;
	s/&/&amp;/g;
    	s/</&lt;/g;
    	s/>/&gt;/g;

    	# Read a record
	($name, $loc, $prefix, $desc, $ldesc, $owner, $cats, 
	    $keys, $bdep, $rdep) = split('\|');

	# Check for double hyphens in the name (--).
	$name =~ s/--/-/g;

    	# Split the categories into an array
	@@cat = split("[ \t]+", $cats);

    	$catkey{$name} = $cat[0];

	foreach $i (@@cat) {

	    $stats{$i}++;

    	    # figure out the FTP url
	    $loc =~ s/\/usr/$base/;
	    $ldesc =~ s/\/usr/$baseHTTP/;

    	    # The name description and maintainer
	    $data{$i} .= "<DT><B><A NAME=\"$name\"></A><A HREF=\"$loc.tar\">$name</A></B> ";
     

	    $data{$i} .= "<DD>$desc<BR><A HREF=\"$ldesc\">Long description</A>";
	    if ($packages{"$name.tgz"}) { 
		$data{$i} .= qq{ | <a href="$packagesURL$name.tgz">Package</a>};
	    }

    	    $ownerurl = $owner;
    	    $ownerurl =~ s/&lt;/</g;
    	    $owenrurl =~ s/&gt;/>/g;
	    $data{$i} .= 
		"<BR><I>Maintained by:</I> <A HREF=\"mailto:$ownerurl\">$owner</A>";

    	    # If there are any dependencies, list them
    	    if ($bdep ne "" || $rdep ne "") {
    	    	$data{$i} .= "<BR><I>Requires:</I> ";
    	    	@@dep = split(/ /, "$bdep $rdep");
    	    	foreach $j (@@dep) {
    	    	    $data{$i} .= " <A HREF=\"##$j##.html#$j\">$j</A>,";
    	    	}
    	    	# remove the trailing comma
    	    	chop $data{$i};
    	    }

    	    # If the port is listed in more than one category, throw
    	    # in some cross references
    	    if ($#cat > 0) {
    	    	$data{$i} .= "<BR><EM>Also listed in:</EM> ";
    	    	foreach $j (@@cat) {
    	    	    if ($j ne $i) {
			if ($j eq $cat[0]) {
			    $data{$i} .= " <STRONG><A HREF=\"$j.html#$name\">\u$j</A></STRONG>,";
			}
			else {
			    $data{$i} .= " <A HREF=\"$j.html#$name\">\u$j</A>,";
			}
    	    	    }
    	    	}
    	    	# remove the trailing comma
    	    	chop($data{$i});
    	    }
    	    $data{$i} .= "<P></P></DD>\n"
	}

    	# Add an entry to the master index
    	$master[$portnumber] = 
    	    "<!-- $name --><STRONG><A HREF=\"$cat[0].html#$name\">$name</A></STRONG> " .
    	    " -- <EM>$desc</EM><BR>\n";
	$portnumber++;
    }

    open(MOUTF, ">index.sgml");

    &header(MOUTF, "FreeBSD Ports");
#    print MOUTF "<!--#include virtual=\"./ports.inc\" -->\n";
    print MOUTF "&blurb;";
    print MOUTF "<hr><P>There are currently $portnumber ports in the
FreeBSD Ports Collection.<br> <A HREF=\"$base/ports.tar.gz\">Download
a gzip'd tar file of all $portnumber ports</A> (about 4 megabytes) or
browse the following categories:\n";

    print MOUTF "<UL>\n";

    @@foos = sort(keys %stats);
    foreach $key  (@@foos) {
	# For the master file...
	print MOUTF 
	    "<LI><A HREF=\"$key.html\">\u$key</A> <em>($stats{$key})</em></LI>";

	# Create the category file
	open(OUTF, ">$key.sgml");
	&header(OUTF, "FreeBSD Ports: \u$key");
	print OUTF "<DL>\n";
	$d = join("\n", sort(split(/\n/, $data{$key})));
    	$d =~ s/##([^#]*)##/$catkey{$1}/g;
	print OUTF $d;
	print OUTF "</DL>\n";
	&footer(OUTF, "<HR><A HREF=\"index.html\">Port Categories</A>" .
	    " -- <A HREF=\"master-index.html\">Index</A><HR>");
	close(OUTF);

    }
    print MOUTF "</UL>\n";
    print MOUTF 
    	"<UL><LI><A HREF=\"master-index.html\">Alphabetical list of all $portnumber ports</A></LI></UL>\n";
    &footer(MOUTF, "");
    close(MOUTF);

    # Create the master index file
    open(MINDEX, ">master-index.sgml");
    &header(MINDEX, "FreeBSD Ports Collection Index");
    print MINDEX "<P>\n";
    print MINDEX sort @@master;
    print MINDEX "</P>";
    &footer(MINDEX, "<HR><A HREF=\"index.html\">Port Categories</A><HR>");
    close(MINDEX);

}
@


1.14
log
@Print link to packages like in /cgi/ports.cgi
@
text
@@


1.13
log
@Change email in footer from questions to ports.
@
text
@d14 1
d23 1
d55 17
d104 7
a110 1
	    $data{$i} .= "<DD>$desc<BR><I><A HREF=\"$ldesc\">Long description</A></I>";
@


1.12
log
@Use url.cgi for the description link.
@
text
@d40 1
@


1.11
log
@Restore the link to the compressed ports collection.
@
text
@d13 6
@


1.10
log
@Wcarchive is not currently supporting on-the-fly compression, so chop
the .gz from the URLs.  Update the size estimate of the whole collection
to reflect the uncompressed size.
@
text
@d129 2
a130 2
FreeBSD Ports Collection.<br> <A HREF=\"$base/ports.tar\">Download
a tar file of all $portnumber ports</A> (about 22 megabytes) or
@


1.9
log
@3MB -> 4MB.
@
text
@d77 1
a77 1
	    $data{$i} .= "<DT><B><A NAME=\"$name\"></A><A HREF=\"$loc.tar.gz\">$name</A></B> ";
d129 2
a130 2
FreeBSD Ports Collection.<br> <A HREF=\"$base/ports.tar.gz\">Download
a gzip'd tar file of all $portnumber ports</A> (about 4 megabytes) or
@


1.8
log
@Minor english syntax error.

Submitted by:  "Richard M. Neswold" <rneswold@@mcs.net>
@
text
@d130 1
a130 1
a gzip'd tar file of all $portnumber ports</A> (about 3 megabytes) or
@


1.7
log
@Handle rogue double hyphens in package names of ports with
build options, such as paper size in a2ps, that apparently
have a null default.
@
text
@d128 1
a128 1
    print MOUTF "<hr><P>There are currently $portnumber ports is the
@


1.6
log
@Add $Id$.
Requested by:	the Japanese Documentation Project
@
text
@a6 1
# $Id$
d59 3
@


1.5
log
@Small tweakes to make this work better with the new "look and feel"
of the web site.
@
text
@d7 1
@


1.4
log
@Make HTTP links to the `Long description' file. A ftp connection for a
short single file is an overkill and slow.

Reviewed by:	John Fieber
@
text
@d125 1
a125 1
    print MOUTF "<hr noshade><P>There are currently $portnumber ports is the
d146 2
a147 2
	&footer(OUTF, "<HR NOSHADE><A HREF=\"index.html\">Port Categories</A>" .
	    " -- <A HREF=\"master-index.html\">Index</A>");
d163 1
a163 1
    &footer(MINDEX, "<HR NOSHADE><A HREF=\"index.html\">Port Categories</A>");
@


1.3
log
@Render the primary category as bold in cross reference listings.
@
text
@d12 1
d71 1
a71 1
	    $ldesc =~ s/\/usr/$base/;
@


1.2
log
@Fix an embarassing off-by-one bug that prevented "Also listed in"
cross references from being generated for ports with exactly two
categories.

Added a couple comments and changed the output format slightly.
@
text
@d98 6
a103 1
    	    	    	$data{$i} .= " <A HREF=\"$j.html#$name\">\u$j</A>,";
@


1.1
log
@Initial revision
@
text
@d47 2
d51 1
d55 1
d59 2
a60 1
	@@cat = split(" ", $cats);
a63 2
	$sep = "<B>:</B>";

a69 1
#	    $loc =~ s/\/$name$//;
d73 2
a74 1
	    $data{$i} .= "<DT><B><A NAME=\"$name\">$name</A></B> <DD>$desc<BR>";
d79 1
a79 1
		"<I>Maintained by:</I> <A HREF=\"mailto:$ownerurl\">$owner</A><BR>";
d83 1
a83 1
    	    	$data{$i} .= "<I>Requires:</I> ";
a89 1
    	    	$data{$i} .= "<BR>";
a91 5
    	    # Links for browsing and downloading
	    $data{$i} .= "<A HREF=\"$ldesc\">Description</A> $sep ";
	    $data{$i} .= "<A HREF=\"$loc\">Browse</A> $sep ";
	    $data{$i} .= "<A HREF=\"$loc.tar.gz\">Download</A>";

d94 1
a94 1
    	    if ($#cat > 1) {
d98 1
a98 1
    	    	    	$data{$i} .= " <A HREF=\"$j.html\">\u$j</A>,";
d119 1
a119 1
    print MOUTF "<hr><P>There are currently $portnumber ports is the
d121 1
a121 1
a gzip'd tar file of all $portnumber ports</A> (about 2 megabytes) or
d140 1
a140 1
	&footer(OUTF, "<HR><A HREF=\"index.html\">Port Categories</A>" .
d157 1
a157 1
    &footer(MINDEX, "<HR><A HREF=\"index.html\">Port Categories</A>");
@


1.1.1.1
log
@Web pages, may I introduce you to CVS.  CVS, these are the web pages.

Yes, this is supposed to be a new top level in the repository.

For the moment any changes to this area must be cleared by myself
or Jordan.  Once the kinks are worked out, the policy will probably
be relaxed.
@
text
@@
