diff options
Diffstat (limited to 'Master/tlpkg/bin/cmp-textfiles')
-rwxr-xr-x | Master/tlpkg/bin/cmp-textfiles | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Master/tlpkg/bin/cmp-textfiles b/Master/tlpkg/bin/cmp-textfiles index d0b3e30a152..053020c2264 100755 --- a/Master/tlpkg/bin/cmp-textfiles +++ b/Master/tlpkg/bin/cmp-textfiles @@ -1,7 +1,8 @@ #!/usr/bin/env perl # $Id$ # Public domain. Originally written 2008, Karl Berry. -# Compare two files considering CR, LF, and CRLF as equivalent. , +# Compare two files considering CR, LF, and CRLF as equivalent, +# ignoring blank lines, # and ignoring %% lines (see below). # # Used in place and tlpkg-ctan-check in TeX Live. @@ -12,7 +13,7 @@ sub main { if (@ARGV != 2) { warn <<END_USAGE; Usage: $0 FILE1 FILE2. -Compare as text files, ignoring line endings. +Compare as text files, ignoring line endings and %% lines. Exit status is zero if the same, 1 if different, something else if trouble. END_USAGE exit $ARGV[0] eq "--help" ? 0 : 2; @@ -38,15 +39,14 @@ sub read_file { my ($fname) = @_; my $ret = ""; - local *FILE; - open (FILE, $fname) || die "open($fname) failed: $!"; - while (<FILE>) { + open (my $FILE, $fname) || die "open($fname) failed: $!"; + while (<$FILE>) { s/\r\n?/\n/g; next if /^\s*%%\s*$/; # ignore %% lines, see above. #warn "line is |$_|"; $ret .= $_; } - close (FILE) || warn "close($fname) failed: $!"; + close ($FILE) || warn "close($fname) failed: $!"; # if the file did not have a trailing newline, add one for purposes of # comparison, since it can slip in if we edit it, etc. |