2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

[master] dig +ttlunits

3829.	[func]		"dig +ttlunits" causes dig to print TTL values
			with time-unit suffixes: w, d, h, m, s for
			weeks, days, hours, minutes, and seconds. (Thanks
			to Tony Finch.) [RT #35823]
This commit is contained in:
Evan Hunt
2014-04-29 16:58:36 -07:00
parent f6ea2b1d09
commit cd750f6e74
8 changed files with 75 additions and 14 deletions

View File

@@ -69,7 +69,7 @@ static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE,
ip6_int = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE,
multiline = ISC_FALSE, nottl = ISC_FALSE, noclass = ISC_FALSE,
onesoa = ISC_FALSE, rrcomments = ISC_FALSE, use_usec = ISC_FALSE,
nocrypto = ISC_FALSE;
nocrypto = ISC_FALSE, ttlunits = ISC_FALSE;
static isc_uint32_t splitwidth = 0xffffffff;
/*% opcode text */
@@ -218,6 +218,7 @@ help(void) {
" +[no]short (Disable everything except short\n"
" form of answer)\n"
" +[no]ttlid (Control display of ttls in records)\n"
" +[no]ttlunits (Display TTLs in human-readable units)\n"
" +[no]all (Set or clear all display flags)\n"
" +[no]qr (Print question before sending)\n"
" +[no]nssearch (Search all authoritative nameservers)\n"
@@ -424,6 +425,8 @@ printrdataset(dns_name_t *owner_name, dns_rdataset_t *rdataset,
return(ISC_FALSE);
styleflags |= DNS_STYLEFLAG_REL_OWNER;
if (ttlunits)
styleflags |= DNS_STYLEFLAG_TTL_UNITS;
if (nottl)
styleflags |= DNS_STYLEFLAG_NO_TTL;
if (noclass)
@@ -483,6 +486,8 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
styleflags |= DNS_STYLEFLAG_COMMENT;
if (rrcomments)
styleflags |= DNS_STYLEFLAG_RRCOMMENT;
if (ttlunits)
styleflags |= DNS_STYLEFLAG_TTL_UNITS;
if (nottl)
styleflags |= DNS_STYLEFLAG_NO_TTL;
if (noclass)
@@ -1297,9 +1302,18 @@ plus_option(char *option, isc_boolean_t is_batchfile,
goto invalid_option;
}
break;
case 't': /* ttlid */
FULLCHECK("ttlid");
nottl = ISC_TF(!state);
case 't':
switch (cmd[3]) {
case 'i': /* ttlid */
FULLCHECK("ttlid");
nottl = ISC_TF(!state);
break;
case 'u': /* ttlunits */
FULLCHECK("ttlunits");
nottl = ISC_FALSE;
ttlunits = ISC_TF(state);
break;
}
break;
default:
goto invalid_option;