modified bts2str to also escape double quotes

This commit is contained in:
ceriel 1988-10-05 16:19:42 +00:00
parent 8e7e1320ac
commit b909bb629b
2 changed files with 2 additions and 1 deletions

View file

@ -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++ = '\\';

View file

@ -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