From 276c8f125e11ed0dbd84a4ee3759591b53f5e6c7 Mon Sep 17 00:00:00 2001 From: Izaya Date: Sat, 28 Jul 2018 05:52:37 +1000 Subject: [PATCH] replaced a bunch of different configuration options in the minitel daemon with a single command --- FRequest/OpenOS/etc/rc.d/fserv.lua | 12 ++++++++-- OpenOS/etc/rc.d/minitel.lua | 37 ++++++++++++------------------ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/FRequest/OpenOS/etc/rc.d/fserv.lua b/FRequest/OpenOS/etc/rc.d/fserv.lua index 1f3b8ac..cf1e31a 100644 --- a/FRequest/OpenOS/etc/rc.d/fserv.lua +++ b/FRequest/OpenOS/etc/rc.d/fserv.lua @@ -121,9 +121,17 @@ function stop() end function set(k,v) - if cfg[k] then + if type(cfg[k]) == "string" then cfg[k] = v - print("cfg."..k.." = "..v) + elseif type(cfg[k]) == "number" then + cfg[k] = tonumber(v) + elseif type(cfg[k]) == "boolean" then + if v:lower():sub(1,1) == "t" then + cfg[k] = true + else + cfg[k] = false + end end + print("cfg."..k.." = "..tostring(cfg[k])) writeConfig() end diff --git a/OpenOS/etc/rc.d/minitel.lua b/OpenOS/etc/rc.d/minitel.lua index 7dd2843..60e0728 100644 --- a/OpenOS/etc/rc.d/minitel.lua +++ b/OpenOS/etc/rc.d/minitel.lua @@ -241,29 +241,22 @@ function stop() end end -function debug() - cfg.debug = not cfg.debug -end -function set_retry(sn) - cfg.retry = tonumber(sn) or 30 - print("retry = "..tostring(cfg.retry)) -end -function set_retrycount(sn) - cfg.retrycount = tonumber(sn) or 64 - print("retrycount = "..tostring(cfg.retrycount)) -end -function set_pctime(sn) - cfg.pctime = tonumber(sn) or 30 - print("pctime = "..tostring(cfg.pctime)) -end -function set_rctime(sn) - cfg.rctime = tonumber(sn) or 30 - print("rctime = "..tostring(cfg.rctime)) -end -function set_port(sn) - cfg.port = tonumber(sn) or 4096 - print("port = "..tostring(cfg.port)) +function set(k,v) + if type(cfg[k]) == "string" then + cfg[k] = v + elseif type(cfg[k]) == "number" then + cfg[k] = tonumber(v) + elseif type(cfg[k]) == "boolean" then + if v:lower():sub(1,1) == "t" then + cfg[k] = true + else + cfg[k] = false + end + end + print("cfg."..k.." = "..tostring(cfg[k])) + writeConfig() end + function set_route(to,laddr,raddr) cfg.sroutes[to] = {laddr,raddr,0} end