1 /* loadkeys - load national keyboard map Author: Marcus Hampel
5 #include <minix/keymap.h>
13 #define KBD_DEVICE "/dev/console"
17 fprintf(stderr
, "loadkeys: %s: %s\n", say
, strerror(errno
));
24 fprintf(stderr
, "usage: loadkeys <mapfile>\n");
29 int main(int argc
, char *argv
[])
38 if ((fd
= open(argv
[1], O_RDONLY
)) < 0) fatal(argv
[1]);
40 if (read(fd
, sig
, sizeof(sig
)) < sizeof(sig
)) fatal(argv
[1]);
42 if (memcmp(sig
, KEY_MAGIC
, sizeof(sig
)) != 0) {
43 fprintf(stderr
, "loadkeys: %s: not a keymap file\n", argv
[1]);
47 if (read(fd
, keymap
, sizeof(keymap
)) < sizeof(keymap
)) fatal(argv
[1]);
51 if ((fd
= open(KBD_DEVICE
, O_WRONLY
)) < 0) fatal(KBD_DEVICE
);
53 if (ioctl(fd
, KIOCSMAP
, keymap
) < 0) fatal(KBD_DEVICE
);