[resubmitted having pulled from sources and fixed careless mistake caused by manually entering a change that i'd made on another system, without testing it.] for the record, these are the changes: printf("%c", 0); could produce unexpected results (it read uninitialised memory) the utf function was in the wrong place, so never worked. Notes: Fri Mar 10 10:41:55 EST 2006 rsc I don't see why you need else{ *p++ = 0; *p = 0; } why can't you just use *p = 0 alone? Do you really want an embedded NUL in your string? Is that really going to work? Fri Mar 10 11:44:41 EST 2006 rsc never mind, i see that it's fine. Reference: /n/sources/patch/applied/awkbugs.again Date: Thu Mar 9 17:39:25 CET 2006 Reviewed-by: rsc --- /sys/src/cmd/awk/run.c Thu Mar 9 16:45:54 2006 +++ /sys/src/cmd/awk/run.c Thu Mar 9 16:45:36 2006 @@ -903,8 +903,10 @@ if (isnum(x)) { if (getfval(x)) sprintf(p, fmt, (int) getfval(x)); - else + else{ *p++ = '\0'; + *p = '\0'; + } } else sprintf(p, fmt, getsval(x)[0]); break; --- /sys/src/cmd/awk/lex.c Thu Mar 9 16:47:13 2006 +++ /sys/src/cmd/awk/lex.c Thu Mar 9 16:46:46 2006 @@ -86,8 +86,8 @@ { "system", FSYSTEM, BLTIN }, { "tolower", FTOLOWER, BLTIN }, { "toupper", FTOUPPER, BLTIN }, - { "while", WHILE, WHILE }, { "utf", FUTF, BLTIN }, + { "while", WHILE, WHILE }, }; #define DEBUG