Community Wiki

IngresCharacterBasedToolsAndFunctionKeys

From Ingres Community Wiki

Jump to: navigation, search

Contents

Ingres Character Based Tools And Function Keys

Ingres makes use of up to 3 variables for keyboard and screen mapping.

  • II_TERMCAP_FILE - Ingres format termcap file
  • INGRES_KEYS - allows custom mapping of application keys
  • TERM_INGRES - name of the terminal to use

For most users the important setting is TERM_INGRES (the others tend to be pre-set and do not need changing).

The Ingres FRS is the Forms Runtime System, it handles screen I/O for character based tools and is similar to (n)curses. FRS handles screen writing as well as event driven keyboard interaction.

Ingres tools like; isql, cbf, etc. use box drawing tools, if the terminal supports line drawing then the on screen boxes look like boxes. If the terminal does not support line drawing then box approximations are made using simple ASCII character like pipe '|', dash/hypen '-' and plus '+' for vertical, horizontal and corners.

Common Ingres Terminal Types

There are many kinds of terminals, this article only going to mention the popular ones that most users are likely to use/need.

The FRS is not smart enough to know what kind of terminal is being used and so must be told, this is what the variable TERM_INGRES is used for. TERM_INGRES can either be set installation wide via the SymbolTable or via operating system variables, e.g.:

Common Unix/Linux Ingres Terminal Types

  • vt100 -- plain vt100, with line drawing, no "function" keys
  • vt100f -- vt100, with line drawing, with "function" keys; PF1, PF2, PF3, PF4. PF1 is the Menu key, PF2 is Help
  • vt100nl -- plain vt100, no line drawing , no "function" keys
  • vt100fnl -- vt100, no line drawing, with "function" keys; PF1, PF2, PF3, PF4
  • linux - linux text (that is, X11 not loaded) console, with line drawing, with function keys; F1-F12, NOTE linux terminal was introduced into Ingres2006r2, it is possible to copy the termcap and file maps into Ingres 2.6. F1 is the Menu key, F2 is Help
  • konsole - linux GUI terminal (that is, X11 loaded), with line drawing, with function keys; F1-F12 (NOTE! Some desktops hijack F1 for desktop help)

If function keys are available, the first one (horizontally) scrolls through the menu. For example, with vt100f the PF1 key is the menu key. If function keys are NOT available, use the Escape key.

NOTE linux terminal setting does not ship with older versions like Ingres 2.6 but termcap from later Ingres release can be used with Ingres 2.6.

Setting Unix Terminal Type In Shell

Examples of different operating system variable settings:

TERM_INGRES=vt100
export TERM_INGRES

export TERM_INGRES=vt100

setenv TERM_INGRES vt100

Common Microsoft Windows Console CMD Ingres Terminal Types

  • ibmpcd - basic command window, also known as a DOS prompt. Supports function keys F1-F12 (TODO check numbers, XT versus AT may only be F10)

The first function key F1 (horizontally) scrolls through the menu.

Windows CMD prompt

set TERM_INGRES=vt100


Laptop users often do not have real/physical numeric keypads and so they often prefer a terminal that does NOT use PF function keys.




Now as a reminder the TERM_INGRES is related to physical terminals, so for ibmpcd this is an Intel PC with a PC104 keyboard (TODO check numbers; PC105, possibly earlier, etc). For vt100 this is a serial console with a text only display, try Google'ing for more information/pictures http://images.google.com/images?hl=en&q=vt100&um=1&ie=UTF-8&sa=N&tab=wi also see http://vt100.net/ and http://en.wikipedia.org/wiki/VT100 The vt100 had a limited number function keys, PF1-PF4 and where positioned above the numeric keypad on the right hand side of the keyboard

Most Unix users do not have a real vt100 any more (apart from the ones with beards), but vt100's still live on in various forms, mostly software. There are many vt100 emulators around; HPTerm, Konsole, Gterm, gnome-terminal, vte, xterm, etc.

In theory the venerable xterm attempts to emulate a vt100, in practice the keyboard handling is not completely accurate (namely PFx key emulation) you can use parameters to xterm to change this but it is not 100%.


Accessing Unix/Linux boxes remotely from Microsoft Windows

Getting ssh/telnet access to a remote Unix/Linux box from a Windows machine is accomplished with an ssh or telnet application. There is no built in ssh client for Windows, there is a built in telnet application for Windows telnet.exe (but is is very basic and not worth using). This article is not going to get into a discussion of ssh versus telnet other than the warning, "if you are still using telnet, make sure you know why you are still using it as it is an insecure protocol and consider using ssh instead".

So Windows users need an ssh/telnet application, there are many applications for Windows to do this, many of them are not free and are commercial. One of the best terminal emulators for Windows is free and is open source; Putty http://www.chiark.greenend.org.uk/~sgtatham/putty/. Putty has been in beta since 1999, do not be put off by its beta status, is widely used and very stable.

By default Putty emulates a vt100 VERY well, this means that for most Ingres users one can simply connect to the remote machine, set TERM_INGRES to vt100f and be up and running by using the numeric keypad on the right hand side for any options than come up in an Ingres application like CBF and use the keys above the numeric keypad as PF function keys. I.e. NumLock key for PF1, the '/' PF2, '*' PF3 and '-' as PF4.

Incidentally Putty is also available for Linux and so is a great vt100 emulator for connecting from Linux desktops to remote Unix servers.

If a Windows user would prefer not to use the PF function keys (above the numeric keypad) and instead use function keys F1-F12 then the TERM_INGRES setting of "linux" can be used HOWEVER Putty must be put into "Linux" mode (see screen shot).


Image:ScreenShotPuttyKeyboard.png

PLEASE NOTE that version 0.60 of Putty has a bug/feature where it is assumes the keyboard only has 10 function keys and not 12 (which all new keyboards have). A quick and dirty patch is available for this (see attachment) but this problem has not been acknowledged by the Putty team.

As a reminder the terminal settings here are simply some of the most common ones, there are many others, vt220 family, ansi, even custom written ones.

VT100 tip

If you get stuck in an FRS application with a bad terminal and TERM_INGRES is vt100.... you can use the hardware escape keys to get a menu prompt by typing Escape then O then P (i.e. Escape key, then capital O then capital P).

Putty Patch

Patch is based on the "main" svn version, svn://ixion.tartarus.org/main/putty

Index: window.c
===================================================================
--- window.c	(revision 7704)
+++ window.c	(working copy)
@@ -75,6 +75,29 @@
 #define WHEEL_DELTA 120
 #endif
 
+#define CLACH04_REAL_AT_KEYBOARD_LINUX_VC
+#ifdef CLACH04_REAL_AT_KEYBOARD_LINUX_VC
+    /* PC-AT keyboard (12 function keys) Linux Virtual console mapping */
+    #define CMC_LINUX_VC_SHIFT_F1 25
+    #define CMC_LINUX_VC_SHIFT_F2 26
+    #define CMC_LINUX_VC_SHIFT_F3 28
+    #define CMC_LINUX_VC_SHIFT_F4 29
+    #define CMC_LINUX_VC_SHIFT_F5 31
+    #define CMC_LINUX_VC_SHIFT_F6 32
+    #define CMC_LINUX_VC_SHIFT_F7 33
+    #define CMC_LINUX_VC_SHIFT_F8 34
+#else
+    /* PC-XT keyboard (10 function keys) Linux Virtual console mapping */
+    #define CMC_LINUX_VC_SHIFT_F1 23
+    #define CMC_LINUX_VC_SHIFT_F2 24
+    #define CMC_LINUX_VC_SHIFT_F3 25
+    #define CMC_LINUX_VC_SHIFT_F4 26
+    #define CMC_LINUX_VC_SHIFT_F5 28
+    #define CMC_LINUX_VC_SHIFT_F6 29
+    #define CMC_LINUX_VC_SHIFT_F7 31
+    #define CMC_LINUX_VC_SHIFT_F8 32
+#endif  /* CLACH04_REAL_AT_KEYBOARD_LINUX_VC */
+
 static Mouse_Button translate_button(Mouse_Button button);
 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
 static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
@@ -4021,28 +4044,28 @@
 	code = 0;
 	switch (wParam) {
 	  case VK_F1:
-	    code = (keystate[VK_SHIFT] & 0x80 ? 23 : 11);
+	    code = (keystate[VK_SHIFT] & 0x80 ? CMC_LINUX_VC_SHIFT_F1 : 11);
 	    break;
 	  case VK_F2:
-	    code = (keystate[VK_SHIFT] & 0x80 ? 24 : 12);
+	    code = (keystate[VK_SHIFT] & 0x80 ? CMC_LINUX_VC_SHIFT_F2 : 12);
 	    break;
 	  case VK_F3:
-	    code = (keystate[VK_SHIFT] & 0x80 ? 25 : 13);
+	    code = (keystate[VK_SHIFT] & 0x80 ? CMC_LINUX_VC_SHIFT_F3 : 13);
 	    break;
 	  case VK_F4:
-	    code = (keystate[VK_SHIFT] & 0x80 ? 26 : 14);
+	    code = (keystate[VK_SHIFT] & 0x80 ? CMC_LINUX_VC_SHIFT_F4 : 14);
 	    break;
 	  case VK_F5:
-	    code = (keystate[VK_SHIFT] & 0x80 ? 28 : 15);
+	    code = (keystate[VK_SHIFT] & 0x80 ? CMC_LINUX_VC_SHIFT_F5 : 15);
 	    break;
 	  case VK_F6:
-	    code = (keystate[VK_SHIFT] & 0x80 ? 29 : 17);
+	    code = (keystate[VK_SHIFT] & 0x80 ? CMC_LINUX_VC_SHIFT_F6 : 17);
 	    break;
 	  case VK_F7:
-	    code = (keystate[VK_SHIFT] & 0x80 ? 31 : 18);
+	    code = (keystate[VK_SHIFT] & 0x80 ? CMC_LINUX_VC_SHIFT_F7 : 18);
 	    break;
 	  case VK_F8:
-	    code = (keystate[VK_SHIFT] & 0x80 ? 32 : 19);
+	    code = (keystate[VK_SHIFT] & 0x80 ? CMC_LINUX_VC_SHIFT_F8 : 19);
 	    break;
 	  case VK_F9:
 	    code = (keystate[VK_SHIFT] & 0x80 ? 33 : 20);
Personal tools