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.
This commit is contained in:
parent
4484dc9f35
commit
d9673d368a
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=1120
2 changed files with 32 additions and 38 deletions
|
@ -44,61 +44,58 @@ sub footer {
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
|
|
||||||
|
$sep = "<B>:</B>";
|
||||||
|
|
||||||
while (<>) {
|
while (<>) {
|
||||||
chop;
|
chop;
|
||||||
|
s/&/&/g;
|
||||||
s/</</g;
|
s/</</g;
|
||||||
s/>/>/g;
|
s/>/>/g;
|
||||||
|
|
||||||
|
# Read a record
|
||||||
($name, $loc, $prefix, $desc, $ldesc, $owner, $cats,
|
($name, $loc, $prefix, $desc, $ldesc, $owner, $cats,
|
||||||
$keys, $bdep, $rdep) = split('\|');
|
$keys, $bdep, $rdep) = split('\|');
|
||||||
|
|
||||||
@cat = split(" ", $cats);
|
# Split the categories into an array
|
||||||
|
@cat = split("[ \t]+", $cats);
|
||||||
|
|
||||||
$catkey{$name} = $cat[0];
|
$catkey{$name} = $cat[0];
|
||||||
|
|
||||||
$sep = "<B>:</B>";
|
|
||||||
|
|
||||||
foreach $i (@cat) {
|
foreach $i (@cat) {
|
||||||
|
|
||||||
$stats{$i}++;
|
$stats{$i}++;
|
||||||
|
|
||||||
# figure out the FTP url
|
# figure out the FTP url
|
||||||
$loc =~ s/\/usr/$base/;
|
$loc =~ s/\/usr/$base/;
|
||||||
# $loc =~ s/\/$name$//;
|
|
||||||
$ldesc =~ s/\/usr/$base/;
|
$ldesc =~ s/\/usr/$base/;
|
||||||
|
|
||||||
# The name description and maintainer
|
# The name description and maintainer
|
||||||
$data{$i} .= "<DT><B><A NAME=\"$name\">$name</A></B> <DD>$desc<BR>";
|
$data{$i} .= "<DT><B><A NAME=\"$name\"></A><A HREF=\"$loc.tar.gz\">$name</A></B> ";
|
||||||
|
$data{$i} .= "<DD>$desc<BR><I><A HREF=\"$ldesc\">Long description</A></I>";
|
||||||
$ownerurl = $owner;
|
$ownerurl = $owner;
|
||||||
$ownerurl =~ s/</</g;
|
$ownerurl =~ s/</</g;
|
||||||
$owenrurl =~ s/>/>/g;
|
$owenrurl =~ s/>/>/g;
|
||||||
$data{$i} .=
|
$data{$i} .=
|
||||||
"<I>Maintained by:</I> <A HREF=\"mailto:$ownerurl\">$owner</A><BR>";
|
"<BR><I>Maintained by:</I> <A HREF=\"mailto:$ownerurl\">$owner</A>";
|
||||||
|
|
||||||
# If there are any dependencies, list them
|
# If there are any dependencies, list them
|
||||||
if ($bdep ne "" || $rdep ne "") {
|
if ($bdep ne "" || $rdep ne "") {
|
||||||
$data{$i} .= "<I>Requires:</I> ";
|
$data{$i} .= "<BR><I>Requires:</I> ";
|
||||||
@dep = split(/ /, "$bdep $rdep");
|
@dep = split(/ /, "$bdep $rdep");
|
||||||
foreach $j (@dep) {
|
foreach $j (@dep) {
|
||||||
$data{$i} .= " <A HREF=\"##$j##.html#$j\">$j</A>,";
|
$data{$i} .= " <A HREF=\"##$j##.html#$j\">$j</A>,";
|
||||||
}
|
}
|
||||||
# remove the trailing comma
|
# remove the trailing comma
|
||||||
chop $data{$i};
|
chop $data{$i};
|
||||||
$data{$i} .= "<BR>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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>";
|
|
||||||
|
|
||||||
# If the port is listed in more than one category, throw
|
# If the port is listed in more than one category, throw
|
||||||
# in some cross references
|
# in some cross references
|
||||||
if ($#cat > 1) {
|
if ($#cat > 0) {
|
||||||
$data{$i} .= "<BR><EM>Also listed in:</EM> ";
|
$data{$i} .= "<BR><EM>Also listed in:</EM> ";
|
||||||
foreach $j (@cat) {
|
foreach $j (@cat) {
|
||||||
if ($j ne $i) {
|
if ($j ne $i) {
|
||||||
$data{$i} .= " <A HREF=\"$j.html\">\u$j</A>,";
|
$data{$i} .= " <A HREF=\"$j.html#$name\">\u$j</A>,";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# remove the trailing comma
|
# remove the trailing comma
|
||||||
|
@ -119,9 +116,9 @@ sub main {
|
||||||
&header(MOUTF, "FreeBSD Ports");
|
&header(MOUTF, "FreeBSD Ports");
|
||||||
# print MOUTF "<!--#include virtual=\"./ports.inc\" -->\n";
|
# print MOUTF "<!--#include virtual=\"./ports.inc\" -->\n";
|
||||||
print MOUTF "&blurb;";
|
print MOUTF "&blurb;";
|
||||||
print MOUTF "<hr><P>There are currently $portnumber ports is the
|
print MOUTF "<hr noshade><P>There are currently $portnumber ports is the
|
||||||
FreeBSD Ports Collection.<br> <A HREF=\"$base/ports.tar.gz\">Download
|
FreeBSD Ports Collection.<br> <A HREF=\"$base/ports.tar.gz\">Download
|
||||||
a gzip'd tar file of all $portnumber ports</A> (about 2 megabytes) or
|
a gzip'd tar file of all $portnumber ports</A> (about 3 megabytes) or
|
||||||
browse the following categories:\n";
|
browse the following categories:\n";
|
||||||
|
|
||||||
print MOUTF "<UL>\n";
|
print MOUTF "<UL>\n";
|
||||||
|
@ -140,7 +137,7 @@ browse the following categories:\n";
|
||||||
$d =~ s/##([^#]*)##/$catkey{$1}/g;
|
$d =~ s/##([^#]*)##/$catkey{$1}/g;
|
||||||
print OUTF $d;
|
print OUTF $d;
|
||||||
print OUTF "</DL>\n";
|
print OUTF "</DL>\n";
|
||||||
&footer(OUTF, "<HR><A HREF=\"index.html\">Port Categories</A>" .
|
&footer(OUTF, "<HR NOSHADE><A HREF=\"index.html\">Port Categories</A>" .
|
||||||
" -- <A HREF=\"master-index.html\">Index</A>");
|
" -- <A HREF=\"master-index.html\">Index</A>");
|
||||||
close(OUTF);
|
close(OUTF);
|
||||||
|
|
||||||
|
@ -157,7 +154,7 @@ browse the following categories:\n";
|
||||||
print MINDEX "<P>\n";
|
print MINDEX "<P>\n";
|
||||||
print MINDEX sort @master;
|
print MINDEX sort @master;
|
||||||
print MINDEX "</P>";
|
print MINDEX "</P>";
|
||||||
&footer(MINDEX, "<HR><A HREF=\"index.html\">Port Categories</A>");
|
&footer(MINDEX, "<HR NOSHADE><A HREF=\"index.html\">Port Categories</A>");
|
||||||
close(MINDEX);
|
close(MINDEX);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,61 +44,58 @@ sub footer {
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
|
|
||||||
|
$sep = "<B>:</B>";
|
||||||
|
|
||||||
while (<>) {
|
while (<>) {
|
||||||
chop;
|
chop;
|
||||||
|
s/&/&/g;
|
||||||
s/</</g;
|
s/</</g;
|
||||||
s/>/>/g;
|
s/>/>/g;
|
||||||
|
|
||||||
|
# Read a record
|
||||||
($name, $loc, $prefix, $desc, $ldesc, $owner, $cats,
|
($name, $loc, $prefix, $desc, $ldesc, $owner, $cats,
|
||||||
$keys, $bdep, $rdep) = split('\|');
|
$keys, $bdep, $rdep) = split('\|');
|
||||||
|
|
||||||
@cat = split(" ", $cats);
|
# Split the categories into an array
|
||||||
|
@cat = split("[ \t]+", $cats);
|
||||||
|
|
||||||
$catkey{$name} = $cat[0];
|
$catkey{$name} = $cat[0];
|
||||||
|
|
||||||
$sep = "<B>:</B>";
|
|
||||||
|
|
||||||
foreach $i (@cat) {
|
foreach $i (@cat) {
|
||||||
|
|
||||||
$stats{$i}++;
|
$stats{$i}++;
|
||||||
|
|
||||||
# figure out the FTP url
|
# figure out the FTP url
|
||||||
$loc =~ s/\/usr/$base/;
|
$loc =~ s/\/usr/$base/;
|
||||||
# $loc =~ s/\/$name$//;
|
|
||||||
$ldesc =~ s/\/usr/$base/;
|
$ldesc =~ s/\/usr/$base/;
|
||||||
|
|
||||||
# The name description and maintainer
|
# The name description and maintainer
|
||||||
$data{$i} .= "<DT><B><A NAME=\"$name\">$name</A></B> <DD>$desc<BR>";
|
$data{$i} .= "<DT><B><A NAME=\"$name\"></A><A HREF=\"$loc.tar.gz\">$name</A></B> ";
|
||||||
|
$data{$i} .= "<DD>$desc<BR><I><A HREF=\"$ldesc\">Long description</A></I>";
|
||||||
$ownerurl = $owner;
|
$ownerurl = $owner;
|
||||||
$ownerurl =~ s/</</g;
|
$ownerurl =~ s/</</g;
|
||||||
$owenrurl =~ s/>/>/g;
|
$owenrurl =~ s/>/>/g;
|
||||||
$data{$i} .=
|
$data{$i} .=
|
||||||
"<I>Maintained by:</I> <A HREF=\"mailto:$ownerurl\">$owner</A><BR>";
|
"<BR><I>Maintained by:</I> <A HREF=\"mailto:$ownerurl\">$owner</A>";
|
||||||
|
|
||||||
# If there are any dependencies, list them
|
# If there are any dependencies, list them
|
||||||
if ($bdep ne "" || $rdep ne "") {
|
if ($bdep ne "" || $rdep ne "") {
|
||||||
$data{$i} .= "<I>Requires:</I> ";
|
$data{$i} .= "<BR><I>Requires:</I> ";
|
||||||
@dep = split(/ /, "$bdep $rdep");
|
@dep = split(/ /, "$bdep $rdep");
|
||||||
foreach $j (@dep) {
|
foreach $j (@dep) {
|
||||||
$data{$i} .= " <A HREF=\"##$j##.html#$j\">$j</A>,";
|
$data{$i} .= " <A HREF=\"##$j##.html#$j\">$j</A>,";
|
||||||
}
|
}
|
||||||
# remove the trailing comma
|
# remove the trailing comma
|
||||||
chop $data{$i};
|
chop $data{$i};
|
||||||
$data{$i} .= "<BR>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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>";
|
|
||||||
|
|
||||||
# If the port is listed in more than one category, throw
|
# If the port is listed in more than one category, throw
|
||||||
# in some cross references
|
# in some cross references
|
||||||
if ($#cat > 1) {
|
if ($#cat > 0) {
|
||||||
$data{$i} .= "<BR><EM>Also listed in:</EM> ";
|
$data{$i} .= "<BR><EM>Also listed in:</EM> ";
|
||||||
foreach $j (@cat) {
|
foreach $j (@cat) {
|
||||||
if ($j ne $i) {
|
if ($j ne $i) {
|
||||||
$data{$i} .= " <A HREF=\"$j.html\">\u$j</A>,";
|
$data{$i} .= " <A HREF=\"$j.html#$name\">\u$j</A>,";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# remove the trailing comma
|
# remove the trailing comma
|
||||||
|
@ -119,9 +116,9 @@ sub main {
|
||||||
&header(MOUTF, "FreeBSD Ports");
|
&header(MOUTF, "FreeBSD Ports");
|
||||||
# print MOUTF "<!--#include virtual=\"./ports.inc\" -->\n";
|
# print MOUTF "<!--#include virtual=\"./ports.inc\" -->\n";
|
||||||
print MOUTF "&blurb;";
|
print MOUTF "&blurb;";
|
||||||
print MOUTF "<hr><P>There are currently $portnumber ports is the
|
print MOUTF "<hr noshade><P>There are currently $portnumber ports is the
|
||||||
FreeBSD Ports Collection.<br> <A HREF=\"$base/ports.tar.gz\">Download
|
FreeBSD Ports Collection.<br> <A HREF=\"$base/ports.tar.gz\">Download
|
||||||
a gzip'd tar file of all $portnumber ports</A> (about 2 megabytes) or
|
a gzip'd tar file of all $portnumber ports</A> (about 3 megabytes) or
|
||||||
browse the following categories:\n";
|
browse the following categories:\n";
|
||||||
|
|
||||||
print MOUTF "<UL>\n";
|
print MOUTF "<UL>\n";
|
||||||
|
@ -140,7 +137,7 @@ browse the following categories:\n";
|
||||||
$d =~ s/##([^#]*)##/$catkey{$1}/g;
|
$d =~ s/##([^#]*)##/$catkey{$1}/g;
|
||||||
print OUTF $d;
|
print OUTF $d;
|
||||||
print OUTF "</DL>\n";
|
print OUTF "</DL>\n";
|
||||||
&footer(OUTF, "<HR><A HREF=\"index.html\">Port Categories</A>" .
|
&footer(OUTF, "<HR NOSHADE><A HREF=\"index.html\">Port Categories</A>" .
|
||||||
" -- <A HREF=\"master-index.html\">Index</A>");
|
" -- <A HREF=\"master-index.html\">Index</A>");
|
||||||
close(OUTF);
|
close(OUTF);
|
||||||
|
|
||||||
|
@ -157,7 +154,7 @@ browse the following categories:\n";
|
||||||
print MINDEX "<P>\n";
|
print MINDEX "<P>\n";
|
||||||
print MINDEX sort @master;
|
print MINDEX sort @master;
|
||||||
print MINDEX "</P>";
|
print MINDEX "</P>";
|
||||||
&footer(MINDEX, "<HR><A HREF=\"index.html\">Port Categories</A>");
|
&footer(MINDEX, "<HR NOSHADE><A HREF=\"index.html\">Port Categories</A>");
|
||||||
close(MINDEX);
|
close(MINDEX);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue