]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[v9_6] fix todos bug
authorEvan Hunt <each@isc.org>
Wed, 3 Jul 2013 22:58:19 +0000 (15:58 -0700)
committerEvan Hunt <each@isc.org>
Wed, 3 Jul 2013 22:58:19 +0000 (15:58 -0700)
win32utils/todos.pl

index a149465ca59f729ac37b51347c9cdc03feb6d7f7..2baf66342ae6ec9d2e28d4e409b1df78fdcef323 100644 (file)
@@ -24,16 +24,27 @@ use strict;
 use File::Find;
 
 sub todos {
-        local ($^I, @ARGV) = (defined, @_);
-        while (<>) {
-                s/[\r\n]+$/\r\n/;
-                print;
-        }
+       local @ARGV = @_;
+       unshift (@ARGV, '-') unless @ARGV;
+       while ($ARGV = shift) {
+               open(FH, $ARGV);
+               binmode(FH);
+               my @lines = <FH>;
+               close(FH);
+
+               open(FH, ">$ARGV");
+               binmode(FH);
+               for my $line (@lines) {
+                       $line =~ s/[\r\n]+$/\r\n/;
+                       print FH $line;
+               }
+               close(FH);
+       }
 }
 
 sub wanted {
-        return unless -f && $_ =~ qr/\.(mak|dsp|dsw|txt|bat)$/;
-        todos $File::Find::dir . "/" . $_;
+       return unless -f && $_ =~ qr/\.(mak|dsp|dsw|txt|bat)$/;
+       todos $_;
 }
 
 finddepth(\&wanted, "..");