[BACK]Return to cvsweb.cgi CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / cvsweb

Diff for /cvsweb/cvsweb.cgi between version 1.1.1.28 and 1.1.1.29

version 1.1.1.28, 2001/08/01 10:24:01 version 1.1.1.29, 2002/04/10 20:03:49
Line 10 
Line 10 
 #             Dick Balaska     <dick@buckosoft.com>  #             Dick Balaska     <dick@buckosoft.com>
 #             Akinori MUSHA    <knu@FreeBSD.org>  #             Akinori MUSHA    <knu@FreeBSD.org>
 #             Jens-Uwe Mager   <jum@helios.de>  #             Jens-Uwe Mager   <jum@helios.de>
   #             Ville Skyttä     <ville.skytta@iki.fi> (html cleanup)
 #  #
 # Based on:  # Based on:
 # * Bill Fenners cvsweb.cgi revision 1.28 available from:  # * Bill Fenners cvsweb.cgi revision 1.28 available from:
Line 18 
Line 19 
 # Copyright (c) 1996-1998 Bill Fenner  # Copyright (c) 1996-1998 Bill Fenner
 #           (c) 1998-1999 Henner Zeller  #           (c) 1998-1999 Henner Zeller
 #           (c) 1999      Henrik Nordstrom  #           (c) 1999      Henrik Nordstrom
 #           (c) 2000-2001 Akinori MUSHA  #           (c) 2000-2002 Akinori MUSHA
 # All rights reserved.  # All rights reserved.
 #  #
 # Redistribution and use in source and binary forms, with or without  # Redistribution and use in source and binary forms, with or without
Line 42 
Line 43 
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.  # SUCH DAMAGE.
 #  #
   # $FreeBSD: projects/cvsweb/cvsweb.cgi,v 1.90 2002/04/10 19:25:11 knu Exp $
 # $zId: cvsweb.cgi,v 1.112 2001/07/24 13:03:16 hzeller Exp $  # $zId: cvsweb.cgi,v 1.112 2001/07/24 13:03:16 hzeller Exp $
 # $Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.82 2001/08/01 09:54:52 knu Exp $  # $Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.84 2001/10/07 20:50:10 knu Exp $
 #  #
 ###  ###
   
Line 67  use vars qw (
Line 69  use vars qw (
     $is_links $is_lynx $is_w3m $is_msie $is_mozilla3 $is_textbased      $is_links $is_lynx $is_w3m $is_msie $is_mozilla3 $is_textbased
     %input $query $barequery $sortby $bydate $byrev $byauthor      %input $query $barequery $sortby $bydate $byrev $byauthor
     $bylog $byfile $defaultDiffType $logsort $cvstree $cvsroot      $bylog $byfile $defaultDiffType $logsort $cvstree $cvsroot
     $mimetype $charset $defaultTextPlain $defaultViewable      $mimetype $charset $output_filter $defaultTextPlain $defaultViewable
     $command_path %CMD $allow_compress      $command_path %CMD $allow_compress
     $backicon $diricon $fileicon      $backicon $diricon $fileicon
     $fullname $newname $cvstreedefault      $fullname $newname $cvstreedefault
Line 106  sub search_path($);
Line 108  sub search_path($);
 sub getMimeTypeFromSuffix($);  sub getMimeTypeFromSuffix($);
 sub head($;$);  sub head($;$);
 sub scan_directives(@);  sub scan_directives(@);
   sub openOutputFilter();
 sub doAnnotate($$);  sub doAnnotate($$);
 sub doCheckout($$);  sub doCheckout($$);
 sub cvswebMarkup($$$);  sub cvswebMarkup($$$);
Line 141  sub forbidden_module($);
Line 144  sub forbidden_module($);
 ##### Start of Configuration Area ########  ##### Start of Configuration Area ########
 delete $ENV{PATH};  delete $ENV{PATH};
   
 $cvsweb_revision =  $cvsweb_revision = '2.0.1';
     '1.112' . '.' . (  
     split (/ /,  
     q$Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.82 2001/08/01 09:54:52 knu Exp $  
 ))[2];  
   
 use File::Basename;  use File::Basename;
   
Line 301  if (-f $config) {
Line 300  if (-f $config) {
         require $config || &fatal(          require $config || &fatal(
                 "500 Internal Error",                  "500 Internal Error",
                 sprintf(                  sprintf(
                         'Error in loading configuration file: %s<BR><BR>%s<BR>',                          'Error in loading configuration file: %s<br><br>%s<br>',
                         $config,                          $config,
                         &htmlify($@)                          &htmlify($@)
                 )                  )
Line 451  foreach $k (keys %ICONS) {
Line 450  foreach $k (keys %ICONS) {
         if ($ipath) {          if ($ipath) {
                 ${"${k}icon"} =                  ${"${k}icon"} =
                     sprintf(                      sprintf(
                         '<IMG SRC="%s" ALT="%s" BORDER="0" WIDTH="%d" HEIGHT="%d">',                          '<img src="%s" alt="%s" border="0" width="%d" height="%d">',
                         hrefquote($ipath), htmlquote($itxt), $iwidth, $iheight)                          hrefquote($ipath), htmlquote($itxt), $iwidth, $iheight)
         } else {          } else {
                 ${"${k}icon"} = $itxt;                  ${"${k}icon"} = $itxt;
Line 466  if (-f $config_cvstree) {
Line 465  if (-f $config_cvstree) {
         require $config_cvstree || &fatal(          require $config_cvstree || &fatal(
                 "500 Internal Error",                  "500 Internal Error",
                 sprintf(                  sprintf(
                         'Error in loading configuration file: %s<BR><BR>%s<BR>',                          'Error in loading configuration file: %s<br><br>%s<br>',
                         $config_cvstree,                          $config_cvstree,
                         &htmlify($@)                          &htmlify($@)
                 )                  )
Line 508  undef $rewrite;
Line 507  undef $rewrite;
   
 if (!-d $cvsroot) {  if (!-d $cvsroot) {
         &fatal("500 Internal Error",          &fatal("500 Internal Error",
                 '$CVSROOT not found!<P>The server on which the CVS tree lives is probably down.  Please try again in a few minutes.'                  '$CVSROOT not found!<p>The server on which the CVS tree lives is probably down.  Please try again in a few minutes.'
         );          );
 }  }
   
Line 537  if ($input{tarball}) {
Line 536  if ($input{tarball}) {
                         "You cannot download the top level directory.");                          "You cannot download the top level directory.");
         }          }
   
         my $tmpdir = "/tmp/.cvsweb.$$." . int(time);          my $tmpexportdir = "$tmpdir/.cvsweb.$$." . int(time);
   
         mkdir($tmpdir, 0700)          mkdir($tmpexportdir, 0700)
             or &fatal("500 Internal Error",              or &fatal("500 Internal Error",
                 "Unable to make temporary directory: $!");                  "Unable to make temporary directory: $!");
   
Line 549  if ($input{tarball}) {
Line 548  if ($input{tarball}) {
             (exists $input{only_with_tag} && length $input{only_with_tag}) ?              (exists $input{only_with_tag} && length $input{only_with_tag}) ?
             $input{only_with_tag} : "HEAD";              $input{only_with_tag} : "HEAD";
   
           if ($tag eq 'MAIN') {
               $tag = 'HEAD';
           }
   
         if (system $CMD{cvs}, @cvs_options, '-Qd', $cvsroot, 'export', '-r',          if (system $CMD{cvs}, @cvs_options, '-Qd', $cvsroot, 'export', '-r',
             $tag, '-d', "$tmpdir/$basedir", $module)              $tag, '-d', "$tmpexportdir/$basedir", $module)
         {          {
                 @fatal = ("500 Internal Error", "cvs co failure: $!: $module");                  @fatal = ("500 Internal Error", "cvs co failure: $!: $module");
         } else {          } else {
                 $| = 1;    # Essential to get the buffering right.                  $| = 1;    # Essential to get the buffering right.
   
                 if ($ext eq '.tar.gz') {                  if ($ext eq '.tar.gz') {
                         print "Content-type: application/x-gzip\r\n\r\n";                          print "Content-Type: application/x-gzip\r\n\r\n";
   
                         system                          system
                             "$CMD{tar} @tar_options -cf - -C $tmpdir $basedir | $CMD{gzip} @gzip_options -c"                              "$CMD{tar} @tar_options -cf - -C $tmpexportdir $basedir | $CMD{gzip} @gzip_options -c"
                             and @fatal =                              and @fatal =
                             ("500 Internal Error",                              ("500 Internal Error",
                                 "tar zc failure: $!: $basedir");                                  "tar zc failure: $!: $basedir");
                 } elsif ($ext eq '.zip' && $CMD{zip}) {                  } elsif ($ext eq '.zip' && $CMD{zip}) {
                         print "Content-type: application/zip\r\n\r\n";                          print "Content-Type: application/zip\r\n\r\n";
   
                         system                          system
                             "cd $tmpdir && $CMD{zip} @zip_options -r - $basedir"                              "cd $tmpexportdir && $CMD{zip} @zip_options -r - $basedir"
                             and @fatal =                              and @fatal =
                             ("500 Internal Error", "zip failure: $!: $basedir");                              ("500 Internal Error", "zip failure: $!: $basedir");
                 } else {                  } else {
Line 577  if ($input{tarball}) {
Line 580  if ($input{tarball}) {
                 }                  }
         }          }
   
         system $CMD{rm}, '-rf', $tmpdir if -d $tmpdir;          system $CMD{rm}, '-rf', $tmpexportdir if -d $tmpexportdir;
   
         &fatal(@fatal) if @fatal;          &fatal(@fatal) if @fatal;
   
Line 615  if (-d $fullname) {
Line 618  if (-d $fullname) {
                 }                  }
         }          }
   
         print "<P><a name=\"dirlist\"></a>\n";          print "<p><a name=\"dirlist\"></a></p>\n";
   
         # give direct access to dirs          # give direct access to dirs
         if ($where eq '/') {          if ($where eq '/') {
Line 623  if (-d $fullname) {
Line 626  if (-d $fullname) {
                 chooseCVSRoot ();                  chooseCVSRoot ();
         } else {          } else {
                 print "<p>Current directory: <b>", &clickablePath($where, 0),                  print "<p>Current directory: <b>", &clickablePath($where, 0),
                     "</b>\n";                      "</b></p>\n";
   
                 print "<P>Current tag: <B>", $input{only_with_tag}, "</b>\n"                  print "<p>Current tag: <b>", $input{only_with_tag},"</b></p>\n"
                     if $input{only_with_tag};                      if $input{only_with_tag};
   
         }          }
   
         print "<HR NOSHADE>\n";          print "<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 642  if (-d $fullname) {
Line 645  if (-d $fullname) {
   
                         # Can't this be done by defining the border for the inner table?                          # Can't this be done by defining the border for the inner table?
                         print                          print
                             "<table border=0 cellpadding=0 width=\"100%\"><tr><td bgcolor=\"$tableBorderColor\">";                              "<table border=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td bgcolor=\"$tableBorderColor\">";
                 }                  }
                 print                  print
                     "<table  width=\"100%\" border=0 cellspacing=1 cellpadding=$tablepadding>\n";                      "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"$tablepadding\">\n";
                 $infocols++;                  $infocols++;
                 printf '<tr><th align=left bgcolor="%s">',                  printf '<tr><th align="left" bgcolor="%s">',
                     $byfile ? $columnHeaderColorSorted :                      $byfile ? $columnHeaderColorSorted :
                     $columnHeaderColorDefault;                      $columnHeaderColorDefault;
   
Line 668  if (-d $fullname) {
Line 671  if (-d $fullname) {
                 # with revision information:                  # with revision information:
                 if (scalar(%fileinfo)) {                  if (scalar(%fileinfo)) {
                         $infocols++;                          $infocols++;
                         printf '<th align=left bgcolor="%s">',                          printf '<th align="left" bgcolor="%s">',
                             $byrev ? $columnHeaderColorSorted :                              $byrev ? $columnHeaderColorSorted :
                             $columnHeaderColorDefault;                              $columnHeaderColorDefault;
   
Line 685  if (-d $fullname) {
Line 688  if (-d $fullname) {
                         }                          }
                         print "</th>";                          print "</th>";
                         $infocols++;                          $infocols++;
                         printf '<th align=left bgcolor="%s">',                          printf '<th align="left" bgcolor="%s">',
                             $bydate ? $columnHeaderColorSorted :                              $bydate ? $columnHeaderColorSorted :
                             $columnHeaderColorDefault;                              $columnHeaderColorDefault;
   
Line 704  if (-d $fullname) {
Line 707  if (-d $fullname) {
   
                         if ($show_author) {                          if ($show_author) {
                                 $infocols++;                                  $infocols++;
                                 printf '<th align=left bgcolor="%s">',                                  printf '<th align="left" bgcolor="%s">',
                                     $byauthor ? $columnHeaderColorSorted :                                      $byauthor ? $columnHeaderColorSorted :
                                     $columnHeaderColorDefault;                                      $columnHeaderColorDefault;
   
Line 725  if (-d $fullname) {
Line 728  if (-d $fullname) {
                                 print "</th>";                                  print "</th>";
                         }                          }
                         $infocols++;                          $infocols++;
                         printf '<th align=left bgcolor="%s">',                          printf '<th align="left" bgcolor="%s">',
                             $bylog ? $columnHeaderColorSorted :                              $bylog ? $columnHeaderColorSorted :
                             $columnHeaderColorDefault;                              $columnHeaderColorDefault;
   
Line 742  if (-d $fullname) {
Line 745  if (-d $fullname) {
                         }                          }
                         print "</th>";                          print "</th>";
                 } elsif ($use_descriptions) {                  } elsif ($use_descriptions) {
                         printf '<th align=left bgcolor="%s">',                          printf '<th align="left" bgcolor="%s">',
                             $columnHeaderColorDefault;                              $columnHeaderColorDefault;
                         print "Description";                          print "Description";
                         $infocols++;                          $infocols++;
Line 823  if (-d $fullname) {
Line 826  if (-d $fullname) {
                                 print " ", &link("Parent Directory", $url);                                  print " ", &link("Parent Directory", $url);
                         } else {                          } else {
                                 $url = './' . urlencode($_) . "/$query";                                  $url = './' . urlencode($_) . "/$query";
                                 print "<A NAME=\"$_\"></A>";                                  print "<a name=\"$_\"></a>";
   
                                 if ($nofilelinks) {                                  if ($nofilelinks) {
                                         print $diricon;                                          print $diricon;
Line 862  if (-d $fullname) {
Line 865  if (-d $fullname) {
                                 print "</td><td>&nbsp;" if ($dirtable);                                  print "</td><td>&nbsp;" if ($dirtable);
                                 $filename =~ s%^[^/]+/%%;                                  $filename =~ s%^[^/]+/%%;
                                 print "$filename/$rev";                                  print "$filename/$rev";
                                 print "<BR>" if ($dirtable);                                  print "<br>" if ($dirtable);
   
                                 if ($log) {                                  if ($log) {
                                         print "&nbsp;<font size=-1>", &htmlify(                                          print "&nbsp;<font size=\"-1\">",
                                             &htmlify(
                                                 substr($log, 0, $shortLogLen));                                                  substr($log, 0, $shortLogLen));
                                         if (length $log > 80) {                                          if (length $log > 80) {
                                                 print "...";                                                  print "...";
Line 879  if (-d $fullname) {
Line 883  if (-d $fullname) {
                                 if ($use_descriptions                                  if ($use_descriptions
                                     && defined $descriptions{$dwhere})                                      && defined $descriptions{$dwhere})
                                 {                                  {
                                         print "<TD COLSPAN=", ($infocols - 1),                                          print "<td colspan=\"",($infocols - 1),
                                             ">&nbsp;"                                              "\">&nbsp;"
                                             if $dirtable;                                              if $dirtable;
                                         print $descriptions{$dwhere};                                          print $descriptions{$dwhere};
                                 } elsif ($dirtable && $infocols > 1) {                                  } elsif ($dirtable && $infocols > 1) {
Line 914  if (-d $fullname) {
Line 918  if (-d $fullname) {
                         $filesfound++;                          $filesfound++;
                         printf '<tr bgcolor="%s"><td>', $tabcolors[$dirrow % 2]                          printf '<tr bgcolor="%s"><td>', $tabcolors[$dirrow % 2]
                             if $dirtable;                              if $dirtable;
                         print "<A NAME=\"$_\"></A>";                          print "<a name=\"$_\"></a>";
   
                         if ($nofilelinks) {                          if ($nofilelinks) {
                                 print $fileicon;                                  print $fileicon;
Line 939  if (-d $fullname) {
Line 943  if (-d $fullname) {
                         print "</td><td>&nbsp;" if ($dirtable);                          print "</td><td>&nbsp;" if ($dirtable);
   
                         if ($log) {                          if ($log) {
                                 print " <font size=-1>",                                  print " <font size=\"-1\">",
                                     &htmlify(substr($log, 0, $shortLogLen));                                      &htmlify(substr($log, 0, $shortLogLen));
                                 if (length $log > 80) {                                  if (length $log > 80) {
                                         print "...";                                          print "...";
Line 953  if (-d $fullname) {
Line 957  if (-d $fullname) {
                 print "\n";                  print "\n";
         }          }
   
           print($dirtable ? "</table>\n" : "</menu>\n");
   
         if ($dirtable && defined($tableBorderColor)) {          if ($dirtable && defined($tableBorderColor)) {
                 print "</td></tr></table>";                  print "</td></tr></table>";
         }          }
         print($dirtable == 1 ? "</table>\n" : "</menu>\n");  
   
         if ($filesexists && !$filesfound) {          if ($filesexists && !$filesfound) {
                 print                  print
                     "<P><B>NOTE:</B> There are $filesexists files, but none matches the current tag ($input{only_with_tag})\n";                      "<p><b>NOTE:</b> There are $filesexists files, but none matches the current tag ($input{only_with_tag}).</p>\n";
         }          }
         if ($input{only_with_tag} && (!%tags || !$tags{$input{only_with_tag}}))          if ($input{only_with_tag} && (!%tags || !$tags{$input{only_with_tag}}))
         {          {
Line 970  if (-d $fullname) {
Line 975  if (-d $fullname) {
         if (scalar %tags || $input{only_with_tag} || $edit_option_form          if (scalar %tags || $input{only_with_tag} || $edit_option_form
             || defined($input{"options"}))              || defined($input{"options"}))
         {          {
                 print "<hr size=1 NOSHADE>";                  print "<hr size=\"1\" noshade>";
         }          }
   
         if (scalar %tags || $input{only_with_tag}) {          if (scalar %tags || $input{only_with_tag}) {
                 print "<FORM METHOD=\"GET\" ACTION=\"./\">\n";                  print "<form method=\"get\" action=\"./\">\n";
                 foreach my $var (@stickyvars) {                  foreach my $var (@stickyvars) {
                         print                          print
                             "<INPUT TYPE=HIDDEN NAME=\"$var\" VALUE=\"$input{$var}\">\n"                              "<input type=\"hidden\" name=\"$var\" value=\"$input{$var}\">\n"
                             if (defined($input{$var})                              if (defined($input{$var})
                             && (!defined($DEFAULTVALUE{$var})                              && (!defined($DEFAULTVALUE{$var})
                             || $input{$var} ne $DEFAULTVALUE{$var})                              || $input{$var} ne $DEFAULTVALUE{$var})
                             && $input{$var} ne "" && $var ne "only_with_tag");                              && $input{$var} ne "" && $var ne "only_with_tag");
                 }                  }
                 print "Show only files with tag:\n";                  print "<p>Show only files with tag:\n";
                 print "<SELECT NAME=only_with_tag";                  print "<select name=\"only_with_tag\"";
                 print " onchange=\"submit()\"" if ($use_java_script);                  print " onchange=\"this.form.submit()\"" if $use_java_script;
                 print ">";                  print ">";
                 print "<OPTION VALUE=\"\">All tags / default branch\n";                  print "<option value=\"\">All tags / default branch</option>\n";
   
                 foreach my $tag (reverse sort { lc $a cmp lc $b } keys %tags) {                  foreach my $tag (reverse sort { lc $a cmp lc $b } keys %tags) {
                         print "<OPTION",                          print "<option",
                             defined($input{only_with_tag})                              defined($input{only_with_tag})
                             && $input{only_with_tag} eq $tag ? " SELECTED" : "",                              && $input{only_with_tag} eq $tag ? " selected" : "",
                             ">$tag\n";                              ">$tag</option>\n";
                 }                  }
                 print "</SELECT>\n";                  print "</select>\n";
                 print " Module path or alias:\n";                  print " Module path or alias:\n";
                 printf "<INPUT TYPE=TEXT NAME=\"path\" VALUE=\"%s\" SIZE=15>\n",                  printf "<input type=\"text\" name=\"path\" value=\"%s\" size=\"15\">\n",
                     htmlquote($where);                      htmlquote($where);
                 print "<INPUT TYPE=SUBMIT VALUE=\"Go\">\n";                  print "<input type=\"submit\" value=\"Go\"></p>\n";
                 print "</FORM>\n";                  print "</form>\n";
         }          }
   
         if ($allow_tar) {          if ($allow_tar) {
                 my ($basefile) = ($where =~ m,(?:.*/)?([^/]+),);                  my ($basefile) = ($where =~ m,(?:.*/)?([^/]+),);
   
                 if (defined($basefile) && $basefile ne '') {                  if (defined($basefile) && $basefile ne '') {
                         print "<HR NOSHADE>\n",                          print "<hr noshade>\n",
                             "<DIV align=center>Download this directory in ";                              "<div align=\"center\">Download this directory in ";
   
                         # Mangle the filename so browsers show a reasonable                          # Mangle the filename so browsers show a reasonable
                         # filename to download.                          # filename to download.
Line 1019  if (-d $fullname) {
Line 1024  if (-d $fullname) {
                                     &link("zip archive", "./$basefile.zip$query"                                      &link("zip archive", "./$basefile.zip$query"
                                         . ($query ? "&" : "?") . "tarball=1");                                          . ($query ? "&" : "?") . "tarball=1");
                         }                          }
                         print "</DIV>";                          print "</div>";
                 }                  }
         }          }
   
Line 1027  if (-d $fullname) {
Line 1032  if (-d $fullname) {
         $formwhere =~ s|Attic/?$|| if ($input{'hideattic'});          $formwhere =~ s|Attic/?$|| if ($input{'hideattic'});
   
         if ($edit_option_form || defined($input{"options"})) {          if ($edit_option_form || defined($input{"options"})) {
                 print "<FORM METHOD=\"GET\" ACTION=\"${formwhere}\">\n";                  print "<form method=\"get\" action=\"${formwhere}\">\n";
                 print "<INPUT TYPE=HIDDEN NAME=\"copt\" VALUE=\"1\">\n";                  print "<input type=\"hidden\" name=\"copt\" value=\"1\">\n";
                 if ($cvstree ne $cvstreedefault) {                  if ($cvstree ne $cvstreedefault) {
                         print                          print
                             "<INPUT TYPE=HIDDEN NAME=\"cvsroot\" VALUE=\"$cvstree\">\n";                              "<input type=\"hidden\" name=\"cvsroot\" value=\"$cvstree\">\n";
                 }                  }
                 print "<center><table cellpadding=0 cellspacing=0>";                  print "<center><table cellpadding=\"0\" cellspacing=\"0\">";
                 print                  print
                     "<tr bgcolor=\"$columnHeaderColorDefault\"><th colspan=2>Preferences</th></tr>";                      "<tr bgcolor=\"$columnHeaderColorDefault\"><th colspan=\"2\">Preferences</th></tr>";
                 print "<tr><td>Sort files by <SELECT name=\"sortby\">";                  print "<tr><td>Sort files by <select name=\"sortby\">";
                 print "<OPTION VALUE=\"\">File";                  print "<option value=\"\">File</option>";
                 print "<OPTION", $bydate ? " SELECTED" : "", " VALUE=date>Age";                  print "<option", $bydate ? " selected" : "",
                 print "<OPTION", $byauthor ? " SELECTED" : "",                      " value=\"date\">Age</option>";
                     " VALUE=author>Author"                  print "<option", $byauthor ? " selected" : "",
                       " value=\"author\">Author</option>"
                     if ($show_author);                      if ($show_author);
                 print "<OPTION", $byrev ? " SELECTED" : "",                  print "<option", $byrev ? " selected" : "",
                     " VALUE=rev>Revision";                      " value=\"rev\">Revision</option>";
                 print "<OPTION", $bylog ? " SELECTED" : "",                  print "<option", $bylog ? " selected" : "",
                     " VALUE=log>Log message";                      " value=\"log\">Log message</option>";
                 print "</SELECT></td>";                  print "</select></td>";
                 print "<td>Sort log by: ";                  print "<td>Sort log by: ";
                 printLogSortSelect(0);                  printLogSortSelect(0);
                 print "</td></tr>";                  print "</td></tr>";
                 print "<tr><td>Diff format: ";                  print "<tr><td>Diff format: ";
                 printDiffSelect(0);                  printDiffSelect(0);
                 print "</td>";                  print "</td>";
                 print "<td>Show Attic files: ";                  print "<td><label>Show Attic files: ";
                 print "<INPUT NAME=hideattic TYPE=CHECKBOX",                  print "<input name=\"hideattic\" type=\"checkbox\"",
                     $input{'hideattic'} ? " CHECKED" : "", "></td></tr>\n";                      $input{'hideattic'} ? " checked" : "", "></label></td></tr>\n";
                 print                  print
                     "<tr><td align=center colspan=2><input type=submit value=\"Change Options\">";                      "<tr><td align=\"center\" colspan=\"2\"><input type=\"submit\" value=\"Change Options\">";
                 print "</td></tr></table></center></FORM>\n";                  print "</td></tr></table></center></form>\n";
         }          }
         print &html_footer;          print &html_footer;
         print "</BODY></HTML>\n";  
 }  }
   
 ###############################  ###############################
Line 1120  elsif (-f $fullname . ',v') {
Line 1125  elsif (-f $fullname . ',v') {
         # The file has been removed and is in the Attic.          # The file has been removed and is in the Attic.
         # Send a redirect pointing to the file in the Attic.          # Send a redirect pointing to the file in the Attic.
         (my $newplace = $scriptwhere) =~ s|/([^/]+)$|/Attic/$1|;          (my $newplace = $scriptwhere) =~ s|/([^/]+)$|/Attic/$1|;
         redirect("$newplace$query");          if ($ENV{QUERY_STRING} ne "") {
                   redirect("${newplace}?$ENV{QUERY_STRING}");
           } else {
                   redirect($newplace);
           }
         exit;          exit;
 } elsif (0 && (my @files = &safeglob($fullname . ",v"))) {  } elsif (0 && (my @files = &safeglob($fullname . ",v"))) {
         http_header("text/plain");          http_header("text/plain");
Line 1157  sub printDiffSelect($) {
Line 1166  sub printDiffSelect($) {
         my ($use_java_script) = @_;          my ($use_java_script) = @_;
         my $f = $input{'f'};          my $f = $input{'f'};
   
         print '<SELECT NAME="f"';          print '<select name="f"';
         print ' onchange="submit()"' if $use_java_script;          print ' onchange="this.form.submit()"' if $use_java_script;
         print '>';          print '>';
   
         local $_;          local $_;
         for (@DIFFTYPES) {          for (@DIFFTYPES) {
                 printf('<OPTION VALUE="%s"%s>%s', $_,                  printf('<option value="%s"%s>%s</option>', $_,
                     $f eq $_ ? ' SELECTED' : '', "\u$DIFFTYPES{$_}{'descr'}");                      $f eq $_ ? ' selected' : '', "\u$DIFFTYPES{$_}{'descr'}");
         }          }
   
         print "</SELECT>";          print "</select>";
 }  }
   
 sub printLogSortSelect($) {  sub printLogSortSelect($) {
         my ($use_java_script) = @_;          my ($use_java_script) = @_;
   
         print '<SELECT NAME="logsort"';          print '<select name="logsort"';
         print ' onchange="submit()"' if $use_java_script;          print ' onchange="this.form.submit()"' if $use_java_script;
         print '>';          print '>';
   
         local $_;          local $_;
         for (@LOGSORTKEYS) {          for (@LOGSORTKEYS) {
                 printf('<OPTION VALUE="%s"%s>%s', $_,                  printf('<option value="%s"%s>%s</option>', $_,
                     $logsort eq $_ ? ' SELECTED' : '',                      $logsort eq $_ ? ' selected' : '',
                     "\u$LOGSORTKEYS{$_}{'descr'}");                      "\u$LOGSORTKEYS{$_}{'descr'}");
         }          }
   
         print "</SELECT>";          print "</select>";
 }  }
   
 sub findLastModifiedSubdirs(@) {  sub findLastModifiedSubdirs(@) {
Line 1356  sub link($$) {
Line 1365  sub link($$) {
         $url =~ s/:/sprintf("%%%02x", ord($&))/eg          $url =~ s/:/sprintf("%%%02x", ord($&))/eg
             if $url =~ /^[^a-z]/;    # relative              if $url =~ /^[^a-z]/;    # relative
   
         sprintf '<A HREF="%s">%s</A>', hrefquote($url), $name;          sprintf '<a href="%s">%s</a>', hrefquote($url), $name;
 }  }
   
 sub revcmp($$) {  sub revcmp($$) {
Line 1514  sub scan_directives(@) {
Line 1523  sub scan_directives(@) {
         ('tabstop' => $ts);          ('tabstop' => $ts);
 }  }
   
   sub openOutputFilter() {
           return if !defined($output_filter) || $output_filter eq '';
   
           open(STDOUT, "|-") && return;
   
           # child of child
           open(STDERR, '>/dev/null');
           exec($output_filter);
   
           exit -1;
   }
   
 ###############################  ###############################
 # show Annotation  # show Annotation
 ###############################  ###############################
Line 1614  sub doAnnotate($$) {
Line 1635  sub doAnnotate($$) {
   
         navigateHeader($scriptwhere, $pathname, $filename, $rev, "annotate");          navigateHeader($scriptwhere, $pathname, $filename, $rev, "annotate");
         print          print
             "<h3 align=center>Annotation of $pathname$filename, Revision $rev</h3>\n";              "<h3 align=\"center\">Annotation of $pathname$filename, Revision $rev</h3>\n";
   
         # Ready to get the responses from the server.          # Ready to get the responses from the server.
         # For example:          # For example:
Line 1627  sub doAnnotate($$) {
Line 1648  sub doAnnotate($$) {
         my ($revprint, $usrprint);          my ($revprint, $usrprint);
   
         if ($annTable) {          if ($annTable) {
                 print "<table border=0 cellspacing=0 cellpadding=0>\n";                  print "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
         } else {          } else {
                 print "<pre>";                  print "<pre>";
         }          }
Line 1815  sub cvswebMarkup($$$) {
Line 1836  sub cvswebMarkup($$$) {
         http_header();          http_header();
   
         navigateHeader($scriptwhere, $pathname, $filename, $revision, "view");          navigateHeader($scriptwhere, $pathname, $filename, $revision, "view");
         print "<HR noshade>";          print "<hr noshade>";
         print "<table width=\"100%\"><tr><td bgcolor=\"$markupLogColor\">";          print "<table width=\"100%\"><tr><td bgcolor=\"$markupLogColor\">";
         print "File: ", &clickablePath($where, 1);          print "File: ", &clickablePath($where, 1);
         print "&nbsp;(";          print "&nbsp;(";
Line 1827  sub cvswebMarkup($$$) {
Line 1848  sub cvswebMarkup($$$) {
                 &download_link($fileurl, $revision, "as text", "text/plain");                  &download_link($fileurl, $revision, "as text", "text/plain");
                 print ")";                  print ")";
         }          }
         print "<BR>\n";          print "<br>\n";
   
         if ($show_log_in_markup) {          if ($show_log_in_markup) {
                 readLog($fullname);    #,$revision);                  readLog($fullname);    #,$revision);
                 printLog($revision, 0);                  printLog($revision, 0);
         } else {          } else {
                 print "Version: <B>$revision</B><BR>\n";                  print "Version: <b>$revision</b><br>\n";
                 print "Tag: <B>", $input{only_with_tag}, "</b><br>\n"                  print "Tag: <b>", $input{only_with_tag}, "</b><br>\n"
                     if $input{only_with_tag};                      if $input{only_with_tag};
         }          }
         print "</td></tr></table>";          print "</td></tr></table>";
         my $url = download_url($fileurl, $revision, $mimetype);          my $url = download_url($fileurl, $revision, $mimetype);
         print "<HR noshade>";          print "<hr noshade>";
   
         if ($mimetype =~ /^image/) {          if ($mimetype =~ /^image/) {
                 printf '<IMG SRC="%s"><BR>', hrefquote("$url$barequery");                  printf '<img src="%s" alt=""><br>', hrefquote("$url$barequery");
         } elsif ($mimetype =~ m%^application/pdf%) {          } elsif ($mimetype =~ m%^application/pdf%) {
                 printf '<EMBED SRC="%s" WIDTH="100%"><BR>',                  printf '<embed src="%s" width="100%"><br>',
                     hrefquote("$url$barequery");                      hrefquote("$url$barequery");
         } elsif ($preformat_in_markup) {          } elsif ($preformat_in_markup) {
                 print "<PRE>";                  print "<pre>";
   
                 # prefetch several lines                  # prefetch several lines
                 my @buf = head($filehandle);                  my @buf = head($filehandle);
Line 1859  sub cvswebMarkup($$$) {
Line 1880  sub cvswebMarkup($$$) {
   
                         print spacedHtmlText($_, $d{'tabstop'});                          print spacedHtmlText($_, $d{'tabstop'});
                 }                  }
                 print "</PRE>";                  print "</pre>";
         } else {          } else {
                 print "<PRE>";                  print "<pre>";
   
                 while (<$filehandle>) {                  while (<$filehandle>) {
                         print htmlquote($_);                          print htmlquote($_);
                 }                  }
                 print "</PRE>";                  print "</pre>";
         }          }
 }  }
   
Line 1959  sub doDiff($$$$$$) {
Line 1980  sub doDiff($$$$$$) {
   
         if (!open($fh, "-|")) {    # child          if (!open($fh, "-|")) {    # child
                 open(STDERR, ">&STDOUT");    # Redirect stderr to stdout                  open(STDERR, ">&STDOUT");    # Redirect stderr to stdout
                   openOutputFilter();
                 exec($CMD{rcsdiff}, @difftype, "-r$rev1", "-r$rev2", $fullname);                  exec($CMD{rcsdiff}, @difftype, "-r$rev1", "-r$rev2", $fullname);
         }          }
         if ($human_readable) {          if ($human_readable) {
Line 2045  sub getDirLogs($$@) {
Line 2067  sub getDirLogs($$@) {
         if (defined($tag)) {          if (defined($tag)) {
   
                 #can't use -r<tag> as - is allowed in tagnames, but misinterpreated by rlog..                  #can't use -r<tag> as - is allowed in tagnames, but misinterpreated by rlog..
                 if (!open($fh, "-|")) {                  if (!open($fh, "-|")) {    # child
                         open(STDERR, '>/dev/null'); # rlog may complain; ignore.                          open(STDERR, '>/dev/null'); # rlog may complain; ignore.
                           openOutputFilter();
                         exec($CMD{rlog}, @files);                          exec($CMD{rlog}, @files);
                 }                  }
         } else {          } else {
   
                 if (!open($fh, "-|")) {                  if (!open($fh, "-|")) {    # child
                         open(STDERR, '>/dev/null'); # rlog may complain; ignore.                          open(STDERR, '>/dev/null'); # rlog may complain; ignore.
                           openOutputFilter();
                         exec($CMD{rlog}, '-r', @files);                          exec($CMD{rlog}, '-r', @files);
                 }                  }
         }          }
Line 2249  sub readLog($;$) {
Line 2273  sub readLog($;$) {
         print("Going to rlog '$fullname'\n") if ($verbose);          print("Going to rlog '$fullname'\n") if ($verbose);
         if (!open($fh, "-|")) {    # child          if (!open($fh, "-|")) {    # child
                 if ($revision ne '') {                  if ($revision ne '') {
                           openOutputFilter();
                         exec($CMD{rlog}, $revision, $fullname);                          exec($CMD{rlog}, $revision, $fullname);
                 } else {                  } else {
                           openOutputFilter();
                         exec($CMD{rlog}, $fullname);                          exec($CMD{rlog}, $fullname);
                 }                  }
         }          }
Line 2416  sub readLog($;$) {
Line 2442  sub readLog($;$) {
                 }                  }
                 $revsym{$rev} .= ", " if ($revsym{$rev});                  $revsym{$rev} .= ", " if ($revsym{$rev});
                 $revsym{$rev} .= $_;                  $revsym{$rev} .= $_;
                 $sel .= "<OPTION VALUE=\"${rev}:${_}\">$_\n";                  $sel .= "<option value=\"${rev}:${_}\">$_</option>\n";
         }          }
         print "Done associating revisions with branches\n" if ($verbose);          print "Done associating revisions with branches\n" if ($verbose);
   
Line 2494  sub printLog($;$) {
Line 2520  sub printLog($;$) {
                 my ($filename);                  my ($filename);
                 ($filename = $where) =~ s/^.*\///;                  ($filename = $where) =~ s/^.*\///;
                 my ($fileurl) = urlencode($filename);                  my ($fileurl) = urlencode($filename);
                 print "<a NAME=\"rev$_\"></a>";                  print "<a name=\"rev$_\"></a>";
   
                 if (defined($revsym{$_})) {                  if (defined($revsym{$_})) {
                         foreach my $sym (split (", ", $revsym{$_})) {                          foreach my $sym (split (", ", $revsym{$_})) {
                                 print "<a NAME=\"$sym\"></a>";                                  print "<a name=\"$sym\"></a>";
                         }                          }
                 }                  }
   
Line 2506  sub printLog($;$) {
Line 2532  sub printLog($;$) {
                     && !defined($nameprinted{$br}))                      && !defined($nameprinted{$br}))
                 {                  {
                         foreach my $sym (split (", ", $revsym{$br})) {                          foreach my $sym (split (", ", $revsym{$br})) {
                                 print "<a NAME=\"$sym\"></a>";                                  print "<a name=\"$sym\"></a>";
                         }                          }
                         $nameprinted{$br} = 1;                          $nameprinted{$br} = 1;
                 }                  }
Line 2561  sub printLog($;$) {
Line 2587  sub printLog($;$) {
                         }                          }
                 }                  }
         } else {          } else {
                 print "Revision <B>$_</B>";                  print "Revision <b>$_</b>";
         }          }
   
         if (/^1\.1\.1\.\d+$/) {          if (/^1\.1\.1\.\d+$/) {
Line 2576  sub printLog($;$) {
Line 2602  sub printLog($;$) {
         print readableTime(time() - $date{$_}, 1), " ago)";          print readableTime(time() - $date{$_}, 1), " ago)";
         print " by ";          print " by ";
         print "<i>", $author{$_}, "</i>\n";          print "<i>", $author{$_}, "</i>\n";
         print "<BR>Branch: <b>", $link ? link_tags($revsym{$br}) : $revsym{$br},          print "<br>Branch: <b>", $link ? link_tags($revsym{$br}) : $revsym{$br},
             "</b>\n"              "</b>\n"
             if ($revsym{$br});              if ($revsym{$br});
         print "<BR>CVS Tags: <b>", $link ? link_tags($revsym{$_}) : $revsym{$_},          print "<br>CVS Tags: <b>", $link ? link_tags($revsym{$_}) : $revsym{$_},
             "</b>"              "</b>"
             if ($revsym{$_});              if ($revsym{$_});
         print "<BR>Branch point for: <b>",          print "<br>Branch point for: <b>",
             $link ? link_tags($branchpoint{$_}) : $branchpoint{$_}, "</b>\n"              $link ? link_tags($branchpoint{$_}) : $branchpoint{$_}, "</b>\n"
             if ($branchpoint{$_});              if ($branchpoint{$_});
   
Line 2601  sub printLog($;$) {
Line 2627  sub printLog($;$) {
         if ($prev ne "") {          if ($prev ne "") {
                 if ($difflines{$_}) {                  if ($difflines{$_}) {
                         print                          print
                             "<BR>Changes since <b>$prev: $difflines{$_} lines</b>";                              "<br>Changes since <b>$prev: $difflines{$_} lines</b>";
                 }                  }
         }          }
   
         if ($isDead) {          if ($isDead) {
                 print "<BR><B><I>FILE REMOVED</I></B>\n";                  print "<br><b><i>FILE REMOVED</i></b>\n";
         } elsif ($link) {          } elsif ($link) {
                 my %diffrev = ();                  my %diffrev = ();
                 $diffrev{$_} = 1;                  $diffrev{$_} = 1;
                 $diffrev{""} = 1;                  $diffrev{""} = 1;
                 print "<BR>Diff";                  print "<br>Diff";
   
                 #                  #
                 # Offer diff to previous revision                  # Offer diff to previous revision
Line 2696  sub printLog($;$) {
Line 2722  sub printLog($;$) {
                         printDiffLinks($input{'r1'}, $url);                          printDiffLinks($input{'r1'}, $url);
                 }                  }
         }          }
         print "<PRE>\n";          print "<pre>\n";
         print &htmlify($log{$_}, 1);          print &htmlify($log{$_}, 1);
         print "</PRE>\n";          print "</pre>\n";
 }  }
   
 sub doLog($) {  sub doLog($) {
Line 2714  sub doLog($) {
Line 2740  sub doLog($) {
         print &link($backicon, "$backurl#$filename"), " <b>Up to ",          print &link($backicon, "$backurl#$filename"), " <b>Up to ",
             &clickablePath($upwhere, 1), "</b><p>\n";              &clickablePath($upwhere, 1), "</b><p>\n";
         print &link('Request diff between arbitrary revisions', '#diff');          print &link('Request diff between arbitrary revisions', '#diff');
         print '<HR NOSHADE>';          print '<hr noshade>';
   
         if ($curbranch) {          if ($curbranch) {
                 print "Default branch: ", ($revsym{$curbranch} || $curbranch);                  print "Default branch: ", ($revsym{$curbranch} || $curbranch);
         } else {          } else {
                 print "No default branch";                  print "No default branch";
         }          }
         print "<BR>\n";          print "<br>\n";
   
         if ($input{only_with_tag}) {          if ($input{only_with_tag}) {
                 print "Current tag: $input{only_with_tag}<BR>\n";                  print "Current tag: $input{only_with_tag}<br>\n";
         }          }
   
         undef %nameprinted;          undef %nameprinted;
   
         for (my $i = 0 ; $i <= $#revdisplayorder ; $i++) {          for (my $i = 0 ; $i <= $#revdisplayorder ; $i++) {
                 print "<HR size=1 NOSHADE>";                  print "<hr size=\"1\" noshade>";
                 printLog($revdisplayorder[$i]);                  printLog($revdisplayorder[$i]);
         }          }
   
         print "<HR NOSHADE>";          print "<hr noshade>";
         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 "revisions of a file.  You may select a symbolic revision\n";          print "revisions of a file.  You may select a symbolic revision\n";
         print "name using the selection box or you may type in a numeric\n";          print "name using the selection box or you may type in a numeric\n";
         print "name using the type-in text box.\n";          print "name using the type-in text box.\n";
         print "</A><P>\n";          print "</a><p>\n";
         print          print
             "<FORM METHOD=\"GET\" ACTION=\"${scriptwhere}.diff\" NAME=\"diff_select\">\n";              "<form method=\"get\" action=\"${scriptwhere}.diff\" name=\"diff_select\">\n";
   
         foreach (@stickyvars) {          foreach (@stickyvars) {
                 printf('<INPUT TYPE=HIDDEN NAME="%s" VALUE="%s">', $_,                  printf('<input type="hidden" name="%s" value="%s">', $_,
                     $input{$_})                      $input{$_})
                     if (defined($input{$_})                      if (defined($input{$_})
                     && ((!defined($DEFAULTVALUE{$_})                      && ((!defined($DEFAULTVALUE{$_})
                     || $input{$_} ne $DEFAULTVALUE{$_}) && $input{$_} ne ""));                      || $input{$_} ne $DEFAULTVALUE{$_}) && $input{$_} ne ""));
         }          }
         print "<TABLE><TR>\n";          print "<table><tr>\n";
         print "<TD align=right>Diffs between \n";          print "<td align=\"right\">Diffs between \n";
         print "<SELECT NAME=\"r1\">\n";          print "<select name=\"r1\">\n";
         print "<OPTION VALUE=\"text\" SELECTED>Use Text Field\n";          print "<option value=\"text\" selected>Use Text Field</option>\n";
         print $sel;          print $sel;
         print "</SELECT>\n";          print "</select>\n";
         $diffrev = $revdisplayorder[$#revdisplayorder];          $diffrev = $revdisplayorder[$#revdisplayorder];
         $diffrev = $input{"r1"} if (defined($input{"r1"}));          $diffrev = $input{"r1"} if (defined($input{"r1"}));
         print          print
             "<INPUT TYPE=\"TEXT\" SIZE=\"$inputTextSize\" NAME=\"tr1\" VALUE=\"$diffrev\" onChange='document.diff_select.r1.selectedIndex=0'></TD>";              "<input type=\"text\" size=\"$inputTextSize\" name=\"tr1\" value=\"$diffrev\" onchange=\"document.diff_select.r1.selectedIndex=0\"></td>";
         print "<TD><BR></TD></TR>\n";          print "<td><br></td></tr>\n";
         print "<TR><TD align=right>and \n";          print "<tr><td align=\"right\">and \n";
         print "<SELECT NAME=\"r2\">\n";          print "<select name=\"r2\">\n";
         print "<OPTION VALUE=\"text\" SELECTED>Use Text Field\n";          print "<option value=\"text\" selected>Use Text Field</option>\n";
         print $sel;          print $sel;
         print "</SELECT>\n";          print "</select>\n";
         $diffrev = $revdisplayorder[0];          $diffrev = $revdisplayorder[0];
         $diffrev = $input{"r2"} if (defined($input{"r2"}));          $diffrev = $input{"r2"} if (defined($input{"r2"}));
         print          print
             "<INPUT TYPE=\"TEXT\" SIZE=\"$inputTextSize\" NAME=\"tr2\" VALUE=\"$diffrev\" onChange='document.diff_select.r2.selectedIndex=0'></TD>";              "<input type=\"text\" size=\"$inputTextSize\" name=\"tr2\" value=\"$diffrev\" onchange=\"document.diff_select.r2.selectedIndex=0\"></td>";
         print "<TD><INPUT TYPE=SUBMIT VALUE=\"  Get Diffs  \"></TD>\n";          print "<td><input type=\"submit\" value=\"  Get Diffs  \"></td>\n";
         print "</FORM>\n";          print "</form>\n";
         print "</TR></TABLE>\n";          print "</tr></table>\n";
         print "<HR noshade>\n";          print "<hr noshade>\n";
         print "<TABLE>";          print "<table>";
         print "<FORM METHOD=\"GET\" ACTION=\"$scriptwhere\">\n";          print "<form method=\"get\" action=\"$scriptwhere\">\n";
         print "<TR><TD align=right>Preferred Diff type:</TD>";          print "<tr><td align=\"right\">Preferred Diff type:</td>";
         print "<TD>";          print "<td>";
         printDiffSelect($use_java_script);          printDiffSelect($use_java_script);
         print "</TD><TD></TD></TR>\n";          print "</td><td></td></tr>\n";
   
         if (@branchnames) {          if (@branchnames) {
                 print "<TR><TD align=right>View only Branch:</TD>";                  print "<tr><td align=\"right\">View only Branch:</td>";
                 print "<TD>";                  print "<td>";
                 print "<A name=branch></A>\n";                  print "<a name=\"branch\"></a>\n";
                 print "<SELECT NAME=\"only_with_tag\"";                  print "<select name=\"only_with_tag\"";
                 print " onchange=\"submit()\"" if ($use_java_script);                  print " onchange=\"this.form.submit()\"" if $use_java_script;
                 print ">\n";                  print ">\n";
                 print "<OPTION VALUE=\"\"";                  print "<option value=\"\"";
                 print " SELECTED"                  print " selected"
                     if (defined($input{"only_with_tag"})                      if (defined($input{"only_with_tag"})
                     && $input{"only_with_tag"} eq "");                      && $input{"only_with_tag"} eq "");
                 print ">Show all branches\n";                  print ">Show all branches</option>\n";
   
                 foreach (reverse sort @branchnames) {                  foreach (reverse sort @branchnames) {
                         print "<OPTION";                          print "<option";
                         print " SELECTED"                          print " selected"
                             if (defined($input{"only_with_tag"})                              if (defined($input{"only_with_tag"})
                             && $input{"only_with_tag"} eq $_);                              && $input{"only_with_tag"} eq $_);
                         print ">${_}\n";                          print ">${_}</option>\n";
                 }                  }
                 print "</SELECT></TD><TD></TD></TR>\n";                  print "</select></td><td></td></tr>\n";
         }          }
   
         foreach (@stickyvars) {          foreach (@stickyvars) {
                 next if ($_ eq "f");                  next if ($_ eq "f");
                 next if ($_ eq "only_with_tag");                  next if ($_ eq "only_with_tag");
                 next if ($_ eq "logsort");                  next if ($_ eq "logsort");
                 print "<INPUT TYPE=HIDDEN NAME=\"$_\" VALUE=\"$input{$_}\">\n"                  print "<input type=\"hidden\" name=\"$_\" value=\"$input{$_}\">\n"
                     if (defined($input{$_})                      if (defined($input{$_})
                     && (!defined($DEFAULTVALUE{$_})                      && (!defined($DEFAULTVALUE{$_})
                     || $input{$_} ne $DEFAULTVALUE{$_}) && $input{$_} ne "");                      || $input{$_} ne $DEFAULTVALUE{$_}) && $input{$_} ne "");
         }          }
         print "<TR><TD align=right>";          print "<tr><td align=\"right\">";
         print "<A name=logsort></A>\n";          print "<a name=\"logsort\"></a>\n";
         print "Sort log by:</TD>";          print "Sort log by:</td>";
         print "<TD>";          print "<td>";
         printLogSortSelect($use_java_script);          printLogSortSelect($use_java_script);
         print "</TD>";          print "</td>";
         print "<TD><INPUT TYPE=SUBMIT VALUE=\"  Set  \"></TD>";          print "<td><input type=\"submit\" value=\"  Set  \"></td>";
         print "</FORM>\n";          print "</form>\n";
         print "</TR></TABLE>";          print "</tr></table>";
         print &html_footer;          print &html_footer;
         print "</BODY></HTML>\n";  
 }  }
   
 sub flush_diff_rows($$$$) {  sub flush_diff_rows($$$$) {
Line 2902  sub human_readable_diff($) {
Line 2927  sub human_readable_diff($) {
         }          }
   
         print          print
             "<h3 align=center>Diff for /$where_nd between version $rev1 and $rev2</h3>\n",              "<h3 align=\"center\">Diff for /$where_nd between version $rev1 and $rev2</h3>\n",
             "<table border=0 cellspacing=0 cellpadding=0 width=\"100%\">\n",              "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n",
             "<tr bgcolor=\"#ffffff\">\n", "<th width=\"50%\" valign=TOP>",              "<tr bgcolor=\"#ffffff\">\n", "<th width=\"50%\" valign=\"top\">",
             "version $rev1";              "version $rev1";
         print ", $date1"         if (defined($date1));          print ", $date1"         if (defined($date1));
         print "<br>Tag: $sym1\n" if ($sym1);          print "<br>Tag: $sym1\n" if ($sym1);
         print "</th>\n", "<th width=\"50%\" valign=TOP>", "version $rev2";          print "</th>\n", "<th width=\"50%\" valign=\"top\">", "version $rev2";
         print ", $date2"         if (defined($date2));          print ", $date2"         if (defined($date2));
         print "<br>Tag: $sym2\n" if ($sym1);          print "<br>Tag: $sym2\n" if ($sym1);
         print "</th>\n";          print "</th>\n";
Line 2941  sub human_readable_diff($) {
Line 2966  sub human_readable_diff($) {
                         print                          print
                             "<tr bgcolor=\"$diffcolorHeading\"><td width=\"50%\">";                              "<tr bgcolor=\"$diffcolorHeading\"><td width=\"50%\">";
                         print                          print
                             "<table width=\"100%\" border=1 cellpadding=5><tr><td><b>Line $oldline</b>";                              "<table width=\"100%\" border=\"1\" cellpadding=\"5\"><tr><td><b>Line $oldline</b>";
                         print                          print
                             "&nbsp;<font size=-1>$funname</font></td></tr></table>";                              "&nbsp;<font size=\"-1\">$funname</font></td></tr></table>";
                         print "</td><td width=\"50%\">";                          print "</td><td width=\"50%\">";
                         print                          print
                             "<table width=\"100%\" border=1 cellpadding=5><tr><td><b>Line $newline</b>";                              "<table width=\"100%\" border=\"1\" cellpadding=\"5\"><tr><td><b>Line $newline</b>";
                         print                          print
                             "&nbsp;<font size=-1>$funname</font></td></tr></table>";                              "&nbsp;<font size=\"-1\">$funname</font></td></tr></table>";
                         print "</td>\n";                          print "</td>\n";
                         $state    = "dump";                          $state    = "dump";
                         $leftRow  = 0;                          $leftRow  = 0;
Line 2991  sub human_readable_diff($) {
Line 3016  sub human_readable_diff($) {
                         }                          }
                 }                  }
         }          }
           close($fh);
   
         flush_diff_rows \@leftCol, \@rightCol, $leftRow, $rightRow;          flush_diff_rows \@leftCol, \@rightCol, $leftRow, $rightRow;
   
         # state is empty if we didn't have any change          # state is empty if we didn't have any change
         if (!$state) {          if (!$state) {
                 print "<tr><td colspan=2>&nbsp;</td></tr>";                  print "<tr><td colspan=\"2\">&nbsp;</td></tr>";
                 print "<tr bgcolor=\"$diffcolorEmpty\" >";                  print "<tr bgcolor=\"$diffcolorEmpty\">";
                 print                  print
                     "<td colspan=2 align=center><b>- No viewable Change -</b></td></tr>";                      "<td colspan=\"2\" align=\"center\"><b>- No viewable change -</b></td></tr>";
         }          }
         print "</table>";          print "</table>";
         close($fh);  
   
         print "<br><hr noshade width=\"100%\">\n";          print "<br><hr noshade width=\"100%\">\n";
   
         print "<table border=0>";          print "<table border=\"0\">";
   
         print "<tr><td>";          print "<tr><td>";
   
         # print legend          # print legend
         print "<table border=1><tr><td>";          print "<table border=\"1\"><tr><td>";
         print "Legend:<br><table border=0 cellspacing=0 cellpadding=1>\n";          print "Legend:<br><table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
         print          print
             "<tr><td align=center bgcolor=\"$diffcolorRemove\">Removed from v.$rev1</td><td bgcolor=\"$diffcolorEmpty\">&nbsp;</td></tr>";              "<tr><td align=\"center\" bgcolor=\"$diffcolorRemove\">Removed from v.$rev1</td><td bgcolor=\"$diffcolorEmpty\">&nbsp;</td></tr>";
         print          print
             "<tr bgcolor=\"$diffcolorChange\"><td align=center colspan=2>changed lines</td></tr>";              "<tr bgcolor=\"$diffcolorChange\"><td align=\"center\" colspan=\"2\">changed lines</td></tr>";
         print          print
             "<tr><td bgcolor=\"$diffcolorEmpty\">&nbsp;</td><td align=center bgcolor=\"$diffcolorAdd\">Added in v.$rev2</td></tr>";              "<tr><td bgcolor=\"$diffcolorEmpty\">&nbsp;</td><td align=\"center\" bgcolor=\"$diffcolorAdd\">Added in v.$rev2</td></tr>";
         print "</table></td></tr></table>\n";          print "</table></td></tr></table>\n";
   
         print "<td>";          print "<td>";
   
         # Print format selector          # Print format selector
         print "<FORM METHOD=\"GET\" ACTION=\"${scriptwhere}\">\n";          print "<form method=\"get\" action=\"${scriptwhere}\">\n";
         foreach my $var (keys %input) {          foreach my $var (keys %input) {
                 next if ($var eq "f");                  next if ($var eq "f");
                 next                  next
                     if (defined($DEFAULTVALUE{$var})                      if (defined($DEFAULTVALUE{$var})
                     && $DEFAULTVALUE{$var} eq $input{$var});                      && $DEFAULTVALUE{$var} eq $input{$var});
                 print "<INPUT TYPE=HIDDEN NAME=\"", urlencode($var),                  print "<input type=\"hidden\" name=\"", urlencode($var),
                     "\" VALUE=\"", urlencode($input{$var}), "\">\n";                      "\" value=\"", urlencode($input{$var}), "\">\n";
         }          }
         printDiffSelect($use_java_script);          printDiffSelect($use_java_script);
         print "<INPUT TYPE=SUBMIT VALUE=\"Show\">\n";          print "<input type=\"submit\" value=\"Show\">\n";
         print "</FORM>\n";          print "</form>\n";
         print "</td>";          print "</td>";
   
         print "</tr></table>";          print "</tr></table>";
Line 3046  sub navigateHeader($$$$$) {
Line 3072  sub navigateHeader($$$$$) {
         $swhere = './' . urlencode($filename) if ($swhere eq "");          $swhere = './' . urlencode($filename) if ($swhere eq "");
   
         print <<EOF;          print <<EOF;
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <HTML>  <html>
 <HEAD>  <head>
 <META name="robots" content="nofollow">  <meta name="robots" content="nofollow">
 <!-- knu-cvsweb $cvsweb_revision -->  <!-- FreeBSD-cvsweb $cvsweb_revision -->
 <TITLE>$path$filename - $title - $rev</TITLE></HEAD>  <title>$path$filename - $title - $rev</title>
   </head>
 $body_tag_for_src  $body_tag_for_src
 <table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="$navigationHeaderColor">  <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="$navigationHeaderColor">
 <tr valign=bottom><td>  <tr valign="bottom"><td>
 EOF  EOF
   
         print &link($backicon, "$swhere$query#rev$rev");          print &link($backicon, "$swhere$query#rev$rev");
Line 3062  EOF
Line 3089  EOF
             " CVS log";              " CVS log";
         print "</b> $fileicon</td>";          print "</b> $fileicon</td>";
   
         print "<td align=right>$diricon <b>Up to ", &clickablePath($path, 1),          print "<td align=\"right\">$diricon <b>Up to ",
             &clickablePath($path, 1),
             "</b></td>";              "</b></td>";
         print "</tr></table>";          print "</tr></table>";
 }  }
Line 3171  sub chooseCVSRoot() {
Line 3199  sub chooseCVSRoot() {
                 my ($k);                  my ($k);
                 print "<form method=\"GET\" action=\"${scriptwhere}\">\n";                  print "<form method=\"GET\" action=\"${scriptwhere}\">\n";
                 foreach $k (keys %input) {                  foreach $k (keys %input) {
                         print "<input type=hidden NAME=$k VALUE=$input{$k}>\n"                          print "<input type=\"hidden\" name=\"$k\" value=\"$input{$k}\">\n"
                             if ($input{$k}) && ($k ne "cvsroot");                              if ($input{$k}) && ($k ne "cvsroot");
                 }                  }
   
Line 3181  sub chooseCVSRoot() {
Line 3209  sub chooseCVSRoot() {
                 print "<table><tr>";                  print "<table><tr>";
                 print "<td>CVS Root:</td>";                  print "<td>CVS Root:</td>";
                 print "<td>\n<select name=\"cvsroot\"";                  print "<td>\n<select name=\"cvsroot\"";
                 print " onchange=\"submit()\"" if ($use_java_script);                  print " onchange=\"this.form.submit()\"" if $use_java_script;
                 print ">\n";                  print ">\n";
   
                 foreach $k (@CVSROOT) {                  foreach $k (@CVSROOT) {
                         print "<option value=\"$k\"";                          print "<option value=\"$k\"";
                         print " selected" if ($k eq $cvstree);                          print " selected" if ($k eq $cvstree);
                         print ">", ($CVSROOTdescr{$k} ? $CVSROOTdescr{$k} : $k),                          print ">",($CVSROOTdescr{$k} ? $CVSROOTdescr{$k} : $k),
                             "</option>\n";                              "</option>\n";
                 }                  }
                 print "</select>\n</td>";                  print "</select>\n</td>";
Line 3195  sub chooseCVSRoot() {
Line 3223  sub chooseCVSRoot() {
         } else {          } else {
   
                 # no choice -- but we need the form to select module/path, at least for Netscape                  # no choice -- but we need the form to select module/path, at least for Netscape
                 print "<form method=\"GET\" action=\"${scriptwhere}\">\n";                  print "<form method=\"get\" action=\"${scriptwhere}\">\n";
                 print "CVS Root: <b>[$cvstree]</b>";                  print "CVS Root: <b>[$cvstree]</b>";
         }          }
   
         print " Module path or alias:\n";          print " Module path or alias:\n";
         print "<INPUT TYPE=TEXT NAME=\"path\" VALUE=\"\" SIZE=15>\n";          print "<input type=\"text\" name=\"path\" value=\"\" size=\"15\">\n";
         print "<input type=submit value=\"Go\">";          print "<input type=\"submit\" value=\"Go\">";
   
         if (2 <= @CVSROOT) {          if (2 <= @CVSROOT) {
                 print "</td></tr></table>";                  print "</td></tr></table>";
Line 3276  sub download_url($$;$) {
Line 3304  sub download_url($$;$) {
             && (!defined($mimetype) || $mimetype ne "text/x-cvsweb-markup"))              && (!defined($mimetype) || $mimetype ne "text/x-cvsweb-markup"))
         {          {
                 my $path = $where;                  my $path = $where;
                 $path =~ s|/[^/]*$|/|;                  $path =~ s|[^/]+$||;
                 $url = "$scriptname/$checkoutMagic/${path}$url";                  $url = "$scriptname/$checkoutMagic/${path}$url";
         }          }
         $url .= "?rev=$revision";          $url .= "?rev=$revision";
Line 3293  sub download_link($$$;$) {
Line 3321  sub download_link($$$;$) {
   
         $fullurl =~ s/:/sprintf("%%%02x", ord($&))/eg;          $fullurl =~ s/:/sprintf("%%%02x", ord($&))/eg;
   
         printf '<A HREF="%s"', hrefquote("$fullurl$barequery");          printf '<a href="%s"', hrefquote("$fullurl$barequery");
   
         if ($open_extern_window          if ($open_extern_window
             && (!defined($mimetype) || $mimetype ne "text/x-cvsweb-markup"))              && (!defined($mimetype) || $mimetype ne "text/x-cvsweb-markup"))
Line 3329  sub download_link($$$;$) {
Line 3357  sub download_link($$$;$) {
                         push @attr, "height=$extern_window_height"                          push @attr, "height=$extern_window_height"
                             if (defined($extern_window_height));                              if (defined($extern_window_height));
   
                           # We need the "return false" here to prevent browsers
                           # from following the href after the onclick handler.
                           # This would effectively load the same document in
                           # the same window *twice*.
                         printf                          printf
                             q` onClick="window.open('%s','cvs_checkout','%s');"`,                              q` onclick="window.open('%s','cvs_checkout','%s');return false"`,
                             hrefquote($fullurl), join (',', @attr);                              hrefquote($fullurl), join (',', @attr);
                 }                  }
         }          }
         print "><b>$textlink</b></A>";          print "><b>$textlink</b></a>";
 }  }
   
 # Returns a Query string with the  # Returns a Query string with the
Line 3430  sub http_header(;$) {
Line 3462  sub http_header(;$) {
         if ($is_mod_perl) {          if ($is_mod_perl) {
                 Apache->request->content_type($content_type);                  Apache->request->content_type($content_type);
         } else {          } else {
                 print "Content-type: $content_type\r\n";                  print "Content-Type: $content_type\r\n";
         }          }
   
         if ($allow_compress && $maycompress) {          if ($allow_compress && $maycompress) {
Line 3445  sub http_header(;$) {
Line 3477  sub http_header(;$) {
                                         Vary => "Accept-Encoding");                                          Vary => "Accept-Encoding");
                                 Apache->request->send_http_header;                                  Apache->request->send_http_header;
                         } else {                          } else {
                                 print "Content-encoding: x-gzip\r\n";                                  print "Content-Encoding: x-gzip\r\n";
                                 print "Vary: Accept-Encoding\r\n"                                  print "Vary: Accept-Encoding\r\n"
                                     ;            #RFC 2068, 14.43                                      ;            #RFC 2068, 14.43
                                 print "\r\n";    # Close headers                                  print "\r\n";    # Close headers
Line 3467  sub http_header(;$) {
Line 3499  sub http_header(;$) {
                                 print "\r\n";    # Close headers                                  print "\r\n";    # Close headers
                         }                          }
                         print                          print
                             "<font size=-1>Unable to find gzip binary in the <b>\$command_path</b> ($command_path) to compress output</font><br>";                              "<font size=\"-1\">Unable to find gzip binary in the <b>\$command_path</b> ($command_path) to compress output</font><br>";
                 }                  }
         } else {          } else {
   
Line 3483  sub html_header($) {
Line 3515  sub html_header($) {
         my ($title) = @_;          my ($title) = @_;
         http_header("text/html");          http_header("text/html");
         print <<EOH;          print <<EOH;
 <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  "http://www.w3.org/TR/REC-html40/loose.dtd">  
 <html>  <html>
 <head>  <head>
 <meta name="robots" content="nofollow">  <meta name="robots" content="nofollow">
 <title>$title</title>  <title>$title</title>
 <!-- knu-cvsweb $cvsweb_revision -->  <!-- FreeBSD-cvsweb $cvsweb_revision -->
 </head>  </head>
 $body_tag  $body_tag
 $logo <h1 align="center">$title</h1>  $logo <h1 align="center">$title</h1>

Legend:
Removed from v.1.1.1.28  
changed lines
  Added in v.1.1.1.29

CVSweb