From dcd234ea278357f2ab71f20326ba37d89a5335c1 Mon Sep 17 00:00:00 2001 From: Jakob Gruber Date: Mon, 21 Feb 2011 14:21:40 +0100 Subject: --print-format displays size in bytes Printing the exact size seems to make more sense for scripting contexts. Signed-off-by: Jakob Gruber [Dan: adjust for master before VerbosePkgLists patches, fix type] Signed-off-by: Dan McGee --- src/pacman/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pacman') diff --git a/src/pacman/util.c b/src/pacman/util.c index 9d50afb2..2d4ccf37 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -28,6 +28,7 @@ #include #include #include +#include /* intmax_t */ #include #include #include @@ -642,8 +643,7 @@ void print_packages(const alpm_list_t *packages) /* %s : size */ if(strstr(temp,"%s")) { char *size; - double mbsize = (double)pkg_get_size(pkg) / (1024.0 * 1024.0); - pm_asprintf(&size, "%.2f", mbsize); + pm_asprintf(&size, "%jd", (intmax_t)pkg_get_size(pkg)); string = strreplace(temp, "%s", size); free(size); free(temp); -- cgit v1.2.3-70-g09d2