: $Workfile:   kixsgu.sh  $ $Revision:   1.0  $
#**********************************************************************#
#*                                                                    *#
#* Copyright (c) 2001 by Sun Microsystems, Inc.                       *#
#* All rights reserved.                                               *#
#*                                                                    *#
#**********************************************************************#


# kixsgu
# call bms processor to	create an sgu file
# params: -y terminal name, -9 temporary output	name, -o sgu output name
#	  the input file is the	.bms file

ASMOPT=""

FOUTPUT=OFF

set -- `getopt so:y:9: $*`

# while	options	to process
while test "$1"	!= "--"
do
    case $1 in
    -y)
	shift
	TTYNAME=$1
	;;
    -9)
	shift
	FOUTNAME=$1
	FOUTPUT=YES
	;;
    -o)
	shift
	NEWFILE=$1
	;;
    -s)
	;;
    *)
	exit 1
	# illegal option encountered
	;;
    esac
    shift
done

trap "/bin/rm -f $FOUTNAME.1 $FOUTNAME.2 $FOUTNAME; exit 1" 0 1 2 3

echo "Processing $2, please wait..."

if test	$FOUTPUT = "YES"
then
    ####  kixbms output	 #### >$FOUTNAME
    /bin/rm -f $NEWFILE
    $UNIKIX/bin/kixbms -s -o $NEWFILE $ASMOPT $2 1>>$FOUTNAME.1 2>>$FOUTNAME.2
    cat	$FOUTNAME.1 >> $FOUTNAME
    cat	$FOUTNAME.2 >> $FOUTNAME
    /bin/rm -f $FOUTNAME.1
    /bin/rm -f $FOUTNAME.2
    vi $FOUTNAME <$TTYNAME >$TTYNAME
    /bin/rm -f $FOUTNAME
else
    /bin/rm -f $NEWFILE
    $UNIKIX/bin/kixbms -s -o $NEWFILE $2 1>/dev/null 2>/dev/null
fi
exit 0
