]> gitweb.factorcode.org Git - factor.git/commitdiff
Support openbsd's resolv.conf syntax
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 9 Oct 2010 02:12:31 +0000 (19:12 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 9 Oct 2010 02:13:03 +0000 (19:13 -0700)
extra/resolv-conf/resolv-conf.factor

index 4ee0366f4543040d71385ffb4502a646dc2cc0e7..d8d370a02b635d6d1dfd2a8ad814e0dad0941f4f 100644 (file)
@@ -10,20 +10,24 @@ CONSTRUCTOR: network ( ip netmask -- network ) ;
 
 TUPLE: options
 debug?
+edns0?
+insecure1?
+insecure2?
 { ndots integer initial: 1 }
 { timeout integer initial: 5 }
 { attempts integer initial: 2 }
-rotate? no-check-names? inet6? ;
+rotate? no-check-names? inet6? tcp? ;
 
 CONSTRUCTOR: options ( -- options ) ;
 
-TUPLE: resolv.conf nameserver domain search sortlist options ;
+TUPLE: resolv.conf nameserver domain lookup search sortlist options ;
 
 CONSTRUCTOR: resolv.conf ( -- resolv.conf )
     V{ } clone >>nameserver
     V{ } clone >>domain
     V{ } clone >>search
     V{ } clone >>sortlist
+    V{ } clone >>lookup
     <options> >>options ;
 
 <PRIVATE
@@ -40,6 +44,9 @@ CONSTRUCTOR: resolv.conf ( -- resolv.conf )
 : parse-domain ( resolv.conf string -- resolv.conf )
     split-line domain>> push-all ;
 
+: parse-lookup ( resolv.conf string -- resolv.conf )
+    split-line lookup>> push-all ;
+
 : parse-search ( resolv.conf string -- resolv.conf )
     split-line search>> push-all ;
 
@@ -70,6 +77,7 @@ ERROR: unsupported-resolv.conf-line string ;
     {
         { [ "nameserver" ?head ] [ parse-nameserver ] }
         { [ "domain" ?head ] [ parse-domain ] }
+        { [ "lookup" ?head ] [ parse-lookup ] }
         { [ "search" ?head ] [ parse-search ] }
         { [ "sortlist" ?head ] [ parse-sortlist ] }
         { [ "options" ?head ] [ parse-option ] }