shithub: mc

Download patch

ref: d1ff1cf60286cc672d269eaeef62c1bd3134d408
parent: ee42f7f682c2279b0e24f70979f41436ff655cd4
author: Ori Bernstein <[email protected]>
date: Wed Dec 11 19:57:00 EST 2013

More work on the DNS resolution code.

--- a/libstd/resolve.myr
+++ b/libstd/resolve.myr
@@ -7,6 +7,7 @@
 use "slcp.use"
 use "slurp.use"
 use "strsplit.use"
+use "strstrip.use"
 use "sys.use"
 use "types.use"
 
@@ -50,12 +51,13 @@
 }
 
 const hostfind = {host
+	-> `None
+	/*
 	var hdat
 	var lines
-	/*
 	var ip
-	var host
-	*/
+	var hn
+	var str
 	var i
 
 	match slurp(Hostfile)
@@ -65,8 +67,14 @@
 
 	lines = strsplit(hdat, "\n")
 	for i = 0; i < lines.len; i++
-		put("Hosts: Line %s\n", lines[i])
+		lines[i] = strstrip(lines[i])
+		(ip, str) = nextword(lines)
+		(hn, str) = nextword(str)
+		if streq(hn, host)
+			-> parseip(ip)
+		;;
 	;;
+	*/
 }
 
 const dnsresolve = {host : byte[:]