summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci/model
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-03-24 21:50:48 +0000
committerSteven Barth <steven@midlink.org>2008-03-24 21:50:48 +0000
commit9fa7e0e92ddae9ff68f50ad20bbdfc8a3c09135a (patch)
treef1d316abaaced25c6d8476e65ad6d50f57013768 /src/ffluci/model
parent8e7ed0e8a752bc3f551aabcf2a20807b64e707ed (diff)
* CBI: updates
* UCI: fixed argument escaping
Diffstat (limited to 'src/ffluci/model')
-rw-r--r--src/ffluci/model/uci.lua25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/ffluci/model/uci.lua b/src/ffluci/model/uci.lua
index 5faffe5486..2d6702b577 100644
--- a/src/ffluci/model/uci.lua
+++ b/src/ffluci/model/uci.lua
@@ -79,6 +79,16 @@ function commit(...)
end
+-- Wrapper for "uci del"
+function Session.del(self, config, section, option)
+ return self:_uci2("del " .. _path(config, section, option))
+end
+
+function del(...)
+ return default:del(...)
+end
+
+
-- Wrapper for "uci get"
function Session.get(self, config, section, option)
return self:_uci("get " .. _path(config, section, option))
@@ -173,12 +183,15 @@ function _path(...)
-- Not using ipairs because it is not reliable in case of nil arguments
arg.n = nil
for k,v in pairs(arg) do
- if k == 1 then
- result = "'" .. v:gsub("['.]", "") .. "'"
- elseif k < 4 then
- result = result .. ".'" .. v:gsub("['.]", "") .. "'"
- elseif k == 4 then
- result = result .. "='" .. v:gsub("'", "") .. "'"
+ if v then
+ v = tostring(v)
+ if k == 1 then
+ result = "'" .. v:gsub("['.]", "") .. "'"
+ elseif k < 4 then
+ result = result .. ".'" .. v:gsub("['.]", "") .. "'"
+ elseif k == 4 then
+ result = result .. "='" .. v:gsub("'", "") .. "'"
+ end
end
end
return result