Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!tikal!hplsla!hpubvwa!ur-tut!akk2 From: akk2@ur-tut Newsgroups: comp.sys.ibm.pc Subject: Re: Observations on new Kermit 2.29C with partial Tektronix emulation Message-ID: <772@ur-tut> Date: 30 Dec 87 20:00:00 GMT References: <766@ucdavis> Lines: 299 Here is the relevant section from the Kermit docs on remapping keys. For those of you with ftp or BITNET access, the full docs can be obtained from Columbia Univ. They are approx 300K in size and there's no way I am going to post them here. (Neither should anyone else, actually). I am sorry, I will **NOT** mail them to anyone. --------------------------------------------------------------------------- SET KEY Syntax: SET KEY {[key-specifier [key-definition]], ON, OFF, CLEAR} WARNING: The format and functions of this command have changed substan- tially since version 2.29B and earlier. The changes were made in order to allow key redefinition to work on a wider variety of systems and keyboards without customization of the program source code for each configuration. See section 1.10 for further details. The SET KEY command is one of the most useful -- and confusing -- features of MS-Kermit. Typical uses: - You're used to having the ESC key in the upper left corner of the keyboard, but your new PC keyboard has an accent grave ("`") there. You can use SET KEY to make the accent key transmit an ESC, and you can assign accent grave to some other key. - You send a lot of electronic mail, and always sign it the same way. You can put your "signature" on a single key to save yourself a lot of repetitive typing. - You must set up your PC's function keys or numeric keypad to work properly with a host application. The SET KEY command does these things and more, and SHOW KEY gives us assis- tance. A key can be defined to: - send a single character other than what it would normally send, - send a string of multiple characters, - invoke a CONNECT-mode Kermit action verb, - send itself again. SET KEY specifies that when the designated key is struck during terminal emula- tion, the specified character or string is sent or the specified Kermit action verb is performed. Key definitions operate only during CONNECT, not at Kermit-MS> or DOS command level. The key-specifier is the identification of the key expressed in system-depend- ent terms. This can be a letter, such as Q for the key which emits an upper case Q, or the numeric ASCII value of the letter in backslash notation (e.g. "\81"), or else the numerical "scan code" observed by the system when the key is pressed (e.g. "\3856" for Ctrl-Alt-Q on an IBM PC). Material printed on keycaps is not necessarily a guide to what the key-specifier should be. When the word CLEAR is used in place of a key-specifier, all key definitions are cleared and then any built-in definitions are restored. A string definition is one or more characters, including 8-bit values expressed in backslash form, such as SET KEY \315 top \13 list\13 IBM F1 key sends "top list" SET KEY S L S key sends upper case L SET KEY T \27[m T key sends three bytes ESC [ m The string begins with the first non-spacing character following the key iden- tification and continues until the end of line, exclusive of any trailing spaces. If a semicolon comment is used and the definition is given in a TAKE file, the line ends at the last non-spacing character before the semicolon. Curly braces, {...}, can be use to delimit the string in case you want the definition to include trailing spaces. All text after the closing bracket is ignored. SET KEY \315 {login } this extra text is ignored This manual does not contain a list of all the scan codes for all the keys on all the keyboards on all the PCs supported by MS-Kermit -- that would be a manual in itself. Rather, in order to obtain the key-specifier for the SET KEY command, you must type a SHOW KEY command and press the desired key or key com- bination. This will report a scan code that you can use as the key specifier in a SET KEY command. To do this for many keys is a laborious process, so you should collect all your SET KEY commands into a file, which you can TAKE, or put them in your MSKERMIT.INI file. If you enter SET KEY by itself, with no key specifier, the command will prompt you to press the selected key and again for the definition string. Certain characters, like ESC and CR, may not be entered literally into the string, but can be included by inserting escape codes of the form \nnn, a backslash fol- lowed by a 1- to 4-digit number corresponding to the ASCII value of the desired character. Where an ASCII digit follows directly after a backslash number, confusion can be avoided by placing curly braces {} around the backslashed num- ber; thus, \{27}5 represents the two ASCII characters ESC 5. Here is an example of the use of SET KEY to assign ESC (ASCII 27) to the accent grave key. First the user gets the key-specifier for the key: Kermit-MS>show key Push key to be shown (? shows all): ` ASCII char: ` \96 decimal is defined as Self, no translation. Free space: 145 keys and 96 string definitions, 894 string characters. The free space report says that 145 more keys may be redefined, and up to 96 of them may have multi-character strings assigned to them (as opposed to single characters), and that there are 984 bytes left for these strings, in total. Confident that there is enough space left for a new key definition, the user proceeds: Kermit-MS>set key Push key to be defined: ` Enter new definition: \27 Once a key definition is constructed and tested, it may be entered on a single line in a command file (such as MSKERMIT.INI): set key \96 \27 To prevent accidents, SET KEY shows the current definition before asking for a new one; enter a Control-C to keep the current definition, or a carriage return to undefine the key, or a query mark (?) to see available choices. A more exact definition of SET KEY follows these construction rules: SET KEY [] where is: - a single ordinary printable ASCII character, or - the numerical equivalent of an ASCII character (ESC is \27), or - a scan code written as a backslashed number (e.g. \3856 for Ctrl-Alt-Q), or - keyword SCAN followed by a backslashed scan code number (obsolete), or - keyword CLEAR which removes all current key definitions and then restores any built-in definitions. - ? (a question mark), which displays a help message. Scan codes, non-printing ASCII characters, 8-bit characters, and other bi- nary codes are written in backslash form (see Table 1-1 for ASCII codes): \123 a decimal number (decimal is the default number base) \d789 a decimal number (also \D) \o177 an octal number (also \O) \x0d a hexadecimal number (also \X) \{b###} braces around material following the slash, where the numerical base letter b is d, o, x, or absent. is one or more spaces and or tabs. is: missing altogether which "undefines" a key. \number (a number in backslash notation between 0 and 255 decimal) - assigns a character with the corresponding 8-bit value. \Kverb for a Kermit action verb; upper or lower case K is OK. \{Kverb} Same. Verb is the name of an action verb. text a string with allowed embedded whitespace and embedded bi- nary chars as above. This kind of string may not commence with sequences \K or \{K. The string begins with the first non-whitespace character and ends at the end of the line (exclusive of trailing spaces and comments). {text} string confined to material within but excluding the braces. Note, where the number of opening braces exceeds the number of closing braces the end of line terminates the string: {ab{}{{c}d ==> ab{}{{c}d but {ab}{{c}d ==> ab ? Displays help message and lists all action verbs. Control-C Quits the Set Key command without making changes. Curly braces can be used to separate backslash numbers from regular ASCII text, such as when we want to send the two bytes ESC 8 (ESC is decimal 27): SET KEY T \{27}8 T key sends ESC 8 SET KEY L {words \{27}8 more words} trailing junk to be ignored If a string begins with a left curly brace then Kermit counts them and ends the string on the matching right curly brace (or end of line); the SET KEY L ex- ample above relies on brace matching to omit the trailing comment. The outer curly brace delimiters are not sent but the inner ones are; for example: SET KEY U {a {b}\{27}8} sends the 7 bytes "a {b}ESC8" SET KEY U a{ {b}\{27}8} sends the 9 bytes "a{ {b}ESC8}" SET KEY U a{ {b}\{{27}}8} sends the 15 bytes "a{ {b}\{{27}}8}" A definition is removed, that is a key is defined as itself, by giving an empty definition: SET KEY q q key sends q again SET KEY \331 IBM left arrow key is undefined. The keyboard can be restored to its startup state, that is all redefinitions removed and all built-in defitions restored, by using the keyword CLEAR in place of the key identification: SET KEY CLEAR Undefined keys which do not send ASCII characters are trapped by the keyboard translator and are rejected; a beep results from using an undefined non-ASCII key. SET KEY OFF disables the key definition mechanism entirely, but leaves the cur- rent definitions in place. SET KEY OFF also directs MS-Kermit to read keycodes from DOS, rather than BIOS, so that console drivers like ANSI.SYS that operate at the DOS level, may be used during Kermit CONNECT sessions. This would also apply to any special keyboards that come with DOS-level drivers. SET KEY ON turns key definition back on, and returns Kermit to processing keystrokes at the BIOS level. Kermit Action Verbs: An action verb is the shorthand expression for a named Kermit procedure, such as "generate the proper sequence for a left arrow," "show status," "send a BREAK," and others; verbs are complex actions and each verb has a name. In a key definition the verb name is preceeded by backslash K (\K) to avoid being confused with a string. Verbs and strings cannot be used together on a key. SET KEY \331 \Klfarr SET KEY \2349 \Kexit makes the IBM keyboard left arrow key execute the verb named lfarr which sends the proper escape sequence for a VT102 left arrow key (which changes depending on the internal state of the VT102). The leading \K identifies the definition as a Kermit verb, so no string can start as \K or as \{K in upper or lower case (use \92K). The second example has Alt-X invoking the Leave-Connect-Mode verb "exit" (same as Kermit escape character "^]" followed by C). Each system has its own list of verbs and predefined keys. Table 1-3 shows those available for the IBM PC family (there are also some additional verbs for reassigning Heath or VT100 function keys, see section 1.15.1). The SET KEY command shows the list of available verbs when a query mark (?) is given as a definition. SHOW KEY displays all currently defined keys or individually selected ones; SHOW KEY can be executed only interactively. ------------------------------------------------------------------------------- Verb Meaning \Kupscn Roll up (back) to previous screen \Kdnscn Roll down (forward) to next screen \Khomscn Roll up to top of screen memory \Kendscn Roll down to end of screen memory (current position) \Kupone Roll screen up one line \Kdnone Roll screen down one line \Kprtscn Print the current screen \Kdump Append the current screen to dump file \Klogoff Turn off session logging \Klogon Turn on session logging \Ktermtype Toggle terminal type \Kreset Reset terminal emulator to initial state \Kmodeline Toggle modeline off/on \Kbreak Send a BREAK signal \Klbreak Send a "long BREAK" signal \Khangup Drop DTR so modem will hang up phone \Knull Send a null (ASCII 0) \Kdos "Push" to DOS \Khelp Display CONNECT help message \Kstatus Display STATUS message \Kexit Escape back from CONNECT mode \Kgold,\Kpf1 VT102 keypad function key PF1 \Kpf2..\Kpf4 VT102 keypad function keys \Kp0..\Kp9 VT102 keypad numeric keys \Kdot,\Kminus,\Kcoma,\Kenter Other VT102 keypad keys \Kuparr,\Kdnarr,\Klfarr,\Krtarr VT102 cursor (arrow) keys Table 1-3: Kermit-MS Verbs for the IBM PC Family ------------------------------------------------------------------------------- Some systems have preset key definitions when Kermit first begins (those for the IBM PC are shown in section 1.15.1). You can find out what they are on your system by typing SHOW KEY, and then question mark on the next line. You may supplement or change the predefined keys with SET KEY commands typed inter- actively or in MSKERMIT.INI or other command files. The MS-Kermit CONNECT command may be used in conjunction with certain console drivers that do their own key redefinitions. Since MS-Kermit intercepts keystrokes at the BIOS level, drivers like ANSI.SYS which work at the DOS level will have no effect during CONNECT, even though they work at MS-Kermit command level. Other drivers, like SuperKey and ProKey, work at the BIOS level, and their key assignments will remain effective during Kermit terminal sessions, and additional Kermit SET KEY assignments may be made "on top" of them. -- ------------------------------------------------------------------------------- Atul Kacker | Internet: akk2@tut.cc.rochester.edu | UUCP: {ames,cmcl2,decvax,rutgers}!rochester!ur-tut!akk2 -------------------------------------------------------------------------------