version 1.20, 1998/07/23 08:50:52 |
version 1.38, 2000/02/01 14:52:38 |
|
|
# cvsweb - a CGI interface to the CVS tree. |
# cvsweb - a CGI interface to the CVS tree. |
# |
# |
# Written by Bill Fenner <fenner@parc.xerox.com> on his own time. |
# Written by Bill Fenner <fenner@parc.xerox.com> 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.37 2000/01/05 15:47:43 phantom 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 |
#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 |
#QUERY_STRING: baz |
#SCRIPT_FILENAME: /usr/local/www/cgi-bin/env.pl |
#SCRIPT_FILENAME: /usr/local/www/cgi-bin/env.pl |
#SERVER_PORT: 80 |
#SERVER_PORT: 80 |
|
|
#SCRIPT_NAME: /cgi-bin/env.pl |
#SCRIPT_NAME: /cgi-bin/env.pl |
#SERVER_SOFTWARE: Apache/1.0.0 |
#SERVER_SOFTWARE: Apache/1.0.0 |
#REMOTE_HOST: beta.xerox.com |
#REMOTE_HOST: beta.xerox.com |
#SERVER_ADMIN: webmaster@freebsd.org |
#SERVER_ADMIN: webmaster@FreeBSD.org |
# |
# |
require 'timelocal.pl'; |
require 'timelocal.pl'; |
require 'ctime.pl'; |
require 'ctime.pl'; |
Line 35 require 'cgi-style.pl'; |
|
Line 62 require 'cgi-style.pl'; |
|
%CVSROOT = ( |
%CVSROOT = ( |
'freebsd', '/home/ncvs', |
'freebsd', '/home/ncvs', |
'learn', '/c/learncvs', |
'learn', '/c/learncvs', |
'mozilla', '/a/mozilla-cvs', |
|
); |
); |
|
|
%CVSROOTdescr = ( |
%CVSROOTdescr = ( |
'freebsd', 'FreeBSD', |
'freebsd', 'FreeBSD', |
'learn', 'Learn', |
'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'; |
$cvstreedefault = 'freebsd'; |
$cvstree = $cvstreedefault; |
$cvstree = $cvstreedefault; |
$cvsroot = $CVSROOT{"$cvstree"} || "/home/ncvs"; |
$cvsroot = $CVSROOT{"$cvstree"} || "/home/ncvs"; |
Line 62 a form at the bottom of the page that allows you to |
|
Line 94 a form at the bottom of the page that allows you to |
|
display diffs between arbitrary revisions. |
display diffs between arbitrary revisions. |
<p> |
<p> |
If you would like to use this CGI script on your own web server and |
If you would like to use this CGI script on your own web server and |
CVS tree, see <A HREF=\"http://www.freebsd.org/~fenner/cvsweb/\"> |
CVS tree, see <A HREF=\"http://www.FreeBSD.org/~fenner/cvsweb/\"> |
the CVSWeb distribution site</A> or the <a |
the CVSWeb distribution site</A> or the <a |
href=\"http://www.freebsd.org/cgi/cvsweb.cgi/www/data/cgi/cvsweb.cgi\">current</a> FreeBSD version. |
href=\"http://www.FreeBSD.org/cgi/cvsweb.cgi/www/data/cgi/cvsweb.cgi\">current</a> FreeBSD version. |
<p> |
<p> |
Please send any suggestions, comments, etc. to |
Please send any suggestions, comments, etc. to |
<A HREF=\"mailto:fenner\@freebsd.org\">Bill Fenner <fenner\@freebsd.org></A> |
<A HREF=\"mailto:fenner\@FreeBSD.org\">Bill Fenner <fenner\@FreeBSD.org></A> |
"; |
"; |
$shortinstr = " |
$shortinstr = " |
Click on a directory to enter that directory. Click on a file to display |
Click on a directory to enter that directory. Click on a file to display |
Line 117 if (!-d $cvsroot) { |
|
Line 149 if (!-d $cvsroot) { |
|
{ |
{ |
local(@foo, $i); |
local(@foo, $i); |
local($scriptname) = $ENV{'SCRIPT_NAME'}; |
local($scriptname) = $ENV{'SCRIPT_NAME'}; |
foreach (keys %CVSROOT) { |
foreach (sort keys %CVSROOT) { |
if (-d $CVSROOT{$_}) { |
if (-d $CVSROOT{$_}) { |
push(@foo, $_); |
push(@foo, $_); |
} |
} |
} |
} |
if ($#foo > 1) { |
if ($#foo >= 1) { |
$intro .= "<p>\nThis script support the following CVS trees:\n"; |
$intro .= "<p>\nThis script supports the following CVS trees:\n"; |
for($i = 0; $i <= $#foo; $i++) { |
for($i = 0; $i <= $#foo; $i++) { |
$intro .= qq{<a href="$scriptname?cvsroot=$foo[$i]">} . |
$intro .= qq{<a href="$scriptname?cvsroot=$foo[$i]">} . |
($CVSROOTdescr{$foo[$i]} ? |
($CVSROOTdescr{$foo[$i]} ? |
Line 134 if (!-d $cvsroot) { |
|
Line 166 if (!-d $cvsroot) { |
|
} |
} |
|
|
|
|
|
{ |
|
local(@mirrors) = sort keys %mirrors;; |
|
if ($#mirrors >= 0) { |
|
$intro .= "<p>\nThis script is mirrored in:\n"; |
|
local($m); |
|
for($m = 0; $m <= $#mirrors; $m++) { |
|
$intro .= qq(<a href="$mirrors{$mirrors[$m]}">$mirrors[$m]</a>); |
|
$intro .= ',' if $m != $#mirrors; |
|
$intro .= "\n"; |
|
} |
|
} |
|
} |
|
|
|
|
if (-d $fullname) { |
if (-d $fullname) { |
opendir(DIR, $fullname) || &fatal("404 Not Found","$where: $!"); |
opendir(DIR, $fullname) || &fatal("404 Not Found","$where: $!"); |
@dir = readdir(DIR); |
@dir = readdir(DIR); |
Line 146 if (-d $fullname) { |
|
Line 192 if (-d $fullname) { |
|
print $shortinstr; |
print $shortinstr; |
} |
} |
print "<p>"; |
print "<p>"; |
print "Current CVS tree: <b>$cvstree</b><br>\n" |
print "Current CVS tree: <b>", |
if $cvstree ne $cvstreedefault; |
($CVSROOTdescr{"$cvstree"} ? $CVSROOTdescr{"$cvstree"} : |
|
$cvstree), "</b><br>\n"; |
print "Current directory: <b>/$where</b>\n"; |
print "Current directory: <b>/$where</b>\n"; |
print "<P><HR NOSHADE>\n"; |
print "<P><HR NOSHADE>\n"; |
# Using <MENU> in this manner violates the HTML2.0 spec but |
# Using <MENU> in this manner violates the HTML2.0 spec but |
|
|
$string =~ s/>/>/g; |
$string =~ s/>/>/g; |
|
|
if ($pr) { |
if ($pr) { |
$string =~ s|\bpr(\W+[a-z]+/\W*)(\d+)|<A HREF=/cgi/query-pr.cgi?pr=$2>$&</A>|ig; |
$string =~ s!\b((pr[:#]?\s*#?)|((bin|conf|docs|gnu|i386|kern|misc|ports)\/))(\d+)\b!<A HREF=http://www.FreeBSD.org/cgi/query-pr.cgi?pr=\5>$&</A>!ig; |
} |
} |
|
|
$string; |
$string; |
|
|
"Unexpected output from co: $_"); |
"Unexpected output from co: $_"); |
} |
} |
$_ = <RCS>; |
$_ = <RCS>; |
if (/^revision\s+$rev\s*$/) { |
if ($rev eq ".") { |
|
# latest rev requested, don't check |
|
} elsif (/^revision\s+$rev\s*$/) { |
# As expected |
# As expected |
} else { |
} else { |
&fatal("500 Internal Error", |
&fatal("500 Internal Error", |