2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +00:00

1298. [func] dig: now supports +[no]cl +[no]ttlid.

This commit is contained in:
Mark Andrews
2002-05-22 04:58:30 +00:00
parent b9efcf0a37
commit e7bb307667
3 changed files with 56 additions and 9 deletions

View File

@@ -1,3 +1,5 @@
1298. [func] dig: now supports +[no]cl +[no]ttlid.
1297. [func] You can now create your own customised printing 1297. [func] You can now create your own customised printing
styles: dns_master_stylecreate() and styles: dns_master_stylecreate() and
dns_master_styledestroy(). dns_master_styledestroy().

View File

@@ -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.176 2001/12/19 12:16:38 marka Exp $ */ /* $Id: dig.c,v 1.177 2002/05/22 04:58:29 marka Exp $ */
#include <config.h> #include <config.h>
#include <stdlib.h> #include <stdlib.h>
@@ -85,7 +85,7 @@ static char domainopt[DNS_NAME_MAXTEXT];
static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE, static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE,
nibble = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE, nibble = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE,
multiline = ISC_FALSE; multiline = ISC_FALSE, nottl = ISC_FALSE, noclass = ISC_FALSE;
static const char *opcodetext[] = { static const char *opcodetext[] = {
"QUERY", "QUERY",
@@ -186,6 +186,7 @@ help(void) {
" +[no]aaonly (Set AA flag in query)\n" " +[no]aaonly (Set AA flag in query)\n"
" +[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"
" +[no]cl (Control display of class in records)\n"
" +[no]cmd (Control display of command line)\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"
@@ -195,6 +196,7 @@ help(void) {
" +[no]stats (Control display of statistics)\n" " +[no]stats (Control display of statistics)\n"
" +[no]short (Disable everything except short\n" " +[no]short (Disable everything except short\n"
" form of answer)\n" " form of answer)\n"
" +[no]ttlid (Control display of ttls in records)\n"
" +[no]all (Set or clear all display flags)\n" " +[no]all (Set or clear all display flags)\n"
" +[no]qr (Print question before sending)\n" " +[no]qr (Print question before sending)\n"
" +[no]nssearch (Search all authoritative nameservers)\n" " +[no]nssearch (Search all authoritative nameservers)\n"
@@ -356,12 +358,33 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
dns_messagetextflag_t flags; dns_messagetextflag_t flags;
isc_buffer_t *buf = NULL; isc_buffer_t *buf = NULL;
unsigned int len = OUTPUTBUF; unsigned int len = OUTPUTBUF;
const dns_master_style_t *style; dns_master_style_t *style = NULL;
unsigned int styleflags = 0;
if (multiline) styleflags |= DNS_STYLEFLAG_REL_OWNER;
style = &dns_master_style_default; if (nottl)
else styleflags |= DNS_STYLEFLAG_NO_TTL;
style = &dns_master_style_debug; if (noclass)
styleflags |= DNS_STYLEFLAG_NO_CLASS;
if (multiline) {
styleflags |= DNS_STYLEFLAG_OMIT_OWNER;
styleflags |= DNS_STYLEFLAG_OMIT_CLASS;
styleflags |= DNS_STYLEFLAG_REL_DATA;
styleflags |= DNS_STYLEFLAG_OMIT_TTL;
styleflags |= DNS_STYLEFLAG_TTL;
styleflags |= DNS_STYLEFLAG_MULTILINE;
styleflags |= DNS_STYLEFLAG_COMMENT;
}
if (multiline || (nottl && noclass))
result = dns_master_stylecreate(&style, styleflags,
24, 24, 24, 32, 80, 8, mctx);
else if (nottl || noclass)
result = dns_master_stylecreate(&style, styleflags,
24, 24, 32, 40, 80, 8, mctx);
else
result = dns_master_stylecreate(&style, styleflags,
24, 32, 40, 48, 80, 8, mctx);
check_result(result, "dns_master_stylecreate");
if (query->lookup->cmdline[0] != 0) { if (query->lookup->cmdline[0] != 0) {
if (!short_form) if (!short_form)
@@ -438,7 +461,7 @@ buftoosmall:
if (result == ISC_R_SUCCESS) if (result == ISC_R_SUCCESS)
goto repopulate_buffer; goto repopulate_buffer;
else else
return (result); goto cleanup;
} }
check_result(result, check_result(result,
"dns_message_pseudosectiontotext"); "dns_message_pseudosectiontotext");
@@ -516,6 +539,10 @@ buftoosmall:
printf("%.*s", (int)isc_buffer_usedlength(buf), printf("%.*s", (int)isc_buffer_usedlength(buf),
(char *)isc_buffer_base(buf)); (char *)isc_buffer_base(buf));
isc_buffer_free(&buf); isc_buffer_free(&buf);
cleanup:
if (style != NULL)
dns_master_styledestroy(&style, mctx);
return (result); return (result);
} }
@@ -719,6 +746,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
FULLCHECK("cdflag"); FULLCHECK("cdflag");
lookup->cdflag = state; lookup->cdflag = state;
break; break;
case 'l': /* cl */
FULLCHECK("cl");
noclass = !state;
break;
case 'm': /* cmd */ case 'm': /* cmd */
FULLCHECK("cmd"); FULLCHECK("cmd");
printcmd = state; printcmd = state;
@@ -924,6 +955,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
goto invalid_option; goto invalid_option;
} }
break; break;
case 't': /* ttlid */
FULLCHECK("ttlid");
nottl = !state;
break;
default: default:
goto invalid_option; goto invalid_option;
} }

View File

@@ -16,7 +16,7 @@
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--> -->
<!-- $Id: dig.docbook,v 1.10 2001/11/14 06:34:24 marka Exp $ --> <!-- $Id: dig.docbook,v 1.11 2002/05/22 04:58:30 marka Exp $ -->
<refentry> <refentry>
@@ -315,6 +315,16 @@ Set [do not set] the CD (checking disabled) bit in the query. This
requests the server to not perform DNSSEC validation of responses. requests the server to not perform DNSSEC validation of responses.
</para></listitem></varlistentry> </para></listitem></varlistentry>
<varlistentry><term><option>+[no]cl</option></term>
<listitem><para>
Display [do not display] the CLASS when printing the record.
</para></listitem></varlistentry>
<varlistentry><term><option>+[no]ttlid</option></term>
<listitem><para>
Display [do not display] the TTL when printing the record.
</para></listitem></varlistentry>
<varlistentry><term><option>+[no]recursive</option></term> <varlistentry><term><option>+[no]recursive</option></term>
<listitem><para> <listitem><para>
Toggle the setting of the RD (recursion desired) bit in the query. Toggle the setting of the RD (recursion desired) bit in the query.