:
:				'@(#) REPT:3.2 5/30/92 20:18:28'
#
# AIM Suite III v3.1.1
# (C) Copyright AIM Technology Inc. 1986,87,88,89,90,91,92.
# All Rights Reserved.
#
#  REPT 	report Suite III output	
# 

NNL=
CCL=
#
# first, figure out how to make echo work without automatic newline
#
if echo "\c" | grep c >/dev/null 2>&1
then
	NNL='-n'
else
	CCL='\c'
fi

if test ! -r toutput
then
    echo "No toutput file in current directory " >/dev/tty
    exit 1
fi
if test ! -r filter -o ! -r plot
then
	echo 'You must compile filter and plot first!' >/dev/tty
	echo 'Type: make report' >/dev/tty
	exit 1
fi
inter=0
if test $# -gt 0 -a "$1" = "-i"
then
    inter=1
    cat toutput | awk 'BEGIN {n=1 
    x[1] = "1"; x[2] = "2"; x[3] = "3"; x[4] = "4"; x[5] = "5"; x[6] ="6";
    x[7] = "7"; x[8] = "8"; x[9] = "9"; x[10] = "a"; x[11] = "b"; x[12] ="c";
    x[13] = "d"; x[14] = "e"; x[15] = "f"; x[16] = "g"; x[17] = "h"; x[18] ="i";
    x[19] = "j"; x[20] = "k"}
    /^:/ {printf "%s%s\n",x[n],$0 ;n++}' > /dev/tty
    echo >/dev/tty
    echo $NNL "Please choose labels of machines to evaluate: $CCL" > /dev/tty
    read numbers
fi
size=none
while test "$size" = "none"
do
	echo "Do you wish to see L)arge plots or S)mall plots?: " >/dev/tty
	echo >/dev/tty
	echo "       L) 118x59 size plot" >/dev/tty
	echo "       S) 75x20 size plot" >/dev/tty
	echo >/dev/tty
	echo $NNL "          ======> $CCL" >/dev/tty
	read size
done
wid=75
high=20
if test $size = l -o $size = L
then
	wid=118
	high=59
	if test $inter = "1"
	then
	    if test -z "$numbers" 
	    then
		mnumbs=`grep -c : toutput`
	    else
	        set $numbers
	    	mnumbs=$#
	    fi
	    high=`expr 59 - $mnumbs `
	else
	    mnumbs=`grep -c : toutput`
	    high=`expr 59 - $mnumbs `
	fi
fi
./filter $numbers
echo "                              Response time degradation "
./plot -h$high -w$wid -x2 %2.0f -y3 %4.1f -p1 %123456789abcdefghijk -e seconds tinput
echo "                             number of concurrent users -->"
echo $NNL "                             Press [RETURN] to continue...$CCL" >/dev/tty
read tmp
# echo "+"
if test $inter = "1" -a -n "$numbers"
then
cat toutput | awk 'BEGIN {n=1 
    x[1] = "1"; x[2] = "2"; x[3] = "3"; x[4] = "4"; x[5] = "5"; x[6] ="6";
    x[7] = "7"; x[8] = "8"; x[9] = "9"; x[10] = "a"; x[11] = "b"; x[12] ="c";
    x[13] = "d"; x[14] = "e"; x[15] = "f"; x[16] = "g"; x[17] = "h"; x[18] ="i";
    x[19] = "j"; x[20] = "k"}
    /:/ {printf "%s%s\n",x[n],$0 ;n++}' | grep "^[$numbers]:"
else
cat toutput | awk 'BEGIN {n=1 
    x[1] = "1"; x[2] = "2"; x[3] = "3"; x[4] = "4"; x[5] = "5"; x[6] ="6";
    x[7] = "7"; x[8] = "8"; x[9] = "9"; x[10] = "a"; x[11] = "b"; x[12] ="c";
    x[13] = "d"; x[14] = "e"; x[15] = "f"; x[16] = "g"; x[17] = "h"; x[18] ="i";
    x[19] = "j"; x[20] = "k"}
    /:/ {printf "%s%s\n",x[n],$0 ;n++}'
fi
echo ""
echo "                               User Throughput "
./plot -h$high -w$wid -x2 %2.0f -y5 %4.4f -p1 %123456789abcdefghijk -e job/sec/user tinput
echo "                             number of concurrent users --> "
echo $NNL "                             Press [RETURN] to continue...$CCL" >/dev/tty
read tmp
# echo "+"
if test $inter = "1" -a -n "$numbers"
then
cat toutput | awk 'BEGIN {n=1 
    x[1] = "1"; x[2] = "2"; x[3] = "3"; x[4] = "4"; x[5] = "5"; x[6] ="6";
    x[7] = "7"; x[8] = "8"; x[9] = "9"; x[10] = "a"; x[11] = "b"; x[12] ="c";
    x[13] = "d"; x[14] = "e"; x[15] = "f"; x[16] = "g"; x[17] = "h"; x[18] ="i";
    x[19] = "j"; x[20] = "k"}
    /:/ {printf "%s%s\n",x[n],$0 ;n++}' | grep "^[$numbers]:"
else
cat toutput | awk 'BEGIN {n=1 
    x[1] = "1"; x[2] = "2"; x[3] = "3"; x[4] = "4"; x[5] = "5"; x[6] ="6";
    x[7] = "7"; x[8] = "8"; x[9] = "9"; x[10] = "a"; x[11] = "b"; x[12] ="c";
    x[13] = "d"; x[14] = "e"; x[15] = "f"; x[16] = "g"; x[17] = "h"; x[18] ="i";
    x[19] = "j"; x[20] = "k"}
    /:/ {printf "%s%s\n",x[n],$0 ;n++}'
fi

#
# Cleanup after ourselves.  8/19/89 Tin
#
rm -f tinput
