M(
Size: a a a
M(
M(
V
V
V
to_parse.txt
start 192.168.0.100
end 192.168.0.199
opt lease 7200
opt dns 192.168.0.1
opt router 192.168.0.1
opt subnet 255.255.255.0
static_lease 11:22:33:44:55:66 192.168.0.1
interface br0
max_leases 100
auto_time 7200
lease_file /tmp/wr841n/udhcpd.leases
pidfile /tmp/wr841n/udhcpd.pid
V
test.nim
import strutils
import tables
proc extractConfig(): Table[string, string] =
var lan_ip = ""
var data = initTable[string, string]()
for line in lines("to_parse.txt"):
let splitted = line.splitWhitespace()
if (splitted[0] == "opt") and (splitted[1] == "router"):
lan_ip = splitted[2]
data["lan_ip"] = lan_ip
if (splitted[0] == "static_lease") and (splitted[2] == lan_ip):
data["bssid"] = splitted[1]
return data
echo extractConfig()
M(
M(
V
lan_ip
V
V
nim c -r --gc:arc --opt:size --checks:off --assertions:off --debuginfo:off --stackTrace:off --lineTrace:off test.nim
M(
M(
A
--gc:arc
?M(
M(
M(
nim c -r --gc:arc --opt:size --checks:off --assertions:off --debuginfo:off --stackTrace:off --lineTrace:off test.nim
M(
M(
M(