mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 13:20:00 -04:00
don't print redundant $ORIGIN's.
This commit is contained in:
parent
5d4999d241
commit
692ae2fff9
1 changed files with 14 additions and 7 deletions
|
|
@ -15,7 +15,7 @@
|
|||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: masterdump.c,v 1.67 2003/04/11 07:25:24 marka Exp $ */
|
||||
/* $Id: masterdump.c,v 1.68 2003/06/18 05:42:45 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -81,6 +81,7 @@ typedef struct dns_totext_ctx {
|
|||
char * linebreak;
|
||||
char linebreak_buf[DNS_TOTEXT_LINEBREAK_MAXLEN];
|
||||
dns_name_t * origin;
|
||||
dns_name_t * neworigin;
|
||||
dns_fixedname_t origin_fixname;
|
||||
isc_uint32_t current_ttl;
|
||||
isc_boolean_t current_ttl_valid;
|
||||
|
|
@ -285,6 +286,7 @@ totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) {
|
|||
}
|
||||
|
||||
ctx->origin = NULL;
|
||||
ctx->neworigin = NULL;
|
||||
ctx->current_ttl = 0;
|
||||
ctx->current_ttl_valid = ISC_FALSE;
|
||||
|
||||
|
|
@ -770,6 +772,7 @@ dump_rdatasets(isc_mem_t *mctx, dns_name_t *name, dns_rdatasetiter_t *rdsiter,
|
|||
isc_buffer_t *buffer, FILE *f)
|
||||
{
|
||||
isc_result_t itresult, dumpresult;
|
||||
isc_region_t r;
|
||||
dns_rdataset_t rdatasets[MAXSORT];
|
||||
dns_rdataset_t *sorted[MAXSORT];
|
||||
int i, n;
|
||||
|
|
@ -777,6 +780,15 @@ dump_rdatasets(isc_mem_t *mctx, dns_name_t *name, dns_rdatasetiter_t *rdsiter,
|
|||
itresult = dns_rdatasetiter_first(rdsiter);
|
||||
dumpresult = ISC_R_SUCCESS;
|
||||
|
||||
if (itresult == ISC_R_SUCCESS && ctx->neworigin != NULL) {
|
||||
isc_buffer_clear(buffer);
|
||||
itresult = dns_name_totext(ctx->neworigin, ISC_FALSE, buffer);
|
||||
RUNTIME_CHECK(itresult == ISC_R_SUCCESS);
|
||||
isc_buffer_usedregion(buffer, &r);
|
||||
fprintf(f, "$ORIGIN %.*s\n", (int) r.length, (char *) r.base);
|
||||
ctx->neworigin = NULL;
|
||||
}
|
||||
|
||||
again:
|
||||
for (i = 0;
|
||||
itresult == ISC_R_SUCCESS && i < MAXSORT;
|
||||
|
|
@ -1117,14 +1129,9 @@ dumptostreaminc(dns_dumpctx_t *dctx) {
|
|||
dns_fixedname_name(&dctx->tctx.origin_fixname);
|
||||
result = dns_dbiterator_origin(dctx->dbiter, origin);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
isc_buffer_clear(&buffer);
|
||||
result = dns_name_totext(origin, ISC_FALSE, &buffer);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
isc_buffer_usedregion(&buffer, &r);
|
||||
fprintf(dctx->f, "$ORIGIN %.*s\n", (int) r.length,
|
||||
(char *) r.base);
|
||||
if ((dctx->tctx.style.flags & DNS_STYLEFLAG_REL_DATA) != 0)
|
||||
dctx->tctx.origin = origin;
|
||||
dctx->tctx.neworigin = origin;
|
||||
}
|
||||
result = dns_db_allrdatasets(dctx->db, node, dctx->version,
|
||||
dctx->now, &rdsiter);
|
||||
|
|
|
|||
Loading…
Reference in a new issue