Author: mav
Date: Mon Jan 22 06:00:45 2018
New Revision: 328256
URL: https://svnweb.freebsd.org/changeset/base/328256

Log:
  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 <mahr...@delphix.com>
  Approved by: Dan McDonald <dan...@joyent.com>
  Author: Allan Jude <allanj...@freebsd.org>

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c    Mon Jan 22 05:59:48 
2018        (r328255)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c    Mon Jan 22 06:00:45 
2018        (r328256)
@@ -5636,8 +5636,6 @@ print_holds(boolean_t scripted, boolean_t literal, siz
                        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, siz
                                    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);
+                       }
                }
        }
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to