=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.4 retrieving revision 1.10 diff -u -p -r1.4 -r1.10 --- cvsweb/cvsweb.cgi 1997/02/03 20:47:12 1.4 +++ cvsweb/cvsweb.cgi 1997/11/14 17:36:47 1.10 @@ -31,7 +31,17 @@ require 'ctime.pl'; $hsty_base = ""; require 'cgi-style.pl'; -$cvsroot = '/home/ncvs'; +%CVSROOT = ( + 'freebsd', '/home/ncvs', + 'openbsd', '/home/OpenBSD/cvs', + 'learn', '/c/learncvs', + ); + +$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 +54,12 @@ 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. +
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 +70,40 @@ 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; +} + + + +if ($input{'cvsroot'}) { + if ($CVSROOT{$input{'cvsroot'}}) { + $cvstree = $input{'cvsroot'}; + $cvsroot = $CVSROOT{"$cvstree"}; + } +} + +$fullname = $cvsroot . '/' . $where; if (!-d $cvsroot) { &fatal("500 Internal Error",'$CVSROOT not found!'); } + + 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); @@ -88,151 +120,87 @@ if (-d $fullname) { # provides the results that I want in most browsers. Another # case of layout spooging up HTML. print "
\n"; + if ($input{"only_on_branch"}) { + print "