diff options
author | Christian Ruppert <idl0r@gentoo.org> | 2012-04-23 04:24:09 +0200 |
---|---|---|
committer | Christian Ruppert <idl0r@gentoo.org> | 2012-04-23 04:24:09 +0200 |
commit | 430f15ddbd8405d7e82a332cbd9c242405923800 (patch) | |
tree | e3b00d08fff9986a273703dfc33d7b14406f257f | |
parent | Some cleanup (diff) | |
download | gentoolkit-430f15ddbd8405d7e82a332cbd9c242405923800.tar.gz gentoolkit-430f15ddbd8405d7e82a332cbd9c242405923800.tar.bz2 gentoolkit-430f15ddbd8405d7e82a332cbd9c242405923800.zip |
More cleanup
-rwxr-xr-x | src/ekeyword/ekeyword | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ekeyword/ekeyword b/src/ekeyword/ekeyword index 0c68773..5f94fc6 100755 --- a/src/ekeyword/ekeyword +++ b/src/ekeyword/ekeyword @@ -112,7 +112,6 @@ for my $f (@ARGV) { open(my $fh_in, "<", $f) or die "Can't read $f: $!\n"; open(my $fh_out, ">", "${f}.new") or die "Can't create ${f}.new: ${!}\n"; - select($fh_out); my $count = 0; while(<$fh_in>) { @@ -121,10 +120,10 @@ for my $f (@ARGV) { seek($fh_in, 0, 0); while (<$fh_in>) { - if (/^\s*KEYWORDS=/) { + if (m/^\s*KEYWORDS=/) { # extract the quoted section from KEYWORDS - while (not /^\s*KEYWORDS=["'].*?["']/) { + while (not m/^\s*KEYWORDS=["'].*?["']/) { chomp; my $next = <$fh_in>; $_ = join " ", $_, $next; @@ -134,7 +133,7 @@ for my $f (@ARGV) { if($count > 1 && length($quoted) eq 0) { # Skip empty KEYWORDS variables in case they occur more than # once, bug 321475. - print $_; + print $fh_out $_; next; } @@ -218,15 +217,15 @@ for my $f (@ARGV) { # re-insert quoted to KEYWORDS s/(["']).*?["']/$1$quoted$1/; - print $_ or die "Can't write $f.new: $!\n"; + print $fh_out $_ or die "Can't write $f.new: $!\n"; } else { - print, next; + print $fh_out $_; + next; } } close($fh_in); close($fh_out); - select STDOUT; system("diff -U 0 ${f} ${f}.new"); rename("$f.new", "$f") or die "Can't rename: $!\n"; |