xbps_show_pkg_info: print with %zu if humanize_number() fails.
--HG-- extra : convert_revision : 1145081289336f3d76c877b68321f5f76d559a89
This commit is contained in:
parent
d10d9e824c
commit
1282daf008
1 changed files with 9 additions and 3 deletions
12
lib/plist.c
12
lib/plist.c
|
@ -374,6 +374,7 @@ xbps_show_pkg_info(prop_dictionary_t dict)
|
||||||
prop_object_t obj;
|
prop_object_t obj;
|
||||||
const char *sep = NULL;
|
const char *sep = NULL;
|
||||||
char size[64];
|
char size[64];
|
||||||
|
int rv = 0;
|
||||||
|
|
||||||
assert(dict != NULL);
|
assert(dict != NULL);
|
||||||
if (prop_dictionary_count(dict) == 0)
|
if (prop_dictionary_count(dict) == 0)
|
||||||
|
@ -385,10 +386,15 @@ xbps_show_pkg_info(prop_dictionary_t dict)
|
||||||
|
|
||||||
obj = prop_dictionary_get(dict, "installed_size");
|
obj = prop_dictionary_get(dict, "installed_size");
|
||||||
if (obj && prop_object_type(obj) == PROP_TYPE_NUMBER) {
|
if (obj && prop_object_type(obj) == PROP_TYPE_NUMBER) {
|
||||||
humanize_number(size, 5,
|
printf("Installed size: ");
|
||||||
|
rv = humanize_number(size, 5,
|
||||||
(int64_t)prop_number_unsigned_integer_value(obj),
|
(int64_t)prop_number_unsigned_integer_value(obj),
|
||||||
"", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
|
"", HN_AUTOSCALE, HN_NOSPACE);
|
||||||
printf("Installed size: %s\n", size);
|
if (rv == -1)
|
||||||
|
printf("%zu\n",
|
||||||
|
prop_number_unsigned_integer_value(obj));
|
||||||
|
else
|
||||||
|
printf("%s\n", size);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = prop_dictionary_get(dict, "maintainer");
|
obj = prop_dictionary_get(dict, "maintainer");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue