2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

delete does not now do recursive deletion.

new function nuke does what delete did.

fixed up some changed interfaces to the dns_rbt library.
This commit is contained in:
David Lawrence 1999-01-31 00:54:14 +00:00
parent 0f5962ac3e
commit fbcd8c7a5c

View File

@ -20,6 +20,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <isc/boolean.h>
#include <isc/error.h> #include <isc/error.h>
#include <dns/rbt.h> #include <dns/rbt.h>
@ -62,6 +63,17 @@ create_name(char *s) {
return &name; return &name;
} }
/*
* Not currently useful. Will be changed so create_name allocates memory
* and this function cleans it up.
*/
static void
delete_name(void *data) {
dns_name_t *name;
name = data;
}
#define CMDCHECK(s) (strncasecmp(command, (s), length) == 0) #define CMDCHECK(s) (strncasecmp(command, (s), length) == 0)
void void
@ -89,7 +101,7 @@ main (int argc, char **argv) {
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
result = dns_rbt_create(mctx, &rbt); result = dns_rbt_create(mctx, delete_name, &rbt);
if (result != DNS_R_SUCCESS) if (result != DNS_R_SUCCESS)
printf("dns_rbt_create: %s: exiting\n", printf("dns_rbt_create: %s: exiting\n",
dns_result_totext(result)); dns_result_totext(result));
@ -138,7 +150,24 @@ main (int argc, char **argv) {
printf("deleting name %s\n", printf("deleting name %s\n",
arg); arg);
result = dns_rbt_deletename result = dns_rbt_deletename
(rbt, name); (rbt, name,
ISC_FALSE);
if (result != DNS_R_SUCCESS)
printf("... %s\n",
dns_result_totext(result));
}
} else
printf("usage: delete NAME\n");
} else if (CMDCHECK("nuke")) {
if (arg != NULL && *arg != '\0') {
name = create_name(arg);
if (name != NULL) {
printf("deleting name %s\n",
arg);
result = dns_rbt_deletename
(rbt, name,
ISC_TRUE);
if (result != DNS_R_SUCCESS) if (result != DNS_R_SUCCESS)
printf("... %s\n", printf("... %s\n",
dns_result_totext(result)); dns_result_totext(result));
@ -153,7 +182,7 @@ main (int argc, char **argv) {
printf("searching for " printf("searching for "
"name %s ... ", arg); "name %s ... ", arg);
node = dns_rbt_findnode node = dns_rbt_findnode
(rbt, name); (rbt, name, NULL);
if (node != NULL) if (node != NULL)
printf("found it.\n"); printf("found it.\n");
else else