/*
 * $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
 *
 */
#ident	"$Header: _initprint 1.4 89/10/11 $@(#)bnu.admin:_initprint	2.3"
#	This internal program prints inittab entries in
#	user readable form

LINE="$*"

DIRECTION=`echo $LINE  |
	sed -n '/^[^:]\{1,\}:[^:]\{1,\}:/ {
			s///
			/^off:/s/.*/outgoing/p
			/^respawn:.*uugetty/s/.*/bidirectional/p
			/^respawn:.*getty/s/.*/incoming/p
			q
		}'`

set `echo $LINE  |
	sed '
		s/^[^ 	]*[ 	]//
		s/[ 	]*#.*//
		s/^.*\([ 	][^ 	]\{1,\}\).*\([ 	][^ 	]\{1,\}\)$/\1 \2/
	'`

PORT=$1
SPEED=$2
# if SPEED ends in H, eliminate the H
if [ 0 != `expr $SPEED : "[0-9]\{1,\}H"` ]
then
	SPEED=`expr $SPEED : "\(.*\)H"`
fi

if [ -n "$PORT" -a -n "$SPEED" -a -n "$DIRECTION" ]
then
	echo "
PORT:		$PORT
SPEED:		$SPEED
DIRECTION:	$DIRECTION
"

else
	echo "
**WARNING** Non-Standard I/O port line:
'$LINE'
"
fi
