#!/bin/sh
#
#  Copyright(c) 1995 Sun Microsystems, Inc.
#  All rights reserved.

#ident  "@(#)testinfo  1.7  95/11/16  SMI"


# ------------------------------------------------------------
# testinfo list all the testname_info.o file in VTS vtsinfo.a. 
# Usage: testinfo [-l <testname>] [<vtsinfo_directory>]
# ------------------------------------------------------------

usage_error()
{
    echo Usage: $0 "[-l <testname>] [<vtsinfo_directory>]"
    exit
}

libdir=`pwd`
lib=vtsinfo
longlist=0
AR=/usr/ccs/bin/ar

getall() {
    if ( $AR t ${libdir}/${lib}.a > /dev/null 2>&1 )
    then
	if ( $AR t ${libdir}/${lib}.a | grep _info.o > /dev/null )
	then
	    echo found the following "<testname>_info.o" files in ${lib}.a.
	    $AR t ${libdir}/${lib}.a | grep _info.o
	else
	    echo "No <testname>_info.o files found in "${lib}".a."
	fi
    else
        echo "ar error! SunVTS "${lib}".a may not exist."
    fi
}

if [ $# -eq 0 ] ; then  getall ; exit ; fi

for i
do case $i in
    	  -l)	if [ $# = 1 ] ;  then usage_error ; fi 
		if [ $# = 2 ] ;  then tname=$2 ; fi
		if [ $# = 3 ] 
		then 
		    tname=$2 
		    if [ -d $3 ] 
		    then 
		 	libdir=$3 
		    else
			echo "Error: "$3" is not a directory!" 
			exit
		    fi
		fi	
		longlist=1 
		# getinfo $tname $libdir 
		echo "'testinfo "$i"' has not been implemented yet!"
		exit ;;

       	  -*)	echo 'unknown flag '$i''  
		usage_error ;;	
    esac
done

if [ $# -eq 1   -a   -d $1 ]
then 
   libdir=$1 ; getall
else
   usage_error 
fi

exit
