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

# usage: ncd101unikix [-4 | -5] shlscrpt-name [screen-position] 
: $Workfile:   xtermunikix.sh  $ $Revision:   1.0  $
# usage: ncd101unikix 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_Divide:	string("[OP") \n\
	<Key> KP_Multiply: 	string("[OQ") \n\
	<Key> KP_Subtract: 	string("Om") \n\
	<Key> KP_Add: 		string("Ok") \n\
	<Key> KP_Enter: 	string("OM") \n\
	<Key> SunF36:		string(0x1b) string("[23~")\n\
	<Key> SunF37:		string(0x1b) string("[24~")\n\
	Shift<Key> F1:		string("[25~")\n\
	Shift<Key> F2:		string("[26~")\n\
	Shift<Key> F3:		string("[28~")\n\
	Shift<Key> F4:		string("[29~")\n\
	Shift<Key> F5:		string("[30~")\n\
	Shift<Key> F6:		string("[31~")\n\
	Shift<Key> F7:		string("[32~")\n\
	Shift<Key> F8:		string("[33~")\n\
	Shift<Key> F9:		string("[34~")\n\
	Shift<Key> F10:		string("[35~")\n\
	Shift<Key> F11:		string("[36~")\n\
	Shift<Key> F12:		string("[37~")\n\
   	<Key> Insert:         	string(0x1b) string("[1~")\n\
   	<Key> Home:           	string(0x1b) string("[2~")\n\
   	<Key> Prior:          	string(0x1b) string("[3~")\n\
   	<Key> Delete:         	string(0x1b) string("[4~")\n\
   	<Key> End:            	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 ncd101.key &
exit $?
