source: trunk/minix/commands/cawf/nreq.c@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 17.3 KB
Line 
1/*
2 * nreq.c - cawf(1) processing of nroff requests
3 */
4
5/*
6 * Copyright (c) 1991 Purdue University Research Foundation,
7 * West Lafayette, Indiana 47907. All rights reserved.
8 *
9 * Written by Victor A. Abell <abe@mace.cc.purdue.edu>, Purdue
10 * University Computing Center. Not derived from licensed software;
11 * derived from awf(1) by Henry Spencer of the University of Toronto.
12 *
13 * Permission is granted to anyone to use this software for any
14 * purpose on any computer system, and to alter it and redistribute
15 * it freely, subject to the following restrictions:
16 *
17 * 1. The author is not responsible for any consequences of use of
18 * this software, even if they arise from flaws in it.
19 *
20 * 2. The origin of this software must not be misrepresented, either
21 * by explicit claim or by omission. Credits must appear in the
22 * documentation.
23 *
24 * 3. Altered versions must be plainly marked as such, and must not
25 * be misrepresented as being the original software. Credits must
26 * appear in the documentation.
27 *
28 * 4. This notice may not be removed or altered.
29 */
30
31#include "cawf.h"
32#include <ctype.h>
33
34
35/*
36 * Prototypes for request processing functions.
37 */
38
39_PROTOTYPE(static void nr_UL,(unsigned char *line, int brk));
40_PROTOTYPE(static void nr_Ub,(unsigned char *line, int brk));
41_PROTOTYPE(static void nr_Uc,(unsigned char *line, int brk));
42_PROTOTYPE(static void nr_Uf,(unsigned char *line, int brk));
43_PROTOTYPE(static void nr_Ur,(unsigned char *line, int brk));
44_PROTOTYPE(static void nr_ad,(unsigned char *line, int brk));
45_PROTOTYPE(static void nr_bp,(unsigned char *line, int brk));
46_PROTOTYPE(static void nr_br,(unsigned char *line, int brk));
47_PROTOTYPE(static void nr_ce,(unsigned char *line, int brk));
48_PROTOTYPE(static void nr_di,(unsigned char *line, int brk));
49_PROTOTYPE(static void nr_ds,(unsigned char *line, int brk));
50_PROTOTYPE(static void nr_fi,(unsigned char *line, int brk));
51_PROTOTYPE(static void nr_fl,(unsigned char *line, int brk));
52_PROTOTYPE(static void nr_ft,(unsigned char *line, int brk));
53_PROTOTYPE(static void nr_it,(unsigned char *line, int brk));
54_PROTOTYPE(static void nr_na,(unsigned char *line, int brk));
55_PROTOTYPE(static void nr_nf,(unsigned char *line, int brk));
56_PROTOTYPE(static void nr_ns,(unsigned char *line, int brk));
57_PROTOTYPE(static void nr_rm,(unsigned char *line, int brk));
58_PROTOTYPE(static void nr_rn,(unsigned char *line, int brk));
59_PROTOTYPE(static void nr_rr,(unsigned char *line, int brk));
60_PROTOTYPE(static void nr_rs,(unsigned char *line, int brk));
61_PROTOTYPE(static void nr_tm,(unsigned char *line, int brk));
62_PROTOTYPE(static void nr_tr,(unsigned char *line, int brk));
63
64_PROTOTYPE(static void nr_nil,(unsigned char *line, int brk));
65
66
67/*
68 * NrReqt[] - nroff request processing table
69 *
70 * CAUTION: place new entries in their proper alphabetical order, since
71 * this table is processed with a binary search.
72 */
73
74static struct nr_req {
75 char *nm; /* nroff request */
76 void (*fun)(); /* processing function */
77} NrReqt[] = {
78 { "\\\"", nr_nil }, /* backslash-quote */
79 { "^#", nr_UL },
80 { "^=", nr_UL },
81 { "^b", nr_Ub },
82 { "^c", nr_Uc },
83 { "^d", nr_nil },
84 { "^e", nr_nil },
85 { "^f", nr_Uf },
86 { "^r", nr_Ur },
87 { "^x", nr_nil },
88 { "ad", nr_ad },
89 { "bp", nr_bp },
90 { "br", nr_br },
91 { "ce", nr_ce },
92 { "di", nr_di },
93 { "ds", nr_ds },
94 { "fi", nr_fi },
95 { "fl", nr_fl },
96 { "ft", nr_ft },
97 { "hy", nr_nil },
98 { "i0", nr_nil },
99 { "it", nr_it },
100 { "lg", nr_nil },
101 { "li", nr_nil },
102 { "na", nr_na },
103 { "nf", nr_nf },
104 { "ns", nr_ns },
105 { "ps", nr_nil },
106 { "rm", nr_rm },
107 { "rn", nr_rn },
108 { "rr", nr_rr },
109 { "rs", nr_rs },
110 { "tm", nr_tm },
111 { "tr", nr_tr },
112 { "vs", nr_nil },
113};
114/*
115 * Nreq(line, brk) - process miscellaneous nroff requests from line
116 * buffer with request status of (brk)
117 */
118
119void
120Nreq(line, brk)
121 unsigned char *line;
122 int brk;
123{
124 unsigned char c[3]; /* command buffer */
125 int cmp, hi, low, mid; /* binary search indixes */
126
127 c[0] = c[1] = c[2] = '\0';
128 if ((c[0] = line[1]) != '\0')
129 c[1] = line[2];
130
131 low = mid = 0;
132 hi = sizeof(NrReqt) / sizeof(struct nr_req);
133 while (low <= hi) {
134 mid = (low + hi) / 2;
135 if ((cmp = strcmp((char *)c, NrReqt[mid].nm)) < 0)
136 hi = mid - 1;
137 else if (cmp > 0)
138 low = mid + 1;
139 else {
140 (void) (*NrReqt[mid].fun)(line, brk);
141 return;
142 }
143 }
144 /*
145 * Unknown request starting with a '.' or '\''..
146 */
147 Error(WARN, LINE, " unknown request", NULL);
148}
149
150
151/*
152 * Adjust - "^[.']ad"
153 */
154
155static void
156nr_ad(line, brk)
157 unsigned char *line;
158 int brk;
159{
160 Pass3(NOBREAK, (unsigned char *)"both", NULL, 0);
161}
162
163
164/*
165* Begin new page - "^[.']bp"
166*/
167
168static void
169nr_bp(line, brk)
170 unsigned char *line;
171 int brk;
172{
173 Pass3(brk, (unsigned char *)"need", NULL, 999);
174}
175
176
177/*
178* Break - "^[.']br"
179*/
180
181static void
182nr_br(line, brk)
183 unsigned char *line;
184 int brk;
185{
186 Pass3(brk, (unsigned char *)"flush", NULL, 0);
187}
188
189
190/*
191 * Center - "^[.']ce"
192 */
193
194static void
195nr_ce(line, brk)
196 unsigned char *line;
197 int brk;
198{
199 unsigned char *s; /* string poiner */
200
201 if ((s = Field(2, line, 0)) != NULL)
202 Centering = atoi((char *)s);
203 else
204 Centering = 1;
205}
206
207
208/*
209 * Diversion on and off - "^[.']di"
210 */
211
212static void
213nr_di(line, brk)
214 unsigned char *line;
215 int brk;
216{
217 Pass3(DOBREAK, (unsigned char *)"flush", NULL, 0);
218 Divert ^= 1;
219}
220
221
222/*
223 * Define string - "^[.']ds"
224 */
225
226static void
227nr_ds(line, brk)
228 unsigned char *line;
229 int brk;
230{
231 unsigned char buf[MAXLINE]; /* temporary buffer */
232 unsigned char nm[4], nm1[4]; /* name buffers */
233 unsigned char *s1, *s2, *s3, /* temporary string pointers */
234 *s4;
235
236 if (Asmname(&line[3], nm) == 0) {
237 Error(WARN, LINE, " no name", NULL);
238 return;
239 }
240 s1 = Field(3, line, 0);
241 s2 = Findstr(nm, s1, 1);
242 while (*s2 == '\\' && *(s2 + 1) == '*') {
243 s2++;
244 s3 = Asmcode(&s2, nm1);
245 s2 = Findstr(nm1, NULL, 0);
246 }
247 if (Hdft) {
248
249 /*
250 * Look for names LH, LF, CH, CF, RH, RF.
251 */
252 if ((nm[0]=='L' || nm[0]=='C' || nm[0]=='R')
253 && (nm[1]=='F' || nm[1]=='H')) {
254 (void) sprintf((char *)buf, "%s", (char *)nm);
255 Pass3(NOBREAK, buf, s2, 0);
256 }
257 }
258}
259
260
261
262/*
263 * Fill - "^[.']fi"
264 */
265
266static void
267nr_fi(line, brk)
268 unsigned char *line;
269 int brk;
270{
271 Fill = 1;
272 Pass3(brk, (unsigned char *)"flush", NULL, 0);
273}
274
275
276/*
277 * Flush - "^[.']fl"
278 */
279
280static void
281nr_fl(line, brk)
282 unsigned char *line;
283 int brk;
284{
285 Pass3(brk, (unsigned char *)"flush", NULL, 0);
286}
287
288
289/*
290 * Font - "^[.']ft <font_name>"
291 */
292
293static void
294nr_ft(line, brk)
295 unsigned char *line;
296 int brk;
297{
298 int i; /* temporary index */
299
300 if (line[3] == '\0' || line[4] == '\0')
301 line[4] = 'P';
302 if (line[4] == 'P') {
303 Font[0] = Prevfont;
304 return;
305 }
306 for (i = 0; Fcode[i].nm; i++) {
307 if (Fcode[i].nm == line[4])
308 break;
309 }
310 if (Fcode[i].status == '\0') {
311 Error(WARN, LINE, " bad font code", NULL);
312 return;
313 }
314 Prevfont = Font[0];
315 Font[0] = line[4];
316}
317
318
319/*
320 * Input trap - "^[.']it [1 <request>]"
321 */
322
323static void
324nr_it(line, brk)
325 unsigned char *line;
326 int brk;
327
328{
329 unsigned char buf[MAXLINE]; /* temporary buffer */
330 int i; /* temporary index */
331 unsigned char *s1, *s2; /* temporary string pointers */
332
333 if ((s1 = Field(2, line, 0)) == NULL) {
334 Free(&Aftnxt);
335 return;
336 }
337 if ((i = atoi((char *)s1)) != 1) {
338 Error(WARN, LINE, " first .it arg must be 1", NULL);
339 return;
340 }
341 if ((s2 = Field(3, line, 0)) == NULL)
342 Free(&Aftnxt);
343 else {
344 (void) sprintf((char *)buf, "%s,%s",
345 (Aftnxt == NULL) ? "" : (char *)Aftnxt,
346 (char *)s2);
347 Free(&Aftnxt);
348 Aftnxt = Newstr(buf);
349 }
350}
351
352
353/*
354 * Comment - "^[.']\\" - do nothing
355 *
356 * Debug - "^[.']\^d" - do nothing
357 *
358 * Finalization - "[.']\^e" - do nothing
359 *
360 * Error file - "^[.']\^x <name>" - do nothing
361 *
362 * "^[.']i0", "^[.']lg" and "^[.']li" - do nothing
363 *
364 * Point size - "^[.']ps" - do nothing
365 *
366 * Vertical spacing - "^[.']vs" - do nothing
367 *
368 */
369
370static void
371nr_nil(line, brk)
372 unsigned char *line;
373 int brk;
374{
375}
376
377
378/*
379 * No adjust "^[.']na"
380 */
381
382static void
383nr_na(line, brk)
384 unsigned char *line;
385 int brk;
386{
387 Pass3(NOBREAK, (unsigned char *)"left", NULL, 0);
388}
389
390
391/*
392 * No fill - "^[.']nf"
393 */
394
395static void
396nr_nf(line, brk)
397 unsigned char *line;
398 int brk;
399{
400 Fill = 0;
401 Pass3(brk, (unsigned char *)"flush", NULL, 0);
402}
403
404
405/*
406 * No space - "^[.']ns"
407 */
408
409static void
410nr_ns(line, brk)
411 unsigned char *line;
412 int brk;
413{
414 Pass3(NOBREAK, (unsigned char *)"nospace", NULL, 0);
415}
416
417
418/*
419 * Remove macro or string - "^[.']rm"
420 */
421
422static void
423nr_rm(line, brk)
424 unsigned char *line;
425 int brk;
426{
427 int i; /* temporary index */
428 unsigned char nm[4]; /* name buffer */
429
430 if (Asmname(&line[3], nm) == 0) {
431 Error(WARN, LINE, " no name", NULL);
432 return;
433 }
434 if ((i = Findmacro(nm, 0)) >= 0) {
435 Delmacro(i);
436 return;
437 }
438 (void) Findstr(nm, NULL, 0);
439 if (Sx >= 0) {
440 Delstr(Sx);
441 return;
442 }
443 Error(WARN, LINE, " no macro/string", NULL);
444}
445
446
447/*
448 * Rename macro or string - "^[.']rn"
449 */
450
451static void
452nr_rn(line, brk)
453 unsigned char *line;
454 int brk;
455{
456 int i, j; /* temporary indexes */
457 unsigned char nm[4], nm1[4]; /* name buffers */
458 unsigned char *s1; /* temporary string pointer */
459
460 if ((s1 = Field(2, line, 0)) == NULL || Asmname(s1, nm) == 0) {
461 Error(WARN, LINE, " no name", NULL);
462 return;
463 }
464 if ((s1 = Field(3, line, 0)) == NULL || Asmname(s1, nm1) == 0) {
465 Error(WARN, LINE, " no new name", NULL);
466 return;
467 }
468 if ((i = Findmacro(nm, 0)) >= 0) {
469 if ((j = Findmacro(nm1, 0)) >= 0)
470 Delmacro(j);
471 j = Findmacro(nm1, 1);
472 Macrotab[j].bx = Macrotab[i].bx;
473 Macrotab[i].bx = -1;
474 Macrotab[j].ct = Macrotab[i].ct;
475 Macrotab[i].ct = 0;
476 Delmacro(i);
477 return;
478 }
479 (void) Findstr(nm, NULL, 0);
480 if ((i = Sx) >= 0) {
481 (void) Findstr(nm1, Str[i].str, 1);
482 Delstr(i);
483 return;
484 }
485 if (Findmacro(nm1, 0) < 0)
486 (void) Findmacro(nm1, 1);
487}
488
489
490/*
491 * Remove register - "^[.']rr"
492 */
493
494static void
495nr_rr(line, brk)
496 unsigned char *line;
497 int brk;
498{
499 int i; /* temporary index */
500 unsigned char nm[4]; /* name buffer */
501
502 if (Asmname(&line[3], nm) == 0) {
503 Error(WARN, LINE, " no name", NULL);
504 return;
505 }
506 if ((i = Findnum(nm, 0, 0)) < 0) {
507 Error(WARN, LINE, " no register", NULL);
508 return;
509 }
510 Delnum(i);
511}
512
513
514/*
515 * Resume space - "^[.']rs"
516 */
517
518static void
519nr_rs(line, brk)
520 unsigned char *line;
521 int brk;
522{
523 Pass3(NOBREAK, (unsigned char *)"yesspace", NULL, 0);
524}
525
526
527/*
528 * Message - "^[.']tm"
529 */
530
531static void
532nr_tm(line, brk)
533 unsigned char *line;
534 int brk;
535{
536 Pass3(MESSAGE, Inname, (line[3] == ' ') ? &line[4] : &line[3], NR);
537}
538
539
540/*
541 * Translate - "^[.']tr abcd..."
542 */
543
544static void
545nr_tr(line, brk)
546 unsigned char *line;
547 int brk;
548{
549 unsigned char buf[MAXLINE]; /* temporary buffer */
550 int i, j; /* temporary indexes */
551 unsigned char nm[4], nm1[4]; /* name buffers */
552 unsigned char *s1, *s2; /* temporary string pointers */
553 int trin, trout; /* types: 0 = char; 1 = named char */
554 unsigned char xbuf[MAXLINE]; /* temporary buffer */
555
556 if (line[3] != ' ') {
557 Error(WARN, LINE, " unknown translation", NULL);
558 return;
559 }
560 for (s1 = &line[4]; *s1;) {
561 nm[1] = nm[2] = '\0';
562 s2 = s1 + 1;
563 /*
564 * Assemble the input value.
565 */
566 if (*s1 == '\\' && (*s2 == '*' || *s2 == '(')) {
567 if (*s2 == '(') {
568 /*
569 * Input is named character -- "\(xx".
570 */
571 trin = 1;
572 s1 = s2 + 1;
573 if ((nm[0] = *s1) != '\0') {
574 s1++;
575 if ((nm[1] = *s1) != '\0')
576 s1++;
577 }
578 } else {
579 /*
580 * Input is interpolated string -- "\*x" or "\*(xx".
581 */
582 s1 = Asmcode(&s2, nm);
583 if (*s1)
584 s1++;
585 s2 = Findstr(nm, NULL, 0);
586 if (*s2 != '\0') {
587 if ((strlen((char *)s2) + strlen((char *)s1) + 1)
588 >= MAXLINE)
589 Error(WARN, LINE, " string too long: ", (char *)nm);
590 else {
591 (void) sprintf((char *)buf, "%s%s",
592 (char *)s2, (char *)s1);
593 (void) strcpy((char *)xbuf, (char *)buf);
594 s1 = xbuf;
595 }
596 }
597 continue;
598 }
599 } else {
600
601 /*
602 * Input is a simple character.
603 */
604 trin = 0;
605 if ((nm[0] = *s1) != '\0')
606 s1++;
607 }
608 /*
609 * Assemble the output value.
610 */
611
612assemble_output:
613 nm1[1] = nm1[2] = '\0';
614 if (*s1 == '\0') {
615
616 /*
617 * Supply a space if there is no output character.
618 */
619 trout = 0;
620 nm1[0] = ' ';
621 } else {
622 s2 = s1 + 1;
623 if (*s1 == '\\' && (*s2 == '(' || *s2 == '*')) {
624 if (*s2 == '(') {
625 /*
626 * The output is a named character -- "\(xx".
627 */
628 trout = 1;
629 s1 = s2 + 1;
630 if ((nm1[0] = *s1) != '\0') {
631 s1++;
632 if ((nm1[1] = *s1) != '\0')
633 s1++;
634 }
635 } else {
636 /*
637 * The output is an interpolated string -- * "\*x" or "\*(xx".
638 */
639 s1 = Asmcode(&s2, nm1);
640 if (*s1)
641 s1++;
642 s2 = Findstr(nm1, NULL, 0);
643 if (*s2 != '\0') {
644 /*
645 * Interpolate a string value.
646 */
647 if ((strlen((char *)s2) + strlen((char *)s1) + 1)
648 >= MAXLINE)
649 Error(WARN, LINE, " string too long: ",
650 (char *)nm);
651 else {
652 (void) sprintf((char *)buf, "%s%s", (char *)s2,
653 (char *)s1);
654 (void) strcpy((char *)xbuf, (char *)buf);
655 s1 = xbuf;
656 }
657 }
658 goto assemble_output;
659 }
660 } else {
661 trout = 0;
662 if ((nm1[0] = *s1) != '0')
663 s1++;
664 else
665 nm1[0] = ' ';
666 }
667 }
668 /*
669 * Do the translation.
670 */
671 switch (trin) {
672
673 case 0: /* simple char */
674 switch (trout) {
675
676 case 0: /* to simple char */
677 Trtbl[(int)nm[0]] = nm1[0];
678 break;
679 case 1: /* to named char */
680 if ((i = Findchar(nm1, 0, NULL, 0)) < 0
681 || strlen((char *)Schar[i].str) != 1)
682 Error(WARN, LINE, " bad named character: ",
683 (char *)nm1);
684 else
685 Trtbl[(int)nm[0]] = *(Schar[i].str);
686 break;
687 }
688 break;
689 case 1: /* named char */
690 if ((i = Findchar(nm, 0, NULL, 0)) < 0)
691 Error(WARN, LINE, " unknown named character: ", (char *)nm);
692 else {
693 switch (trout) {
694
695 case 0: /* to simple char */
696 Free(&Schar[i].str);
697 Schar[i].str = Newstr(nm1);
698 Schar[i].len = 1;
699 break;
700 case 1: /* to named char */
701 if ((j = Findchar(nm1, 0, NULL, 0)) < 0)
702 Error(WARN, LINE, " unknown named character: ",
703 (char *)nm1);
704 else
705 (void) Findchar(nm, Schar[j].len, Schar[j].str, 1);
706 break;
707 }
708 }
709 break;
710 }
711 }
712}
713
714
715/*
716 * Initialization - "^[.']\^b (fh|HF|NH) [01]"
717 *
718 * fh = first page header status
719 * HF = header/footer status
720 * NH = initialize number headers
721 */
722
723static void
724nr_Ub(line, brk)
725 unsigned char *line;
726 int brk;
727{
728 int i; /* temporary index */
729 unsigned char *s1, *s2; /* temporary string pointers */
730
731 if ((s1 = Field(2, line, 0)) == NULL)
732 return;
733 if ((s2 = Field(3, line, 0)) == NULL)
734 i = 0;
735 else
736 i = atoi((char *)s2);
737 if (s1[0] == 'f' && s1[1] == 'h')
738 Pass3(NOBREAK, (unsigned char *)"fph", NULL, i);
739 else if (s1[0] == 'H' && s1[1] == 'F')
740 Hdft = i;
741 else if (s1[0] == 'N' && s1[1] == 'H') {
742 for (i = 0; i < MAXNHNR; i++)
743 Nhnr[i] = 0;
744 } else
745 Error(WARN, LINE, " unknown initialization", NULL);
746}
747
748
749/*
750 * Character definitions - "^[.']\^c"
751 */
752
753static void
754nr_Uc(line, brk)
755 unsigned char *line;
756 int brk;
757{
758 unsigned char buf[MAXLINE]; /* temporary buffer */
759 int i; /* temporary index */
760 unsigned char *s1, *s2, *s3, /* temporary string pointers */
761 *s4, *s5;
762
763 s2 = Field(2, line, 0);
764 i = atoi((char *)Field(3, line, 0));
765 s4 = Field(4, line, 0);
766 if (i < 0 || i > MAXLINE/2 || *s2 == '\0') {
767 Error(WARN, LINE, " bad character definition", NULL);
768 return;
769 }
770 if (s4 == NULL)
771 s4 = (unsigned char *)"";
772 else if (*s4 == '"')
773 s4++;
774 s1 = buf;
775 while ((s5 = (unsigned char *)strchr((char *)s4, '\\')) != NULL) {
776 while (s5 > s4)
777 *s1++ = *s4++;
778 s4 = ++s5;
779 if (*s5 == '\\')
780 *s1++ = '\\';
781 else if (*s5 == 'b')
782 *s1++ = '\b';
783 if (*s4)
784 s4++;
785 }
786 while (*s1++ = *s4++)
787 ;
788 if (*s2 == 'h' && *(s2+1) == 'y')
789 (void) Findhy(buf, i, 1);
790 else
791 (void) Findchar(s2, i, buf, 1);
792}
793
794
795/*
796 * Font is OK - "[.']\^f <font_name_character>"
797 */
798
799static void
800nr_Uf(line, brk)
801 unsigned char *line;
802 int brk;
803{
804 int i; /* temporary index */
805
806 if (line[3] != '\0' && line[4] != '\0') {
807 for (i = 0; Fcode[i].nm; i++) {
808 if (line[4] == Fcode[i].nm) {
809 Fcode[i].status = '1';
810 return;
811 }
812 }
813 }
814 Error(WARN, LINE, " unknown font", NULL);
815}
816
817
818/*
819 * Resolutions - "[.']\^r cpi horizontal vertical"
820 */
821
822static void
823nr_Ur(line, brk)
824 unsigned char *line;
825 int brk;
826{
827 unsigned char buf[MAXLINE]; /* temporary buffer */
828 int i, j; /* temporary indexes */
829 double tval; /* temporary value */
830
831 if ((i = atoi((char *)Field(3, line, 0))) <= 0
832 || (j = atoi((char *)Field(4, line, 0))) <= 0) {
833 Error(WARN, LINE, " bad cpi resolutions", NULL);
834 return;
835 }
836 tval = (double) (240.0 / (double) i);
837 if (Findscale((int)'m', tval, 1) < 0)
838 Error(FATAL, LINE, " missing Scal['m']", NULL);
839 Scalen = tval;
840 if (Scalen <= 0.0) {
841 (void) sprintf((char *)buf, " bad Scale['n'] (%f)", Scalen);
842 Error(FATAL, LINE, (char *)buf, NULL);
843 }
844 if (Findscale((int)'n', tval, 1) < 0)
845 Error(FATAL, LINE, " missing Scale['n']", NULL);
846 Scalev = (double) (240.0 / (double) j);
847 if (Scalev <= 0.0) {
848 (void) sprintf((char *)buf, " bad Scale['v'] (%f)", Scalen);
849 Error(FATAL, LINE, (char *)buf, NULL);
850 }
851 if (Findscale((int)'v', Scalev, 1) < 0)
852 Error(FATAL, LINE, " missing Scale['v']", NULL);
853}
854
855
856/*
857 * Set line number and file name - "^[.']\^# <number> <file>"
858 *
859 * Lock line number and file name - "^[.']\^= <number> <file>"
860 */
861
862static void
863nr_UL(line, brk)
864 unsigned char *line;
865 int brk;
866{
867 unsigned char *s1; /* temporary string pointer */
868
869 if ((s1 = Field(2, line, 0)) != NULL)
870 P2il = atoi((char *)s1) - 1;
871 else
872 P2il = 0;
873 Lockil = (line[2] == '#') ? 0 : 1;
874 Free(&P2name);
875 if (Field(3, line, 1) != NULL) {
876 P2name = F;
877 F = NULL;
878 } else
879 P2name = NULL;
880}
Note: See TracBrowser for help on using the repository browser.