I like separating colours for different systems, and on my last desktop I 
hardcoded it with cursesterm and xrdb... but I wanted a more generic way that 
could be adapted for new systems...

The other thing I miss from Client Access was resizing the screen, so I 
stumbled on a way of doing that as well... and then I got carried away and 
decided to add my own simple macros and...

To change a colour, go to the .tn5250rc file and for each host system specify 
the AS400 colour (Black, Red, Green, Pink, Turquoise, Yellow or Blue) and the 
xterm colour you want it changed to (the xterm understands many more colours 
such as lightblue or darkred, as well as hex codes (#rrggbb)). 

#I replace 'green' on test systems:
my_dev_system {
my_test_system {

#and I want the live system to look very different:
my_prod_system {

It doesn't matter if all the AS400 colours are mentioned, or if they are 

The shortcuts are a similar format, eg:
my_dev_system {
Shortcut1="dspmsg qsysopr"
Shortcut2="wrkactjob job(bnb*)"
Shortcuto="signoff endcnn(*yes)"

The character after 'Shortcut' will produce the stuff in quotes when pressed 
with Alt.. ie Alt-1 will produce dspmsg qsysopr followed by enter. As an 
example of what can be done (and shouldn't be :)
Alt-S will type qsysopr <fieldexit> password <enter> <enter> 
The \015 is a second <enter> which will clear the 'msgq already locked' 

The changes are:
xt5250 has a couple of seds which convert the tn5250rc statements into xrdb 
format and applies them just before the xterm is started, and xterm has a 
-class added so the xrdb takes effect. Replace the xterm statement in xt5250 

### v BB - Get xt5250 keymappings (with Shortcuts), then get colours

sed -n -e "/$XT5250_HOST/,/}/{            \
   /^.hortcut/ {                          \
  s//  Meta <Key>/; s/=/: string(/ ;      \
  s/$/) string(0x0d) \\\n\\\\/p}} "       \
.tn5250rc | cat /usr/local/share/tn5250/XTerm - | xrdb

sed -n -e "/$XT5250_HOST/,/}/{           \
  s/^.lack=/$XT5250_HOST*color0 : /p;     \
  s/^.ed=/$XT5250_HOST*color1 : /p;       \
  s/^.reen=/$XT5250_HOST*color2 : /p;     \
  s/^.ellow=/$XT5250_HOST*color3 : /p;    \
  s/^.lue=/$XT5250_HOST*color4 : /p;      \
  s/^.ink=/$XT5250_HOST*color5 : /p;      \
  s/^.urquoise=/$XT5250_HOST*color6 : /p; \
  s/^.hite=/$XT5250_HOST*color15 : /p}"   \
.tn5250rc | xrdb -merge

### Added -class statement to allow diff colours for diff hosts
exec xterm -class "$XT5250_HOST" -name "xt5250" \
   -bg black -fg white -T "xt5250 - $XT5250_HOST" \
  +sb -tn xterm-5250 -geometry 120x25 -e "$0" -BOOT "$@"
### ^ BB

To get the resizing, there's an amended XTerm. In it the font sizes are 
specified along with the keys:
Ctrl-Pageup and Ctrl-PageDn cycle through the sizes, and Ctrl 1-6 jump to the 
sizes. You can alter the sizes you want by changing the fonts in XTerm. 

Replace the /usr/local/share/tn5250/XTerm with this:
xt5250.VT100*underLine: True
xt5250.VT100*colorULMode: off
xt5250.VT100*font1: 6x13
xt5250.VT100*font2: 7x14
xt5250.VT100*font3: 8x13
xt5250.VT100*font4: 9x15
xt5250.VT100*font5: 10x20
xt5250.VT100*font6: 12x24

xt5250*VT100.Translations: #override\n\
        <Key>KP_Add: string("\030") \n\
        <Key>KP_Subtract: string("\033M") \n\
        <Key>KP_Multiply: string("*") \n\
        <Key>KP_Divide: string("/") \n\
        <Key>KP_0: string("0") \n\
        <Key>KP_1: string("1") \n\
        <Key>KP_2: string("2") \n\
        <Key>KP_3: string("3") \n\
        <Key>KP_4: string("4") \n\
        <Key>KP_5: string("5") \n\
        <Key>KP_6: string("6") \n\
        <Key>KP_7: string("7") \n\
        <Key>KP_8: string("8") \n\
        <Key>KP_9: string("9") \n\
        <Key>Scroll_Lock: string("\033H") \n\
        ~Shift<Key>Print: string("\020") \n\
        <Key>Control_L: string("\022") \n\
        <Key>Escape: string("\001") \n\
        Shift <Key>Print: string("\003") \n\
        ~Shift <Key>F1: string("\0331") \n\
        ~Shift <Key>F2: string("\0332") \n\
        ~Shift <Key>F3: string("\0333") \n\
        ~Shift <Key>F4: string("\0334") \n\
        ~Shift <Key>F5: string("\0335") \n\
        ~Shift <Key>F6: string("\0336") \n\
        ~Shift <Key>F7: string("\0337") \n\
        ~Shift <Key>F8: string("\0338") \n\
        ~Shift <Key>F9: string("\0339") \n\
        ~Shift <Key>F10: string("\0330") \n\
        ~Shift <Key>F11: string("\033-") \n\
        ~Shift <Key>F12: string("\033=") \n\
        Shift <Key>F1: string("\033!") \n\
        Shift <Key>F2: string("\033@") \n\
        Shift <Key>F3: string("\033#") \n\
        Shift <Key>F4: string("\033$") \n\
        Shift <Key>F5: string("\033%") \n\
        Shift <Key>F6: string("\033^") \n\
        Shift <Key>F7: string("\033&") \n\
        Shift <Key>F8: string("\033*") \n\
        Shift <Key>F9: string("\033(") \n\
        Shift <Key>F10: string("\033)") \n\
        Shift <Key>F11: string("\033_") \n\
        Shift <Key>F12: string("\033+") \n\
        Shift <Key>Tab: string("\033[Z") \n\
        Shift <Key>Left: string("\033\010") \n\
        Shift <Key>Right: string("\033\025") \n\
        Shift <Key>Home: string("\033\006") \n\
Ctrl <Key>Next:smaller-vt-font() \n\
Ctrl <Key>Prior:larger-vt-font() \n\
Ctrl <Key>1:set-vt-font(1) \n\
Ctrl <Key>2:set-vt-font(2) \n\
Ctrl <Key>3:set-vt-font(3) \n\
Ctrl <Key>4:set-vt-font(4) \n\
Ctrl <Key>5:set-vt-font(5) \n\
Ctrl <Key>6:set-vt-font(6) \n\
Ctrl <Key>7:set-vt-font(d) \n\

When you create the new XTerm, the last line should be the Ctrl <Key>7... ie 
no other lines after this so the shortcut keys can be appended.

And now, every new xt5250 will have the new stuff... All these are thoroughly 
untested, buggy and likely to cause havoc if you accidentally swap a ' with a 
` (this is unix after all) so be warned... Most of you however will be able 
to see at a glance what it does and how it could do it much better :)

The one change I can see is probably needed is xrdb -query >/tmp/xt5250$$ 
before the seds and then xrdb /tmp/xt5250$$ when it reruns itself in the new 
xterm so the original settings are restored, however it obviously needs to be 
cleverer than that...

Improvements welcome...


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.