DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

setkey(C)


setkey -- assign the function keys

Syntax

setkey keynum string

Description

The setkey command assigns the given ANSI string to be the output of the computer function key given by keynum. For example, the command:

setkey 1 date

assigns the string "date" as the output of function key 1. The string can contain control characters, such as a newline character, and should be quoted to protect it from processing by the shell. For example, the command:

setkey 2 "pwd ; lc\n"

assigns the command sequence "pwd ; lc" to function key 2. Notice how the newline character is embedded in the quoted string. This causes the commands to be carried out when function key 2 is pressed. Otherwise, the <Enter> key would have to be pressed after pressing the function key, as in the previous example.

setkey translates ``^'' into ``^^'', which, when passed to the screen driver, is interpreted as a right angle bracket (>), or greater than key.

Limitations

setkey works only on the console keyboard and on terminals running in scancode mode.

The function keys are defined in the string mapping table. This is an array of 512 bytes (typedef strmap_t) where null terminated strings can be put to redefine the function keys. The first null terminated string is assigned to the first string key, the second to the second string key, and so on. There is one string mapping table per multi-screen.

Although the size of the setkey string mapping table is 512 bytes, there is a limit of 30 characters that can be assigned to any individual function key.

Assigning more than 512 characters to the string mapping table causes the function key buffer to overflow. When this happens, the sequences sent by the arrow keys are overwritten, effectively disabling them. Once the function key buffer overflows, the only way to enable the arrow keys is to reboot the system.

The table below lists the keynum values for the function keys:

Function key keynum Function key keynum
<F1> 1 <Ctrl><F10> 34
<F2> 2 <Ctrl><F11> 35
<F3> 3 <Ctrl><F12> 36
<F4> 4 <Ctrl><Shift><F1> 37
<F5> 5 <Ctrl><Shift><F2> 38
<F6> 6 <Ctrl><Shift><F3> 39
<F7> 7 <Ctrl><Shift><F4> 40
<F8> 8 <Ctrl><Shift><F5> 41
<F9> 9 <Ctrl><Shift><F6> 42
<F10> 10 <Ctrl><Shift><F7> 43
<F11> 11 <Ctrl><Shift><F8> 44
<F12> 12 <Ctrl><Shift><F9> 45
<Shift><F1> 13 <Ctrl><Shift><F10> 46
<Shift><F2> 14 <Ctrl><Shift><F11> 47
<Shift><F3> 15 <Ctrl><Shift><F12> 48
<Shift><F4> 16 _ _ _
<Shift><F5> 17 Numeric key pad keynum
<Shift><F6> 18 _ _ _
<Shift><F7> 19 7 49
<Shift><F8> 20 8 50
<Shift><F9> 21 9 51
<Shift><F10> 22 - 52
<Shift><F11> 23 4 53
<Shift><F12> 24 5 54
<Ctrl><F1> 25 6 55
<Ctrl><F2> 26 + 56
<Ctrl><F3> 27 1 57
<Ctrl><F4> 28 2 58
<Ctrl><F5> 29 3 59
<Ctrl><F6> 30 0 60
<Ctrl><F7> 31
<Ctrl><F8> 32
<Ctrl><F9> 33

      Function key   keynum |      Function key      keynum
      F1             1      |      CtrlF10           34
      F2             2      |      CtrlF11           35
      F3             3      |      CtrlF12           36
      F4             4      |      CtrlShiftF1       37
      F5             5      |      CtrlShiftF2       38
      F6             6      |      CtrlShiftF3       39
      F7             7      |      CtrlShiftF4       40
      F8             8      |      CtrlShiftF5       41
      F9             9      |      CtrlShiftF6       42
      F10            10     |      CtrlShiftF7       43
      F11            11     |      CtrlShiftF8       44
      F12            12     |      CtrlShiftF9       45
      ShiftF1        13     |      CtrlShiftF10      46
      ShiftF2        14     |      CtrlShiftF11      47
      ShiftF3        15     |      CtrlShiftF12      48
      ShiftF4        16     +-------------------------------
      ShiftF5        17     |      Numeric key pad   keynum
      ShiftF6        18     +-------------------------------
      ShiftF7        19     |             7          49
      ShiftF8        20     |             8          50
      ShiftF9        21     |             9          51
      ShiftF10       22     |             -          52
      ShiftF11       23     |             4          53
      ShiftF12       24     |             5          54
      CtrlF1         25     |             6          55
      CtrlF2         26     |             +          56
      CtrlF3         27     |             1          57
      CtrlF4         28     |             2          58
      CtrlF5         29     |             3          59
      CtrlF6         30     |             0          60
      CtrlF7         31     |
      CtrlF8         32     |
      CtrlF9         33     |
For a table of the escape sequences, refer to keyboard(HW).

Files

/bin/setkey

See also

keyboard(HW), scancode(HW)

Standards conformance

setkey is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003