Commit a5af8127 authored by Mark Andrews's avatar Mark Andrews
Browse files

add support for enabling library logging.

add missing ISC_LINK_INIT()
parent a7e4b894
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: db_test.c,v 1.54 2000/10/17 07:22:25 marka Exp $ */ /* $Id: db_test.c,v 1.55 2000/11/28 03:34:10 marka Exp $ */
/* /*
* Principal Author: Bob Halley * Principal Author: Bob Halley
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/log.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/time.h> #include <isc/time.h>
#include <isc/string.h> #include <isc/string.h>
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
#include <dns/dbiterator.h> #include <dns/dbiterator.h>
#include <dns/dbtable.h> #include <dns/dbtable.h>
#include <dns/fixedname.h> #include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/rdataset.h> #include <dns/rdataset.h>
#include <dns/rdatasetiter.h> #include <dns/rdatasetiter.h>
#include <dns/result.h> #include <dns/result.h>
...@@ -262,6 +264,7 @@ load(const char *filename, const char *origintext, isc_boolean_t cache) { ...@@ -262,6 +264,7 @@ load(const char *filename, const char *origintext, isc_boolean_t cache) {
dbi->iversion = NULL; dbi->iversion = NULL;
dbi->pause_every = pause_every; dbi->pause_every = pause_every;
dbi->ascending = ascending; dbi->ascending = ascending;
ISC_LINK_INIT(dbi, link);
len = strlen(origintext); len = strlen(origintext);
isc_buffer_init(&source, origintext, len); isc_buffer_init(&source, origintext, len);
...@@ -374,6 +377,7 @@ main(int argc, char *argv[]) { ...@@ -374,6 +377,7 @@ main(int argc, char *argv[]) {
size_t memory_quota = 0; size_t memory_quota = 0;
dns_trust_t trust = 0; dns_trust_t trust = 0;
unsigned int addopts; unsigned int addopts;
isc_log_t *lctx = NULL;
dns_result_register(); dns_result_register();
...@@ -381,8 +385,10 @@ main(int argc, char *argv[]) { ...@@ -381,8 +385,10 @@ main(int argc, char *argv[]) {
RUNTIME_CHECK(dns_dbtable_create(mctx, dns_rdataclass_in, &dbtable) == RUNTIME_CHECK(dns_dbtable_create(mctx, dns_rdataclass_in, &dbtable) ==
ISC_R_SUCCESS); ISC_R_SUCCESS);
strcpy(dbtype, "rbt"); strcpy(dbtype, "rbt");
while ((ch = isc_commandline_parse(argc, argv, "c:d:t:z:P:Q:gpqvT")) while ((ch = isc_commandline_parse(argc, argv, "c:d:t:z:P:Q:glpqvT"))
!= -1) { != -1) {
switch (ch) { switch (ch) {
case 'c': case 'c':
...@@ -398,6 +404,13 @@ main(int argc, char *argv[]) { ...@@ -398,6 +404,13 @@ main(int argc, char *argv[]) {
case 'g': case 'g':
options |= (DNS_DBFIND_GLUEOK|DNS_DBFIND_VALIDATEGLUE); options |= (DNS_DBFIND_GLUEOK|DNS_DBFIND_VALIDATEGLUE);
break; break;
case 'l':
RUNTIME_CHECK(isc_log_create(mctx, &lctx,
NULL) == ISC_R_SUCCESS);
isc_log_setcontext(lctx);
dns_log_init(lctx);
dns_log_setcontext(lctx);
break;
case 'q': case 'q':
quiet = ISC_TRUE; quiet = ISC_TRUE;
verbose = ISC_FALSE; verbose = ISC_FALSE;
...@@ -923,6 +936,9 @@ main(int argc, char *argv[]) { ...@@ -923,6 +936,9 @@ main(int argc, char *argv[]) {
dns_dbtable_detach(&dbtable); dns_dbtable_detach(&dbtable);
if (lctx != NULL)
isc_log_destroy(&lctx);
if (!quiet) if (!quiet)
isc_mem_stats(mctx, stdout); isc_mem_stats(mctx, stdout);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment