(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:
Markus Armbruster 2005-06-13 08:42:27 +00:00
parent 24672e351b
commit ddfd5c1699
4 changed files with 41 additions and 36 deletions

View file

@ -39,9 +39,6 @@
#include "file.h"
#include "commands.h"
static int ufindbreak(char *message /* message is message text */,
int num_chars);
int
flash(void)
{
@ -143,7 +140,7 @@ sendmessage(struct natstr *us, struct natstr *to, char *message
char c; /* c is message text */
int pos;
pos = ufindbreak(message, 60);
pos = ufindpfx(message, 60);
c = message[pos];
if (c)
message[pos] = '\0';
@ -206,22 +203,3 @@ sendmessage(struct natstr *us, struct natstr *to, char *message
}
return 0;
}
/*
* 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
ufindbreak(char *s /* s is message text */, int n)
{
int i = 0;
while (n && s[i])
{
if ((s[i++] & 0xc0) == 0xc0)
while ((s[i] & 0xc0) == 0x80)
i++;
--n;
}
return i;
}