[parted-devel] Printing partition type in --machine output

Alberto Planas Dominguez aplanas at suse.com
Thu Sep 27 13:50:03 BST 2018


Hi, I would like to include this in parted, as printing the partition
type in machine readable output can be a relevant feature.

This will make the normal and the machine readable format more similar
too.


Index: parted-3.2/parted/parted.c
===================================================================
--- parted-3.2.orig/parted/parted.c
+++ parted-3.2/parted/parted.c
@@ -1381,6 +1381,11 @@ do_print (PedDevice** dev, PedDisk** dis
 
                 if (!(part->type & PED_PARTITION_FREESPACE)) {
 
+                    if (has_extended)
+                        printf ("%s:", ped_partition_type_get_name
(part->type));
+                    else
+                        putchar (':');
+
                     if (part->fs_type)
                         printf ("%s:", part->fs_type->name);
                     else




More information about the parted-devel mailing list