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