printf("ID_FS_%s=%s\n", name, value);
}
-static void print_value(int output, int num, blkid_dev dev,
+static void print_value(int output, int num, const char *devname,
const char *value, const char *name, size_t valsz)
{
if (output & OUTPUT_VALUE_ONLY) {
print_udev_format(name, value, valsz);
} else {
- if (num == 1 && dev)
- printf("%s: ", blkid_dev_devname(dev));
+ if (num == 1 && devname)
+ printf("%s: ", devname);
fputs(name, stdout);
fputs("=\"", stdout);
safe_print(value, valsz);
static void print_tags(blkid_dev dev, char *show[], int numtag, int output)
{
blkid_tag_iterate iter;
- const char *type, *value;
+ const char *type, *value, *devname;
int i, num = 1;
if (!dev)
return;
}
+ devname = blkid_dev_devname(dev);
+
if (output & OUTPUT_DEVICE_ONLY) {
- printf("%s\n", blkid_dev_devname(dev));
+ printf("%s\n", devname);
return;
}
if (i >= numtag)
continue;
}
- print_value(output, num++, dev, value, type, strlen(value));
+ print_value(output, num++, devname, value, type, strlen(value));
}
blkid_tag_iterate_end(iter);
- if (num > 1 && !(output & OUTPUT_VALUE_ONLY))
+ if (num > 1 && !(output & (OUTPUT_VALUE_ONLY | OUTPUT_UDEV_LIST)))
printf("\n");
}
continue;
len = strnlen((char *) data, len);
- print_value(output, n + 1, NULL, (char *) data, name, len);
+ print_value(output, n + 1, devname, (char *) data, name, len);
}
+ if (nvals > 1 && !(output & (OUTPUT_VALUE_ONLY | OUTPUT_UDEV_LIST)))
+ printf("\n");
done:
if (rc == -2)
fprintf(stderr, "%s: ambivalent result "