Compare commits
3 Commits
97e559f26f
...
3266c66fc4
Author | SHA1 | Date | |
---|---|---|---|
3266c66fc4 | |||
3fed8a5985 | |||
f132c2349f |
@ -111,4 +111,6 @@ function pkgfs.add(fname,comp) -- string boolean -- -- Add a package as specifie
|
|||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fs.makeDirectory("/pkg")
|
||||||
|
fs.mount("/pkg",pkgfs.component)
|
||||||
return pkgfs
|
return pkgfs
|
||||||
|
@ -68,7 +68,11 @@ function fs.copy(from,to) -- string string -- boolean -- copies a file from *fro
|
|||||||
if not of or not df then
|
if not of or not df then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
df:write(of:read("*a"))
|
local tmp
|
||||||
|
repeat
|
||||||
|
tmp = of:read(2048)
|
||||||
|
df:write(tmp or "")
|
||||||
|
until not tmp
|
||||||
df:close()
|
df:close()
|
||||||
of:close()
|
of:close()
|
||||||
return true
|
return true
|
||||||
|
@ -3,12 +3,14 @@ local serial = require "serialization"
|
|||||||
|
|
||||||
local cfg = {["path"]="/boot/srv/frequest",["port"]=70}
|
local cfg = {["path"]="/boot/srv/frequest",["port"]=70}
|
||||||
|
|
||||||
f=io.open("/boot/cfg/fserv.cfg","rb")
|
local function loadConfig(cfgpath)
|
||||||
if f then
|
local f=io.open(cfgpath or "/boot/cfg/fserv.cfg","rb")
|
||||||
local ncfg = serial.unserialize(f:read("*a"))
|
if f then
|
||||||
f:close()
|
local ncfg = serial.unserialize(f:read("*a"))
|
||||||
for k,v in pairs(ncfg) do
|
f:close()
|
||||||
cfg[k] = v
|
for k,v in pairs(ncfg) do
|
||||||
|
cfg[k] = v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -90,6 +92,15 @@ local function socketHandler(socket)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
while true do
|
local function fileServer()
|
||||||
os.spawn(socketHandler(minitel.listen(70)),"fserv worker process")
|
while true do
|
||||||
|
os.spawn(socketHandler(minitel.listen(70)),"fserv worker process")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function start(cfgpath)
|
||||||
|
loadConfig(cfgpath)
|
||||||
|
return os.spawn(fileServer,"fserv")
|
||||||
|
end
|
||||||
|
|
||||||
|
return {start=start}
|
||||||
|
Loading…
Reference in New Issue
Block a user