2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

offsets are now optional

This commit is contained in:
Bob Halley
1999-01-09 00:34:18 +00:00
parent 86131d8d7a
commit 514a93f41f
2 changed files with 10 additions and 3 deletions

View File

@@ -54,6 +54,7 @@ main(int argc, char *argv[]) {
dns_name_t *origin, *comp; dns_name_t *origin, *comp;
isc_boolean_t downcase = ISC_FALSE; isc_boolean_t downcase = ISC_FALSE;
size_t len; size_t len;
dns_offsets_t offsets, compoffsets;
argc--; argc--;
argv++; argv++;
@@ -68,6 +69,7 @@ main(int argc, char *argv[]) {
isc_buffer_add(&source, len); isc_buffer_add(&source, len);
isc_buffer_init(&target, o, 255, isc_buffer_init(&target, o, 255,
ISC_BUFFERTYPE_BINARY); ISC_BUFFERTYPE_BINARY);
dns_name_init(&oname, NULL);
result = dns_name_fromtext(&oname, &source, result = dns_name_fromtext(&oname, &source,
dns_rootname, 0, dns_rootname, 0,
&target); &target);
@@ -92,6 +94,7 @@ main(int argc, char *argv[]) {
isc_buffer_add(&source, len); isc_buffer_add(&source, len);
isc_buffer_init(&target, c, 255, isc_buffer_init(&target, c, 255,
ISC_BUFFERTYPE_BINARY); ISC_BUFFERTYPE_BINARY);
dns_name_init(&compname, compoffsets);
result = dns_name_fromtext(&compname, &source, result = dns_name_fromtext(&compname, &source,
dns_rootname, 0, dns_rootname, 0,
&target); &target);
@@ -106,6 +109,7 @@ main(int argc, char *argv[]) {
} else } else
comp = NULL; comp = NULL;
dns_name_init(&name, offsets);
while (gets(s) != NULL) { while (gets(s) != NULL) {
len = strlen(s); len = strlen(s);
isc_buffer_init(&source, s, len, ISC_BUFFERTYPE_TEXT); isc_buffer_init(&source, s, len, ISC_BUFFERTYPE_TEXT);
@@ -138,13 +142,13 @@ main(int argc, char *argv[]) {
printf("%s\n", dns_result_totext(result)); printf("%s\n", dns_result_totext(result));
} }
#ifndef QUIET
if (comp != NULL) { if (comp != NULL) {
int i; int i;
isc_boolean_t b; isc_boolean_t b;
i = dns_name_compare(&name, comp); i = dns_name_compare(&name, comp);
b = dns_name_issubdomain(&name, comp); b = dns_name_issubdomain(&name, comp);
#ifndef QUIET
if (i < 0) if (i < 0)
printf("<, "); printf("<, ");
else if (i > 0) else if (i > 0)
@@ -154,8 +158,11 @@ main(int argc, char *argv[]) {
if (!b) if (!b)
printf("not "); printf("not ");
printf("subdomain\n"); printf("subdomain\n");
} #else
if (!b)
printf("not subdomain\n");
#endif #endif
}
} }
return (0); return (0);

View File

@@ -157,7 +157,7 @@ main(int argc, char *argv[]) {
fclose(f); fclose(f);
dctx.allowed = DNS_COMPRESS_GLOBAL14 | DNS_COMPRESS_GLOBAL16; dctx.allowed = DNS_COMPRESS_GLOBAL14 | DNS_COMPRESS_GLOBAL16;
dns_name_init(&dctx.owner_name); dns_name_init(&dctx.owner_name, NULL);
isc_buffer_init(&source, b, 255, ISC_BUFFERTYPE_BINARY); isc_buffer_init(&source, b, 255, ISC_BUFFERTYPE_BINARY);
isc_buffer_add(&source, bp - b); isc_buffer_add(&source, bp - b);