Updated to better handle malformed URLs and to toss

out any blank entries that might make it into the
gallery file.
This commit is contained in:
nsj 1998-12-29 06:34:55 +00:00
parent 932548a791
commit 4ad49ea82d
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=3982

View file

@ -5,7 +5,7 @@
# into another SGML file where the <UL></UL> list element pair is
# already in existence.
#
# Syntax: dump.pl type < galleryfile.db > galleryfile.inc
# Syntax: gengallery.pl type < galleryfile.db > galleryfile.inc
# where type is one of: commerical, nonprofit, personal
#
# yymmdd own comments
@ -13,6 +13,9 @@
# 980311 nsj First pass
# 980312 jrf Added sorting
# 980313 nsj Wrapped file input routine with error checking
# 981229 nsj Tried to be more intelligent in eliminating any
# possible blank entries in the .db file and
# malformed url entries (missing http://).
# Setup
# Which sort program are we using?
@ -56,6 +59,15 @@ while (<DBFILE>)
($dummy, $name, $url, $description, $email, $dateadd, $datever) =
m/([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]*)\t([^\t]+)\t([^\t]+)\t([^\t]+)/;
# Skip bogus entries (in lieu of actually checking to
# eliminate them from the .db file.)
next if ($name =~ m/^$|^\s+$/);
next if ($url =~ m/^$|^\s+$|^http:\/\/\s+$/);
# Be semi-intelligent about entries without "http://" in front
# by prepending that to any that are missing it.
$url = "http://" . $url unless ($url =~ m/^http:\/\/.*$/);
# Dump it out to the file, in SGML <LI> format
if ($description ne "")
{