]> git.proxmox.com Git - mirror_zfs.git/commitdiff
OpenZFS 8972 - zfs holds: In scripted mode, do not pad columns with spaces
authorAllan Jude <allanjude@freebsd.org>
Wed, 1 Nov 2017 01:41:46 +0000 (21:41 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 19 Jan 2018 17:36:17 +0000 (09:36 -0800)
Authored by: Allan Jude <allanjude@freebsd.org>
Approved by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Melikov <mail@gmelikov.ru>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
OpenZFS-issue: https://www.illumos.org/issues/8972
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/3aace5c077
Closes #7063

cmd/zfs/zfs_main.c

index 26096e11529a3ed7cce0f45f653aa825e3bb8ce6..924a4d4aa6f920f23cc053d46786dbca757b1f54 100644 (file)
@@ -5749,8 +5749,6 @@ print_holds(boolean_t scripted, int nwidth, int tagwidth, nvlist_t *nvl)
                        uint64_t val = 0;
                        time_t time;
                        struct tm t;
-                       char sep = scripted ? '\t' : ' ';
-                       int sepnum = scripted ? 1 : 2;
 
                        (void) nvpair_value_uint64(nvp2, &val);
                        time = (time_t)val;
@@ -5758,8 +5756,13 @@ print_holds(boolean_t scripted, int nwidth, int tagwidth, nvlist_t *nvl)
                        (void) strftime(tsbuf, DATETIME_BUF_LEN,
                            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);
+                       }
                }
        }
 }