#**********************************************************************#
#*                                                                    *#
#* Copyright (c) 2001 by Sun Microsystems, Inc.                       *#
#* All rights reserved.                                               *#
#*                                                                    *#
#**********************************************************************#

# usage: ncdvtunikix [-4 | -5 ] shlscrpt-name [screen-position]
: $Workfile:   ncdvtunikix.sh  $ $Revision:   1.0  $
# usage: ncdvtunikix shlscrpt-name screen-position 
# used to open an xterm window on the ncd

# params:  4    Model 4 window (43x80)
#          5    Model 5 window (27x132)
#          SHLSCRPT to execute on xterm
#          SCRNPOS of xterm

PARAM1=$1
PARAM2=$2
PARAM3=$3
GMTRY=80x25
set -- `getopt 45 $*`

#while options to process
while test  "$1" != "--"
do
    case $1 in
	-4)
            GMTRY=80x43
	    ;;
        -5)
	    GMTRY=132x27
	    ;;
    esac
    shift
done

if test "$GMTRY" != "80x25"
then
    SHLSCRPT=$PARAM2
    SCRNPOS=$PARAM3
else
    SHLSCRPT=$PARAM1
    SCRNPOS=$PARAM2
fi

xterm +sb -geom $GMTRY$SCRNPOS  -title "3270 Session" -tn xterms \
    -xrm 'XTerm*vt100*translations:	#override \
	<Key> KP_Subtract: 	string("Om") \n\
	<Key> KP_Separator:	string("Ol") \n\
	<Key> KP_Enter: 	string("OM") \n\
   	<Key> Find:         	string(0x1b) string("[1~")\n\
   	<Key> Insert:          	string(0x1b) string("[2~")\n\
   	<Key> DRemove:         	string(0x1b) string("[3~")\n\
   	<Key> Select:         	string(0x1b) string("[4~")\n\
   	<Key> Prior:           	string(0x1b) string("[5~")\n\
   	<Key> Next:           	string(0x1b) string("[6~")\n\
   	<Key> Linefeed:        	string(0x1b) string("[OT")\n\
   	Shift<Key> Tab:       	string(0x1b) string(0x09) ' \
        -e $SHLSCRPT -k ncdvt.key &
exit $?
