[PATCH 6/8] test-wrap-argv: hold a copy of the original file in an array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will be useful to check if the file is wrapped already.
---
 tests/test-wrap-argv.pl | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/test-wrap-argv.pl b/tests/test-wrap-argv.pl
index 1f619cc..96f998a 100755
--- a/tests/test-wrap-argv.pl
+++ b/tests/test-wrap-argv.pl
@@ -33,15 +33,15 @@ sub rewrap {
 
     # Read the original file
     open FILE, "<", $file or die "cannot read $file: $!";
-    my @lines;
-    while (<FILE>) {
+    my @orig_lines = <FILE>;
+    close FILE;
+    my @lines = @orig_lines;
+    foreach (@lines) {
         # If there is a trailing '\' then kill the new line
         if (/\\$/) {
             chomp;
             $_ =~ s/\\$//;
         }
-
-        push @lines, $_;
     }
 
     # Skip empty files
@@ -49,7 +49,6 @@ sub rewrap {
 
     # Kill the last new line in the file
     chomp @lines[$#lines];
-    close FILE;
 
     # Reconstruct the master data by joining all lines
     # and then split again based on the real desired
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]