Fri, 25 Sep 2009 01:35:46 +0100
net.dns: Even better parsing of nameservers from resolv.conf
net/dns.lua | file | annotate | diff | comparison | revisions |
--- a/net/dns.lua Thu Sep 24 23:46:12 2009 +0100 +++ b/net/dns.lua Fri Sep 25 01:35:46 2009 +0100 @@ -510,7 +510,7 @@ local resolv_conf = io.open("/etc/resolv.conf"); if resolv_conf then for line in resolv_conf:lines() do - local address = string.match (line, '^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$') + local address = line:gsub("#.*$", ""):match('^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$') if address then self:addnameserver (address) end end elseif os.getenv("WINDIR") then