Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / amiga / stand / loadkmap / loadkmap.c
blob9ae8496807c1774d3edd57198c99a0ccb254fe9f
1 /* $NetBSD: loadkmap.c,v 1.5 2002/01/26 13:21:12 aymeric Exp $ */
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <sys/ioctl.h>
6 #include "../../dev/iteioctl.h"
7 #include "../../dev/kbdmap.h"
8 #include <stdio.h>
9 #include <stdlib.h>
12 void load_kmap(const char *);
13 void dump_kmap(void);
15 int
16 main(int argc, char *argv[])
18 if (argc > 2)
20 fprintf (stderr, "%s keymap\n", argv[0]);
21 exit (1);
24 if (argc == 1)
25 dump_kmap ();
26 else
27 load_kmap (argv[1]);
29 exit (0);
33 void
34 load_kmap(const char *file)
36 int fd;
37 char buf[sizeof (struct kbdmap)];
39 if ((fd = open (file, 0)) >= 0)
41 if (read (fd, buf, sizeof (buf)) == sizeof (buf))
43 if (ioctl (0, ITEIOCSKMAP, buf) == 0)
44 return;
45 else
46 perror ("ITEIOCSKMAP");
48 else
49 perror ("read kmap");
51 close (fd);
53 else
54 perror ("open kmap");
57 void
58 dump_kmap(void)
60 char buf[sizeof (struct kbdmap)];
61 if (ioctl (0, ITEIOCGKMAP, buf) == 0)
62 write (1, buf, sizeof (buf));
63 else
64 perror ("ITEIOCGKMAP");