summaryrefslogtreecommitdiff
path: root/bin/tests/name_test.c
diff options
context:
space:
mode:
authorInternet Software Consortium, Inc <@isc.org>2007-09-07 14:15:23 -0600
committerLaMont Jones <lamont@debian.org>2007-09-07 14:15:23 -0600
commit708dfaae929e0746a1e6fb5100d2c74036e45adf (patch)
tree8e41d12e0a398d83e4b055867ea794f50d3dc337 /bin/tests/name_test.c
parent00fa0dd5b9bb17deb8d2e96a2bc4234abaa9d5ac (diff)
downloadbind9-708dfaae929e0746a1e6fb5100d2c74036e45adf.tar.gz
9.3.0beta2
Diffstat (limited to 'bin/tests/name_test.c')
-rw-r--r--bin/tests/name_test.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/bin/tests/name_test.c b/bin/tests/name_test.c
index 3390fb54..bd9bfa69 100644
--- a/bin/tests/name_test.c
+++ b/bin/tests/name_test.c
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1998-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: name_test.c,v 1.33.2.3 2005/03/17 03:59:31 marka Exp $ */
+/* $Id: name_test.c,v 1.33.12.4 2004/04/13 03:24:40 marka Exp $ */
#include <config.h>
@@ -83,7 +83,7 @@ main(int argc, char *argv[]) {
isc_boolean_t test_downcase = ISC_FALSE;
isc_boolean_t inplace = ISC_FALSE;
isc_boolean_t want_split = ISC_FALSE;
- unsigned int depth, split_depth = 0;
+ unsigned int labels, split_label = 0;
dns_fixedname_t fprefix, fsuffix;
dns_name_t *prefix, *suffix;
int ch;
@@ -107,7 +107,7 @@ main(int argc, char *argv[]) {
break;
case 's':
want_split = ISC_TRUE;
- split_depth = atoi(isc_commandline_argument);
+ split_label = atoi(isc_commandline_argument);
break;
case 'w':
check_wildcard = ISC_TRUE;
@@ -166,16 +166,16 @@ main(int argc, char *argv[]) {
dns_fixedname_init(&wname);
name = dns_fixedname_name(&wname);
dns_fixedname_init(&wname2);
- while (fgets(s, sizeof s, stdin) != NULL) {
+ while (fgets(s, sizeof(s), stdin) != NULL) {
len = strlen(s);
- if (len > 0U && s[len - 1] == '\n') {
+ if (len > 0 && s[len - 1] == '\n') {
s[len - 1] = '\0';
len--;
}
isc_buffer_init(&source, s, len);
isc_buffer_add(&source, len);
- if (len > 0U)
+ if (len > 0)
result = dns_name_fromtext(name, &source, origin,
downcase, NULL);
else {
@@ -292,11 +292,11 @@ main(int argc, char *argv[]) {
if (comp != NULL && dns_name_countlabels(name) > 0) {
int order;
- unsigned int nlabels, nbits;
+ unsigned int nlabels;
dns_namereln_t namereln;
namereln = dns_name_fullcompare(name, comp, &order,
- &nlabels, &nbits);
+ &nlabels);
if (!quiet) {
if (order < 0)
printf("<");
@@ -319,32 +319,25 @@ main(int argc, char *argv[]) {
}
if (namereln != dns_namereln_none &&
namereln != dns_namereln_equal)
- printf(", nlabels = %u, nbits = %u",
- nlabels, nbits);
+ printf(", nlabels = %u", nlabels);
printf("\n");
}
printf("dns_name_equal() returns %s\n",
dns_name_equal(name, comp) ? "TRUE" : "FALSE");
}
- depth = dns_name_depth(name);
- if (want_split && split_depth < depth) {
+ labels = dns_name_countlabels(name);
+ if (want_split && split_label < labels) {
dns_fixedname_init(&fprefix);
prefix = dns_fixedname_name(&fprefix);
dns_fixedname_init(&fsuffix);
suffix = dns_fixedname_name(&fsuffix);
- printf("splitting at depth %u: ", split_depth);
- result = dns_name_splitatdepth(name, split_depth,
- prefix, suffix);
- if (result == ISC_R_SUCCESS) {
- printf("\n prefix = ");
- print_name(prefix);
- printf(" suffix = ");
- print_name(suffix);
- } else {
- printf("failed: %s\n",
- isc_result_totext(result));
- }
+ printf("splitting at label %u: ", split_label);
+ dns_name_split(name, split_label, prefix, suffix);
+ printf("\n prefix = ");
+ print_name(prefix);
+ printf(" suffix = ");
+ print_name(suffix);
}
if (concatenate) {