4.2bsd awk bug

Bill Shannon shannon at sun.uucp
Fri Dec 9 19:29:39 AEST 1983


Index:	bin/awk 4.2BSD [Fix]

Description:
	Awk doesn't allow you to replace fields.  This bug was
	introduced when the indirect-through-zero bugs in awk
	were fixed.
Repeat-By:
	The following command
		echo 1 2 3 | awk '{$1 = NF; print}'
	should give
		3 2 3
	if it works.
	If it's broken it will give
		1 2 3
Fix:
	Install the following fix:

	--- awk.def
	7a8
	> #define	isnull(x)	((x) == EMPTY || (x) == NULL)

	--- tran.c
	139c139
	< 	if ((vp->tval & FLD) && vp->nval == 0)
	---
	> 	if ((vp->tval & FLD) && isnull(vp->nval))
	154c154
	< 	if ((vp->tval & FLD) && vp->nval == 0)
	---
	> 	if ((vp->tval & FLD) && isnull(vp->nval))



More information about the Comp.bugs.4bsd.ucb-fixes mailing list