aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Jaspert <joerg@debian.org>2009-08-16 13:10:39 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2009-08-16 13:10:39 +0200
commit7ad474bcbc8554dfba32c641dc8969239dcff7da (patch)
tree0a271da5cbd2e14c8ae4ebd0fa47f1a0ae402fab
parentf8eb93a656d66b0195d35de4673253229f4df30e (diff)
downloadvicious-legacy-7ad474bcbc8554dfba32c641dc8969239dcff7da.tar.xz
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)
-rw-r--r--fs.lua4
1 files changed, 2 insertions, 2 deletions
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