SVN: toys/rsget.pl/t/prepare

sparky sparky at pld-linux.org
Thu Mar 11 01:05:48 CET 2010


Author: sparky
Date: Thu Mar 11 01:05:47 2010
New Revision: 11230

Modified:
   toys/rsget.pl/t/prepare
Log:
- write test.list and .orig list for comparision


Modified: toys/rsget.pl/t/prepare
==============================================================================
--- toys/rsget.pl/t/prepare	(original)
+++ toys/rsget.pl/t/prepare	Thu Mar 11 01:05:47 2010
@@ -3,13 +3,34 @@
 use strict;
 use warnings;
 
-while ( <> ) {
-	if ( /#\s*src:\s*(.+)/ ) {
-		print;
-		print $1 . "\n";
-	} elsif ( /^# invalid uri:/ ) {
-		# nothing here
-	} elsif ( /^(#.*|)$/ ) {
-		print;
+open F_LIST, ">", "test.list";
+open F_ORIG, ">", "test.list.orig";
+
+while ( my $file = shift @ARGV ) {
+	open F_IN, "<", $file or die;
+
+	my $src = "# source: $file\n";
+	print $src;
+	print F_LIST $src;
+	print F_ORIG $src;
+
+	while ( <F_IN> ) {
+		print F_ORIG $_;
+		if ( /#\s*src:\s*(.+)/ ) {
+			print F_LIST $_;
+			print F_LIST $1 . "\n";
+		} elsif ( /^# invalid uri:/ ) {
+			# nothing here
+		} elsif ( /^(#.*|)$/ ) {
+			print F_LIST $_;
+		}
 	}
+
+	close F_IN;
+
+	print F_LIST "\n";
+	print F_ORIG "\n";
 }
+
+close F_LIST and print "wrote test.list\n";
+close F_ORIG and print "wrote test.list.orig\n";


More information about the pld-cvs-commit mailing list