From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <680defcae96b075c53e95286469aa683@rei2.9hal> Date: Mon, 10 Dec 2012 09:20:58 +0100 From: cinap_lenrek@gmx.de To: 9fans@9fans.net In-Reply-To: <3ae6745532f52ad89f292e3875bff5bf@rei2.9hal> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] awk split(a[1], a) Topicbox-Message-UUID: f2464e20-ead7-11e9-9d60-3106f5b1d025 small addition. this introduces a bug. have to save the DONTFREE flag if its already set! sorry! --- a/sys/src/cmd/awk/run.c Mon Dec 10 07:20:00 2012 +0100 +++ b/sys/src/cmd/awk/run.c Mon Dec 10 09:19:04 2012 +0100 @@ -1213,9 +1213,10 @@ FATAL("illegal type of split"); sep = *fs; ap = execute(a[1]); /* array name */ + n = y->tval; y->tval |= DONTFREE; /* split(a[x], a); */ freesymtab(ap); - y->tval &= ~DONTFREE; + y->tval = n; dprintf( ("split: s=|%s|, a=%s, sep=|%s|\n", s, ap->nval, fs) ); ap->tval &= ~STR; ap->tval |= ARR; -- cinap