summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci/sys.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-03-28 22:55:27 +0000
committerSteven Barth <steven@midlink.org>2008-03-28 22:55:27 +0000
commitbd32a8aac5de9beb321b3cdfe180a8798c5a3379 (patch)
treea0b5e2926066e23c7356122a8afeb0ed0ef0e505 /src/ffluci/sys.lua
parentfb2a9a328d619ecf329e64cb500ff1385e3f8290 (diff)
* CBI: improvements, bug fixes
* admin: Introduced wifi, olsr, password pages
Diffstat (limited to 'src/ffluci/sys.lua')
-rw-r--r--src/ffluci/sys.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ffluci/sys.lua b/src/ffluci/sys.lua
index 048f6d3751..4ed2262c8b 100644
--- a/src/ffluci/sys.lua
+++ b/src/ffluci/sys.lua
@@ -29,11 +29,20 @@ require("ffluci.fs")
-- Returns the hostname
function hostname()
- return ffluci.fs.readfilel("/proc/sys/kernel/hostname")[1]
+ return io.lines("/proc/sys/kernel/hostname")()
end
-- Returns the load average
function loadavg()
- local loadavg = ffluci.fs.readfilel("/proc/loadavg")[1]
+ local loadavg = io.lines("/proc/loadavg")()
return loadavg:match("^(.-) (.-) (.-) (.-) (.-)$")
+end
+
+-- Returns all available network interfaces
+function net_devices()
+ local devices = {}
+ for line in io.lines("/proc/net/dev") do
+ table.insert(devices, line:match(" *(.-):"))
+ end
+ return devices
end \ No newline at end of file