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
This commit is contained in:
Kazutaka YOKOTA 1998-09-10 12:20:09 +00:00
parent 6fa64a7e93
commit d30ada6d4b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39047

View File

@ -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 @@ set_bell_values(char *opt)
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 @@ struct {
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");
}