case $# in
0)
	FILE=/usr/spool/uucp/SYSLOG
	;;
1)
	FILE=$*
	;;
*)
	echo "usage: uustat [syslog]"
	;;
esac
awk ' \
	$5 ~ /received/ {ftotal++; fcount[$2]++; fbytes[$2] += $7; \
	fsecs[$2] += $9} \
	$5 ~ /sent/ {ttotal++; tcount[$2]++; tbytes[$2] += $7; \
	tsecs[$2] += $9} \
	{ curtime = substr($4, 5, 6); \
	dtmp = curtime - int($9) - lasttime[$2]; \
	if (dtmp > 0) if (dtmp < 20) \
		dead[$2] += dtmp; \
	lasttime[$2] = curtime; \
	live[$2] += $9 ; \
	} \
	END { if (ftotal) for (i in fbytes) { \
	printf "got from %8s %4d files %7d bytes %5d secs", i, \
	fcount[i], fbytes[i], fsecs[i]; \
	if (fsecs[i]) printf " %.2f bytes/sec", fbytes[i]/fsecs[i]; \
	printf "\n"; } \
	if (ttotal) for (i in tbytes) { \
	printf "sent to  %8s %4d files %7d bytes %5d secs", i, \
	tcount[i], tbytes[i], tsecs[i]; \
	if (tsecs[i]) printf " %.2f bytes/sec", tbytes[i]/tsecs[i]; \
	printf "\n"; } \
	for (i in live) { \
	printf "%8s live%5d secs  dead%5d secs\n", i, live[i], dead[i]; } \
	}' \
$FILE
