[comp.sources.misc] v06i058: Caps Lock and Num Lock for local multiscreens for SCO Xenix

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (03/08/89)

Posting-number: Volume 6, Issue 58
Submitted-by: jbayer@ispi.UUCP (Jonathan Bayer)
Archive-name: keylock.sco

I thought that I would post this since it is so short.  This program
makes the keyboard caps-lock and num-lock keys local to each multiscreen
or global to all the multiscreens.  It is more documentation than code.
It uses an undocumented ioctl() call to set the mode.

Enjoy.

JB
---
Jonathan Bayer			      Beware: The light at the end of the
Intelligent Software Products, Inc.	      tunnel may be an oncoming dragon
19 Virginia Ave.				...uunet!ispi!jbayer
Rockville Centre, NY 11570  (516) 766-2867    jbayer@ispi.UUCP



#! /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:  setlocklock.c
# Wrapped by root@ispi on Fri Feb 24 20:09:15 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'setlocklock.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'setlocklock.c'\"
else
echo shar: Extracting \"'setlocklock.c'\" \(1811 characters\)
sed "s/^X//" >'setlocklock.c' <<'END_OF_FILE'
X/* ******************************************************************** *
X *									*
X *	This short program sets the behaviour of the Caps-Lock and	*
X *	Num-Lock keys to either local or global mode. 			*
X *									*
X *	Calling sequence:						*
X *									*
X *		setlocklock [ -l ] [ -L ] [ -g ] [ -G ]			*
X *									*
X *	where:		-l and -L both will set local mode		*
X *			-g and -G both will set global mode		*
X *									*
X *	Bugs:	In Xenix 2.3.x,                                   	*
X *	      	The keyboard lights do not correctly show the mode	*
X *		when in local mode.  They are only updated when		*
X *		either the Num-Lock or Caps-LOCK or Scroll-Lock		*
X *		keys are depressed.  At that time all of the lights	*
X *		are updated correctly.	This is due to the way the 	*
X *		keyboard and console drivers are now seperated.  In	*
X *		Xenix 2.2.x, the keyboard and console drivers were	*
X *		more tightly interconnected and this problem doesn't	*
X *		exist.							*
X *									*
X *	Author:	Jonathan B. Bayer					*
X *		Intelligent Software Products, Inc.			*
X *		19 Virginia Ave.					*
X *		Rockville Centre, NY   11570				*
X *		(516) 766-2867						*
X *		jbayer@ispi.UUCP or ...uunet!ispi!jbayer		*
X *									*
X *	This program is hereby released to the public domain.  Do	*
X *	with it as you will.  I take no resonsibility for it's actions.	*
X *									*
X * ******************************************************************** */
X
X
X#include <stdio.h>
X#include <sys/keyboard.h>
X#include <sys/ioctl.h>
X
X
X#define		LOCAL	0
X#define		GLOBAL	1
Xmain(argc, argv)
Xchar	*argv[];
Xint	argc;
X{
Xint	mode = LOCAL, c;
X
X	while ( (c = getopt(argc, argv,"lLgG")) != EOF)
X		switch (c) {
X			case 'l':
X			case 'L':
X					mode = LOCAL; break;
X			case 'g':
X			case 'G':
X					mode = GLOBAL; break;
X		}
X	
X	ioctl(0,SETLOCKLOCK, mode);
X}
END_OF_FILE
if test 1811 -ne `wc -c <'setlocklock.c'`; then
    echo shar: \"'setlocklock.c'\" unpacked with wrong size!
fi
# end of 'setlocklock.c'
fi
echo shar: End of shell archive.
exit 0

-- 
Jonathan Bayer			      Beware: The light at the end of the
Intelligent Software Products, Inc.	      tunnel may be an oncoming dragon
19 Virginia Ave.				...uunet!ispi!jbayer
Rockville Centre, NY 11570  (516) 766-2867    jbayer@ispi.UUCP