summaryrefslogtreecommitdiffstats
path: root/syslog-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'syslog-model.lua')
-rw-r--r--syslog-model.lua35
1 files changed, 26 insertions, 9 deletions
diff --git a/syslog-model.lua b/syslog-model.lua
index 59747d1..ac37572 100644
--- a/syslog-model.lua
+++ b/syslog-model.lua
@@ -25,23 +25,34 @@ local is_running = function( process )
return statusreport
end
--- ################################################################################
--- EXPERIMENTAL LOCAL FUNCTIONS
-
local function readopts(optname)
local opts = {}
local line
local f = io.open("/etc/conf.d/syslog", "r")
- if f == nil then
+ if (f == nil) then
return nil
end
for line in f:lines() do
- local optstr = string.match(line, "^" .. optname .. "=\"?(.*)\"?")
+ local optstr = string.match(line, "^" .. optname .. "=\"?(.*)%\"+")
if optstr then
- local t = {}
- for k, v in string.gmatch(optstr, "(%C*)") do
--- for k, v in string.gmatch(optstr, "(-%S+)%s+(%S+)") do
- opts[k] = optstr
+ local option = ""
+ local optvalue = ""
+ opts["org"]=optstr
+ for j = 1, string.len(optstr) do
+ if (string.sub(optstr, j, j) == "-") then
+ option=string.sub(optstr, j, j+1)
+ for k = j+1, string.len(optstr) do
+ if (string.sub(optstr, k, k) == "-") then
+ opts[option] = string.match(string.sub(optstr, j+2, k-1),"^%s*(.*)%s?")
+ break
+ end
+ if (k == string.len(optstr)) then
+ opts[option] = string.match(string.sub(optstr, j+2, k),"^%s*(.*)%s?")
+ break
+ end
+
+ end
+ end
end
end
end
@@ -49,6 +60,10 @@ local function readopts(optname)
end
-- ################################################################################
+-- EXPERIMENTAL LOCAL FUNCTIONS
+
+
+-- ################################################################################
-- PUBLIC FUNCTIONS
function getstatus()
@@ -120,6 +135,7 @@ function priv.enable(opts)
end
--]]
+--[[
-- this func does not need privileges
local function readopts()
local opts = {}
@@ -137,3 +153,4 @@ local function readopts()
end
return opts
end
+--]]