Vmsterm VT220 Emulation for Linux


#!/bin/sh
#               vmsterm
#               from an original script by Bob Ess
#               key translations by Erik Ahlefeldt 
#
#               Script file using Xterm and telnet to connect to a VMS host
#               and give a decent vt220 emulation.
#
# Usage statement
Usage(){
        echo
        echo " Usage  : vmsterm -options"
        echo
        echo " Options: -80   for 80 column terminal"
        echo "          -132  for 132 column terminal"
        echo "          -bg colorname"
        echo "          -fg colorname"
        echo "          -fn fontname"
        echo "          -fb bold fontname"
        echo "          -host [crusher.saltmine.com] [earth] [192.168.7.7]" 
        echo ""
        echo " Example: \"vmsterm -80 -fg white -bg black -fn 9x15 -fb 9x15b -host earth\""
        echo "          Starts a VMS session with an 80 column terminal"
        echo "          with a black background, white foreground, a normal"
        echo "          font of 9x15 and a bold font of 9x15b, and connects"
        echo "          to the node 'earth'"
        echo ""
        echo " Example: \"vmsterm -host earth\""
        echo "          Starts a VMS session with default terminal settings "
        echo ""
        echo " Example: \"vmsterm -help\""
        echo "          Displays vmsterm options "
        echo
        exit 1
}

# Default to a black foreground with a white background.
# Use the 9x15 and 9x15bold fonts. Connect to 192.168.3.3 by default.
#
FG=black
BG=white
HOST=192.168.3.3
FONT=9x15
BFONT=9x15bold
COLS=80

# Parse the command line arguments
#
while [ $# != 0 ];
do
        case $1 in
                -80)    COLS=80
                        FONT=spc12x24c
                        BFONT=spc12x24b
                        shift
                        ;;
                -132)   COLS=132
                        FONT=9x15
                        BFONT=9x15b
                        shift
                        ;;
                -fg)    shift
                        FG=$1
                        shift;;
                -bg)    shift
                        BG=$1
                        shift;;
                -fn)    shift
                        FONT=$1
                        shift;;
                -fb)    shift
                        BFONT=$1
                        shift;;
                -host)  shift
                        HOST=$1
                        shift;;
                -help)  Usage;;
                *)      Usage;;
        esac
done

xterm	-title "VMSTERM" -sb -sl 1000 -geo ${COLS}x24 -fg ${FG} -bg ${BG} \
	-cr blue -fn ${FONT} -fb ${BFONT} -xrm \
	"XTerm*vt100.translations: #override \n \
	~Shift	F1:	string(0x1b)	string("OP") \n \
	~Shift	F2:	string(0x1b)	string("OQ") \n \
	~Shift	F3:	string(0x1b)	string("OR") \n \
	~Shift	F4:	string(0x1b)	string("OS") \n \
	~Shift	F5:	string("Break") \n \
	~Shift	F6:	string(0x1b)	string("[17~") \n \
	~Shift	F7:	string(0x1b)	string("[18~") \n \
	~Shift	F8:	string(0x1b)	string("[19~") \n \
	~Shift	F9:	string(0x1b)	string("[20~") \n \
	~Shift	F10:	string(0x1b)	string("[21~") \n \
	~Shift	F11:	string(0x1b)	string("[23~") \n \
	~Shift	F12:	string(0x1b)	string("[24~") \n \
	Shift   F1:	string(0x1b)	string("[23~") \n \
	Shift   F2:	string(0x1b)	string("[24~") \n \
	Shift   F3:	string(0x1b)	string("[25~") \n \
	Shift   F4:	string(0x1b)	string("[26~") \n \
	Shift   F5:	string(0x1b)	string("[28~") \n \
	Shift   F6:	string(0x1b)	string("[29~") \n \
	Shift   F7:	string(0x1b)	string("[31~") \n \
	Shift   F8:	string(0x1b)	string("[32~") \n \
	Shift   F9:	string(0x1b)	string("[33~") \n \
	Shift   F10:	string(0x1b)	string("[34~") \n \
	Shift   F11:	string(0x1b)	string("[28~") \n \
	Shift   F12:	string(0x1b)	string("[29~") \n \
		Print:	string(0x1b)	string("[28~") \n \
		Cancel:	string(0x1b)	string("[29~") \n \
		Pause:	string(0x1b)	string("Om") \n \
		Insert:	string(0x1b)	string("[2~") \n \
		Delete:	string(0x1b)	string("[3~") \n \
		Home:	string(0x1b)	string("[1~") \n \
		End:	string(0x1b)	string("[4~") \n \
		Prior:	string(0x1b)	string("[5~") \n \
		Next:	string(0x1b)	string("[6~") \n \
		BackSpace:	string(0x7f)	\n \
                Num_Lock:	string(0x1b)	string("OP") \n \
		KP_Divide:	string(0x1b)	string("OQ") \n \
		KP_Multiply: string(0x1b)	string("OR") \n \
		KP_Subtract: string(0x1b)	string("OS") \n \
		KP_Add:	string(0x1b)	string("Ol") \n \
		KP_Enter:	string(0x1b)	string("OM") \n \
		KP_Decimal: string(0x1b)	string("On") \n \
		KP_0:	string(0x1b)	string("Op") \n \
		KP_1:	string(0x1b)	string("Oq") \n \
		KP_2:	string(0x1b)	string("Or") \n \
		KP_3:	string(0x1b)	string("Os") \n \
		KP_4:	string(0x1b)	string("Ot") \n \
		KP_5:	string(0x1b)	string("Ou") \n \
		KP_6:	string(0x1b)	string("Ov") \n \
		KP_7:	string(0x1b)	string("Ow") \n \
		KP_8:	string(0x1b)	string("Ox") \n \
		KP_9:	string(0x1b)	string("Oy") \n \
	~Shift	Up:	string(0x1b)	string("[A") \n \
	Shift	Up:	scroll-back(1,lines) \n \
	~Shift	Down:	string(0x1b)	string("[B") \n \
	Shift	Down:	scroll-forw(1,lines) \n \
	      	Right:	string(0x1b)	string("[C") \n \
	      	Left:	string(0x1b)	string("[D")" \
        -e telnet $HOST 

        

 

 

Author : Erik Ahlefeldt ( erik.ahlefeldt@abri.une.edu.au )
Last revision : 17 May 2000