#!/bin/sh
# $Header: /tmp_mnt/net/quake/proj/wais/wais-8-b5/bin/RCS/server_stats,v 1.8 92/03/15 11:31:41 jonathan Exp $
# $Log:	server_stats,v $
# Revision 1.8  92/03/15  11:31:41  jonathan
# Added line for warnings.
# 
# Revision 1.7  92/03/11  08:38:30  jonathan
# Removed "error" from grep line.  Added RCS headers.
# 
#
# this is a simple script for generating statistics on the log

# the argument to this script is the name of the server log file.

if (test $# -eq 0)
then
	echo "usage: $0 <server-log-file>"
	echo "  Generates statistics on the use of the Server"
	exit 1
fi

# francois
#my_dir=`dirname $0`
my_dir=`echo $0 | sed 's,/[^/]*$,,'`

my_name=`basename $0`

if (test $my_dir -eq ""); then
  for dir in $PATH; do
    if [ -f $dir/$my_name ]; then
      my_dir=$dir
    fi
  done
fi

cat $* | $my_dir/trunc 80 | awk -f $my_dir/stats.awk

echo -n "Errors: "
grep ": -1:" $* | wc -l | awk '{ print $1 }'
echo -n "Warnings: "
grep ": -2:" $* | wc -l | awk '{ print $1 }'
