#!/bin/rc
# name: ve
# usage: ve [file]
# coded by Kenji Arisawa
# source: http://plan9.aichi-u.ac.jp/netlib/
# last update: 2002/09/06
log=$home/venti/log
switch($#*){
case 0
	awk '{print $2,$3,$4}' $log
case 1
	if(! test -e $1){
		echo $1 not exist
		exit
	}
	d=`{date}
	# $d is: Sun Sep  1 17:43:14 JST 2002
	Jan=01;Feb=02;Mar=03;Apr=04;May=05;Jun=06;Jul=07;Aug=08;
	Sep=09;Oct=10;Nov=11;Dec=12
	day=$d(3)
	if(~ $#day 1)
		day=0^$day
	t=`{ifs=':' echo `{echo $d(4)}}
	t=$t(1)^':'^$t(2)
	d=$d(6)^/^$$d(2)^/^$day^' '^$t
	if(~ $1 /*)
		p=$1
	if not
		p=`{pwd}^/$1	# `^' is required
	p=`{cleanname $p}
	a=`{grep ' '^$p^'$' $log | tail -1}
	if(~ $#a 4)
		v=`{vac -h pc -qd <{echo vac:$a(1)} $p}
	if not
		v=`{vac -h pc $p}
	if(! ~ $v vac:*){
		echo '# vac error'
		exit 'vac error'
	}
	ifs=': ' v=`{echo -n $v} echo $v(2) $d $p >> $log
case *
	echo 'usage: ve [file]'
}


