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
40*e5190c10Smuffin #pragma ident "%Z%%M% %I% %E% SMI"
41*e5190c10Smuffin
427c478bd9Sstevel@tonic-gate /* Note added 9/25/83
437c478bd9Sstevel@tonic-gate Setting the parameter biggestfont in the DESC file
447c478bd9Sstevel@tonic-gate to be at least as big as the number of characters
457c478bd9Sstevel@tonic-gate in the largest font for a particular device
467c478bd9Sstevel@tonic-gate eliminates the "font X too big for position Y"
477c478bd9Sstevel@tonic-gate message from troff.
487c478bd9Sstevel@tonic-gate Thanks to Dave Stephens, WECo.
497c478bd9Sstevel@tonic-gate */
507c478bd9Sstevel@tonic-gate /*
517c478bd9Sstevel@tonic-gate makedev:
527c478bd9Sstevel@tonic-gate read text info about a particular device
537c478bd9Sstevel@tonic-gate (e.g., cat, 202, aps5) from file, convert
547c478bd9Sstevel@tonic-gate it into internal (binary) form suitable for
557c478bd9Sstevel@tonic-gate fast reading by troff initialization (ptinit()).
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gate Usage:
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gate makedev DESC [ F ... ]
607c478bd9Sstevel@tonic-gate uses DESC to create a description file
617c478bd9Sstevel@tonic-gate using the information therein.
627c478bd9Sstevel@tonic-gate It creates the file DESC.out.
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gate makedev F ...
657c478bd9Sstevel@tonic-gate makes the font tables for fonts F only,
667c478bd9Sstevel@tonic-gate creates files F.out.
677c478bd9Sstevel@tonic-gate
687c478bd9Sstevel@tonic-gate DESC.out contains:
697c478bd9Sstevel@tonic-gate dev structure with fundamental sizes
707c478bd9Sstevel@tonic-gate list of sizes (nsizes+1) terminated by 0, as short's
717c478bd9Sstevel@tonic-gate indices of char names (nchtab * sizeof(short))
727c478bd9Sstevel@tonic-gate char names as hy\0em\0... (lchname)
737c478bd9Sstevel@tonic-gate nfonts occurrences of
747c478bd9Sstevel@tonic-gate widths (nwidth)
757c478bd9Sstevel@tonic-gate kerning (nwidth) [ascender+descender only so far]
767c478bd9Sstevel@tonic-gate codes (nwidth) to drive actual typesetter
777c478bd9Sstevel@tonic-gate fitab (nchtab+128-32)
787c478bd9Sstevel@tonic-gate each of these is an array of char.
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gate dev.filesize contains the number of bytes
817c478bd9Sstevel@tonic-gate in the file, excluding the dev part itself.
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate F.out contains the font header, width, kern, codes, and fitab.
847c478bd9Sstevel@tonic-gate Width, kern and codes are parallel arrays.
857c478bd9Sstevel@tonic-gate (Which suggests that they ought to be together?)
867c478bd9Sstevel@tonic-gate Later, we might allow for codes which are actually
877c478bd9Sstevel@tonic-gate sequences of formatting info so characters can be drawn.
887c478bd9Sstevel@tonic-gate */
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gate #include "stdio.h"
917c478bd9Sstevel@tonic-gate #include "dev.h"
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gate #define BYTEMASK 0377
947c478bd9Sstevel@tonic-gate #define skipline(f) while(getc(f) != '\n')
957c478bd9Sstevel@tonic-gate
967c478bd9Sstevel@tonic-gate struct dev dev;
977c478bd9Sstevel@tonic-gate struct Font font;
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gate #define NSIZE 100 /* maximum number of sizes */
1007c478bd9Sstevel@tonic-gate short size[NSIZE];
1017c478bd9Sstevel@tonic-gate #define NCH 256 /* max number of characters with funny names */
1027c478bd9Sstevel@tonic-gate char chname[5*NCH]; /* character names, including \0 for each */
1037c478bd9Sstevel@tonic-gate short chtab[NCH]; /* index of character in chname */
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gate #define NFITAB (NCH + 128-32) /* includes ascii chars, but not non-graphics */
1067c478bd9Sstevel@tonic-gate char fitab[NFITAB]; /* font index table: position of char i on this font. */
1077c478bd9Sstevel@tonic-gate /* zero if not there */
1087c478bd9Sstevel@tonic-gate
1097c478bd9Sstevel@tonic-gate #define FSIZE 256 /* size of a physical font (e.g., 102 for cat) */
1107c478bd9Sstevel@tonic-gate char width[FSIZE]; /* width table for a physical font */
1117c478bd9Sstevel@tonic-gate char kern[FSIZE]; /* ascender+descender info */
1127c478bd9Sstevel@tonic-gate char code[FSIZE]; /* actual device codes for a physical font */
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gate #define NFONT 60 /* max number of default fonts */
1157c478bd9Sstevel@tonic-gate char fname[NFONT][10]; /* temp space to hold default font names */
1167c478bd9Sstevel@tonic-gate
1177c478bd9Sstevel@tonic-gate int fflag = 0; /* on if font table to be written */
1187c478bd9Sstevel@tonic-gate int fdout; /* output file descriptor */
1197c478bd9Sstevel@tonic-gate char *fout = "DESC.out";
1207c478bd9Sstevel@tonic-gate
main(int argc,char * argv[])1217c478bd9Sstevel@tonic-gate int main(int argc, char *argv[])
1227c478bd9Sstevel@tonic-gate {
1237c478bd9Sstevel@tonic-gate FILE *fin;
1247c478bd9Sstevel@tonic-gate char cmd[100], *p;
1257c478bd9Sstevel@tonic-gate int i, totfont, v;
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate if (argc < 2) {
1287c478bd9Sstevel@tonic-gate fprintf(stderr, "Usage: makedev [DESC] [fonts]\n");
1297c478bd9Sstevel@tonic-gate exit(1);
1307c478bd9Sstevel@tonic-gate }
1317c478bd9Sstevel@tonic-gate
1327c478bd9Sstevel@tonic-gate if ((fin = fopen("DESC", "r")) == NULL) {
1337c478bd9Sstevel@tonic-gate fprintf(stderr, "makedev: can't open %s\n", argv[1]);
1347c478bd9Sstevel@tonic-gate exit(1);
1357c478bd9Sstevel@tonic-gate }
1367c478bd9Sstevel@tonic-gate while (fscanf(fin, "%s", cmd) != EOF) {
1377c478bd9Sstevel@tonic-gate if (cmd[0] == '#') /* comment */
1387c478bd9Sstevel@tonic-gate skipline(fin);
1397c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "res") == 0) {
1407c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.res);
1417c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "hor") == 0) {
1427c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.hor);
1437c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "vert") == 0) {
1447c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.vert);
1457c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "unitwidth") == 0) {
1467c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.unitwidth);
1477c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "sizescale") == 0) {
1487c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.sizescale);
1497c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "paperwidth") == 0) {
1507c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.paperwidth);
1517c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "paperlength") == 0) {
1527c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.paperlength);
1537c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "biggestfont") == 0) {
1547c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.biggestfont);
1557c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "spare2") == 0) {
1567c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.spare2);
1577c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "sizes") == 0) {
1587c478bd9Sstevel@tonic-gate dev.nsizes = 0;
1597c478bd9Sstevel@tonic-gate while (fscanf(fin, "%d", &v) != EOF && v != 0)
1607c478bd9Sstevel@tonic-gate size[dev.nsizes++] = v;
1617c478bd9Sstevel@tonic-gate size[dev.nsizes] = 0; /* need an extra 0 at the end */
1627c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "fonts") == 0) {
1637c478bd9Sstevel@tonic-gate fscanf(fin, "%hd", &dev.nfonts);
1647c478bd9Sstevel@tonic-gate for (i = 0; i < dev.nfonts; i++)
1657c478bd9Sstevel@tonic-gate fscanf(fin, "%s", fname[i]);
1667c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "charset") == 0) {
1677c478bd9Sstevel@tonic-gate p = chname;
1687c478bd9Sstevel@tonic-gate dev.nchtab = 0;
1697c478bd9Sstevel@tonic-gate while (fscanf(fin, "%s", p) != EOF) {
1707c478bd9Sstevel@tonic-gate chtab[dev.nchtab++] = p - chname;
1717c478bd9Sstevel@tonic-gate while (*p++) /* skip to end of name */
1727c478bd9Sstevel@tonic-gate ;
1737c478bd9Sstevel@tonic-gate }
1747c478bd9Sstevel@tonic-gate dev.lchname = p - chname;
1757c478bd9Sstevel@tonic-gate chtab[dev.nchtab++] = 0; /* terminate properly */
1767c478bd9Sstevel@tonic-gate } else
1777c478bd9Sstevel@tonic-gate fprintf(stderr, "makedev: unknown command %s\n", cmd);
1787c478bd9Sstevel@tonic-gate }
1797c478bd9Sstevel@tonic-gate if (argc > 0 && strcmp(argv[1], "DESC") == 0) {
1807c478bd9Sstevel@tonic-gate fdout = creat(fout, 0666);
1817c478bd9Sstevel@tonic-gate if (fdout < 0) {
1827c478bd9Sstevel@tonic-gate fprintf(stderr, "makedev: can't open %s\n", fout);
1837c478bd9Sstevel@tonic-gate exit(1);
1847c478bd9Sstevel@tonic-gate }
1857c478bd9Sstevel@tonic-gate write(fdout, &dev, sizeof(struct dev));
1867c478bd9Sstevel@tonic-gate write(fdout, size, (dev.nsizes+1) * sizeof(size[0])); /* we need a 0 on the end */
1877c478bd9Sstevel@tonic-gate write(fdout, chtab, dev.nchtab * sizeof(chtab[0]));
1887c478bd9Sstevel@tonic-gate write(fdout, chname, dev.lchname);
1897c478bd9Sstevel@tonic-gate totfont = 0;
1907c478bd9Sstevel@tonic-gate for (i = 0; i < dev.nfonts; i++) {
1917c478bd9Sstevel@tonic-gate totfont += dofont(fname[i]);
1927c478bd9Sstevel@tonic-gate write(fdout, &font, sizeof(struct Font));
1937c478bd9Sstevel@tonic-gate write(fdout, width, font.nwfont & BYTEMASK);
1947c478bd9Sstevel@tonic-gate write(fdout, kern, font.nwfont & BYTEMASK);
1957c478bd9Sstevel@tonic-gate write(fdout, code, font.nwfont & BYTEMASK);
1967c478bd9Sstevel@tonic-gate write(fdout, fitab, dev.nchtab+128-32);
1977c478bd9Sstevel@tonic-gate }
1987c478bd9Sstevel@tonic-gate lseek(fdout, 0L, 0); /* back to beginning to install proper size */
1997c478bd9Sstevel@tonic-gate dev.filesize = /* excluding dev struct itself */
2007c478bd9Sstevel@tonic-gate (dev.nsizes+1) * sizeof(size[0])
2017c478bd9Sstevel@tonic-gate + dev.nchtab * sizeof(chtab[0])
2027c478bd9Sstevel@tonic-gate + dev.lchname * sizeof(char)
2037c478bd9Sstevel@tonic-gate + totfont * sizeof(char);
2047c478bd9Sstevel@tonic-gate write(fdout, &dev, sizeof(struct dev));
2057c478bd9Sstevel@tonic-gate close(fdout);
2067c478bd9Sstevel@tonic-gate argc--;
2077c478bd9Sstevel@tonic-gate argv++;
2087c478bd9Sstevel@tonic-gate }
2097c478bd9Sstevel@tonic-gate for (i = 1; i < argc; i++)
2107c478bd9Sstevel@tonic-gate dofont(argv[i]);
2117c478bd9Sstevel@tonic-gate exit(0);
212*e5190c10Smuffin
213*e5190c10Smuffin return (0);
2147c478bd9Sstevel@tonic-gate }
2157c478bd9Sstevel@tonic-gate
216*e5190c10Smuffin int
dofont(name)2177c478bd9Sstevel@tonic-gate dofont(name) /* create fitab and width tab for font */
2187c478bd9Sstevel@tonic-gate char *name;
2197c478bd9Sstevel@tonic-gate {
2207c478bd9Sstevel@tonic-gate FILE *fin;
2217c478bd9Sstevel@tonic-gate int fdout;
2227c478bd9Sstevel@tonic-gate int i, nw, spacewidth, n, v;
2237c478bd9Sstevel@tonic-gate char buf[100], ch[10], s1[10], s2[10], s3[10], cmd[30];
2247c478bd9Sstevel@tonic-gate
2257c478bd9Sstevel@tonic-gate if ((fin = fopen(name, "r")) == NULL) {
2267c478bd9Sstevel@tonic-gate fprintf(stderr, "makedev: can't open font %s\n", name);
2277c478bd9Sstevel@tonic-gate exit(2);
2287c478bd9Sstevel@tonic-gate }
2297c478bd9Sstevel@tonic-gate sprintf(cmd, "%s.out", name);
2307c478bd9Sstevel@tonic-gate fdout = creat(cmd, 0666);
2317c478bd9Sstevel@tonic-gate for (i = 0; i < NFITAB; i++)
2327c478bd9Sstevel@tonic-gate fitab[i] = 0;
2337c478bd9Sstevel@tonic-gate for (i = 0; i < FSIZE; i++)
2347c478bd9Sstevel@tonic-gate width[i] = kern[i] = code[i] = 0;
2357c478bd9Sstevel@tonic-gate font.specfont = font.ligfont = spacewidth = 0;
2367c478bd9Sstevel@tonic-gate while (fscanf(fin, "%s", cmd) != EOF) {
2377c478bd9Sstevel@tonic-gate if (cmd[0] == '#')
2387c478bd9Sstevel@tonic-gate skipline(fin);
2397c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "name") == 0)
2407c478bd9Sstevel@tonic-gate fscanf(fin, "%s", font.namefont);
2417c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "internalname") == 0)
2427c478bd9Sstevel@tonic-gate fscanf(fin, "%s", font.intname);
2437c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "special") == 0)
2447c478bd9Sstevel@tonic-gate font.specfont = 1;
2457c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "spare1") == 0)
2467c478bd9Sstevel@tonic-gate fscanf(fin, "%1s", &font.spare1);
2477c478bd9Sstevel@tonic-gate else if (strcmp(cmd, "ligatures") == 0) {
2487c478bd9Sstevel@tonic-gate font.ligfont = getlig(fin);
2497c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "spacewidth") == 0) {
2507c478bd9Sstevel@tonic-gate fscanf(fin, "%d", &spacewidth);
2517c478bd9Sstevel@tonic-gate width[0] = spacewidth; /* width of space on this font */
2527c478bd9Sstevel@tonic-gate } else if (strcmp(cmd, "charset") == 0) {
2537c478bd9Sstevel@tonic-gate skipline(fin);
2547c478bd9Sstevel@tonic-gate nw = 0;
2557c478bd9Sstevel@tonic-gate /* widths are origin 1 so fitab==0 can mean "not there" */
2567c478bd9Sstevel@tonic-gate while (fgets(buf, 100, fin) != NULL) {
2577c478bd9Sstevel@tonic-gate sscanf(buf, "%s %s %s %s", ch, s1, s2, s3);
2587c478bd9Sstevel@tonic-gate if (s1[0] != '"') { /* it's a genuine new character */
2597c478bd9Sstevel@tonic-gate nw++;
2607c478bd9Sstevel@tonic-gate width[nw] = atoi(s1);
2617c478bd9Sstevel@tonic-gate kern[nw] = atoi(s2);
2627c478bd9Sstevel@tonic-gate /* temporarily, pick up one byte as code */
2637c478bd9Sstevel@tonic-gate if (s3[0] == '0')
2647c478bd9Sstevel@tonic-gate sscanf(s3, "%o", &i);
2657c478bd9Sstevel@tonic-gate else
2667c478bd9Sstevel@tonic-gate sscanf(s3, "%d", &i);
2677c478bd9Sstevel@tonic-gate code[nw] = i;
2687c478bd9Sstevel@tonic-gate }
269*e5190c10Smuffin /*
270*e5190c10Smuffin * otherwise it's a synonym for previous character,
271*e5190c10Smuffin * so leave previous values intact
2727c478bd9Sstevel@tonic-gate */
2737c478bd9Sstevel@tonic-gate if (strlen(ch) == 1) /* it's ascii */
2747c478bd9Sstevel@tonic-gate fitab[ch[0] - 32] = nw; /* fitab origin omits non-graphics */
2757c478bd9Sstevel@tonic-gate else { /* it has a funny name */
2767c478bd9Sstevel@tonic-gate for (i = 0; i < dev.nchtab; i++)
2777c478bd9Sstevel@tonic-gate if (strcmp(&chname[chtab[i]], ch) == 0) {
2787c478bd9Sstevel@tonic-gate fitab[i + 128-32] = nw; /* starts after the ascii */
2797c478bd9Sstevel@tonic-gate break;
2807c478bd9Sstevel@tonic-gate }
2817c478bd9Sstevel@tonic-gate if (i >= dev.nchtab)
2827c478bd9Sstevel@tonic-gate fprintf(stderr, "makedev: font %s: %s not in charset\n", name, ch);
2837c478bd9Sstevel@tonic-gate }
2847c478bd9Sstevel@tonic-gate }
2857c478bd9Sstevel@tonic-gate nw++;
2867c478bd9Sstevel@tonic-gate if (dev.biggestfont >= nw)
2877c478bd9Sstevel@tonic-gate n = dev.biggestfont;
2887c478bd9Sstevel@tonic-gate else {
2897c478bd9Sstevel@tonic-gate if (dev.biggestfont > 0)
2907c478bd9Sstevel@tonic-gate fprintf(stderr, "font %s too big\n", name);
2917c478bd9Sstevel@tonic-gate n = nw;
2927c478bd9Sstevel@tonic-gate }
2937c478bd9Sstevel@tonic-gate font.nwfont = n;
2947c478bd9Sstevel@tonic-gate }
2957c478bd9Sstevel@tonic-gate }
2967c478bd9Sstevel@tonic-gate if (spacewidth == 0)
2977c478bd9Sstevel@tonic-gate width[0] = dev.res * dev.unitwidth / 72 / 3;
2987c478bd9Sstevel@tonic-gate fclose(fin);
2997c478bd9Sstevel@tonic-gate
3007c478bd9Sstevel@tonic-gate write(fdout, &font, sizeof(struct Font));
3017c478bd9Sstevel@tonic-gate write(fdout, width, font.nwfont & BYTEMASK);
3027c478bd9Sstevel@tonic-gate write(fdout, kern, font.nwfont & BYTEMASK);
3037c478bd9Sstevel@tonic-gate write(fdout, code, font.nwfont & BYTEMASK);
3047c478bd9Sstevel@tonic-gate write(fdout, fitab, dev.nchtab+128-32);
3057c478bd9Sstevel@tonic-gate close(fdout);
3067c478bd9Sstevel@tonic-gate v = sizeof(struct Font) + 3 * n + dev.nchtab + 128-32;
3077c478bd9Sstevel@tonic-gate fprintf(stderr, "%3s: %3d chars, width %3d, size %3d\n",
3087c478bd9Sstevel@tonic-gate font.namefont, nw, width[0], v);
3097c478bd9Sstevel@tonic-gate return v;
3107c478bd9Sstevel@tonic-gate }
3117c478bd9Sstevel@tonic-gate
312*e5190c10Smuffin int
getlig(fin)3137c478bd9Sstevel@tonic-gate getlig(fin) /* pick up ligature list */
3147c478bd9Sstevel@tonic-gate FILE *fin;
3157c478bd9Sstevel@tonic-gate {
3167c478bd9Sstevel@tonic-gate int lig;
3177c478bd9Sstevel@tonic-gate char temp[100];
3187c478bd9Sstevel@tonic-gate
3197c478bd9Sstevel@tonic-gate lig = 0;
3207c478bd9Sstevel@tonic-gate while (fscanf(fin, "%s", temp) != EOF && strcmp(temp, "0") != 0) {
3217c478bd9Sstevel@tonic-gate if (strcmp(temp, "fi") == 0)
3227c478bd9Sstevel@tonic-gate lig |= LFI;
3237c478bd9Sstevel@tonic-gate else if (strcmp(temp, "fl") == 0)
3247c478bd9Sstevel@tonic-gate lig |= LFL;
3257c478bd9Sstevel@tonic-gate else if (strcmp(temp, "ff") == 0)
3267c478bd9Sstevel@tonic-gate lig |= LFF;
3277c478bd9Sstevel@tonic-gate else if (strcmp(temp, "ffi") == 0)
3287c478bd9Sstevel@tonic-gate lig |= LFFI;
3297c478bd9Sstevel@tonic-gate else if (strcmp(temp, "ffl") == 0)
3307c478bd9Sstevel@tonic-gate lig |= LFFL;
3317c478bd9Sstevel@tonic-gate else
3327c478bd9Sstevel@tonic-gate fprintf(stderr, "illegal ligature %s\n", temp);
3337c478bd9Sstevel@tonic-gate }
3347c478bd9Sstevel@tonic-gate skipline(fin);
3357c478bd9Sstevel@tonic-gate return lig;
3367c478bd9Sstevel@tonic-gate }
337