* SOFTWARE.
*/
-/* $Id: dighost.c,v 1.58.2.8 2000/07/26 22:28:31 gson Exp $ */
+/* $Id: dighost.c,v 1.58.2.9 2000/08/07 23:50:13 gson Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
}
}
+/*
+ * Create a server structure, which is part of the lookup structure.
+ * This is little more than a linked list of servers to query in hopes
+ * of finding the answer the user is looking for
+ */
+dig_server_t *
+make_server(const char *servname) {
+ dig_server_t *srv;
+
+ REQUIRE(servname != NULL);
+
+ debug("make_server(%s)",servname);
+ srv = isc_mem_allocate(mctx, sizeof(struct dig_server));
+ if (srv == NULL)
+ fatal("Memory allocation failure in %s:%d",
+ __FILE__, __LINE__);
+ strncpy(srv->servername, servname, MXNAME);
+ return (srv);
+}
+
isc_boolean_t
isclass(char *text) {
/*
* SOFTWARE.
*/
-/* $Id: nslookup.c,v 1.20.2.2 2000/07/17 19:40:54 gson Exp $ */
+/* $Id: nslookup.c,v 1.20.2.3 2000/08/07 23:50:16 gson Exp $ */
#include <config.h>
extern char fixeddomain[MXNAME];
extern int exitcode;
extern isc_taskmgr_t *taskmgr;
+extern isc_mempool_t *commctx;
extern char *progname;
isc_boolean_t short_form = ISC_TRUE, printcmd = ISC_TRUE,
static void
setoption(char *opt) {
+ dig_server_t *srv;
if (strncasecmp(opt,"all",4) == 0) {
show_settings(ISC_TRUE);
debugging = ISC_FALSE;
} else if (strncasecmp(opt, "sil",3) == 0) {
deprecation_msg = ISC_FALSE;
+ } else {
+ srv = make_server(opt);
+ debug("server is %s", srv->servername);
+ ISC_LIST_APPEND(server_list, srv, link);
}
}
-static void
+static dig_lookup_t*
addlookup(char *opt) {
dig_lookup_t *lookup;
lookup->origin = NULL;
ISC_LIST_INIT(lookup->my_server_list);
debug("looking up %s", lookup->textname);
+ return (lookup);
}
static void
static void
parse_args(int argc, char **argv) {
dig_lookup_t *lookup = NULL;
+ isc_boolean_t have_lookup = ISC_FALSE;
for (argc--, argv++; argc > 0; argc--, argv++) {
debug ("main parsing %s", argv[0]);
}
if (argv[0][1] != 0)
setoption(&argv[0][1]);
+ else
+ have_lookup = ISC_TRUE;
} else {
- if (lookup == NULL) {
+ if (!have_lookup) {
+ have_lookup = ISC_TRUE;
in_use = ISC_TRUE;
- addlookup(argv[0]);
+ lookup = addlookup(argv[0]);
}
else
setsrv(argv[0]);
if (ISC_LINK_LINKED(&q->lengthbuf, link))
ISC_LIST_DEQUEUE(q->lengthlist, &q->lengthbuf,
link);
+ INSIST(q->recvspace != NULL);
+ isc_mempool_put(commctx, q->recvspace);
isc_buffer_invalidate(&q->recvbuf);
isc_buffer_invalidate(&q->lengthbuf);
qp = q;
}
if (l->sendmsg != NULL)
dns_message_destroy(&l->sendmsg);
+ if (l->sendspace != NULL)
+ isc_mempool_put(commctx, l->sendspace);
if (l->timer != NULL)
isc_timer_detach(&l->timer);
lp = l;