b1f9dd4343119073021c030e09bf9ccf68dce31a
[yaz-moved-to-github.git] / util / cvs-date.tcl
1 #!/bin/sh
2 #  the next line restarts using tclsh \
3 exec tclsh "$0" "$@"
4 #
5 # $Id: cvs-date.tcl,v 1.1 2001-05-16 07:37:39 adam Exp $
6 set sec 0
7
8 proc cvslog {} {
9         global sec
10
11         set f [open {|cvs log} r]
12         while {[gets $f line] >= 0} {
13                 if {[regexp {^date: ([0-9]+)[ /]+([0-9]+)[ /]+([0-9]+)[ /]} $line dummy year month day]} {
14                         set this $year$month$day
15                         if {$this > $sec} {
16                                 set sec $this
17                         }
18                 }
19         }
20 }
21
22 cvslog 
23
24 if {$sec} {
25         set fname [lindex $argv 0]
26         if {[string length $fname]} {
27                 set f [open [lindex $argv 0] w]
28                 puts $f  "#define YAZ_DATE \"$sec\""
29                 close $f
30         } else {
31                 puts $sec
32         }
33 }