summaryrefslogtreecommitdiffstats
path: root/usr.sbin/kbdcontrol/kbdcontrol.c
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>1998-09-10 12:20:09 +0000
committeryokota <yokota@FreeBSD.org>1998-09-10 12:20:09 +0000
commit30c8ef5ad9738a290fe79f0210327b2fd2763771 (patch)
treefc260555b6e0bf74992e27f02a63ab7041984eb1 /usr.sbin/kbdcontrol/kbdcontrol.c
parent645b31eaf0f80a48e0303c8d01871b3473d15a6b (diff)
downloadFreeBSD-src-30c8ef5ad9738a290fe79f0210327b2fd2763771.zip
FreeBSD-src-30c8ef5ad9738a290fe79f0210327b2fd2763771.tar.gz
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
Diffstat (limited to 'usr.sbin/kbdcontrol/kbdcontrol.c')
-rw-r--r--usr.sbin/kbdcontrol/kbdcontrol.c23
1 files changed, 9 insertions, 14 deletions
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 <ctype.h>
@@ -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");
}
OpenPOWER on IntegriCloud