1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-07-02 20:31:07 +03:00
openwrt-xburst/scripts/timestamp.pl
nbd 61ad8a56f8 redirect find stderr to /dev/null in timestamp.pl
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3678 3c298f89-4303-0410-b956-a3cf2f4a3e73
2006-04-20 00:33:40 +00:00

41 lines
661 B
Perl
Executable File

#!/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\\* 2>/dev/null |";
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";
}