mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
test-wrap-argv: hold a copy of the original file in an array
This will be useful to check if the file is wrapped already.
This commit is contained in:
parent
80880fd4af
commit
b0590a53a5
@ -33,15 +33,15 @@ sub rewrap {
|
|||||||
|
|
||||||
# Read the original file
|
# Read the original file
|
||||||
open FILE, "<", $file or die "cannot read $file: $!";
|
open FILE, "<", $file or die "cannot read $file: $!";
|
||||||
my @lines;
|
my @orig_lines = <FILE>;
|
||||||
while (<FILE>) {
|
close FILE;
|
||||||
|
my @lines = @orig_lines;
|
||||||
|
foreach (@lines) {
|
||||||
# If there is a trailing '\' then kill the new line
|
# If there is a trailing '\' then kill the new line
|
||||||
if (/\\$/) {
|
if (/\\$/) {
|
||||||
chomp;
|
chomp;
|
||||||
$_ =~ s/\\$//;
|
$_ =~ s/\\$//;
|
||||||
}
|
}
|
||||||
|
|
||||||
push @lines, $_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Skip empty files
|
# Skip empty files
|
||||||
@ -49,7 +49,6 @@ sub rewrap {
|
|||||||
|
|
||||||
# Kill the last new line in the file
|
# Kill the last new line in the file
|
||||||
chomp @lines[$#lines];
|
chomp @lines[$#lines];
|
||||||
close FILE;
|
|
||||||
|
|
||||||
# Reconstruct the master data by joining all lines
|
# Reconstruct the master data by joining all lines
|
||||||
# and then split again based on the real desired
|
# and then split again based on the real desired
|
||||||
|
Loading…
Reference in New Issue
Block a user