Module Name: src
Committed By: martin
Date: Sun Aug 4 19:19:31 UTC 2019
Modified Files:
src/external/historical/nawk/dist [netbsd-9]: FIXES awk.1 awk.h b.c
lex.c lib.c main.c run.c tran.c ytab.c
Log Message:
Pull up following revision(s) (requested by christos in ticket #11):
external/historical/nawk/dist/awk.h: revision 1.3
external/historical/nawk/dist/run.c: revision 1.10
external/historical/nawk/dist/FIXES: revision 1.2
external/historical/nawk/dist/b.c: revision 1.7
external/historical/nawk/dist/b.c: revision 1.8
external/historical/nawk/dist/lex.c: revision 1.5
external/historical/nawk/dist/main.c: revision 1.9
external/historical/nawk/dist/proto.h: revision 1.8
external/historical/nawk/dist/tran.c: revision 1.10
external/historical/nawk/dist/proto.h: revision 1.9
external/historical/nawk/dist/awk.1: revision 1.2
external/historical/nawk/dist/lib.c: revision 1.9
external/historical/nawk/dist/ytab.c: revision 1.2
external/historical/nawk/dist/tran.c: revision 1.9
remove trailing whitespace.
PR/54424: Martijn Dekker: awk: broken character classes in UTF-8 locale:
only the first matches
Pick up some of the fixes from upstream:
- posix paren matching
- print \v \a
- some more fatal handling
- init all the character range.
remove ### error output accidentally committed.
Add translators for \v and \a per posix.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.32.1 src/external/historical/nawk/dist/FIXES
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.48.1 src/external/historical/nawk/dist/awk.1
cvs rdiff -u -r1.2 -r1.2.48.1 src/external/historical/nawk/dist/awk.h
cvs rdiff -u -r1.6 -r1.6.2.1 src/external/historical/nawk/dist/b.c
cvs rdiff -u -r1.4 -r1.4.4.1 src/external/historical/nawk/dist/lex.c
cvs rdiff -u -r1.8 -r1.8.28.1 src/external/historical/nawk/dist/lib.c
cvs rdiff -u -r1.8 -r1.8.32.1 src/external/historical/nawk/dist/main.c \
src/external/historical/nawk/dist/tran.c
cvs rdiff -u -r1.9 -r1.9.18.1 src/external/historical/nawk/dist/run.c
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.36.1 \
src/external/historical/nawk/dist/ytab.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/FIXES
diff -u src/external/historical/nawk/dist/FIXES:1.1.1.2 src/external/historical/nawk/dist/FIXES:1.1.1.2.32.1
--- src/external/historical/nawk/dist/FIXES:1.1.1.2 Sat Dec 29 02:14:51 2012
+++ src/external/historical/nawk/dist/FIXES Sun Aug 4 19:19:31 2019
@@ -52,10 +52,10 @@ Jun 12, 2011:
/pat/, \n /pat/ {...} is now legal, though bad style to use.
added checks to new -v code that permits -vnospace; thanks to
- ruslan ermilov for spotting this and providing the patch.
+ ruslan ermilov for spotting this and providing the patch.
removed fixed limit on number of open files; thanks to aleksey
- cheusov and christos zoulos.
+ cheusov and christos zoulos.
fixed day 1 bug that resurrected deleted elements of ARGV when
used as filenames (in lib.c).
@@ -73,10 +73,10 @@ May 1, 2011:
and arnold robbins, changed srand() to return the previous
seed (which is 1 on the first call of srand). the seed is
an Awkfloat internally though converted to unsigned int to
- pass to the library srand(). thanks, everyone.
+ pass to the library srand(). thanks, everyone.
fixed a subtle (and i hope low-probability) overflow error
- in fldbld, by adding space for one extra \0. thanks to
+ in fldbld, by adding space for one extra \0. thanks to
robert bassett for spotting this one and providing a fix.
removed the files related to compilation on windows. i no
@@ -113,7 +113,7 @@ Oct 8, 2008:
Oct 23, 2007:
minor fix in lib.c: increase inputFS to 100, change malloc
- for fields to n+1.
+ for fields to n+1.
fixed memory fault caused by out of order test in setsval.
@@ -160,7 +160,7 @@ Jan 17, 2006:
core dump on linux with BEGIN {nextfile}, now fixed.
- removed some #ifdef's in run.c and lex.c that appear to no
+ removed some #ifdef's in run.c and lex.c that appear to no
longer be necessary.
Apr 24, 2005:
@@ -174,8 +174,8 @@ Jan 14, 2005:
rethinking it.
Dec 31, 2004:
- prevent overflow of -f array in main, head off potential error in
- call of SYNTAX(), test malloc return in lib.c, all with thanks to
+ prevent overflow of -f array in main, head off potential error in
+ call of SYNTAX(), test malloc return in lib.c, all with thanks to
todd miller.
Dec 22, 2004:
@@ -203,8 +203,8 @@ Nov 22, 2003:
code known to man.
fixed a storage leak in call() that appears to have been there since
- 1983 or so -- a function without an explicit return that assigns a
- string to a parameter leaked a Cell. thanks to moinak ghosh for
+ 1983 or so -- a function without an explicit return that assigns a
+ string to a parameter leaked a Cell. thanks to moinak ghosh for
spotting this very subtle one.
Jul 31, 2003:
@@ -226,7 +226,7 @@ Jul 28, 2003:
radix character in programs and command line arguments regardless of
the locale; otherwise, the locale should prevail for input and output
of numbers. so it's intended to work that way.
-
+
i have rescinded the attempt to use strcoll in expanding shorthands in
regular expressions (cclenter). its properties are much too
surprising; for example [a-c] matches aAbBc in locale en_US but abBcC
@@ -290,7 +290,7 @@ Nov 29, 2002:
Jun 28, 2002:
modified run/format() and tran/getsval() to do a slightly better
job on using OFMT for output from print and CONVFMT for other
- number->string conversions, as promised by posix and done by
+ number->string conversions, as promised by posix and done by
gawk and mawk. there are still places where it doesn't work
right if CONVFMT is changed; by then the STR attribute of the
variable has been irrevocably set. thanks to arnold robbins for
@@ -322,7 +322,7 @@ Feb 10, 2002:
Jan 1, 2002:
fflush() or fflush("") flushes all files and pipes.
- length(arrayname) returns number of elements; thanks to
+ length(arrayname) returns number of elements; thanks to
arnold robbins for suggestion.
added a makefile.win to make it easier to build on windows.
@@ -372,7 +372,7 @@ July 5, 2000:
May 25, 2000:
yet another attempt at making 8-bit input work, with another
- band-aid in b.c (member()), and some (uschar) casts to head
+ band-aid in b.c (member()), and some (uschar) casts to head
off potential errors in subscripts (like isdigit). also
changed HAT to NCHARS-2. thanks again to santiago vila.
@@ -419,7 +419,7 @@ Apr 21, 1999:
the test case.)
Apr 16, 1999:
- with code kindly provided by Bruce Lilly, awk now parses
+ with code kindly provided by Bruce Lilly, awk now parses
/=/ and similar constructs more sensibly in more places.
Bruce also provided some helpful test cases.
@@ -476,7 +476,7 @@ Jan 13, 1999:
Oct 19, 1998:
fixed a couple of bugs in getrec: could fail to update $0
- after a getline var; because inputFS wasn't initialized,
+ after a getline var; because inputFS wasn't initialized,
could split $0 on every character, a misleading diversion.
fixed caching bug in makedfa: LRU was actually removing
@@ -622,7 +622,7 @@ May 2, 1996:
input file. (thanks to arnold robbins for inspiration and code).
small fixes to regexpr code: can now handle []], [[], and
- variants; [] is now a syntax error, rather than matching
+ variants; [] is now a syntax error, rather than matching
everything; [z-a] is now empty, not z. far from complete
or correct, however. (thanks to jeffrey friedl for pointing out
some awful behaviors.)
Index: src/external/historical/nawk/dist/awk.1
diff -u src/external/historical/nawk/dist/awk.1:1.1.1.1 src/external/historical/nawk/dist/awk.1:1.1.1.1.48.1
--- src/external/historical/nawk/dist/awk.1:1.1.1.1 Thu Aug 26 14:53:17 2010
+++ src/external/historical/nawk/dist/awk.1 Sun Aug 4 19:19:31 2019
@@ -49,7 +49,7 @@ matches the pattern.
Each line is matched against the
pattern portion of every pattern-action statement;
the associated action is performed for each matched pattern.
-The file name
+The file name
.B \-
means the standard input.
Any
@@ -91,7 +91,7 @@ A pattern-action statement has the form
.IP
.IB pattern " { " action " }
.PP
-A missing
+A missing
.BI { " action " }
means print the line;
a missing pattern always matches.
@@ -195,7 +195,7 @@ The mathematical functions
.BR sin ,
.BR cos ,
and
-.BR atan2
+.BR atan2
are built in.
Other built-in functions:
.TF length
@@ -224,7 +224,7 @@ the
substring of
.I s
that begins at position
-.IR m
+.IR m
counted from 1.
.TP
.BI index( s , " t" )
@@ -352,7 +352,7 @@ Patterns are arbitrary Boolean combinati
of regular expressions and
relational expressions.
Regular expressions are as in
-.IR egrep ;
+.IR egrep ;
see
.IR grep (1).
Isolated regular expressions
@@ -512,7 +512,7 @@ BEGIN { # Simulate echo(1)
.fi
.EE
.SH SEE ALSO
-.IR lex (1),
+.IR lex (1),
.IR sed (1)
.br
A. V. Aho, B. W. Kernighan, P. J. Weinberger,
Index: src/external/historical/nawk/dist/awk.h
diff -u src/external/historical/nawk/dist/awk.h:1.2 src/external/historical/nawk/dist/awk.h:1.2.48.1
--- src/external/historical/nawk/dist/awk.h:1.2 Thu Aug 26 14:55:19 2010
+++ src/external/historical/nawk/dist/awk.h Sun Aug 4 19:19:31 2019
@@ -32,7 +32,7 @@ typedef unsigned char uschar;
#define xfree(a) { if ((a) != NULL) { free((void *) (a)); (a) = NULL; } }
-#define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for dprintf
+#define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for dprintf
*/
#define DEBUG
#ifdef DEBUG
@@ -155,7 +155,7 @@ extern Node *nullnode;
#define CCOPY 6
#define CCON 5
#define CTEMP 4
-#define CNAME 3
+#define CNAME 3
#define CVAR 2
#define CFLD 1
#define CUNK 0
Index: src/external/historical/nawk/dist/b.c
diff -u src/external/historical/nawk/dist/b.c:1.6 src/external/historical/nawk/dist/b.c:1.6.2.1
--- src/external/historical/nawk/dist/b.c:1.6 Sat Jan 19 00:37:41 2019
+++ src/external/historical/nawk/dist/b.c Sun Aug 4 19:19:31 2019
@@ -31,6 +31,7 @@ THIS SOFTWARE.
#define DEBUG
#include <ctype.h>
+#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -220,7 +221,7 @@ int makeinit(fa *f, int anchor)
f->curstat = 2;
f->out[2] = 0;
k = *(f->re[0].lfollow);
- xfree(f->posns[2]);
+ xfree(f->posns[2]);
if ((f->posns[2] = calloc(1, (k+1)*sizeof(int))) == NULL)
overflo("out of space in makeinit");
for (i=0; i <= k; i++) {
@@ -333,6 +334,10 @@ int quoted(const uschar **pp) /* pick up
c = '\r';
else if (c == 'b')
c = '\b';
+ else if (c == 'v')
+ c = '\v';
+ else if (c == 'a')
+ c = '\a';
else if (c == '\\')
c = '\\';
else if (c == 'x') { /* hexadecimal goo follows */
@@ -649,9 +654,9 @@ int nematch(fa *f, const char *p0) /* no
* RETURN VALUES
* 0 No match found.
* 1 Match found.
- */
+ */
-int fnematch(fa *pfa, FILE *f, uschar **pbuf, int *pbufsize, int quantum)
+int fnematch(fa *pfa, FILE *f, uschar **pbuf, int *pbufsize, int quantum)
{
uschar *buf = *pbuf;
int bufsize = *pbufsize;
@@ -676,7 +681,7 @@ int fnematch(fa *pfa, FILE *f, uschar **
if (++j == k) {
if (k == bufsize)
if (!adjbuf(&buf, &bufsize, bufsize+1, quantum, 0, "fnematch"))
- FATAL("stream '%.30s...' too long", buf);
+ FATAL("stream '%.30s...' too long", buf);
buf[k++] = (c = getc(f)) != EOF ? c : 0;
}
c = buf[j];
@@ -716,7 +721,7 @@ int fnematch(fa *pfa, FILE *f, uschar **
*/
do
if (buf[--k] && ungetc(buf[k], f) == EOF)
- FATAL("unable to ungetc '%c'", buf[k]);
+ FATAL("unable to ungetc '%c'", buf[k]);
while (k > i + patlen);
buf[k] = 0;
return 1;
@@ -905,8 +910,8 @@ replace_repeat(const uschar *reptok, int
uschar *buf = 0;
int ret = 1;
int init_q = (firstnum==0); /* first added char will be ? */
- int n_q_reps = secondnum-firstnum; /* m>n, so reduce until {1,m-n} left */
- int prefix_length = reptok - basestr; /* prefix includes first rep */
+ int n_q_reps = secondnum-firstnum; /* m>n, so reduce until {1,m-n} left */
+ int prefix_length = reptok - basestr; /* prefix includes first rep */
int suffix_length = strlen(reptok) - reptoklen; /* string after rep specifier */
int size = prefix_length + suffix_length;
@@ -924,7 +929,7 @@ replace_repeat(const uschar *reptok, int
}
if ((buf = (uschar *) malloc(size+1)) == NULL)
FATAL("out of space in reg expr %.10s..", lastre);
- memcpy(buf, basestr, prefix_length); /* copy prefix */
+ memcpy(buf, basestr, prefix_length); /* copy prefix */
j = prefix_length;
if (special_case == REPEAT_ZERO) {
j -= atomlen;
@@ -978,26 +983,28 @@ static int repeat(const uschar *reptok,
if (secondnum < 0) { /* means {n,} -> repeat n-1 times followed by PLUS */
if (firstnum < 2) {
/* 0 or 1: should be handled before you get here */
+ FATAL("internal error");
} else {
- return replace_repeat(reptok, reptoklen, atom, atomlen,
+ return replace_repeat(reptok, reptoklen, atom, atomlen,
firstnum, secondnum, REPEAT_PLUS_APPENDED);
}
} else if (firstnum == secondnum) { /* {n} or {n,n} -> simply repeat n-1 times */
if (firstnum == 0) { /* {0} or {0,0} */
- /* This case is unusual because the resulting
- replacement string might actually be SMALLER than
+ /* This case is unusual because the resulting
+ replacement string might actually be SMALLER than
the original ERE */
- return replace_repeat(reptok, reptoklen, atom, atomlen,
+ return replace_repeat(reptok, reptoklen, atom, atomlen,
firstnum, secondnum, REPEAT_ZERO);
} else { /* (firstnum >= 1) */
- return replace_repeat(reptok, reptoklen, atom, atomlen,
+ return replace_repeat(reptok, reptoklen, atom, atomlen,
firstnum, secondnum, REPEAT_SIMPLE);
}
} else if (firstnum < secondnum) { /* {n,m} -> repeat n-1 times then alternate */
/* x{n,m} => xx...x{1, m-n+1} => xx...x?x?x?..x? */
- return replace_repeat(reptok, reptoklen, atom, atomlen,
+ return replace_repeat(reptok, reptoklen, atom, atomlen,
firstnum, secondnum, REPEAT_WITH_Q);
} else { /* Error - shouldn't be here (n>m) */
+ FATAL("internal error");
}
return 0;
}
@@ -1013,6 +1020,7 @@ int relex(void) /* lexical analyzer for
int i;
int num, m, commafound, digitfound;
const uschar *startreptok;
+ static int parens = 0;
rescan:
starttok = prestr;
@@ -1026,16 +1034,25 @@ rescan:
case '\0': prestr--; return '\0';
case '^':
case '$':
+ return c;
case '(':
+ parens++;
+ return c;
case ')':
- return c;
+ if (parens) {
+ parens--;
+ return c;
+ }
+ /* unmatched close parenthesis; per POSIX, treat as literal */
+ rlxval = c;
+ return CHAR;
case '\\':
rlxval = quoted(&prestr);
return CHAR;
default:
rlxval = c;
return CHAR;
- case '[':
+ case '[':
if (buf == 0 && (buf = malloc(bufsz)) == NULL)
FATAL("out of space in reg expr %.10s..", lastre);
bp = buf;
@@ -1064,7 +1081,15 @@ rescan:
if (cc->cc_name != NULL && prestr[1 + cc->cc_namelen] == ':' &&
prestr[2 + cc->cc_namelen] == ']') {
prestr += cc->cc_namelen + 3;
- for (i = 1; i < NCHARS; i++) {
+ /*
+ * BUG: We begin at 1, instead of 0, since we
+ * would otherwise prematurely terminate the
+ * string for classes like [[:cntrl:]]. This
+ * means that we can't match the NUL character,
+ * not without first adapting the entire
+ * program to track each string's length.
+ */
+ for (i = 1; i <= UCHAR_MAX; i++) {
if (!adjbuf(&buf, &bufsz, bp-buf+1, 100, &bp, "relex2"))
FATAL("out of space for reg expr %.10s...", lastre);
if (cc->cc_func(i)) {
@@ -1098,7 +1123,7 @@ rescan:
if (*prestr == '=' && prestr[1] == ']') {
prestr += 2;
/* Found it: map via locale TBD: for now
- simply return this char. This is
+ simply return this char. This is
sufficient to pass conformance test
awk.ex 156
*/
@@ -1123,7 +1148,7 @@ rescan:
*bp++ = c;
}
break;
- case '{':
+ case '{':
if (isdigit(*(prestr))) {
num = 0; /* Process as a repetition */
n = -1; m = -1;
Index: src/external/historical/nawk/dist/lex.c
diff -u src/external/historical/nawk/dist/lex.c:1.4 src/external/historical/nawk/dist/lex.c:1.4.4.1
--- src/external/historical/nawk/dist/lex.c:1.4 Tue Jun 12 13:24:28 2018
+++ src/external/historical/nawk/dist/lex.c Sun Aug 4 19:19:31 2019
@@ -147,7 +147,7 @@ int gettok(char **pbuf, int *psz) /* get
if (bp-buf >= sz)
if (!adjbuf(&buf, &sz, bp-buf+2, 100, &bp, "gettok"))
FATAL( "out of space for number %.10s...", buf );
- if (isdigit(c) || c == 'e' || c == 'E'
+ if (isdigit(c) || c == 'e' || c == 'E'
|| c == '.' || c == '+' || c == '-')
*bp++ = c;
else {
@@ -205,7 +205,7 @@ int yylex(void)
/* should this also have STR set? */
RET(NUMBER);
}
-
+
yylval.i = c;
switch (c) {
case '\n': /* {EOL} */
@@ -234,7 +234,7 @@ int yylex(void)
case '&':
if (peek() == '&') {
input(); RET(AND);
- } else
+ } else
RET('&');
case '|':
if (peek() == '|') {
@@ -332,7 +332,7 @@ int yylex(void)
unputstr(buf);
RET(INDIRECT);
}
-
+
case '}':
if (--bracecnt < 0)
SYNTAX( "extra }" );
@@ -355,10 +355,10 @@ int yylex(void)
case '(':
parencnt++;
RET('(');
-
+
case '"':
return string(); /* BUG: should be like tran.c ? */
-
+
default:
RET(c);
}
@@ -391,7 +391,7 @@ int string(void)
switch (c) {
case '\n': break;
case '"': *bp++ = '"'; break;
- case 'n': *bp++ = '\n'; break;
+ case 'n': *bp++ = '\n'; break;
case 't': *bp++ = '\t'; break;
case 'f': *bp++ = '\f'; break;
case 'r': *bp++ = '\r'; break;
@@ -440,7 +440,7 @@ int string(void)
break;
}
}
- *bp = 0;
+ *bp = 0;
s = tostring(buf);
*bp++ = ' '; *bp++ = 0;
yylval.cp = setsymtab(buf, s, 0.0, CON|STR|DONTFREE, symtab);
@@ -466,7 +466,7 @@ int binsearch(const char *w, const Keywo
return -1;
}
-int word(char *w)
+int word(char *w)
{
const Keyword *kp;
int c, n;
@@ -529,11 +529,11 @@ int regexpr(void)
if (!adjbuf(&buf, &bufsz, bp-buf+3, 500, &bp, "regexpr"))
FATAL("out of space for reg expr %.10s...", buf);
if (c == '\n') {
- SYNTAX( "newline in regular expression %.10s...", buf );
+ SYNTAX( "newline in regular expression %.10s...", buf );
unput('\n');
break;
} else if (c == '\\') {
- *bp++ = '\\';
+ *bp++ = '\\';
*bp++ = input();
} else {
*bp++ = c;
Index: src/external/historical/nawk/dist/lib.c
diff -u src/external/historical/nawk/dist/lib.c:1.8 src/external/historical/nawk/dist/lib.c:1.8.28.1
--- src/external/historical/nawk/dist/lib.c:1.8 Sun Oct 20 21:35:46 2013
+++ src/external/historical/nawk/dist/lib.c Sun Aug 4 19:19:31 2019
@@ -511,7 +511,7 @@ int refldbld(const char *rec, const char
break;
}
}
- return i;
+ return i;
}
void recbld(void) /* create $0 from $1..$NF if necessary */
Index: src/external/historical/nawk/dist/main.c
diff -u src/external/historical/nawk/dist/main.c:1.8 src/external/historical/nawk/dist/main.c:1.8.32.1
--- src/external/historical/nawk/dist/main.c:1.8 Sat Dec 29 02:44:26 2012
+++ src/external/historical/nawk/dist/main.c Sun Aug 4 19:19:31 2019
@@ -107,8 +107,8 @@ int main(int argc, char *argv[])
setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */
cmdname = argv[0];
if (argc == 1) {
- fprintf(stderr,
- "usage: %s [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]\n",
+ fprintf(stderr,
+ "usage: %s [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]\n",
cmdname);
exit(1);
}
@@ -162,7 +162,7 @@ int main(int argc, char *argv[])
maxpfile * sizeof(*pfile));
if (pfile == NULL)
FATAL("error allocating space for "
- "-f options");
+ "-f options");
}
pfile[npfile++] = fn;
break;
Index: src/external/historical/nawk/dist/tran.c
diff -u src/external/historical/nawk/dist/tran.c:1.8 src/external/historical/nawk/dist/tran.c:1.8.32.1
--- src/external/historical/nawk/dist/tran.c:1.8 Mon Feb 11 00:32:07 2013
+++ src/external/historical/nawk/dist/tran.c Sun Aug 4 19:19:31 2019
@@ -187,7 +187,7 @@ void freesymtab(Cell *ap) /* free a symb
if (freeable(cp))
xfree(cp->sval);
temp = cp->cnext; /* avoids freeing then using */
- free(cp);
+ free(cp);
tp->nelem--;
}
tp->tab[i] = 0;
@@ -203,7 +203,7 @@ void freeelem(Cell *ap, const char *s) /
Array *tp;
Cell *p, *prev = NULL;
int h;
-
+
tp = (Array *) ap->sval;
h = hash(s, tp->size);
for (p = tp->tab[h]; p != NULL; prev = p, p = p->cnext)
@@ -302,7 +302,7 @@ Awkfloat setfval(Cell *vp, Awkfloat f) /
int fldno;
f += 0.0; /* normalise negative zero to positive zero */
- if ((vp->tval & (NUM | STR)) == 0)
+ if ((vp->tval & (NUM | STR)) == 0)
funnyvar(vp, "assign to");
if (isfld(vp)) {
donerec = 0; /* mark $0 invalid */
@@ -344,7 +344,7 @@ char *setsval(Cell *vp, const char *s) /
int fldno;
Awkfloat f;
- dprintf( ("starting setsval %p: %s = \"%s\", t=%o, r,f=%d,%d\n",
+ dprintf( ("starting setsval %p: %s = \"%s\", t=%o, r,f=%d,%d\n",
vp, NN(vp->nval), s, vp->tval, donerec, donefld) );
if ((vp->tval & (NUM | STR)) == 0)
funnyvar(vp, "assign to");
@@ -364,7 +364,7 @@ char *setsval(Cell *vp, const char *s) /
vp->tval &= ~NUM;
vp->tval |= STR;
setfree(vp);
- dprintf( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n",
+ dprintf( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n",
vp, NN(vp->nval), t,t, vp->tval, donerec, donefld) );
vp->sval = t;
@@ -490,7 +490,7 @@ char *qstring(const char *is, int delim)
if (c == 0) { /* \ at end */
*bp++ = '\\';
break; /* for loop */
- }
+ }
switch (c) {
case '\\': *bp++ = '\\'; break;
case 'n': *bp++ = '\n'; break;
@@ -498,6 +498,8 @@ char *qstring(const char *is, int delim)
case 'b': *bp++ = '\b'; break;
case 'f': *bp++ = '\f'; break;
case 'r': *bp++ = '\r'; break;
+ case 'v': *bp++ = '\v'; break;
+ case 'a': *bp++ = '\a'; break;
default:
if (!isdigit(c)) {
*bp++ = c;
Index: src/external/historical/nawk/dist/run.c
diff -u src/external/historical/nawk/dist/run.c:1.9 src/external/historical/nawk/dist/run.c:1.9.18.1
--- src/external/historical/nawk/dist/run.c:1.9 Tue Nov 3 14:15:08 2015
+++ src/external/historical/nawk/dist/run.c Sun Aug 4 19:19:31 2019
@@ -862,7 +862,7 @@ int format(char **pbuf, int *pbufsize, c
"\"%.30s\")", os);
x = execute(a);
a = a->nnext;
- snprintf(t - 1, FMTSZ(t - 1),
+ snprintf(t - 1, FMTSZ(t - 1),
"%d", fmtwd=(int) getfval(x));
if (fmtwd < 0)
fmtwd = -fmtwd;
@@ -2117,7 +2117,7 @@ Cell *gensub(Node **a, int nnn) /* globa
FATAL("gensub doesn't support backreferences (subst \"%s\")", rptr);
}
}
-
+
do {
if (whichm >= 0 && whichm != num) {
num++;
Index: src/external/historical/nawk/dist/ytab.c
diff -u src/external/historical/nawk/dist/ytab.c:1.1.1.1 src/external/historical/nawk/dist/ytab.c:1.1.1.1.36.1
--- src/external/historical/nawk/dist/ytab.c:1.1.1.1 Sat Dec 29 02:14:51 2012
+++ src/external/historical/nawk/dist/ytab.c Sun Aug 4 19:19:31 2019
@@ -1010,7 +1010,7 @@ yylex1(void)
const long *t3p;
int c;
-#ifdef YYARG
+#ifdef YYARG
yychar = yylex(yyarg);
#else
yychar = yylex();
@@ -1218,7 +1218,7 @@ yydefault:
if(yyj >= YYLAST || yychk[yystate=yyact[yyj]] != -yyn)
yystate = yyact[yyg];
switch(yym) {
-
+
case 1:
#line 98 "/n/fs/fac/bwk/awk/awkgram.y"
{ if (errorflag==0)
@@ -1381,12 +1381,12 @@ case 72:
{ yyval.p = op2(INTEST, yypt[-3].yyv.p, makearr(yypt[-0].yyv.p)); } break;
case 73:
#line 241 "/n/fs/fac/bwk/awk/awkgram.y"
-{
+{
if (safe) SYNTAX("cmd | getline is unsafe");
else yyval.p = op3(GETLINE, yypt[-0].yyv.p, itonp(yypt[-2].yyv.i), yypt[-3].yyv.p); } break;
case 74:
#line 244 "/n/fs/fac/bwk/awk/awkgram.y"
-{
+{
if (safe) SYNTAX("cmd | getline is unsafe");
else yyval.p = op3(GETLINE, (Node*)0, itonp(yypt[-1].yyv.i), yypt[-2].yyv.p); } break;
case 75:
@@ -1421,7 +1421,7 @@ case 96:
{ yyval.s = yypt[-1].yyv.s; } break;
case 99:
#line 295 "/n/fs/fac/bwk/awk/awkgram.y"
-{
+{
if (safe) SYNTAX("print | is unsafe");
else yyval.p = stat3(yypt[-3].yyv.i, yypt[-2].yyv.p, itonp(yypt[-1].yyv.i), yypt[-0].yyv.p); } break;
case 100: