File: 102-getlookup-getsearch.lua

package info (click to toggle)
lua-cqueues 20161214-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,672 kB
  • ctags: 3,228
  • sloc: ansic: 20,232; sh: 2,959; makefile: 24
file content (27 lines) | stat: -rwxr-xr-x 475 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
_=[[
	. "${0%%/*}/regress.sh"
	exec runlua "$0" "$@"
]]
require"regress".export".*"

local config = require"cqueues.dns.config"
local txt = io.tmpfile()

assert(txt:write([[
	search google.com yahoo.com wikipedia.org
	nameserver 8.8.8.8
]]))

local resconf = config.new()
resconf:loadfile(txt)

for i,dn in ipairs(resconf:getsearch()) do
	info("search[%d]: %s", i, dn)
end

for i,how in ipairs(resconf:getlookup()) do
	info("lookup[%d]: %s", i, how)
end

say("OK")