From ab239cb5ba1e3e72d53a55ca2a2e97469c29e884 Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 26 May 2006 00:53:07 +0000 Subject: oops --- src/lib9/fmt/dofmt.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lib9/fmt/dofmt.c') diff --git a/src/lib9/fmt/dofmt.c b/src/lib9/fmt/dofmt.c index 74697eb5..e4e32bf4 100644 --- a/src/lib9/fmt/dofmt.c +++ b/src/lib9/fmt/dofmt.c @@ -252,9 +252,17 @@ fmtstrcpy(Fmt *f, char *s) return __fmtcpy(f, "", 5, 5); /* if precision is specified, make sure we don't wander off the end */ if(f->flags & FmtPrec){ +#ifdef PLAN9PORT i = 0; for(j=0; jprec && s[i]; j++) i += chartorune(&r, s+i); +#else + /* ANSI requires precision in bytes, not Runes */ + for(i=0; iprec; i++) + if(s[i] == 0) + break; + j = utfnlen(s, i); /* won't print partial at end */ +#endif return __fmtcpy(f, s, j, i); } return __fmtcpy(f, s, utflen(s), strlen(s)); -- cgit v1.2.3