#
# turn major dev number into device name
#
devname()
{
	modinfo | nawk -v dev=$1 '{ if ( $4 == dev ) print $6}'
}

#
# get the line to add to MODFILE -- assume that the device is valid!
#
install_strmod()
{
	findcmd	/usr/sbin/autopush
	findcmd /usr/

	MODFILE=/etc/iu.ap
	AP=/tmp/autopush.$$

	DEV=$1

	message_start Checking STREAMS modules on ${DEV}: ""

	LL=`ls -Ll $DEV | tr ',' ' '`

	MAJ=`echo $LL | awk '{ print $5}' | cut -f1 -d,`
	MIN=`echo $LL | awk '{ print $6}'`

	#
	# open to the device - just to make sure that the
	# driver is modloaded for us
	#
	dd if=/dev/null of=$DEV >/dev/null 2>&1

	NAME=`devname $MAJ`

	LINE=`/bin/echo "\\t$NAME\\t$MIN\\t0\\tldterm ttcompat"`
	
	if autopush -g -M $MAJ -m $MIN > /dev/null 2>&1
	then
		message_part already configured
	else
		message_part running autopush
		echo "$LINE" > $AP
		echo "$LINE" >> $MODFILE
		autopush -f $AP
	fi

	message_done
}
