Annotation of src/usr.bin/m4/main.c, Revision 1.83
1.83 ! espie 1: /* $OpenBSD: main.c,v 1.82 2014/04/28 12:34:11 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;
176:
177: if (signal(SIGINT, SIG_IGN) != SIG_IGN)
178: signal(SIGINT, onintr);
179:
1.61 espie 180: init_macros();
1.14 espie 181: initspaces();
1.34 espie 182: STACKMAX = INITSTACKMAX;
183:
1.83 ! espie 184: mstack = xreallocarray(NULL, STACKMAX, sizeof(stae), NULL);
1.82 espie 185: sstack = xalloc(STACKMAX, NULL);
1.1 deraadt 186:
1.36 espie 187: maxout = 0;
188: outfile = NULL;
189: resizedivs(MAXOUT);
190:
1.77 sthen 191: while ((c = getopt(argc, argv, "gst:d:D:U:o:I:P")) != -1)
1.1 deraadt 192: switch(c) {
193:
194: case 'D': /* define something..*/
195: for (p = optarg; *p; p++)
196: if (*p == '=')
197: break;
198: if (*p)
199: *p++ = EOS;
200: dodefine(optarg, p);
1.16 espie 201: break;
202: case 'I':
203: addtoincludepath(optarg);
1.1 deraadt 204: break;
1.77 sthen 205: case 'P':
206: prefix_builtins = 1;
207: break;
1.1 deraadt 208: case 'U': /* undefine... */
1.59 espie 209: macro_popdef(optarg);
1.32 espie 210: break;
211: case 'g':
212: mimic_gnu = 1;
1.1 deraadt 213: break;
1.46 espie 214: case 'd':
215: set_trace_flags(optarg);
1.47 espie 216: break;
1.54 espie 217: case 's':
218: synch_lines = 1;
219: break;
1.47 espie 220: case 't':
1.49 espie 221: mark_traced(optarg, 1);
1.46 espie 222: break;
1.38 aaron 223: case 'o':
1.46 espie 224: trace_file(optarg);
1.38 aaron 225: break;
1.1 deraadt 226: case '?':
227: usage();
228: }
229:
230: argc -= optind;
231: argv += optind;
1.77 sthen 232:
233: initkwds();
234: if (mimic_gnu)
235: setup_builtin("format", FORMATTYPE);
1.1 deraadt 236:
237: active = stdout; /* default active output */
238: bbase[0] = bufbase;
239: if (!argc) {
1.79 marco 240: sp = -1; /* stack pointer initialized */
241: fp = 0; /* frame pointer initialized */
1.26 espie 242: set_input(infile+0, stdin, "stdin");
243: /* default input (naturally) */
1.1 deraadt 244: macro();
245: } else
246: for (; argc--; ++argv) {
247: p = *argv;
1.13 espie 248: if (p[0] == '-' && p[1] == EOS)
1.26 espie 249: set_input(infile, stdin, "stdin");
250: else if (fopen_trypath(infile, p) == NULL)
1.11 espie 251: err(1, "%s", p);
1.1 deraadt 252: sp = -1;
1.79 marco 253: fp = 0;
1.1 deraadt 254: macro();
1.79 marco 255: release_input(infile);
1.1 deraadt 256: }
257:
1.66 espie 258: if (wrapindex) {
259: int i;
260:
1.1 deraadt 261: ilevel = 0; /* in case m4wrap includes.. */
262: bufbase = bp = buf; /* use the entire buffer */
1.66 espie 263: if (mimic_gnu) {
264: while (wrapindex != 0) {
265: for (i = 0; i < wrapindex; i++)
266: pbstr(m4wraps[i]);
267: wrapindex =0;
268: macro();
269: }
270: } else {
271: for (i = 0; i < wrapindex; i++) {
272: pbstr(m4wraps[i]);
273: macro();
1.79 marco 274: }
1.66 espie 275: }
1.1 deraadt 276: }
277:
278: if (active != stdout)
279: active = stdout; /* reset output just in case */
1.36 espie 280: for (n = 1; n < maxout; n++) /* default wrap-up: undivert */
1.1 deraadt 281: if (outfile[n] != NULL)
282: getdiv(n);
283: /* remove bitbucket if used */
284: if (outfile[0] != NULL) {
285: (void) fclose(outfile[0]);
286: }
287:
1.81 espie 288: return exit_code;
1.1 deraadt 289: }
290:
291: /*
1.21 espie 292: * Look ahead for `token'.
1.2 deraadt 293: * (on input `t == token[0]')
294: * Used for comment and quoting delimiters.
295: * Returns 1 if `token' present; copied to output.
296: * 0 if `token' not found; all characters pushed back
297: */
1.18 espie 298: static int
1.53 espie 299: do_look_ahead(int t, const char *token)
1.2 deraadt 300: {
301: int i;
302:
1.43 espie 303: assert((unsigned char)t == (unsigned char)token[0]);
1.2 deraadt 304:
305: for (i = 1; *++token; i++) {
306: t = gpbc();
1.43 espie 307: if (t == EOF || (unsigned char)t != (unsigned char)*token) {
1.68 espie 308: pushback(t);
1.2 deraadt 309: while (--i)
1.68 espie 310: pushback(*--token);
1.2 deraadt 311: return 0;
312: }
313: }
314: return 1;
315: }
316:
1.79 marco 317: #define LOOK_AHEAD(t, token) (t != EOF && \
318: (unsigned char)(t)==(unsigned char)(token)[0] && \
1.43 espie 319: do_look_ahead(t,token))
1.2 deraadt 320:
321: /*
1.1 deraadt 322: * macro - the work horse..
323: */
1.18 espie 324: static void
1.56 deraadt 325: macro(void)
1.17 espie 326: {
1.34 espie 327: char token[MAXTOK+1];
1.17 espie 328: int t, l;
329: ndptr p;
330: int nlpar;
1.1 deraadt 331:
332: cycle {
1.2 deraadt 333: t = gpbc();
1.68 espie 334:
335: if (LOOK_AHEAD(t,lquote)) { /* strip quotes */
336: nlpar = 0;
337: record(quotes, nlpar++);
338: /*
339: * Opening quote: scan forward until matching
340: * closing quote has been found.
341: */
342: do {
343:
344: l = gpbc();
345: if (LOOK_AHEAD(l,rquote)) {
346: if (--nlpar > 0)
347: outputstr(rquote);
348: } else if (LOOK_AHEAD(l,lquote)) {
349: record(quotes, nlpar++);
350: outputstr(lquote);
351: } else if (l == EOF) {
352: if (nlpar == 1)
353: warnx("unclosed quote:");
354: else
355: warnx("%d unclosed quotes:", nlpar);
356: dump_stack(quotes, nlpar);
357: exit(1);
358: } else {
359: if (nlpar > 0) {
360: if (sp < 0)
361: reallyputchar(l);
362: else
363: CHRSAVE(l);
364: }
365: }
366: }
367: while (nlpar != 0);
368: } else if (sp < 0 && LOOK_AHEAD(t, scommt)) {
369: reallyoutputstr(scommt);
370:
371: for(;;) {
372: t = gpbc();
373: if (LOOK_AHEAD(t, ecommt)) {
374: reallyoutputstr(ecommt);
375: break;
376: }
377: if (t == EOF)
378: break;
379: reallyputchar(t);
380: }
381: } else if (t == '_' || isalpha(t)) {
1.29 espie 382: p = inspect(t, token);
1.59 espie 383: if (p != NULL)
1.68 espie 384: pushback(l = gpbc());
1.79 marco 385: if (p == NULL || (l != LPAREN &&
1.59 espie 386: (macro_getdef(p)->type & NEEDARGS) != 0))
1.29 espie 387: outputstr(token);
1.1 deraadt 388: else {
389: /*
390: * real thing.. First build a call frame:
391: */
392: pushf(fp); /* previous call frm */
1.59 espie 393: pushf(macro_getdef(p)->type); /* type of the call */
1.63 espie 394: pushf(is_traced(p));
1.1 deraadt 395: pushf(0); /* parenthesis level */
396: fp = sp; /* new frame pointer */
397: /*
398: * now push the string arguments:
399: */
1.59 espie 400: pushs1(macro_getdef(p)->defn); /* defn string */
401: pushs1((char *)macro_name(p)); /* macro name */
1.79 marco 402: pushs(ep); /* start next..*/
1.1 deraadt 403:
1.79 marco 404: if (l != LPAREN && PARLEV == 0) {
1.41 espie 405: /* no bracks */
406: chrsave(EOS);
407:
408: if (sp == STACKMAX)
409: errx(1, "internal stack overflow");
1.79 marco 410: eval((const char **) mstack+fp+1, 2,
1.60 espie 411: CALTYP, TRACESTATUS);
1.41 espie 412:
413: ep = PREVEP; /* flush strspace */
414: sp = PREVSP; /* previous sp.. */
415: fp = PREVFP; /* rewind stack...*/
1.1 deraadt 416: }
417: }
1.41 espie 418: } else if (t == EOF) {
1.83 ! espie 419: if (!mimic_gnu /* you can puke right there */
! 420: && sp > -1 && ilevel <= 0) {
1.27 espie 421: warnx( "unexpected end of input, unclosed parenthesis:");
422: dump_stack(paren, PARLEV);
423: exit(1);
424: }
1.1 deraadt 425: if (ilevel <= 0)
426: break; /* all done thanks.. */
1.26 espie 427: release_input(infile+ilevel--);
1.54 espie 428: emit_synchline();
1.1 deraadt 429: bufbase = bbase[ilevel];
430: continue;
1.68 espie 431: } else if (sp < 0) { /* not in a macro at all */
1.54 espie 432: reallyputchar(t); /* output directly.. */
1.1 deraadt 433: }
434:
435: else switch(t) {
436:
437: case LPAREN:
438: if (PARLEV > 0)
439: chrsave(t);
1.76 espie 440: while (isspace(l = gpbc())) /* skip blank, tab, nl.. */
441: if (PARLEV > 0)
442: chrsave(l);
1.68 espie 443: pushback(l);
1.27 espie 444: record(paren, PARLEV++);
1.1 deraadt 445: break;
446:
447: case RPAREN:
448: if (--PARLEV > 0)
449: chrsave(t);
450: else { /* end of argument list */
451: chrsave(EOS);
452:
453: if (sp == STACKMAX)
1.11 espie 454: errx(1, "internal stack overflow");
1.1 deraadt 455:
1.79 marco 456: eval((const char **) mstack+fp+1, sp-fp,
1.60 espie 457: CALTYP, TRACESTATUS);
1.1 deraadt 458:
459: ep = PREVEP; /* flush strspace */
460: sp = PREVSP; /* previous sp.. */
461: fp = PREVFP; /* rewind stack...*/
462: }
463: break;
464:
465: case COMMA:
466: if (PARLEV == 1) {
467: chrsave(EOS); /* new argument */
468: while (isspace(l = gpbc()))
469: ;
1.68 espie 470: pushback(l);
1.1 deraadt 471: pushs(ep);
472: } else
473: chrsave(t);
474: break;
475:
476: default:
1.22 espie 477: if (LOOK_AHEAD(t, scommt)) {
478: char *p;
479: for (p = scommt; *p; p++)
480: chrsave(*p);
481: for(;;) {
482: t = gpbc();
483: if (LOOK_AHEAD(t, ecommt)) {
484: for (p = ecommt; *p; p++)
485: chrsave(*p);
486: break;
487: }
488: if (t == EOF)
489: break;
1.48 espie 490: CHRSAVE(t);
1.22 espie 491: }
492: } else
1.48 espie 493: CHRSAVE(t); /* stack the char */
1.1 deraadt 494: break;
495: }
496: }
497: }
498:
1.79 marco 499: /*
500: * output string directly, without pushing it for reparses.
1.24 espie 501: */
502: void
1.53 espie 503: outputstr(const char *s)
1.24 espie 504: {
505: if (sp < 0)
1.54 espie 506: reallyoutputstr(s);
1.24 espie 507: else
508: while (*s)
1.48 espie 509: CHRSAVE(*s++);
1.24 espie 510: }
511:
1.54 espie 512: void
513: reallyoutputstr(const char *s)
514: {
515: if (synch_lines) {
516: while (*s) {
517: fputc(*s, active);
518: if (*s++ == '\n') {
519: infile[ilevel].synch_lineno++;
1.79 marco 520: if (infile[ilevel].synch_lineno !=
1.54 espie 521: infile[ilevel].lineno)
522: do_emit_synchline();
523: }
524: }
525: } else
526: fputs(s, active);
527: }
528:
529: void
530: reallyputchar(int c)
531: {
532: putc(c, active);
533: if (synch_lines && c == '\n') {
534: infile[ilevel].synch_lineno++;
535: if (infile[ilevel].synch_lineno != infile[ilevel].lineno)
536: do_emit_synchline();
537: }
538: }
539:
1.1 deraadt 540: /*
541: * build an input token..
1.79 marco 542: * consider only those starting with _ or A-Za-z.
1.1 deraadt 543: */
1.18 espie 544: static ndptr
1.79 marco 545: inspect(int c, char *tp)
1.1 deraadt 546: {
1.17 espie 547: char *name = tp;
548: char *etp = tp+MAXTOK;
549: ndptr p;
1.79 marco 550:
1.59 espie 551: *tp++ = c;
1.1 deraadt 552:
553: while ((isalnum(c = gpbc()) || c == '_') && tp < etp)
1.59 espie 554: *tp++ = c;
1.51 espie 555: if (c != EOF)
1.68 espie 556: PUSHBACK(c);
1.1 deraadt 557: *tp = EOS;
1.33 espie 558: /* token is too long, it won't match anything, but it can still
559: * be output. */
560: if (tp == ep) {
561: outputstr(name);
562: while (isalnum(c = gpbc()) || c == '_') {
563: if (sp < 0)
1.54 espie 564: reallyputchar(c);
1.33 espie 565: else
1.48 espie 566: CHRSAVE(c);
1.33 espie 567: }
568: *name = EOS;
1.59 espie 569: return NULL;
1.33 espie 570: }
1.1 deraadt 571:
1.63 espie 572: p = ohash_find(¯os, ohash_qlookupi(¯os, name, (const char **)&tp));
1.61 espie 573: if (p == NULL)
574: return NULL;
575: if (macro_getdef(p) == NULL)
576: return NULL;
577: return p;
1.1 deraadt 578: }
579:
580: /*
1.79 marco 581: * initkwds - initialise m4 keywords as fast as possible.
1.1 deraadt 582: * This very similar to install, but without certain overheads,
1.79 marco 583: * such as calling lookup. Malloc is not used for storing the
1.17 espie 584: * keyword strings, since we simply use the static pointers
1.1 deraadt 585: * within keywrds block.
586: */
1.18 espie 587: static void
1.56 deraadt 588: initkwds(void)
1.17 espie 589: {
1.59 espie 590: unsigned int type;
591: int i;
1.1 deraadt 592:
593: for (i = 0; i < MAXKEYS; i++) {
1.59 espie 594: type = keywrds[i].ktyp & TYPEMASK;
1.24 espie 595: if ((keywrds[i].ktyp & NOARGS) == 0)
1.59 espie 596: type |= NEEDARGS;
597: setup_builtin(keywrds[i].knam, type);
1.1 deraadt 598: }
1.45 espie 599: }
1.17 espie 600:
1.27 espie 601: static void
1.53 espie 602: record(struct position *t, int lev)
1.27 espie 603: {
604: if (lev < MAXRECORD) {
605: t[lev].name = CURRENT_NAME;
606: t[lev].line = CURRENT_LINE;
607: }
608: }
609:
610: static void
1.53 espie 611: dump_stack(struct position *t, int lev)
1.27 espie 612: {
613: int i;
614:
615: for (i = 0; i < lev; i++) {
616: if (i == MAXRECORD) {
617: fprintf(stderr, " ...\n");
618: break;
619: }
1.79 marco 620: fprintf(stderr, " %s at line %lu\n",
1.27 espie 621: t[i].name, t[i].line);
622: }
1.34 espie 623: }
624:
625:
1.79 marco 626: static void
1.56 deraadt 627: enlarge_stack(void)
1.34 espie 628: {
1.64 espie 629: STACKMAX += STACKMAX/2;
1.82 espie 630: mstack = xreallocarray(mstack, STACKMAX, sizeof(stae),
1.79 marco 631: "Evaluation stack overflow (%lu)",
1.64 espie 632: (unsigned long)STACKMAX);
633: sstack = xrealloc(sstack, STACKMAX,
1.79 marco 634: "Evaluation stack overflow (%lu)",
1.64 espie 635: (unsigned long)STACKMAX);
1.27 espie 636: }