Small improvement in toprint()

This commit is contained in:
Andrew Bettison 2012-07-13 18:00:25 +09:30
parent c09582a220
commit 0c260a966e

4
log.c
View File

@ -266,7 +266,9 @@ char *toprint(char *dstStr, size_t dstChars, const unsigned char *srcBuf, size_t
strbuf_puts(b, "\\r");
else if (*srcBuf == '\t')
strbuf_puts(b, "\\t");
else if (isprint(*srcBuf))
else if (*srcBuf == '\\')
strbuf_puts(b, "\\\\");
else if (*srcBuf >= ' ' && *srcBuf <= '~')
strbuf_putc(b, *srcBuf);
else
strbuf_sprintf(b, "\\x%02x", *srcBuf);