=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.1.1.1 retrieving revision 3.3 diff -u -p -r1.1.1.1 -r3.3 --- cvsweb/cvsweb.cgi 2000/08/14 04:35:13 1.1.1.1 +++ cvsweb/cvsweb.cgi 2000/07/27 16:16:41 3.3 @@ -1,4 +1,4 @@ -#!/usr/bin/perl5 -ws +#!/usr/bin/perl -ws # # cvsweb - a CGI interface to CVS trees. # @@ -12,7 +12,7 @@ # # Based on: # * Bill Fenners cvsweb.cgi revision 1.28 available from: -# http://www.FreeBSD.org/cgi/cvsweb.cgi/www/en/cgi/cvsweb.cgi +# http://www.freebsd.org/cgi/cvsweb.cgi/www/en/cgi/cvsweb.cgi # # Copyright (c) 1996-1998 Bill Fenner # (c) 1998-1999 Henner Zeller @@ -41,8 +41,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $zId: cvsweb.cgi,v 1.93 2000/07/27 17:42:28 hzeller Exp $ -# $kId: cvsweb.cgi,v 1.11 2000/08/13 18:58:24 knu Exp $ +# $Id: cvsweb.cgi,v 3.3 2000/07/27 16:16:41 knu Exp $ # ### @@ -58,7 +57,7 @@ use vars qw ( $checkoutMagic $doCheckout $scriptname $scriptwhere $where $pathinfo $Browser $nofilelinks $maycompress @stickyvars %funcline_regexp $is_mod_perl - $is_lynx $is_w3m $is_msie $is_mozilla3 $is_textbased + $is_lynx $is_msie $is_mozilla3 %input $query $barequery $sortby $bydate $byrev $byauthor $bylog $byfile $hr_default $logsort $cvstree $cvsroot $mimetype $defaultTextPlain $defaultViewable $allow_compress @@ -80,16 +79,10 @@ use vars qw ( ); ##### Start of Configuration Area ######## -use Cwd; - # == EDIT this == # User configuration is stored in -$config = undef; +$config = defined($ENV{CVSWEB_CONFIG}) ? $ENV{CVSWEB_CONFIG} : '/usr/local/etc/cvsweb.conf'; -for ($ENV{CVSWEB_CONFIG}, '/usr/local/etc/cvsweb.conf', getcwd . '/cvsweb.conf') { - $config = $_ if -r $_; -} - # == Configuration defaults == # Defaults for configuration variables that shouldn't need # to be configured.. @@ -140,15 +133,12 @@ $is_mod_perl = defined($ENV{MOD_PERL}); # per file, so disable the link at the icon # in this case: $Browser = $ENV{HTTP_USER_AGENT} || ''; -$is_lynx = ($Browser =~ m`^Lynx/`i); -$is_w3m = ($Browser =~ m`^w3m/`i); +$is_lynx = ($Browser =~ m`^Lynx/`); $is_msie = ($Browser =~ m`MSIE`); -$is_mozilla3 = ($Browser =~ m`^Mozilla/[3-9]`); +$is_mozilla3 = ($Browser =~ m`^Mozilla/[3456789]`); -$is_textbased = ($is_lynx || $is_w3m); +$nofilelinks = $is_lynx; -$nofilelinks = $is_textbased; - # newer browsers accept gzip content encoding # and state this in a header # (netscape did always but didn't state it) @@ -168,7 +158,7 @@ $maycompress =(($ENV{HTTP_ACCEPT_ENCODING} =~ m`gzip` # to hold our state - they will be added (with # their current value) to any link/query string # you construct -@stickyvars = qw(cvsroot hideattic sortby logsort f only_with_tag); +@stickyvars = qw(cvsroot hideattic sortby logsort fonly_with_tag); if (-f $config) { do $config; @@ -227,9 +217,8 @@ foreach (keys %DEFAULTVALUE) $barequery = ""; foreach (@stickyvars) { # construct a query string with the sticky non default parameters set - if (defined($input{$_}) && $input{$_} ne '' && - !(defined($DEFAULTVALUE{$_}) && $input{$_} eq $DEFAULTVALUE{$_})) { - if ($barequery) { + if (defined($input{$_}) && $input{$_} ne "" && $input{$_} ne $DEFAULTVALUE{$_}) { + if ($barequery) { $barequery = $barequery . "&"; } my $thisval = urlencode($_) . "=" . urlencode($input{$_}); @@ -861,8 +850,8 @@ sub htmlify { # get #PR as link .. if ($pr && defined($prcgi)) { - 1 while $string =~ s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`$1$2`i; - $string =~ s`\b${prcategories}/(\d+)\b`$&`igo; + 1 while $string =~ s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`$1$2`i; + $string =~ s`\b${prcategories}/(\d+)\b`$&`igo; } return $string; @@ -929,7 +918,7 @@ sub fatal { Apache->request->status((split(/ /, $errcode))[0]); } else { - print "Status: $errcode\r\n"; + print "Status: $errcode\n"; } html_header("Error"); print "Error: $errmsg\n"; @@ -944,8 +933,8 @@ sub redirect { Apache->request->header_out(Location => $url); } else { - print "Status: 301 Moved\r\n"; - print "Location: $url\r\n"; + print "Status: 301 Moved\n"; + print "Location: $url\n"; } html_header("Moved"); print "This document is located here.\n"; @@ -1479,15 +1468,15 @@ sub getDirLogs { if ($tag) { #can't use -r as - is allowed in tagnames, but misinterpreated by rlog.. if (! open($fh, "-|")) { - open(STDERR, '>/dev/null'); # rlog may complain; ignore. - exec('rlog', @files); + close(STDERR); # rlog may complain; ignore. + exec("rlog",@files); } } else { my $kidpid = open($fh, "-|"); if (! $kidpid) { - open(STDERR, '>/dev/null'); # rlog may complain; ignore. - exec('rlog', '-r', @files); + close(STDERR); # rlog may complain; ignore. + exec("rlog","-r",@files); } } $state = "start"; @@ -2336,7 +2325,7 @@ sub navigateHeader ($$$$$) { $swhere = urlencode($filename) if ($swhere eq ""); print "<\!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; print "\n\n"; - print ''; + print ''; print "\n$path$filename - $title - $rev\n"; print "\n"; print ""; @@ -2642,14 +2631,14 @@ sub http_header { Apache->request->header_out(Last_modified => scalar gmtime($moddate) . " GMT"); } else { - print "Last-Modified: " . scalar gmtime($moddate) . " GMT\r\n"; + print "Last-Modified: " . scalar gmtime($moddate) . " GMT\n"; } } if ($is_mod_perl) { Apache->request->content_type($content_type); } else { - print "Content-type: $content_type\r\n"; + print "Content-type: $content_type\n"; } if ($allow_compress && $maycompress) { my $fh = do {local(*FH);}; @@ -2660,9 +2649,9 @@ sub http_header { Apache->request->send_http_header; } else { - print "Content-encoding: x-gzip\r\n"; - print "Vary: Accept-Encoding\r\n"; #RFC 2068, 14.43 - print "\r\n"; # Close headers + print "Content-encoding: x-gzip\n"; + print "Vary: Accept-Encoding\n"; #RFC 2068, 14.43 + print "\n"; # Close headers } $| = 1; $| = 0; # Flush header output select ($fh); @@ -2673,7 +2662,7 @@ sub http_header { Apache->request->send_http_header; } else { - print "\r\n"; # Close headers + print "\n"; # Close headers } print "Unable to find gzip binary in the \$PATH to compress output
"; } @@ -2683,14 +2672,14 @@ sub http_header { Apache->request->send_http_header; } else { - print "\r\n"; # Close headers + print "\n"; # Close headers } } } sub html_header($) { my ($title) = @_; - my $version = '$zRevision: 1.93 $ $kRevision: 1.11 $'; + my $version = '$Revision: 3.3 $'; http_header(); print <