From 7ad474bcbc8554dfba32c641dc8969239dcff7da Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Sun, 16 Aug 2009 13:10:39 +0200 Subject: Use of LANG=C and improved matching in fs.lua. - Prepend LANG=C to the df call, so it always gets the information in a way it understands. Other languages do have other namings for "Filesystem" and some use , instead of . for the number seperator. - Adapt the line.match line so it actually matches values. (Have the - last in the first match and teach it that mount targets can also have dots and colons in it) --- fs.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs.lua') diff --git a/fs.lua b/fs.lua index afefab3..0b6fbd9 100644 --- a/fs.lua +++ b/fs.lua @@ -16,7 +16,7 @@ module("vicious.fs") -- {{{ Filesystem widget type local function worker(format) -- Get data from df - local f = io.popen("df -hP") + local f = io.popen("LANG=C df -hP") local fs_info = {} -- Format data @@ -26,7 +26,7 @@ local function worker(format) -- table for each mount point with gmatch local size, used, avail, usep, mount = -- Instead match all at once, including network file systems - line:match("^[%w/-:%.]+[%s]+([%d%.]+)[%a]?[%s]+([%d%.]+)[%a]?[%s]+([%d%.]+)[%a]?[%s]+([%d]+)%%[%s]+([-/%w]+)$") + line:match('^[/%w:%.-]+[%s]+([%d%.]+)[%a]?[%s]+([%d%.]+)[%a]?[%s]+([%d%.]+)[%a]?[%s]+([%d]+)%%[%s]+([/%w:%.-]+)$') fs_info["{"..mount.." size}"] = size fs_info["{"..mount.." used}"] = used -- cgit v1.2.3