diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-08-12 21:34:06 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-08-12 21:34:06 +0200 |
commit | 9cf3dc9a259cadc80e6d3840c658ef1d5f7c94a4 (patch) | |
tree | 3ae416813cb7631de1c27a74f8cc35ae5686c356 /sys/src/cmd/awk/lex.c | |
parent | 3f9d5e4a4f9e4f0b5fe66e4a6745a4b8c5f6e447 (diff) |
awk: allow string as exit status
Diffstat (limited to 'sys/src/cmd/awk/lex.c')
-rw-r--r-- | sys/src/cmd/awk/lex.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/cmd/awk/lex.c b/sys/src/cmd/awk/lex.c index f1f5e1f09..5a68f27ac 100644 --- a/sys/src/cmd/awk/lex.c +++ b/sys/src/cmd/awk/lex.c @@ -355,12 +355,15 @@ int string(void) if (buf == 0 && (buf = (char *) malloc(bufsz)) == nil) FATAL("out of space for strings"); for (bp = buf; (c = input()) != '"'; ) { - if (!adjbuf(&buf, &bufsz, bp-buf+2, 500, &bp, 0)) + if (!adjbuf(&buf, &bufsz, bp-buf+2, 500, &bp, 0)){ + *bp = 0; FATAL("out of space for string %.10s...", buf); + } switch (c) { case '\n': case '\r': - case 0: + case 0: + *bp = 0; SYNTAX( "non-terminated string %.10s...", buf ); lineno++; RET(0); |