summaryrefslogtreecommitdiff
path: root/scripts/library/README
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-04-25 22:27:19 -0400
committerDan McGee <dan@archlinux.org>2012-06-25 23:39:12 -0500
commitb58489d29a1898a4bff1b5da6ca4bfb14003dbfe (patch)
tree5c42f704cc671136ef43972cfdee1274e620e65f /scripts/library/README
parente183522e3168c4a31103b3c7910fa8d29333fb5a (diff)
scripts/library: add human_to_size
This is a bash wrapper around an awk function that parses human readable sizes and returns their representative values in bytes, as a string. A small test harness is added to validate the functionality. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'scripts/library/README')
-rw-r--r--scripts/library/README8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/library/README b/scripts/library/README
index c71c0714..44748ee2 100644
--- a/scripts/library/README
+++ b/scripts/library/README
@@ -27,3 +27,11 @@ Reccommended Usage:
Returns:
0: parse success
1: parse failure (error message supplied)
+
+human_to_size.sh:
+A function to convert human readable sizes (such as "5.3 GiB") to raw byte
+equivalents. base10 and base2 suffixes are supported, case sensitively. If
+successful, the converted byte value is written to stdout and the function
+returns 0. If an error occurs, nothing in written and the function returns 1.
+Results may be inaccurate when using a broken implementation of awk, such
+as mawk or busybox awk.