=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.17 retrieving revision 1.39 diff -u -p -r1.17 -r1.39 --- cvsweb/cvsweb.cgi 1998/05/05 16:05:32 1.17 +++ cvsweb/cvsweb.cgi 2000/02/19 13:58:12 1.39 @@ -3,10 +3,37 @@ # cvsweb - a CGI interface to the CVS tree. # # Written by Bill Fenner on his own time. -# Insert BSD copyright here. # +# Copyright (c) 1996-1998 Bill Fenner +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD: www/en/cgi/cvsweb.cgi,v 1.38 2000/02/01 14:52:38 wosch Exp $ +# + + #HTTP_USER_AGENT: Mozilla/1.1N (X11; I; SunOS 4.1.3_U1 sun4m) via proxy gateway CERN-HTTPD/3.0 libwww/2.17 -#SERVER_NAME: www.freebsd.org +#SERVER_NAME: www.FreeBSD.org #QUERY_STRING: baz #SCRIPT_FILENAME: /usr/local/www/cgi-bin/env.pl #SERVER_PORT: 80 @@ -23,7 +50,7 @@ #SCRIPT_NAME: /cgi-bin/env.pl #SERVER_SOFTWARE: Apache/1.0.0 #REMOTE_HOST: beta.xerox.com -#SERVER_ADMIN: webmaster@freebsd.org +#SERVER_ADMIN: webmaster@FreeBSD.org # require 'timelocal.pl'; require 'ctime.pl'; @@ -34,18 +61,21 @@ require 'cgi-style.pl'; %CVSROOT = ( 'freebsd', '/home/ncvs', - 'openbsd', '/home/OpenBSD/cvs', 'learn', '/c/learncvs', - 'mozilla', '/a/mozilla-cvs', ); %CVSROOTdescr = ( 'freebsd', 'FreeBSD', - 'openbsd', 'OpenBSD', 'learn', 'Learn', - 'mozilla', 'Mozilla FreeBSD', ); +%mirrors = ( + 'Germany', 'http://www.de.FreeBSD.org/cgi/cvsweb.cgi', + 'Spain', 'http://www.es.FreeBSD.org/cgi/cvsweb.cgi', + 'USA, California', 'http://www.FreeBSD.org/cgi/cvsweb.cgi', + 'Japan', 'http://www.jp.FreeBSD.org/cgi/cvsweb.cgi', + ); + $cvstreedefault = 'freebsd'; $cvstree = $cvstreedefault; $cvsroot = $CVSROOT{"$cvstree"} || "/home/ncvs"; @@ -64,12 +94,12 @@ a form at the bottom of the page that allows you to display diffs between arbitrary revisions.

If you would like to use this CGI script on your own web server and -CVS tree, see +CVS tree, see the CVSWeb distribution site or the current FreeBSD version. +href=\"http://www.FreeBSD.org/cgi/cvsweb.cgi/www/en/cgi/cvsweb.cgi\">current FreeBSD version.

Please send any suggestions, comments, etc. to -Bill Fenner <fenner\@freebsd.org> +Bill Fenner <fenner\@FreeBSD.org> "; $shortinstr = " Click on a directory to enter that directory. Click on a file to display @@ -119,13 +149,13 @@ if (!-d $cvsroot) { { local(@foo, $i); local($scriptname) = $ENV{'SCRIPT_NAME'}; - foreach (keys %CVSROOT) { + foreach (sort keys %CVSROOT) { if (-d $CVSROOT{$_}) { push(@foo, $_); } } - if ($#foo > 1) { - $intro .= "

\nThis script support the following CVS trees:\n"; + if ($#foo >= 1) { + $intro .= "

\nThis script supports the following CVS trees:\n"; for($i = 0; $i <= $#foo; $i++) { $intro .= qq{} . ($CVSROOTdescr{$foo[$i]} ? @@ -136,6 +166,20 @@ if (!-d $cvsroot) { } +{ + local(@mirrors) = sort keys %mirrors;; + if ($#mirrors >= 0) { + $intro .= "

\nThis script is mirrored in:\n"; + local($m); + for($m = 0; $m <= $#mirrors; $m++) { + $intro .= qq($mirrors[$m]); + $intro .= ',' if $m != $#mirrors; + $intro .= "\n"; + } + } +} + + if (-d $fullname) { opendir(DIR, $fullname) || &fatal("404 Not Found","$where: $!"); @dir = readdir(DIR); @@ -148,8 +192,9 @@ if (-d $fullname) { print $shortinstr; } print "

"; - print "Current CVS tree: $cvstree
\n" - if $cvstree ne $cvstreedefault; + print "Current CVS tree: ", + ($CVSROOTdescr{"$cvstree"} ? $CVSROOTdescr{"$cvstree"} : + $cvstree), "
\n"; print "Current directory: /$where\n"; print "


\n"; # Using in this manner violates the HTML2.0 spec but @@ -174,6 +219,9 @@ if (-d $fullname) { if ($_ eq '.') { next; } + # ignore CVS lock and stale NFS files + next if /^#cvs\.|^,|^\.nfs/; + if (s|^Attic/||) { $attic = " (in the Attic)"; } else { @@ -281,7 +329,7 @@ sub htmlify { $string =~ s/>/>/g; if ($pr) { - $string =~ s|\bpr(\W+[a-z]+/\W*)(\d+)|$&|ig; + $string =~ s!\b((pr[:#]?\s*#?)|((bin|conf|docs|gnu|i386|kern|misc|ports)\/))(\d+)\b!$&!ig; } $string; @@ -381,7 +429,9 @@ sub checkout { "Unexpected output from co: $_"); } $_ = ; - if (/^revision\s+$rev\s*$/) { + if ($rev eq ".") { + # latest rev requested, don't check + } elsif (/^revision\s+$rev\s*$/) { # As expected } else { &fatal("500 Internal Error",