diff options
-rw-r--r-- | ChangeLog.old | 2 | ||||
-rw-r--r-- | log.c | 21 |
2 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog.old b/ChangeLog.old index c704f2c..45577ac 100644 --- a/ChangeLog.old +++ b/ChangeLog.old @@ -1,5 +1,7 @@ 2009-01-06 dain + * log.c: Bugfixed #capture together with multi-byte locales such + as UTF-8. * beam.c, tcp.c, tcp.h: Fixed IAC handling inside MPI messages. Still not done properly, but double IACs are converted to one ASCII 255, and message length is correctly computed. @@ -207,11 +207,14 @@ void log_write __P3 (char *,str, int,len, int,newline) movie_last = now; do { - if ((next = memchr(str, '\n', len))) + if ((next = memchr(str, '\n', len))) { i = next - str; - else - i = len, last = 1; - + newline = 1; + } else { + i = len; + last = 1; + } + if (datasize) log_writeline(str, i, last && !newline ? PROMPT : LINE, diff); else { @@ -222,9 +225,13 @@ void log_write __P3 (char *,str, int,len, int,newline) fprintf(moviefile, "%s %.*s\n", names[last && !newline ? PROMPT : LINE], i, str); } - if (capturefile) - fprintf(capturefile, "%.*s%s", - i, str, last && !newline ? "" : "\n"); + if (capturefile) { + fwrite(str, 1, i, capturefile); + if (newline) { + const char nl[1] = "\n"; + fwrite(nl, 1, 1, capturefile); + } + } } diff = 0; if (next) { |