#! /usr/bin/perl -w use File::Find; use File::Basename; use strict; @ARGV == 2 or die "Usage: $0 dir1 dir2 \n"; my $dir1 = $ARGV[0]; my $dir2 = $ARGV[1]; my %hasht; sub getsource { my $filename = $File::Find::name; if( $filename =~ /\.c$/ || /\.cpp$/ || /\.h$/ || /\.tcl$/ ){ my $base = basename($filename); $hasht{$base} = $filename; } } find (\&getsource, $dir1); my %hash1 = %hasht; %hasht = (); find (\&getsource, $dir2); my %hash2 = %hasht; my $key; foreach $key (keys %hash1) { if (!exists($hash2{$key})) { printf "$key does not exist in $dir2\n"; next; } my $difference = `diff -q $hash1{$key} $hash2{$key}`; next unless $difference; my $detail = `diff $hash1{$key} $hash2{$key}`; $detail =~ s/.*static char \*cvsid="\$Id:.*//g; $detail =~ s/2c2|1c1//; $detail =~ s/---//; next unless $detail =~ /\w/; print $difference; } =head1 DESCRIPTION Compare *.c *.cc *.h *.tcl files in two directories. =head1 README Help CVS users manage branches. Report the source code files that are different in two directories. Report the files existing in dir1 but missing from dir2. =head1 PREREQUISITES requires strict module and File module =head1 SCRIPT CATEGORIES VersionControl/CVS UNIX/System_administration =cut