#! /usr/local/bin/python
# grabs version strings out of a source file.

import regex

# example: $Id: winvn.c 1.57 1994/11/09 23:02:03 rushing Exp $
version_reg = regex.compile('.*\$Id: \(.*\) Exp .*$')
	
def find_version (filename):
	fin = open(filename, 'r')
	vstr = ''
	while 1:
		line = fin.readline()
		if line == '':
			break
		if version_reg.match(line) != -1:
			vstr = version_reg.group(1)
			break
	fin.close()
	return vstr
