summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-05-15 21:00:31 +0000
committerTed Trask <ttrask01@yahoo.com>2008-05-15 21:00:31 +0000
commit3e24a1473e8af29ccd94ce855a0bb95200f6ab3b (patch)
tree09330adaa3c523e8786020c357eb7fc7160688da
parent846a69204d0d2e54638f8e08a3052b2316827cab (diff)
downloadacf-core-3e24a1473e8af29ccd94ce855a0bb95200f6ab3b.tar.bz2
acf-core-3e24a1473e8af29ccd94ce855a0bb95200f6ab3b.tar.xz
Added validation to syslog expert page.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1123 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--lib/getopts.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/getopts.lua b/lib/getopts.lua
index 0970e20..ee6a3c8 100644
--- a/lib/getopts.lua
+++ b/lib/getopts.lua
@@ -141,8 +141,14 @@ end
-- If filter is defined (and table is true), only list option matching filter
function getoptsfromfile (file, search_section, search_name, to_table, filter)
local opts = nil
- if not (fs.is_file(file)) then return nil end
- local conf_file = fs.read_file_as_array ( file )
+ local conf_file = {}
+ if (fs.is_file(file)) then
+ conf_file = fs.read_file_as_array ( file )
+ else
+ for line in string.gmatch(file, "(.*)\n") do
+ conf_file[#conf_file + 1] = line
+ end
+ end
local section = ""
local skip_lines = 0
for i,l in ipairs(conf_file) do