From 3e24a1473e8af29ccd94ce855a0bb95200f6ab3b Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 15 May 2008 21:00:31 +0000 Subject: Added validation to syslog expert page. git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1123 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lib/getopts.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/getopts.lua') 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 -- cgit v1.2.3