allow to set multiple keyboard "variants" simultanously.
Follows PR kern/8456 by Michael Eriksson <eramore@era-t.ericsson.se>, implemented diffently.
This commit is contained in:
parent
bebf6897b4
commit
3bc4cec200
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: util.c,v 1.4 1998/12/30 19:15:11 augustss Exp $ */
|
||||
/* $NetBSD: util.c,v 1.5 1999/11/10 16:49:38 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -85,7 +85,11 @@ static struct nameint dpytype_tab[] = {
|
|||
};
|
||||
|
||||
static struct nameint kbdenc_tab[] = {
|
||||
KB_NAMETAB
|
||||
KB_ENCTAB
|
||||
};
|
||||
|
||||
static struct nameint kbdvar_tab[] = {
|
||||
KB_VARTAB
|
||||
};
|
||||
|
||||
static struct field *field_tab;
|
||||
|
@ -171,6 +175,8 @@ pr_field(f, sep)
|
|||
char *sep;
|
||||
{
|
||||
char *p;
|
||||
u_int flags;
|
||||
int i;
|
||||
|
||||
if (sep)
|
||||
printf("%s%s", f->name, sep);
|
||||
|
@ -199,10 +205,14 @@ pr_field(f, sep)
|
|||
kbdenc_tab, TABLEN(kbdenc_tab));
|
||||
printf("%s", p);
|
||||
|
||||
p = int2name(KB_VARIANT(*((u_int *) f->valp)), 0,
|
||||
kbdenc_tab, TABLEN(kbdenc_tab));
|
||||
if (p)
|
||||
flags = KB_VARIANT(*((u_int *) f->valp));
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (!(flags & (1 << i)))
|
||||
continue;
|
||||
p = int2name(flags & (1 << i), 1,
|
||||
kbdvar_tab, TABLEN(kbdvar_tab));
|
||||
printf(".%s", p);
|
||||
}
|
||||
break;
|
||||
case FMT_KBMAP:
|
||||
print_kmap((struct wskbd_map_data *) f->valp);
|
||||
|
@ -245,13 +255,17 @@ rd_field(f, val, merge)
|
|||
errx(1, "%s: not a valid encoding", val);
|
||||
*((u_int *) f->valp) = i;
|
||||
|
||||
if (p == NULL)
|
||||
break;
|
||||
|
||||
i = name2int(p, kbdenc_tab, TABLEN(kbdenc_tab));
|
||||
while (p) {
|
||||
val = p;
|
||||
p = strchr(p, '.');
|
||||
if (p != NULL)
|
||||
*p++ = '\0';
|
||||
i = name2int(val, kbdvar_tab, TABLEN(kbdvar_tab));
|
||||
if (i == -1)
|
||||
errx(1, "%s: not a valid variant", val);
|
||||
*((u_int *) f->valp) |= i;
|
||||
}
|
||||
printf("enc: %x\n", *((u_int *) f->valp));
|
||||
break;
|
||||
case FMT_KBMAP:
|
||||
if (! merge)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wsksymdef.h,v 1.25 1999/05/11 09:21:07 drochner Exp $ */
|
||||
/* $NetBSD: wsksymdef.h,v 1.26 1999/11/10 16:49:39 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -475,7 +475,7 @@
|
|||
#define KB_SWAPCTRLCAPS 0x0008 /* Swap Control-L and Caps-Lock */
|
||||
#define KB_DVORAK 0x0010 /* Dvorak layout */
|
||||
|
||||
#define KB_NAMETAB \
|
||||
#define KB_ENCTAB \
|
||||
{ KB_USER, "user" }, \
|
||||
{ KB_US, "us" }, \
|
||||
{ KB_DE, "de" }, \
|
||||
|
@ -484,7 +484,9 @@
|
|||
{ KB_FR, "fr" }, \
|
||||
{ KB_UK, "uk" }, \
|
||||
{ KB_JP, "jp" }, \
|
||||
{ KB_SV, "sv" }, \
|
||||
{ KB_SV, "sv" }
|
||||
|
||||
#define KB_VARTAB \
|
||||
{ KB_NODEAD, "nodead" }, \
|
||||
{ KB_DECLK, "declk" }, \
|
||||
{ KB_LK401, "lk401" }, \
|
||||
|
|
Loading…
Reference in New Issue