Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / x68k / usr.bin / loadfont / loadfont.c
blobc4dfef8c94ab8284dec9606a5a6f4c4b4f195a14
1 /*
2 * loadfont - load ascii font (for NetBSD/X680x0)
3 * from: amiga/stand/loadkmap/loadkmap.c
4 * Copyright 1993 by Masaru Oki
6 * $NetBSD: loadfont.c,v 1.6 2005/12/11 12:19:45 christos Exp $
7 */
9 #include <sys/cdefs.h>
10 __RCSID("$NetBSD: loadfont.c,v 1.6 2005/12/11 12:19:45 christos Exp $");
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <sys/file.h>
15 #include <sys/ioctl.h>
16 #define ITEKANJI 1 /* XXX */
17 #include <machine/iteioctl.h>
19 void load_font(const char *);
21 int
22 main(int argc, char *argv[])
25 if (argc != 2) {
26 fprintf(stderr, "Usage: %s fontfile\n", argv[0]);
27 exit (1);
30 load_font(argv[1]);
31 exit(0);
34 void
35 load_font(const char *file)
37 unsigned char buf[4096];
38 int fd;
40 if ((fd = open(file, O_RDONLY)) >= 0) {
41 if (read (fd, buf, sizeof(buf)) == sizeof (buf)) {
42 if (ioctl(0, ITELOADFONT, buf) == 0)
43 return;
44 else
45 perror("ITELOADFONT");
46 } else {
47 perror("read font");
50 close(fd);
51 } else {
52 perror("open font");