remove madwifi-old
[openwrt.git] / scripts / timestamp.pl
1 #!/usr/bin/perl
2 use strict;
3
4 sub get_ts($$) {
5 my $path = shift;
6 my $options = shift;
7 my $ts = 0;
8 my $fn = "";
9 open FIND, "find $path -not -path \\*.svn\\* -and -not -path \\*CVS\\* $options 2>/dev/null |";
10 while (<FIND>) {
11 chomp;
12 my $file = $_;
13 open FILE, "<$file";
14 my @stat = stat FILE;
15 close FILE;
16 if ($stat[9] > $ts) {
17 $ts = $stat[9];
18 $fn = $file;
19 }
20 }
21 close FIND;
22 return ($ts, $fn);
23 }
24
25 (@ARGV > 0) or push @ARGV, ".";
26 my $ts = 0;
27 my $n = ".";
28 my %options;
29 while (@ARGV > 0) {
30 my $path = shift @ARGV;
31 if ($path =~ /^-x/) {
32 my $str = shift @ARGV;
33 $options{"-x"} .= " -and -not -path \\*".$str."\\*"
34 } elsif ($path =~ /^-/) {
35 $options{$path} = 1;
36 } else {
37 my ($tmp, $fname) = get_ts($path, $options{"-x"});
38 if ($tmp > $ts) {
39 if ($options{'-f'}) {
40 $n = $fname;
41 } else {
42 $n = $path;
43 }
44 $ts = $tmp;
45 }
46 }
47 }
48
49 if ($options{"-p"}) {
50 print "$n\n";
51 } elsif ($options{"-t"}) {
52 print "$ts\n";
53 } else {
54 print "$n\t$ts\n";
55 }
This page took 0.057221 seconds and 5 git commands to generate.