Commit 48674819 authored by Michael Sawyer's avatar Michael Sawyer
Browse files

367. [func] Allow proper selection of server on nslookup command

                        line.

 366.   [func]          Allow use of '-' batch file in dig for stdin.
parent 5896a3af
367. [func] Allow proper selection of server on nslookup command
line.
366. [func] Allow use of '-' batch file in dig for stdin.
365. [bug] nsupdate -k leaked memory.
364. [func] Added additional-from-{cache,auth}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dig.c,v 1.82 2000/08/01 01:11:14 tale Exp $ */
/* $Id: dig.c,v 1.83 2000/08/02 17:58:06 mws Exp $ */
#include <config.h>
#include <stdlib.h>
......@@ -1048,7 +1048,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
* to get the rest
*/
if ((batchname != NULL) && !(is_batchfile)) {
batchfp = fopen(batchname, "r");
if (strcmp(batchname, "-") == 0)
batchfp = stdin;
else
batchfp = fopen(batchname, "r");
if (batchfp == NULL) {
perror(batchname);
if (exitcode < 10)
......@@ -1108,7 +1111,8 @@ dighost_shutdown(void) {
if (feof(batchfp)) {
batchname = NULL;
isc_app_shutdown();
fclose(batchfp);
if (batchfp != stdin)
fclose(batchfp);
return;
}
......@@ -1128,7 +1132,8 @@ dighost_shutdown(void) {
start_lookup();
} else {
batchname = NULL;
fclose(batchfp);
if (batchfp != stdin)
fclose(batchfp);
isc_app_shutdown();
return;
}
......@@ -1165,7 +1170,8 @@ main(int argc, char **argv) {
}
isc_mem_free(mctx, default_lookup);
if (batchname != NULL) {
fclose(batchfp);
if (batchfp != stdin)
fclose(batchfp);
batchname = NULL;
}
cancel_all();
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nslookup.c,v 1.29 2000/08/01 01:11:17 tale Exp $ */
/* $Id: nslookup.c,v 1.30 2000/08/02 17:58:07 mws Exp $ */
#include <config.h>
......@@ -612,6 +612,7 @@ testclass(char *typetext) {
static void
setoption(char *opt) {
dig_server_t *srv;
if (strncasecmp(opt,"all",4) == 0) {
show_settings(ISC_TRUE);
......@@ -664,10 +665,14 @@ setoption(char *opt) {
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;
isc_result_t result;
......@@ -709,6 +714,7 @@ addlookup(char *opt) {
lookup->origin = NULL;
ISC_LIST_INIT(lookup->my_server_list);
debug("looking up %s", lookup->textname);
return (lookup);
}
static void
......@@ -787,7 +793,7 @@ parse_args(int argc, char **argv) {
} else {
if (lookup == NULL) {
in_use = ISC_TRUE;
addlookup(argv[0]);
lookup=addlookup(argv[0]);
}
else
setsrv(argv[0]);
......
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