modified bts2str to also escape double quotes
This commit is contained in:
parent
8e7e1320ac
commit
b909bb629b
|
@ -19,7 +19,7 @@ bts2str(b, n, s)
|
|||
|
||||
while (n-- > 0) {
|
||||
if (is_print(*f)) {
|
||||
if (*f == '\\') *t++ = *f;
|
||||
if (*f == '\\' || *f == '"') *t++ = '\\';
|
||||
*t++ = *f++;
|
||||
} else {
|
||||
*t++ = '\\';
|
||||
|
|
|
@ -156,6 +156,7 @@ into a null-terminated string, starting at
|
|||
.IR s .
|
||||
Printable characters are copied and non-printable characters are transformed
|
||||
into sequences of printable characters, representing those characters.
|
||||
Also, back-slashes and double quotes are escaped with a back-slash.
|
||||
The transformation agrees with the representation of non-printable
|
||||
characters in C strings.
|
||||
.br
|
||||
|
|
Loading…
Reference in a new issue