summaryrefslogtreecommitdiff
path: root/sbin/wsconsctl/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/wsconsctl/keyboard.c')
-rw-r--r--sbin/wsconsctl/keyboard.c92
1 files changed, 53 insertions, 39 deletions
diff --git a/sbin/wsconsctl/keyboard.c b/sbin/wsconsctl/keyboard.c
index a1b5f2d0762..2dc44e0bf7c 100644
--- a/sbin/wsconsctl/keyboard.c
+++ b/sbin/wsconsctl/keyboard.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keyboard.c,v 1.2 2001/06/30 02:12:57 mickey Exp $ */
+/* $OpenBSD: keyboard.c,v 1.3 2001/10/24 17:45:59 miod Exp $ */
/* $NetBSD: keyboard.c 1.1 1998/12/28 14:01:17 hannken Exp $ */
/*-
@@ -80,7 +80,7 @@ keyboard_get_values(pre, fd)
{
if (field_by_value(keyboard_field_tab, &kbtype)->flags & FLG_GET)
if (ioctl(fd, WSKBDIO_GTYPE, &kbtype) < 0)
- err(1, "WSKBDIO_GTYPE");
+ warn("WSKBDIO_GTYPE");
bell.which = 0;
if (field_by_value(keyboard_field_tab, &bell.pitch)->flags & FLG_GET)
@@ -90,7 +90,7 @@ keyboard_get_values(pre, fd)
if (field_by_value(keyboard_field_tab, &bell.volume)->flags & FLG_GET)
bell.which |= WSKBD_BELL_DOVOLUME;
if (bell.which != 0 && ioctl(fd, WSKBDIO_GETBELL, &bell) < 0)
- err(1, "WSKBDIO_GETBELL");
+ warn("WSKBDIO_GETBELL");
dfbell.which = 0;
if (field_by_value(keyboard_field_tab, &dfbell.pitch)->flags & FLG_GET)
@@ -101,12 +101,12 @@ keyboard_get_values(pre, fd)
dfbell.which |= WSKBD_BELL_DOVOLUME;
if (dfbell.which != 0 &&
ioctl(fd, WSKBDIO_GETDEFAULTBELL, &dfbell) < 0)
- err(1, "WSKBDIO_GETDEFAULTBELL");
+ warn("WSKBDIO_GETDEFAULTBELL");
if (field_by_value(keyboard_field_tab, &kbmap)->flags & FLG_GET) {
kbmap.maplen = KS_NUMKEYCODES;
if (ioctl(fd, WSKBDIO_GETMAP, &kbmap) < 0)
- err(1, "WSKBDIO_GETMAP");
+ warn("WSKBDIO_GETMAP");
}
repeat.which = 0;
@@ -116,7 +116,7 @@ keyboard_get_values(pre, fd)
repeat.which |= WSKBD_KEYREPEAT_DODELN;
if (repeat.which != 0 &&
ioctl(fd, WSKBDIO_GETKEYREPEAT, &repeat) < 0)
- err(1, "WSKBDIO_GETKEYREPEAT");
+ warn("WSKBDIO_GETKEYREPEAT");
dfrepeat.which = 0;
if (field_by_value(keyboard_field_tab, &dfrepeat.del1)->flags & FLG_GET)
@@ -125,15 +125,15 @@ keyboard_get_values(pre, fd)
dfrepeat.which |= WSKBD_KEYREPEAT_DODELN;
if (dfrepeat.which != 0 &&
ioctl(fd, WSKBDIO_GETKEYREPEAT, &dfrepeat) < 0)
- err(1, "WSKBDIO_GETKEYREPEAT");
+ warn("WSKBDIO_GETKEYREPEAT");
if (field_by_value(keyboard_field_tab, &ledstate)->flags & FLG_GET)
if (ioctl(fd, WSKBDIO_GETLEDS, &ledstate) < 0)
- err(1, "WSKBDIO_GETLEDS");
+ warn("WSKBDIO_GETLEDS");
if (field_by_value(keyboard_field_tab, &kbdencoding)->flags & FLG_GET)
if (ioctl(fd, WSKBDIO_GETENCODING, &kbdencoding) < 0)
- err(1, "WSKBDIO_GETENCODING");
+ warn("WSKBDIO_GETENCODING");
}
void
@@ -149,13 +149,15 @@ keyboard_put_values(pre, fd)
if (field_by_value(keyboard_field_tab, &bell.volume)->flags & FLG_SET)
bell.which |= WSKBD_BELL_DOVOLUME;
if (bell.which != 0 && ioctl(fd, WSKBDIO_SETBELL, &bell) < 0)
- err(1, "WSKBDIO_SETBELL");
- if (bell.which & WSKBD_BELL_DOPITCH)
- pr_field(pre, field_by_value(keyboard_field_tab, &bell.pitch), " -> ");
- if (bell.which & WSKBD_BELL_DOPERIOD)
- pr_field(pre, field_by_value(keyboard_field_tab, &bell.period), " -> ");
- if (bell.which & WSKBD_BELL_DOVOLUME)
- pr_field(pre, field_by_value(keyboard_field_tab, &bell.volume), " -> ");
+ warn("WSKBDIO_SETBELL");
+ else {
+ if (bell.which & WSKBD_BELL_DOPITCH)
+ pr_field(pre, field_by_value(keyboard_field_tab, &bell.pitch), " -> ");
+ if (bell.which & WSKBD_BELL_DOPERIOD)
+ pr_field(pre, field_by_value(keyboard_field_tab, &bell.period), " -> ");
+ if (bell.which & WSKBD_BELL_DOVOLUME)
+ pr_field(pre, field_by_value(keyboard_field_tab, &bell.volume), " -> ");
+ }
dfbell.which = 0;
if (field_by_value(keyboard_field_tab, &dfbell.pitch)->flags & FLG_SET)
@@ -166,18 +168,22 @@ keyboard_put_values(pre, fd)
dfbell.which |= WSKBD_BELL_DOVOLUME;
if (dfbell.which != 0 &&
ioctl(fd, WSKBDIO_SETDEFAULTBELL, &dfbell) < 0)
- err(1, "WSKBDIO_SETDEFAULTBELL");
- if (dfbell.which & WSKBD_BELL_DOPITCH)
- pr_field(pre, field_by_value(keyboard_field_tab, &dfbell.pitch), " -> ");
- if (dfbell.which & WSKBD_BELL_DOPERIOD)
- pr_field(pre, field_by_value(keyboard_field_tab, &dfbell.period), " -> ");
- if (dfbell.which & WSKBD_BELL_DOVOLUME)
- pr_field(pre, field_by_value(keyboard_field_tab, &dfbell.volume), " -> ");
+ warn("WSKBDIO_SETDEFAULTBELL");
+ else {
+ if (dfbell.which & WSKBD_BELL_DOPITCH)
+ pr_field(pre, field_by_value(keyboard_field_tab, &dfbell.pitch), " -> ");
+ if (dfbell.which & WSKBD_BELL_DOPERIOD)
+ pr_field(pre, field_by_value(keyboard_field_tab, &dfbell.period), " -> ");
+ if (dfbell.which & WSKBD_BELL_DOVOLUME)
+ pr_field(pre, field_by_value(keyboard_field_tab, &dfbell.volume), " -> ");
+ }
if (field_by_value(keyboard_field_tab, &kbmap)->flags & FLG_SET) {
if (ioctl(fd, WSKBDIO_SETMAP, &kbmap) < 0)
- err(1, "WSKBDIO_SETMAP");
- pr_field(pre, field_by_value(keyboard_field_tab, &kbmap), " -> ");
+ warn("WSKBDIO_SETMAP");
+ else {
+ pr_field(pre, field_by_value(keyboard_field_tab, &kbmap), " -> ");
+ }
}
repeat.which = 0;
@@ -187,11 +193,13 @@ keyboard_put_values(pre, fd)
repeat.which |= WSKBD_KEYREPEAT_DODELN;
if (repeat.which != 0 &&
ioctl(fd, WSKBDIO_SETKEYREPEAT, &repeat) < 0)
- err(1, "WSKBDIO_SETKEYREPEAT");
- if (repeat.which & WSKBD_KEYREPEAT_DODEL1)
- pr_field(pre, field_by_value(keyboard_field_tab, &repeat.del1), " -> ");
- if (repeat.which & WSKBD_KEYREPEAT_DODELN)
- pr_field(pre, field_by_value(keyboard_field_tab, &repeat.delN), " -> ");
+ warn("WSKBDIO_SETKEYREPEAT");
+ else {
+ if (repeat.which & WSKBD_KEYREPEAT_DODEL1)
+ pr_field(pre, field_by_value(keyboard_field_tab, &repeat.del1), " -> ");
+ if (repeat.which & WSKBD_KEYREPEAT_DODELN)
+ pr_field(pre, field_by_value(keyboard_field_tab, &repeat.delN), " -> ");
+ }
dfrepeat.which = 0;
if (field_by_value(keyboard_field_tab, &dfrepeat.del1)->flags & FLG_SET)
@@ -200,21 +208,27 @@ keyboard_put_values(pre, fd)
dfrepeat.which |= WSKBD_KEYREPEAT_DODELN;
if (dfrepeat.which != 0 &&
ioctl(fd, WSKBDIO_SETDEFAULTKEYREPEAT, &dfrepeat) < 0)
- err(1, "WSKBDIO_SETDEFAULTKEYREPEAT");
- if (dfrepeat.which &WSKBD_KEYREPEAT_DODEL1)
- pr_field(pre, field_by_value(keyboard_field_tab, &dfrepeat.del1), " -> ");
- if (dfrepeat.which & WSKBD_KEYREPEAT_DODELN)
- pr_field(pre, field_by_value(keyboard_field_tab, &dfrepeat.delN), " -> ");
+ warn("WSKBDIO_SETDEFAULTKEYREPEAT");
+ else {
+ if (dfrepeat.which &WSKBD_KEYREPEAT_DODEL1)
+ pr_field(pre, field_by_value(keyboard_field_tab, &dfrepeat.del1), " -> ");
+ if (dfrepeat.which & WSKBD_KEYREPEAT_DODELN)
+ pr_field(pre, field_by_value(keyboard_field_tab, &dfrepeat.delN), " -> ");
+ }
if (field_by_value(keyboard_field_tab, &ledstate)->flags & FLG_SET) {
if (ioctl(fd, WSKBDIO_SETLEDS, &ledstate) < 0)
- err(1, "WSKBDIO_SETLEDS");
- pr_field(pre, field_by_value(keyboard_field_tab, &ledstate), " -> ");
+ warn("WSKBDIO_SETLEDS");
+ else {
+ pr_field(pre, field_by_value(keyboard_field_tab, &ledstate), " -> ");
+ }
}
if (field_by_value(keyboard_field_tab, &kbdencoding)->flags & FLG_SET) {
if (ioctl(fd, WSKBDIO_SETENCODING, &kbdencoding) < 0)
- err(1, "WSKBDIO_SETENCODING");
- pr_field(pre, field_by_value(keyboard_field_tab, &kbdencoding), " -> ");
+ warn("WSKBDIO_SETENCODING");
+ else {
+ pr_field(pre, field_by_value(keyboard_field_tab, &kbdencoding), " -> ");
+ }
}
}