diff options
author | Karl Berry <karl@freefriends.org> | 2020-02-19 22:28:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-02-19 22:28:45 +0000 |
commit | 99c28e24b25819a97e508923d5da1edb6fa4cdd0 (patch) | |
tree | bbea5768448f1d2713551c982f31f363bdae6be0 /Master/tlpkg | |
parent | a9e8ab5ea667e1e188595e49a7cc6fcc4e5ae18e (diff) |
doc
git-svn-id: svn://tug.org/texlive/trunk@53848 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-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. |