michael@0: #!/usr/local/bin/perl michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: #Input: [-d dir] foo1.java foo2.java michael@0: #Compares with: foo1.class foo2.class (if -d specified, checks in 'dir', michael@0: # otherwise assumes .class files in same directory as .java files) michael@0: #Returns: list of input arguments which are newer than corresponding class michael@0: #files (non-existent class files are considered to be real old :-) michael@0: michael@0: $found = 1; michael@0: michael@0: if ($ARGV[0] eq '-d') { michael@0: $classdir = $ARGV[1]; michael@0: $classdir .= "/"; michael@0: shift; michael@0: shift; michael@0: } else { michael@0: $classdir = "./"; michael@0: } michael@0: michael@0: foreach $filename (@ARGV) { michael@0: $classfilename = $classdir; michael@0: $classfilename .= $filename; michael@0: $classfilename =~ s/.java$/.class/; michael@0: ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime, michael@0: $ctime,$blksize,$blocks) = stat($filename); michael@0: ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime, michael@0: $ctime,$blksize,$blocks) = stat($classfilename); michael@0: # print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n"; michael@0: if ($mtime > $classmtime) { michael@0: print $filename, " "; michael@0: $found = 0; michael@0: } michael@0: } michael@0: michael@0: print "\n";