Merge branch 'master' into subsep
This commit is contained in:
commit
11c1fc61d5
@ -1,3 +1,9 @@
|
|||||||
|
2018-08-29 Arnold D. Robbins <arnold@skeeve.com>
|
||||||
|
|
||||||
|
* REGRESS: Check for existence of a.out. If not there, run
|
||||||
|
make. Enable core dumps for T.arnold system status test
|
||||||
|
to work on MacOS X.
|
||||||
|
|
||||||
2018-08-22 Arnold D. Robbins <arnold@skeeve.com>
|
2018-08-22 Arnold D. Robbins <arnold@skeeve.com>
|
||||||
|
|
||||||
* awktest.tar (testdir/T.expr): Fix test for unary plus.
|
* awktest.tar (testdir/T.expr): Fix test for unary plus.
|
||||||
|
5
FIXES
5
FIXES
@ -25,6 +25,11 @@ THIS SOFTWARE.
|
|||||||
This file lists all bug fixes, changes, etc., made since the AWK book
|
This file lists all bug fixes, changes, etc., made since the AWK book
|
||||||
was sent to the printers in August, 1987.
|
was sent to the printers in August, 1987.
|
||||||
|
|
||||||
|
Oct 25, 2018:
|
||||||
|
Added test in maketab.c to prevent generating a proctab entry
|
||||||
|
for YYSTYPE_IS_DEFINED. It was harmless but some gcc settings
|
||||||
|
generated a warning message. Thanks to Nan Xiao for report.
|
||||||
|
|
||||||
Aug 27, 2018:
|
Aug 27, 2018:
|
||||||
Disallow '$' in printf formats; arguments evaluated in order
|
Disallow '$' in printf formats; arguments evaluated in order
|
||||||
and printed in order.
|
and printed in order.
|
||||||
|
15
REGRESS
15
REGRESS
@ -1,5 +1,15 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
CYGWIN) EXE=a.exe ;;
|
||||||
|
*) EXE=a.out ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ ! -f $EXE ]
|
||||||
|
then
|
||||||
|
make || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d testdir ]
|
if [ -d testdir ]
|
||||||
then
|
then
|
||||||
true # do nothing
|
true # do nothing
|
||||||
@ -16,5 +26,10 @@ cd testdir
|
|||||||
pwd
|
pwd
|
||||||
PATH=.:$PATH
|
PATH=.:$PATH
|
||||||
export PATH
|
export PATH
|
||||||
|
if (ulimit -c unlimited > /dev/null 2>&1)
|
||||||
|
then
|
||||||
|
# Workaround broken default on MacOS X
|
||||||
|
ulimit -c unlimited
|
||||||
|
fi
|
||||||
|
|
||||||
REGRESS
|
REGRESS
|
||||||
|
@ -24,9 +24,17 @@ and also if CONVFMT changed.
|
|||||||
7. unary-plus: Unary plus on a string constant returned the string.
|
7. unary-plus: Unary plus on a string constant returned the string.
|
||||||
Instead, it should convert the value to numeric and give that value.
|
Instead, it should convert the value to numeric and give that value.
|
||||||
|
|
||||||
X. numeric-subsep, numeric-fs, numeric-output-seps, numerics-rs: If SUBSEP,
|
8. missing-precision: When using the format string "%*s", the precision
|
||||||
|
argument was used without checking if it was present first.
|
||||||
|
|
||||||
|
9. fmt-overflow: The buffer used for OFMT/CONVFMT conversions was written
|
||||||
|
to with sprintf(), which meant that some conversions could write past the
|
||||||
|
end.
|
||||||
|
|
||||||
|
10. numeric-subsep, numeric-fs, numeric-output-seps, numerics-rs: If SUBSEP,
|
||||||
FS, RS, OFS, or ORS were set to a numeric value, then their string values
|
FS, RS, OFS, or ORS were set to a numeric value, then their string values
|
||||||
wouldn't always be generated before being needed.
|
wouldn't always be generated before being needed.
|
||||||
|
|
||||||
X. subsep-overflow: The length of SUBSEP needs to be rechecked after
|
11. subsep-overflow: The length of SUBSEP needs to be rechecked after
|
||||||
calling execute(), in case SUBSEP itself has been changed.
|
calling execute(), in case SUBSEP itself has been changed.
|
||||||
|
|
||||||
|
1
bugs-fixed/fmt-overflow.awk
Normal file
1
bugs-fixed/fmt-overflow.awk
Normal file
@ -0,0 +1 @@
|
|||||||
|
BEGIN { OFMT = "%.1000f"; print 1.25; }
|
1
bugs-fixed/fmt-overflow.ok
Normal file
1
bugs-fixed/fmt-overflow.ok
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.2500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
1
bugs-fixed/missing-precision.awk
Normal file
1
bugs-fixed/missing-precision.awk
Normal file
@ -0,0 +1 @@
|
|||||||
|
BEGIN { printf("%*s"); }
|
2
bugs-fixed/missing-precision.ok
Normal file
2
bugs-fixed/missing-precision.ok
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
./a.out: not enough args in printf(%*s)
|
||||||
|
source line number 1
|
4
makefile
4
makefile
@ -34,8 +34,8 @@ CC = gcc -g -Wall -pedantic
|
|||||||
|
|
||||||
# yacc options. pick one; this varies a lot by system.
|
# yacc options. pick one; this varies a lot by system.
|
||||||
#YFLAGS = -d -S
|
#YFLAGS = -d -S
|
||||||
#YACC = bison -d -y
|
YACC = bison -d -y
|
||||||
YACC = yacc -d
|
#YACC = yacc -d
|
||||||
# -S uses sprintf in yacc parser instead of sprint
|
# -S uses sprintf in yacc parser instead of sprint
|
||||||
|
|
||||||
OFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o
|
OFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o
|
||||||
|
@ -135,6 +135,8 @@ int main(int argc, char *argv[])
|
|||||||
n = sscanf(buf, "%1c %s %s %d", &c, def, name, &tok);
|
n = sscanf(buf, "%1c %s %s %d", &c, def, name, &tok);
|
||||||
if (c != '#' || (n != 4 && strcmp(def,"define") != 0)) /* not a valid #define */
|
if (c != '#' || (n != 4 && strcmp(def,"define") != 0)) /* not a valid #define */
|
||||||
continue;
|
continue;
|
||||||
|
if (strcmp(name, "YYSTYPE_IS_DECLARED") == 0)
|
||||||
|
continue;
|
||||||
if (tok < FIRSTTOKEN || tok > LASTTOKEN) {
|
if (tok < FIRSTTOKEN || tok > LASTTOKEN) {
|
||||||
/* fprintf(stderr, "maketab funny token %d %s ignored\n", tok, buf); */
|
/* fprintf(stderr, "maketab funny token %d %s ignored\n", tok, buf); */
|
||||||
continue;
|
continue;
|
||||||
|
3
run.c
3
run.c
@ -866,6 +866,9 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
|
|||||||
FATAL("'$' not permitted in awk formats");
|
FATAL("'$' not permitted in awk formats");
|
||||||
}
|
}
|
||||||
if (*s == '*') {
|
if (*s == '*') {
|
||||||
|
if (a == NULL) {
|
||||||
|
FATAL("not enough args in printf(%s)", os);
|
||||||
|
}
|
||||||
x = execute(a);
|
x = execute(a);
|
||||||
a = a->nnext;
|
a = a->nnext;
|
||||||
sprintf(t-1, "%d", fmtwd=(int) getfval(x));
|
sprintf(t-1, "%d", fmtwd=(int) getfval(x));
|
||||||
|
6
tran.c
6
tran.c
@ -406,7 +406,7 @@ Awkfloat getfval(Cell *vp) /* get float val of a Cell */
|
|||||||
|
|
||||||
static char *get_str_val(Cell *vp, char **fmt) /* get string val of a Cell */
|
static char *get_str_val(Cell *vp, char **fmt) /* get string val of a Cell */
|
||||||
{
|
{
|
||||||
char s[100]; /* BUG: unchecked */
|
char s[256];
|
||||||
double dtemp;
|
double dtemp;
|
||||||
|
|
||||||
if ((vp->tval & (NUM | STR)) == 0)
|
if ((vp->tval & (NUM | STR)) == 0)
|
||||||
@ -445,9 +445,9 @@ static char *get_str_val(Cell *vp, char **fmt) /* get string val of a Cel
|
|||||||
if (freeable(vp)) \
|
if (freeable(vp)) \
|
||||||
xfree(vp->sval); \
|
xfree(vp->sval); \
|
||||||
if (modf(vp->fval, &dtemp) == 0) /* it's integral */ \
|
if (modf(vp->fval, &dtemp) == 0) /* it's integral */ \
|
||||||
sprintf(s, "%.30g", vp->fval); \
|
snprintf(s, sizeof (s), "%.30g", vp->fval); \
|
||||||
else \
|
else \
|
||||||
sprintf(s, *fmt, vp->fval); \
|
snprintf(s, sizeof (s), *fmt, vp->fval); \
|
||||||
vp->sval = tostring(s); \
|
vp->sval = tostring(s); \
|
||||||
vp->tval &= ~DONTFREE; \
|
vp->tval &= ~DONTFREE; \
|
||||||
vp->tval |= STR; \
|
vp->tval |= STR; \
|
||||||
|
Loading…
Reference in New Issue
Block a user