17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate * with the License.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate * and limitations under the License.
137c478bd9Sstevel@tonic-gate *
147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate *
207c478bd9Sstevel@tonic-gate * CDDL HEADER END
217c478bd9Sstevel@tonic-gate */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate * Copyright 1989 Sun Microsystems, Inc. All rights reserved.
247c478bd9Sstevel@tonic-gate * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate */
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
287c478bd9Sstevel@tonic-gate /* All Rights Reserved */
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988
327c478bd9Sstevel@tonic-gate * The Regents of the University of California
337c478bd9Sstevel@tonic-gate * All Rights Reserved
347c478bd9Sstevel@tonic-gate *
357c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from
367c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its
377c478bd9Sstevel@tonic-gate * contributors.
387c478bd9Sstevel@tonic-gate */
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate /* Note added 9/25/83
417c478bd9Sstevel@tonic-gate Setting the parameter biggestfont in the DESC file
427c478bd9Sstevel@tonic-gate to be at least as big as the number of characters
437c478bd9Sstevel@tonic-gate in the largest font for a particular device
447c478bd9Sstevel@tonic-gate eliminates the "font X too big for position Y"
457c478bd9Sstevel@tonic-gate message from troff.
467c478bd9Sstevel@tonic-gate Thanks to Dave Stephens, WECo.
477c478bd9Sstevel@tonic-gate */
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate makedev:
507c478bd9Sstevel@tonic-gate read text info about a particular device
517c478bd9Sstevel@tonic-gate (e.g., cat, 202, aps5) from file, convert
527c478bd9Sstevel@tonic-gate it into internal (binary) form suitable for
537c478bd9Sstevel@tonic-gate fast reading by troff initialization (ptinit()).
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gate Usage:
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gate makedev DESC [ F ... ]
587c478bd9Sstevel@tonic-gate uses DESC to create a description file
597c478bd9Sstevel@tonic-gate using the information therein.
607c478bd9Sstevel@tonic-gate It creates the file DESC.out.
617c478bd9Sstevel@tonic-gate
627c478bd9Sstevel@tonic-gate makedev F ...
637c478bd9Sstevel@tonic-gate makes the font tables for fonts F only,
647c478bd9Sstevel@tonic-gate creates files F.out.
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gate DESC.out contains:
677c478bd9Sstevel@tonic-gate dev structure with fundamental sizes
687c478bd9Sstevel@tonic-gate list of sizes (nsizes+1) terminated by 0, as short's
697c478bd9Sstevel@tonic-gate indices of char names (nchtab * sizeof(short))
707c478bd9Sstevel@tonic-gate char names as hy\0em\0... (lchname)
717c478bd9Sstevel@tonic-gate nfonts occurrences of
727c478bd9Sstevel@tonic-gate widths (nwidth)
737c478bd9Sstevel@tonic-gate kerning (nwidth) [ascender+descender only so far]
747c478bd9Sstevel@tonic-gate codes (nwidth) to drive actual typesetter
757c478bd9Sstevel@tonic-gate fitab (nchtab+128-32)
767c478bd9Sstevel@tonic-gate each of these is an array of char.
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gate dev.filesize contains the number of bytes
797c478bd9Sstevel@tonic-gate in the file, excluding the dev part itself.
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate F.out contains the font header, width, kern, codes, and fitab.
827c478bd9Sstevel@tonic-gate Width, kern and codes are parallel arrays.
837c478bd9Sstevel@tonic-gate (Which suggests that they ought to be together?)
847c478bd9Sstevel@tonic-gate Later, we might allow for codes which are actually
857c478bd9Sstevel@tonic-gate sequences of formatting info so characters can be drawn.
867c478bd9Sstevel@tonic-gate */
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate #include "stdio.h"
897c478bd9Sstevel@tonic-gate #include "dev.h"
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gate #define BYTEMASK 0377
927c478bd9Sstevel@tonic-gate #define skipline(f) while(getc(f) != '\n')
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate struct dev dev;
957c478bd9Sstevel@tonic-gate struct Font font;
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate #define NSIZE 100 /* maximum number of sizes */
987c478bd9Sstevel@tonic-gate short size[NSIZE];
997c478bd9Sstevel@tonic-gate #define NCH 256 /* max number of characters with funny names */
1007c478bd9Sstevel@tonic-gate char chname[5*NCH]; /* character names, including \0 for each */
1017c478bd9Sstevel@tonic-gate short chtab[NCH]; /* index of character in chname */
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gate #define NFITAB (NCH + 128-32) /* includes ascii chars, but not non-graphics */
1047c478bd9Sstevel@tonic-gate char fitab[NFITAB]; /* font index table: position of char i on this font. */
1057c478bd9Sstevel@tonic-gate /* zero if not there */
1067c478bd9Sstevel@tonic-gate
1077c478bd9Sstevel@tonic-gate #define FSIZE 256 /* size of a physical font (e.g., 102 for cat) */
1087c478bd9Sstevel@tonic-gate char width[FSIZE]; /* width table for a physical font */
1097c478bd9Sstevel@tonic-gate char kern[FSIZE]; /* ascender+descender info */
1107c478bd9Sstevel@tonic-gate char code[FSIZE]; /* actual device codes for a physical font */
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gate #define NFONT 60 /* max number of default fonts */
1137c478bd9Sstevel@tonic-gate char fname[NFONT][10]; /* temp space to hold default font names */
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gate int fflag = 0; /* on if font table to be written */
1167c478bd9Sstevel@tonic-gate int fdout; /* output file descriptor */
1177c478bd9Sstevel@tonic-gate char *fout = "DESC.out";
1187c478bd9Sstevel@tonic-gate
main(int argc,char * argv[])1197c478bd9Sstevel@tonic-gate int main(int argc, char *argv[])
1207c478bd9Sstevel@tonic-gate {
1217c478bd9Sstevel@tonic-gate FILE *fin;
1227c478bd9Sstevel@tonic-gate char cmd[100], *p;
1237c478bd9Sstevel@tonic-gate int i, totfont, v;
1247c478bd9Sstevel@tonic-gate
1257c478bd9Sstevel@tonic-gate if (argc < 2) {
1267c478bd9Sstevel@tonic-gate fprintf(stderr, "Usage: makedev [DESC] [fonts]\n");
1277c478bd9Sstevel@tonic-gate exit(1);
1287c478bd9Sstevel@tonic-gate }
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gate if ((fin = fopen("DESC", "r")) == NULL) {
1317c478bd9Sstevel@tonic-gate fprintf(stderr, "makedev: can't open %s\n", argv[1]);
1327c478bd9Sstevel@tonic-gate exit(1);
1337c478bd9Sstevel@tonic-gate }
1347c478bd9Sstevel@tonic-gate while (fscanf(fin, "%s", cmd) != EOF) {
1357c478bd9Sstevel@tonic-gate if (cmd[0] == '#') /* comment */
1367c478bd9Sstevel@tonic-gate skipline(fin);
1377c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "res") == 0) {
1387c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.res);
1397c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "hor") == 0) {
1407c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.hor);
1417c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "vert") == 0) {
1427c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.vert);
1437c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "unitwidth") == 0) {
1447c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.unitwidth);
1457c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "sizescale") == 0) {
1467c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.sizescale);
1477c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "paperwidth") == 0) {
1487c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.paperwidth);
1497c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "paperlength") == 0) {
1507c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.paperlength);
1517c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "biggestfont") == 0) {
1527c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.biggestfont);
1537c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "spare2") == 0) {
1547c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.spare2);
1557c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "sizes") == 0) {
1567c478bd9Sstevel@tonic-gate dev.nsizes = 0;
1577c478bd9Sstevel@tonic-gate while (fscanf(fin, "%d", &v) != EOF && v != 0)
1587c478bd9Sstevel@tonic-gate size[dev.nsizes++] = v;
1597c478bd9Sstevel@tonic-gate size[dev.nsizes] = 0; /* need an extra 0 at the end */
1607c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "fonts") == 0) {
1617c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.nfonts);
1627c478bd9Sstevel@tonic-gate for (i = 0; i < dev.nfonts; i++)
1637c478bd9Sstevel@tonic-gate fscanf(fin, "%s", fname[i]);
1647c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "charset") == 0) {
1657c478bd9Sstevel@tonic-gate p = chname;
1667c478bd9Sstevel@tonic-gate dev.nchtab = 0;
1677c478bd9Sstevel@tonic-gate while (fscanf(fin, "%s", p) != EOF) {
1687c478bd9Sstevel@tonic-gate chtab[dev.nchtab++] = p - chname;
1697c478bd9Sstevel@tonic-gate while (*p++) /* skip to end of name */
1707c478bd9Sstevel@tonic-gate ;
1717c478bd9Sstevel@tonic-gate }
1727c478bd9Sstevel@tonic-gate dev.lchname = p - chname;
1737c478bd9Sstevel@tonic-gate chtab[dev.nchtab++] = 0; /* terminate properly */
1747c478bd9Sstevel@tonic-gate } else
1757c478bd9Sstevel@tonic-gate fprintf(stderr, "makedev: unknown command %s\n", cmd);
1767c478bd9Sstevel@tonic-gate }
1777c478bd9Sstevel@tonic-gate if (argc > 0 && strcmp(argv[1], "DESC") == 0) {
1787c478bd9Sstevel@tonic-gate fdout = creat(fout, 0666);
1797c478bd9Sstevel@tonic-gate if (fdout < 0) {
1807c478bd9Sstevel@tonic-gate fprintf(stderr, "makedev: can't open %s\n", fout);
1817c478bd9Sstevel@tonic-gate exit(1);
1827c478bd9Sstevel@tonic-gate }
1837c478bd9Sstevel@tonic-gate write(fdout, &dev, sizeof(struct dev));
1847c478bd9Sstevel@tonic-gate write(fdout, size, (dev.nsizes+1) * sizeof(size[0])); /* we need a 0 on the end */
1857c478bd9Sstevel@tonic-gate write(fdout, chtab, dev.nchtab * sizeof(chtab[0]));
1867c478bd9Sstevel@tonic-gate write(fdout, chname, dev.lchname);
1877c478bd9Sstevel@tonic-gate totfont = 0;
1887c478bd9Sstevel@tonic-gate for (i = 0; i < dev.nfonts; i++) {
1897c478bd9Sstevel@tonic-gate totfont += dofont(fname[i]);
1907c478bd9Sstevel@tonic-gate write(fdout, &font, sizeof(struct Font));
1917c478bd9Sstevel@tonic-gate write(fdout, width, font.nwfont & BYTEMASK);
1927c478bd9Sstevel@tonic-gate write(fdout, kern, font.nwfont & BYTEMASK);
1937c478bd9Sstevel@tonic-gate write(fdout, code, font.nwfont & BYTEMASK);
1947c478bd9Sstevel@tonic-gate write(fdout, fitab, dev.nchtab+128-32);
1957c478bd9Sstevel@tonic-gate }
1967c478bd9Sstevel@tonic-gate lseek(fdout, 0L, 0); /* back to beginning to install proper size */
1977c478bd9Sstevel@tonic-gate dev.filesize = /* excluding dev struct itself */
1987c478bd9Sstevel@tonic-gate (dev.nsizes+1) * sizeof(size[0])
1997c478bd9Sstevel@tonic-gate + dev.nchtab * sizeof(chtab[0])
2007c478bd9Sstevel@tonic-gate + dev.lchname * sizeof(char)
2017c478bd9Sstevel@tonic-gate + totfont * sizeof(char);
2027c478bd9Sstevel@tonic-gate write(fdout, &dev, sizeof(struct dev));
2037c478bd9Sstevel@tonic-gate close(fdout);
2047c478bd9Sstevel@tonic-gate argc--;
2057c478bd9Sstevel@tonic-gate argv++;
2067c478bd9Sstevel@tonic-gate }
2077c478bd9Sstevel@tonic-gate for (i = 1; i < argc; i++)
2087c478bd9Sstevel@tonic-gate dofont(argv[i]);
2097c478bd9Sstevel@tonic-gate exit(0);
210*e5190c10Smuffin
211*e5190c10Smuffin return (0);
2127c478bd9Sstevel@tonic-gate }
2137c478bd9Sstevel@tonic-gate
214*e5190c10Smuffin int
dofont(name)2157c478bd9Sstevel@tonic-gate dofont(name) /* create fitab and width tab for font */
2167c478bd9Sstevel@tonic-gate char *name;
2177c478bd9Sstevel@tonic-gate {
2187c478bd9Sstevel@tonic-gate FILE *fin;
2197c478bd9Sstevel@tonic-gate int fdout;
2207c478bd9Sstevel@tonic-gate int i, nw, spacewidth, n, v;
2217c478bd9Sstevel@tonic-gate char buf[100], ch[10], s1[10], s2[10], s3[10], cmd[30];
2227c478bd9Sstevel@tonic-gate
2237c478bd9Sstevel@tonic-gate if ((fin = fopen(name, "r")) == NULL) {
2247c478bd9Sstevel@tonic-gate fprintf(stderr, "makedev: can't open font %s\n", name);
2257c478bd9Sstevel@tonic-gate exit(2);
2267c478bd9Sstevel@tonic-gate }
2277c478bd9Sstevel@tonic-gate sprintf(cmd, "%s.out", name);
2287c478bd9Sstevel@tonic-gate fdout = creat(cmd, 0666);
2297c478bd9Sstevel@tonic-gate for (i = 0; i < NFITAB; i++)
2307c478bd9Sstevel@tonic-gate fitab[i] = 0;
2317c478bd9Sstevel@tonic-gate for (i = 0; i < FSIZE; i++)
2327c478bd9Sstevel@tonic-gate width[i] = kern[i] = code[i] = 0;
2337c478bd9Sstevel@tonic-gate font.specfont = font.ligfont = spacewidth = 0;
2347c478bd9Sstevel@tonic-gate while (fscanf(fin, "%s", cmd) != EOF) {
2357c478bd9Sstevel@tonic-gate if (cmd[0] == '#')
2367c478bd9Sstevel@tonic-gate skipline(fin);
2377c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "name") == 0)
2387c478bd9Sstevel@tonic-gate fscanf(fin, "%s", font.namefont);
2397c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "internalname") == 0)
2407c478bd9Sstevel@tonic-gate fscanf(fin, "%s", font.intname);
2417c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "special") == 0)
2427c478bd9Sstevel@tonic-gate font.specfont = 1;
2437c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "spare1") == 0)
2447c478bd9Sstevel@tonic-gate fscanf(fin, "%1s", &font.spare1);
2457c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "ligatures") == 0) {
2467c478bd9Sstevel@tonic-gate font.ligfont = getlig(fin);
2477c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "spacewidth") == 0) {
2487c478bd9Sstevel@tonic-gate fscanf(fin, "%d", &spacewidth);
2497c478bd9Sstevel@tonic-gate width[0] = spacewidth; /* width of space on this font */
2507c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "charset") == 0) {
2517c478bd9Sstevel@tonic-gate skipline(fin);
2527c478bd9Sstevel@tonic-gate nw = 0;
2537c478bd9Sstevel@tonic-gate /* widths are origin 1 so fitab==0 can mean "not there" */
2547c478bd9Sstevel@tonic-gate while (fgets(buf, 100, fin) != NULL) {
2557c478bd9Sstevel@tonic-gate sscanf(buf, "%s %s %s %s", ch, s1, s2, s3);
2567c478bd9Sstevel@tonic-gate if (s1[0] != '"') { /* it's a genuine new character */
2577c478bd9Sstevel@tonic-gate nw++;
2587c478bd9Sstevel@tonic-gate width[nw] = atoi(s1);
2597c478bd9Sstevel@tonic-gate kern[nw] = atoi(s2);
2607c478bd9Sstevel@tonic-gate /* temporarily, pick up one byte as code */
2617c478bd9Sstevel@tonic-gate if (s3[0] == '0')
2627c478bd9Sstevel@tonic-gate sscanf(s3, "%o", &i);
2637c478bd9Sstevel@tonic-gate else
2647c478bd9Sstevel@tonic-gate sscanf(s3, "%d", &i);
2657c478bd9Sstevel@tonic-gate code[nw] = i;
2667c478bd9Sstevel@tonic-gate }
267*e5190c10Smuffin /*
268*e5190c10Smuffin * otherwise it's a synonym for previous character,
269*e5190c10Smuffin * so leave previous values intact
2707c478bd9Sstevel@tonic-gate */
2717c478bd9Sstevel@tonic-gate if (strlen(ch) == 1) /* it's ascii */
2727c478bd9Sstevel@tonic-gate fitab[ch[0] - 32] = nw; /* fitab origin omits non-graphics */
2737c478bd9Sstevel@tonic-gate else { /* it has a funny name */
2747c478bd9Sstevel@tonic-gate for (i = 0; i < dev.nchtab; i++)
2757c478bd9Sstevel@tonic-gate if (strcmp(&chname[chtab[i]], ch) == 0) {
2767c478bd9Sstevel@tonic-gate fitab[i + 128-32] = nw; /* starts after the ascii */
2777c478bd9Sstevel@tonic-gate break;
2787c478bd9Sstevel@tonic-gate }
2797c478bd9Sstevel@tonic-gate if (i >= dev.nchtab)
2807c478bd9Sstevel@tonic-gate fprintf(stderr, "makedev: font %s: %s not in charset\n", name, ch);
2817c478bd9Sstevel@tonic-gate }
2827c478bd9Sstevel@tonic-gate }
2837c478bd9Sstevel@tonic-gate nw++;
2847c478bd9Sstevel@tonic-gate if (dev.biggestfont >= nw)
2857c478bd9Sstevel@tonic-gate n = dev.biggestfont;
2867c478bd9Sstevel@tonic-gate else {
2877c478bd9Sstevel@tonic-gate if (dev.biggestfont > 0)
2887c478bd9Sstevel@tonic-gate fprintf(stderr, "font %s too big\n", name);
2897c478bd9Sstevel@tonic-gate n = nw;
2907c478bd9Sstevel@tonic-gate }
2917c478bd9Sstevel@tonic-gate font.nwfont = n;
2927c478bd9Sstevel@tonic-gate }
2937c478bd9Sstevel@tonic-gate }
2947c478bd9Sstevel@tonic-gate if (spacewidth == 0)
2957c478bd9Sstevel@tonic-gate width[0] = dev.res * dev.unitwidth / 72 / 3;
2967c478bd9Sstevel@tonic-gate fclose(fin);
2977c478bd9Sstevel@tonic-gate
2987c478bd9Sstevel@tonic-gate write(fdout, &font, sizeof(struct Font));
2997c478bd9Sstevel@tonic-gate write(fdout, width, font.nwfont & BYTEMASK);
3007c478bd9Sstevel@tonic-gate write(fdout, kern, font.nwfont & BYTEMASK);
3017c478bd9Sstevel@tonic-gate write(fdout, code, font.nwfont & BYTEMASK);
3027c478bd9Sstevel@tonic-gate write(fdout, fitab, dev.nchtab+128-32);
3037c478bd9Sstevel@tonic-gate close(fdout);
3047c478bd9Sstevel@tonic-gate v = sizeof(struct Font) + 3 * n + dev.nchtab + 128-32;
3057c478bd9Sstevel@tonic-gate fprintf(stderr, "%3s: %3d chars, width %3d, size %3d\n",
3067c478bd9Sstevel@tonic-gate font.namefont, nw, width[0], v);
3077c478bd9Sstevel@tonic-gate return v;
3087c478bd9Sstevel@tonic-gate }
3097c478bd9Sstevel@tonic-gate
310*e5190c10Smuffin int
getlig(fin)3117c478bd9Sstevel@tonic-gate getlig(fin) /* pick up ligature list */
3127c478bd9Sstevel@tonic-gate FILE *fin;
3137c478bd9Sstevel@tonic-gate {
3147c478bd9Sstevel@tonic-gate int lig;
3157c478bd9Sstevel@tonic-gate char temp[100];
3167c478bd9Sstevel@tonic-gate
3177c478bd9Sstevel@tonic-gate lig = 0;
3187c478bd9Sstevel@tonic-gate while (fscanf(fin, "%s", temp) != EOF && strcmp(temp, "0") != 0) {
3197c478bd9Sstevel@tonic-gate if (strcmp(temp, "fi") == 0)
3207c478bd9Sstevel@tonic-gate lig |= LFI;
3217c478bd9Sstevel@tonic-gate else if (strcmp(temp, "fl") == 0)
3227c478bd9Sstevel@tonic-gate lig |= LFL;
3237c478bd9Sstevel@tonic-gate else if (strcmp(temp, "ff") == 0)
3247c478bd9Sstevel@tonic-gate lig |= LFF;
3257c478bd9Sstevel@tonic-gate else if (strcmp(temp, "ffi") == 0)
3267c478bd9Sstevel@tonic-gate lig |= LFFI;
3277c478bd9Sstevel@tonic-gate else if (strcmp(temp, "ffl") == 0)
3287c478bd9Sstevel@tonic-gate lig |= LFFL;
3297c478bd9Sstevel@tonic-gate else
3307c478bd9Sstevel@tonic-gate fprintf(stderr, "illegal ligature %s\n", temp);
3317c478bd9Sstevel@tonic-gate }
3327c478bd9Sstevel@tonic-gate skipline(fin);
3337c478bd9Sstevel@tonic-gate return lig;
3347c478bd9Sstevel@tonic-gate }
335