diff -Naur original/lib/config-plan9.h port/lib/config-plan9.h
--- original/lib/config-plan9.h	1970-01-01 01:00:00.000000000 +0100
+++ port/lib/config-plan9.h	2012-04-03 08:01:53.140074060 +0200
@@ -0,0 +1,26 @@
+/* manually added definitions requested during compilation on Plan9 */
+
+#include "curl_config.h"
+
+#define HAVE_POSIX_STRERROR_R 1
+
+#define HAVE_SYS_SELECT 1
+#define HAVE_SELECT 1
+#define HAVE_SYS_SOCKET_H 1
+#define HAVE_UNISTD_H 1
+
+#define VALID_SOCK(x) 1
+#define VERIFY_SOCK(x) 0 /* no idea what I should put here but this at least makes stuff compile */
+
+#define TRUE 1
+#define FALSE 0
+
+#include <errno.h>
+#define EWOULDBLOCK EAGAIN
+#define EISCONN EISCON
+
+
+
+
+
+
diff -Naur original/lib/cookie.c port/lib/cookie.c
--- original/lib/cookie.c	2011-11-04 23:32:55.000000000 +0100
+++ port/lib/cookie.c	2012-04-02 18:27:05.000000000 +0200
@@ -75,7 +75,7 @@
     Session_Key@6791a9e0-901a-11d0-a1c8-9b012c88aa77=none;expires=Monday,
     13-Jun-1988 03:04:55 GMT; domain=.fidelity.com; path=/; secure
 ****/
-
+/* find: tok_buf */ /* plan9 bunny cookies! yaay! */
 
 #include "setup.h"
 
@@ -496,7 +496,7 @@
     if(ptr)
       *ptr=0; /* clear it */
 
-    firstptr=strtok_r(lineptr, "\t", &tok_buf); /* tokenize it on the TAB */
+    firstptr= (char *) strtok_r(lineptr, "\t", &tok_buf); /* tokenize it on the TAB */
 
     /* Here's a quick check to eliminate normal HTTP-headers from this */
     if(!firstptr || strchr(firstptr, ':')) {
@@ -507,7 +507,7 @@
     /* Now loop through the fields and init the struct we already have
        allocated */
     for(ptr=firstptr, fields=0; ptr && !badcookie;
-        ptr=strtok_r(NULL, "\t", &tok_buf), fields++) {
+        ptr= (char *) strtok_r(NULL, "\t", &tok_buf), fields++) {
       switch(fields) {
       case 0:
         if(ptr[0]=='.') /* skip preceding dots */
@@ -518,7 +518,7 @@
         break;
       case 1:
         /* This field got its explanation on the 23rd of May 2001 by
-           Andrés García:
+           Andrï¿½s Garcï¿½a:
 
            flag: A TRUE/FALSE value indicating if all machines within a given
            domain can access the variable. This value is set automatically by
@@ -532,7 +532,7 @@
       case 2:
         /* It turns out, that sometimes the file format allows the path
            field to remain not filled in, we try to detect this and work
-           around it! Andrés García made us aware of this... */
+           around it! Andrï¿½s Garcï¿½a made us aware of this... */
         if(strcmp("TRUE", ptr) && strcmp("FALSE", ptr)) {
           /* only if the path doesn't look like a boolean option! */
           co->path = strdup(ptr);

diff -Naur original/lib/mkfile port/lib/mkfile
--- original/lib/mkfile	1970-01-01 01:00:00.000000000 +0100
+++ port/lib/mkfile	2012-03-19 20:38:00.000000000 +0100
@@ -0,0 +1,249 @@
+</$objtype/mkfile
+LIB=/$objtype/lib/ape/libcurl.a
+OFILES=asyn-ares.$O cookie.$O curl_fnmatch.$O curl_memrchr.$O escape.$O file.$O \
+	hash.$O hmac.$O hostip.$O hostip6.$O hostsyn.$O if2ip.$O inet_pton.$O krb5.$O \
+	llist.$O md4.$O mprintf.$O non-ascii.$O nwos.$O openldap.$O rawstr.$O select.$O \
+	sendf.$O share.$O splay.$O ssluse.$O strdup.$O strtoofft.$O transfer.$O \
+	curl_addrinfo.$O curl_rand.$O curl_rtmp.$O curl_threads.$O cyassl.$O ftp.$O \
+	getenv.$O hostasyn.$O hostip4.$O http.$O http_negotiate.$O http_negotiate_sspi.$O \
+	http_proxy.$O imap.$O inet_ntop.$O ldap.$O netrc.$O nss.$O parsedate.$O \
+	slist.$O ssh.$O strequal.$O tftp.$O url.$O version.$O axtls.$O base64.$O \
+	connect.$O content_encoding.$O curl_gethostname.$O curl_gssapi.$O curl_ntlm.$O \
+	curl_ntlm_core.$O curl_ntlm_wb.$O curl_sspi.$O easy.$O formdata.$O getinfo.$O \
+	gopher.$O gtls.$O http_chunks.$O http_digest.$O krb4.$O md5.$O multi.$O \
+	nonblock.$O nwlib.$O pingpong.$O polarssl.$O pop3.$O progress.$O qssl.$O \
+	rtsp.$O smtp.$O socks_gssapi.$O socks_sspi.$O speedcheck.$O sslgen.$O strerror.$O \
+	strtok.$O telnet.$O timeval.$O warnless.$O wildcard.$O asyn-thread.$O curl_ntlm_msgs.$O \
+	dict.$O fileinfo.$O ftplistparser.$O memdebug.$O security.$O socks.$O 
+HFILES=setup.h 
+
+</sys/src/cmd/mksyslib
+
+CC=pcc
+LD=pcc
+CFLAGS=-c -I. -I../include -I../include/curl -I/sys/include/ape -I/386/include/ape \
+	-I/sys/src/cmd/gs/zlib -B -DPLAN9 -D_POSIX_SOURCE -D_SUSV2_SOURCE -D_BSD_EXTENSION \
+	-D_REENTRANT_SOURCE -DNEED_REENTRANT -D_EXPERIMENTAL_SOURCE -D_C99_SNPRINTF_EXTENSION \
+	-DHAVE_STRTOK_R -DHAVE_STRDUP -DHAVE_GMTIME_R -DHAVE_STRCASECMP -DHAVE_STRNCASECMP \
+	-DHAVE_GETHOSTNAME -DHAVE_STRERROR_R 
+
+socks.$O: memdebug.h socks.h timeval.h connect.h select.h strequal.h sendf.h urldata.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+ftplistparser.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h ftp.h rawstr.h \
+	strtoofft.h llist.h fileinfo.h ftp.h urldata.h curl_fnmatch.h ftplistparser.h 
+fileinfo.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h fileinfo.h strdup.h 
+dict.$O: memdebug.h ../include/curl/mprintf.h rawstr.h dict.h strequal.h progress.h \
+	sendf.h transfer.h ../include/curl/curl.h urldata.h /sys/include/ape/sys/select.h \
+	/sys/include/ape/sys/param.h /sys/include/ape/sys/ioctl.h /sys/include/ape/arpa/inet.h \
+	/sys/include/ape/netdb.h /sys/include/ape/unistd.h /sys/include/ape/netinet/in.h \
+	/sys/include/ape/sys/socket.h 
+asyn-thread.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h curl_threads.h \
+	inet_ntop.h inet_pton.h multiif.h url.h strerror.h share.h hash.h hostip.h \
+	sendf.h urldata.h /sys/include/ape/unistd.h /sys/include/ape/arpa/inet.h \
+	/sys/include/ape/netdb.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+wildcard.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h fileinfo.h llist.h \
+	wildcard.h 
+warnless.$O: warnless.h 
+timeval.$O: timeval.h 
+telnet.$O: memdebug.h rawstr.h strequal.h select.h curl_memory.h arpa_telnet.h \
+	../include/curl/mprintf.h progress.h connect.h telnet.h sendf.h transfer.h \
+	../include/curl/curl.h urldata.h /sys/include/ape/sys/param.h /sys/include/ape/sys/ioctl.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h /sys/include/ape/unistd.h \
+	/sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+strerror.$O: ../include/curl/mprintf.h strerror.h ../include/curl/curl.h 
+sslgen.$O: memdebug.h share.h progress.h curl_memory.h url.h rawstr.h sendf.h cyassl.h \
+	axtls.h polarssl.h urldata.h qssl.h nssg.h gtls.h ssluse.h sslgen.h urldata.h \
+	/sys/include/ape/sys/socket.h 
+speedcheck.$O: speedcheck.h multiif.h sendf.h urldata.h ../include/curl/curl.h 
+smtp.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h http_proxy.h warnless.h \
+	curl_ntlm_msgs.h curl_gethostname.h curl_hmac.h curl_md5.h curl_base64.h \
+	strtoofft.h rawstr.h url.h multiif.h select.h strerror.h connect.h sslgen.h \
+	strequal.h strtoofft.h smtp.h socks.h http.h escape.h transfer.h progress.h \
+	hostip.h if2ip.h sendf.h urldata.h ../include/curl/curl.h /sys/include/ape/netdb.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h \
+	/sys/include/ape/unistd.h 
+rtsp.$O: memdebug.h ../include/curl/mprintf.h connect.h select.h curl_memory.h \
+	rawstr.h rtsp.h progress.h url.h http.h multiif.h sendf.h transfer.h ../include/curl/curl.h \
+	urldata.h 
+progress.$O: ../include/curl/mprintf.h progress.h sendf.h urldata.h 
+pop3.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h http_proxy.h strtoofft.h \
+	rawstr.h url.h multiif.h select.h strerror.h connect.h sslgen.h strequal.h \
+	strtoofft.h pop3.h socks.h http.h escape.h transfer.h progress.h hostip.h \
+	if2ip.h sendf.h urldata.h ../include/curl/curl.h /sys/include/ape/netdb.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h \
+	/sys/include/ape/unistd.h 
+pingpong.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h non-ascii.h multiif.h \
+	pingpong.h speedcheck.h progress.h select.h sendf.h urldata.h 
+nonblock.$O: nonblock.h /sys/include/ape/fcntl.h /sys/include/ape/unistd.h /sys/include/ape/sys/ioctl.h \
+	/sys/include/ape/sys/socket.h 
+multi.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h warnless.h select.h \
+	http.h timeval.h sendf.h multiif.h easyif.h progress.h connect.h url.h \
+	transfer.h urldata.h ../include/curl/curl.h /sys/include/ape/unistd.h /sys/include/ape/sys/socket.h 
+md5.$O: curl_hmac.h curl_md5.h 
+http_digest.$O: memdebug.h ../include/curl/mprintf.h non-ascii.h curl_memory.h \
+	url.h strtok.h http_digest.h curl_hmac.h curl_md5.h curl_base64.h rawstr.h \
+	sendf.h urldata.h 
+http_chunks.$O: memdebug.h ../include/curl/mprintf.h non-ascii.h curl_memory.h \
+	http.h content_encoding.h sendf.h urldata.h 
+gopher.$O: memdebug.h ../include/curl/mprintf.h warnless.h url.h select.h rawstr.h \
+	gopher.h strequal.h progress.h sendf.h transfer.h ../include/curl/curl.h \
+	urldata.h /sys/include/ape/sys/select.h /sys/include/ape/sys/param.h /sys/include/ape/sys/ioctl.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h /sys/include/ape/unistd.h \
+	/sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+getinfo.$O: memdebug.h progress.h connect.h sslgen.h curl_memory.h getinfo.h urldata.h \
+	../include/curl/curl.h 
+formdata.$O: memdebug.h ../include/curl/mprintf.h sendf.h curl_memory.h strequal.h \
+	curl_rand.h formdata.h urldata.h ../include/curl/curl.h 
+easy.$O: memdebug.h ../include/curl/mprintf.h warnless.h non-ascii.h curl_rand.h \
+	slist.h connect.h curl_ntlm.h sendf.h select.h easyif.h progress.h curl_memory.h \
+	strdup.h share.h hostip.h getinfo.h url.h sslgen.h transfer.h ../include/curl/curl.h \
+	urldata.h strequal.h /sys/include/ape/sys/param.h /sys/include/ape/sys/ioctl.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h /sys/include/ape/unistd.h \
+	/sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+curl_gethostname.$O: curl_gethostname.h /sys/include/ape/unistd.h 
+content_encoding.$O: memdebug.h curl_memory.h content_encoding.h sendf.h ../include/curl/curl.h \
+	urldata.h 
+connect.$O: memdebug.h warnless.h progress.h sslgen.h inet_pton.h inet_ntop.h sockaddr.h \
+	multiif.h url.h select.h curl_memory.h connect.h strerror.h if2ip.h sendf.h \
+	urldata.h ../include/curl/mprintf.h /sys/include/ape/arpa/inet.h /sys/include/ape/fcntl.h \
+	/sys/include/ape/netdb.h /sys/include/ape/unistd.h /sys/include/ape/sys/ioctl.h \
+	/sys/include/ape/netinet/tcp.h /sys/include/ape/sys/un.h /sys/include/ape/netinet/in.h \
+	/sys/include/ape/sys/socket.h 
+base64.$O: memdebug.h non-ascii.h curl_memory.h curl_base64.h warnless.h urldata.h \
+	../include/curl/mprintf.h 
+version.$O: ../include/curl/mprintf.h sslgen.h urldata.h ../include/curl/curl.h 
+url.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h gopher.h curl_rtmp.h \
+	socks.h curl_ntlm_wb.h curl_ntlm.h inet_ntop.h connect.h url.h imap.h ssh.h \
+	curl_ldap.h file.h http.h tftp.h telnet.h dict.h ftp.h non-ascii.h warnless.h \
+	rawstr.h speedcheck.h easyif.h multiif.h select.h http_negotiate.h http_digest.h \
+	content_encoding.h share.h strtok.h escape.h strerror.h strequal.h cookie.h \
+	progress.h sendf.h transfer.h hostip.h sslgen.h formdata.h netrc.h urldata.h \
+	/sys/include/ape/limits.h /sys/include/ape/sys/param.h /sys/include/ape/sys/ioctl.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h /sys/include/ape/unistd.h \
+	/sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+tftp.$O: memdebug.h select.h curl_memory.h ../include/curl/mprintf.h rawstr.h url.h \
+	multiif.h sockaddr.h strerror.h connect.h progress.h tftp.h sendf.h transfer.h \
+	../include/curl/curl.h urldata.h /sys/include/ape/sys/param.h /sys/include/ape/sys/ioctl.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h /sys/include/ape/unistd.h \
+	/sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+strequal.$O: strequal.h 
+slist.$O: memdebug.h slist.h curl_memory.h 
+parsedate.$O: parsedate.h warnless.h rawstr.h ../include/curl/curl.h 
+nss.$O: ../include/curl/mprintf.h llist.h sslgen.h select.h strequal.h connect.h \
+	url.h formdata.h sendf.h urldata.h /sys/include/ape/sys/socket.h 
+netrc.$O: memdebug.h ../include/curl/mprintf.h rawstr.h curl_memory.h strtok.h \
+	strequal.h netrc.h ../include/curl/curl.h /sys/include/ape/sys/types.h \
+	/sys/include/ape/pwd.h /sys/include/ape/unistd.h 
+inet_ntop.$O: inet_ntop.h ../include/curl/mprintf.h /sys/include/ape/arpa/inet.h \
+	/sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h /sys/include/ape/sys/param.h 
+imap.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h http_proxy.h strtoofft.h \
+	rawstr.h url.h multiif.h select.h strerror.h connect.h sslgen.h strequal.h \
+	strtoofft.h imap.h socks.h http.h escape.h transfer.h progress.h hostip.h \
+	if2ip.h sendf.h urldata.h ../include/curl/curl.h /sys/include/ape/netdb.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h \
+	/sys/include/ape/unistd.h 
+http_proxy.$O: memdebug.h warnless.h nonblock.h timeval.h strtoofft.h strequal.h \
+	../include/curl/mprintf.h curlx.h ../include/curl/mprintf.h connect.h non-ascii.h \
+	progress.h rawstr.h select.h url.h http.h sendf.h http_proxy.h ../include/curl/curl.h \
+	urldata.h /sys/include/ape/unistd.h 
+http.$O: memdebug.h ../include/curl/mprintf.h non-ascii.h warnless.h http_proxy.h \
+	content_encoding.h rawstr.h multiif.h strtoofft.h parsedate.h select.h \
+	curl_memory.h http.h hostip.h share.h url.h http_negotiate.h curl_ntlm_wb.h \
+	curl_ntlm.h http_digest.h sslgen.h strequal.h cookie.h curl_base64.h progress.h \
+	formdata.h sendf.h transfer.h ../include/curl/curl.h urldata.h /sys/include/ape/sys/param.h \
+	/sys/include/ape/sys/ioctl.h /sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h \
+	/sys/include/ape/unistd.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+hostip4.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h inet_pton.h url.h \
+	strerror.h share.h hash.h hostip.h sendf.h urldata.h /sys/include/ape/unistd.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h /sys/include/ape/netinet/in.h \
+	/sys/include/ape/sys/socket.h 
+hostasyn.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h url.h strerror.h \
+	share.h hash.h hostip.h sendf.h urldata.h /sys/include/ape/unistd.h /sys/include/ape/arpa/inet.h \
+	/sys/include/ape/netdb.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+getenv.$O: memdebug.h curl_memory.h ../include/curl/curl.h 
+ftp.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h non-ascii.h http_proxy.h \
+	warnless.h speedcheck.h rawstr.h url.h multiif.h sockaddr.h parsedate.h \
+	select.h inet_pton.h inet_ntop.h strerror.h connect.h sslgen.h strequal.h \
+	strtoofft.h ../include/curl/curl.h ftplistparser.h ../include/curl/curl.h \
+	fileinfo.h ftp.h socks.h http.h escape.h transfer.h progress.h hostip.h \
+	if2ip.h sendf.h urldata.h ../include/curl/curl.h /sys/include/ape/netdb.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h \
+	/sys/include/ape/unistd.h 
+curl_threads.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h curl_threads.h 
+curl_rand.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h curl_rand.h ../include/curl/curl.h 
+curl_addrinfo.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h warnless.h \
+	inet_pton.h curl_addrinfo.h /sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h \
+	/sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h ../include/curl/curl.h 
+transfer.$O: memdebug.h ../include/curl/mprintf.h non-ascii.h connect.h multiif.h \
+	select.h curl_memory.h share.h http_negotiate.h curl_ntlm.h http_digest.h \
+	sslgen.h getinfo.h url.h http.h progress.h speedcheck.h sendf.h transfer.h \
+	hostip.h content_encoding.h netrc.h ../include/curl/curl.h urldata.h /sys/include/ape/sys/select.h \
+	/sys/include/ape/sys/param.h /sys/include/ape/signal.h /sys/include/ape/sys/ioctl.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h /sys/include/ape/unistd.h \
+	/sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h rawstr.h strequal.h \
+	strtoofft.h 
+strtoofft.$O: strtoofft.h 
+strdup.$O: strdup.h 
+ssluse.$O: ../include/curl/mprintf.h rawstr.h sslgen.h select.h strequal.h connect.h \
+	ssluse.h inet_pton.h url.h formdata.h sendf.h urldata.h /sys/include/ape/sys/socket.h \
+	/sys/include/ape/limits.h 
+splay.$O: splay.h 
+share.$O: memdebug.h curl_memory.h sslgen.h share.h urldata.h ../include/curl/curl.h 
+sendf.$O: memdebug.h strerror.h curl_memory.h ../include/curl/mprintf.h non-ascii.h \
+	multiif.h ssh.h sslgen.h connect.h sendf.h urldata.h ../include/curl/curl.h \
+	/sys/include/ape/unistd.h /sys/include/ape/sys/socket.h 
+select.$O: warnless.h select.h connect.h urldata.h ../include/curl/curl.h /sys/include/ape/sys/select.h 
+rawstr.$O: rawstr.h 
+mprintf.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h 
+llist.$O: memdebug.h curl_memory.h llist.h 
+inet_pton.$O: inet_pton.h /sys/include/ape/arpa/inet.h /sys/include/ape/netinet/in.h \
+	/sys/include/ape/sys/socket.h /sys/include/ape/sys/param.h 
+if2ip.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h if2ip.h strequal.h \
+	inet_ntop.h /sys/include/ape/netdb.h /sys/include/ape/sys/ioctl.h /sys/include/ape/arpa/inet.h \
+	/sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h /sys/include/ape/unistd.h 
+hostsyn.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h url.h strerror.h \
+	share.h hash.h hostip.h sendf.h urldata.h /sys/include/ape/unistd.h /sys/include/ape/arpa/inet.h \
+	/sys/include/ape/netdb.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+hostip6.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h ../include/curl/curl.h \
+	nonblock.h connect.h inet_pton.h url.h strerror.h share.h hash.h hostip.h \
+	sendf.h urldata.h /sys/include/ape/unistd.h /sys/include/ape/arpa/inet.h \
+	/sys/include/ape/netdb.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+hostip.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h warnless.h inet_ntop.h \
+	url.h urldata.h strerror.h share.h hash.h hostip.h sendf.h urldata.h /sys/include/ape/signal.h \
+	/sys/include/ape/setjmp.h /sys/include/ape/unistd.h /sys/include/ape/arpa/inet.h \
+	/sys/include/ape/netdb.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+hmac.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h curl_hmac.h 
+hash.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h llist.h hash.h 
+file.$O: memdebug.h ../include/curl/mprintf.h warnless.h parsedate.h curl_memory.h \
+	url.h transfer.h getinfo.h timeval.h speedcheck.h file.h escape.h sendf.h \
+	timeval.h progress.h ../include/curl/curl.h urldata.h strtoofft.h /sys/include/ape/sys/types.h \
+	/sys/include/ape/fcntl.h /sys/include/ape/sys/param.h /sys/include/ape/sys/ioctl.h \
+	/sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h /sys/include/ape/unistd.h \
+	/sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h 
+escape.$O: memdebug.h ../include/curl/mprintf.h non-ascii.h warnless.h urldata.h \
+	curl_memory.h ../include/curl/curl.h 
+curl_memrchr.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h curl_memrchr.h 
+curl_fnmatch.$O: memdebug.h curl_memory.h ../include/curl/mprintf.h curl_fnmatch.h 
+cookie.$O: memdebug.h curl_memrchr.h ../include/curl/curl.h rawstr.h strtoofft.h \
+	urldata.h cookie.h ../include/curl/curl.h share.h ../include/curl/curl.h \
+	curl_memory.h sendf.h /sys/include/ape/string.h /sys/include/ape/stddef.h \
+	strtok.h ../include/curl/curl.h strequal.h cookie.h ../include/curl/curl.h \
+	wildcard.h rtsp.h http.h ssh.h file.h pingpong.h ftp.h pingpong.h smtp.h \
+	pop3.h pingpong.h imap.h splay.h hash.h /sys/include/ape/setjmp.h curl_addrinfo.h \
+	asyn.h /sys/include/ape/arpa/inet.h /sys/include/ape/netdb.h /sys/include/ape/netinet/in.h \
+	/sys/include/ape/sys/socket.h curl_addrinfo.h /sys/include/ape/stddef.h \
+	llist.h /sys/include/ape/stddef.h hash.h hostip.h http_chunks.h ../include/curl/curl.h \
+	/sys/src/cmd/gs/zlib/zconf.h /sys/src/cmd/gs/zlib/zlib.h /sys/include/ape/zlib.h \
+	timeval.h /sys/include/ape/netinet/in.h formdata.h ../include/curl/curl.h \
+	cookie.h urldata.h ../include/curl/curl.h ../include/curl/multi.h ../include/curl/easy.h \
+	/sys/include/ape/sys/time.h /sys/include/ape/sys/socket.h /sys/include/ape/time.h \
+	/sys/include/ape/sys/types.h /sys/include/ape/limits.h /sys/include/ape/stdio.h \
+	../include/curl/curlrules.h ../include/curl/curlbuild.h ../include/curl/curlver.h \
+	../include/curl/curl.h /sys/include/ape/stdio.h /386/include/ape/stdarg.h \
+	../include/curl/mprintf.h 
+asyn-ares.$O: /sys/include/ape/bsd.h /sys/include/ape/unistd.h /sys/include/ape/arpa/inet.h \
+	/sys/include/ape/netdb.h /sys/include/ape/netinet/in.h /sys/include/ape/sys/socket.h \
+	/sys/include/ape/limits.h 
+nuke:V:
+	mk clean
+	rm -f $LIB
diff -Naur original/lib/progress.c port/lib/progress.c
--- original/lib/progress.c	2011-11-04 23:32:56.000000000 +0100
+++ port/lib/progress.c	2012-04-02 18:23:57.000000000 +0200
@@ -41,7 +41,12 @@
   h = seconds / CURL_OFF_T_C(3600);
   if(h <= CURL_OFF_T_C(99)) {
     m = (seconds - (h*CURL_OFF_T_C(3600))) / CURL_OFF_T_C(60);
-    s = (seconds - (h*CURL_OFF_T_C(3600))) - (m*CURL_OFF_T_C(60));
+#ifndef PLAN9
+    s = ((unsigned long long) seconds - (unsigned long long) (h*3600) - (unsigned long long) (m*60));
+/*somehow, seconds get "vlong double-spil botch" every time on Plan9*/
+#else 
+    s=0; /* ok countdown on seconds will not be informative */
+#endif
     snprintf(r, 9, "%2" FORMAT_OFF_T ":%02" FORMAT_OFF_T ":%02" FORMAT_OFF_T,
              h, m, s);
   }
diff -Naur original/lib/README.Plan9 port/lib/README.Plan9
--- original/lib/README.Plan9	1970-01-01 01:00:00.000000000 +0100
+++ port/lib/README.Plan9	2012-03-19 20:38:08.000000000 +0100
@@ -0,0 +1,12 @@
+This directory should compile libcurl.a
+Currently, openLDAP is not ported to Plan9, so curl is compiled without that support...for now...
+openLDAP needs netscape portable runtime (nspr) to compile so that needs to be ported first...
+
+un-needed files are deleted.
+Possibly, a configure-plan9.h needs to be generated later...
+
+Generation of mkfile:
+Makefile.inc gives some info about the stuff we need.
+
+mkmk -s libcurl -a -S -B -I. -I../include -I../include/curl -I/sys/include/ape -I/$objtype/include/ape -I/sys/src/cmd/gs/zlib -DPLAN9 -D_POSIX_SOURCE -D_SUSV2_SOURCE -D_BSD_EXTENSION -D_REENTRANT_SOURCE -DNEED_REENTRANT -D_EXPERIMENTAL_SOURCE -D_C99_SNPRINTF_EXTENSION -x .deps -H/$objtype/lib/ape/libssl.a -H/$objtype/lib/ape/libcrypto.a -H/$objtype/lib/ape/libz.a -H/$objtype/lib/ape/libbz2.a > mkfile
+
diff -Naur original/lib/select.c port/lib/select.c
--- original/lib/select.c	2011-11-04 23:32:56.000000000 +0100
+++ port/lib/select.c	2012-03-19 20:02:24.000000000 +0100
@@ -19,6 +19,7 @@
  * KIND, either express or implied.
  *
  ***************************************************************************/
+/* find: pollfd */
 
 #include "setup.h"
 
@@ -56,6 +57,45 @@
 #define error_not_EINTR (error != EINTR)
 #endif
 
+/* for some reason, the definintions from "select.h" did not carry over... */
+/*perhaps I need to change the order of the include files... */
+
+#if defined PLAN9
+#define POLLIN      0x01
+#define POLLPRI     0x02
+#define POLLOUT     0x04
+#define POLLERR     0x08
+#define POLLHUP     0x10
+#define POLLNVAL    0x20
+
+struct pollfd
+{
+    curl_socket_t fd;
+    short   events;
+    short   revents;
+};
+
+#ifndef POLLRDNORM
+#define POLLRDNORM POLLIN
+#endif
+
+#ifndef POLLWRNORM
+#define POLLWRNORM POLLOUT
+#endif
+
+#ifndef POLLRDBAND
+#define POLLRDBAND POLLPRI
+#endif
+
+int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd,
+                      long timeout_ms);
+
+int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms);
+
+int Curl_wait_ms(int timeout_ms);
+
+#endif
+
 /*
  * Internal function used for waiting a specific amount of ms
  * in Curl_socket_ready() and Curl_poll() when no file descriptor
diff -Naur original/lib/select.h port/lib/select.h
--- original/lib/select.h	2011-11-04 23:32:56.000000000 +0100
+++ port/lib/select.h	2012-04-03 07:55:42.896734109 +0200
@@ -21,6 +21,7 @@
  * KIND, either express or implied.
  *
  ***************************************************************************/
+/* Curl_socket_ready */ 
 
 #include "setup.h"
 
@@ -96,9 +97,10 @@
                        fd_set* excepts, struct timeval* tv);
 #endif
 
+#ifndef PLAN9
 /* Winsock and TPF sockets are not in range [0..FD_SETSIZE-1], which
    unfortunately makes it impossible for us to easily check if they're valid
-*/
+*/ /* Plan9 also had issues with this */
 #if defined(USE_WINSOCK) || defined(TPF)
 #define VALID_SOCK(x) 1
 #define VERIFY_SOCK(x) Curl_nop_stmt
@@ -111,5 +113,7 @@
   } \
 } WHILE_FALSE
 #endif
+#endif /* Plan9 got messed up here. Defined in config-plan9.h */
+
 
 #endif /* __SELECT_H */
diff -Naur original/lib/setup.h port/lib/setup.h
--- original/lib/setup.h	2011-11-04 23:32:57.000000000 +0100
+++ port/lib/setup.h	2012-03-19 19:35:29.000000000 +0100
@@ -74,6 +74,10 @@
 #  include "config-vxworks.h"
 #endif
 
+#ifdef PLAN9
+#include "config-plan9.h"
+#endif
+
 #endif /* HAVE_CONFIG_H */
 
 /* ================================================================ */
diff -Naur original/mkfile port/mkfile
--- original/mkfile	1970-01-01 01:00:00.000000000 +0100
+++ port/mkfile	2012-04-01 03:04:26.000000000 +0200
@@ -0,0 +1,19 @@
+</$objtype/mkfile
+DIRS=lib src 
+
+all:V:
+	for (i in $DIRS)
+		@{ cd $i; mk }
+
+install:V:
+	for (i in $DIRS)
+		@{ cd $i; mk $target }
+
+clean:V:
+	for (i in $DIRS)
+		@{ cd $i; mk $target }
+
+nuke:V:
+	for (i in $DIRS)
+		@{ cd $i; mk $target }
+
diff -Naur original/src/config-plan9.h port/src/config-plan9.h
--- original/src/config-plan9.h	1970-01-01 01:00:00.000000000 +0100
+++ port/src/config-plan9.h	2012-03-20 02:01:51.000000000 +0100
@@ -0,0 +1,13 @@
+#include "curl_config.h"
+
+#define HAVE_SYS_SOCKET_H 1
+
+#define VERIFY_SOCK 0
+
+
+
+
+
+
+
+

diff -Naur original/src/mkfile port/src/mkfile
--- original/src/mkfile	1970-01-01 01:00:00.000000000 +0100
+++ port/src/mkfile	2012-03-20 01:42:56.000000000 +0100
@@ -0,0 +1,94 @@
+</$objtype/mkfile
+TARG=curl
+OFILES=nonblock.$O rawstr.$O strdup.$O tool_binmode.$O tool_bname.$O tool_cb_prg.$O \
+	tool_cb_rea.$O tool_cb_see.$O tool_cb_skt.$O tool_convert.$O tool_dirhie.$O \
+	tool_doswin.$O tool_easysrc.$O tool_getparam.$O tool_getpass.$O tool_libinfo.$O \
+	tool_main.$O tool_operate.$O tool_operhlp.$O tool_parsecfg.$O tool_setopt.$O \
+	tool_urlglob.$O tool_util.$O tool_vms.$O tool_writeenv.$O tool_writeout.$O \
+	tool_xattr.$O hugehelp.$O tool_cb_dbg.$O tool_cb_hdr.$O tool_cb_wrt.$O \
+	tool_cfgable.$O tool_formparse.$O tool_help.$O tool_helpers.$O tool_homedir.$O \
+	tool_mfiles.$O tool_msgs.$O tool_panykey.$O tool_paramhlp.$O tool_sleep.$O 
+LIB=/386/lib/ape/libssl.a /386/lib/ape/libcrypto.a /386/lib/ape/libz.a /386/lib/ape/libbz2.a \
+	/386/lib/ape/libcurl.a 
+BIN=/$objtype/bin/ape
+HFILES=../lib/memdebug.h setup.h 
+
+</sys/src/cmd/mkone
+
+CC=pcc
+LD=pcc
+CFLAGS=-c -I. -I../lib -I../include -I../include/curl -I/sys/include/ape -I/386/include/ape \
+	-I/sys/src/cmd/gs/zlib -B -DPLAN9 -D_POSIX_SOURCE -D_SUSV2_SOURCE -D_BSD_EXTENSION \
+	-D_REENTRANT_SOURCE -DNEED_REENTRANT -D_EXPERIMENTAL_SOURCE -D_C99_SNPRINTF_EXTENSION \
+	-DHAVE_STRDUP 
+
+tool_sleep.$O: tool_sleep.h /sys/include/ape/sys/socket.h /sys/include/ape/sys/select.h 
+tool_paramhlp.$O: tool_paramhlp.h tool_msgs.h tool_homedir.h tool_getpass.h tool_getparam.h \
+	tool_cfgable.h ../lib/curlx.h ../lib/rawstr.h ../include/curl/curl.h 
+tool_msgs.$O: tool_msgs.h tool_cfgable.h ../lib/curlx.h 
+tool_mfiles.$O: tool_mfiles.h ../include/curl/curl.h 
+tool_homedir.$O: tool_homedir.h /sys/include/ape/unistd.h /sys/include/ape/sys/types.h \
+	/sys/include/ape/pwd.h 
+tool_helpers.$O: tool_helpers.h tool_getparam.h tool_msgs.h tool_cfgable.h ../lib/curlx.h \
+	../lib/rawstr.h ../include/curl/curl.h 
+tool_help.$O: tool_help.h tool_panykey.h 
+tool_formparse.$O: tool_formparse.h tool_msgs.h tool_mfiles.h tool_cfgable.h ../lib/curlx.h \
+	../lib/rawstr.h ../include/curl/curl.h 
+tool_cfgable.$O: tool_cfgable.h ../include/curl/curl.h 
+tool_cb_wrt.$O: tool_cb_wrt.h tool_msgs.h tool_cfgable.h ../lib/curlx.h ../include/curl/curl.h 
+tool_cb_hdr.$O: tool_cb_hdr.h tool_msgs.h tool_cfgable.h ../lib/curlx.h ../lib/rawstr.h \
+	../include/curl/curl.h 
+tool_cb_dbg.$O: tool_util.h tool_cb_dbg.h tool_msgs.h tool_cfgable.h ../lib/curlx.h \
+	../include/curl/curl.h 
+hugehelp.$O: /sys/src/cmd/gs/zlib/zconf.h /sys/src/cmd/gs/zlib/zlib.h /sys/include/ape/zlib.h \
+	hugehelp.h 
+tool_xattr.$O: tool_xattr.h ../include/curl/curl.h 
+tool_writeout.$O: tool_writeout.h ../include/curl/mprintf.h ../include/curl/curl.h 
+tool_util.$O: tool_util.h 
+tool_urlglob.$O: tool_vms.h tool_urlglob.h ../include/curl/mprintf.h ../include/curl/curl.h 
+tool_setopt.$O: tool_setopt.h tool_easysrc.h tool_cfgable.h ../lib/curlx.h ../include/curl/curl.h 
+tool_parsecfg.$O: tool_parsecfg.h tool_msgs.h tool_homedir.h tool_helpers.h tool_getparam.h \
+	tool_cfgable.h ../lib/curlx.h ../include/curl/curl.h 
+tool_operhlp.$O: tool_version.h tool_operhlp.h tool_convert.h tool_cfgable.h ../lib/curlx.h \
+	../lib/rawstr.h ../include/curl/curl.h 
+tool_operate.$O: tool_xattr.h tool_writeout.h tool_writeenv.h tool_util.h tool_urlglob.h \
+	tool_sleep.h tool_setopt.h tool_parsecfg.h tool_operhlp.h tool_operate.h \
+	tool_msgs.h tool_main.h tool_libinfo.h tool_homedir.h tool_helpers.h tool_getparam.h \
+	tool_easysrc.h tool_doswin.h tool_dirhie.h tool_cb_wrt.h tool_cb_skt.h \
+	tool_cb_see.h tool_cb_rea.h tool_cb_prg.h tool_cb_hdr.h tool_cb_dbg.h tool_cfgable.h \
+	tool_binmode.h ../lib/curlx.h ../lib/rawstr.h /sys/include/ape/stddef.h \
+	/sys/include/ape/locale.h /sys/include/ape/utime.h /sys/include/ape/fcntl.h \
+	/sys/include/ape/unistd.h ../include/curl/curl.h 
+tool_main.$O: tool_main.h tool_vms.h tool_panykey.h tool_operate.h tool_convert.h \
+	tool_cfgable.h ../lib/curlx.h /sys/include/ape/unistd.h /sys/include/ape/sys/stat.h \
+	../include/curl/curl.h 
+tool_libinfo.$O: tool_libinfo.h ../lib/curlx.h ../lib/rawstr.h ../include/curl/curl.h 
+tool_getpass.$O: tool_getpass.h ../include/curl/mprintf.h /sys/include/ape/termios.h \
+	/sys/include/ape/fcntl.h /sys/include/ape/unistd.h 
+tool_getparam.$O: ../include/curl/curlver.h tool_version.h tool_parsecfg.h tool_paramhlp.h \
+	tool_msgs.h tool_libinfo.h tool_helpers.h tool_help.h tool_getparam.h tool_formparse.h \
+	tool_cb_prg.h tool_cfgable.h tool_binmode.h hugehelp.h ../lib/curlx.h ../lib/rawstr.h \
+	../include/curl/curl.h 
+tool_easysrc.$O: tool_msgs.h tool_easysrc.h tool_cfgable.h ../lib/curlx.h ../include/curl/curl.h 
+tool_dirhie.$O: tool_dirhie.h ../lib/curlx.h /sys/include/ape/unistd.h /sys/include/ape/sys/stat.h \
+	../include/curl/curl.h 
+tool_cb_skt.$O: tool_cb_skt.h tool_msgs.h tool_cfgable.h ../lib/curlx.h /sys/include/ape/sys/socket.h \
+	../include/curl/curl.h 
+tool_cb_see.$O: tool_cb_see.h tool_cfgable.h ../lib/curlx.h /sys/include/ape/unistd.h \
+	../include/curl/curl.h 
+tool_cb_rea.$O: tool_cb_rea.h tool_cfgable.h ../lib/curlx.h /sys/include/ape/unistd.h \
+	../include/curl/curl.h 
+tool_cb_prg.$O: tool_cb_prg.h tool_cfgable.h tool_sdecls.h tool_cfgable.h ../lib/warnless.h \
+	../lib/nonblock.h ../lib/timeval.h ../lib/strtoofft.h ../include/curl/curl.h \
+	../lib/strequal.h ../include/curl/curl.h /sys/include/ape/stdio.h /386/include/ape/stdarg.h \
+	../include/curl/mprintf.h ../lib/curlx.h ../include/curl/curl.h 
+tool_bname.$O: tool_bname.h 
+strdup.$O: ../lib/strdup.h 
+rawstr.$O: ../include/curl/curl.h ../lib/rawstr.h 
+nonblock.$O: ../include/curl/curl.h ../include/curl/multi.h ../include/curl/easy.h \
+	/sys/include/ape/sys/time.h /sys/include/ape/sys/socket.h /sys/include/ape/time.h \
+	/sys/include/ape/sys/types.h /sys/include/ape/limits.h /sys/include/ape/stdio.h \
+	../include/curl/curlrules.h ../include/curl/curlbuild.h ../include/curl/curlver.h \
+	../include/curl/curl.h ../lib/nonblock.h /sys/include/ape/sys/types.h /sys/include/ape/fcntl.h \
+	/sys/include/ape/bsd.h /sys/include/ape/unistd.h /sys/include/ape/sys/ioctl.h \
+	/sys/include/ape/sys/socket.h 
diff -Naur original/src/nonblock.c port/src/nonblock.c
--- original/src/nonblock.c	1970-01-01 01:00:00.000000000 +0100
+++ port/src/nonblock.c	2012-03-20 01:17:46.000000000 +0100
@@ -0,0 +1,97 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#include "setup.h"
+
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#if (defined(HAVE_IOCTL_FIONBIO) && defined(NETWARE))
+#include <sys/filio.h>
+#endif
+#ifdef __VMS
+#include <in.h>
+#include <inet.h>
+#endif
+
+#include "nonblock.h"
+
+/*
+ * curlx_nonblock() set the given socket to either blocking or non-blocking
+ * mode based on the 'nonblock' boolean argument. This function is highly
+ * portable.
+ */
+int curlx_nonblock(curl_socket_t sockfd,    /* operate on this */
+                   int nonblock   /* TRUE or FALSE */)
+{
+#if defined(USE_BLOCKING_SOCKETS)
+
+  return 0; /* returns success */
+
+#elif defined(HAVE_FCNTL_O_NONBLOCK)
+
+  /* most recent unix versions */
+  int flags;
+  flags = fcntl(sockfd, F_GETFL, 0);
+  if(nonblock)
+    return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
+  else
+    return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
+
+#elif defined(HAVE_IOCTL_FIONBIO)
+
+  /* older unix versions */
+  int flags = nonblock ? 1 : 0;
+  return ioctl(sockfd, FIONBIO, &flags);
+
+#elif defined(HAVE_IOCTLSOCKET_FIONBIO)
+
+  /* Windows */
+  unsigned long flags = nonblock ? 1UL : 0UL;
+  return ioctlsocket(sockfd, FIONBIO, &flags);
+
+#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
+
+  /* Amiga */
+  long flags = nonblock ? 1L : 0L;
+  return IoctlSocket(sockfd, FIONBIO, flags);
+
+#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK)
+
+  /* BeOS */
+  long b = nonblock ? 1L : 0L;
+  return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
+
+#else
+#  error "no non-blocking method was found/used/set"
+#endif
+}
diff -Naur original/src/rawstr.c port/src/rawstr.c
--- original/src/rawstr.c	1970-01-01 01:00:00.000000000 +0100
+++ port/src/rawstr.c	2012-03-20 01:17:30.000000000 +0100
@@ -0,0 +1,142 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#include "setup.h"
+
+#include "rawstr.h"
+
+/* Portable, consistent toupper (remember EBCDIC). Do not use toupper() because
+   its behavior is altered by the current locale. */
+char Curl_raw_toupper(char in)
+{
+  switch (in) {
+  case 'a':
+    return 'A';
+  case 'b':
+    return 'B';
+  case 'c':
+    return 'C';
+  case 'd':
+    return 'D';
+  case 'e':
+    return 'E';
+  case 'f':
+    return 'F';
+  case 'g':
+    return 'G';
+  case 'h':
+    return 'H';
+  case 'i':
+    return 'I';
+  case 'j':
+    return 'J';
+  case 'k':
+    return 'K';
+  case 'l':
+    return 'L';
+  case 'm':
+    return 'M';
+  case 'n':
+    return 'N';
+  case 'o':
+    return 'O';
+  case 'p':
+    return 'P';
+  case 'q':
+    return 'Q';
+  case 'r':
+    return 'R';
+  case 's':
+    return 'S';
+  case 't':
+    return 'T';
+  case 'u':
+    return 'U';
+  case 'v':
+    return 'V';
+  case 'w':
+    return 'W';
+  case 'x':
+    return 'X';
+  case 'y':
+    return 'Y';
+  case 'z':
+    return 'Z';
+  }
+  return in;
+}
+
+/*
+ * Curl_raw_equal() is for doing "raw" case insensitive strings. This is meant
+ * to be locale independent and only compare strings we know are safe for
+ * this.  See http://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ for
+ * some further explanation to why this function is necessary.
+ *
+ * The function is capable of comparing a-z case insensitively even for
+ * non-ascii.
+ */
+
+int Curl_raw_equal(const char *first, const char *second)
+{
+  while(*first && *second) {
+    if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second))
+      /* get out of the loop as soon as they don't match */
+      break;
+    first++;
+    second++;
+  }
+  /* we do the comparison here (possibly again), just to make sure that if the
+     loop above is skipped because one of the strings reached zero, we must not
+     return this as a successful match */
+  return (Curl_raw_toupper(*first) == Curl_raw_toupper(*second));
+}
+
+int Curl_raw_nequal(const char *first, const char *second, size_t max)
+{
+  while(*first && *second && max) {
+    if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) {
+      break;
+    }
+    max--;
+    first++;
+    second++;
+  }
+  if(0 == max)
+    return 1; /* they are equal this far */
+
+  return Curl_raw_toupper(*first) == Curl_raw_toupper(*second);
+}
+
+/* Copy an upper case version of the string from src to dest.  The
+ * strings may overlap.  No more than n characters of the string are copied
+ * (including any NUL) and the destination string will NOT be
+ * NUL-terminated if that limit is reached.
+ */
+void Curl_strntoupper(char *dest, const char *src, size_t n)
+{
+  if(n < 1)
+    return;
+
+  do {
+    *dest++ = Curl_raw_toupper(*src);
+  } while(*src++ && --n);
+}
diff -Naur original/src/README.Plan9 port/src/README.Plan9
--- original/src/README.Plan9	1970-01-01 01:00:00.000000000 +0100
+++ port/src/README.Plan9	2012-03-20 01:23:01.000000000 +0100
@@ -0,0 +1,10 @@
+Makefile.inc gave some interesting info on needed files.
+the files represented by CURLX_ONES 
+term% cp ../lib/strdup.c .
+term% cp ../lib/rawstr.c .
+term% cp ../lib/nonblock.c .
+
+
+mkfile generated by:
+
+mkmk -o curl -a -S -B -I. -I../lib -I../include -I../include/curl -I/sys/include/ape -I/$objtype/include/ape  -I/sys/src/cmd/gs/zlib -DPLAN9 -D_POSIX_SOURCE -D_SUSV2_SOURCE -D_BSD_EXTENSION -D_REENTRANT_SOURCE -DNEED_REENTRANT -D_EXPERIMENTAL_SOURCE -D_C99_SNPRINTF_EXTENSION -x .deps -H/$objtype/lib/ape/libssl.a -H/$objtype/lib/ape/libcrypto.a -H/$objtype/lib/ape/libz.a -H/$objtype/lib/ape/libbz2.a -H/$objtype/lib/ape/libcurl.a > mkfile

diff -Naur original/src/setup.h port/src/setup.h
--- original/src/setup.h	2011-11-04 23:32:58.000000000 +0100
+++ port/src/setup.h	2012-03-20 01:24:48.000000000 +0100
@@ -66,6 +66,10 @@
 #include "config-tpf.h"
 #endif
 
+#ifdef PLAN9
+#include "config-plan9.h"
+#endif
+
 #endif /* HAVE_CONFIG_H */
 
 /*
diff -Naur original/src/strdup.c port/src/strdup.c
--- original/src/strdup.c	1970-01-01 01:00:00.000000000 +0100
+++ port/src/strdup.c	2012-03-20 01:17:02.000000000 +0100
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#include "setup.h"
+
+#include "strdup.h"
+
+#ifndef HAVE_STRDUP
+char *curlx_strdup(const char *str)
+{
+  size_t len;
+  char *newstr;
+
+  if(!str)
+    return (char *)NULL;
+
+  len = strlen(str);
+
+  if(len >= ((size_t)-1) / sizeof(char))
+    return (char *)NULL;
+
+  newstr = malloc((len+1)*sizeof(char));
+  if(!newstr)
+    return (char *)NULL;
+
+  memcpy(newstr,str,(len+1)*sizeof(char));
+
+  return newstr;
+
+}
+#endif
diff -Naur original/src/tool_cb_skt.c port/src/tool_cb_skt.c
--- original/src/tool_cb_skt.c	2011-11-04 23:32:58.000000000 +0100
+++ port/src/tool_cb_skt.c	2012-03-20 01:35:44.000000000 +0100
@@ -27,6 +27,12 @@
 #  include <sys/socket.h>
 #endif
 
+#ifdef PLAN9
+/* for some reason this did not carry over */
+/* found in APE sys/socket.h */
+#define	SO_KEEPALIVE	0x0008		/* keep connections alive */
+#endif
+
 #define ENABLE_CURLX_PRINTF
 /* use our own printf() functions */
 #include "curlx.h"
