[plain text]
--- run.c.orig 2005-03-21 15:50:10.000000000 -0800
+++ run.c 2005-03-22 18:16:27.000000000 -0800
@@ -88,6 +88,8 @@
Node *curnode = NULL; /* the node being executed, for debugging */
+static Awkfloat prev_srand, tmp_srand;
+
/* buffer memory management */
int adjbuf(char **pbuf, int *psiz, int minlen, int quantum, char **pbptr,
const char *whatrtn)
@@ -193,6 +195,7 @@
if (setjmp(env) != 0) /* handles exit within END */
goto ex1;
if (a[2]) { /* END */
+ donefld = 1; /* avoid updating NF */
x = execute(a[2]);
if (isbreak(x) || isnext(x) || iscont(x))
FATAL("illegal break, continue, next or nextfile from END");
@@ -895,7 +898,7 @@
break;
case 'f': sprintf(p, fmt, getfval(x)); break;
case 'd': sprintf(p, fmt, (long) getfval(x)); break;
- case 'u': sprintf(p, fmt, (int) getfval(x)); break;
+ case 'u': sprintf(p, fmt, (unsigned int) getfval(x)); break;
case 's':
t = getsval(x);
n = strlen(t);
@@ -1509,6 +1512,9 @@
else
u = getfval(x);
srand((unsigned int) u);
+ tmp_srand = u;
+ u = prev_srand; /* return the previous value */
+ prev_srand = tmp_srand; /* remember for next time */
break;
case FTOUPPER:
case FTOLOWER:
Generated by GNU enscript 1.6.4.