Annotation of src/usr.bin/m4/main.c, Revision 1.85
1.85 ! espie 1: /* $OpenBSD: main.c,v 1.84 2014/12/21 09:33:12 espie Exp $ */
1.7 deraadt 2: /* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */
1.1 deraadt 3:
4: /*-
5: * Copyright (c) 1989, 1993
6: * The Regents of the University of California. All rights reserved.
7: *
8: * This code is derived from software contributed to Berkeley by
9: * Ozan Yigit at York University.
10: *
11: * Redistribution and use in source and binary forms, with or without
12: * modification, are permitted provided that the following conditions
13: * are met:
14: * 1. Redistributions of source code must retain the above copyright
15: * notice, this list of conditions and the following disclaimer.
16: * 2. Redistributions in binary form must reproduce the above copyright
17: * notice, this list of conditions and the following disclaimer in the
18: * documentation and/or other materials provided with the distribution.
1.55 millert 19: * 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 20: * may be used to endorse or promote products derived from this software
21: * without specific prior written permission.
22: *
23: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33: * SUCH DAMAGE.
34: */
35:
36: /*
37: * main.c
38: * Facility: m4 macro processor
39: * by: oz
40: */
41:
1.21 espie 42: #include <assert.h>
1.1 deraadt 43: #include <signal.h>
1.74 espie 44: #include <err.h>
1.1 deraadt 45: #include <errno.h>
46: #include <unistd.h>
47: #include <stdio.h>
48: #include <ctype.h>
49: #include <string.h>
1.13 espie 50: #include <stddef.h>
1.69 espie 51: #include <stdint.h>
1.34 espie 52: #include <stdlib.h>
1.63 espie 53: #include <ohash.h>
1.1 deraadt 54: #include "mdef.h"
55: #include "stdd.h"
56: #include "extern.h"
57: #include "pathnames.h"
58:
1.79 marco 59: stae *mstack; /* stack of m4 machine */
60: char *sstack; /* shadow stack, for string space extension */
1.34 espie 61: static size_t STACKMAX; /* current maximum size of stack */
1.79 marco 62: int sp; /* current m4 stack pointer */
63: int fp; /* m4 call frame pointer */
1.26 espie 64: struct input_file infile[MAXINP];/* input file stack (0=stdin) */
1.36 espie 65: FILE **outfile; /* diversion array(0=bitbucket)*/
66: int maxout;
1.1 deraadt 67: FILE *active; /* active output file pointer */
1.79 marco 68: int ilevel = 0; /* input file stack pointer */
69: int oindex = 0; /* diversion index.. */
1.1 deraadt 70: char *null = ""; /* as it says.. just a null.. */
1.79 marco 71: char **m4wraps = NULL; /* m4wraps array. */
1.66 espie 72: int maxwraps = 0; /* size of m4wraps array */
73: int wrapindex = 0; /* current offset in m4wraps */
1.2 deraadt 74: char lquote[MAXCCHARS+1] = {LQUOTE}; /* left quote character (`) */
75: char rquote[MAXCCHARS+1] = {RQUOTE}; /* right quote character (') */
76: char scommt[MAXCCHARS+1] = {SCOMMT}; /* start character for comment */
77: char ecommt[MAXCCHARS+1] = {ECOMMT}; /* end character for comment */
1.54 espie 78: int synch_lines = 0; /* line synchronisation for C preprocessor */
1.77 sthen 79: int prefix_builtins = 0; /* -P option to prefix builtin keywords */
1.1 deraadt 80:
1.63 espie 81: struct keyblk {
82: char *knam; /* keyword name */
83: int ktyp; /* keyword type */
84: };
85:
1.1 deraadt 86: struct keyblk keywrds[] = { /* m4 keywords to be installed */
1.8 millert 87: { "include", INCLTYPE },
88: { "sinclude", SINCTYPE },
89: { "define", DEFITYPE },
90: { "defn", DEFNTYPE },
1.24 espie 91: { "divert", DIVRTYPE | NOARGS },
1.8 millert 92: { "expr", EXPRTYPE },
93: { "eval", EXPRTYPE },
94: { "substr", SUBSTYPE },
95: { "ifelse", IFELTYPE },
96: { "ifdef", IFDFTYPE },
97: { "len", LENGTYPE },
98: { "incr", INCRTYPE },
99: { "decr", DECRTYPE },
1.24 espie 100: { "dnl", DNLNTYPE | NOARGS },
101: { "changequote", CHNQTYPE | NOARGS },
102: { "changecom", CHNCTYPE | NOARGS },
1.8 millert 103: { "index", INDXTYPE },
1.1 deraadt 104: #ifdef EXTENDED
1.8 millert 105: { "paste", PASTTYPE },
106: { "spaste", SPASTYPE },
1.79 marco 107: /* Newer extensions, needed to handle gnu-m4 scripts */
1.31 espie 108: { "indir", INDIRTYPE},
109: { "builtin", BUILTINTYPE},
110: { "patsubst", PATSTYPE},
111: { "regexp", REGEXPTYPE},
1.35 espie 112: { "esyscmd", ESYSCMDTYPE},
1.31 espie 113: { "__file__", FILENAMETYPE | NOARGS},
114: { "__line__", LINETYPE | NOARGS},
1.1 deraadt 115: #endif
1.8 millert 116: { "popdef", POPDTYPE },
117: { "pushdef", PUSDTYPE },
1.24 espie 118: { "dumpdef", DUMPTYPE | NOARGS },
119: { "shift", SHIFTYPE | NOARGS },
1.8 millert 120: { "translit", TRNLTYPE },
121: { "undefine", UNDFTYPE },
1.24 espie 122: { "undivert", UNDVTYPE | NOARGS },
123: { "divnum", DIVNTYPE | NOARGS },
1.8 millert 124: { "maketemp", MKTMTYPE },
1.78 espie 125: { "mkstemp", MKTMTYPE },
1.24 espie 126: { "errprint", ERRPTYPE | NOARGS },
127: { "m4wrap", M4WRTYPE | NOARGS },
128: { "m4exit", EXITTYPE | NOARGS },
1.8 millert 129: { "syscmd", SYSCTYPE },
1.24 espie 130: { "sysval", SYSVTYPE | NOARGS },
1.49 espie 131: { "traceon", TRACEONTYPE | NOARGS },
132: { "traceoff", TRACEOFFTYPE | NOARGS },
1.1 deraadt 133:
1.79 marco 134: #if defined(unix) || defined(__unix__)
1.24 espie 135: { "unix", SELFTYPE | NOARGS },
1.1 deraadt 136: #else
137: #ifdef vms
1.24 espie 138: { "vms", SELFTYPE | NOARGS },
1.1 deraadt 139: #endif
140: #endif
141: };
142:
143: #define MAXKEYS (sizeof(keywrds)/sizeof(struct keyblk))
144:
145: extern int optind;
146: extern char *optarg;
147:
1.27 espie 148: #define MAXRECORD 50
149: static struct position {
150: char *name;
151: unsigned long line;
152: } quotes[MAXRECORD], paren[MAXRECORD];
153:
1.52 millert 154: static void record(struct position *, int);
155: static void dump_stack(struct position *, int);
1.27 espie 156:
1.52 millert 157: static void macro(void);
158: static void initkwds(void);
159: static ndptr inspect(int, char *);
160: static int do_look_ahead(int, const char *);
1.54 espie 161: static void reallyoutputstr(const char *);
162: static void reallyputchar(int);
1.18 espie 163:
1.52 millert 164: static void enlarge_stack(void);
1.34 espie 165:
1.52 millert 166: int main(int, char *[]);
1.1 deraadt 167:
1.81 espie 168: int exit_code = 0;
169:
1.1 deraadt 170: int
1.53 espie 171: main(int argc, char *argv[])
1.1 deraadt 172: {
1.17 espie 173: int c;
174: int n;
1.1 deraadt 175: char *p;
1.85 ! espie 176:
! 177: if (pledge("stdio rpath wpath cpath tmppath proc exec", NULL) == -1)
! 178: err(1, "pledge");
1.1 deraadt 179:
180: if (signal(SIGINT, SIG_IGN) != SIG_IGN)
181: signal(SIGINT, onintr);
182:
1.61 espie 183: init_macros();
1.14 espie 184: initspaces();
1.34 espie 185: STACKMAX = INITSTACKMAX;
186:
1.83 espie 187: mstack = xreallocarray(NULL, STACKMAX, sizeof(stae), NULL);
1.82 espie 188: sstack = xalloc(STACKMAX, NULL);
1.1 deraadt 189:
1.36 espie 190: maxout = 0;
191: outfile = NULL;
192: resizedivs(MAXOUT);
193:
1.77 sthen 194: while ((c = getopt(argc, argv, "gst:d:D:U:o:I:P")) != -1)
1.1 deraadt 195: switch(c) {
196:
197: case 'D': /* define something..*/
198: for (p = optarg; *p; p++)
199: if (*p == '=')
200: break;
201: if (*p)
202: *p++ = EOS;
203: dodefine(optarg, p);
1.16 espie 204: break;
205: case 'I':
206: addtoincludepath(optarg);
1.1 deraadt 207: break;
1.77 sthen 208: case 'P':
209: prefix_builtins = 1;
210: break;
1.1 deraadt 211: case 'U': /* undefine... */
1.59 espie 212: macro_popdef(optarg);
1.32 espie 213: break;
214: case 'g':
215: mimic_gnu = 1;
1.1 deraadt 216: break;
1.46 espie 217: case 'd':
218: set_trace_flags(optarg);
1.47 espie 219: break;
1.54 espie 220: case 's':
221: synch_lines = 1;
222: break;
1.47 espie 223: case 't':
1.49 espie 224: mark_traced(optarg, 1);
1.46 espie 225: break;
1.38 aaron 226: case 'o':
1.46 espie 227: trace_file(optarg);
1.38 aaron 228: break;
1.1 deraadt 229: case '?':
230: usage();
231: }
232:
233: argc -= optind;
234: argv += optind;
1.77 sthen 235:
236: initkwds();
237: if (mimic_gnu)
238: setup_builtin("format", FORMATTYPE);
1.1 deraadt 239:
240: active = stdout; /* default active output */
241: bbase[0] = bufbase;
242: if (!argc) {
1.79 marco 243: sp = -1; /* stack pointer initialized */
244: fp = 0; /* frame pointer initialized */
1.26 espie 245: set_input(infile+0, stdin, "stdin");
246: /* default input (naturally) */
1.1 deraadt 247: macro();
248: } else
249: for (; argc--; ++argv) {
250: p = *argv;
1.13 espie 251: if (p[0] == '-' && p[1] == EOS)
1.26 espie 252: set_input(infile, stdin, "stdin");
253: else if (fopen_trypath(infile, p) == NULL)
1.11 espie 254: err(1, "%s", p);
1.1 deraadt 255: sp = -1;
1.79 marco 256: fp = 0;
1.1 deraadt 257: macro();
1.79 marco 258: release_input(infile);
1.1 deraadt 259: }
260:
1.66 espie 261: if (wrapindex) {
262: int i;
263:
1.1 deraadt 264: ilevel = 0; /* in case m4wrap includes.. */
265: bufbase = bp = buf; /* use the entire buffer */
1.66 espie 266: if (mimic_gnu) {
267: while (wrapindex != 0) {
268: for (i = 0; i < wrapindex; i++)
269: pbstr(m4wraps[i]);
270: wrapindex =0;
271: macro();
272: }
273: } else {
274: for (i = 0; i < wrapindex; i++) {
275: pbstr(m4wraps[i]);
276: macro();
1.79 marco 277: }
1.66 espie 278: }
1.1 deraadt 279: }
280:
281: if (active != stdout)
282: active = stdout; /* reset output just in case */
1.36 espie 283: for (n = 1; n < maxout; n++) /* default wrap-up: undivert */
1.1 deraadt 284: if (outfile[n] != NULL)
285: getdiv(n);
286: /* remove bitbucket if used */
287: if (outfile[0] != NULL) {
288: (void) fclose(outfile[0]);
289: }
290:
1.81 espie 291: return exit_code;
1.1 deraadt 292: }
293:
294: /*
1.21 espie 295: * Look ahead for `token'.
1.2 deraadt 296: * (on input `t == token[0]')
297: * Used for comment and quoting delimiters.
298: * Returns 1 if `token' present; copied to output.
299: * 0 if `token' not found; all characters pushed back
300: */
1.18 espie 301: static int
1.53 espie 302: do_look_ahead(int t, const char *token)
1.2 deraadt 303: {
304: int i;
305:
1.43 espie 306: assert((unsigned char)t == (unsigned char)token[0]);
1.2 deraadt 307:
308: for (i = 1; *++token; i++) {
309: t = gpbc();
1.43 espie 310: if (t == EOF || (unsigned char)t != (unsigned char)*token) {
1.68 espie 311: pushback(t);
1.2 deraadt 312: while (--i)
1.68 espie 313: pushback(*--token);
1.2 deraadt 314: return 0;
315: }
316: }
317: return 1;
318: }
319:
1.79 marco 320: #define LOOK_AHEAD(t, token) (t != EOF && \
321: (unsigned char)(t)==(unsigned char)(token)[0] && \
1.43 espie 322: do_look_ahead(t,token))
1.2 deraadt 323:
324: /*
1.1 deraadt 325: * macro - the work horse..
326: */
1.18 espie 327: static void
1.56 deraadt 328: macro(void)
1.17 espie 329: {
1.34 espie 330: char token[MAXTOK+1];
1.17 espie 331: int t, l;
332: ndptr p;
333: int nlpar;
1.1 deraadt 334:
335: cycle {
1.2 deraadt 336: t = gpbc();
1.68 espie 337:
338: if (LOOK_AHEAD(t,lquote)) { /* strip quotes */
339: nlpar = 0;
340: record(quotes, nlpar++);
341: /*
342: * Opening quote: scan forward until matching
343: * closing quote has been found.
344: */
345: do {
346:
347: l = gpbc();
348: if (LOOK_AHEAD(l,rquote)) {
349: if (--nlpar > 0)
350: outputstr(rquote);
351: } else if (LOOK_AHEAD(l,lquote)) {
352: record(quotes, nlpar++);
353: outputstr(lquote);
354: } else if (l == EOF) {
355: if (nlpar == 1)
356: warnx("unclosed quote:");
357: else
358: warnx("%d unclosed quotes:", nlpar);
359: dump_stack(quotes, nlpar);
360: exit(1);
361: } else {
362: if (nlpar > 0) {
363: if (sp < 0)
364: reallyputchar(l);
365: else
366: CHRSAVE(l);
367: }
368: }
369: }
370: while (nlpar != 0);
371: } else if (sp < 0 && LOOK_AHEAD(t, scommt)) {
372: reallyoutputstr(scommt);
373:
374: for(;;) {
375: t = gpbc();
376: if (LOOK_AHEAD(t, ecommt)) {
377: reallyoutputstr(ecommt);
378: break;
379: }
380: if (t == EOF)
381: break;
382: reallyputchar(t);
383: }
384: } else if (t == '_' || isalpha(t)) {
1.29 espie 385: p = inspect(t, token);
1.59 espie 386: if (p != NULL)
1.68 espie 387: pushback(l = gpbc());
1.79 marco 388: if (p == NULL || (l != LPAREN &&
1.59 espie 389: (macro_getdef(p)->type & NEEDARGS) != 0))
1.29 espie 390: outputstr(token);
1.1 deraadt 391: else {
392: /*
393: * real thing.. First build a call frame:
394: */
395: pushf(fp); /* previous call frm */
1.59 espie 396: pushf(macro_getdef(p)->type); /* type of the call */
1.63 espie 397: pushf(is_traced(p));
1.1 deraadt 398: pushf(0); /* parenthesis level */
399: fp = sp; /* new frame pointer */
400: /*
401: * now push the string arguments:
402: */
1.84 espie 403: pushdef(p); /* defn string */
1.59 espie 404: pushs1((char *)macro_name(p)); /* macro name */
1.79 marco 405: pushs(ep); /* start next..*/
1.1 deraadt 406:
1.79 marco 407: if (l != LPAREN && PARLEV == 0) {
1.41 espie 408: /* no bracks */
409: chrsave(EOS);
410:
411: if (sp == STACKMAX)
412: errx(1, "internal stack overflow");
1.79 marco 413: eval((const char **) mstack+fp+1, 2,
1.60 espie 414: CALTYP, TRACESTATUS);
1.41 espie 415:
416: ep = PREVEP; /* flush strspace */
417: sp = PREVSP; /* previous sp.. */
418: fp = PREVFP; /* rewind stack...*/
1.1 deraadt 419: }
420: }
1.41 espie 421: } else if (t == EOF) {
1.83 espie 422: if (!mimic_gnu /* you can puke right there */
423: && sp > -1 && ilevel <= 0) {
1.27 espie 424: warnx( "unexpected end of input, unclosed parenthesis:");
425: dump_stack(paren, PARLEV);
426: exit(1);
427: }
1.1 deraadt 428: if (ilevel <= 0)
429: break; /* all done thanks.. */
1.26 espie 430: release_input(infile+ilevel--);
1.54 espie 431: emit_synchline();
1.1 deraadt 432: bufbase = bbase[ilevel];
433: continue;
1.68 espie 434: } else if (sp < 0) { /* not in a macro at all */
1.54 espie 435: reallyputchar(t); /* output directly.. */
1.1 deraadt 436: }
437:
438: else switch(t) {
439:
440: case LPAREN:
441: if (PARLEV > 0)
442: chrsave(t);
1.76 espie 443: while (isspace(l = gpbc())) /* skip blank, tab, nl.. */
444: if (PARLEV > 0)
445: chrsave(l);
1.68 espie 446: pushback(l);
1.27 espie 447: record(paren, PARLEV++);
1.1 deraadt 448: break;
449:
450: case RPAREN:
451: if (--PARLEV > 0)
452: chrsave(t);
453: else { /* end of argument list */
454: chrsave(EOS);
455:
456: if (sp == STACKMAX)
1.11 espie 457: errx(1, "internal stack overflow");
1.1 deraadt 458:
1.79 marco 459: eval((const char **) mstack+fp+1, sp-fp,
1.60 espie 460: CALTYP, TRACESTATUS);
1.1 deraadt 461:
462: ep = PREVEP; /* flush strspace */
463: sp = PREVSP; /* previous sp.. */
464: fp = PREVFP; /* rewind stack...*/
465: }
466: break;
467:
468: case COMMA:
469: if (PARLEV == 1) {
470: chrsave(EOS); /* new argument */
471: while (isspace(l = gpbc()))
472: ;
1.68 espie 473: pushback(l);
1.1 deraadt 474: pushs(ep);
475: } else
476: chrsave(t);
477: break;
478:
479: default:
1.22 espie 480: if (LOOK_AHEAD(t, scommt)) {
481: char *p;
482: for (p = scommt; *p; p++)
483: chrsave(*p);
484: for(;;) {
485: t = gpbc();
486: if (LOOK_AHEAD(t, ecommt)) {
487: for (p = ecommt; *p; p++)
488: chrsave(*p);
489: break;
490: }
491: if (t == EOF)
492: break;
1.48 espie 493: CHRSAVE(t);
1.22 espie 494: }
495: } else
1.48 espie 496: CHRSAVE(t); /* stack the char */
1.1 deraadt 497: break;
498: }
499: }
500: }
501:
1.79 marco 502: /*
503: * output string directly, without pushing it for reparses.
1.24 espie 504: */
505: void
1.53 espie 506: outputstr(const char *s)
1.24 espie 507: {
508: if (sp < 0)
1.54 espie 509: reallyoutputstr(s);
1.24 espie 510: else
511: while (*s)
1.48 espie 512: CHRSAVE(*s++);
1.24 espie 513: }
514:
1.54 espie 515: void
516: reallyoutputstr(const char *s)
517: {
518: if (synch_lines) {
519: while (*s) {
520: fputc(*s, active);
521: if (*s++ == '\n') {
522: infile[ilevel].synch_lineno++;
1.79 marco 523: if (infile[ilevel].synch_lineno !=
1.54 espie 524: infile[ilevel].lineno)
525: do_emit_synchline();
526: }
527: }
528: } else
529: fputs(s, active);
530: }
531:
532: void
533: reallyputchar(int c)
534: {
535: putc(c, active);
536: if (synch_lines && c == '\n') {
537: infile[ilevel].synch_lineno++;
538: if (infile[ilevel].synch_lineno != infile[ilevel].lineno)
539: do_emit_synchline();
540: }
541: }
542:
1.1 deraadt 543: /*
544: * build an input token..
1.79 marco 545: * consider only those starting with _ or A-Za-z.
1.1 deraadt 546: */
1.18 espie 547: static ndptr
1.79 marco 548: inspect(int c, char *tp)
1.1 deraadt 549: {
1.17 espie 550: char *name = tp;
551: char *etp = tp+MAXTOK;
552: ndptr p;
1.79 marco 553:
1.59 espie 554: *tp++ = c;
1.1 deraadt 555:
556: while ((isalnum(c = gpbc()) || c == '_') && tp < etp)
1.59 espie 557: *tp++ = c;
1.51 espie 558: if (c != EOF)
1.68 espie 559: PUSHBACK(c);
1.1 deraadt 560: *tp = EOS;
1.33 espie 561: /* token is too long, it won't match anything, but it can still
562: * be output. */
563: if (tp == ep) {
564: outputstr(name);
565: while (isalnum(c = gpbc()) || c == '_') {
566: if (sp < 0)
1.54 espie 567: reallyputchar(c);
1.33 espie 568: else
1.48 espie 569: CHRSAVE(c);
1.33 espie 570: }
571: *name = EOS;
1.59 espie 572: return NULL;
1.33 espie 573: }
1.1 deraadt 574:
1.63 espie 575: p = ohash_find(¯os, ohash_qlookupi(¯os, name, (const char **)&tp));
1.61 espie 576: if (p == NULL)
577: return NULL;
578: if (macro_getdef(p) == NULL)
579: return NULL;
580: return p;
1.1 deraadt 581: }
582:
583: /*
1.79 marco 584: * initkwds - initialise m4 keywords as fast as possible.
1.1 deraadt 585: * This very similar to install, but without certain overheads,
1.79 marco 586: * such as calling lookup. Malloc is not used for storing the
1.17 espie 587: * keyword strings, since we simply use the static pointers
1.1 deraadt 588: * within keywrds block.
589: */
1.18 espie 590: static void
1.56 deraadt 591: initkwds(void)
1.17 espie 592: {
1.59 espie 593: unsigned int type;
594: int i;
1.1 deraadt 595:
596: for (i = 0; i < MAXKEYS; i++) {
1.59 espie 597: type = keywrds[i].ktyp & TYPEMASK;
1.24 espie 598: if ((keywrds[i].ktyp & NOARGS) == 0)
1.59 espie 599: type |= NEEDARGS;
600: setup_builtin(keywrds[i].knam, type);
1.1 deraadt 601: }
1.45 espie 602: }
1.17 espie 603:
1.27 espie 604: static void
1.53 espie 605: record(struct position *t, int lev)
1.27 espie 606: {
607: if (lev < MAXRECORD) {
608: t[lev].name = CURRENT_NAME;
609: t[lev].line = CURRENT_LINE;
610: }
611: }
612:
613: static void
1.53 espie 614: dump_stack(struct position *t, int lev)
1.27 espie 615: {
616: int i;
617:
618: for (i = 0; i < lev; i++) {
619: if (i == MAXRECORD) {
620: fprintf(stderr, " ...\n");
621: break;
622: }
1.79 marco 623: fprintf(stderr, " %s at line %lu\n",
1.27 espie 624: t[i].name, t[i].line);
625: }
1.34 espie 626: }
627:
628:
1.79 marco 629: static void
1.56 deraadt 630: enlarge_stack(void)
1.34 espie 631: {
1.64 espie 632: STACKMAX += STACKMAX/2;
1.82 espie 633: mstack = xreallocarray(mstack, STACKMAX, sizeof(stae),
1.79 marco 634: "Evaluation stack overflow (%lu)",
1.64 espie 635: (unsigned long)STACKMAX);
636: sstack = xrealloc(sstack, STACKMAX,
1.79 marco 637: "Evaluation stack overflow (%lu)",
1.64 espie 638: (unsigned long)STACKMAX);
1.27 espie 639: }