(play_list): player->combuf[] is user text and must be printed as
such. (ufindbreak, ufindpfx): Rename, move to pr.c, external linkage.
This commit is contained in:
parent
24672e351b
commit
ddfd5c1699
4 changed files with 41 additions and 36 deletions
|
@ -441,3 +441,22 @@ prtoascii(char *buf /* buf is message text */)
|
|||
pbuf--;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return byte-index of the N-th UTF-8 character in UTF-8 string S.
|
||||
* If S doesn't have that many characters, return its length instead.
|
||||
*/
|
||||
int
|
||||
ufindpfx(char *s, int n)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (n && s[i])
|
||||
{
|
||||
if ((s[i++] & 0xc0) == 0xc0)
|
||||
while ((s[i] & 0xc0) == 0x80)
|
||||
i++;
|
||||
--n;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue