projects
/
openwrt
/
svn-archive
/
archive.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
add timestamp check script
[openwrt/svn-archive/archive.git]
/
openwrt
/
scripts
/
timestamp.pl
1
#!/usr/bin/perl
2
use
strict
;
3
4
sub
get_ts
($) {
5
my
$path
=
shift
;
6
my
$ts
=
0
;
7
open
FIND
,
"find
$path
-not -path
\\
*.svn
\\
* -and -not -path
\\
*CVS
\\
* |"
;
8
while
(<
FIND
>) {
9
open
FILE
,
"<
$_
"
;
10
my
@stat
=
stat
FILE
;
11
close
FILE
;
12
$ts
=
$stat
[
9
]
if
(
$stat
[
9
] >
$ts
);
13
}
14
close
FIND
;
15
return
$ts
;
16
}
17
18
(
@ARGV
>
0
)
or push
@ARGV
,
"."
;
19
my
$ts
=
0
;
20
my
$n
=
"."
;
21
my
%options
;
22
foreach
my
$path
(
@ARGV
) {
23
if
(
$path
=~
/^-/
) {
24
$options
{
$path
} =
1
;
25
}
else
{
26
my
$tmp
=
get_ts
(
$path
);
27
if
(
$tmp
>
$ts
) {
28
$n
=
$path
;
29
$ts
=
$tmp
;
30
}
31
}
32
}
33
34
if
(
$options
{
"-p"
}) {
35
print
"
$n
\n
"
;
36
}
elsif
(
$options
{
"-t"
}) {
37
print
"
$ts
\n
"
;
38
}
else
{
39
print
"
$n
\t
$ts
\n
"
;
40
}