bagder: curl-www/docs relinfo.pl,1.1,1.2

[email protected] Tue, 05 May 2009 09:11:39 +0000
Newsgroups gmane.comp.web.curl.www.cvs
Message-ID <[email protected]>
Update of /cvsroot/curl/curl-www/docs
In directory labb:/tmp/cvs-serv28847

Modified Files:
	relinfo.pl 
Log Message:
added --raw to generate raw output


Index: relinfo.pl
===================================================================
RCS file: /cvsroot/curl/curl-www/docs/relinfo.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- relinfo.pl	4 Feb 2009 21:47:49 -0000	1.1
+++ relinfo.pl	5 May 2009 09:11:37 -0000	1.2
@@ -3,6 +3,12 @@
 # un-preprocessed _changes-file as input
 require "vuln.pm";            
 
+my $raw; # raw output. no html
+
+if($ARGV[0] eq "--raw") {
+    $raw=1;
+}
+
 sub vernum {
     my ($ver)=@_;
     my @v = split('\.', $ver);
@@ -19,8 +25,11 @@
     $v++;
 }
 
-print "<table>";
+print "<table>" if(!$raw);
 sub head {
+    if($raw) {
+        return;
+    }
     print "<tr class=\"tabletop\"><th>index</th><th>Version</th><th>Vulnerabilites</th>";
     printf("<th>Date</th><th>Since %s</th><th>Days</th><th>Bugfixes</th><th>Changes</th></tr>\n",
            $releases[0]);
@@ -127,10 +136,16 @@
     my $anchor = $str;
     
     $anchor =~ s/\./_/g;
-    
-    printf("<tr class=\"%s\"><td>%d</td><td><a href=\"/changes.html#$anchor\">$str</a></td>",
-           $l&1?"even":"odd",
-           $index++);
+
+    if($raw) {
+        printf "%d;$str;", $index;
+    }
+    else {
+        printf("<tr class=\"%s\"><td>%d</td><td><a href=\"/changes.html#$anchor\">$str</a></td>",
+               $l&1?"even":"odd",
+               $index);
+    }
+    $index++;
     my $vulc=0;
     my $vulstr;
     for my $i (0 .. scalar(@vuln)-1 ) {
@@ -141,11 +156,16 @@
             $vulc++;
         }
     }
-    if($vulstr) {
-        print "<td>$vulstr</td>";
+    if($raw) {
+        printf "%d;", $vulc;
     }
     else {
-        print "<td>&nbsp;</td>";
+        if($vulstr) {
+            print "<td>$vulstr</td>";
+        }
+        else {
+            print "<td>&nbsp;</td>";
+        }
     }
     if($date =~ /([A-Za-z]+) (\d+) (\d\d\d\d)/) {
         if(length($1)>3) {
@@ -162,11 +182,19 @@
     my $deltadays = $delta{$later{$str}};
     $totaldays += $deltadays;
 
-    printf("<td>$date</td><td>$age</td><td>$deltadays ($totaldays)</td><td>%d (%d)</td><td>%d (%d)</td></tr>\n",
-           $bugfixes{$str}, $totalbugs,
-           $changes{$str}, $totalchanges);
+    if($raw) {
+        printf("$date;$age;%d;$totaldays;%d;%d;%d;%d;\n",
+               $deltadays,
+               $bugfixes{$str}, $totalbugs,
+               $changes{$str}, $totalchanges);
+    }
+    else {
+        printf("<td>$date</td><td>$age</td><td>$deltadays ($totaldays)</td><td>%d (%d)</td><td>%d (%d)</td></tr>\n",
+               $bugfixes{$str}, $totalbugs,
+               $changes{$str}, $totalchanges);
+    }
  
     ++$l;
 }
 
-print "</table>\n";
+print "</table>\n" if(!$raw);