synccompare: normalize directory

Passing a single directory with items inside was not supported yet.
Only comparison was able to read such items. This patch adds the
same feature to the single argument case.
This commit is contained in:
Patrick Ohly 2010-11-26 14:07:04 +01:00
parent 9094edd765
commit e426108e11

View file

@ -799,7 +799,12 @@ if($#ARGV > 1) {
# normalize
my $in;
if( $#ARGV >= 0 ) {
open(IN, "<$ARGV[0]") || die "$ARGV[0]: $!";
my $file1 = $ARGV[0];
if (-d $file1) {
open(IN, "-|:utf8", "find $file1 -type f -print0 | xargs -0 cat") || die "$file1: $!";
} else {
open(IN, "<:utf8", $file1) || die "$file1: $!";
}
$in = *IN{IO};
} else {
$in = *STDIN{IO};