=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.7 retrieving revision 1.18 diff -u -p -r1.7 -r1.18 --- cvsweb/cvsweb.cgi 1997/04/30 18:25:05 1.7 +++ cvsweb/cvsweb.cgi 1998/05/08 10:14:10 1.18 @@ -30,8 +30,27 @@ require 'ctime.pl'; $hsty_base = ""; require 'cgi-style.pl'; +#&get_the_source; -$cvsroot = '/home/ncvs'; +%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', + ); + +$cvstreedefault = 'freebsd'; +$cvstree = $cvstreedefault; +$cvsroot = $CVSROOT{"$cvstree"} || "/home/ncvs"; + + $intro = " This is a WWW interface to the FreeBSD CVS tree. You can browse the file hierarchy by picking directories @@ -46,10 +65,11 @@ display diffs between arbitrary revisions.
If you would like to use this CGI script on your own web server and CVS tree, see -the CVSWeb distribution site. +the CVSWeb distribution site or the 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 @@ -60,18 +80,13 @@ chance to display diffs between revisions. $verbose = $v; ($where = $ENV{'PATH_INFO'}) =~ s|^/||; $where =~ s|/$||; -$fullname = $cvsroot . '/' . $where; ($scriptname = $ENV{'SCRIPT_NAME'}) =~ s|^/?|/|; $scriptname =~ s|/$||; $scriptwhere = $scriptname . '/' . $where; $scriptwhere =~ s|/$||; -if (!-d $cvsroot) { - &fatal("500 Internal Error",'$CVSROOT not found!'); -} - -if ($q = $ENV{'QUERY_STRING'}) { - foreach (split(/&/, $q)) { +if ($query = $ENV{'QUERY_STRING'}) { + foreach (split(/&/, $query)) { s/%(..)/sprintf("%c", hex($1))/ge; # unquote %-quoted if (/(\S+)=(.*)/) { $input{$1} = $2; @@ -79,7 +94,48 @@ if ($q = $ENV{'QUERY_STRING'}) { $input{$_}++; } } + $query = "?" . $query; } + + +$config = '/usr/local/etc/cvsweb'; +do "$config" if -f $config; + +if ($input{'cvsroot'}) { + if ($CVSROOT{$input{'cvsroot'}}) { + $cvstree = $input{'cvsroot'}; + $cvsroot = $CVSROOT{"$cvstree"}; + } +} +do "$config-$cvstree" if -f "$config-$cvstree"; + +$fullname = $cvsroot . '/' . $where; + +if (!-d $cvsroot) { + &fatal("500 Internal Error",'$CVSROOT not found!
The server on which the CVS tree lives is probably down. Please try again in a few minutes.'); +} + + +{ + local(@foo, $i); + local($scriptname) = $ENV{'SCRIPT_NAME'}; + foreach (keys %CVSROOT) { + if (-d $CVSROOT{$_}) { + push(@foo, $_); + } + } + if ($#foo > 1) { + $intro .= "
\nThis script support the following CVS trees:\n"; + for($i = 0; $i <= $#foo; $i++) { + $intro .= qq{} . + ($CVSROOTdescr{$foo[$i]} ? + $CVSROOTdescr{$foo[$i]} : $foo[$i]) . qq{} . + ($i == $#foo ? ".\n" : ",\n"); + } + } +} + + if (-d $fullname) { opendir(DIR, $fullname) || &fatal("404 Not Found","$where: $!"); @dir = readdir(DIR); @@ -91,33 +147,83 @@ if (-d $fullname) { print &html_header("/$where"); print $shortinstr; } - print "
Current directory: /$where\n"; + print "
";
+ print "Current CVS tree: $cvstree
\n"
+ if $cvstree ne $cvstreedefault;
+ print "Current directory: /$where\n";
print "