(uprnf): A print function must not change its text argument!

This commit is contained in:
Markus Armbruster 2005-06-13 18:28:10 +00:00
parent b5ff7e3beb
commit 1bf1b5b303

View file

@ -73,13 +73,21 @@ pr(char *format, ...)
pr_player(player, C_DATA, buf); pr_player(player, C_DATA, buf);
} }
/*
* Print UTF-8 text BUF to current player.
*/
void void
uprnf(char *buf /* buf is message text */) uprnf(char *buf)
{ {
if (!(player->flags & PF_UTF8)) char *p;
copy_utf8_to_ascii_no_funny(buf, buf);
pr_player(player, C_DATA, buf); if (!(player->flags & PF_UTF8)) {
p = malloc(strlen(buf) + 1);
copy_utf8_to_ascii_no_funny(p, buf);
pr_player(player, C_DATA, p);
free(p);
} else
pr_player(player, C_DATA, buf);
} }
/*VARARGS*/ /*VARARGS*/