Deleted Added
full compact
1/*-
2 * Copyright (c) 1994 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright

--- 8 unchanged lines hidden (view full) ---

19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * $Id: kbdcontrol.c,v 1.1 1994/08/17 08:59:34 sos Exp $
28 */
29
30#include <ctype.h>
31#include <stdio.h>
32#include <string.h>
33#include <machine/console.h>
34#include "path.h"
35#include "lex.h"

--- 45 unchanged lines hidden (view full) ---

81 exit(1);
82 return("");
83}
84
85
86char *
87mkfullname(const char *s1, const char *s2, const char *s3)
88{
89static char *buf = NULL;
90static int bufl = 0;
91int f;
92
93
94 f = strlen(s1) + strlen(s2) + strlen(s3) + 1;
95 if (f > bufl)
96 if (buf)
97 buf = (char *)realloc(buf, f);
98 else
99 buf = (char *)malloc(f);
100 if (!buf) {
101 bufl = 0;

--- 314 unchanged lines hidden (view full) ---

416 if (ioctl(0, SETFKEY, &fkey) < 0)
417 perror("setting function key");
418}
419
420
421void
422set_bell_values(char *opt)
423{
424 int duration, pitch;
425
426 if (!strcmp(opt, "normal"))
427 duration = 1, pitch = 15;
428 else {
429 int n;
430 char *v1;
431
432 duration = strtol(opt, &v1, 0);
433 if ((duration < 0) || (*v1 != '.'))
434 goto badopt;
435 opt = ++v1;
436 pitch = strtol(opt, &v1, 0);
437 if ((pitch < 0) || (*opt == '\0') || (*v1 != '\0')) {
438badopt:
439 fprintf(stderr,
440 "argument to -b must be DURATION.PITCH\n");
441 return;
442 }
443 }
444
445 if (verbose)
446 fprintf(stderr, "setting bell values to %d.%d\n",
447 duration, pitch);
448 fprintf(stderr, "[=%d;%dB", pitch, duration);
449}
450
451
452void
453set_keyrates(char *opt)
454{
455struct {
456 int rep:5;

--- 39 unchanged lines hidden (view full) ---

496 if (ioctl(0, KDSETRAD, rate) < 0)
497 perror("setting keyboard rate");
498}
499
500
501usage()
502{
503 fprintf(stderr,
504"Usage: kbdcontrol -b duration.pitch (set bell duration & pitch)\n"
505" -d (dump keyboard map to stdout)\n"
506" -l filename (load keyboard map file)\n"
507" -f <N> string (set function key N to send <string>)\n"
508" -F (set function keys back to default)\n"
509" -r delay.repeat (set keyboard delay & repeat rate)\n"
510" -r slow (set keyboard delay & repeat to slow)\n"
511" -r normal (set keyboard delay & repeat to normal)\n"
512" -r fast (set keyboard delay & repeat to fast)\n"
513" -v (verbose)\n"
514 );
515}
516
517
518void
519main(int argc, char **argv)
520{
521 extern char *optarg;

--- 46 unchanged lines hidden ---