summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/bin/dig/nslookup.c
diff options
context:
space:
mode:
authorerwin <erwin@FreeBSD.org>2013-08-22 08:15:03 +0000
committererwin <erwin@FreeBSD.org>2013-08-22 08:15:03 +0000
commit6a288ef517fece2ca5a21d081efd7b4a81da0053 (patch)
tree37271fd86c9be9a6bab12a7aebd85ccfbb8a7b62 /contrib/bind9/bin/dig/nslookup.c
parent0b46e38a09fbccfdfd7bca0f387c66b2c64fa5b6 (diff)
parentf32b4abce98c97ee6e51b7aa8f8fde6e4cab7f28 (diff)
downloadFreeBSD-src-6a288ef517fece2ca5a21d081efd7b4a81da0053.zip
FreeBSD-src-6a288ef517fece2ca5a21d081efd7b4a81da0053.tar.gz
Update Bind to 9.9.3-P2
Notable new features: * Elliptic Curve Digital Signature Algorithm keys and signatures in DNSSEC are now supported per RFC 6605. [RT #21918] * Introduces a new tool "dnssec-verify" that validates a signed zone, checking for the correctness of signatures and NSEC/NSEC3 chains. [RT #23673] * BIND now recognizes the TLSA resource record type, created to support IETF DANE (DNS-based Authentication of Named Entities) [RT #28989] * The new "inline-signing" option, in combination with the "auto-dnssec" option that was introduced in BIND 9.7, allows named to sign zones completely transparently. Approved by: delphij (mentor) MFC after: 3 days Sponsored by: DK Hostmaster A/S
Diffstat (limited to 'contrib/bind9/bin/dig/nslookup.c')
-rw-r--r--contrib/bind9/bin/dig/nslookup.c68
1 files changed, 45 insertions, 23 deletions
diff --git a/contrib/bind9/bin/dig/nslookup.c b/contrib/bind9/bin/dig/nslookup.c
index 2ef8f84..3f5b82f 100644
--- a/contrib/bind9/bin/dig/nslookup.c
+++ b/contrib/bind9/bin/dig/nslookup.c
@@ -15,11 +15,12 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: nslookup.c,v 1.127.38.2 2011/02/28 01:19:58 tbox Exp $ */
+/* $Id: nslookup.c,v 1.130 2011/12/16 23:01:16 each Exp $ */
#include <config.h>
#include <stdlib.h>
+#include <unistd.h>
#include <isc/app.h>
#include <isc/buffer.h>
@@ -45,6 +46,11 @@
#include <dig/dig.h>
+#if defined(HAVE_READLINE)
+#include <readline/readline.h>
+#include <readline/history.h>
+#endif
+
static isc_boolean_t short_form = ISC_TRUE,
tcpmode = ISC_FALSE,
identify = ISC_FALSE, stats = ISC_TRUE,
@@ -53,6 +59,8 @@ static isc_boolean_t short_form = ISC_TRUE,
section_additional = ISC_TRUE, recurse = ISC_TRUE,
aaonly = ISC_FALSE, nofail = ISC_TRUE;
+static isc_boolean_t interactive;
+
static isc_boolean_t in_use = ISC_FALSE;
static char defclass[MXRD] = "IN";
static char deftype[MXRD] = "A";
@@ -715,28 +723,12 @@ addlookup(char *opt) {
}
static void
-get_next_command(void) {
- char *buf;
+do_next_command(char *input) {
char *ptr, *arg;
- char *input;
- fflush(stdout);
- buf = isc_mem_allocate(mctx, COMMSIZE);
- if (buf == NULL)
- fatal("memory allocation failure");
- fputs("> ", stderr);
- fflush(stderr);
- isc_app_block();
- ptr = fgets(buf, COMMSIZE, stdin);
- isc_app_unblock();
- if (ptr == NULL) {
- in_use = ISC_FALSE;
- goto cleanup;
- }
- input = buf;
ptr = next_token(&input, " \t\r\n");
if (ptr == NULL)
- goto cleanup;
+ return;
arg = next_token(&input, " \t\r\n");
if ((strcasecmp(ptr, "set") == 0) &&
(arg != NULL))
@@ -750,20 +742,48 @@ get_next_command(void) {
show_settings(ISC_TRUE, ISC_TRUE);
} else if (strcasecmp(ptr, "exit") == 0) {
in_use = ISC_FALSE;
- goto cleanup;
} else if (strcasecmp(ptr, "help") == 0 ||
strcasecmp(ptr, "?") == 0) {
printf("The '%s' command is not yet implemented.\n", ptr);
- goto cleanup;
} else if (strcasecmp(ptr, "finger") == 0 ||
strcasecmp(ptr, "root") == 0 ||
strcasecmp(ptr, "ls") == 0 ||
strcasecmp(ptr, "view") == 0) {
printf("The '%s' command is not implemented.\n", ptr);
- goto cleanup;
} else
addlookup(ptr);
- cleanup:
+}
+
+static void
+get_next_command(void) {
+ char *buf;
+ char *ptr;
+
+ fflush(stdout);
+ buf = isc_mem_allocate(mctx, COMMSIZE);
+ if (buf == NULL)
+ fatal("memory allocation failure");
+ isc_app_block();
+ if (interactive) {
+#ifdef HAVE_READLINE
+ ptr = readline("> ");
+ add_history(ptr);
+#else
+ fputs("> ", stderr);
+ fflush(stderr);
+ ptr = fgets(buf, COMMSIZE, stdin);
+#endif
+ } else
+ ptr = fgets(buf, COMMSIZE, stdin);
+ isc_app_unblock();
+ if (ptr == NULL) {
+ in_use = ISC_FALSE;
+ } else
+ do_next_command(ptr);
+#ifdef HAVE_READLINE
+ if (interactive)
+ free(ptr);
+#endif
isc_mem_free(mctx, buf);
}
@@ -859,6 +879,8 @@ int
main(int argc, char **argv) {
isc_result_t result;
+ interactive = ISC_TF(isatty(0));
+
ISC_LIST_INIT(lookup_list);
ISC_LIST_INIT(server_list);
ISC_LIST_INIT(search_list);
OpenPOWER on IntegriCloud