#!/lang/perl
my ($file1, $file2, @diffopts) = @ARGV;
# quick diff, checks if size and mtime are the same first, and skips diff if so -
# treediff uses the same technique but within the one program to avoid fork/exec
my ($size1, $mtime1) = (stat($file1))[7,9];
my ($size2, $mtime2) = (stat($file2))[7,9];
if ($size1 == $size2 && $mtime1 == $mtime2) {
	# files are almost certainly the same, skip diff
} else {
	# files are probably different - run diff
	exec("diff", @diffopts, "--", $file1, $file2);
}
