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

@@ -79,6 +79,13 @@ ttlfmt(unsigned int t, const char *s, isc_boolean_t verbose,
*/
isc_result_t
dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, isc_buffer_t *target) {
return (dns_ttl_totext2(src, verbose, ISC_TRUE, target));
}
isc_result_t
dns_ttl_totext2(isc_uint32_t src, isc_boolean_t verbose,
isc_boolean_t upcase, isc_buffer_t *target)
{
unsigned secs, mins, hours, days, weeks, x;
secs = src % 60; src /= 60;
@@ -116,7 +123,7 @@ dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, isc_buffer_t *target) {
* in upper case. (Why? Because BIND 8 does that.
* Presumably it has a reason.)
*/
if (x == 1 && !verbose) {
if (x == 1 && upcase && !verbose) {
isc_region_t region;
/*
* The unit letter is the last character in the