Re: Patch: %m for two-digit month in X-refs

Andrew Ford (andrew@icarus.demon.co.uk)
Sun, 9 Feb 1997 19:46:13 +0100


Oops I sent the wrong version of the previous patch -- the month
number should be padded with a zero if it is less than ten.  Revised
patch follows.

Andrew
-- 
Andrew Ford                             Email:  andrew@icarus.demon.co.uk
Independent Software Consultant         WWW:    http://www.nhbs.co.uk/aford/
"Brittany", Wells Road,                 Tel:    +44 1452 770836
Eastcombe, Stroud, GL6 7EE, GB          Fax:    +44 1452 770835



*** wwwstat.pl.orig	Mon Nov  4 19:06:18 1996
--- wwwstat	Sun Feb  9 18:42:16 1997
***************
*** 1463,1470 ****
      &output_xref($Do_Ident,     $TopIdent,     'Ident',     $IdentHeader);
  
      if ($LastSummary) {
!         local($prevmonth, $prevyear) = &lastmonth($earliest);
          $LastSummary =~ s/%M/$prevmonth/g;
          $LastSummary =~ s/%Y/$prevyear/g;
          print "<LI><A HREF=\"$LastSummary\">$LastSumHeader</A>\n";
      }
--- 1463,1471 ----
      &output_xref($Do_Ident,     $TopIdent,     'Ident',     $IdentHeader);
  
      if ($LastSummary) {
!         local($prevmonth, $prevmm, $prevyear) = &lastmonth($earliest);
          $LastSummary =~ s/%M/$prevmonth/g;
+         $LastSummary =~ s/%m/$prevmm/g;
          $LastSummary =~ s/%Y/$prevyear/g;
          print "<LI><A HREF=\"$LastSummary\">$LastSumHeader</A>\n";
      }
***************
*** 1919,1926 ****
      local($midx) = index($AllMonths, substr($date,0,3));
      local($year) = substr($date,7,4);
  
!     if    ($midx  < 0) { return ('Err', ''); }
!     elsif ($midx == 0) { return ('Dec', ($year - 1)); }
!     else               { return (substr($AllMonths,($midx - 3),3), $year); }
  }
  
--- 1920,1928 ----
      local($midx) = index($AllMonths, substr($date,0,3));
      local($year) = substr($date,7,4);
  
!     if    ($midx  < 0) { return ('Err', '', ''); }
!     elsif ($midx == 0) { return ('Dec', 12, ($year - 1)); }
!     else               { return (substr($AllMonths,($midx - 3),3), 
! 				 sprintf("%02d", $midx/3), $year); }
  }
  
*** wwwstat.1.orig	Sun Feb  9 15:05:07 1997
--- wwwstat.1	Sun Feb  9 15:05:53 1997
***************
*** 217,226 ****
  Use the given string as the HTML title and heading for output.
  .TP
  .BI \-X " string"
! Use the given string as the cross-reference URL to the last summary output.
! Any occurrence of the characters "%M" or "%Y" are replaced by the month
! and year, respectively, of the month prior to the first log entry date.
! The empty string will exclude any cross-reference.
  .TP
  .B \-R
  Display the daily stats table sorted in reverse. This option is primarily
--- 217,227 ----
  Use the given string as the HTML title and heading for output.
  .TP
  .BI \-X " string"
! Use the given string as the cross-reference URL to the last summary
! output.  Any occurrence of the characters "%M", "%m" or "%Y" are
! replaced by the abbreviated month name, the two digit month number and
! the year, respectively, of the month prior to the first log entry
! date.  The empty string will exclude any cross-reference.
  .TP
  .B \-R
  Display the daily stats table sorted in reverse. This option is primarily
*** wwwstat.html.orig	Sun Feb  9 15:04:59 1997
--- wwwstat.html	Sun Feb  9 15:06:48 1997
***************
*** 145,152 ****
  <DL COMPACT>
  <DT><B>-H</B><I> string</I> <DD>Use the given string as the HTML title and heading for output.
  <DT><B>-X</B><I> string</I> <DD>Use the given string as the cross-reference URL to the last summary output.
! Any occurrence of the characters &quot;%M&quot; or &quot;%Y&quot; are replaced by the month
! and year, respectively, of the month prior to the first log entry date.
  The empty string will exclude any cross-reference.
  <DT><B>-R</B> <DD>Display the daily stats table sorted in reverse. This option is primarily
  for use with the
--- 145,154 ----
  <DL COMPACT>
  <DT><B>-H</B><I> string</I> <DD>Use the given string as the HTML title and heading for output.
  <DT><B>-X</B><I> string</I> <DD>Use the given string as the cross-reference URL to the last summary output.
! Any occurrence of the characters &quot;%M&quot;, &quot;%m&quot; or
! &quot;%Y&quot; are replaced by the abbreviated month name, the two
! digit month number and the year, respectively, of the month prior to
! the first log entry date.
  The empty string will exclude any cross-reference.
  <DT><B>-R</B> <DD>Display the daily stats table sorted in reverse. This option is primarily
  for use with the