summaryrefslogtreecommitdiffstats
path: root/www/cgi-bin
diff options
context:
space:
mode:
Diffstat (limited to 'www/cgi-bin')
-rwxr-xr-xwww/cgi-bin/cli5
-rw-r--r--www/cgi-bin/mvc.lua9
2 files changed, 7 insertions, 7 deletions
diff --git a/www/cgi-bin/cli b/www/cgi-bin/cli
index 9e8ce02..1221481 100755
--- a/www/cgi-bin/cli
+++ b/www/cgi-bin/cli
@@ -18,8 +18,11 @@ Output will be a serialized Lua table.
return
end
+require("posix")
local PATH = package.path
-package.path = "/usr/share/acf/www/cgi-bin/?.lua;" .. package.path
+local p = posix.dirname(arg[0])
+if p:sub(1,1) ~= "/" then p = posix.getcwd().."/"..p end
+package.path = p.."/?.lua;" .. package.path
require("mvc")
package.path = PATH
diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua
index c7afdcd..db29bda 100644
--- a/www/cgi-bin/mvc.lua
+++ b/www/cgi-bin/mvc.lua
@@ -242,13 +242,10 @@ read_config = function( self, appname )
local file = io.open (filename)
if (file) then
self.conf.confdir = posix.dirname(filename) .. "/"
+ self.conf.conffile = filename
for line in file:lines() do
- key, value = string.match(line, "([^[=]*)=[ \t]*(.*)")
- if key then -- ugly way of finding blank spots between key and =
- repeat
- local space = string.find ( key, "%s", -1)
- if space then key=string.sub(key,1,space-1) end
- until space == nil
+ key, value = string.match(line, "^%s*([^[=%s#]*)%s*=%s*(.*)")
+ if key then
self.conf[key] = value
end
end