ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/web/cgi-bin/docs.cgi
(Generate patch)

Comparing web/cgi-bin/docs.cgi (file contents):
Revision 1.8 by tdb, Wed Mar 24 13:11:42 2004 UTC vs.
Revision 1.9 by tdb, Wed Mar 24 20:57:27 2004 UTC

# Line 98 | Line 98 | END
98   exit 0;
99  
100   # Print a file, whilst escaping HTML: -
101 < sub print_file ($) {
101 > sub print_file {
102   my ($urls) = '(' . join ('|', qw{
103                 http
104                 telnet
# Line 109 | Line 109 | my ($urls) = '(' . join ('|', qw{
109                 } )
110             . ')';
111  
112 < my ($ltrs) = '\w';
113 < my ($gunk) = '/#~:.?+=&%@!\-';
114 < my ($punc) = '.:?\-';
115 < my ($any) = "${ltrs}${gunk}${punc}";
116 < my ($filename) = @_;
117 < if(open(FILE, $filename)) {
118 <    print "          <pre>\n";
119 <    # Use $_ implicitly throughout.
120 <    while (<FILE>) {
121 <        # Must do the next line first!
122 <        s/&/&amp;/g;
123 <        s/</&lt;/g;
124 <        s/>/&gt;/g;
125 <        s/"/&quot;/g;
126 <        s/\b($urls:[$any]+?)(?=[$punc]*[^$any]|$)/<a href="$1">$1<\/a>/igox;
127 <        print;
112 >    my ($ltrs) = '\w';
113 >    my ($gunk) = '/#~:.?+=&%@!\-';
114 >    my ($punc) = '.:?\-';
115 >    my ($any) = "${ltrs}${gunk}${punc}";
116 >    my ($filename) = @_;
117 >    if(open(FILE, $filename)) {
118 >        print "          <pre>\n";
119 >        # Use $_ implicitly throughout.
120 >        while (<FILE>) {
121 >            # Must do the next line first!
122 >            s/&/&amp;/g;
123 >            s/</&lt;/g;
124 >            s/>/&gt;/g;
125 >            s/"/&quot;/g;
126 >            s/\b($urls:[$any]+?)(?=[$punc]*[^$any]|$)/<a href="$1">$1<\/a>/igox;
127 >            print;
128 >        }
129 >        print "\n</pre>";
130      }
131 <    print "\n</pre>";
131 >    else {
132 >        print "Failed to open $docname.";
133 >    }
134   }
131 else {
132    print "Failed to open $docname.";
133 }
134 }
135  
136 < # Print a file without escaping HTML: -
136 > # Print the contents of a file containing html
137   sub print_html ($) {
138 < my ($filename) = @_;
139 < print `cat $filename 2>&1`;
138 >    my ($filename) = @_;
139 >    open(FILE, $filename);
140 >    while(<FILE>) {
141 >        print;
142 >    }
143 >    close FILE;
144   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines