2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +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;
isc_boolean_t downcase = ISC_FALSE;
size_t len;
dns_offsets_t offsets, compoffsets;
argc--;
argv++;
@@ -68,6 +69,7 @@ main(int argc, char *argv[]) {
isc_buffer_add(&source, len);
isc_buffer_init(&target, o, 255,
ISC_BUFFERTYPE_BINARY);
dns_name_init(&oname, NULL);
result = dns_name_fromtext(&oname, &source,
dns_rootname, 0,
&target);
@@ -92,6 +94,7 @@ main(int argc, char *argv[]) {
isc_buffer_add(&source, len);
isc_buffer_init(&target, c, 255,
ISC_BUFFERTYPE_BINARY);
dns_name_init(&compname, compoffsets);
result = dns_name_fromtext(&compname, &source,
dns_rootname, 0,
&target);
@@ -106,6 +109,7 @@ main(int argc, char *argv[]) {
} else
comp = NULL;
dns_name_init(&name, offsets);
while (gets(s) != NULL) {
len = strlen(s);
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));
}
#ifndef QUIET
if (comp != NULL) {
int i;
isc_boolean_t b;
i = dns_name_compare(&name, comp);
b = dns_name_issubdomain(&name, comp);
#ifndef QUIET
if (i < 0)
printf("<, ");
else if (i > 0)
@@ -154,8 +158,11 @@ main(int argc, char *argv[]) {
if (!b)
printf("not ");
printf("subdomain\n");
}
#else
if (!b)
printf("not subdomain\n");
#endif
}
}
return (0);

View File

@@ -157,7 +157,7 @@ main(int argc, char *argv[]) {
fclose(f);
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_add(&source, bp - b);