about summary refs log tree commit diff stats
path: root/WWW/Library
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-03-21 16:00:00 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1998-03-21 16:00:00 -0500
commit43797ce7b89f70182191e7b41521772c7efa2d25 (patch)
tree24880fdd0a1fc4a7778ec322a0af12e878a9a4fb /WWW/Library
parentd8e8363bb47d88e434c2128c4c1ffbf501a67898 (diff)
downloadlynx-snapshots-43797ce7b89f70182191e7b41521772c7efa2d25.tar.gz
snapshot of project "lynx", label v2-8-1dev_3
Diffstat (limited to 'WWW/Library')
-rw-r--r--WWW/Library/Implementation/HTTCP.c60
-rw-r--r--WWW/Library/Implementation/tcp.h1
2 files changed, 59 insertions, 2 deletions
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index dab7ab73..13897da8 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -117,6 +117,16 @@ extern int sys_nerr;
 
 #endif	/* !PCNFS */
 
+#ifdef _WINDOWS_NSL
+	 char host[512];
+	 struct hostent  *phost;     /* Pointer to host - See netdb.h */
+
+unsigned long _fork_func (void *arglist)
+{
+		  return (unsigned long)(phost = gethostbyname(host));
+}
+#endif /* _WINDOWS_NSL */
+
 #if defined(VMS) && defined(UCX)
 /*
 **  A routine to mimic the ioctl function for UCX.
@@ -315,9 +325,11 @@ PUBLIC int HTParseInet ARGS2(
 	CONST char *,	str)
 {
     char *port;
-    char *host = NULL;
     int dotcount_ip = 0;	/* for dotted decimal IP addr */
+#ifndef _WINDOWS_NSL
+    char *host = NULL;
     struct hostent  *phost;	/* Pointer to host - See netdb.h */
+#endif /* _WINDOWS_NSL */
 
     if (!str) {
 	if (TRACE) {
@@ -331,8 +343,11 @@ PUBLIC int HTParseInet ARGS2(
 	}
 	return -1;
     }
+#ifdef _WINDOWS_NSL
+    strncpy(host, str, (size_t)512);
+#else
     StrAllocCopy(host, str);	/* Make a copy we can mutilate */
-
+#endif /*  _WINDOWS_NSL */
     /*
     **	Parse port number if present.
     */
@@ -407,7 +422,9 @@ PUBLIC int HTParseInet ARGS2(
 #endif /* GUSI */
 #endif /* DGUX_OLD */
 #endif /* DJGPP */
+#ifndef _WINDOWS_NSL
 	FREE(host);
+#endif /* _WINDOWS_NSL */
     } else {		    /* Alphanumeric node name: */
 #ifdef MVS	/* Outstanding problem with crash in MVS gethostbyname */
 	if (TRACE) {
@@ -550,10 +567,14 @@ PUBLIC int HTParseInet ARGS2(
 			"HTParseInet: Can't find internet node name `%s'.\n",
 			host);
 	    }
+#ifndef _WINDOWS_NSL
 	    FREE(host);
+#endif /* _WINDOWS_NSL */
 	    return -1;
 	}
+#ifndef _WINDOWS_NSL
 	FREE(host);
+#endif /* _WINDOWS_NSL */
 #ifdef MVS
 	if (TRACE) {
 	    fprintf(stderr,
@@ -572,7 +593,38 @@ PUBLIC int HTParseInet ARGS2(
 		 return -1;  /* Fail? */
 	}
 #else
+#ifdef _WINDOWS_NSL
+	{
+#ifdef __BORLANDC__
+		HANDLE hThread, dwThreadID;
+#else
+		unsigned long hThread, dwThreadID;
+#endif /* __BORLANDC__ */
+		phost = (struct hostent *) NULL;
+		hThread = CreateThread((void *)NULL, 4096UL,
+#ifdef __BORLANDC__
+			 (LPTHREAD_START_ROUTINE)_fork_func,
+#else
+			 (unsigned long (*)())_fork_func,
+#endif /* __BORLANDC__ */
+			 (void *)NULL, 0UL, (unsigned long *)&dwThreadID);
+		if (!hThread)
+			 MessageBox((void *)NULL, "CreateThread",
+				"CreateThread Failed", 0L);
+		while (!phost)
+			if (HTCheckForInterrupt())
+			 {
+			  /* Note that host is a character array and is not freed */
+			  /* to avoid possible subthread problems: */
+			  if (!CloseHandle(hThread))
+				 MessageBox((void *)NULL, "CloseHandle","CloseHandle Failed",
+						0L);
+			  return HT_INTERRUPTED;
+			};
+	};
+#else /* !_WINDOWS_NSL */
 	phost = gethostbyname(host);	/* See netdb.h */
+#endif /* _WINDOWS_NSL */
 #ifdef MVS
 	if (TRACE) {
 	    fprintf(stderr,
@@ -836,7 +888,11 @@ PUBLIC int HTDoConnect ARGS4(
 		return HT_NO_DATA;
 	    }
 
+#ifdef _WINDOWS_NSL
+	    timeout.tv_sec = 100;
+#else
 	    timeout.tv_sec = 0;
+#endif /* _WINDOWS_NSL */
 	    timeout.tv_usec = 100000;
 	    FD_ZERO(&writefds);
 	    FD_SET(*s, &writefds);
diff --git a/WWW/Library/Implementation/tcp.h b/WWW/Library/Implementation/tcp.h
index 7bfdb39b..482ff28d 100644
--- a/WWW/Library/Implementation/tcp.h
+++ b/WWW/Library/Implementation/tcp.h
@@ -135,6 +135,7 @@ IBM-PC running Windows NT
 */
 
 #ifdef _WINDOWS
+#define _WINDOWS_NSL
 #include "fcntl.h"                      /* For HTFile.c */
 #include "sys\types.h"                  /* For HTFile.c */
 #include "sys\stat.h"                   /* For HTFile.c */