Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / x68k / usr.bin / loadkmap / loadkmap.c
blob29cc73a8d3c272308fd4665108087c49463066bf
1 /* $NetBSD: loadkmap.c,v 1.8 2005/12/11 12:19:45 christos Exp $ */
2 /*
3 * loadkmap - load keyboard map (for NetBSD/X680x0)
4 * from: amiga/stand/loadkmap/loadkmap.c
5 * Copyright 1994 by Masaru Oki
6 */
8 #include <sys/cdefs.h>
9 __RCSID("$NetBSD: loadkmap.c,v 1.8 2005/12/11 12:19:45 christos Exp $");
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <sys/types.h>
14 #include <sys/ioctl.h>
15 #include <machine/kbdmap.h>
16 #include <machine/iteioctl.h>
18 void load_kmap(const char *);
20 int
21 main(int argc, char *argv[])
24 if (argc != 2) {
25 fprintf(stderr, "Usage: %s kmapfile\n", argv[0]);
26 exit (1);
29 load_kmap(argv[1]);
30 exit(0);
33 void
34 load_kmap(const char *file)
36 unsigned char buf[sizeof(struct kbdmap)];
37 int fd;
39 if ((fd = open(file, 0)) >= 0) {
40 if (read(fd, buf, sizeof(buf)) == sizeof(buf)) {
41 if (ioctl(0, ITEIOCSKMAP, buf) == 0)
42 return;
43 else
44 perror("ITEIOCSKMAP");
45 } else {
46 perror("read kbdmap");
49 close (fd);
50 } else {
51 perror("open kbdmap");