Make script more intelegent. Allow ftp:// and telnet:// proto

prefixes also.

This fixes "http://ftp://site.com/path/" problem.
This commit is contained in:
Alexey Zelkin 1999-12-21 11:10:12 +00:00
parent 2a132b9c7b
commit 71c0ee473b
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=6242

View file

@ -8,14 +8,16 @@
# Syntax: gengallery.pl type < galleryfile.db > galleryfile.inc
# where type is one of: commerical, nonprofit, personal
#
# yymmdd own comments
# ------ --- ------------------------------------------------
# 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://).
# yymmdd own comments
# ------ ------- ------------------------------------------------
# 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://).
# 991221 phantom Allow `ftp://' and `telnet://' as url prefixes. It allows
# to avoid "http://ftp://site" cases.
# Setup
# Which sort program are we using?
@ -64,9 +66,9 @@ while (<DBFILE>)
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:\/\/.*$/);
# Be semi-intelligent about entries without "http://" (or "ftp://" or
# "telnet://") in front by prepending that to any that are missing it.
$url = "http://" . $url unless ($url =~ m/^(http|ftp|telnet):\/\/.*$/);
# Dump it out to the file, in SGML <LI> format
if ($description ne "")