db_test.c revision 22c4f0162f46e3b16f719d6c11b0a003cc1020e3
/*
* Copyright (C) 1999 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/compress.h>
static void
char b[255];
}
static void
isc_region_t r;
dns_name_toregion(name, &r);
}
int
char s[1000];
char t[1000];
char b[255];
isc_region_t r;
if (argc < 2) {
exit(1);
}
&db);
if (result != DNS_R_SUCCESS) {
printf("couldn't load master file: %s\n",
exit(1);
}
&target);
if (result != DNS_R_SUCCESS) {
continue;
}
if (result == DNS_R_NOTFOUND)
printf("not found\n");
else if (result != DNS_R_SUCCESS)
else {
printf("success\n");
&rdataset);
if (result == DNS_R_NOTFOUND)
printf("type 2 rdataset not found\n");
else if (result != DNS_R_SUCCESS)
else {
isc_buffer_init(&text, t, sizeof t,
&name,
&text);
isc_buffer_used(&text, &r);
if (result == DNS_R_SUCCESS)
(char *)r.base);
else
printf("%s\n",
}
}
}
dns_db_detach(&db);
return (0);
}