Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / atari / stand / tostools / aptck / setrev.awk
blobacfcc8c082cef182355faa42f44f2c6bb29ffd6b
1 #!/usr/bin/awk -f
3 # $NetBSD: setversion,v 1.1.1.1 1996/01/07 21:54:17 leo Exp $
5 function revcmp(r1, r2, n1, n2, a1, a2, n, i) {
6 n1 = split(r1, a1, "\.")
7 n2 = split(r2, a2, "\.")
8 n = (n1 < n2) ? n1 : n2
10 for (i = 1; i <= n; ++i) {
11 if (a1[i] != a2[i])
12 return(a1[i] - a2[i])
14 if (n1 != n2)
15 return(n1 - n2)
16 return(0)
19 BEGIN {
20 destfile = ARGV[1]
21 rev = "0.0"
25 if (revcmp($4, rev) > 0)
26 rev = $4
27 next file
30 END {
31 while ((e = getline <destfile) > 0) {
32 if (/"\$Revision.*\$"/)
33 sub("\\\$Revision.*\\\$", "Revision " rev)
34 print
36 if (e)
37 exit(1)
38 exit(0)