diff options
author | Roland McGrath <roland@gnu.org> | 1996-05-09 15:59:18 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-05-09 15:59:18 +0000 |
commit | 557072655748be14a747242135f1b34eff9f735f (patch) | |
tree | 9ee1bcb428de7c9f205cf093263d207d0b5ebb38 /resolv/res_debug.c | |
parent | 782e865067efc414b8dca36d8dd632d621ba94ef (diff) | |
download | glibc-557072655748be14a747242135f1b34eff9f735f.zip glibc-557072655748be14a747242135f1b34eff9f735f.tar.gz glibc-557072655748be14a747242135f1b34eff9f735f.tar.bz2 |
* resolv: Code updated from BIND-4.9.3P2C3.
Diffstat (limited to 'resolv/res_debug.c')
-rw-r--r-- | resolv/res_debug.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/resolv/res_debug.c b/resolv/res_debug.c index b3dfcdf..85ec628 100644 --- a/resolv/res_debug.c +++ b/resolv/res_debug.c @@ -502,16 +502,28 @@ __p_rr(cp, msg, file) case T_HINFO: case T_ISDN: + (void) fputs("\t\"", file); cp2 = cp + dlen; - if (n = *cp++) { - fprintf(file, "\t%.*s", n, cp); - cp += n; + if ((n = (unsigned char) *cp++) != 0) { + for (c = n; c > 0 && cp < cp2; c--) { + if (strchr("\n\"\\", *cp)) + (void) putc('\\', file); + (void) putc(*cp++, file); + } + putc('"', file); } - if ((cp < cp2) && (n = *cp++)) { - fprintf(file, "\t%.*s", n, cp); - cp += n; - } else if (type == T_HINFO) + if (cp < cp2 && (n = (unsigned char) *cp++) != 0) { + (void) fputs ("\t\"", file); + for (c = n; c > 0 && cp < cp2; c--) { + if (strchr("\n\"\\", *cp)) + (void) putc('\\', file); + (void) putc(*cp++, file); + } + putc('"', file); + } else if (type == T_HINFO) { + (void) fputs("\"?\"", file); fprintf(file, "\n;; *** Warning *** OS-type missing"); + } break; case T_SOA: @@ -563,12 +575,11 @@ __p_rr(cp, msg, file) cp2 = cp1 + dlen; while (cp < cp2) { if (n = (unsigned char) *cp++) { - for (c = n; c > 0 && cp < cp2; c--) - if ((*cp == '\n') || (*cp == '"')) { - (void) putc('\\', file); - (void) putc(*cp++, file); - } else - (void) putc(*cp++, file); + for (c = n; c > 0 && cp < cp2; c--) { + if (strchr("\n\"\\", *cp)) + (void) putc('\\', file); + (void) putc(*cp++, file); + } } } putc('"', file); |