From 9ce72fc748cc7c2b738147f9736e00a96474be1b Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Tue, 22 Aug 2000 22:07:13 +0000 Subject: [PATCH] don't print parens at all if in non-multiline mode. --- lib/dns/rdata/generic/soa_6.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/dns/rdata/generic/soa_6.c b/lib/dns/rdata/generic/soa_6.c index 4b4c538c5c..1c042ffe17 100644 --- a/lib/dns/rdata/generic/soa_6.c +++ b/lib/dns/rdata/generic/soa_6.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: soa_6.c,v 1.42 2000/08/01 01:26:02 tale Exp $ */ +/* $Id: soa_6.c,v 1.43 2000/08/22 22:07:13 bwelling Exp $ */ /* Reviewed: Thu Mar 16 15:18:32 PST 2000 by explorer */ @@ -73,9 +73,15 @@ totext_soa(ARGS_TOTEXT) { dns_name_t prefix; isc_boolean_t sub; int i; + isc_boolean_t multiline; REQUIRE(rdata->type == 6); + multiline = ISC_TF((tctx->flags & (DNS_STYLEFLAG_MULTILINE | + DNS_STYLEFLAG_COMMENT)) == + (DNS_STYLEFLAG_MULTILINE | + DNS_STYLEFLAG_COMMENT)); + dns_name_init(&mname, NULL); dns_name_init(&rname, NULL); dns_name_init(&prefix, NULL); @@ -96,7 +102,8 @@ totext_soa(ARGS_TOTEXT) { sub = name_prefix(&rname, tctx->origin, &prefix); RETERR(dns_name_totext(&prefix, sub, target)); - RETERR(str_totext(" (" , target)); + if (multiline) + RETERR(str_totext(" (" , target)); RETERR(str_totext(tctx->linebreak, target)); for (i = 0; i < 5 ; i++) { @@ -108,10 +115,7 @@ totext_soa(ARGS_TOTEXT) { numlen = sprintf(buf, "%lu", num); INSIST(numlen > 0 && numlen < sizeof "2147483647"); RETERR(str_totext(buf, target)); - if ((tctx->flags & (DNS_STYLEFLAG_MULTILINE | - DNS_STYLEFLAG_COMMENT)) == - (DNS_STYLEFLAG_MULTILINE | - DNS_STYLEFLAG_COMMENT)) { + if (multiline) { RETERR(str_totext(" ; " + numlen, target)); RETERR(str_totext(soa_fieldnames[i], target)); /* Print times in week/day/hour/minute/second form */ @@ -121,12 +125,13 @@ totext_soa(ARGS_TOTEXT) { RETERR(str_totext(")", target)); } RETERR(str_totext(tctx->linebreak, target)); - } else { + } else if (i < 4) { RETERR(str_totext(" ", target)); } } - RETERR(str_totext(")", target)); + if (multiline) + RETERR(str_totext(" )", target)); return (ISC_R_SUCCESS); }