+ register int i;
+ register int fin;
+ register int nw;
+ register char *filebase;
+ register char *p;
+ register FILE *fp;
+ char temp[100];
+
+ /* first, read in font map file. The file must be of Format:
+ XX FILENAME (XX = troff font name)
+ with one entry per text line of the file.
+ Extra stuff after FILENAME is ignored */
+
+ sprintf(temp, "%s/fontmap", bitdir);
+ if ((fp = fopen(temp, "r")) == NULL)
+ error(FATAL, "Can't open %s", temp);
+ for (i = 0; i <= NFONTS && fgets(temp, 100, fp) != NULL; i++) {
+ sscanf(temp, "%2s", fontmap[i].fname);
+ p = &temp[0];
+ while (*p != ' ' && *p != ' ') p++;
+ while (*p == ' ' || *p == ' ') p++;
+ filebase = p;
+ for (nw = 1; *p != '\n' && *p != ' ' && *p != '\t'; p++) nw++;
+ fontmap[i].ffile = nalloc(1, nw);
+ sscanf(filebase, "%s", fontmap[i].ffile);
+ }
+ fontmap[++i].fname[0] = '0'; /* finish off with zeros */
+ fontmap[i].ffile = (char *) 0;
+ fclose(fp);
+#ifdef DEBUGABLE
+ if(dbg) {
+ fprintf(stderr, "font map:\n");
+ for (i = 0; fontmap[i].ffile; i++)
+ fprintf(stderr,"%s = %s\n", fontmap[i].fname, fontmap[i].ffile);
+ }
+#endif