diff options
| author | Felix Fietkau <nbd@openwrt.org> | 2006-04-20 00:25:17 +0000 |
|---|---|---|
| committer | Felix Fietkau <nbd@openwrt.org> | 2006-04-20 00:25:17 +0000 |
| commit | 6d35e9d0f580f95aa7a97366cf5a325543494f2d (patch) | |
| tree | e8212a391a3a0e6d225803d87c3d882fd10ccc4d | |
| parent | e3199bd4d60038d10945b0182a834ff9a051eeec (diff) | |
| download | mtk-20170518-6d35e9d0f580f95aa7a97366cf5a325543494f2d.zip mtk-20170518-6d35e9d0f580f95aa7a97366cf5a325543494f2d.tar.gz mtk-20170518-6d35e9d0f580f95aa7a97366cf5a325543494f2d.tar.bz2 | |
add timestamp check script
SVN-Revision: 3677
| -rwxr-xr-x | openwrt/scripts/timestamp.pl | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/openwrt/scripts/timestamp.pl b/openwrt/scripts/timestamp.pl new file mode 100755 index 0000000..f6b06bc --- /dev/null +++ b/openwrt/scripts/timestamp.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl +use strict; + +sub get_ts($) { + my $path = shift; + my $ts = 0; + open FIND, "find $path -not -path \\*.svn\\* -and -not -path \\*CVS\\* |"; + while (<FIND>) { + open FILE, "<$_"; + my @stat = stat FILE; + close FILE; + $ts = $stat[9] if ($stat[9] > $ts); + } + close FIND; + return $ts; +} + +(@ARGV > 0) or push @ARGV, "."; +my $ts = 0; +my $n = "."; +my %options; +foreach my $path (@ARGV) { + if ($path =~ /^-/) { + $options{$path} = 1; + } else { + my $tmp = get_ts($path); + if ($tmp > $ts) { + $n = $path; + $ts = $tmp; + } + } +} + +if ($options{"-p"}) { + print "$n\n"; +} elsif ($options{"-t"}) { + print "$ts\n"; +} else { + print "$n\t$ts\n"; +} |
