diff options
author | Gustav HÃ¥llberg <gustav@gmail.com> | 2009-01-16 23:49:41 (GMT) |
---|---|---|
committer | Gustav HÃ¥llberg <gustav@gmail.com> | 2009-01-16 23:55:40 (GMT) |
commit | 91577d08988638929266667ee0e77c84f8af47c4 (patch) | |
tree | d9d3491e07ec1b351aaac876c936aea519b7d0bd | |
parent | 6f1485f772cf5671fb5f8d94026254e6f1e6a832 (diff) | |
download | powwow-91577d08988638929266667ee0e77c84f8af47c4.zip powwow-91577d08988638929266667ee0e77c84f8af47c4.tar.gz powwow-91577d08988638929266667ee0e77c84f8af47c4.tar.bz2 |
bugfixed #capture together with multibyte output locales such as UTF-8
-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) { |