Thu Jan 20 21:26:20 2011 UTC ()
fix bug introduced in rev. 1.3: need to set the string before
converting it into a numerical value, otherwise we might get junk or crash


(drochner)
diff -r1.3 -r1.4 src/external/historical/nawk/dist/tran.c

cvs diff -r1.3 -r1.4 src/external/historical/nawk/dist/tran.c (expand / switch to context diff)
--- src/external/historical/nawk/dist/tran.c 2010/11/07 22:55:26 1.3
+++ src/external/historical/nawk/dist/tran.c 2011/01/20 21:26:20 1.4
@@ -353,6 +353,7 @@
 	   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;
 	if (&vp->fval == NF) {
 		donerec = 0;	/* mark $0 invalid */
 		f = getfval(vp);
@@ -360,7 +361,7 @@
 		dprintf( ("setting NF to %g\n", f) );
 	}
 
-	return(vp->sval = t);
+	return(vp->sval);
 }
 
 Awkfloat getfval(Cell *vp)	/* get float val of a Cell */