xref: /minix3/minix/commands/cawf/nreq.c (revision d0055759dd8892194db7fce6acc5085d5c9aeaee)
1433d6423SLionel Sambuc /*
2433d6423SLionel Sambuc  *	nreq.c - cawf(1) processing of nroff requests
3433d6423SLionel Sambuc  */
4433d6423SLionel Sambuc 
5433d6423SLionel Sambuc /*
6433d6423SLionel Sambuc  *	Copyright (c) 1991 Purdue University Research Foundation,
7433d6423SLionel Sambuc  *	West Lafayette, Indiana 47907.  All rights reserved.
8433d6423SLionel Sambuc  *
9433d6423SLionel Sambuc  *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
10433d6423SLionel Sambuc  *	University Computing Center.  Not derived from licensed software;
11433d6423SLionel Sambuc  *	derived from awf(1) by Henry Spencer of the University of Toronto.
12433d6423SLionel Sambuc  *
13433d6423SLionel Sambuc  *	Permission is granted to anyone to use this software for any
14433d6423SLionel Sambuc  *	purpose on any computer system, and to alter it and redistribute
15433d6423SLionel Sambuc  *	it freely, subject to the following restrictions:
16433d6423SLionel Sambuc  *
17433d6423SLionel Sambuc  *	1. The author is not responsible for any consequences of use of
18433d6423SLionel Sambuc  *	   this software, even if they arise from flaws in it.
19433d6423SLionel Sambuc  *
20433d6423SLionel Sambuc  *	2. The origin of this software must not be misrepresented, either
21433d6423SLionel Sambuc  *	   by explicit claim or by omission.  Credits must appear in the
22433d6423SLionel Sambuc  *	   documentation.
23433d6423SLionel Sambuc  *
24433d6423SLionel Sambuc  *	3. Altered versions must be plainly marked as such, and must not
25433d6423SLionel Sambuc  *	   be misrepresented as being the original software.  Credits must
26433d6423SLionel Sambuc  *	   appear in the documentation.
27433d6423SLionel Sambuc  *
28433d6423SLionel Sambuc  *	4. This notice may not be removed or altered.
29433d6423SLionel Sambuc  */
30433d6423SLionel Sambuc 
31433d6423SLionel Sambuc #include "cawf.h"
32433d6423SLionel Sambuc #include <ctype.h>
33433d6423SLionel Sambuc 
34433d6423SLionel Sambuc 
35433d6423SLionel Sambuc /*
36433d6423SLionel Sambuc  * Prototypes for request processing functions.
37433d6423SLionel Sambuc  */
38433d6423SLionel Sambuc 
39433d6423SLionel Sambuc static void nr_UL(unsigned char *line, int brk);
40433d6423SLionel Sambuc static void nr_Ub(unsigned char *line, int brk);
41433d6423SLionel Sambuc static void nr_Uc(unsigned char *line, int brk);
42433d6423SLionel Sambuc static void nr_Uf(unsigned char *line, int brk);
43433d6423SLionel Sambuc static void nr_Ur(unsigned char *line, int brk);
44433d6423SLionel Sambuc static void nr_ad(unsigned char *line, int brk);
45433d6423SLionel Sambuc static void nr_bp(unsigned char *line, int brk);
46433d6423SLionel Sambuc static void nr_br(unsigned char *line, int brk);
47433d6423SLionel Sambuc static void nr_ce(unsigned char *line, int brk);
48433d6423SLionel Sambuc static void nr_di(unsigned char *line, int brk);
49433d6423SLionel Sambuc static void nr_ds(unsigned char *line, int brk);
50433d6423SLionel Sambuc static void nr_fi(unsigned char *line, int brk);
51433d6423SLionel Sambuc static void nr_fl(unsigned char *line, int brk);
52433d6423SLionel Sambuc static void nr_ft(unsigned char *line, int brk);
53433d6423SLionel Sambuc static void nr_it(unsigned char *line, int brk);
54433d6423SLionel Sambuc static void nr_na(unsigned char *line, int brk);
55433d6423SLionel Sambuc static void nr_nf(unsigned char *line, int brk);
56433d6423SLionel Sambuc static void nr_ns(unsigned char *line, int brk);
57433d6423SLionel Sambuc static void nr_rm(unsigned char *line, int brk);
58433d6423SLionel Sambuc static void nr_rn(unsigned char *line, int brk);
59433d6423SLionel Sambuc static void nr_rr(unsigned char *line, int brk);
60433d6423SLionel Sambuc static void nr_rs(unsigned char *line, int brk);
61433d6423SLionel Sambuc static void nr_tm(unsigned char *line, int brk);
62433d6423SLionel Sambuc static void nr_tr(unsigned char *line, int brk);
63433d6423SLionel Sambuc 
64433d6423SLionel Sambuc static void nr_nil(unsigned char *line, int brk);
65433d6423SLionel Sambuc 
66433d6423SLionel Sambuc 
67433d6423SLionel Sambuc /*
68433d6423SLionel Sambuc  * NrReqt[] - nroff request processing table
69433d6423SLionel Sambuc  *
70433d6423SLionel Sambuc  * CAUTION: place new entries in their proper alphabetical order, since
71433d6423SLionel Sambuc  *	    this table is processed with a binary search.
72433d6423SLionel Sambuc  */
73433d6423SLionel Sambuc 
74433d6423SLionel Sambuc static struct nr_req {
75433d6423SLionel Sambuc 	char *nm;			/* nroff request */
76433d6423SLionel Sambuc 	void (*fun)();			/* processing function */
77433d6423SLionel Sambuc } NrReqt[] = {
78433d6423SLionel Sambuc 	{ "\\\"",	nr_nil },	/* backslash-quote */
79433d6423SLionel Sambuc 	{ "^#",		nr_UL  },
80433d6423SLionel Sambuc 	{ "^=",		nr_UL  },
81433d6423SLionel Sambuc 	{ "^b",		nr_Ub  },
82433d6423SLionel Sambuc 	{ "^c",		nr_Uc  },
83433d6423SLionel Sambuc 	{ "^d",		nr_nil },
84433d6423SLionel Sambuc 	{ "^e",		nr_nil },
85433d6423SLionel Sambuc 	{ "^f",		nr_Uf  },
86433d6423SLionel Sambuc 	{ "^r",		nr_Ur  },
87433d6423SLionel Sambuc 	{ "^x",		nr_nil },
88433d6423SLionel Sambuc 	{ "ad",		nr_ad  },
89433d6423SLionel Sambuc 	{ "bp",		nr_bp  },
90433d6423SLionel Sambuc 	{ "br",		nr_br  },
91433d6423SLionel Sambuc 	{ "ce",		nr_ce  },
92433d6423SLionel Sambuc 	{ "di",		nr_di  },
93433d6423SLionel Sambuc 	{ "ds",		nr_ds  },
94433d6423SLionel Sambuc 	{ "fi",		nr_fi  },
95433d6423SLionel Sambuc 	{ "fl",		nr_fl  },
96433d6423SLionel Sambuc 	{ "ft",		nr_ft  },
97433d6423SLionel Sambuc 	{ "hy",		nr_nil },
98433d6423SLionel Sambuc 	{ "i0",		nr_nil },
99433d6423SLionel Sambuc 	{ "it",		nr_it  },
100433d6423SLionel Sambuc 	{ "lg",		nr_nil },
101433d6423SLionel Sambuc 	{ "li",		nr_nil },
102433d6423SLionel Sambuc 	{ "na",		nr_na  },
103433d6423SLionel Sambuc 	{ "nf",		nr_nf  },
104433d6423SLionel Sambuc 	{ "ns",		nr_ns  },
105433d6423SLionel Sambuc 	{ "ps",		nr_nil },
106433d6423SLionel Sambuc 	{ "rm",		nr_rm  },
107433d6423SLionel Sambuc 	{ "rn",		nr_rn  },
108433d6423SLionel Sambuc 	{ "rr",		nr_rr  },
109433d6423SLionel Sambuc 	{ "rs",		nr_rs  },
110433d6423SLionel Sambuc 	{ "tm",		nr_tm  },
111433d6423SLionel Sambuc 	{ "tr",		nr_tr  },
112433d6423SLionel Sambuc 	{ "vs",		nr_nil },
113433d6423SLionel Sambuc };
114433d6423SLionel Sambuc /*
115433d6423SLionel Sambuc  * Nreq(line, brk) - process miscellaneous nroff requests from line
116433d6423SLionel Sambuc  *		     buffer with request status of (brk)
117433d6423SLionel Sambuc  */
118433d6423SLionel Sambuc 
Nreq(unsigned char * line,int brk)119d9494baaSJacob Adams void Nreq(unsigned char *line, int brk) {
120433d6423SLionel Sambuc 	unsigned char c[3];		/* command buffer */
121433d6423SLionel Sambuc 	int cmp, hi, low, mid;		/* binary search indixes */
122433d6423SLionel Sambuc 
123433d6423SLionel Sambuc 	c[0] = c[1] = c[2] = '\0';
124433d6423SLionel Sambuc 	if ((c[0] = line[1]) != '\0')
125433d6423SLionel Sambuc 		c[1] = line[2];
126433d6423SLionel Sambuc 
127433d6423SLionel Sambuc 	low = mid = 0;
128433d6423SLionel Sambuc 	hi = sizeof(NrReqt) / sizeof(struct nr_req);
129433d6423SLionel Sambuc 	while (low <= hi) {
130433d6423SLionel Sambuc 		mid = (low + hi) / 2;
131433d6423SLionel Sambuc 		if ((cmp = strcmp((char *)c, NrReqt[mid].nm)) < 0)
132433d6423SLionel Sambuc 			hi = mid - 1;
133433d6423SLionel Sambuc 		else if (cmp > 0)
134433d6423SLionel Sambuc 			low = mid + 1;
135433d6423SLionel Sambuc 		else {
136433d6423SLionel Sambuc 			(void) (*NrReqt[mid].fun)(line, brk);
137433d6423SLionel Sambuc 			return;
138433d6423SLionel Sambuc 		}
139433d6423SLionel Sambuc 	}
140433d6423SLionel Sambuc     /*
141433d6423SLionel Sambuc      * Unknown request starting with a '.' or '\''..
142433d6423SLionel Sambuc      */
143433d6423SLionel Sambuc 	Error(WARN, LINE, " unknown request", NULL);
144433d6423SLionel Sambuc }
145433d6423SLionel Sambuc 
146433d6423SLionel Sambuc 
147433d6423SLionel Sambuc /*
148433d6423SLionel Sambuc  * Adjust - "^[.']ad"
149433d6423SLionel Sambuc  */
150433d6423SLionel Sambuc 
nr_ad(unsigned char * line,int brk)151d9494baaSJacob Adams static void nr_ad(unsigned char *line, int brk) {
152433d6423SLionel Sambuc 	Pass3(NOBREAK, (unsigned char *)"both", NULL, 0);
153433d6423SLionel Sambuc }
154433d6423SLionel Sambuc 
155433d6423SLionel Sambuc 
156433d6423SLionel Sambuc /*
157433d6423SLionel Sambuc * Begin new page - "^[.']bp"
158433d6423SLionel Sambuc */
159433d6423SLionel Sambuc 
nr_bp(unsigned char * line,int brk)160d9494baaSJacob Adams static void nr_bp(unsigned char *line, int brk) {
161433d6423SLionel Sambuc 	Pass3(brk, (unsigned char *)"need", NULL, 999);
162433d6423SLionel Sambuc }
163433d6423SLionel Sambuc 
164433d6423SLionel Sambuc 
165433d6423SLionel Sambuc /*
166433d6423SLionel Sambuc * Break - "^[.']br"
167433d6423SLionel Sambuc */
168433d6423SLionel Sambuc 
nr_br(unsigned char * line,int brk)169d9494baaSJacob Adams static void nr_br(unsigned char *line, int brk) {
170433d6423SLionel Sambuc 	Pass3(brk, (unsigned char *)"flush", NULL, 0);
171433d6423SLionel Sambuc }
172433d6423SLionel Sambuc 
173433d6423SLionel Sambuc 
174433d6423SLionel Sambuc /*
175433d6423SLionel Sambuc  * Center - "^[.']ce"
176433d6423SLionel Sambuc  */
177433d6423SLionel Sambuc 
nr_ce(unsigned char * line,int brk)178d9494baaSJacob Adams static void nr_ce(unsigned char *line, int brk) {
179433d6423SLionel Sambuc 	unsigned char *s;			/* string poiner */
180433d6423SLionel Sambuc 
181433d6423SLionel Sambuc 	if ((s = Field(2, line, 0)) != NULL)
182433d6423SLionel Sambuc 		Centering = atoi((char *)s);
183433d6423SLionel Sambuc 	else
184433d6423SLionel Sambuc 		Centering = 1;
185433d6423SLionel Sambuc }
186433d6423SLionel Sambuc 
187433d6423SLionel Sambuc 
188433d6423SLionel Sambuc /*
189433d6423SLionel Sambuc  * Diversion on and off - "^[.']di"
190433d6423SLionel Sambuc  */
191433d6423SLionel Sambuc 
nr_di(unsigned char * line,int brk)192d9494baaSJacob Adams static void nr_di(unsigned char *line, int brk) {
193433d6423SLionel Sambuc 	Pass3(DOBREAK, (unsigned char *)"flush", NULL, 0);
194433d6423SLionel Sambuc 	Divert ^= 1;
195433d6423SLionel Sambuc }
196433d6423SLionel Sambuc 
197433d6423SLionel Sambuc 
198433d6423SLionel Sambuc /*
199433d6423SLionel Sambuc  * Define string - "^[.']ds"
200433d6423SLionel Sambuc  */
201433d6423SLionel Sambuc 
nr_ds(unsigned char * line,int brk)202d9494baaSJacob Adams static void nr_ds(unsigned char *line, int brk) {
203433d6423SLionel Sambuc 	unsigned char buf[MAXLINE];	/* temporary buffer */
204433d6423SLionel Sambuc 	unsigned char nm[4], nm1[4];	/* name buffers */
205433d6423SLionel Sambuc 	unsigned char *s1, *s2, *s3,	/* temporary string pointers */
206433d6423SLionel Sambuc 		       *s4;
207433d6423SLionel Sambuc 
208433d6423SLionel Sambuc 	if (Asmname(&line[3], nm) == 0) {
209433d6423SLionel Sambuc 		Error(WARN, LINE, " no name", NULL);
210433d6423SLionel Sambuc 		return;
211433d6423SLionel Sambuc 	}
212433d6423SLionel Sambuc 	s1 = Field(3, line, 0);
213433d6423SLionel Sambuc 	s2 = Findstr(nm, s1, 1);
214433d6423SLionel Sambuc 	while (*s2 == '\\' && *(s2 + 1) == '*') {
215433d6423SLionel Sambuc 		s2++;
216433d6423SLionel Sambuc 		s3 = Asmcode(&s2, nm1);
217433d6423SLionel Sambuc 		s2 = Findstr(nm1, NULL, 0);
218433d6423SLionel Sambuc 	}
219433d6423SLionel Sambuc 	if (Hdft) {
220433d6423SLionel Sambuc 
221433d6423SLionel Sambuc 	/*
222433d6423SLionel Sambuc 	 * Look for names LH, LF, CH, CF, RH, RF.
223433d6423SLionel Sambuc 	 */
224433d6423SLionel Sambuc 		if ((nm[0]=='L' || nm[0]=='C' || nm[0]=='R')
225433d6423SLionel Sambuc 		&&  (nm[1]=='F' || nm[1]=='H')) {
226433d6423SLionel Sambuc 			(void) sprintf((char *)buf, "%s", (char *)nm);
227433d6423SLionel Sambuc 			Pass3(NOBREAK, buf, s2, 0);
228433d6423SLionel Sambuc 		}
229433d6423SLionel Sambuc 	}
230433d6423SLionel Sambuc }
231433d6423SLionel Sambuc 
232433d6423SLionel Sambuc 
233433d6423SLionel Sambuc 
234433d6423SLionel Sambuc /*
235433d6423SLionel Sambuc  * Fill - "^[.']fi"
236433d6423SLionel Sambuc  */
237433d6423SLionel Sambuc 
nr_fi(unsigned char * line,int brk)238d9494baaSJacob Adams static void nr_fi(unsigned char *line, int brk) {
239433d6423SLionel Sambuc 	Fill = 1;
240433d6423SLionel Sambuc 	Pass3(brk, (unsigned char *)"flush", NULL, 0);
241433d6423SLionel Sambuc }
242433d6423SLionel Sambuc 
243433d6423SLionel Sambuc 
244433d6423SLionel Sambuc /*
245433d6423SLionel Sambuc  * Flush - "^[.']fl"
246433d6423SLionel Sambuc  */
247433d6423SLionel Sambuc 
nr_fl(unsigned char * line,int brk)248d9494baaSJacob Adams static void nr_fl(unsigned char *line, int brk) {
249433d6423SLionel Sambuc 	Pass3(brk, (unsigned char *)"flush", NULL, 0);
250433d6423SLionel Sambuc }
251433d6423SLionel Sambuc 
252433d6423SLionel Sambuc 
253433d6423SLionel Sambuc /*
254433d6423SLionel Sambuc  * Font - "^[.']ft <font_name>"
255433d6423SLionel Sambuc  */
256433d6423SLionel Sambuc 
nr_ft(unsigned char * line,int brk)257d9494baaSJacob Adams static void nr_ft(unsigned char *line, int brk) {
258433d6423SLionel Sambuc 	int i;				/* temporary index */
259433d6423SLionel Sambuc 
260433d6423SLionel Sambuc 	if (line[3] == '\0' || line[4] == '\0')
261433d6423SLionel Sambuc 		line[4] = 'P';
262433d6423SLionel Sambuc 	if (line[4] == 'P') {
263433d6423SLionel Sambuc 		Font[0] = Prevfont;
264433d6423SLionel Sambuc 		return;
265433d6423SLionel Sambuc 	}
266433d6423SLionel Sambuc 	for (i = 0; Fcode[i].nm; i++) {
267433d6423SLionel Sambuc 		if (Fcode[i].nm == line[4])
268433d6423SLionel Sambuc 		break;
269433d6423SLionel Sambuc 	}
270433d6423SLionel Sambuc 	if (Fcode[i].status == '\0') {
271433d6423SLionel Sambuc 		Error(WARN, LINE, " bad font code", NULL);
272433d6423SLionel Sambuc 		return;
273433d6423SLionel Sambuc 	}
274433d6423SLionel Sambuc 	Prevfont = Font[0];
275433d6423SLionel Sambuc 	Font[0] = line[4];
276433d6423SLionel Sambuc }
277433d6423SLionel Sambuc 
278433d6423SLionel Sambuc 
279433d6423SLionel Sambuc /*
280433d6423SLionel Sambuc  * Input trap - "^[.']it [1 <request>]"
281433d6423SLionel Sambuc  */
282433d6423SLionel Sambuc 
nr_it(unsigned char * line,int brk)283d9494baaSJacob Adams static void nr_it(unsigned char *line, int brk) {
284433d6423SLionel Sambuc 	unsigned char buf[MAXLINE];	/* temporary buffer */
285433d6423SLionel Sambuc 	int i;				/* temporary index */
286433d6423SLionel Sambuc 	unsigned char *s1, *s2;		/* temporary string pointers */
287433d6423SLionel Sambuc 
288433d6423SLionel Sambuc 	if ((s1 = Field(2, line, 0)) == NULL) {
289433d6423SLionel Sambuc 		Free(&Aftnxt);
290433d6423SLionel Sambuc 		return;
291433d6423SLionel Sambuc 	}
292433d6423SLionel Sambuc 	if ((i = atoi((char *)s1)) != 1) {
293433d6423SLionel Sambuc 		Error(WARN, LINE, " first .it arg must be 1", NULL);
294433d6423SLionel Sambuc 		return;
295433d6423SLionel Sambuc 	}
296433d6423SLionel Sambuc 	if ((s2 = Field(3, line, 0)) == NULL)
297433d6423SLionel Sambuc 		Free(&Aftnxt);
298433d6423SLionel Sambuc 	else {
299433d6423SLionel Sambuc 		(void) sprintf((char *)buf, "%s,%s",
300433d6423SLionel Sambuc 			(Aftnxt == NULL) ? "" : (char *)Aftnxt,
301433d6423SLionel Sambuc 			(char *)s2);
302433d6423SLionel Sambuc 		Free(&Aftnxt);
303433d6423SLionel Sambuc 		Aftnxt = Newstr(buf);
304433d6423SLionel Sambuc 	}
305433d6423SLionel Sambuc }
306433d6423SLionel Sambuc 
307433d6423SLionel Sambuc 
308433d6423SLionel Sambuc /*
309433d6423SLionel Sambuc  * Comment - "^[.']\\" - do nothing
310433d6423SLionel Sambuc  *
311433d6423SLionel Sambuc  * Debug - "^[.']\^d" - do nothing
312433d6423SLionel Sambuc  *
313433d6423SLionel Sambuc  * Finalization - "[.']\^e" - do nothing
314433d6423SLionel Sambuc  *
315433d6423SLionel Sambuc  * Error file - "^[.']\^x <name>" - do nothing
316433d6423SLionel Sambuc  *
317433d6423SLionel Sambuc  * "^[.']i0", "^[.']lg" and "^[.']li" - do nothing
318433d6423SLionel Sambuc  *
319433d6423SLionel Sambuc  * Point size - "^[.']ps" - do nothing
320433d6423SLionel Sambuc  *
321433d6423SLionel Sambuc  * Vertical spacing - "^[.']vs" - do nothing
322433d6423SLionel Sambuc  *
323433d6423SLionel Sambuc  */
324433d6423SLionel Sambuc 
nr_nil(unsigned char * line,int brk)325d9494baaSJacob Adams static void nr_nil(unsigned char *line, int brk) {
326433d6423SLionel Sambuc }
327433d6423SLionel Sambuc 
328433d6423SLionel Sambuc 
329433d6423SLionel Sambuc /*
330433d6423SLionel Sambuc  * No adjust "^[.']na"
331433d6423SLionel Sambuc  */
332433d6423SLionel Sambuc 
nr_na(unsigned char * line,int brk)333d9494baaSJacob Adams static void nr_na(unsigned char *line, int brk) {
334433d6423SLionel Sambuc 	Pass3(NOBREAK, (unsigned char *)"left", NULL, 0);
335433d6423SLionel Sambuc }
336433d6423SLionel Sambuc 
337433d6423SLionel Sambuc 
338433d6423SLionel Sambuc /*
339433d6423SLionel Sambuc  * No fill - "^[.']nf"
340433d6423SLionel Sambuc  */
341433d6423SLionel Sambuc 
nr_nf(unsigned char * line,int brk)342d9494baaSJacob Adams static void nr_nf(unsigned char *line, int brk) {
343433d6423SLionel Sambuc 	Fill = 0;
344433d6423SLionel Sambuc 	Pass3(brk, (unsigned char *)"flush", NULL, 0);
345433d6423SLionel Sambuc }
346433d6423SLionel Sambuc 
347433d6423SLionel Sambuc 
348433d6423SLionel Sambuc /*
349433d6423SLionel Sambuc  * No space - "^[.']ns"
350433d6423SLionel Sambuc  */
351433d6423SLionel Sambuc 
nr_ns(unsigned char * line,int brk)352d9494baaSJacob Adams static void nr_ns(unsigned char *line, int brk) {
353433d6423SLionel Sambuc 	Pass3(NOBREAK, (unsigned char *)"nospace", NULL, 0);
354433d6423SLionel Sambuc }
355433d6423SLionel Sambuc 
356433d6423SLionel Sambuc 
357433d6423SLionel Sambuc /*
358433d6423SLionel Sambuc  * Remove macro or string - "^[.']rm"
359433d6423SLionel Sambuc  */
360433d6423SLionel Sambuc 
nr_rm(unsigned char * line,int brk)361d9494baaSJacob Adams static void nr_rm(unsigned char *line, int brk) {
362433d6423SLionel Sambuc 	int i;				/* temporary index */
363433d6423SLionel Sambuc 	unsigned char nm[4];		/* name buffer */
364433d6423SLionel Sambuc 
365433d6423SLionel Sambuc 	if (Asmname(&line[3], nm) == 0) {
366433d6423SLionel Sambuc 		Error(WARN, LINE, " no name", NULL);
367433d6423SLionel Sambuc 		return;
368433d6423SLionel Sambuc 	}
369433d6423SLionel Sambuc 	if ((i = Findmacro(nm, 0)) >= 0) {
370433d6423SLionel Sambuc 		Delmacro(i);
371433d6423SLionel Sambuc 		return;
372433d6423SLionel Sambuc 			}
373433d6423SLionel Sambuc 	(void) Findstr(nm, NULL, 0);
374433d6423SLionel Sambuc 		if (Sx >= 0) {
375433d6423SLionel Sambuc 			Delstr(Sx);
376433d6423SLionel Sambuc 			return;
377433d6423SLionel Sambuc 	}
378433d6423SLionel Sambuc 	Error(WARN, LINE, " no macro/string", NULL);
379433d6423SLionel Sambuc }
380433d6423SLionel Sambuc 
381433d6423SLionel Sambuc 
382433d6423SLionel Sambuc /*
383433d6423SLionel Sambuc  * Rename macro or string - "^[.']rn"
384433d6423SLionel Sambuc  */
385433d6423SLionel Sambuc 
nr_rn(unsigned char * line,int brk)386d9494baaSJacob Adams static void nr_rn(unsigned char *line, int brk) {
387433d6423SLionel Sambuc 	int i, j;			/* temporary indexes */
388433d6423SLionel Sambuc 	unsigned char nm[4], nm1[4];	/* name buffers */
389433d6423SLionel Sambuc 	unsigned char *s1;		/* temporary string pointer */
390433d6423SLionel Sambuc 
391433d6423SLionel Sambuc 	if ((s1 = Field(2, line, 0)) == NULL ||  Asmname(s1, nm) == 0) {
392433d6423SLionel Sambuc 		Error(WARN, LINE, " no name", NULL);
393433d6423SLionel Sambuc 		return;
394433d6423SLionel Sambuc 	}
395433d6423SLionel Sambuc 	if ((s1 = Field(3, line, 0)) == NULL ||  Asmname(s1, nm1) == 0) {
396433d6423SLionel Sambuc 		Error(WARN, LINE, " no new name", NULL);
397433d6423SLionel Sambuc 		return;
398433d6423SLionel Sambuc 	}
399433d6423SLionel Sambuc 	if ((i = Findmacro(nm, 0)) >= 0) {
400433d6423SLionel Sambuc 		if ((j = Findmacro(nm1, 0)) >= 0)
401433d6423SLionel Sambuc 			Delmacro(j);
402433d6423SLionel Sambuc 		j = Findmacro(nm1, 1);
403433d6423SLionel Sambuc 		Macrotab[j].bx = Macrotab[i].bx;
404433d6423SLionel Sambuc 		Macrotab[i].bx = -1;
405433d6423SLionel Sambuc 		Macrotab[j].ct = Macrotab[i].ct;
406433d6423SLionel Sambuc 		Macrotab[i].ct = 0;
407433d6423SLionel Sambuc 		Delmacro(i);
408433d6423SLionel Sambuc 		return;
409433d6423SLionel Sambuc 	}
410433d6423SLionel Sambuc 	(void) Findstr(nm, NULL, 0);
411433d6423SLionel Sambuc 	if ((i = Sx) >= 0) {
412433d6423SLionel Sambuc 		(void) Findstr(nm1, Str[i].str, 1);
413433d6423SLionel Sambuc 		Delstr(i);
414433d6423SLionel Sambuc 		return;
415433d6423SLionel Sambuc 	}
416433d6423SLionel Sambuc 	if (Findmacro(nm1, 0) < 0)
417433d6423SLionel Sambuc 		(void) Findmacro(nm1, 1);
418433d6423SLionel Sambuc }
419433d6423SLionel Sambuc 
420433d6423SLionel Sambuc 
421433d6423SLionel Sambuc /*
422433d6423SLionel Sambuc  * Remove register - "^[.']rr"
423433d6423SLionel Sambuc  */
424433d6423SLionel Sambuc 
nr_rr(unsigned char * line,int brk)425d9494baaSJacob Adams static void nr_rr(unsigned char *line, int brk) {
426433d6423SLionel Sambuc 	int i;				/* temporary index */
427433d6423SLionel Sambuc 	unsigned char nm[4];		/* name buffer */
428433d6423SLionel Sambuc 
429433d6423SLionel Sambuc 	if (Asmname(&line[3], nm) == 0) {
430433d6423SLionel Sambuc 		Error(WARN, LINE, " no name", NULL);
431433d6423SLionel Sambuc 		return;
432433d6423SLionel Sambuc 	}
433433d6423SLionel Sambuc 	if ((i = Findnum(nm, 0, 0)) < 0) {
434433d6423SLionel Sambuc 		Error(WARN, LINE, " no register", NULL);
435433d6423SLionel Sambuc 		return;
436433d6423SLionel Sambuc 	}
437433d6423SLionel Sambuc 	Delnum(i);
438433d6423SLionel Sambuc }
439433d6423SLionel Sambuc 
440433d6423SLionel Sambuc 
441433d6423SLionel Sambuc /*
442433d6423SLionel Sambuc  * Resume space - "^[.']rs"
443433d6423SLionel Sambuc  */
444433d6423SLionel Sambuc 
nr_rs(unsigned char * line,int brk)445d9494baaSJacob Adams static void nr_rs(unsigned char *line, int brk) {
446433d6423SLionel Sambuc 	Pass3(NOBREAK, (unsigned char *)"yesspace", NULL, 0);
447433d6423SLionel Sambuc }
448433d6423SLionel Sambuc 
449433d6423SLionel Sambuc 
450433d6423SLionel Sambuc /*
451433d6423SLionel Sambuc  * Message - "^[.']tm"
452433d6423SLionel Sambuc  */
453433d6423SLionel Sambuc 
nr_tm(unsigned char * line,int brk)454d9494baaSJacob Adams static void nr_tm(unsigned char *line, int brk) {
455433d6423SLionel Sambuc 	Pass3(MESSAGE, Inname, (line[3] == ' ') ? &line[4] : &line[3], NR);
456433d6423SLionel Sambuc }
457433d6423SLionel Sambuc 
458433d6423SLionel Sambuc 
459433d6423SLionel Sambuc /*
460433d6423SLionel Sambuc  * Translate - "^[.']tr abcd..."
461433d6423SLionel Sambuc  */
462433d6423SLionel Sambuc 
nr_tr(unsigned char * line,int brk)463d9494baaSJacob Adams static void nr_tr(unsigned char *line, int brk) {
464433d6423SLionel Sambuc 	unsigned char buf[MAXLINE];	/* temporary buffer */
465433d6423SLionel Sambuc 	int i, j;			/* temporary indexes */
466433d6423SLionel Sambuc 	unsigned char nm[4], nm1[4];	/* name buffers */
467433d6423SLionel Sambuc 	unsigned char *s1, *s2;		/* temporary string pointers */
468433d6423SLionel Sambuc 	int trin, trout;		/* types: 0 = char; 1 = named char */
469433d6423SLionel Sambuc 	unsigned char xbuf[MAXLINE];	/* temporary buffer */
470433d6423SLionel Sambuc 
471433d6423SLionel Sambuc 	if (line[3] != ' ') {
472433d6423SLionel Sambuc 		Error(WARN, LINE, " unknown translation", NULL);
473433d6423SLionel Sambuc 		return;
474433d6423SLionel Sambuc 	}
475433d6423SLionel Sambuc 	for (s1 = &line[4]; *s1;) {
476433d6423SLionel Sambuc 	    nm[1] = nm[2] = '\0';
477433d6423SLionel Sambuc 	    s2 = s1 + 1;
478433d6423SLionel Sambuc 	/*
479433d6423SLionel Sambuc 	 * Assemble the input value.
480433d6423SLionel Sambuc 	 */
481433d6423SLionel Sambuc 	    if (*s1 == '\\' && (*s2 == '*' || *s2 == '(')) {
482433d6423SLionel Sambuc 		if (*s2 == '(') {
483433d6423SLionel Sambuc 	    /*
484433d6423SLionel Sambuc 	     * Input is named character -- "\(xx".
485433d6423SLionel Sambuc 	     */
486433d6423SLionel Sambuc 		    trin = 1;
487433d6423SLionel Sambuc 		    s1 = s2 + 1;
488433d6423SLionel Sambuc 		    if ((nm[0] = *s1) != '\0') {
489433d6423SLionel Sambuc 			s1++;
490433d6423SLionel Sambuc 			if ((nm[1] = *s1) != '\0')
491433d6423SLionel Sambuc 			    s1++;
492433d6423SLionel Sambuc 		    }
493433d6423SLionel Sambuc 		} else {
494433d6423SLionel Sambuc 	    /*
495433d6423SLionel Sambuc 	     * Input is interpolated string -- "\*x" or "\*(xx".
496433d6423SLionel Sambuc 	     */
497433d6423SLionel Sambuc 		    s1 = Asmcode(&s2, nm);
498433d6423SLionel Sambuc 		    if (*s1)
499433d6423SLionel Sambuc 			s1++;
500433d6423SLionel Sambuc 		    s2 = Findstr(nm, NULL, 0);
501433d6423SLionel Sambuc 		    if (*s2 != '\0') {
502433d6423SLionel Sambuc 			if ((strlen((char *)s2) + strlen((char *)s1) + 1)
503433d6423SLionel Sambuc 			>= MAXLINE)
504433d6423SLionel Sambuc 			    Error(WARN, LINE, " string too long: ", (char *)nm);
505433d6423SLionel Sambuc 			else {
506433d6423SLionel Sambuc 			    (void) sprintf((char *)buf, "%s%s",
507433d6423SLionel Sambuc 				(char *)s2, (char *)s1);
508433d6423SLionel Sambuc 			    (void) strcpy((char *)xbuf, (char *)buf);
509433d6423SLionel Sambuc 			    s1 = xbuf;
510433d6423SLionel Sambuc 			}
511433d6423SLionel Sambuc 		    }
512433d6423SLionel Sambuc 		    continue;
513433d6423SLionel Sambuc 		}
514433d6423SLionel Sambuc 	    } else {
515433d6423SLionel Sambuc 
516433d6423SLionel Sambuc 	    /*
517433d6423SLionel Sambuc 	     * Input is a simple character.
518433d6423SLionel Sambuc 	     */
519433d6423SLionel Sambuc 		trin = 0;
520433d6423SLionel Sambuc 		if ((nm[0] = *s1) != '\0')
521433d6423SLionel Sambuc 		    s1++;
522433d6423SLionel Sambuc 	    }
523433d6423SLionel Sambuc 	/*
524433d6423SLionel Sambuc 	 * Assemble the output value.
525433d6423SLionel Sambuc 	 */
526433d6423SLionel Sambuc 
527433d6423SLionel Sambuc assemble_output:
528433d6423SLionel Sambuc 	    nm1[1] = nm1[2] = '\0';
529433d6423SLionel Sambuc 	    if (*s1 == '\0') {
530433d6423SLionel Sambuc 
531433d6423SLionel Sambuc 	    /*
532433d6423SLionel Sambuc 	     * Supply a space if there is no output character.
533433d6423SLionel Sambuc 	     */
534433d6423SLionel Sambuc 		trout = 0;
535433d6423SLionel Sambuc 		nm1[0] = ' ';
536433d6423SLionel Sambuc 	    } else {
537433d6423SLionel Sambuc 		s2 = s1 + 1;
538433d6423SLionel Sambuc 		if (*s1 == '\\' && (*s2 == '(' || *s2 == '*')) {
539433d6423SLionel Sambuc 		    if (*s2 == '(') {
540433d6423SLionel Sambuc 		/*
541433d6423SLionel Sambuc 		 * The output is a named character -- "\(xx".
542433d6423SLionel Sambuc 		 */
543433d6423SLionel Sambuc 			trout = 1;
544433d6423SLionel Sambuc 			s1 = s2 + 1;
545433d6423SLionel Sambuc 			if ((nm1[0] = *s1) != '\0') {
546433d6423SLionel Sambuc 			    s1++;
547433d6423SLionel Sambuc 			    if ((nm1[1] = *s1) != '\0')
548433d6423SLionel Sambuc 				s1++;
549433d6423SLionel Sambuc 			}
550433d6423SLionel Sambuc 		    } else {
551433d6423SLionel Sambuc 		/*
552433d6423SLionel Sambuc 		 * The output is an interpolated string -- * "\*x" or "\*(xx".
553433d6423SLionel Sambuc 		 */
554433d6423SLionel Sambuc 			s1 = Asmcode(&s2, nm1);
555433d6423SLionel Sambuc 			if (*s1)
556433d6423SLionel Sambuc 			    s1++;
557433d6423SLionel Sambuc 			s2 = Findstr(nm1, NULL, 0);
558433d6423SLionel Sambuc 			if (*s2 != '\0') {
559433d6423SLionel Sambuc 		    /*
560433d6423SLionel Sambuc 		     * Interpolate a string value.
561433d6423SLionel Sambuc 		     */
562433d6423SLionel Sambuc 			    if ((strlen((char *)s2) + strlen((char *)s1) + 1)
563433d6423SLionel Sambuc 			    >= MAXLINE)
564433d6423SLionel Sambuc 				Error(WARN, LINE, " string too long: ",
565433d6423SLionel Sambuc 				    (char *)nm);
566433d6423SLionel Sambuc 			    else {
567433d6423SLionel Sambuc 				(void) sprintf((char *)buf, "%s%s", (char *)s2,
568433d6423SLionel Sambuc 				    (char *)s1);
569433d6423SLionel Sambuc 				(void) strcpy((char *)xbuf, (char *)buf);
570433d6423SLionel Sambuc 			        s1 = xbuf;
571433d6423SLionel Sambuc 			    }
572433d6423SLionel Sambuc 			}
573433d6423SLionel Sambuc 			goto assemble_output;
574433d6423SLionel Sambuc 		    }
575433d6423SLionel Sambuc 		} else {
576433d6423SLionel Sambuc 		    trout = 0;
577433d6423SLionel Sambuc 		    if ((nm1[0] = *s1) != '0')
578433d6423SLionel Sambuc 			s1++;
579433d6423SLionel Sambuc 		    else
580433d6423SLionel Sambuc 			nm1[0] = ' ';
581433d6423SLionel Sambuc 		}
582433d6423SLionel Sambuc 	    }
583433d6423SLionel Sambuc 	/*
584433d6423SLionel Sambuc 	 * Do the translation.
585433d6423SLionel Sambuc 	 */
586433d6423SLionel Sambuc 	    switch (trin) {
587433d6423SLionel Sambuc 
588433d6423SLionel Sambuc 	    case 0:			/* simple char */
589433d6423SLionel Sambuc 		switch (trout) {
590433d6423SLionel Sambuc 
591433d6423SLionel Sambuc 		case 0:			/* to simple char */
592433d6423SLionel Sambuc 		    Trtbl[(int)nm[0]] = nm1[0];
593433d6423SLionel Sambuc 		    break;
594433d6423SLionel Sambuc 		case 1:			/* to named char */
595433d6423SLionel Sambuc 		    if ((i = Findchar(nm1, 0, NULL, 0)) < 0
596433d6423SLionel Sambuc 		    ||  strlen((char *)Schar[i].str) != 1)
597433d6423SLionel Sambuc 			Error(WARN, LINE, " bad named character: ",
598433d6423SLionel Sambuc 			    (char *)nm1);
599433d6423SLionel Sambuc 		    else
600433d6423SLionel Sambuc 			Trtbl[(int)nm[0]] = *(Schar[i].str);
601433d6423SLionel Sambuc 		    break;
602433d6423SLionel Sambuc 		}
603433d6423SLionel Sambuc 		break;
604433d6423SLionel Sambuc 	    case 1:			/* named char */
605433d6423SLionel Sambuc 		if ((i = Findchar(nm, 0, NULL, 0)) < 0)
606433d6423SLionel Sambuc 		    Error(WARN, LINE, " unknown named character: ", (char *)nm);
607433d6423SLionel Sambuc 		else {
608433d6423SLionel Sambuc 		    switch (trout) {
609433d6423SLionel Sambuc 
610433d6423SLionel Sambuc 		    case 0:		/* to simple char */
611433d6423SLionel Sambuc 			Free(&Schar[i].str);
612433d6423SLionel Sambuc 			Schar[i].str = Newstr(nm1);
613433d6423SLionel Sambuc 			Schar[i].len = 1;
614433d6423SLionel Sambuc 			break;
615433d6423SLionel Sambuc 		    case 1:		/* to named char */
616433d6423SLionel Sambuc 			if ((j = Findchar(nm1, 0, NULL, 0)) < 0)
617433d6423SLionel Sambuc 			    Error(WARN, LINE, " unknown named character: ",
618433d6423SLionel Sambuc 				(char *)nm1);
619433d6423SLionel Sambuc 			else
620433d6423SLionel Sambuc 			    (void) Findchar(nm, Schar[j].len, Schar[j].str, 1);
621433d6423SLionel Sambuc 			break;
622433d6423SLionel Sambuc 		    }
623433d6423SLionel Sambuc 		}
624433d6423SLionel Sambuc 		break;
625433d6423SLionel Sambuc 	    }
626433d6423SLionel Sambuc 	}
627433d6423SLionel Sambuc }
628433d6423SLionel Sambuc 
629433d6423SLionel Sambuc 
630433d6423SLionel Sambuc /*
631433d6423SLionel Sambuc  * Initialization - "^[.']\^b (fh|HF|NH) [01]"
632433d6423SLionel Sambuc  *
633433d6423SLionel Sambuc  * fh = first page header status
634433d6423SLionel Sambuc  * HF = header/footer status
635433d6423SLionel Sambuc  * NH = initialize number headers
636433d6423SLionel Sambuc  */
637433d6423SLionel Sambuc 
nr_Ub(unsigned char * line,int brk)638d9494baaSJacob Adams static void nr_Ub(unsigned char *line, int brk) {
639433d6423SLionel Sambuc 	int i;				/* temporary index */
640433d6423SLionel Sambuc 	unsigned char *s1, *s2;		/* temporary string pointers */
641433d6423SLionel Sambuc 
642433d6423SLionel Sambuc 	if ((s1 = Field(2, line, 0)) == NULL)
643433d6423SLionel Sambuc 		return;
644433d6423SLionel Sambuc 	if ((s2 = Field(3, line, 0)) == NULL)
645433d6423SLionel Sambuc 		i = 0;
646433d6423SLionel Sambuc 	else
647433d6423SLionel Sambuc 		i = atoi((char *)s2);
648433d6423SLionel Sambuc 	if (s1[0] == 'f' && s1[1] == 'h')
649433d6423SLionel Sambuc 		Pass3(NOBREAK, (unsigned char *)"fph", NULL, i);
650433d6423SLionel Sambuc 	else if (s1[0] == 'H' && s1[1] == 'F')
651433d6423SLionel Sambuc 		Hdft = i;
652433d6423SLionel Sambuc 	else if (s1[0] == 'N' && s1[1] == 'H') {
653433d6423SLionel Sambuc 		for (i = 0; i < MAXNHNR; i++)
654433d6423SLionel Sambuc 			Nhnr[i] = 0;
655433d6423SLionel Sambuc 	} else
656433d6423SLionel Sambuc 		Error(WARN, LINE, " unknown initialization", NULL);
657433d6423SLionel Sambuc }
658433d6423SLionel Sambuc 
659433d6423SLionel Sambuc 
660433d6423SLionel Sambuc /*
661433d6423SLionel Sambuc  * Character definitions - "^[.']\^c"
662433d6423SLionel Sambuc  */
663433d6423SLionel Sambuc 
nr_Uc(unsigned char * line,int brk)664d9494baaSJacob Adams static void nr_Uc(unsigned char *line, int brk) {
665433d6423SLionel Sambuc 	unsigned char buf[MAXLINE];	/* temporary buffer */
666433d6423SLionel Sambuc 	int i;				/* temporary index */
667433d6423SLionel Sambuc 	unsigned char *s1, *s2, *s3,	/* temporary string pointers */
668433d6423SLionel Sambuc 		      *s4, *s5;
669433d6423SLionel Sambuc 
670433d6423SLionel Sambuc 	s2 = Field(2, line, 0);
671433d6423SLionel Sambuc 	i = atoi((char *)Field(3, line, 0));
672433d6423SLionel Sambuc 	s4 = Field(4, line, 0);
673433d6423SLionel Sambuc 	if (i < 0 || i > MAXLINE/2 || *s2 == '\0') {
674433d6423SLionel Sambuc 		Error(WARN, LINE, " bad character definition", NULL);
675433d6423SLionel Sambuc 		return;
676433d6423SLionel Sambuc 	}
677433d6423SLionel Sambuc 	if (s4 == NULL)
678433d6423SLionel Sambuc 		s4 = (unsigned char *)"";
679433d6423SLionel Sambuc 	else if (*s4 == '"')
680433d6423SLionel Sambuc 		s4++;
681433d6423SLionel Sambuc 	s1 = buf;
682433d6423SLionel Sambuc 	while ((s5 = (unsigned char *)strchr((char *)s4, '\\')) != NULL) {
683433d6423SLionel Sambuc 		while (s5 > s4)
684433d6423SLionel Sambuc 			*s1++ = *s4++;
685433d6423SLionel Sambuc 		s4 = ++s5;
686433d6423SLionel Sambuc 		if (*s5 == '\\')
687433d6423SLionel Sambuc 			*s1++ = '\\';
688433d6423SLionel Sambuc 		else if (*s5 == 'b')
689433d6423SLionel Sambuc 			*s1++ = '\b';
690433d6423SLionel Sambuc 		if (*s4)
691433d6423SLionel Sambuc 			s4++;
692433d6423SLionel Sambuc 	}
693*d0055759SDavid van Moolenbroek 	while ((*s1++ = *s4++))
694433d6423SLionel Sambuc 		;
695433d6423SLionel Sambuc 	if (*s2 == 'h' && *(s2+1) == 'y')
696433d6423SLionel Sambuc 		(void) Findhy(buf, i, 1);
697433d6423SLionel Sambuc 	else
698433d6423SLionel Sambuc 		(void) Findchar(s2, i, buf, 1);
699433d6423SLionel Sambuc }
700433d6423SLionel Sambuc 
701433d6423SLionel Sambuc 
702433d6423SLionel Sambuc /*
703433d6423SLionel Sambuc  * Font is OK - "[.']\^f <font_name_character>"
704433d6423SLionel Sambuc  */
705433d6423SLionel Sambuc 
nr_Uf(unsigned char * line,int brk)706d9494baaSJacob Adams static void nr_Uf(unsigned char *line, int brk) {
707433d6423SLionel Sambuc 	int i;				/* temporary index */
708433d6423SLionel Sambuc 
709433d6423SLionel Sambuc 	if (line[3] != '\0' && line[4] != '\0') {
710433d6423SLionel Sambuc 		for (i = 0; Fcode[i].nm; i++) {
711433d6423SLionel Sambuc 			if (line[4] == Fcode[i].nm) {
712433d6423SLionel Sambuc 				Fcode[i].status = '1';
713433d6423SLionel Sambuc 				return;
714433d6423SLionel Sambuc 			}
715433d6423SLionel Sambuc 		}
716433d6423SLionel Sambuc 	}
717433d6423SLionel Sambuc 	Error(WARN, LINE, " unknown font", NULL);
718433d6423SLionel Sambuc }
719433d6423SLionel Sambuc 
720433d6423SLionel Sambuc 
721433d6423SLionel Sambuc /*
722433d6423SLionel Sambuc  * Resolutions - "[.']\^r cpi horizontal vertical"
723433d6423SLionel Sambuc  */
724433d6423SLionel Sambuc 
nr_Ur(unsigned char * line,int brk)725d9494baaSJacob Adams static void nr_Ur(unsigned char *line, int brk) {
726433d6423SLionel Sambuc 	unsigned char buf[MAXLINE];	/* temporary buffer */
727433d6423SLionel Sambuc 	int i, j;			/* temporary indexes */
728433d6423SLionel Sambuc 	double tval;			/* temporary value */
729433d6423SLionel Sambuc 
730433d6423SLionel Sambuc 	if ((i = atoi((char *)Field(3, line, 0))) <= 0
731433d6423SLionel Sambuc 	||  (j = atoi((char *)Field(4, line, 0))) <= 0) {
732433d6423SLionel Sambuc 		Error(WARN, LINE, " bad cpi resolutions", NULL);
733433d6423SLionel Sambuc 		return;
734433d6423SLionel Sambuc 	}
735433d6423SLionel Sambuc 	tval = (double) (240.0 / (double) i);
736433d6423SLionel Sambuc 	if (Findscale((int)'m', tval, 1) < 0)
737433d6423SLionel Sambuc 		Error(FATAL, LINE, " missing Scal['m']", NULL);
738433d6423SLionel Sambuc 	Scalen = tval;
739433d6423SLionel Sambuc 	if (Scalen <= 0.0) {
740433d6423SLionel Sambuc 		(void) sprintf((char *)buf, " bad Scale['n'] (%f)", Scalen);
741433d6423SLionel Sambuc 		Error(FATAL, LINE, (char *)buf, NULL);
742433d6423SLionel Sambuc 	}
743433d6423SLionel Sambuc 	if (Findscale((int)'n', tval, 1) < 0)
744433d6423SLionel Sambuc 		Error(FATAL, LINE, " missing Scale['n']", NULL);
745433d6423SLionel Sambuc 	Scalev = (double) (240.0 / (double) j);
746433d6423SLionel Sambuc 	if (Scalev <= 0.0) {
747433d6423SLionel Sambuc 		(void) sprintf((char *)buf, " bad Scale['v'] (%f)", Scalen);
748433d6423SLionel Sambuc 		Error(FATAL, LINE, (char *)buf, NULL);
749433d6423SLionel Sambuc 	}
750433d6423SLionel Sambuc 	if (Findscale((int)'v', Scalev, 1) < 0)
751433d6423SLionel Sambuc 		Error(FATAL, LINE, " missing Scale['v']", NULL);
752433d6423SLionel Sambuc }
753433d6423SLionel Sambuc 
754433d6423SLionel Sambuc 
755433d6423SLionel Sambuc /*
756433d6423SLionel Sambuc  * Set line number and file name - "^[.']\^# <number> <file>"
757433d6423SLionel Sambuc  *
758433d6423SLionel Sambuc  * Lock line number and file name - "^[.']\^= <number> <file>"
759433d6423SLionel Sambuc  */
760433d6423SLionel Sambuc 
nr_UL(unsigned char * line,int brk)761d9494baaSJacob Adams static void nr_UL(unsigned char *line, int brk) {
762433d6423SLionel Sambuc 	unsigned char *s1;		/* temporary string pointer */
763433d6423SLionel Sambuc 
764433d6423SLionel Sambuc 	if ((s1 = Field(2, line, 0)) != NULL)
765433d6423SLionel Sambuc 		P2il = atoi((char *)s1) - 1;
766433d6423SLionel Sambuc 	else
767433d6423SLionel Sambuc 		P2il = 0;
768433d6423SLionel Sambuc 	Lockil = (line[2] == '#') ? 0 : 1;
769433d6423SLionel Sambuc 	Free(&P2name);
770433d6423SLionel Sambuc 	if (Field(3, line, 1) != NULL) {
771433d6423SLionel Sambuc 		P2name = F;
772433d6423SLionel Sambuc 		F = NULL;
773433d6423SLionel Sambuc 	} else
774433d6423SLionel Sambuc 		P2name = NULL;
775433d6423SLionel Sambuc }
776