Module Name: src Committed By: christos Date: Mon Nov 2 22:58:51 UTC 2020
Modified Files: src/external/historical/nawk/dist: tran.c Log Message: >From wajap at github: - eat whitespace in infnan checks - set fval to 0 if we are not a floating point number To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/external/historical/nawk/dist/tran.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/historical/nawk/dist/tran.c diff -u src/external/historical/nawk/dist/tran.c:1.14 src/external/historical/nawk/dist/tran.c:1.15 --- src/external/historical/nawk/dist/tran.c:1.14 Mon Aug 31 20:35:29 2020 +++ src/external/historical/nawk/dist/tran.c Mon Nov 2 17:58:51 2020 @@ -399,11 +399,15 @@ static int checkstr(const char *s, const { while (*s && tolower((unsigned char)*s) == *v) s++, v++; + while (isspace((unsigned char)*s)) + s++; return !(*s || *v); } static int checkinfnan(const char *s) { + while (isspace((unsigned char)*s)) + s++; if (*s == '+' || *s == '-') s++; switch (tolower((unsigned char)*s)) { @@ -427,6 +431,8 @@ Awkfloat getfval(Cell *vp) /* get float if (!isnum(vp)) { /* not a number */ if (checkinfnan(vp->sval)) vp->fval = atof(vp->sval); /* best guess */ + else + vp->fval = 0.0; if (is_number(vp->sval) && !(vp->tval&CON)) { vp->tval |= NUM; /* make NUM only sparingly */ }