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

# usage: ncd101unikix shlscrpt-name [-4 | -5] [other unikixl options]
: $Workfile:   xtermunikix.sh  $ $Revision:   1.0  $
# used to open an xterm window 

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

# ensure that the first param is 'unikix', or issue usage message

if test "$1" != "unikix"
then
	echo "Usage: $0 unikix [-4|-5] [unikixl options]"
	exit 1
fi
GMTRY=80x25

if test `uname` = "SunOS"
then
  set -- `getopts 45 $* 2> /dev/null`
fi

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

export LINES COLUMNS
xterm +sb -geom $GMTRY  -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 $UNIKIXLPARM -k ncd101.key &
exit $?
