=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.5 retrieving revision 1.18 diff -u -p -r1.5 -r1.18 --- cvsweb/cvsweb.cgi 1997/03/20 01:36:20 1.5 +++ 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 @@ -44,8 +63,13 @@ diffs between that revision and the previous one, and 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 +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 @@ -56,22 +80,63 @@ 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 ($query = $ENV{'QUERY_STRING'}) { + foreach (split(/&/, $query)) { + s/%(..)/sprintf("%c", hex($1))/ge; # unquote %-quoted + if (/(\S+)=(.*)/) { + $input{$1} = $2; + } else { + $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!'); + &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) { -# Something that would be nice to support, although I have no real -# good idea of how, would be to get full directory diff's, using -# symbolic names (revision numbers would be meaningless). -# The problem is finding a list of symbolic names that is common -# to all the files in the directory. -# opendir(DIR, $fullname) || &fatal("404 Not Found","$where: $!"); @dir = readdir(DIR); closedir(DIR); @@ -82,110 +147,301 @@ 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 "