Meta key support for SCO Xenix 2.x
Chip Salzenberg
chip at ateng.ateng.com
Sat Feb 25 06:08:44 AEST 1989
In lieu of a key table, here is a program that modifies any existing key
layout to use Alt as a meta key. If you prefer, you can then use
"mapkey -d" to generate a text version of the resulting layout.
BTW, this program must be setuid root (really!) because of SCO's security
restrictions on the keyboard mapping ioctl() call.
#! /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: metakeys.c
# Wrapped by chip at ateng on Fri Feb 24 15:07:01 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'metakeys.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'metakeys.c'\"
else
echo shar: Extracting \"'metakeys.c'\" \(780 characters\)
sed "s/^X//" >'metakeys.c' <<'END_OF_FILE'
X/*
X * metakeys.c
X * Version 1.0
X * Define Xenix keyboard so that Alt functions as an Emacs "meta" key.
X *
X * Written 24 Feb 1989 by Chip Salzenberg, A T Engineering.
X * E-Mail complaints and kudos to <chip at ateng.com> or <uunet!ateng!chip>.
X */
X
X#include <stdio.h>
X#include <sys/keyboard.h>
X
Xkeymap_t map;
X
Xmain()
X{
X int i, j;
X struct key_t *k;
X
X if (ioctl(0, GIO_KEYMAP, &map) == -1)
X {
X fprintf(stderr, "not a Xenix console\n");
X exit(1);
X }
X
X for (i = 0; i < NUM_KEYS; ++i)
X {
X k = &map.key[i];
X
X for (j = 0; j < ALT; ++j)
X {
X if (! (k->spcl & (0x80 >> j))
X && ! (k->spcl & (0x80 >> (j + ALT))) )
X k->map[j + ALT] = k->map[j] + 0x80;
X }
X }
X
X if (ioctl(0, PIO_KEYMAP, &map) == -1)
X {
X perror("SIO_KEYMAP");
X exit(1);
X }
X
X exit(0);
X}
END_OF_FILE
if test 780 -ne `wc -c <'metakeys.c'`; then
echo shar: \"'metakeys.c'\" unpacked with wrong size!
fi
# end of 'metakeys.c'
fi
echo shar: End of shell archive.
exit 0
--
Chip Salzenberg <chip at ateng.com> or <uunet!ateng!chip>
A T Engineering Me? Speak for my company? Surely you jest!
"It's no good. They're tapping the lines."
More information about the Comp.unix.xenix
mailing list