--- web/cgi-bin/docs.cgi 2000/11/02 20:59:43 1.2 +++ web/cgi-bin/docs.cgi 2000/11/09 22:03:56 1.3 @@ -77,6 +77,20 @@ exit 0; # Print a file, whilst escaping HTML: - sub print_file ($) { + my ($urls) = '(' . join ('|', qw{ + http + telnet + gopher + file + wais + ftp + } ) + . ')'; + + my ($ltrs) = '\w'; + my ($gunk) = '/#~:.?+=&%@!\-'; + my ($punc) = '.:?\-'; + my ($any) = "${ltrs}${gunk}${punc}"; my ($filename) = @_; open(FILE, $filename) or die "Cannot open $filename: $!\n"; print "
\n"; @@ -87,6 +101,7 @@ sub print_file ($) { s/</g; s/>/>/g; s/"/"/g; + s/\b($urls:[$any]+?)(?=[$punc]*[^$any]|$)/$1<\/a>/igox; print; } print "";