mirror of https://github.com/dirtbags/moth.git
make wopr work again
This commit is contained in:
parent
fa8e03613a
commit
7f83cabdad
|
@ -1,6 +1,4 @@
|
|||
#! /usr/bin/lua
|
||||
|
||||
require("lfs")
|
||||
#! /bin/env lua
|
||||
|
||||
BASEDIR = "/var/tmp/wopr"
|
||||
POST_MAX = 512
|
||||
|
@ -128,7 +126,7 @@ end
|
|||
--
|
||||
|
||||
function get(key, ...)
|
||||
local fn = string.format("%s/%s", dirname, key)
|
||||
local fn = string.format("%s.%s", dirname, key)
|
||||
local f = io.open(fn)
|
||||
if (not f) then
|
||||
return arg[1]
|
||||
|
@ -140,12 +138,9 @@ function get(key, ...)
|
|||
end
|
||||
|
||||
function set(key, ...)
|
||||
local fn = string.format("%s/%s", dirname, key)
|
||||
local fn = string.format("%s.%s", dirname, key)
|
||||
local f
|
||||
|
||||
-- Lazy mkdir to save a few inodes
|
||||
lfs.mkdir(dirname)
|
||||
|
||||
f = io.open(fn, "w")
|
||||
if not f then
|
||||
error("Unable to write " .. fn)
|
||||
|
@ -155,7 +150,7 @@ function set(key, ...)
|
|||
end
|
||||
|
||||
function del(key)
|
||||
local fn = string.format("%s/%s", dirname, key)
|
||||
local fn = string.format("%s.%s", dirname, key)
|
||||
os.remove(fn)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue