summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/wsconsctl/display.c130
-rw-r--r--sbin/wsconsctl/keyboard.c92
-rw-r--r--sbin/wsconsctl/mouse.c24
-rw-r--r--sbin/wsconsctl/wsconsctl.c9
4 files changed, 141 insertions, 114 deletions
diff --git a/sbin/wsconsctl/display.c b/sbin/wsconsctl/display.c
index 9e55cc37f30..9e7faa18e82 100644
--- a/sbin/wsconsctl/display.c
+++ b/sbin/wsconsctl/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.4 2001/07/06 04:11:26 pvalchev Exp $ */
+/* $OpenBSD: display.c,v 1.5 2001/10/24 17:45:59 miod Exp $ */
/* $NetBSD: display.c,v 1.1 1998/12/28 14:01:16 hannken Exp $ */
/*-
@@ -68,15 +68,13 @@ display_get_values(pre, fd)
if (field_by_value(display_field_tab, &dpytype)->flags & FLG_GET)
if (ioctl(fd, WSDISPLAYIO_GTYPE, &dpytype) < 0)
- err(1, "WSDISPLAYIO_GTYPE");
+ warn("WSDISPLAYIO_GTYPE");
- gscr.idx = -1;
+ focus = gscr.idx = -1;
if (field_by_value(display_field_tab, &focus)->flags & FLG_GET) {
if (ioctl(fd, WSDISPLAYIO_GETSCREEN, &gscr) < 0)
- err(1, "WSDISPLAYIO_GETSCREEN");
+ warn("WSDISPLAYIO_GETSCREEN");
}
- else
- focus = gscr.idx;
if (field_by_value(display_field_tab, &burnon)->flags & FLG_GET ||
field_by_value(display_field_tab, &burnoff)->flags & FLG_GET ||
@@ -88,25 +86,26 @@ display_get_values(pre, fd)
struct wsdisplay_burner burners;
if (ioctl(fd, WSDISPLAYIO_GBURNER, &burners) < 0)
- err(1, "WSDISPLAYIO_GBURNER");
+ warn("WSDISPLAYIO_GBURNER");
+ else {
+ if (field_by_value(display_field_tab, &burnon)->flags & FLG_GET)
+ burnon = burners.on;
- if (field_by_value(display_field_tab, &burnon)->flags & FLG_GET)
- burnon = burners.on;
+ if (field_by_value(display_field_tab, &burnoff)->flags & FLG_GET)
+ burnoff = burners.off;
- if (field_by_value(display_field_tab, &burnoff)->flags & FLG_GET)
- burnoff = burners.off;
+ if (field_by_value(display_field_tab, &vblank)->flags & FLG_GET)
+ vblank = burners.flags & WSDISPLAY_BURN_VBLANK;
- if (field_by_value(display_field_tab, &vblank)->flags & FLG_GET)
- vblank = burners.flags & WSDISPLAY_BURN_VBLANK;
+ if (field_by_value(display_field_tab, &kbdact)->flags & FLG_GET)
+ kbdact = burners.flags & WSDISPLAY_BURN_KBD;
- if (field_by_value(display_field_tab, &kbdact)->flags & FLG_GET)
- kbdact = burners.flags & WSDISPLAY_BURN_KBD;
+ if (field_by_value(display_field_tab, &msact )->flags & FLG_GET)
+ msact = burners.flags & WSDISPLAY_BURN_MOUSE;
- if (field_by_value(display_field_tab, &msact )->flags & FLG_GET)
- msact = burners.flags & WSDISPLAY_BURN_MOUSE;
-
- if (field_by_value(display_field_tab, &outact)->flags & FLG_GET)
- outact = burners.flags & WSDISPLAY_BURN_OUTPUT;
+ if (field_by_value(display_field_tab, &outact)->flags & FLG_GET)
+ outact = burners.flags & WSDISPLAY_BURN_OUTPUT;
+ }
}
}
@@ -117,7 +116,7 @@ display_put_values(pre, fd)
{
if (field_by_value(display_field_tab, &focus)->flags & FLG_SET)
if (ioctl(fd, WSDISPLAYIO_SETSCREEN, &focus) < 0)
- err(1, "WSDISPLAYIO_SETSCREEN");
+ warn("WSDISPLAYIO_SETSCREEN");
if (field_by_value(display_field_tab, &burnon)->flags & FLG_SET ||
field_by_value(display_field_tab, &burnoff)->flags & FLG_SET ||
@@ -129,43 +128,58 @@ display_put_values(pre, fd)
struct wsdisplay_burner burners;
if (ioctl(fd, WSDISPLAYIO_GBURNER, &burners) < 0)
- err(1, "WSDISPLAYIO_GBURNER");
-
- if (field_by_value(display_field_tab, &burnon)->flags & FLG_SET)
- burners.on = burnon;
-
- if (field_by_value(display_field_tab, &burnoff)->flags & FLG_SET)
- burners.off = burnoff;
-
- if (field_by_value(display_field_tab, &vblank)->flags & FLG_SET) {
- if (vblank)
- burners.flags |= WSDISPLAY_BURN_VBLANK;
- else
- burners.flags &= ~WSDISPLAY_BURN_VBLANK;
- }
-
- if (field_by_value(display_field_tab, &kbdact)->flags & FLG_SET) {
- if (kbdact)
- burners.flags |= WSDISPLAY_BURN_KBD;
- else
- burners.flags &= ~WSDISPLAY_BURN_KBD;
- }
-
- if (field_by_value(display_field_tab, &msact )->flags & FLG_SET) {
- if (msact)
- burners.flags |= WSDISPLAY_BURN_MOUSE;
- else
- burners.flags &= ~WSDISPLAY_BURN_MOUSE;
+ warn("WSDISPLAYIO_GBURNER");
+ else {
+ if (field_by_value(display_field_tab, &burnon)->flags & FLG_SET)
+ burners.on = burnon;
+
+ if (field_by_value(display_field_tab, &burnoff)->flags & FLG_SET)
+ burners.off = burnoff;
+
+ if (field_by_value(display_field_tab, &vblank)->flags & FLG_SET) {
+ if (vblank)
+ burners.flags |= WSDISPLAY_BURN_VBLANK;
+ else
+ burners.flags &= ~WSDISPLAY_BURN_VBLANK;
+ }
+
+ if (field_by_value(display_field_tab, &kbdact)->flags & FLG_SET) {
+ if (kbdact)
+ burners.flags |= WSDISPLAY_BURN_KBD;
+ else
+ burners.flags &= ~WSDISPLAY_BURN_KBD;
+ }
+
+ if (field_by_value(display_field_tab, &msact )->flags & FLG_SET) {
+ if (msact)
+ burners.flags |= WSDISPLAY_BURN_MOUSE;
+ else
+ burners.flags &= ~WSDISPLAY_BURN_MOUSE;
+ }
+
+ if (field_by_value(display_field_tab, &outact)->flags & FLG_SET) {
+ if (outact)
+ burners.flags |= WSDISPLAY_BURN_OUTPUT;
+ else
+ burners.flags &= ~WSDISPLAY_BURN_OUTPUT;
+ }
+
+ if (ioctl(fd, WSDISPLAYIO_SBURNER, &burners) < 0)
+ warn("WSDISPLAYIO_SBURNER");
+ else {
+ if (field_by_value(display_field_tab, &burnon)->flags & FLG_SET)
+ pr_field(pre, field_by_value(display_field_tab, &burnon), " -> ");
+ if (field_by_value(display_field_tab, &burnoff)->flags & FLG_SET)
+ pr_field(pre, field_by_value(display_field_tab, &burnoff), " -> ");
+ if (field_by_value(display_field_tab, &vblank)->flags & FLG_SET)
+ pr_field(pre, field_by_value(display_field_tab, &vblank), " -> ");
+ if (field_by_value(display_field_tab, &kbdact)->flags & FLG_SET)
+ pr_field(pre, field_by_value(display_field_tab, &kbdact), " -> ");
+ if (field_by_value(display_field_tab, &msact )->flags & FLG_SET)
+ pr_field(pre, field_by_value(display_field_tab, &msact), " -> ");
+ if (field_by_value(display_field_tab, &outact)->flags & FLG_SET)
+ pr_field(pre, field_by_value(display_field_tab, &outact), " -> ");
+ }
}
-
- if (field_by_value(display_field_tab, &outact)->flags & FLG_SET) {
- if (outact)
- burners.flags |= WSDISPLAY_BURN_OUTPUT;
- else
- burners.flags &= ~WSDISPLAY_BURN_OUTPUT;
- }
-
- if (ioctl(fd, WSDISPLAYIO_SBURNER, &burners) < 0)
- err(1, "WSDISPLAYIO_SBURNER");
}
}
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), " -> ");
+ }
}
}
diff --git a/sbin/wsconsctl/mouse.c b/sbin/wsconsctl/mouse.c
index e5fea9c6edb..f839481eac3 100644
--- a/sbin/wsconsctl/mouse.c
+++ b/sbin/wsconsctl/mouse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mouse.c,v 1.3 2001/08/01 10:33:10 hugh Exp $ */
+/* $OpenBSD: mouse.c,v 1.4 2001/10/24 17:45:59 miod Exp $ */
/* $NetBSD: mouse.c,v 1.3 1999/11/15 13:47:30 ad Exp $ */
/*-
@@ -61,7 +61,7 @@ mouse_get_values(pre, fd)
{
if (field_by_value(mouse_field_tab, &mstype)->flags & FLG_GET)
if (ioctl(fd, WSMOUSEIO_GTYPE, &mstype) < 0)
- err(1, "WSMOUSEIO_GTYPE");
+ warn("WSMOUSEIO_GTYPE");
}
void
@@ -69,18 +69,18 @@ mouse_put_values(pre, fd)
const char *pre;
int fd;
{
- int tmp;
-
if (field_by_value(mouse_field_tab, &resolution)->flags & FLG_SET) {
- tmp = resolution;
- if (ioctl(fd, WSMOUSEIO_SRES, &tmp) < 0)
- err(1, "WSMOUSEIO_SRES");
- pr_field(pre, field_by_value(mouse_field_tab, &resolution), " -> ");
+ if (ioctl(fd, WSMOUSEIO_SRES, &resolution) < 0)
+ warn("WSMOUSEIO_SRES");
+ else {
+ pr_field(pre, field_by_value(mouse_field_tab, &resolution), " -> ");
+ }
}
if (field_by_value(mouse_field_tab, &samplerate)->flags & FLG_SET) {
- tmp = samplerate;
- if (ioctl(fd, WSMOUSEIO_SRATE, &tmp) < 0)
- err(1, "WSMOUSEIO_SRATE");
- pr_field(pre, field_by_value(mouse_field_tab, &tmp), " -> ");
+ if (ioctl(fd, WSMOUSEIO_SRATE, &samplerate) < 0)
+ warn("WSMOUSEIO_SRATE");
+ else {
+ pr_field(pre, field_by_value(mouse_field_tab, &samplerate), " -> ");
+ }
}
}
diff --git a/sbin/wsconsctl/wsconsctl.c b/sbin/wsconsctl/wsconsctl.c
index 5600de258af..063ef3dbd3e 100644
--- a/sbin/wsconsctl/wsconsctl.c
+++ b/sbin/wsconsctl/wsconsctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsconsctl.c,v 1.8 2001/08/26 17:35:13 deraadt Exp $ */
+/* $OpenBSD: wsconsctl.c,v 1.9 2001/10/24 17:45:59 miod Exp $ */
/* $NetBSD: wsconsctl.c,v 1.2 1998/12/29 22:40:20 hannken Exp $ */
/*-
@@ -82,9 +82,9 @@ usage(msg)
fprintf(stderr, "%s: %s\n", __progname, msg);
fprintf(stderr,
- "usage: %s [-f file] [-n] name ...\n"
- " %s [-f file] [-n] -w name=value ...\n"
- " %s [-f file] [-n] -a\n", __progname,
+ "usage: %s [-n] name ...\n"
+ " %s [-n] -w name=value ...\n"
+ " %s [-n] -a\n", __progname,
__progname, __progname);
exit(1);
@@ -117,7 +117,6 @@ main(argc, argv)
case 'w':
wflag = 1;
break;
- case '?':
default:
usage(NULL);
}