$OpenBSD$
--- cvsweb.cgi.orig	Sun Sep 25 22:28:51 2005
+++ cvsweb.cgi	Fri Jun  8 15:09:49 2012
@@ -45,7 +45,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: projects/cvsweb/cvsweb.cgi,v 1.295 2005/09/25 20:28:51 scop Exp $
+# $FreeBSD: projects/cvsweb/cvsweb.cgi,v 1.297 2005/12/03 18:39:45 scop Exp $
 # $Id: cvsweb.cgi,v 1.112 2001/07/24 13:03:16 hzeller Exp $
 # $Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.84 2001/10/07 20:50:10 knu Exp $
 #
@@ -214,7 +214,7 @@ my ($mydir) = (dirname($0) =~ /(.*)/);    # untaint
 
 # == EDIT this ==
 # Locations to search for user configuration, in order:
-for (catfile($mydir, 'cvsweb.conf'), '/usr/local/etc/cvsweb/cvsweb.conf') {
+for (catfile($mydir, 'cvsweb.conf'), '/conf/cvsweb/cvsweb.conf', '%%CONFDIR%%/cvsweb/cvsweb.conf') {
   if (-r $_) {
     $config = $_;
     last;
@@ -241,7 +241,7 @@ $cvstreedefault = $logo = $defaulttitle =
 
 $allow_version_select = $allow_mailtos = $allow_log_extra = 1;
 
-@DIFFTYPES = qw(h H u c s);
+@DIFFTYPES = qw(h H u c);
 @DIFFTYPES{@DIFFTYPES} = (
   {
     'descr'   => 'colored',
@@ -263,12 +263,6 @@ $allow_version_select = $allow_mailtos = $allow_log_ex
     'opts'    => ['-c'],
     'colored' => 0,
   },
-  {
-    'descr'   => 'side by side',
-    # width=168 should be enough to support 80 character line lengths
-    'opts'    => ['--side-by-side', '--width=168'],
-    'colored' => 0,
-  },
 );
 
 @LOGSORTKEYS = qw(cvs date rev);
@@ -559,8 +553,8 @@ foreach (@stickyvars) {
 }
 
 if ($allow_enscript) {
-  push(@DIFFTYPES, qw(uc cc sc));
-  @DIFFTYPES{qw(uc cc sc)} = (
+  push(@DIFFTYPES, qw(uc cc));
+  @DIFFTYPES{qw(uc cc)} = (
     {
      'descr'   => 'unified, colored',
      'opts'    => ['-u'],
@@ -571,12 +565,6 @@ if ($allow_enscript) {
      'opts'    => ['-c'],
      'colored' => 0,
     },
-    {
-     'descr'   => 'side by side, colored',
-     # width=168 should be enough to support 80 character line lengths
-     'opts'    => ['--side-by-side', '--width=168'],
-     'colored' => 0,
-    },
   );
 } else {
   # No Enscript -> respect difftype, but don't offer colorization.
@@ -789,6 +777,7 @@ if ($input{tarball}) {
   }
 
   # Clean up.
+  chdir("..");
   rmtree($tmpexportdir);
 
   &fatal(@fatal) if @fatal;
@@ -883,8 +872,8 @@ if (-d $fullname) {
 
   my $infocols = 1;
 
-  printf(<<EOF, 'Directory index of ' . htmlquote($where));
-<table class="dir" width="100%%" cellspacing="0" cellpadding="$tablepadding" summary="%s">
+  printf(<<EOF, $tablepadding, 'Directory index of ' . htmlquote($where));
+<table class="dir" width="100%%" cellspacing="0" cellpadding="%s" summary="%s">
 <tr>
 EOF
   printf('<th colspan="2"%s>', ($byfile ? ' class="sorted"' : ''));
@@ -1028,8 +1017,13 @@ EOF
 
       # Show last change in dir
       if ($filename) {
-        print "</td>\n<td>&nbsp;</td>\n<td class=\"age\">";
-        print readableTime(time() - $date, 0) if $date;
+        my $ageclass = 'age';
+        my $age      = '';
+        if ($date) {
+          $age       = readableTime(time() - $date, 0);
+          $ageclass .= " $1" if ($age =~ /^\d+ ([a-z]+)/);
+        }
+        print "</td>\n<td>&nbsp;</td>\n<td class=\"$ageclass\">$age";
         print "</td>\n<td class=\"author\">", htmlquote($author)
           if $show_author;
         print "</td>\n<td class=\"log\">";
@@ -1084,8 +1078,13 @@ EOF
       print '&nbsp;', &link(htmlquote($file), $url), $attic;
       print '</td><td class="graph">', graph_link($fileurl) if $allow_cvsgraph;
       print "</td>\n<td width=\"30\">", display_link($fileurl, $rev);
-      print "</td>\n<td class=\"age\">";
-      print readableTime(time() - $date, 0) if $date;
+      my $ageclass = 'age';
+      my $age      = '';
+      if ($date) {
+        $age       = readableTime(time() - $date, 0);
+        $ageclass .= " $1" if ($age =~ /^\d+ ([a-z]+)/);
+      }
+      print "</td>\n<td class=\"$ageclass\">$age";
       print "</td>\n<td class=\"author\">", htmlquote($author) if $show_author;
       print "</td>\n<td class=\"log\">";
 
@@ -1135,8 +1134,8 @@ EOF
   if (scalar %tags || $input{only_with_tag}) {
     print "<form method=\"get\" action=\"./\">\n<p>\n";
     foreach my $var (@stickyvars) {
-      printf("<input type=\"hidden\" name=\"$var\" value=\"%s\" />\n",
-             htmlquote($input{$var}))
+      printf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />\n",
+             $var, htmlquote($input{$var}))
         if (defined($input{$var})
             && (!defined($DEFAULTVALUE{$var})
                 || $input{$var} ne $DEFAULTVALUE{$var})
@@ -2319,12 +2318,6 @@ sub doDiff($$$$$$)
   # used with --side-by-side.
   if ($showfunc && $f !~ /^s/) {
     push(@difftype, '-p');
-    while (my ($re1, $re2) = each %funcline_regexp) {
-      if ($fullname =~ $re1) {
-        push(@difftype, '-F', $re2);
-        last;
-      }
-    }
   }
 
   if ($human_readable) {
@@ -3350,8 +3343,8 @@ EOF
     next if ($_ eq "f");
     next if ($_ eq "only_with_tag");
     next if ($_ eq "logsort");
-    printf("<input type=\"hidden\" name=\"$_\" value=\"%s\" />\n",
-           htmlquote($input{$_}))
+    printf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />\n",
+           $_, htmlquote($input{$_}))
       if (defined($input{$_})
           && (!defined($DEFAULTVALUE{$_}) || $input{$_} ne $DEFAULTVALUE{$_}));
   }
@@ -4458,7 +4451,7 @@ sub TIEHANDLE
               crc    => 0,
               len    => 0,
             };
-  my ($header) = pack("c10",
+  my ($header) = pack("U10",
                       MAGIC1, MAGIC2, Compress::Zlib::Z_DEFLATED(),
                       0, 0, 0, 0, 0, 0, OSCODE);
   print {$o->{handle}} $header;
