added Arnold's fixes, updates to awktest.tar

This commit is contained in:
Brian Kernighan 2018-08-24 09:09:59 -04:00
parent b619480f94
commit 0f4e1ba922
5 changed files with 38 additions and 25 deletions

31
FIXES
View File

@ -25,6 +25,37 @@ THIS SOFTWARE.
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August, 1987.
Aug 23, 2018:
A long list of fixes courtesy of Arnold Robbins,
to whom profound thanks.
1. ofs-rebuild: OFS value used to rebuild the record was incorrect.
Fixed August 19, 2014. Revised fix August 2018.
2. system-status: Instead of a floating-point division by 256, use
the wait(2) macros to create a reasonable exit status.
Fixed March 12, 2016.
3. space: Use provided xisblank() function instead of ispace() for
matching [[:blank:]].
4. a-format: Add POSIX standard %a and %A to supported formats. Check
at runtime that this format is available.
5. decr-NF: Decrementing NF did not change $0. This is a decades-old
bug. There are interactions with the old and new value of OFS as well.
Most of the fix came from the NetBSD awk.
6. string-conv: String conversions of scalars were sticky. Once a
conversion to string happened, even with OFMT, that value was used until
a new numeric value was assigned, even if OFMT differed from CONVFMT,
and also if CONVFMT changed.
7. unary-plus: Unary plus on a string constant returned the string.
Instead, it should convert the value to numeric and give that value.
Also added Arnold's tests for these to awktest.tar as T.arnold.
Aug 15, 2018:
fixed mangled awktest.tar (thanks, Arnold), posted all
current (very minor) fixes to github / onetrueawk

20
TODO
View File

@ -1,20 +0,0 @@
Fri Aug 10 11:11:11 IDT 2018
============================
A semi-random list of things to look into.
1. DONE. Make sure the FIXES file has everything after the date order
was reversed.
2. DONE. Look into the problem that NF-- doesn't throw away the last field.
This a long-standing issue.
3. DONE. Add suport for %a and %A printf formats.
4. DONE. Look into the problem that string conversions are sticky; once
done they never change, even if OFMT or CONVFMT do. Similarly, a
conversion from OFMT becomes the permanent string value, which is
incorrect.
5. MAYBE: Improve the test suite enough so that it can be cleaned up after
it was run, and old results can be saved for comparison.

Binary file not shown.

2
main.c
View File

@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
const char *version = "version 20130105 + fixes by arnold@skeeve.com 20180822";
const char *version = "version 20180823";
#define DEBUG
#include <stdio.h>

View File

@ -23,17 +23,19 @@
# ****************************************************************/
CFLAGS = -g
CFLAGS = -O2
CFLAGS =
CFLAGS = -O2
# compiler options
#CC = gcc -Wall -g -Wwrite-strings
CC = gcc -g -Wall -pedantic
#CC = gcc -O4 -Wall -pedantic -fno-strict-aliasing
#CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov
CC = gcc -g -Wall -pedantic
YACC = bison -d -y
# YACC = yacc -d
# yacc options. pick one; this varies a lot by system.
#YFLAGS = -d -S
#YACC = bison -d -y
YACC = yacc -d
# -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