Added script cvs-date.tcl that determines last CVS change for YAZ by
[yaz-moved-to-github.git] / util / cvs-date.tcl
diff --git a/util/cvs-date.tcl b/util/cvs-date.tcl
new file mode 100755 (executable)
index 0000000..b1f9dd4
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+#  the next line restarts using tclsh \
+exec tclsh "$0" "$@"
+#
+# $Id: cvs-date.tcl,v 1.1 2001-05-16 07:37:39 adam Exp $
+set sec 0
+
+proc cvslog {} {
+       global sec
+
+       set f [open {|cvs log} r]
+       while {[gets $f line] >= 0} {
+               if {[regexp {^date: ([0-9]+)[ /]+([0-9]+)[ /]+([0-9]+)[ /]} $line dummy year month day]} {
+                       set this $year$month$day
+                       if {$this > $sec} {
+                               set sec $this
+                       }
+               }
+       }
+}
+
+cvslog 
+
+if {$sec} {
+       set fname [lindex $argv 0]
+       if {[string length $fname]} {
+               set f [open [lindex $argv 0] w]
+               puts $f  "#define YAZ_DATE \"$sec\""
+               close $f
+       } else {
+               puts $sec
+       }
+}