version 1.1, 1996/09/28 23:31:06 |
version 1.5, 1997/03/20 01:36:20 |
|
|
require 'timelocal.pl'; |
require 'timelocal.pl'; |
require 'ctime.pl'; |
require 'ctime.pl'; |
|
|
|
$hsty_base = ""; |
|
require 'cgi-style.pl'; |
|
|
$cvsroot = '/home/ncvs'; |
$cvsroot = '/home/ncvs'; |
$intro = " |
$intro = " |
This is a WWW interface to the FreeBSD CVS tree. |
This is a WWW interface to the FreeBSD CVS tree. |
Line 72 if (-d $fullname) { |
|
Line 75 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); |
closedir(DIR); |
closedir(DIR); |
print "Content-type: text/html\n\n"; |
|
print "<HTML><HEAD><TITLE>FreeBSD CVS Tree: /$where</TITLE></HEAD>\n"; |
|
print "<BODY>\n"; |
|
print "<h1><img src=\"/gifs/biglogo.gif\" alt=\"\"> "; |
|
print "FreeBSD CVS Tree</h1>\n<hr>\n"; |
|
# print "<!-- I wish there was a \"halign=center\" for IMG... -->\n"; |
|
# print "<center>\n"; |
|
# print "<IMG SRC=\"/gifs/daemonbar.gif\" alt=\"\">\n"; |
|
# print "</center>\n"; |
|
# print "<H1 align=center>FreeBSD CVS Tree</H1>\n"; |
|
if ($where eq '') { |
if ($where eq '') { |
|
print &html_header("FreeBSD CVS Repository"); |
print $intro; |
print $intro; |
} else { |
} else { |
|
print &html_header("/$where"); |
print $shortinstr; |
print $shortinstr; |
} |
} |
print "<p>Current directory: <b>/$where</b>\n"; |
print "<p>Current directory: <b>/$where</b>\n"; |
print "<P><HR>\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 |
# provides the results that I want in most browsers. Another |
# provides the results that I want in most browsers. Another |
# case of layout spooging up HTML. |
# case of layout spooging up HTML. |
Line 111 if (-d $fullname) { |
|
Line 106 if (-d $fullname) { |
|
} |
} |
} |
} |
print "</MENU>\n"; |
print "</MENU>\n"; |
print "<hr> |
print &html_footer; |
<a href=\"/\"><img src=\"/gifs/home.gif\" alt=\"FreeBSD Home |
|
Page\" border=\"0\" align=\"right\"></a> |
|
<address> |
|
<a href=\"/mailto.html\">www@freebsd.org</a> |
|
</address>\n"; |
|
# print "<HR>\n"; |
|
# print "<A HREF=\"/\"><IMG SRC=\"/gifs/home.gif\" ALT=\"FreeBSD Home Page\">\n"; |
|
# print "</A>\n"; |
|
print "</BODY></HTML>\n"; |
print "</BODY></HTML>\n"; |
} elsif (-f $fullname . ',v') { |
} elsif (-f $fullname . ',v') { |
if ($_ = $ENV{'QUERY_STRING'}) { |
if ($_ = $ENV{'QUERY_STRING'}) { |
|
|
$sel .= "<OPTION VALUE=\"${rev}:${_}\">$_\n"; |
$sel .= "<OPTION VALUE=\"${rev}:${_}\">$_\n"; |
} |
} |
print "Done associating revisions with branches\n" if ($verbose); |
print "Done associating revisions with branches\n" if ($verbose); |
print "Content-type: text/html\n\n"; |
print &html_header("CVS log for $where"); |
print "<HTML><HEAD><TITLE>CVS log for $where</TITLE></HEAD>\n"; |
|
print "<BODY>\n"; |
|
print "<H1 align=center>CVS log for $where</H1>\n"; |
|
($upwhere = $where) =~ s|[^/]+$||; |
($upwhere = $where) =~ s|[^/]+$||; |
print "Up to ", &link($upwhere,$scriptname . "/" . $upwhere); |
print "Up to ", &link($upwhere,$scriptname . "/" . $upwhere); |
print "<BR>\n"; |
print "<BR>\n"; |
print "<A HREF=\"#diff\">Request diff between arbitrary revisions</A>\n"; |
print "<A HREF=\"#diff\">Request diff between arbitrary revisions</A>\n"; |
print "<HR>\n"; |
print "<HR NOSHADE>\n"; |
# The other possible U.I. I can see is to have each revision be hot |
# The other possible U.I. I can see is to have each revision be hot |
# and have the first one you click do ?r1=foo |
# and have the first one you click do ?r1=foo |
# and since there's no r2 it keeps going & the next one you click |
# and since there's no r2 it keeps going & the next one you click |
|
|
|
|
for ($i = 0; $i <= $#revorder; $i++) { |
for ($i = 0; $i <= $#revorder; $i++) { |
$_ = $revorder[$i]; |
$_ = $revorder[$i]; |
|
print "<a NAME=\"rev$_\"></a>"; |
|
foreach $sym (split(", ", $revsym{$_})) { |
|
print "<a NAME=\"$sym\"></a>"; |
|
} |
|
($br = $_) =~ s/\.\d+$//; |
|
if ($revsym{$br} && !$nameprinted{$br}) { |
|
foreach $sym (split(", ", $revsym{$br})) { |
|
print "<a NAME=\"$sym\"></a>"; |
|
} |
|
$nameprinted{$br}++; |
|
} |
|
print "\n"; |
# print "RCS revision <b>$_</b>\n"; |
# print "RCS revision <b>$_</b>\n"; |
print "<A HREF=\"$scriptwhere?rev=$_\"><b>$_</b></A>"; |
print "<A HREF=\"$scriptwhere?rev=$_\"><b>$_</b></A>"; |
if (/^1\.1\.1\.\d+$/) { |
if (/^1\.1\.1\.\d+$/) { |
|
|
# print "CVS Tags: <b>$revsym{$_}</b><BR>\n"; |
# print "CVS Tags: <b>$revsym{$_}</b><BR>\n"; |
print "<BR>CVS Tags: <b>$revsym{$_}</b>"; |
print "<BR>CVS Tags: <b>$revsym{$_}</b>"; |
} |
} |
if (($br = $_) =~ s/\.\d+$// && $revsym{$br}) { |
if ($revsym{$br}) { |
# print "Branch: <b>$revsym{$br}</b><BR>\n"; |
# print "Branch: <b>$revsym{$br}</b><BR>\n"; |
if ($revsym{$_}) { |
if ($revsym{$_}) { |
print "; "; |
print "; "; |
|
|
# print "Log message:<BR>\n"; |
# print "Log message:<BR>\n"; |
print "<PRE>\n"; |
print "<PRE>\n"; |
print &htmlify($log{$_}); |
print &htmlify($log{$_}); |
print "</PRE><HR>\n"; |
print "</PRE><HR NOSHADE>\n"; |
} |
} |
print "<A NAME=diff>\n"; |
print "<A NAME=diff>\n"; |
print "This form allows you to request diff's between any two\n"; |
print "This form allows you to request diff's between any two\n"; |
|
|
print "<INPUT TYPE=RADIO NAME=\"f\" VALUE=c>Context diff<br>\n"; |
print "<INPUT TYPE=RADIO NAME=\"f\" VALUE=c>Context diff<br>\n"; |
print "<INPUT TYPE=SUBMIT VALUE=\"Get Diffs\">\n"; |
print "<INPUT TYPE=SUBMIT VALUE=\"Get Diffs\">\n"; |
print "</FORM>\n"; |
print "</FORM>\n"; |
print "<hr> |
print &html_footer; |
<a href=\"/\"><img src=\"/gifs/home.gif\" alt=\"FreeBSD Home |
|
Page\" border=\"0\" align=\"right\"></a> |
|
<address> |
|
<a href=\"/mailto.html\">www@freebsd.org</a> |
|
</address>\n"; |
|
# print "<HR>\n"; |
|
# print "<A HREF=\"/\"><IMG SRC=\"/gifs/home.gif\" ALT=\"FreeBSD Home Page\">\n"; |
|
# print "</A>\n"; |
|
print "</BODY></HTML>\n"; |
print "</BODY></HTML>\n"; |
} else { |
} else { |
|
# Assume it's a module name with a potential path following it. |
|
$where =~ s|/.*||; |
|
$xtra = $&; |
|
# Is there an indexed version of modules? |
|
if (open(MODULES, "$cvsroot/CVSROOT/modules")) { |
|
while (<MODULES>) { |
|
if (/^${where}\s+(\S+)/o && -d "${cvsroot}/$1") { |
|
&redirect($scriptname . '/' . $1 . $xtra); |
|
} |
|
} |
|
} |
&fatal("404 Not Found","$where: no such file or directory"); |
&fatal("404 Not Found","$where: no such file or directory"); |
} |
} |
|
|
sub htmlify { |
sub htmlify { |
local($string) = @_; |
local($string) = @_; |
|
|
|
$string =~ s/&/&/g; |
$string =~ s/</</g; |
$string =~ s/</</g; |
$string =~ s/>/>/g; |
$string =~ s/>/>/g; |
|
|
|
|
local(@r2) = split(/\./, $rev2); |
local(@r2) = split(/\./, $rev2); |
local($a,$b); |
local($a,$b); |
|
|
while (($a = pop(@r1)) && ($b = pop(@r2))) { |
while (($a = shift(@r1)) && ($b = shift(@r2))) { |
if ($a != $b) { |
if ($a != $b) { |
return $a <=> $b; |
return $a <=> $b; |
} |
} |
|
|
print "\n"; |
print "\n"; |
print "<HTML><HEAD><TITLE>Error</TITLE></HEAD>\n"; |
print "<HTML><HEAD><TITLE>Error</TITLE></HEAD>\n"; |
print "<BODY>Error: $errmsg</BODY></HTML>\n"; |
print "<BODY>Error: $errmsg</BODY></HTML>\n"; |
|
exit(1); |
|
} |
|
|
|
sub redirect { |
|
local($url) = @_; |
|
print "Status: 301 Moved\n"; |
|
print "Location: $url\n"; |
|
print "\n"; |
|
print "<HTML><HEAD><TITLE>Moved</TITLE></HEAD>\n"; |
|
print "<BODY>This document is located <A HREF=$url>here</A>.</BODY></HTML>\n"; |
exit(1); |
exit(1); |
} |
} |