(xdprval): Fix for strings with characters printed as escapes. Print
null pointer as `nil' to distinguish it from empty string.
This commit is contained in:
parent
7a4f133d1c
commit
5346422665
1 changed files with 11 additions and 9 deletions
|
@ -303,17 +303,19 @@ xdprval(struct valstr *val, char *sep)
|
|||
pr("%s%g", sep, val->val_as.dbl);
|
||||
break;
|
||||
case NSC_STRING:
|
||||
pr("%s\"", sep);
|
||||
s = val->val_as.str;
|
||||
while (s && *s) {
|
||||
if (s) {
|
||||
pr("%s\"", sep);
|
||||
while (*s) {
|
||||
for (e = s; *e != '"' && isprint(*e); ++e) ;
|
||||
pr("%*s", (int)(e-s), s);
|
||||
for (; *e && !isprint(*e); ++e) {
|
||||
pr("\\%3o", *e);
|
||||
}
|
||||
pr("%.*s", (int)(e-s), s);
|
||||
if (*e)
|
||||
pr("\\%03o", *e++);
|
||||
s = e;
|
||||
}
|
||||
prnf("\"");
|
||||
} else
|
||||
pr("%snil", sep);
|
||||
break;
|
||||
default:
|
||||
CANT_HAPPEN("Bad VAL type");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue