]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/pr.c
Fix input/output filtering to ASCII
[empserver] / src / lib / subs / pr.c
index 15c24556d00112a7993910fd1d2a1d868738a556..bde5918cb08bf6fb0eb848728cc992cba21d95d4 100644 (file)
@@ -30,7 +30,7 @@
  *     Dave Pare, 1986, 1989
  *     Steve McClure, 1998-2000
  *     Ron Koenderink, 2005
- *     Markus Armbruster, 2005-2009
+ *     Markus Armbruster, 2005-2011
  */
 
 /*
@@ -55,6 +55,7 @@
 #include "com.h"
 #include "empio.h"
 #include "file.h"
+#include "journal.h"
 #include "misc.h"
 #include "nat.h"
 #include "player.h"
@@ -124,6 +125,7 @@ pr_id(struct player *p, int id, char *format, ...)
 
     if (p->curid >= 0) {
        io_puts(p->iop, "\n");
+       journal_output(p, p->curid, "\n");
        p->curid = -1;
     }
     va_start(ap, format);
@@ -222,6 +224,8 @@ pr_player(struct player *pl, int id, char *buf)
     char *bp;
     int len;
 
+    journal_output(pl, id, buf);
+
     bp = buf;
     while (*bp != '\0') {
        if (pl->curid != -1 && pl->curid != id) {
@@ -263,6 +267,8 @@ upr_player(struct player *pl, int id, char *buf)
     char printbuf[2];
     char ch;
 
+    journal_output(pl, id, buf);
+
     printbuf[0] = '\0';
     printbuf[1] = '\0';
 
@@ -557,7 +563,8 @@ copy_utf8_to_ascii_no_funny(char *dst, char *src)
            ;                   /* ignore funny control */
        else if (ch > 0x7f) {
            *p++ = '?';         /* replace non-ASCII */
-           while ((*src++ & 0xc0) == 0x80) ;
+           while ((*src & 0xc0) == 0x80)
+               src++;
        } else
            *p++ = ch;
     }