# -------------- # get_bytes_text # -------------- # This subroutine returns the text presentation of a byte value, i.e. "15 MB", used in view pages in config. subroutine(get_bytes_text(string bytes_value), ( bool option_value_match = matches_regular_expression(bytes_value, "([0-9]*)( ?)([a-zA-Z]*)"); int number_value = $1; string unit_value = lowercase($3); string option_value; if (starts_with(unit_value, "k")) then ( option_value = number_value . " KB"; ) else if (starts_with(unit_value, "m")) then ( option_value = number_value . " MB"; ) else if (starts_with(unit_value, "g")) then ( option_value = number_value . " GB"; ) else if (starts_with(unit_value, "t")) then ( option_value = number_value . " TB"; ) else ( option_value = number_value . " bytes"; ); option_value; ));