From 8214b8f27def51f43d72bc04271b16d1a7b2e0df Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 4 Mar 2014 02:48:26 +0000 Subject: Fix sort by filesize in logfiles/status --- rrdtool-listgraphcfg-html.lsp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'rrdtool-listgraphcfg-html.lsp') diff --git a/rrdtool-listgraphcfg-html.lsp b/rrdtool-listgraphcfg-html.lsp index 0beebc4..db6ef05 100644 --- a/rrdtool-listgraphcfg-html.lsp +++ b/rrdtool-listgraphcfg-html.lsp @@ -3,6 +3,20 @@ htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> +<% +function convertsize(size) + if string.find(size, "k$") then + return tonumber(string.match(size, "[%d.]*")) * 1024.0 + elseif string.find(size, "M$") then + return tonumber(string.match(size, "[%d.]*")) * 1024.0 * 1024.0 + elseif string.find(size, "G$") then + return tonumber(string.match(size, "[%d.]*")) + 1024.0 * 1024.0 * 1024.0 + else + return tonumber(string.match(size, "[%d.]*")) + end +end +%> +