tbetter utf - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 54357361fbc3032b36688bb4c1d4ced1f14f08f6
parent a38a183626848f897085b4d2e54dad6d39146948
Author: rsc 
Date:   Tue, 14 Feb 2006 19:42:58 +0000

better utf

Diffstat:
  M src/cmd/mpm/slug.cc                 |       4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/cmd/mpm/slug.cc b/src/cmd/mpm/slug.cc
t@@ -1,7 +1,7 @@
 #include        "misc.h"
 #include        "slug.h"
-//#include        
 #include        
+#include        
 
 static char        *bufptr(int);
 
t@@ -156,7 +156,7 @@ static char *getutf(FILE *fp)        // get 1 utf-encoded char (might be multiple bytes
 
         for (*p = 0; (*p++ = getc(fp)) != EOF; ) {
                 *p = 0;
-                if (mblen(buf, sizeof buf) > 0)        // found a valid character
+                if (fullrune(buf, p-buf))        // found a valid character
                         break;
         }
         return buf;