diff options
author | peter <peter@FreeBSD.org> | 1999-01-01 08:32:05 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-01-01 08:32:05 +0000 |
commit | 56b4a2fa96ef823c0127976937ca06734834be4d (patch) | |
tree | 2e2ebb5a12755a56d0f7467c343a4635c7d69d5c /usr.sbin/pcvt/kcon | |
parent | c93aa8139afbfc351323f822353fefee494a1278 (diff) | |
download | FreeBSD-src-56b4a2fa96ef823c0127976937ca06734834be4d.zip FreeBSD-src-56b4a2fa96ef823c0127976937ca06734834be4d.tar.gz |
Part 4 of pcvt/voxware revival: pcvt userland
Reviewed by: core
Diffstat (limited to 'usr.sbin/pcvt/kcon')
-rw-r--r-- | usr.sbin/pcvt/kcon/Makefile | 14 | ||||
-rw-r--r-- | usr.sbin/pcvt/kcon/kcon.1 | 122 | ||||
-rw-r--r-- | usr.sbin/pcvt/kcon/kcon.c | 753 |
3 files changed, 889 insertions, 0 deletions
diff --git a/usr.sbin/pcvt/kcon/Makefile b/usr.sbin/pcvt/kcon/Makefile new file mode 100644 index 0000000..77a9f26 --- /dev/null +++ b/usr.sbin/pcvt/kcon/Makefile @@ -0,0 +1,14 @@ +PROG= kcon +DEVICE= /dev/ttyv0 +CFLAGS+= -I${.CURDIR}/../keycap -DKEYB_DEVICE=\"${DEVICE}\" + +.if exists(${.OBJDIR}/../keycap) +LIBKEYCAP= ${.OBJDIR}/../keycap/libkeycap.a +.else +LIBKEYCAP= ${.CURDIR}/../keycap/libkeycap.a +.endif + +DPADD= ${LIBKEYCAP} +LDADD= ${LIBKEYCAP} + +.include <bsd.prog.mk> diff --git a/usr.sbin/pcvt/kcon/kcon.1 b/usr.sbin/pcvt/kcon/kcon.1 new file mode 100644 index 0000000..b430340 --- /dev/null +++ b/usr.sbin/pcvt/kcon/kcon.1 @@ -0,0 +1,122 @@ +.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis +.\" +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Hellmuth Michaelis +.\" 4. The name authors may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" @(#)kcon.1, 3.20, Last Edit-Date: [Wed Jan 25 16:34:56 1995] +.\" +.Dd January 25, 1995 +.Dt KCON 1 +.Sh NAME +.Nm kcon +.Nd keyboard control and remapping +.Sh SYNOPSIS +.Nm kcon +.Op Fl d Ar delay +.Op Fl l +.Op Fl m Ar map +.Op Fl o +.Op Fl p +.Op Fl R +.Op Fl r Ar rate +.Op Fl s +.Op Fl t Ns Ar +/- +.Op Fl x +.Sh DESCRIPTION +.Nm kcon +is used for controlling all aspects of keyboard configuration for the 'pcvt' +video driver. +.Pp +The available options are: +.Bl -tag -width flag +.It Fl d Ar delay +Specifies the delay after which the last key entered will be repeated by the +Keyboard. Valid values are 0..3 corresponding to delays of 250, 500, 750 and +1000 milliseconds. +.It Fl l +Displays the current keyboard map in use by the driver. +.It Fl m Ar map +Specifies the map entry to be searched in the keyboard capabilities database +.Nm keycap. +The database is searched for the entry and if found, the mapping +is loaded and is used in the driver from then on. +.It Fl o +Switches display of control codes to octal in the listing of the current map. +To be used in conjunction with the +.Fl l +option. +.It Fl p +Uses 'pure' output when listing - the Escape character is displayed in either +octal or hexadecimal and not as 'ESC'. To be used in conjunction with the +.Fl l +option. +.It Fl r Ar rate +Specifies the character repetition rate. Valid argument values are 0...31 +corresponding to rates of 30 characters/second ... 2 characters/second. +.It Fl R +Reset the Keyboard. +.It Fl s +Displays the current settings of the rate and delay values. +.It Fl t Ar +/- +Specify this option to enable ( +.Ar + +) or disable ( +.Ar - +) the repetition of keys. +.It Fl x +Switches display of control codes to hexadecimal in the listing of the current map. +To be used in conjunction with the +.Fl l +option. This is the default behaviour. +.Sh FILES +.Bl -tag -width /usr/share/misc/keycap.pcvt -compact +.It Pa /usr/share/misc/keycap.pcvt +Keyboard capabilities data base file if nothing else was chosen during installation. +.It Pa /dev/console +Keyboard raw device. +.Sh SEE ALSO +.Xr keycap 3 , +.Xr keycap 5 +.Sh BUGS +.Nm kcon +detects several inconsistencies in the keycap database. In case of errors +.Nm kcon +exits with an error message. If this happens, the keyboard may remain in +an undefined state. To recover from such situation, execute +.Nm kcon -m default +.Sh EXAMPLES +The command +.Dq Li kcon -m gb +loads the entry 'gb' from the keycap file into the keyboard to switch to +a british keyboard behaviour. + +The command +.Dq Li kcon -r 0 -d 0 +switches the keyboard to emit characters at a rate of 30 characters per second +after a key has been held down for 250 milliseconds. + + diff --git a/usr.sbin/pcvt/kcon/kcon.c b/usr.sbin/pcvt/kcon/kcon.c new file mode 100644 index 0000000..1f9cded --- /dev/null +++ b/usr.sbin/pcvt/kcon/kcon.c @@ -0,0 +1,753 @@ +/* + * Copyright (c) 1992,1993,1994 Hellmuth Michaelis + * + * Copyright (c) 1992,1993 Holger Veit. + * + * All rights reserved. + * + * This code is derived from software contributed to 386BSD by + * Holger Veit + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by + * Hellmuth Michaelis and Holger Veit + * 4. The name authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +static char *id = + "@(#)kcon.c, 3.20, Last Edit-Date: [Wed Jan 25 16:33:08 1995]"; + +/*---------------------------------------------------------------------------* + * + * kcon.c Keyboard control and remapping + * ---------------------------------------------- + * + * based on "keymap" which was written by + * Holger Veit (veit@du9ds3.uni-duisburg.de) + * + * -hm a first rewrite + * -hm rewrite for pcvt 2.0 distribution + * -hm adding show current typematic values + * -hm hex/octal/esc output choices + * -hm remapping debugging + * -hm garbage output for remapped keys bugfix + * -hm patch from Lon Willet, adding -R + * + *---------------------------------------------------------------------------*/ + +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/ioctl.h> +#include <machine/pcvt_ioctl.h> + +#include "keycap.h" + +int Rf = 0; +int df = 0; +int lf = 0; +int mf = 0; +int of = 0; +int pf = 0; +int rf = 0; +int tf = 0; +int xf = 0; +int sf = 0; + +/*---------------------------------------------------------------------------* + * main entry + *---------------------------------------------------------------------------*/ +main(argc, argv) +int argc; +char *argv[]; +{ + extern char *optarg; + extern int optind; + + int c = 0; + + int errf = 0; + + int rate = -1; + int delay = -1; + char *map; + int kbfd; + + while((c = getopt(argc, argv, "Rd:lm:opr:st:x")) != -1) + { + switch(c) + { + case 'R': + Rf = 1; + break; + + case 'd': + df = 1; + delay = atoi(optarg); + break; + + case 'l': + lf = 1; + break; + + case 'm': + mf = 1; + map = optarg; + break; + + case 'o': + if(xf) + errf = 1; + else + of = 1; + break; + + case 'p': + pf = 1; + break; + + case 'r': + rf = 1; + rate = atoi(optarg); + break; + + case 's': + sf = 1; + break; + + case 't': + if(*optarg == '+') + tf = 1; + else if(*optarg == '-') + tf = -1; + else + errf = 1; + break; + + case 'x': + if(of) + errf = 1; + else + xf = 1; + break; + + default: + usage(); + } + } + + if((Rf == 0 && df == 0 && lf == 0 && tf == 0 && sf == 0 && + rf == 0 && mf == 0 ) || errf) + { + usage(); + } + + if((kbfd = open(KEYB_DEVICE, 0)) < 0) + { + perror("kcon: keyboard open failiure"); + exit(1); + } + + if(sf) + { + showtypeamatic(kbfd); + exit(0); + } + + if(lf) + { + listcurrent(kbfd); + exit(0); + } + + if (Rf) + { + if (ioctl(kbfd, KBDRESET, 0) < 0) { + perror ("kcon: ioctl KBDRESET failed"); + exit (1); + } + } + + if(tf) + { + setrepeat(kbfd, tf); + } + + if(df || rf) + { + if(delay > 3) + { + fprintf(stderr,"Delay value (%d) out of range, possible values are 0..3!\n",delay); + exit(1); + } + if(rate > 31) + { + fprintf(stderr,"Rate value (%d) out of range, possible values are 0..31!\n",rate); + exit(1); + } + settypeam(kbfd, delay, rate); + } + + if(mf) + { + remapkeys(kbfd, map); + } + + close(kbfd); + exit(0); +} + +/*---------------------------------------------------------------------------* + * display usage info & exit + *---------------------------------------------------------------------------*/ +usage() +{ + fprintf(stderr, "\nkcon: keyboard control and remapping utility for pcvt video driver\n"); + fprintf(stderr, "usage: [-R] [-d delay] [-l] [-m map] [-o] [-p] [-r rate] [-t +/-] [-x]\n"); + fprintf(stderr, " -R full reset of keyboard\n"); + fprintf(stderr, " -d delay until a key is repeated (range: 0...3 => 250...1000ms)\n"); + fprintf(stderr, " -l produce listing of current keyboard mapping\n"); + fprintf(stderr, " -m set keyboard remapping from a keycap entry\n"); + fprintf(stderr, " -o set octal output for listing\n"); + fprintf(stderr, " -p pure, don't display escape as 'ESC' for listing\n"); + fprintf(stderr, " -r chars/second repeat value (range: 0...31 => 30...2 chars/sec)\n"); + fprintf(stderr, " -s show, display the current keyboard typematic values\n"); + fprintf(stderr, " -t switch repeat on(+) or off(-)\n"); + fprintf(stderr, " -x set hexadecimal output for listing\n\n"); + exit(1); +} + +/*---------------------------------------------------------------------------* + * convert control char in string to printable values + *---------------------------------------------------------------------------*/ +char *showcntrl(s) +u_char *s; +{ + static char res_str[80]; + static char conv_buf[80]; + int i; + + res_str[0] = '\0'; + + for(i = 0; s[i]; i++) + { + if(((s[i] > 0x20) && (s[i] <= 0x7e)) || ((s[i] >= 0xa0) && (s[i] <= 0xff))) + { + conv_buf[0] = s[i]; + conv_buf[1] = '\0'; + } + else if((s[i] == 0x1b) && (pf == 0)) + { + strcpy(conv_buf,"ESC "); + } + else if(of) + { + sprintf(conv_buf,"\\%03.3o ", s[i]); + } + else + { + sprintf(conv_buf,"0x%02.2X ", s[i]); + } + strcat(res_str, conv_buf); + } + return(res_str); +} + +/*---------------------------------------------------------------------------* + * list the current keyboard mapping + *---------------------------------------------------------------------------*/ +listcurrent(kbfd) +int kbfd; +{ + static char *keytypetab[] = { + "NONE ", + "SHIFT ", + "ALT/META ", + "NUMLOCK ", + "CONTROL ", + "CAPSLOCK ", + "ASCII ", + "SCROLL ", + "FUNCTION ", + "KEYPAD ", + "BREAK ", + "ALTGR ", + "SHIFTLOCK", + "CURSOR ", + "RETURN " + }; + + struct kbd_ovlkey keyboardmap[KBDMAXKEYS]; + struct kbd_ovlkey *kbmapp; + int keytype; + int altgr_defined; + int i; + + altgr_defined = 0; + kbmapp = keyboardmap; + + for (i = 0; i < KBDMAXKEYS; i++) + { + kbmapp->keynum = i; + + if(ioctl(kbfd, KBDGCKEY, kbmapp) < 0) + { + perror("kcon: ioctl KBDGCKEY failed"); + exit(1); + } + + if((kbmapp->type & KBD_MASK) == KBD_ALTGR) + altgr_defined = i; + + kbmapp++; + } + + if(altgr_defined) + { + printf("S Key KeyType Normal Shift Control Altgr \n"); + printf("- --- --------- --------------- --------------- --------------- ---------------\n"); + } + else + { + printf("S Key KeyType Normal Shift Control \n"); + printf("- --- --------- --------------- --------------- ---------------\n"); + } + + kbmapp = &keyboardmap[1]; + + for(i = 1; i < KBDMAXKEYS; i++) + { + keytype = kbmapp->type; + + if(keytype) + { + if(keytype & KBD_OVERLOAD) + printf("! %3.3d %9.9s ", i, keytypetab[keytype & KBD_MASK]); + else + printf("- %3.3d %9.9s ", i, keytypetab[keytype & KBD_MASK]); + + switch(keytype & KBD_MASK) + { + + case KBD_NUM: + case KBD_ASCII: + case KBD_FUNC: + case KBD_KP: + case KBD_CURSOR: + case KBD_RETURN: /* ??? */ + + if(kbmapp->subu == KBD_SUBT_STR) + printf("%-15s ",showcntrl(kbmapp->unshift)); + else + printf("Function() "); + + if(kbmapp->subs == KBD_SUBT_STR) + printf("%-15s ",showcntrl(kbmapp->shift)); + else + printf("Function() "); + + if(kbmapp->subc == KBD_SUBT_STR) + printf("%-15s ",showcntrl(kbmapp->ctrl)); + else + printf("Function() "); + + if(altgr_defined) + { + if(kbmapp->suba == KBD_SUBT_STR) + printf("%-15s ",showcntrl(kbmapp->altgr)); + else + printf("Function() "); + } + break; + } + putchar('\n'); + } + kbmapp++; + } +} + +/*---------------------------------------------------------------------------* + * show delay and rate values for keyboard + *---------------------------------------------------------------------------*/ +showtypeamatic(kbfd) +int kbfd; +{ + static char *delaytab[] = { + "250", + "500", + "750", + "1000" + }; + + static char *ratetab[] = { + "30.0", + "26.7", + "24.0", + "21.8", + "20.0", + "18.5", + "17.1", + "16.0", + "15.0", + "13.3", + "12.0", + "10.9", + "10.0", + "9.2", + "8.6", + "8.0", + "7.5", + "6.7", + "6.0", + "5.5", + "5.0", + "4.6", + "4.3", + "4.0", + "3.7", + "3.3", + "3.0", + "2.7", + "2.5", + "2.3", + "2.1", + "2.0" + }; + + int cur_typemat_val; + int delay, rate; + + if((ioctl(kbfd, KBDGTPMAT, &cur_typemat_val)) < 0) + { + perror("kcon: ioctl KBDGTPMAT failed"); + exit(1); + } + + delay = ((cur_typemat_val & 0x60) >> 5); + rate = cur_typemat_val & 0x1f; + + printf("\nDisplaying the current keyboard typematic values:\n\n"); + printf("The delay-until-repeat time is [ %s ] milliseconds\n",delaytab[delay]); + printf("The repeat-rate is [ %s ] characters per second\n\n",ratetab[rate]); +} + +/*---------------------------------------------------------------------------* + * set repeat feature on/off + *---------------------------------------------------------------------------*/ +setrepeat(kbfd, tf) +int kbfd; +int tf; +{ + int srepsw_val; + + if(tf == 1) + srepsw_val = KBD_REPEATON; + else + srepsw_val = KBD_REPEATOFF; + + if(ioctl(kbfd, KBDSREPSW, &srepsw_val) < 0) + { + perror("kcon: ioctl KBDREPSW failed"); + exit(1); + } +} + +/*---------------------------------------------------------------------------* + * set delay and rate values for keyboard + *---------------------------------------------------------------------------*/ +settypeam(kbfd, delay, rate) +int kbfd; +int delay; +int rate; +{ + int cur_typemat_val; + int new_typemat_val; + + if((ioctl(kbfd, KBDGTPMAT, &cur_typemat_val)) < 0) + { + perror("kcon: ioctl KBDGTPMAT failed"); + exit(1); + } + + if(delay == -1) + delay = (cur_typemat_val & 0x60); + else + delay = ((delay << 5) & 0x60); + + if(rate == -1) + rate = (cur_typemat_val & 0x1f); + else + rate &= 0x1f; + + new_typemat_val = delay | rate; + + if((ioctl(kbfd, KBDSTPMAT, &new_typemat_val)) < 0) + { + perror("kcon: ioctl KBDSTPMAT failed"); + exit(1); + } +} + +/*---------------------------------------------------------------------------* + * remap keyboard from keycap entry + *---------------------------------------------------------------------------*/ +remapkeys(kbfd, map) +int kbfd; +char *map; +{ + char cap_entry[1024]; + int ret; + char keyflag[128]; + int i; + + /* try to find the entry */ + + ret = kgetent(cap_entry, map); + + if(ret == -1) + { + fprintf(stderr, "kcon: keycap database not found or not accessible!\n"); + exit(1); + } + else if(ret == 0) + { + fprintf(stderr, "kcon: keycap entry [%s] not found in database!\n", map); + exit(1); + } + + /* set default mapping */ + + if((ioctl(kbfd, KBDDEFAULT)) < 0) + { + perror("kcon: ioctl KBDDEFAULT failed"); + exit(1); + } + + /* DE flag present? */ + + if(kgetflag("de")) + return; + + for(i = 0; i < KBDMAXKEYS; i++) + keyflag[i] = 0; + + set_lock(keyflag, kbfd); + + set_shift(keyflag, kbfd); + + set_char(keyflag, kbfd); +} + +/*---------------------------------------------------------------------------* + * care for lock keys + *---------------------------------------------------------------------------*/ +set_lock(keyflag, kbfd) +char keyflag[]; +int kbfd; +{ + int i, j; + char cap[16]; + struct kbd_ovlkey entry; + + struct { + char *ch; + u_short typ; + } lock[] = + { + "ca", KBD_CAPS, + "sh", KBD_SHFTLOCK, + "nl", KBD_NUMLOCK, + "sc", KBD_SCROLL + }; + + + for(i = 0; i < 4; i++) + { + int n; + + sprintf(cap, "%s", lock[i].ch); + + n = kgetnum(cap); + + if(n > 0) + { + if (keyflag[n]) + { + fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",n); + exit(1); + } + keyflag[n] = 1; + + entry.keynum = n; + entry.type = lock[i].typ; + + if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) + { + perror("kcon: ioctl KBDSCKEY failed"); + exit(1); + } + } + } +} + +/*---------------------------------------------------------------------------* + * care for shifting keys + *---------------------------------------------------------------------------*/ +set_shift(keyflag, kbfd) +char keyflag[]; +int kbfd; +{ + int i, j; + char cap[16]; + struct kbd_ovlkey entry; + + struct { + char ch; + u_short typ; + } shift[] = + { + 'm', KBD_META, + 'l', KBD_ALTGR, + 'h', KBD_SHIFT, + 't', KBD_CTL + }; + + for(i = 0; i < 4; i++) + { + for(j = 1; j < 10; j++) + { + int n; + + sprintf(cap, "%c%d", shift[i].ch,j); + + n = kgetnum(cap); + + if (n >= 0) + { + if (keyflag[n]) + { + fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",n); + exit(1); + } + keyflag[n] = 1; + + entry.keynum = n; + entry.type = shift[i].typ; + if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) + { + perror("kcon: ioctl KBDSCKEY failed"); + exit(1); + } + } + } + } +} + +/*---------------------------------------------------------------------------* + * care for normal keys + *---------------------------------------------------------------------------*/ +set_char(keyflag, kbfd) +char keyflag[]; +int kbfd; +{ + int i, j; + char cap[16]; + int setflag; + char *addr_str; + char *new_str; + struct kbd_ovlkey entry; + + struct { + char *addr; + char ch; + } standard[] = { + 0, 'D', + &entry.unshift[0], 'K', + &entry.shift[0], 'S', + &entry.ctrl[0], 'C', + &entry.altgr[0], 'A' + }; + + for(i = 1; i < KBDMAXKEYS; i++) + { + setflag = 0; + + entry.keynum = i; + + if((ioctl(kbfd, KBDGOKEY, &entry)) < 0) + { + perror("kcon: ioctl KBDGOKEY failed"); + exit(1); + } + + entry.type = KBD_ASCII; + + for(j = 0; j < 5; j++) + { + sprintf(cap, "%c%d", standard[j].ch,i); + + if((j == 0) && (kgetflag(cap))) + { + /* delete a key */ + + entry.type = KBD_NONE; + setflag = 1; + goto setit; + + } + else + { + addr_str = standard[j].addr; + if(new_str = kgetstr(cap, &addr_str)) + { + if(strlen(new_str) > KBDMAXOVLKEYSIZE) + { + fprintf(stderr, "kcon: database entry string [%s] longer than max [%d]!\n",new_str,KBDMAXOVLKEYSIZE); + exit(1); + } + setflag = 1; + } + } + } + +setit: if (setflag) + { + if (keyflag[i]) + { + fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",i); + exit(1); + } + keyflag[i] = 1; + + if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) + { + perror("kcon: ioctl KBDSCKEY failed"); + exit(1); + } + } + } +} + +/*------------------- EOF ------------------------------------------------*/ |