summaryrefslogtreecommitdiff
path: root/sbin/wsconsctl
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-12-17 07:10:26 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-12-17 07:10:26 +0000
commit6c193e127385ca865456e2381818121a0eaa1093 (patch)
treea78b8f65bb5eb816ab49b61b6d660274690a3390 /sbin/wsconsctl
parentb37ccbced4991cd9e576b413574cc0ec62ce5d99 (diff)
display.focus is a signed int, make it so; this fixes a problem under x11, which is now a correct -1
Diffstat (limited to 'sbin/wsconsctl')
-rw-r--r--sbin/wsconsctl/display.c4
-rw-r--r--sbin/wsconsctl/util.c13
-rw-r--r--sbin/wsconsctl/wsconsctl.h7
3 files changed, 18 insertions, 6 deletions
diff --git a/sbin/wsconsctl/display.c b/sbin/wsconsctl/display.c
index 3e60a3c0b0b..d356431033f 100644
--- a/sbin/wsconsctl/display.c
+++ b/sbin/wsconsctl/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.7 2002/12/11 18:27:19 deraadt Exp $ */
+/* $OpenBSD: display.c,v 1.8 2002/12/17 07:10:25 mickey Exp $ */
/* $NetBSD: display.c,v 1.1 1998/12/28 14:01:16 hannken Exp $ */
/*-
@@ -51,7 +51,7 @@ int burnon, burnoff, vblank, kbdact, msact, outact;
struct field display_field_tab[] = {
{ "type", &dpytype, FMT_DPYTYPE, FLG_RDONLY },
- { "focus", &focus, FMT_UINT, FLG_MODIFY },
+ { "focus", &focus, FMT_INT, FLG_MODIFY },
{ "brightness", &brightness, FMT_PC, FLG_MODIFY|FLG_INIT },
{ "contrast", &contrast, FMT_PC, FLG_MODIFY|FLG_INIT },
{ "backlight", &backlight, FMT_PC, FLG_MODIFY|FLG_INIT },
diff --git a/sbin/wsconsctl/util.c b/sbin/wsconsctl/util.c
index 4161d8ea4f9..35a24e4e0ea 100644
--- a/sbin/wsconsctl/util.c
+++ b/sbin/wsconsctl/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.15 2002/12/11 18:27:19 deraadt Exp $ */
+/* $OpenBSD: util.c,v 1.16 2002/12/17 07:10:25 mickey Exp $ */
/* $NetBSD: util.c,v 1.8 2000/03/14 08:11:53 sato Exp $ */
/*-
@@ -192,6 +192,9 @@ pr_field(const char *pre, struct field *f, const char *sep)
case FMT_UINT:
printf("%u", *((u_int *) f->valp));
break;
+ case FMT_INT:
+ printf("%d", *((int *) f->valp));
+ break;
case FMT_BOOL:
printf("%s", *((u_int *) f->valp)? "on" : "off");
break;
@@ -259,6 +262,14 @@ rd_field(struct field *f, char *val, int merge)
else
*((u_int *) f->valp) = u;
break;
+ case FMT_INT:
+ if (sscanf(val, "%d", &i) != 1)
+ errx(1, "%s: not a number", val);
+ if (merge)
+ *((int *) f->valp) += i;
+ else
+ *((int *) f->valp) = i;
+ break;
case FMT_BOOL:
if (*val != 'o' || (val[1] != 'n' &&
(val[1] != 'f' || val[2] != 'f')))
diff --git a/sbin/wsconsctl/wsconsctl.h b/sbin/wsconsctl/wsconsctl.h
index 341851af90f..eca518253a6 100644
--- a/sbin/wsconsctl/wsconsctl.h
+++ b/sbin/wsconsctl/wsconsctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsconsctl.h,v 1.5 2002/05/22 20:36:06 mickey Exp $ */
+/* $OpenBSD: wsconsctl.h,v 1.6 2002/12/17 07:10:25 mickey Exp $ */
/* $NetBSD: wsconsctl.h 1.1 1998/12/28 14:01:17 hannken Exp $ */
/*-
@@ -43,8 +43,9 @@ struct field {
char *name;
void *valp;
#define FMT_UINT 1 /* unsigned integer */
-#define FMT_BOOL 2 /* boolean on/off */
-#define FMT_PC 3 /* percentage fixed point 000.00 */
+#define FMT_INT 2 /* signed integer */
+#define FMT_BOOL 3 /* boolean on/off */
+#define FMT_PC 4 /* percentage fixed point 000.00 */
#define FMT_KBDTYPE 101 /* keyboard type */
#define FMT_MSTYPE 102 /* mouse type */
#define FMT_DPYTYPE 103 /* display type */