xbps_show_pkg_info: print with %zu if humanize_number() fails.

--HG--
extra : convert_revision : 1145081289336f3d76c877b68321f5f76d559a89
This commit is contained in:
Juan RP 2008-12-22 07:29:27 +01:00
parent d10d9e824c
commit 1282daf008
1 changed files with 9 additions and 3 deletions

View File

@ -374,6 +374,7 @@ xbps_show_pkg_info(prop_dictionary_t dict)
prop_object_t obj;
const char *sep = NULL;
char size[64];
int rv = 0;
assert(dict != NULL);
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");
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),
"", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
printf("Installed size: %s\n", size);
"", HN_AUTOSCALE, HN_NOSPACE);
if (rv == -1)
printf("%zu\n",
prop_number_unsigned_integer_value(obj));
else
printf("%s\n", size);
}
obj = prop_dictionary_get(dict, "maintainer");