From b1bb2eaa50e436e2221a1aec9749de58e4234b44 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sun, 6 May 2012 19:47:47 -0400 Subject: paccache: adopt size_to_human Signed-off-by: Dave Reisner --- contrib/paccache.sh.in | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'contrib/paccache.sh.in') diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in index ded42ed5..e8136559 100644 --- a/contrib/paccache.sh.in +++ b/contrib/paccache.sh.in @@ -108,26 +108,7 @@ pkgfilter() { }' "${@:3}" } -size_to_human() { - awk -v size="$1" ' - BEGIN { - suffix[1] = "B" - suffix[2] = "KiB" - suffix[3] = "MiB" - suffix[4] = "GiB" - suffix[5] = "TiB" - count = 1 - - while (size > 1024) { - size /= 1024 - count++ - } - - sizestr = sprintf("%.2f", size) - sub(/\.?0+$/, "", sizestr) - printf("%s %s", sizestr, suffix[count]) - }' -} +m4_include(../scripts/library/size_to_human.sh) runcmd() { if (( needsroot && EUID != 0 )); then -- cgit v1.2.3-70-g09d2