|
1 #!/usr/local/bin/perl |
|
2 # |
|
3 # This Source Code Form is subject to the terms of the Mozilla Public |
|
4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
6 |
|
7 #Input: [-d dir] foo1.java foo2.java |
|
8 #Compares with: foo1.class foo2.class (if -d specified, checks in 'dir', |
|
9 # otherwise assumes .class files in same directory as .java files) |
|
10 #Returns: list of input arguments which are newer than corresponding class |
|
11 #files (non-existent class files are considered to be real old :-) |
|
12 |
|
13 $found = 1; |
|
14 |
|
15 if ($ARGV[0] eq '-d') { |
|
16 $classdir = $ARGV[1]; |
|
17 $classdir .= "/"; |
|
18 shift; |
|
19 shift; |
|
20 } else { |
|
21 $classdir = "./"; |
|
22 } |
|
23 |
|
24 foreach $filename (@ARGV) { |
|
25 $classfilename = $classdir; |
|
26 $classfilename .= $filename; |
|
27 $classfilename =~ s/.java$/.class/; |
|
28 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime, |
|
29 $ctime,$blksize,$blocks) = stat($filename); |
|
30 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime, |
|
31 $ctime,$blksize,$blocks) = stat($classfilename); |
|
32 # print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n"; |
|
33 if ($mtime > $classmtime) { |
|
34 print $filename, " "; |
|
35 $found = 0; |
|
36 } |
|
37 } |
|
38 |
|
39 print "\n"; |