Deleted Added
full compact
run.c (125601) run.c (146299)
1/****************************************************************
2Copyright (C) Lucent Technologies 1997
3All Rights Reserved
4
5Permission to use, copy, modify, and distribute this software and
6its documentation for any purpose and without fee is hereby
7granted, provided that the above copyright notice appear in all
8copies and that both that the copyright notice and this

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

21ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22THIS SOFTWARE.
23****************************************************************/
24
25#define DEBUG
26#include <stdio.h>
27#include <ctype.h>
28#include <setjmp.h>
1/****************************************************************
2Copyright (C) Lucent Technologies 1997
3All Rights Reserved
4
5Permission to use, copy, modify, and distribute this software and
6its documentation for any purpose and without fee is hereby
7granted, provided that the above copyright notice appear in all
8copies and that both that the copyright notice and this

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

21ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22THIS SOFTWARE.
23****************************************************************/
24
25#define DEBUG
26#include <stdio.h>
27#include <ctype.h>
28#include <setjmp.h>
29#include <limits.h>
29#include <math.h>
30#include <string.h>
31#include <stdlib.h>
32#include <time.h>
33#include "awk.h"
34#include "ytab.h"
35
36#define tempfree(x) if (istemp(x)) tfree(x); else

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

700 x = tmps;
701 tmps = x->cnext;
702 *x = tempcell;
703 return(x);
704}
705
706Cell *indirect(Node **a, int n) /* $( a[0] ) */
707{
30#include <math.h>
31#include <string.h>
32#include <stdlib.h>
33#include <time.h>
34#include "awk.h"
35#include "ytab.h"
36
37#define tempfree(x) if (istemp(x)) tfree(x); else

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

701 x = tmps;
702 tmps = x->cnext;
703 *x = tempcell;
704 return(x);
705}
706
707Cell *indirect(Node **a, int n) /* $( a[0] ) */
708{
709 Awkfloat val;
708 Cell *x;
709 int m;
710 char *s;
711
712 x = execute(a[0]);
710 Cell *x;
711 int m;
712 char *s;
713
714 x = execute(a[0]);
713 m = (int) getfval(x);
715 val = getfval(x); /* freebsd: defend against super large field numbers */
716 if ((Awkfloat)INT_MAX < val)
717 FATAL("trying to access out of range field %s", x->nval);
718 m = (int) val;
714 if (m == 0 && !is_number(s = getsval(x))) /* suspicion! */
715 FATAL("illegal field $(%s), name \"%s\"", s, x->nval);
716 /* BUG: can x->nval ever be null??? */
717 tempfree(x);
718 x = fieldadr(m);
719 x->ctype = OCELL; /* BUG? why are these needed? */
720 x->csub = CFLD;
721 return(x);

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

1252 if (*(patbeg+patlen-1) == 0 || *s == 0) {
1253 n++;
1254 sprintf(num, "%d", n);
1255 setsymtab(num, "", 0.0, STR, (Array *) ap->sval);
1256 pfa->initstat = tempstat;
1257 goto spdone;
1258 }
1259 } while (nematch(pfa,s));
719 if (m == 0 && !is_number(s = getsval(x))) /* suspicion! */
720 FATAL("illegal field $(%s), name \"%s\"", s, x->nval);
721 /* BUG: can x->nval ever be null??? */
722 tempfree(x);
723 x = fieldadr(m);
724 x->ctype = OCELL; /* BUG? why are these needed? */
725 x->csub = CFLD;
726 return(x);

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

1257 if (*(patbeg+patlen-1) == 0 || *s == 0) {
1258 n++;
1259 sprintf(num, "%d", n);
1260 setsymtab(num, "", 0.0, STR, (Array *) ap->sval);
1261 pfa->initstat = tempstat;
1262 goto spdone;
1263 }
1264 } while (nematch(pfa,s));
1265 pfa->initstat = tempstat; /* bwk: has to be here to reset */
1266 /* cf gsub and refldbld */
1260 }
1261 n++;
1262 sprintf(num, "%d", n);
1263 if (is_number(s))
1264 setsymtab(num, s, atof(s), STR|NUM, (Array *) ap->sval);
1265 else
1266 setsymtab(num, s, 0.0, STR, (Array *) ap->sval);
1267 spdone:

--- 653 unchanged lines hidden ---
1267 }
1268 n++;
1269 sprintf(num, "%d", n);
1270 if (is_number(s))
1271 setsymtab(num, s, atof(s), STR|NUM, (Array *) ap->sval);
1272 else
1273 setsymtab(num, s, 0.0, STR, (Array *) ap->sval);
1274 spdone:

--- 653 unchanged lines hidden ---