diff options
author | Karel Zak | 2010-04-15 13:15:35 +0200 |
---|---|---|
committer | Karel Zak | 2010-04-15 13:15:35 +0200 |
commit | 9eb44c28f8b847ffe149fd5725e49d4d22c5a390 (patch) | |
tree | b2151e0965258a1a794f34cf64d22d260f83cf1d /misc-utils/blkid.c | |
parent | libblkid: fix some typos (diff) | |
download | kernel-qcow2-util-linux-9eb44c28f8b847ffe149fd5725e49d4d22c5a390.tar.gz kernel-qcow2-util-linux-9eb44c28f8b847ffe149fd5725e49d4d22c5a390.tar.xz kernel-qcow2-util-linux-9eb44c28f8b847ffe149fd5725e49d4d22c5a390.zip |
blkid: add \n to the "-o udev" output when probe more devices
Old output:
# blkid -p -o udev /dev/sda{1,3}
ID_FS_LABEL=/boot
ID_FS_LABEL_ENC=\x2fboot
ID_FS_UUID=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
ID_FS_UUID_ENC=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
ID_FS_VERSION=1.0
ID_FS_TYPE=ext3
ID_FS_USAGE=filesystem
ID_FS_LABEL=BAR
ID_FS_LABEL_ENC=BAR
ID_FS_UUID=1f2aa318-9c34-462e-8d29-260819ffd657
ID_FS_UUID_ENC=1f2aa318-9c34-462e-8d29-260819ffd657
ID_FS_VERSION=2
ID_FS_TYPE=swap
ID_FS_USAGE=other
new output:
# blkid -p -o udev /dev/sda{1,3}
ID_FS_LABEL=/boot
ID_FS_LABEL_ENC=\x2fboot
ID_FS_UUID=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
ID_FS_UUID_ENC=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
ID_FS_VERSION=1.0
ID_FS_TYPE=ext3
ID_FS_USAGE=filesystem
ID_FS_LABEL=BAR
ID_FS_LABEL_ENC=BAR
ID_FS_UUID=1f2aa318-9c34-462e-8d29-260819ffd657
ID_FS_UUID_ENC=1f2aa318-9c34-462e-8d29-260819ffd657
ID_FS_VERSION=2
ID_FS_TYPE=swap
ID_FS_USAGE=other
Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/blkid.c')
-rw-r--r-- | misc-utils/blkid.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 651deb3d8..08df09e1a 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -424,6 +424,7 @@ static int lowprobe_device(blkid_probe pr, const char *devname, char *show[], int fd; int rc = 0; struct stat st; + static int first = 1; fd = open(devname, O_RDONLY); if (fd < 0) { @@ -493,6 +494,10 @@ static int lowprobe_device(blkid_probe pr, const char *devname, char *show[], nvals = blkid_probe_numof_values(pr); + if (nvals && !first && output & OUTPUT_UDEV_LIST) + /* add extra line between output from devices */ + fputc('\n', stdout); + if (output & OUTPUT_DEVICE_ONLY) { printf("%s\n", devname); goto done; @@ -507,6 +512,8 @@ static int lowprobe_device(blkid_probe pr, const char *devname, char *show[], print_value(output, num++, devname, (char *) data, name, len); } + if (first) + first = 0; if (nvals >= 1 && !(output & (OUTPUT_VALUE_ONLY | OUTPUT_UDEV_LIST))) printf("\n"); done: |