[comp.unix.xenix] CRISP 1.9 key mapping support for Xenix

bob@dallnix.UUCP (Bob Best) (06/26/89)

The following set of files provide utilities to support CRISP 1.9
keyboard mapping of function and alt keys using Xenix 386 2.2+
------------------------
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  README keys.xenix strfix.c strmap.c
# Wrapped by bob@dallnix on Sun Jun 25 16:35:54 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(1148 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XSupport for CRISP 1.9 under Xenix 386 2.2+
X------------------------------------------
XI have made the following modifications to enable support of
Xfunction and alt keys using Xenix 386 2.2+:
X1)	strfix >strings
XThis command will create a strings file that can be used as input
Xto strmap.  The Xenix mapstr command will not grok non-ASCII characters,
Xspecifically, characters with the 8th bit set.
X2) strmap strings
XThis command will perform the string mapping for the invoking multiscreen.
XThe Xenix mapstr will fail as explained in (1) above.
X3) /usr/bin/mapkey keys.xenix
XThis command must be run as root.  It will create a keymapping that
Xwill be active in all multiscreens.  It should not cause problems with
Xexisting applications that use the default mapping.
XOnce these steps have been completed, /usr/local/bin/cr should properly
Xhandle all default function and alt key definitions.
X
XTo restore key and string mapping, execute:
X	mapkey /usr/lib/keyboard/keys   # as root
X	mapstr /usr/lib/keyboard/strings
X
XSince I don't use setkey, I am not sure what must be done to enable
Xand/or restore these settings.
X--------
XBob Best
Xbob@dhw68k.cts.com
END_OF_FILE
if test 1148 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'keys.xenix' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'keys.xenix'\"
else
echo shar: Extracting \"'keys.xenix'\" \(6668 characters\)
sed "s/^X//" >'keys.xenix' <<'END_OF_FILE'
X# SCO Mapkey File
X#
X# The descriptions in this file are provided for informational
X# purposes only, and are intended for the exclusive use of the
X# clients, customers, and licensees of The Santa Cruz Operation,
X# Inc.  The Santa Cruz Operation does not warrant the correctness
X# or suitability for any purpose of any information contained
X# herein.
X# 
X# Differences in keytop layout between various manufacturers
X# of keyboards may require that this file be modified.
X# -- scan codes 41 and 86 may differ
X#
X#                                                        alt
X# scan                      cntrl          alt    alt   cntrl  lock
X# code  base  shift  cntrl  shift   alt   shift  cntrl  shift  state
X     0  nop    nop    nop    nop    nop    nop    nop    nop     O
X     1  esc    esc    nop    nop    esc    esc    nop    nop     O
X     2  '1'    '!'    nop    nop    '1'    '!'    nop    nop     O
X     3  '2'    '@'    nul    nul    '2'    '@'    nul    nul     O
X     4  '3'    '#'    nop    nop    '3'    '#'    nop    nop     O
X     5  '4'    '$'    nop    nop    '4'    '$'    nop    nop     O
X     6  '5'    '%'    nop    nop    '5'    '%'    nop    nop     O
X     7  '6'    '^'    rs     rs     '6'    '^'    rs     rs      O
X     8  '7'    '&'    nop    nop    '7'    '&'    nop    nop     O
X     9  '8'    '*'    nop    nop    '8'    '*'    nop    nop     O
X    10  '9'    '('    nop    nop    '9'    '('    nop    nop     O
X    11  '0'    ')'    nop    nop    '0'    ')'    nop    nop     O
X    12  '-'    '_'    ns     ns     '-'    '_'    ns     ns      O
X    13  '='    '+'    nop    nop    '='    '+'    nop    nop     O
X    14  bs     bs     del    del    bs     bs     del    del     O
X    15  ht     btab   nop    nop    ht     btab   nop    nop     O
X    16  'q'    'Q'    dc1    dc1    fkey77 'Q'    dc1    dc1     C
X    17  'w'    'W'    etb    etb    fkey83 'W'    etb    etb     C
X    18  'e'    'E'    enq    enq    fkey65 'E'    enq    enq     C
X    19  'r'    'R'    dc2    dc2    fkey78 'R'    dc2    dc2     C
X    20  't'    'T'    dc4    dc4    fkey80 'T'    dc4    dc4     C
X    21  'y'    'Y'    em     em     fkey85 'Y'    em     em      C
X    22  'u'    'U'    nak    nak    fkey81 'U'    nak    nak     C
X    23  'i'    'I'    ht     ht     fkey69 'I'    ht     ht      C
X    24  'o'    'O'    si     si     fkey75 'O'    si     si      C
X    25  'p'    'P'    dle    dle    fkey76 'P'    dle    dle     C
X    26  '['    '{'    esc    esc    '['    '{'    esc    esc     O
X    27  ']'    '}'    gs     gs     ']'    '}'    gs     gs      O
X    28  cr     cr     nl     nl     cr     cr     nl     nl      O
X    29  ctrl   ctrl   ctrl   ctrl   ctrl   ctrl   ctrl   ctrl    O
X    30  'a'    'A'    soh    soh    fkey61 'A'    soh    soh     C
X    31  's'    'S'    dc3    dc3    fkey79 'S'    dc3    dc3     C
X    32  'd'    'D'    eot    eot    fkey64 'D'    eot    eot     C
X    33  'f'    'F'    ack    ack    fkey66 'F'    ack    ack     C
X    34  'g'    'G'    bel    bel    fkey67 'G'    bel    bel     C
X    35  'h'    'H'    bs     bs     fkey68 'H'    bs     bs      C
X    36  'j'    'J'    nl     nl     fkey70 'J'    nl     nl      C
X    37  'k'    'K'    vt     vt     fkey71 'K'    vt     vt      C
X    38  'l'    'L'    np     np     fkey72 'L'    np     np      C
X    39  ';'    ':'    nop    nop    ';'    ':'    nop    nop     O
X    40  '\''   '"'    nop    nop    '\''   '"'    nop    nop     O
X    41  '`'    '~'    nop    nop    '`'    '~'    nop    nop     O
X    42  lshift lshift lshift lshift lshift lshift lshift lshift  O
X    43  '\\'   '|'    fs     fs     '\\'   '|'    fs     fs      O
X    44  'z'    'Z'    sub    sub    fkey86 'Z'    sub    sub     C
X    45  'x'    'X'    can    can    fkey84 'X'    can    can     C
X    46  'c'    'C'    etx    etx    fkey63 'C'    etx    etx     C
X    47  'v'    'V'    syn    syn    fkey82 'V'    syn    syn     C
X    48  'b'    'B'    stx    stx    fkey62 'B'    stx    stx     C
X    49  'n'    'N'    so     so     fkey74 'N'    so     so      C
X    50  'm'    'M'    cr     cr     fkey73 'M'    cr     cr      C
X    51  ','    '<'    nop    nop    ','    '<'    nop    nop     O
X    52  '.'    '>'    nop    nop    '.'    '>'    nop    nop     O
X    53  '/'    '?'    nop    nop    '/'    '?'    nop    nop     O
X    54  rshift rshift rshift rshift rshift rshift rshift rshift  O
X    55  fkey81 '*'    nscr   nscr   '*'    '*'    nscr   nscr    O
X    56  alt    alt    alt    alt    alt    alt    alt    alt     O
X    57  ' '    ' '    ' '    ' '    ' '    ' '    ' '    ' '     O
X    58  clock  clock  clock  clock  clock  clock  clock  clock   O
X    59  fkey1  fkey13 fkey25 fkey37 scr1   scr11  scr1   scr11   O
X    60  fkey2  fkey14 fkey26 fkey38 scr2   scr12  scr2   scr12   O
X    61  fkey3  fkey15 fkey27 fkey39 scr3   scr13  scr3   scr13   O
X    62  fkey4  fkey16 fkey28 fkey40 scr4   scr14  scr4   scr14   O
X    63  fkey5  fkey17 fkey29 fkey41 scr5   scr15  scr5   scr15   O
X    64  fkey6  fkey18 fkey30 fkey42 scr6   scr16  scr6   scr16   O
X    65  fkey7  fkey19 fkey31 fkey43 scr7   scr7   scr7   scr7    O
X    66  fkey8  fkey20 fkey32 fkey44 scr8   scr8   scr8   scr8    O
X    67  fkey9  fkey21 fkey33 fkey45 scr9   scr9   scr9   scr9    O
X    68  fkey10 fkey22 fkey34 fkey46 scr10  scr10  scr10  scr10   O
X    69  nlock  nlock  dc3    dc3    nlock  nlock  dc3    dc3     O
X    70  slock  slock  del    del    slock  slock  del    del     O
X    71  fkey49 '7'    fkey87 '7'    '7'    '7'    '7'    '7'     N
X    72  fkey50 '8'    '8'    '8'    '8'    '8'    '8'    '8'     N
X    73  fkey51 '9'    fkey88 '9'    '9'    '9'    '9'    '9'     N
X    74  fkey52 '-'    '-'    '-'    '-'    '-'    '-'    '-'     N
X    75  fkey53 '4'    fkey89 '4'    '4'    '4'    '4'    '4'     N
X    76  fkey54 '5'    '5'    '5'    '5'    '5'    '5'    '5'     N
X    77  fkey55 '6'    fkey90 '6'    '6'    '6'    '6'    '6'     N
X    78  fkey56 '+'    '+'    '+'    '+'    '+'    '+'    '+'     N
X    79  fkey57 '1'    fkey91 '1'    '1'    '1'    '1'    '1'     N
X    80  fkey58 '2'    '2'    '2'    '2'    '2'    '2'    '2'     N
X    81  fkey59 '3'    fkey92 '3'    '3'    '3'    '3'    '3'     N
X    82  fkey60 '0'    '0'    '0'    '0'    '0'    '0'    '0'     N
X    83  del    '.'    del    del    del    del    del    del     N
X    84  nop    nop    nop    nop    nop    nop    nop    nop     O
X    85  nop    nop    nop    nop    nop    nop    nop    nop     O
X    86  nop    nop    nop    nop    nop    nop    nop    nop     O
X    87  fkey11 fkey23 fkey35 fkey47 scr11  scr11  scr11  scr11   O
X    88  fkey12 fkey24 fkey36 fkey48 scr12  scr12  scr12  scr12   O
END_OF_FILE
if test 6668 -ne `wc -c <'keys.xenix'`; then
    echo shar: \"'keys.xenix'\" unpacked with wrong size!
fi
# end of 'keys.xenix'
fi
if test -f 'strfix.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'strfix.c'\"
else
echo shar: Extracting \"'strfix.c'\" \(635 characters\)
sed "s/^X//" >'strfix.c' <<'END_OF_FILE'
Xmain()
X{
X	int i;
X	/* map 48 function keys */
X	for (i=0x80;i<=0xaf;i++) 
X		printf("%c\n",i);
X	printf("%c\n",0xd1);
X	printf("%c\n",0xd2);
X	printf("%c\n",0xd3);
X	printf("%c\n",0xd6);
X	printf("%c\n",0xce);
X	printf("%c\n",0xb5);
X	printf("%c\n",0xd0);
X	printf("%c\n",0xd5);
X	printf("%c\n",0xcb);
X	printf("%c\n",0xcc);
X	printf("%c\n",0xcd);
X	printf("%c\n",0xca);
X	/* Alt keys */
X	for (i=0xb0;i<=0xc9;i++) 
X		printf("%c\n",i);
X	printf("%c\n",0xdf); /*ctrl-home*/
X	printf("%c\n",0xe1);
X	printf("%c\n",0xdc);
X	printf("%c\n",0xde);
X	printf("%c\n",0xd9);
X	printf("%c\n",0xdb);
X	printf("%c\n",0xe6);
X	printf("\n");
X	printf("\n");
X	printf("\n");
X}
X
END_OF_FILE
if test 635 -ne `wc -c <'strfix.c'`; then
    echo shar: \"'strfix.c'\" unpacked with wrong size!
fi
# end of 'strfix.c'
fi
if test -f 'strmap.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'strmap.c'\"
else
echo shar: Extracting \"'strmap.c'\" \(1171 characters\)
sed "s/^X//" >'strmap.c' <<'END_OF_FILE'
X/* strmap.c - replacement for Xenix mapstr for use with CRISP 1.9
X * Usage: strmap strings_file
X * allows use of characters with 8th bit set in string mappings
X */
X# include	<stdio.h>
X# include	<ctype.h>
X# include	<sys/types.h>
X# include	<sys/keyboard.h>
X
X# define	FALSE	0
X# define	TRUE	1
X
Xstrmap_t	strmap;
Xchar	*fkeys[NSTRKEYS];
XFILE *fp;
X
Xread_strfile(buf)
Xchar *buf;
X{
X	char *cp=buf;
X	while(fgets(cp,(buf+sizeof strmap-cp),fp) != NULL) {
X		cp += strlen(cp);
X		*(cp-1)='\0';
X	}
X}
X		
Xmain(argc, argv)
Xchar **argv;
X{	
X	fp=fopen(argv[1],"r");
X	read_strfile(strmap);	
X	ioctl(0,PIO_STRMAP,strmap);
X	get_fkey(TRUE);
X	exit(0);
X}
X
Xget_fkey(flag)
X{
X	register char *cp;
X	int	fkey = 0;
X	
X	if (flag) {
X		if (ioctl(0, GIO_STRMAP, strmap) < 0) {
X			perror("GIO_STRMAP");
X			exit(1);
X			}
X		}
X	for (cp = (char *) strmap; fkey < NSTRKEYS; fkey++) {
X		fkeys[fkey] = cp;
X		printf("fkey%d = \"", fkey+1);
X		while (*cp) {
X			if (*cp == '\\') {
X				cp++;
X				printf("\\\\");
X				}
X			else if (*cp == '"') {
X				cp++;
X				printf("\\\"");
X				}
X			else if (*cp >= ' ' && *cp <= 0x7e)
X				putchar(*cp++);
X			else
X				printf("0x%x", (unsigned char) *cp++);
X			}
X		cp++;
X		printf("\"\n");
X		}
X}
END_OF_FILE
if test 1171 -ne `wc -c <'strmap.c'`; then
    echo shar: \"'strmap.c'\" unpacked with wrong size!
fi
# end of 'strmap.c'
fi
echo shar: End of shell archive.
exit 0
-- 
Bob Best
bob@dhw68k.cts.com