summaryrefslogtreecommitdiffhomepage
path: root/subr/rtl_complex.subr
diff options
context:
space:
mode:
Diffstat (limited to 'subr/rtl_complex.subr')
-rw-r--r--subr/rtl_complex.subr7
1 files changed, 7 insertions, 0 deletions
diff --git a/subr/rtl_complex.subr b/subr/rtl_complex.subr
index cb7c90bd..63175bed 100644
--- a/subr/rtl_complex.subr
+++ b/subr/rtl_complex.subr
@@ -192,6 +192,13 @@ rtl_kill_tree() {
fi;
};
+rtl_percentage() {
+ local _in="${1}" _max="${2}" _perc;
+ _perc="$((100 * ${_in} + ${_max} / 2))";
+ _perc="$((${_perc} ? ${_perc} / ${_max} : ${_perc}))";
+ printf "%d\n" "${_perc}";
+};
+
rtl_prompt() {
local _fmt="${1}" _choice=""; shift;
printf "${_fmt}? (y|N) " "${@}";