diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-01-10 10:17:25 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-01-10 10:17:25 +0000 |
commit | eaa23ecefaef558b30d7c69b2bd900dd70abf589 (patch) | |
tree | 1e635f4eeeb7f91ba432ac904cf3596f19c73873 /syslog-model.lua | |
parent | d20181da4d975c5d8649f65ce7f33baef23907f2 (diff) | |
download | acf-alpine-baselayout-eaa23ecefaef558b30d7c69b2bd900dd70abf589.tar.bz2 acf-alpine-baselayout-eaa23ecefaef558b30d7c69b2bd900dd70abf589.tar.xz |
Another try to figure out how to present data
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@524 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'syslog-model.lua')
-rw-r--r-- | syslog-model.lua | 35 |
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 +--]] |