#	Extract a timestamp from a file or directory in the format
#	needed by touch.

#	Copyright (c) 1994 by Hamilton Laboratories.  All rights reserved.

proc timestmp( file )
	local j, t, month, year
	set t = `ls -L $file`:1-4:gs/:/ /
	@ month = 1
	foreach j (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
		if (j == t[0]) break
		@ month++
	end
	set year = $t[5]:s/19//
	return $printf("%02d%02d%02d%02d%02d%02d", ^
		month, t[1], t[2], t[3], t[4], year)
end

timestmp $argv
