From 30c8ef5ad9738a290fe79f0210327b2fd2763771 Mon Sep 17 00:00:00 2001 From: yokota Date: Thu, 10 Sep 1998 12:20:09 +0000 Subject: The fix in the previous commit was not sufficient; the upper 24 bits of an int argument still contained garbage. Pointed out by: bde PR: bin/7799 --- usr.sbin/kbdcontrol/kbdcontrol.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'usr.sbin/kbdcontrol/kbdcontrol.c') diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c index f3f6bc9..e1614c3 100644 --- a/usr.sbin/kbdcontrol/kbdcontrol.c +++ b/usr.sbin/kbdcontrol/kbdcontrol.c @@ -28,7 +28,7 @@ #ifndef lint static const char rcsid[] = - "$Id: kbdcontrol.c,v 1.17 1998/08/06 09:44:23 yokota Exp $"; + "$Id: kbdcontrol.c,v 1.18 1998/09/04 10:15:48 yokota Exp $"; #endif /* not lint */ #include @@ -813,21 +813,17 @@ badopt: void set_keyrates(char *opt) { -struct { - int rep:5; - int del:2; - int pad:1; - }rate; + int repeat; + int delay; if (!strcmp(opt, "slow")) - rate.del = 3, rate.rep = 31; + delay = 3, repeat = 31; else if (!strcmp(opt, "normal")) - rate.del = 1, rate.rep = 15; + delay = 1, repeat = 15; else if (!strcmp(opt, "fast")) - rate.del = rate.rep = 0; + delay = repeat = 0; else { int n; - int delay, repeat; char *v1; delay = strtol(opt, &v1, 0); @@ -843,15 +839,14 @@ badopt: for (n = 0; n < ndelays - 1; n++) if (delay <= delays[n]) break; - rate.del = n; + delay = n; for (n = 0; n < nrepeats - 1; n++) if (repeat <= repeats[n]) break; - rate.rep = n; + repeat = n; } - rate.pad = 0; - if (ioctl(0, KDSETRAD, rate) < 0) + if (ioctl(0, KDSETRAD, (delay << 5) | repeat) < 0) warn("setting keyboard rate"); } -- cgit v1.1