1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/usr/bin/awk -f
#
# $NetBSD: setversion,v 1.1.1.1 1996/01/07 21:54:17 leo Exp $
#
function revcmp(r1, r2, n1, n2, a1, a2, n, i) {
n1 = split(r1, a1, "\.")
n2 = split(r2, a2, "\.")
n = (n1 < n2) ? n1 : n2
for (i = 1; i <= n; ++i) {
if (a1[i] != a2[i])
return(a1[i] - a2[i])
}
if (n1 != n2)
return(n1 - n2)
return(0)
}
BEGIN {
destfile = ARGV[1]
rev = "0.0"
}
{
if (revcmp($4, rev) > 0)
rev = $4
next file
}
END {
while ((e = getline <destfile) > 0) {
if (/"\$Revision.*\$"/)
sub("\\\$Revision.*\\\$", "Revision " rev)
print
}
if (e)
exit(1)
exit(0)
}
|