From 9b8a758b54ffa703067c23b36b9ca801e8cb8d90 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Wed, 14 May 2008 11:38:29 +0000 Subject: Rebuilding the config-view-file to be more easy to use (and a bit more good looking). git-svn-id: svn://svn.alpinelinux.org/acf/shorewall/trunk@1117 ab2d0c66-481e-0410-8bed-d214d4d58bed --- shorewall-model.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'shorewall-model.lua') diff --git a/shorewall-model.lua b/shorewall-model.lua index 023ceed..92c4640 100644 --- a/shorewall-model.lua +++ b/shorewall-model.lua @@ -49,7 +49,11 @@ local function read_config(file) local output = {} for k,v in pairs(filecontent) do if not string.find ( v, "^[;#].*" ) and not (string.find (v, "^%s*$")) then - table.insert(output, v) + local details = {} + for v in string.gmatch(v, "%S+") do + table.insert(details, v) + end + table.insert(output, details) end end return output @@ -213,8 +217,11 @@ function getconfig() name = "params", label="List of parameters", type="select", - option=read_config("params"), + option={}, }) + for k,v in pairs(read_config("params")) do + table.insert(config.params.option, v[1]) + end config.params.size=#config.params.option + 1 config.interfaces = cfe({ @@ -223,7 +230,6 @@ function getconfig() type="select", option=read_config("interfaces"), }) - config.interfaces.size=#config.interfaces.option + 1 config.zones = cfe({ name = "zones", @@ -231,7 +237,6 @@ function getconfig() type="select", option=read_config("zones"), }) - config.zones.size=#config.zones.option + 1 config.policy = cfe({ name = "policy", @@ -239,7 +244,6 @@ function getconfig() type="select", option=read_config("policy"), }) - config.policy.size=#config.policy.option + 1 config.rules = cfe({ name = "rules", @@ -247,7 +251,6 @@ function getconfig() type="select", option=read_config("rules"), }) - config.rules.size=#config.rules.option + 1 return config -- cgit v1.2.3