#!/sbin/sh

#############################################################################
# Product: Streams-TIO
# Fileset: STRTIO-KRN
# verify
# @(#)  $Revision: 1.3.98.1 $
#############################################################################
#
#  (c)  Copyright Hewlett-Packard Company 1993
#
#############################################################################

SUCCESS=0                       # SDU expected return codes
WARNING=2
FAILURE=1

UTILS=/usr/lbin/sw/control_utils
if [[ ! -f $UTILS ]]
then
    print "ERROR:   Cannot find the sh functions library $UTILS."
    exit $FAILURE
fi
. $UTILS

exitval=$SUCCESS                # Anticipate success

############################################# 
# make sure files were installed correctly. #
#############################################

FILE=/usr/conf/lib/libstrtio.a
if [ ! -f "$FILE" ] ; then
	print "ERROR:   The kernel library \"$FILE\""
	print "         is not installed correctly."
	exitval=$FAILURE
fi

for FILE in \
	/usr/include/strtio.h \
	/usr/include/sys/strtio.h \
	/usr/include/eucioctl.h \
	/usr/include/sys/eucioctl.h \
	/usr/conf/strtio/pty.h
do
	if [ ! -f "$FILE" ] ; then
		print "ERROR:   The include file \"$FILE\""
		print "         is not installed correctly."
		exitval=$FAILURE
	fi
done

############################################################################ 
# Make sure the STRTIO drivers/module were installed in the kernel.        #
############################################################################

TFILE=/tmp/strtio$$
KERN=/stand/vmunix
if [ -f "$KERN" ] ; then
	rm -rf $TFILE

	/usr/lbin/sysadm/get_sysfile $KERN > $TFILE

	RES=$?
	if [ $RES -eq 0 ] ; then
		if [ -z "`grep ptm $TFILE`" ] ; then
		    print "ERROR:   ptm is not configured into \"$KERN\"."
		    exitval=$FAILURE
		fi
		if [ -z "`grep pts $TFILE`" ] ; then
		    print "ERROR:   pts is not configured into \"$KERN\"."
		    exitval=$FAILURE
		fi
		if [ -z "`grep ldterm $TFILE`" ] ; then
		    print "ERROR:   ldterm is not configured into \"$KERN\"."
		    exitval=$FAILURE
		fi
		if [ -z "`grep ptem $TFILE`" ] ; then
		    print "ERROR:   ptem is not configured into \"$KERN\"."
		    exitval=$FAILURE
		fi
		if [ -z "`grep pckt $TFILE`" ] ; then
		    print "ERROR:   pckt is not configured into \"$KERN\"."
		    exitval=$FAILURE
		fi
		if [ -z "`grep nstrpty $TFILE`" ] ; then
		    print "ERROR:   nstrpty is not configured into \"$KERN\"."
		    exitval=$FAILURE
		fi
	else
	   print "ERROR:   Cannot read configuration information from \"$KERN\"."
	   exitval=$FAILURE
	fi
else
	print "ERROR:   Kernel not present at \"$KERN\".  Cannot read"
	print "         configuration information."
	exitval=$FAILURE
fi

rm -rf $TFILE
exit $exitval
