Modified convert_to_eula.pl to parse multiple instances of the SFL licence.
authorChetan Kapoor <chetank@symbian.org>
Thu, 01 Oct 2009 17:42:05 +0100
changeset 71 59ba21437bf0
parent 70 b1a0e8d95890
child 73 421d5a95c85a
Modified convert_to_eula.pl to parse multiple instances of the SFL licence.
williamr/convert_to_eula.pl
--- a/williamr/convert_to_eula.pl	Thu Oct 01 16:23:51 2009 +0100
+++ b/williamr/convert_to_eula.pl	Thu Oct 01 17:42:05 2009 +0100
@@ -42,13 +42,16 @@
   
   my $updated = 0;
   my @newlines = ();
+  my $index = 1;
   while (my $line = shift @lines)
     { 
-    if (index($line,$newtext[0]) >= 0)
-      {
+	if (index($line,$newtext[0]) >= 0)
+    {
       # file already converted - nothing to do
-      last;
-      }
+	  push @newlines, $line;
+	  next;
+	  #last;
+    }
     # under the terms of the License "Symbian Foundation License v1.0"
     # which accompanies this distribution, and is available
     # at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
@@ -57,6 +60,7 @@
       {
       my $midline = shift @lines;
       my $urlline = shift @lines;
+	  $index+=2;
       my $pos2 = index $urlline, $oldtext[1];
       if ($pos2 >= 0)
         {
@@ -65,16 +69,21 @@
         substr $urlline, $pos2, length($oldtext[1]), $newtext[1];
         push @newlines, $line, $midline, $urlline;
         $updated = 1;
-        last;
+        next;
+        #last;
         }
       else
         {
-        print STDERR "Problem in $file: incorrectly formatted >\n$line$midline$urlline\n";
-        push @errorfiles, $file;
+			if(!$updated)
+			{
+				print STDERR "Problem in $file at $index: incorrectly formatted >\n$line$midline$urlline\n";
+				push @errorfiles, $file;
+			}	
         last;
         }
       }
     push @newlines, $line;
+	$index+=1;
     }
 
   return if (!$updated);