diff options
author | Alexander Motin <mav@FreeBSD.org> | 2018-01-22 06:00:45 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2018-01-22 06:00:45 +0000 |
commit | 0d6993dfd3bcdcab7db8839a2c7b328781953cae (patch) | |
tree | f19ef51c3646c4d1504406e1e79c903902ed2684 /cddl/contrib/opensolaris/cmd | |
parent | 1dbc0fc3528e63065498ff17cb4dd76efba3a506 (diff) | |
parent | d0fd40e7c98d56b2327af13ed197bcd51b514c12 (diff) | |
download | src-0d6993dfd3bcdcab7db8839a2c7b328781953cae.tar.gz src-0d6993dfd3bcdcab7db8839a2c7b328781953cae.zip |
MFV r328255: 8972 zfs holds: In scripted mode, do not pad columns with spaces
illumos/illumos-gate@e9b7d6e7f7a6477679a35b73eb3934b096b3dd39
https://www.illumos.org/issues/8972:
'zfs holds -H' does not properly output content in scripted mode. It uses a
tab instead of two spaces, but it still pads column widths with spaces when
it should not.
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Allan Jude <allanjude@freebsd.org>
Notes
Notes:
svn path=/head/; revision=328256
Diffstat (limited to 'cddl/contrib/opensolaris/cmd')
-rw-r--r-- | cddl/contrib/opensolaris/cmd/zfs/zfs_main.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c index 80e5163976cc..be4df07abfd1 100644 --- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c +++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c @@ -5636,8 +5636,6 @@ print_holds(boolean_t scripted, boolean_t literal, size_t nwidth, uint64_t val = 0; time_t time; struct tm t; - char sep = scripted ? '\t' : ' '; - size_t sepnum = scripted ? 1 : 2; (void) nvpair_value_uint64(nvp2, &val); if (literal) @@ -5649,8 +5647,13 @@ print_holds(boolean_t scripted, boolean_t literal, size_t nwidth, gettext(STRFTIME_FMT_STR), &t); } - (void) printf("%-*s%*c%-*s%*c%s\n", nwidth, zname, - sepnum, sep, tagwidth, tagname, sepnum, sep, tsbuf); + if (scripted) { + (void) printf("%s\t%s\t%s\n", zname, + tagname, tsbuf); + } else { + (void) printf("%-*s %-*s %s\n", nwidth, + zname, tagwidth, tagname, tsbuf); + } } } } |