#!/usr/bin/env perl # $Id$ # Public domain. Originally written 2008, Karl Berry. # 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. exit (&main ()); sub main { if (@ARGV != 2) { warn <) { s/\r\n?/\n/g; next if /^\s*%%\s*$/; # ignore %% lines, see above. #warn "line is |$_|"; $ret .= $_; } 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. $ret .= "\n" if substr ($ret, -1) ne "\n"; return $ret; }