| 209 | |
| 210 | |
| 211 | int |
| 212 | utflen(const char *s) |
| 213 | { |
| 214 | int c; |
| 215 | long n; |
| 216 | Rune rune; |
| 217 | |
| 218 | n = 0; |
| 219 | for(;;) { |
| 220 | c = *(unsigned char*)s; |
| 221 | if(c < Runeself) { |
| 222 | if(c == 0) |
| 223 | return n; |
| 224 | s++; |
| 225 | } else |
| 226 | s += chartorune(&rune, s); |
| 227 | n++; |
| 228 | } |
| 229 | return 0; |
| 230 | } |
| 231 | |
| 232 | char* |
| 233 | utfrune(const char *s, Rune c) |