]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: print table header as bold
authorKarel Zak <kzak@redhat.com>
Thu, 3 Apr 2014 10:43:36 +0000 (12:43 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 3 Apr 2014 10:43:36 +0000 (12:43 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/fdisk.c

index 14f2590cfc236034c4e571f14c8752046c4a06a8..2283c414276692b9765ad8b198a03b270f101a6a 100644 (file)
@@ -574,8 +574,20 @@ void list_disklabel(struct fdisk_context *cxt)
                return;
        if (fdisk_table_to_string(tb, cxt, NULL, 0, &str) == 0) {
                fputc('\n', stdout);
-               if (str && *str)
-                       fputs(str, stdout);
+               if (str) {
+                       char *p = str;
+                       char *next = strchr(str, '\n');
+                       if (next && colors_wanted()) {
+                               *next = '\0';
+                               color_enable(UL_COLOR_BOLD);
+                               fputs(p, stdout);
+                               color_disable();
+                               fputc('\n', stdout);
+                               p = ++next;
+                       }
+                       fputs(p, stdout);
+                       free(str);
+               }
        }
        fdisk_unref_table(tb);
 }