main.c (d1d015864103b253b3fcb2f72a0da5b0cfeb31b6) main.c (88497f0c68b1469cbf8560b8c4a022dbc509ceae)
1/* $OpenBSD: main.c,v 1.81 2012/04/12 17:00:11 espie Exp $ */
1/* $OpenBSD: main.c,v 1.83 2014/05/12 19:11:19 espie Exp $ */
2/* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */
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.

--- 165 unchanged lines hidden (view full) ---

175
176 if (signal(SIGINT, SIG_IGN) != SIG_IGN)
177 signal(SIGINT, onintr);
178
179 init_macros();
180 initspaces();
181 STACKMAX = INITSTACKMAX;
182
2/* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */
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.

--- 165 unchanged lines hidden (view full) ---

175
176 if (signal(SIGINT, SIG_IGN) != SIG_IGN)
177 signal(SIGINT, onintr);
178
179 init_macros();
180 initspaces();
181 STACKMAX = INITSTACKMAX;
182
183 mstack = (stae *)xalloc(sizeof(stae) * STACKMAX, NULL);
184 sstack = (char *)xalloc(STACKMAX, NULL);
183 mstack = xreallocarray(NULL, STACKMAX, sizeof(stae), NULL);
184 sstack = xalloc(STACKMAX, NULL);
185
186 maxout = 0;
187 outfile = NULL;
188 resizedivs(MAXOUT);
189
190 while ((c = getopt(argc, argv, "gst:d:D:U:o:I:P")) != -1)
191 switch(c) {
192

--- 217 unchanged lines hidden (view full) ---

410 CALTYP, TRACESTATUS);
411
412 ep = PREVEP; /* flush strspace */
413 sp = PREVSP; /* previous sp.. */
414 fp = PREVFP; /* rewind stack...*/
415 }
416 }
417 } else if (t == EOF) {
185
186 maxout = 0;
187 outfile = NULL;
188 resizedivs(MAXOUT);
189
190 while ((c = getopt(argc, argv, "gst:d:D:U:o:I:P")) != -1)
191 switch(c) {
192

--- 217 unchanged lines hidden (view full) ---

410 CALTYP, TRACESTATUS);
411
412 ep = PREVEP; /* flush strspace */
413 sp = PREVSP; /* previous sp.. */
414 fp = PREVFP; /* rewind stack...*/
415 }
416 }
417 } else if (t == EOF) {
418 if (sp > -1 && ilevel <= 0) {
418 if (!mimic_gnu /* you can puke right there */
419 && sp > -1 && ilevel <= 0) {
419 warnx( "unexpected end of input, unclosed parenthesis:");
420 dump_stack(paren, PARLEV);
421 exit(1);
422 }
423 if (ilevel <= 0)
424 break; /* all done thanks.. */
425 release_input(infile+ilevel--);
426 emit_synchline();

--- 193 unchanged lines hidden (view full) ---

620 }
621}
622
623
624static void
625enlarge_stack(void)
626{
627 STACKMAX += STACKMAX/2;
420 warnx( "unexpected end of input, unclosed parenthesis:");
421 dump_stack(paren, PARLEV);
422 exit(1);
423 }
424 if (ilevel <= 0)
425 break; /* all done thanks.. */
426 release_input(infile+ilevel--);
427 emit_synchline();

--- 193 unchanged lines hidden (view full) ---

621 }
622}
623
624
625static void
626enlarge_stack(void)
627{
628 STACKMAX += STACKMAX/2;
628 mstack = xrealloc(mstack, sizeof(stae) * STACKMAX,
629 mstack = xreallocarray(mstack, STACKMAX, sizeof(stae),
629 "Evaluation stack overflow (%lu)",
630 (unsigned long)STACKMAX);
631 sstack = xrealloc(sstack, STACKMAX,
632 "Evaluation stack overflow (%lu)",
633 (unsigned long)STACKMAX);
634}
630 "Evaluation stack overflow (%lu)",
631 (unsigned long)STACKMAX);
632 sstack = xrealloc(sstack, STACKMAX,
633 "Evaluation stack overflow (%lu)",
634 (unsigned long)STACKMAX);
635}