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

: $Workfile:   dttermunikix.sh  $ $Revision:   1.0  $
# usage: dttermunikix [-4 | -5] shlscrpt-name [screen-position] 
# usage: dttermunikix shlscrpt-name screen-position 
# used to open a dtterm window on the desktop 

# params:  4	Model 4 window (43x80)
#	   5  	Model 5 window (27x132)
#          SHLSCRPT to execute on dtterm
#          SCRNPOS of dtterm
# examples: 
#
#           To get the default Model (24x80) enter the following command line
#
#  dttermunikix unikix
#
#           To get a Model 4 Window to be positioned at 100 from the left 
#           side of the desktop and 300 from the top of the desktop enter
#           the following on the command line
#
#  dttermunikix -4 unikix +100+300
#

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
dtterm +sb -geom $GMTRY$SCRNPOS  -title "3270 Session" -tn dtterm \
    -xrm '*DtTerm*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> F1:               string("[11~") \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> osfPageDown:	string("[6~")\n\
	<Key> osfPageUp:	string("[3~")\n\
   	<Key> osfInsert:        string(0x1b) string("[1~")\n\
   	<Key> Home:          string(0x1b) string("[2~")\n\
   	<Key> osfPrior:         string(0x1b) string("[3~")\n\
   	<Key> osfDelete:        string(0x1b) string("[4~")\n\
   	<Key> osfEndLine:           string(0x1b) string("[5~")\n\
   	<Key> osfNext:          string(0x1b) string("[6~")\n\
   	<Key> Linefeed:        	string(0x1b) string("[OT")\n\
   	Shift<Key> Tab:       	string(0x1b) string(0x09) ' \
        -e $SHLSCRPT -k dtterm.key &
exit $?
