avoid rdep in the top level make process (subdir.mk) - it leaks too much memory and...
[openwrt.git] / scripts / timestamp.pl
index a3aa50cb0dffe23fbdcbf9f26da58d0328bcbe28..89ec4e70c310b9a81c888c0978aae1bc41456eff 100755 (executable)
@@ -17,9 +17,8 @@ sub get_ts($$) {
        while (<FIND>) {
                chomp;
                my $file = $_;
-               open FILE, "<$file";
-               my @stat = stat FILE;
-               close FILE;
+               next if -l $file;
+               my @stat = stat $file;
                if ($stat[9] > $ts) {
                        $ts = $stat[9];
                        $fn = $file;
@@ -40,6 +39,9 @@ while (@ARGV > 0) {
                $options{"findopts"} .= " -and -not -path \\*".$str."\\*"
        } elsif ($path =~ /^-f/) {
                $options{"findopts"} .= " -follow";
+       } elsif ($path =~ /^-n/) {
+               my $arg = $ARGV[0];
+               $options{$path} = $arg;
        } elsif ($path =~ /^-/) {
                $options{$path} = 1;
        } else {
@@ -55,7 +57,9 @@ while (@ARGV > 0) {
        }
 }
 
-if ($options{"-p"}) {
+if ($options{"-n"}) {
+       exit ($n eq $options{"-n"} ? 0 : 1);
+} elsif ($options{"-p"}) {
        print "$n\n";
 } elsif ($options{"-t"}) {
        print "$ts\n";