===================================================================
RCS file: /cvs/cvsweb/cvsweb.cgi,v
retrieving revision 3.35
retrieving revision 3.39
diff -u -p -r3.35 -r3.39
--- cvsweb/cvsweb.cgi 2000/10/10 21:14:05 3.35
+++ cvsweb/cvsweb.cgi 2000/11/04 15:32:17 3.39
@@ -42,8 +42,8 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $zId: cvsweb.cgi,v 1.103 2000/09/20 17:02:29 jumager Exp $
-# $Id: cvsweb.cgi,v 3.35 2000/10/10 21:14:05 knu Exp $
+# $zId: cvsweb.cgi,v 1.104 2000/11/01 22:05:12 hnordstrom Exp $
+# $Id: cvsweb.cgi,v 3.39 2000/11/04 15:32:17 knu Exp $
#
###
@@ -52,6 +52,7 @@ use strict;
use vars qw (
$config $allow_version_select $verbose
%CVSROOT %CVSROOTdescr %MIRRORS %DEFAULTVALUE %ICONS %MTYPES
+ @DIFFTYPES %DIFFTYPES @LOGSORTKEYS %LOGSORTKEYS
%alltags @tabcolors %fileinfo %tags @branchnames %nameprinted
%symrev %revsym @allrevisions %date %author @revdisplayorder
@revisions %state %difflines %log %branchpoint @revorder
@@ -61,7 +62,7 @@ use vars qw (
%funcline_regexp $is_mod_perl
$is_links $is_lynx $is_w3m $is_msie $is_mozilla3 $is_textbased
%input $query $barequery $sortby $bydate $byrev $byauthor
- $bylog $byfile $hr_default $logsort $cvstree $cvsroot
+ $bylog $byfile $defaultDiffType $logsort $cvstree $cvsroot
$mimetype $defaultTextPlain $defaultViewable $allow_compress
$GZIPBIN $backicon $diricon $fileicon $fullname $newname
$cvstreedefault $body_tag $body_tag_for_src
@@ -83,7 +84,10 @@ use vars qw (
);
sub printDiffSelect($);
+sub printDiffLinks($$);
+sub printLogSortSelect($);
sub findLastModifiedSubdirs(@);
+sub htmlify_sub(&$);
sub htmlify($;$);
sub spacedHtmlText($;$);
sub link($$);
@@ -117,6 +121,7 @@ sub download_link($$$;$);
sub toggleQuery($$);
sub urlencode($);
sub htmlquote($);
+sub htmlunquote($);
sub http_header(;$);
sub html_header($);
sub html_footer();
@@ -164,6 +169,49 @@ $tabstop = $use_moddate = $moddate = $gzip_open = unde
$LOG_FILESEPARATOR = q/^={77}$/;
$LOG_REVSEPARATOR = q/^-{28}$/;
+@DIFFTYPES = qw(h H u c s);
+@DIFFTYPES{@DIFFTYPES} = (
+ {
+ 'descr' => 'colored',
+ 'opts' => [ '-u' ],
+ 'colored' => 1,
+ },
+ {
+ 'descr' => 'long colored',
+ 'opts' => [ '--unified=15' ],
+ 'colored' => 1,
+ },
+ {
+ 'descr' => 'unified',
+ 'opts' => [ '-u' ],
+ 'colored' => 0,
+ },
+ {
+ 'descr' => 'context',
+ 'opts' => [ '-c' ],
+ 'colored' => 0,
+ },
+ {
+ 'descr' => 'side by side',
+ 'opts' => [ '--side-by-side', '--width=164' ],
+ 'colored' => 0,
+ },
+ );
+
+@LOGSORTKEYS = qw(cvs date rev);
+@LOGSORTKEYS{@LOGSORTKEYS} = (
+ {
+ 'descr' => 'Not sorted',
+ },
+ {
+ 'descr' => 'Commit date',
+ },
+ {
+ 'descr' => 'Revision',
+ },
+ );
+
+
##### End of configuration variables #####
use Time::Local;
@@ -327,7 +375,7 @@ else {
$byfile = 1;
}
-$hr_default = $input{'f'} eq 'h';
+$defaultDiffType = $input{'f'};
$logsort = $input{'logsort'};
@@ -482,9 +530,8 @@ elsif (-d $fullname) {
}
print "
\n";
$infocols++;
- print "";
+ printf ' ',
+ $byfile ? $columnHeaderColorSorted : $columnHeaderColorDefault;
if ($byfile) {
print 'File';
} else {
@@ -496,9 +543,8 @@ elsif (-d $fullname) {
# with revision information:
if (scalar(%fileinfo)) {
$infocols++;
- print " ";
+ printf ' ',
+ $byrev ? $columnHeaderColorSorted : $columnHeaderColorDefault;
if ($byrev) {
print 'Rev.';
} else {
@@ -507,21 +553,19 @@ elsif (-d $fullname) {
}
print " ";
$infocols++;
- print "";
+ printf ' ',
+ $bydate ? $columnHeaderColorSorted : $columnHeaderColorDefault;
if ($bydate) {
print 'Age';
} else {
print &link('Age', sprintf('./%s#dirlist',
- &toggleQuery("sortby", "date")));
+ &toggleQuery("sortby", "date")));
}
print " ";
if ($show_author) {
$infocols++;
- print "";
+ printf ' ',
+ $byauthor ? $columnHeaderColorSorted : $columnHeaderColorDefault;
if ($byauthor) {
print 'Author';
} else {
@@ -531,19 +575,18 @@ elsif (-d $fullname) {
print " ";
}
$infocols++;
- print "";
+ printf ' ',
+ $bylog ? $columnHeaderColorSorted : $columnHeaderColorDefault;
if ($bylog) {
print 'Last log entry';
} else {
print &link('Last log entry', sprintf('./%s#dirlist',
- &toggleQuery("sortby", "log")));
+ &toggleQuery("sortby", "log")));
}
print " ";
}
elsif ($use_descriptions) {
- print "";
+ printf ' ', $columnHeaderColorDefault;
print "Description";
$infocols++;
}
@@ -608,9 +651,9 @@ elsif (-d $fullname) {
next if ($_ eq '..' && $where eq '/');
my ($rev,$date,$log,$author,$filename) = @{$fileinfo{$_}}
if (defined($fileinfo{$_}));
- print " " if ($dirtable);
+ printf ' ', $tabcolors[$dirrow % 2] if $dirtable;
if ($_ eq '..') {
- $url = "../" . $query;
+ $url = "../$query";
if ($nofilelinks) {
print $backicon;
}
@@ -620,7 +663,7 @@ elsif (-d $fullname) {
print " ", &link("Previous Directory", $url);
}
else {
- $url = urlencode($_) . '/' . $query;
+ $url = urlencode($_) . "/$query";
print " ";
if ($nofilelinks) {
print $diricon;
@@ -639,7 +682,7 @@ elsif (-d $fullname) {
if ($filename) {
print " " if ($dirtable);
if ($date) {
- print " " . readableTime(time() - $date,0) . " ";
+ print " ", readableTime(time() - $date,0), " ";
}
if ($show_author) {
print " " if ($dirtable);
@@ -650,8 +693,8 @@ elsif (-d $fullname) {
print "$filename/$rev";
print " " if ($dirtable);
if ($log) {
- print " "
- . &htmlify(substr($log,0,$shortLogLen));
+ print " ",
+ &htmlify(substr($log,0,$shortLogLen));
if (length $log > 80) {
print "...";
}
@@ -661,7 +704,7 @@ elsif (-d $fullname) {
else {
my ($dwhere) = ($where ne "/" ? $where : "") . $_;
if ($use_descriptions && defined $descriptions{$dwhere}) {
- print " " if $dirtable;
+ print " " if $dirtable;
print $descriptions{$dwhere};
} elsif ($dirtable && $infocols > 1) {
# close the row with the appropriate number of
@@ -692,7 +735,7 @@ elsif (-d $fullname) {
next if (!defined($fileinfo{$_}));
($rev,$date,$log,$author) = @{$fileinfo{$_}};
$filesfound++;
- print " " if ($dirtable);
+ printf ' ', $tabcolors[$dirrow % 2] if $dirtable;
print " ";
if ($nofilelinks) {
print $fileicon;
@@ -707,7 +750,7 @@ elsif (-d $fullname) {
$defaultViewable ? "text/x-cvsweb-markup" : undef);
print " " if ($dirtable);
if ($date) {
- print " " . readableTime(time() - $date,0) . " ";
+ print " ", readableTime(time() - $date,0), " ";
}
if ($show_author) {
print " " if ($dirtable);
@@ -715,7 +758,7 @@ elsif (-d $fullname) {
}
print " " if ($dirtable);
if ($log) {
- print " " . &htmlify(substr($log,0,$shortLogLen));
+ print " ", &htmlify(substr($log,0,$shortLogLen));
if (length $log > 80) {
print "...";
}
@@ -730,7 +773,7 @@ elsif (-d $fullname) {
if ($dirtable && defined($tableBorderColor)) {
print "
";
}
- print "". ($dirtable == 1) ? "" : "" . "\n";
+ print( $dirtable == 1 ? "\n" : "\n" );
if ($filesexists && !$filesfound) {
print "NOTE: There are $filesexists files, but none matches the current tag ($input{only_with_tag})\n";
@@ -788,12 +831,9 @@ elsif (-d $fullname) {
print "Revision";
print " Log message";
print "";
- print "revisions by: \n";
- print "\n";
- print "Not sorted";
- print " Commit date";
- print " Revision";
- print " ";
+ print "Sort log by: ";
+ printLogSortSelect(0);
+ print " ";
print "Diff format: ";
printDiffSelect(0);
print " ";
@@ -887,18 +927,43 @@ gzipclose();
sub printDiffSelect($) {
my ($use_java_script) = @_;
- my ($f) = $input{'f'};
- print "\n";
- print "Colored Diff";
- print " Long Colored Diff";
- print " Unidiff";
- print " Context Diff";
- print " Side by Side";
+ my $f = $input{'f'};
+
+ print '';
+
+ local $_;
+ for (@DIFFTYPES) {
+ printf('%s',
+ $_,
+ $f eq $_ ? ' SELECTED' : '',
+ "\u$DIFFTYPES{$_}{'descr'}"
+ );
+ }
+
print " ";
}
+sub printLogSortSelect($) {
+ my ($use_java_script) = @_;
+
+ print '';
+
+ local $_;
+ for (@LOGSORTKEYS) {
+ printf('%s',
+ $_,
+ $logsort eq $_ ? ' SELECTED' : '',
+ "\u$LOGSORTKEYS{$_}{'descr'}"
+ );
+ }
+
+ print " ";
+}
+
sub findLastModifiedSubdirs(@) {
my (@dirs) = @_;
my ($dirname, @files);
@@ -933,30 +998,93 @@ sub findLastModifiedSubdirs(@) {
return @files;
}
+sub htmlify_sub(&$) {
+ (my $proc, local $_) = @_;
+ local @_ = split(m`(]+>[^<]* )`i);
+ my $linked;
+ my $result = '';
+
+ while (($_, $linked) = splice(@_, 0, 2)) {
+ &$proc();
+ $result .= $_ if defined($_);
+ $result .= $linked if defined($linked);
+ }
+
+ $result;
+}
+
sub htmlify($;$) {
- (local $_, my $extra) = @_;
+ (local $_, my $extra) = @_;
- $_ = htmlquote($_);
+ $_ = htmlquote($_);
- # get URL's as link
- s`(http|ftp|https)(://[-a-zA-Z0-9%.~:_/]+)([?&]([-a-zA-Z0-9%.~:_]+)=([-a-zA-Z0-9%.~:_])+)*`&link("$1$2$3", "$1$2$3")`ge; # `
- # get e-mails as link
- s`[-a-zA-Z0-9_.]+@([-a-zA-Z0-9]+\.)+[A-Za-z]{2,4}`&link($&, "mailto:$&")`ge; # `
+ # get URL's as link
+ s{
+ (http|ftp|https)://\S+
+ }{
+ &link($&, htmlunquote($&))
+ }egx;
- if ($extra) {
- # get PR #'s as link: "PR#nnnn" "PR: nnnn, ..." "PR nnnn, ..." "bin/nnnn"
- if (defined($prcgi)) {
- 1 while s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`$1 . &link($2, sprintf($prcgi, $2))`ie; # `;
- s`\b${prcategories}/(\d+)\b`&link($&, sprintf($prcgi, $1))`igeo; # `;
- }
+ # get e-mails as link
+ $_ = htmlify_sub {
+ s<
+ [\w+=\-.!]+@[\w\-]+(\.[\w\-]+)+
+ ><
+ &link($&, "mailto:$&")
+ >egix;
+ } $_;
- # get manpage specs as link: "foo.1" "foo(1)"
- if (defined($mancgi)) {
- s`\b([a-zA-Z]\w+)(?:\(([0-9n])\)\B|\.([0-9n])\b)`&link($&, sprintf($mancgi, $2 ne '' ? $2 : $3, $1))`ge; # `x;
- }
+ if ($extra) {
+ # get PR #'s as link: "PR#nnnn" "PR: nnnn, ..." "PR nnnn, ..." "bin/nnnn"
+ if (defined($prcgi)) {
+ my $prev;
+
+ do {
+ $prev = $_;
+
+ $_ = htmlify_sub {
+ s{
+ (\bPR[:\#]?\s*
+ (?:
+ \#?
+ \d+[,\s]\s*
+ )*
+ \#?)
+ (\d+)\b
+ }{
+ $1 . &link($2, sprintf($prcgi, $2)) . $3
+ }egix;
+ } $_;
+ } while ($_ ne $prev);
+
+ $_ = htmlify_sub {
+ s{
+ (\b$prcategories/(\d+)\b)
+ }{
+ &link($1, sprintf($prcgi, $2)) . $3
+ }egox;
+ } $_;
}
- $_;
+ # get manpage specs as link: "foo.1" "foo(1)"
+ if (defined($mancgi)) {
+ $_ = htmlify_sub {
+ s{
+ (\b([a-zA-Z][\w_.]+)
+ (?:
+ \( ([0-9n]) \)\B
+ |
+ \.([0-9n])\b
+ )
+ )
+ }{
+ &link($1, sprintf($mancgi, $3 ne '' ? $3 : $4, $2)) . $5
+ }egx;
+ } $_;
+ }
+ }
+
+ $_;
}
sub spacedHtmlText($;$) {
@@ -1066,7 +1194,7 @@ sub safeglob($) {
$glob =~ s/{([^}]+)}/($t = $1) =~ s-,-|-g; "($t)"/eg;
foreach (readdir($dh)) {
if (/^${glob}$/) {
- push(@results, $dirname . "/" .$_);
+ push(@results, "$dirname/" .$_);
}
}
}
@@ -1265,7 +1393,7 @@ sub doAnnotate($$) {
}
else {
$revprint = sprintf('%-8s', $lrev);
- $revprint =~ s`\S+`&link($&, "$scriptwhere$barequery#rev$&")`e; # `
+ $revprint =~ s`\S+`&link($&, "$scriptwhere$query#rev$&")`e; # `
$oldLusr = '';
}
if ($lusr eq $oldLusr) {
@@ -1296,7 +1424,7 @@ sub doAnnotate($$) {
# CVS command line client. But for simplicity, we don't.
}
elsif ($words[0] eq "error") {
- fatal ("500 Internal Error", "Error occured during annotate: $_ ");
+ fatal("500 Internal Error", "Error occured during annotate: $_ ");
}
}
if ($annTable) {
@@ -1470,7 +1598,7 @@ sub viewable($) {
sub doDiff($$$$$$) {
my($fullname, $r1, $tr1, $r2, $tr2, $f) = @_;
my $fh = do {local(*FH);};
- my ($rev1, $rev2, $sym1, $sym2, @difftype, $diffname, $f1, $f2);
+ my ($rev1, $rev2, $sym1, $sym2, $f1, $f2);
if ($r1 =~ /([^:]+)(:(.+))?/) {
$rev1 = $1;
@@ -1504,36 +1632,18 @@ sub doDiff($$$$$$) {
($rev1, $sym1) = ($rev2, $sym2);
($rev2, $sym2) = ($tmp1, $tmp2);
}
- my $human_readable = 0;
- if ($f eq 'c') {
- @difftype = qw{-c};
- $diffname = "Context diff";
- }
- elsif ($f eq 's') {
- @difftype = qw{--side-by-side --width=164};
- $diffname = "Side by Side";
- }
- elsif ($f eq 'H') {
- $human_readable = 1;
- @difftype = qw{--unified=15};
- $diffname = "Long Human readable";
- }
- elsif ($f eq 'h') {
- @difftype =qw{-u};
- $human_readable = 1;
- $diffname = "Human readable";
- }
- elsif ($f eq 'u') {
- @difftype = qw{-u};
- $diffname = "Unidiff";
- }
- else {
+ my $difftype = $DIFFTYPES{$f};
+
+ if (!$difftype) {
fatal ("400 Bad arguments", "Diff format $f not understood");
}
+ my @difftype = @{$difftype->{'opts'}};
+ my $human_readable = $difftype->{'colored'};
+
# apply special options
if ($showfunc) {
- push @difftype, '-p' if $f =~ /^[cHhu]$/;
+ push @difftype, '-p' if $f ne 's';
my($re1, $re2);
@@ -1595,14 +1705,14 @@ sub doDiff($$$$$$) {
s|$cvsroot/||o;
if ($sym1) {
chop;
- $_ .= " " . $sym1 . "\n";
+ $_ .= " $sym1\n";
}
}
elsif (m|^$f2 $cvsroot|o) {
s|$cvsroot/||o;
if ($sym2) {
chop;
- $_ .= " " . $sym2 . "\n";
+ $_ .= " $sym2\n";
}
}
print $_;
@@ -1695,7 +1805,7 @@ again:
if ($state eq "tags" && /^\S/) {
if (defined($tag) && (defined($symrev{$tag}) || $tag eq "HEAD")) {
$revwanted = $tag eq "HEAD" ? $symrev{"MAIN"} : $symrev{$tag};
- ($branch = $revwanted) =~ s/\b0\.//;
+ ($branch = $revwanted) =~ s/\.0\././;
($branchpoint = $branch) =~ s/\.?\d+$//;
$revwanted = undef if ($revwanted ne $branch);
}
@@ -1724,9 +1834,9 @@ again:
# End of a log entry.
my $revbranch;
($revbranch = $rev) =~ s/\.\d+$//;
- print "$filename $rev Wanted: $revwanted "
- . "Revbranch: $revbranch Branch: $branch "
- . "Branchpoint: $branchpoint\n" if ($verbose);
+ print "$filename $rev Wanted: $revwanted ",
+ "Revbranch: $revbranch Branch: $branch ",
+ "Branchpoint: $branchpoint\n" if ($verbose);
if (!defined($revwanted) && defined($branch)
&& $branch eq $revbranch || !defined($tag)) {
print "File revision $rev found for branch $branch\n"
@@ -1764,7 +1874,7 @@ again:
next;
}
else {
- $log = $log . $_;
+ $log .= $_;
}
}
if (/$LOG_FILESEPARATOR/o) {
@@ -1924,7 +2034,7 @@ sub readLog($;$) {
foreach (reverse sort keys %symrev) {
$rev = $symrev{$_};
- if ($rev =~ /^((.*)\.)?\b0\.(\d+)$/) {
+ if ($rev =~ /^((.*)\.)0\.(\d+)$/) {
push(@branchnames, $_);
#
# A revision number of A.B.0.D really translates into
@@ -1937,9 +2047,11 @@ sub readLog($;$) {
# with the branch number 0.A, with the exception that
# it has no head to translate to if there is nothing on
# the branch, but I guess this can never happen?
- # (the code below gracefully forgets about the branch
- # if it should happen)
#
+ # Since some stupid people actually import/check in
+ # files with version 0.X we assume that the above cannot
+ # happen, and regard 0.X(.*) as a revision and not a branch.
+ #
$head = defined($2) ? $2 : "";
$branch = $3;
$branchrev = $head . ($head ne "" ? "." : "") . $branch;
@@ -1969,7 +2081,7 @@ sub readLog($;$) {
my ($onlyonbranch, $onlybranchpoint);
if ($onlyonbranch = $input{'only_with_tag'}) {
$onlyonbranch = $symrev{$onlyonbranch};
- if ($onlyonbranch =~ s/\b0\.//) {
+ if ($onlyonbranch =~ s/\.0\././) {
($onlybranchpoint = $onlyonbranch) =~ s/\.\d+$//;
}
else {
@@ -2007,6 +2119,20 @@ sub readLog($;$) {
}
+sub printDiffLinks($$) {
+ my($text, $url) = @_;
+ my @extra;
+
+ local $_;
+ for ($DIFFTYPES{$defaultDiffType}{'colored'} ? qw(u) : qw(h)) {
+ my $f = $_ eq $defaultDiffType ? '' : $_;
+
+ push @extra, &link(lc $DIFFTYPES{$_}{'descr'}, "$url&f=$f");
+ }
+
+ print &link($text, $url), ' (', join(', ', @extra), ')';
+}
+
sub printLog($;$) {
my ($link, $br, $brp);
($_,$link) = @_;
@@ -2083,13 +2209,13 @@ sub printLog($;$) {
}
if (defined @mytz) {
my ($est) = $mytz[(localtime($date{$_}))[8]];
- print ", " . scalar localtime($date{$_}) . " $est (";
+ print ", ", scalar localtime($date{$_}), " $est (";
} else {
- print ", " . scalar gmtime($date{$_}) . " UTC (";
+ print ", ", scalar gmtime($date{$_}), " UTC (";
}
- print readableTime(time() - $date{$_},1) . " ago)";
+ print readableTime(time() - $date{$_},1), " ago)";
print " by ";
- print "" . $author{$_} . " \n";
+ print "", $author{$_}, " \n";
print " Branch: ",$link?link_tags($revsym{$br}):$revsym{$br}," \n"
if ($revsym{$br});
print " CVS Tags: ",$link?link_tags($revsym{$_}):$revsym{$_}," "
@@ -2131,10 +2257,7 @@ sub printLog($;$) {
$barequery);
print " to previous ";
- print &link($prev, $url);
- if (!$hr_default) { # offer a human readable version if not default
- print &link('colored', "$url&f=h");
- }
+ printDiffLinks($prev, $url);
}
#
# Plus, if it's on a branch, and it's not a vendor branch,
@@ -2147,10 +2270,7 @@ sub printLog($;$) {
$barequery);
print " to branchpoint ";
- print &link($brp, $url);
- if (!$hr_default) { # offer a human readable version if not default
- print &link('colored', "$url&f=h");
- }
+ printDiffLinks($brp, $url);
}
#
# Plus, if it's on a branch, and it's not a vendor branch,
@@ -2183,10 +2303,7 @@ sub printLog($;$) {
$barequery);
print " next main ";
- print &link($nextmain, $url);
- if (!$hr_default) { # offer a human readable version if not default
- print &link('colored', "$url&f=h");
- }
+ printDiffLinks($nextmain, $url);
}
}
# Plus if user has selected only r1, then present a link
@@ -2201,10 +2318,7 @@ sub printLog($;$) {
$barequery);
print " to selected ";
- print &link($input{'r1'}, $url);
- if (!$hr_default) { # offer a human readable version if not default
- print &link('colored', "$url&f=h");
- }
+ printDiffLinks($input{'r1'}, $url);
}
}
print "\n";
@@ -2284,8 +2398,8 @@ sub doLog($) {
print " \n";
print " ";
@@ -2396,17 +2506,16 @@ sub human_readable_diff($){
$date2 = $r2d;
}
- print "Diff for /$where_nd between version $rev1 and $rev2 \n";
-
- print "\n";
- print "\n";
- print "";
- print "version $rev1";
+ print "Diff for /$where_nd between version $rev1 and $rev2 \n",
+ "\n",
+ "\n",
+ "",
+ "version $rev1";
print ", $date1" if (defined($date1));
print " Tag: $sym1\n" if ($sym1);
- print " \n";
- print "";
- print "version $rev2";
+ print " \n",
+ "",
+ "version $rev2";
print ", $date2" if (defined($date2));
print " Tag: $sym2\n" if ($sym1);
print " \n";
@@ -2531,7 +2640,7 @@ sub navigateHeader($$$$$) {
$swhere = urlencode($filename) if ($swhere eq "");
print "<\!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
print "\n\n";
- print '';
+ print '';
print "\n$path$filename - $title - $rev \n";
print "$body_tag_for_src\n";
print "";
@@ -2547,10 +2656,10 @@ sub navigateHeader($$$$$) {
sub plural_write($$) {
my ($num,$text) = @_;
if ($num != 1) {
- $text = $text . "s";
+ $text .= "s";
}
if ($num > 0) {
- return $num . " " . $text;
+ return join(' ', $num, $text);
}
else {
return "";
@@ -2594,7 +2703,7 @@ sub readableTime($$) {
my $resttime = plural_write(int ($rest / $break),
$desc{$break});
if ($resttime) {
- $retval = $retval . ", " . $resttime;
+ $retval .= ", $resttime";
}
}
@@ -2624,8 +2733,8 @@ sub clickablePath($$) {
my $wherepath = '';
my ($lastslash) = $pathname =~ m|/$|;
foreach (split(/\//, $pathname)) {
- $retval = $retval . " / ";
- $wherepath = $wherepath . '/' . $_;
+ $retval .= " / ";
+ $wherepath .= "/$_";
my ($last) = "$wherepath/" eq "/$pathname"
|| $wherepath eq "/$pathname";
if ($clickLast || !$last) {
@@ -2669,8 +2778,7 @@ sub chooseCVSRoot() {
foreach $k (@foo) {
print "" . ($CVSROOTdescr{$k} ? $CVSROOTdescr{$k} :
- $k). " \n";
+ print ">", ($CVSROOTdescr{$k} ? $CVSROOTdescr{$k} : $k), "\n";
}
print "\n";
print " ";
@@ -2735,7 +2843,7 @@ sub fileSortCmp() {
sub download_url($$;$) {
my ($url,$revision,$mimetype) = @_;
- $revision =~ s/\b0\.//;
+ $revision =~ s/\.0\././;
if (defined($checkoutMagic)
&& (!defined($mimetype) || $mimetype ne "text/x-cvsweb-markup")) {
@@ -2845,6 +2953,18 @@ sub htmlquote($) {
$_;
}
+sub htmlunquote($) {
+ local($_) = @_;
+
+ # Special Characters; RFC 1866
+ s/"/\"/g;
+ s/<//g;
+ s/&/&/g;
+
+ $_;
+}
+
sub http_header(;$) {
my $content_type = shift || "text/html";
if (defined($moddate)) {
@@ -2852,7 +2972,7 @@ sub http_header(;$) {
Apache->request->header_out("Last-Modified" => scalar gmtime($moddate) . " GMT");
}
else {
- print "Last-Modified: " . scalar gmtime($moddate) . " GMT\r\n";
+ print "Last-Modified: ", scalar gmtime($moddate), " GMT\r\n";
}
}
if ($is_mod_perl) {
@@ -2903,7 +3023,7 @@ sub http_header(;$) {
sub html_header($) {
my ($title) = @_;
- my $version = '$zRevision: 1.103 $ $Revision: 3.35 $'; #'
+ my $version = '$zRevision: 1.104 $ $Revision: 3.39 $'; #'
http_header();
print <