Deleted Added
full compact
run.c (224731) run.c (244988)
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

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

18SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
20IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22THIS SOFTWARE.
23****************************************************************/
24
25#include <sys/cdefs.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

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

18SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
20IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22THIS SOFTWARE.
23****************************************************************/
24
25#include <sys/cdefs.h>
26__FBSDID("$FreeBSD: head/contrib/one-true-awk/run.c 224731 2011-08-09 12:54:43Z ru $");
26__FBSDID("$FreeBSD: head/contrib/one-true-awk/run.c 244988 2013-01-03 07:25:30Z delphij $");
27
28#define DEBUG
29#include <stdio.h>
30#include <ctype.h>
31#include <setjmp.h>
32#include <limits.h>
33#include <math.h>
34#include <string.h>

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

1208 return(x);
1209 }
1210 return(False);
1211}
1212
1213Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */
1214{
1215 Cell *x = 0, *y, *ap;
27
28#define DEBUG
29#include <stdio.h>
30#include <ctype.h>
31#include <setjmp.h>
32#include <limits.h>
33#include <math.h>
34#include <string.h>

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

1208 return(x);
1209 }
1210 return(False);
1211}
1212
1213Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */
1214{
1215 Cell *x = 0, *y, *ap;
1216 char *s;
1216 char *s, *origs;
1217 int sep;
1218 char *t, temp, num[50], *fs = 0;
1219 int n, tempstat, arg3type;
1220
1221 y = execute(a[0]); /* source string */
1217 int sep;
1218 char *t, temp, num[50], *fs = 0;
1219 int n, tempstat, arg3type;
1220
1221 y = execute(a[0]); /* source string */
1222 s = getsval(y);
1222 origs = s = strdup(getsval(y));
1223 arg3type = ptoi(a[3]);
1224 if (a[2] == 0) /* fs string */
1225 fs = *FS;
1226 else if (arg3type == STRING) { /* split(str,arr,"string") */
1227 x = execute(a[2]);
1228 fs = getsval(x);
1229 } else if (arg3type == REGEXPR)
1230 fs = "(regexpr)"; /* split(str,arr,/regexpr/) */

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

1334 setsymtab(num, t, 0.0, STR, (Array *) ap->sval);
1335 *s = temp;
1336 if (*s++ == 0)
1337 break;
1338 }
1339 }
1340 tempfree(ap);
1341 tempfree(y);
1223 arg3type = ptoi(a[3]);
1224 if (a[2] == 0) /* fs string */
1225 fs = *FS;
1226 else if (arg3type == STRING) { /* split(str,arr,"string") */
1227 x = execute(a[2]);
1228 fs = getsval(x);
1229 } else if (arg3type == REGEXPR)
1230 fs = "(regexpr)"; /* split(str,arr,/regexpr/) */

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

1334 setsymtab(num, t, 0.0, STR, (Array *) ap->sval);
1335 *s = temp;
1336 if (*s++ == 0)
1337 break;
1338 }
1339 }
1340 tempfree(ap);
1341 tempfree(y);
1342 free(origs);
1342 if (a[2] != 0 && arg3type == STRING) {
1343 tempfree(x);
1344 }
1345 x = gettemp();
1346 x->tval = NUM;
1347 x->fval = n;
1348 return(x);
1349}

--- 611 unchanged lines hidden ---
1343 if (a[2] != 0 && arg3type == STRING) {
1344 tempfree(x);
1345 }
1346 x = gettemp();
1347 x->tval = NUM;
1348 x->fval = n;
1349 return(x);
1350}

--- 611 unchanged lines hidden ---