mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
Dig changes in response to RT321 (output formatting)
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||||
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
# $Id: Makefile.in,v 1.16 2000/09/20 19:05:51 gson Exp $
|
# $Id: Makefile.in,v 1.17 2000/09/29 23:42:11 mws Exp $
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
@@ -25,7 +25,7 @@ top_srcdir = @top_srcdir@
|
|||||||
|
|
||||||
CINCLUDES = -I${srcdir}/include ${DNS_INCLUDES} ${ISC_INCLUDES}
|
CINCLUDES = -I${srcdir}/include ${DNS_INCLUDES} ${ISC_INCLUDES}
|
||||||
|
|
||||||
CDEFINES =
|
CDEFINES = -DVERSION=\"${VERSION}\"
|
||||||
CWARNINGS =
|
CWARNINGS =
|
||||||
|
|
||||||
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_OPENSSL_LIBS@ @DNS_GSSAPI_LIBS@
|
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_OPENSSL_LIBS@ @DNS_GSSAPI_LIBS@
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: dig.c,v 1.105 2000/09/28 23:02:25 mws Exp $ */
|
/* $Id: dig.c,v 1.106 2000/09/29 23:42:12 mws Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -165,6 +165,7 @@ show_usage(void) {
|
|||||||
" +[no]adflag (Set AD flag in query)\n"
|
" +[no]adflag (Set AD flag in query)\n"
|
||||||
" +[no]cdflag (Set CD flag in query)\n"
|
" +[no]cdflag (Set CD flag in query)\n"
|
||||||
" +ndots=### (Set NDOTS value)\n"
|
" +ndots=### (Set NDOTS value)\n"
|
||||||
|
" +[no]cmd (Control display of command line)\n"
|
||||||
" +[no]comments (Control display of comment lines)\n"
|
" +[no]comments (Control display of comment lines)\n"
|
||||||
" +[no]question (Control display of question)\n"
|
" +[no]question (Control display of question)\n"
|
||||||
" +[no]answer (Control display of answer)\n"
|
" +[no]answer (Control display of answer)\n"
|
||||||
@@ -335,6 +336,10 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
|||||||
isc_buffer_t *buf = NULL;
|
isc_buffer_t *buf = NULL;
|
||||||
unsigned int len = OUTPUTBUF;
|
unsigned int len = OUTPUTBUF;
|
||||||
|
|
||||||
|
if (query->lookup->cmdline[0] != 0) {
|
||||||
|
fputs(query->lookup->cmdline, stdout);
|
||||||
|
query->lookup->cmdline[0]=0;
|
||||||
|
}
|
||||||
debug("printmessage(%s)", headers ? "headers" : "noheaders");
|
debug("printmessage(%s)", headers ? "headers" : "noheaders");
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
@@ -352,6 +357,8 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
|||||||
|
|
||||||
if (query->lookup->comments && !short_form) {
|
if (query->lookup->comments && !short_form) {
|
||||||
if (!query->lookup->doing_xfr) {
|
if (!query->lookup->doing_xfr) {
|
||||||
|
if (query->lookup->cmdline[0] != 0)
|
||||||
|
printf ("; %s\n",query->lookup->cmdline);
|
||||||
if (msg == query->lookup->sendmsg)
|
if (msg == query->lookup->sendmsg)
|
||||||
printf(";; Sending:\n");
|
printf(";; Sending:\n");
|
||||||
else
|
else
|
||||||
@@ -505,19 +512,31 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
|||||||
* print the greeting message when the program first starts up.
|
* print the greeting message when the program first starts up.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
printgreeting(int argc, char **argv) {
|
printgreeting(int argc, char **argv, dig_lookup_t *lookup) {
|
||||||
int i = 1;
|
int i;
|
||||||
|
static isc_boolean_t first = ISC_TRUE;
|
||||||
|
char append[MXNAME];
|
||||||
|
|
||||||
if (printcmd) {
|
if (printcmd) {
|
||||||
puts("");
|
snprintf(lookup->cmdline, sizeof(lookup->cmdline),
|
||||||
printf("; <<>> DiG 9.0 <<>>");
|
"%s; <<>> DiG " VERSION " <<>>",
|
||||||
|
first?"\n":"");
|
||||||
|
i = 1;
|
||||||
while (i < argc) {
|
while (i < argc) {
|
||||||
printf(" %s", argv[i++]);
|
snprintf(append, sizeof(append), " %s", argv[i++]);
|
||||||
|
strncat(lookup->cmdline, append,
|
||||||
|
sizeof (lookup->cmdline));
|
||||||
|
}
|
||||||
|
strncat(lookup->cmdline, "\n", sizeof (lookup->cmdline));
|
||||||
|
if (first) {
|
||||||
|
snprintf(append, sizeof (append),
|
||||||
|
";; global options: %s %s\n",
|
||||||
|
short_form ? "short_form" : "",
|
||||||
|
printcmd ? "printcmd" : "");
|
||||||
|
first = ISC_FALSE;
|
||||||
|
strncat(lookup->cmdline, append,
|
||||||
|
sizeof (lookup->cmdline));
|
||||||
}
|
}
|
||||||
puts("");
|
|
||||||
printf(";; global options: %s %s\n",
|
|
||||||
short_form ? "short_form" : "",
|
|
||||||
printcmd ? "printcmd" : "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -989,6 +1008,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
int argc, char **argv) {
|
int argc, char **argv) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_textregion_t tr;
|
isc_textregion_t tr;
|
||||||
|
isc_boolean_t firstarg = ISC_TRUE;
|
||||||
dig_server_t *srv = NULL;
|
dig_server_t *srv = NULL;
|
||||||
dig_lookup_t *lookup = NULL;
|
dig_lookup_t *lookup = NULL;
|
||||||
dns_rdatatype_t rdtype;
|
dns_rdatatype_t rdtype;
|
||||||
@@ -1003,6 +1023,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
char rcfile[132];
|
char rcfile[132];
|
||||||
#endif
|
#endif
|
||||||
char *input;
|
char *input;
|
||||||
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The semantics for parsing the args is a bit complex; if
|
* The semantics for parsing the args is a bit complex; if
|
||||||
@@ -1112,6 +1133,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
if (!config_only) {
|
if (!config_only) {
|
||||||
lookup = clone_lookup(default_lookup,
|
lookup = clone_lookup(default_lookup,
|
||||||
ISC_TRUE);
|
ISC_TRUE);
|
||||||
|
if (firstarg) {
|
||||||
|
printgreeting(argc, argv, lookup);
|
||||||
|
firstarg = ISC_FALSE;
|
||||||
|
}
|
||||||
strncpy(lookup->textname, rv[0], MXNAME-1);
|
strncpy(lookup->textname, rv[0], MXNAME-1);
|
||||||
lookup->trace_root = ISC_TF(lookup->trace ||
|
lookup->trace_root = ISC_TF(lookup->trace ||
|
||||||
lookup->ns_search_only);
|
lookup->ns_search_only);
|
||||||
@@ -1139,9 +1164,13 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
fatal("Couldn't open specified batch file");
|
fatal("Couldn't open specified batch file");
|
||||||
}
|
}
|
||||||
/* XXX Remove code dup from shutdown code */
|
/* XXX Remove code dup from shutdown code */
|
||||||
|
next_line:
|
||||||
if (fgets(batchline, sizeof(batchline), batchfp) != 0) {
|
if (fgets(batchline, sizeof(batchline), batchfp) != 0) {
|
||||||
debug("batch line %s", batchline);
|
|
||||||
bargc = 1;
|
bargc = 1;
|
||||||
|
debug("batch line %s", batchline);
|
||||||
|
if (batchline[0] == '\r' || batchline[0] == '\n'
|
||||||
|
|| batchline[0] == '#' || batchline[0] == ';')
|
||||||
|
goto next_line;
|
||||||
input = batchline;
|
input = batchline;
|
||||||
bargv[bargc] = next_token(&input, " \t\r\n");
|
bargv[bargc] = next_token(&input, " \t\r\n");
|
||||||
while ((bargv[bargc] != NULL) && (bargc < 14)) {
|
while ((bargv[bargc] != NULL) && (bargc < 14)) {
|
||||||
@@ -1168,8 +1197,6 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
lookup->rdtype = dns_rdatatype_ns;
|
lookup->rdtype = dns_rdatatype_ns;
|
||||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||||
}
|
}
|
||||||
if (!config_only)
|
|
||||||
printgreeting(argc, argv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: dighost.c,v 1.137 2000/09/28 23:02:26 mws Exp $ */
|
/* $Id: dighost.c,v 1.138 2000/09/29 23:42:14 mws Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notice to programmers: Do not use this code as an example of how to
|
* Notice to programmers: Do not use this code as an example of how to
|
||||||
@@ -279,6 +279,7 @@ make_empty_lookup(void) {
|
|||||||
__FILE__, __LINE__);
|
__FILE__, __LINE__);
|
||||||
looknew->pending = ISC_TRUE;
|
looknew->pending = ISC_TRUE;
|
||||||
looknew->textname[0]=0;
|
looknew->textname[0]=0;
|
||||||
|
looknew->cmdline[0]=0; /* Not copied in clone_lookup! */
|
||||||
looknew->rdtype=dns_rdatatype_a;
|
looknew->rdtype=dns_rdatatype_a;
|
||||||
looknew->rdclass=dns_rdataclass_in;
|
looknew->rdclass=dns_rdataclass_in;
|
||||||
looknew->sendspace = NULL;
|
looknew->sendspace = NULL;
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: dig.h,v 1.50 2000/09/28 23:02:28 mws Exp $ */
|
/* $Id: dig.h,v 1.51 2000/09/29 23:42:15 mws Exp $ */
|
||||||
|
|
||||||
#ifndef DIG_H
|
#ifndef DIG_H
|
||||||
#define DIG_H
|
#define DIG_H
|
||||||
@@ -97,6 +97,7 @@ struct dig_lookup {
|
|||||||
servfail_stops,
|
servfail_stops,
|
||||||
new_search;
|
new_search;
|
||||||
char textname[MXNAME]; /* Name we're going to be looking up */
|
char textname[MXNAME]; /* Name we're going to be looking up */
|
||||||
|
char cmdline[MXNAME];
|
||||||
dns_rdatatype_t rdtype;
|
dns_rdatatype_t rdtype;
|
||||||
dns_rdataclass_t rdclass;
|
dns_rdataclass_t rdclass;
|
||||||
char namespace[BUFSIZE];
|
char namespace[BUFSIZE];
|
||||||
|
Reference in New Issue
Block a user