about summary refs log tree commit diff stats
path: root/WWW/Library
diff options
context:
space:
mode:
Diffstat (limited to 'WWW/Library')
-rw-r--r--WWW/Library/Implementation/HTAABrow.c8
-rw-r--r--WWW/Library/Implementation/HTAAUtil.c8
-rw-r--r--WWW/Library/Implementation/HTAccess.c40
-rw-r--r--WWW/Library/Implementation/HTAnchor.c2
-rw-r--r--WWW/Library/Implementation/HTDOS.c38
-rw-r--r--WWW/Library/Implementation/HTDOS.h4
-rw-r--r--WWW/Library/Implementation/HTFTP.c19
-rw-r--r--WWW/Library/Implementation/HTFile.c101
-rw-r--r--WWW/Library/Implementation/HTFile.h2
-rw-r--r--WWW/Library/Implementation/HTFinger.c4
-rw-r--r--WWW/Library/Implementation/HTGopher.c23
-rw-r--r--WWW/Library/Implementation/HTMIME.c10
-rw-r--r--WWW/Library/Implementation/HTNews.c52
-rw-r--r--WWW/Library/Implementation/HTParse.c68
-rw-r--r--WWW/Library/Implementation/HTParse.h21
-rw-r--r--WWW/Library/Implementation/HTTCP.c24
-rw-r--r--WWW/Library/Implementation/HTTP.c109
-rw-r--r--WWW/Library/Implementation/HTTP.h4
-rw-r--r--WWW/Library/Implementation/HTTelnet.c68
-rw-r--r--WWW/Library/Implementation/HTUtils.h19
-rw-r--r--WWW/Library/Implementation/HTVMSUtils.c10
-rw-r--r--WWW/Library/Implementation/HTWAIS.c2
-rw-r--r--WWW/Library/Implementation/HTWSRC.c5
-rw-r--r--WWW/Library/Implementation/SGML.c6
-rw-r--r--WWW/Library/Implementation/www_tcp.h12
-rw-r--r--WWW/Library/Implementation/www_wait.h8
-rw-r--r--WWW/Library/vms/libmake.com10
27 files changed, 390 insertions, 287 deletions
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c
index 519030fa..02db254c 100644
--- a/WWW/Library/Implementation/HTAABrow.c
+++ b/WWW/Library/Implementation/HTAABrow.c
@@ -649,7 +649,7 @@ PRIVATE char *compose_auth_string ARGS3(
 		     realm->realmname,
 		     (IsProxy ? "proxy" : "server"),
 		     (theHost ? theHost : "??"),
-		     (thePort ? thePort : ""));
+		     NonNull(thePort));
 	FREE(proxiedHost);
 	FREE(thePort);
 	username = realm->username;
@@ -676,8 +676,8 @@ PRIVATE char *compose_auth_string ARGS3(
 	}
     }
 
-    len = strlen(realm->username ? realm->username : "") +
-	  strlen(realm->password ? realm->password : "") + 3;
+    len = strlen(NonNull(realm->username)) +
+	  strlen(NonNull(realm->password)) + 3;
 
     if (scheme == HTAA_PUBKEY) {
 #ifdef PUBKEY
@@ -685,7 +685,7 @@ PRIVATE char *compose_auth_string ARGS3(
 	StrAllocCopy(secret_key, HTAA_generateRandomKey());
 #endif /* PUBKEY */
 	/* Room for secret key, timestamp and inet address */
-	len += strlen(secret_key ? secret_key : "") + 30;
+	len += strlen(NonNull(secret_key)) + 30;
     } else {
 	FREE(secret_key);
     }
diff --git a/WWW/Library/Implementation/HTAAUtil.c b/WWW/Library/Implementation/HTAAUtil.c
index 25d24aa6..fd7d24aa 100644
--- a/WWW/Library/Implementation/HTAAUtil.c
+++ b/WWW/Library/Implementation/HTAAUtil.c
@@ -50,10 +50,6 @@
 #include <HTTCP.h>
 #include <HTTP.h>
 
-#ifdef USE_SSL
-PRIVATE SSL * Handle = NULL;	/* The SSL Handle	*/
-#endif /* USE_SSL */
-
 #include <LYStrings.h>
 #include <LYLeaks.h>
 
@@ -560,8 +556,8 @@ PUBLIC char *HTAA_getUnfoldedLine NOARGS
 
 	if (start_pointer >= end_pointer) {/*Read the next block and continue*/
 #ifdef USE_SSL
-	    if (Handle)
-		count = SSL_read(Handle, buffer, BUFFER_SIZE);
+	    if (SSL_handle)
+		count = SSL_read(SSL_handle, buffer, BUFFER_SIZE);
 	    else
 		count = NETREAD(in_soc, buffer, BUFFER_SIZE);
 #else
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index 42a58190..0fe6bc34 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -267,16 +267,10 @@ PUBLIC BOOL override_proxy ARGS1(
     }
     Host = (((at = strchr(host, '@')) != NULL) ? (at+1) : host);
 
-#ifdef VMS
-#define CompareHostname(a,b) strcasecomp(a, b)
-#else
-#define CompareHostname(a,b) strcmp(a, b)
-#endif /* VMS */
-
     if ((acc_method = HTParse(addr, "", PARSE_ACCESS))) {
 	if (!strcmp("file", acc_method) &&
-	    (!strcmp(Host, "localhost") ||
-	     !CompareHostname(Host, HTHostName()))) {
+	    (LYSameHostname(Host, "localhost") ||
+	     LYSameHostname(Host, HTHostName()))) {
 	    FREE(host);
 	    FREE(acc_method);
 	    return YES;
@@ -433,7 +427,7 @@ PRIVATE int get_physical ARGS2(
 #endif /* NO_RULES */
 
     acc_method =  HTParse(HTAnchor_physical(anchor),
-		"file:", PARSE_ACCESS);
+		STR_FILE_URL, PARSE_ACCESS);
 
     /*
     **	Check whether gateway access has been set up for this.
@@ -461,9 +455,9 @@ PRIVATE int get_physical ARGS2(
 		    StrAllocCat(Server_addr, ":119/");
 		}
 		FREE(host);
-	    } else if (getenv("NNTPSERVER") != NULL) {
+	    } else if (LYGetEnv("NNTPSERVER") != NULL) {
 		StrAllocCopy(Server_addr, "news://");
-		StrAllocCat(Server_addr, (char *)getenv("NNTPSERVER"));
+		StrAllocCat(Server_addr, LYGetEnv("NNTPSERVER"));
 		StrAllocCat(Server_addr, ":119/");
 	    }
 	} else if (!strcasecomp(acc_method, "wais")) {
@@ -495,7 +489,7 @@ PRIVATE int get_physical ARGS2(
 	**  Search for gateways.
 	*/
 	HTSprintf0(&gateway_parameter, "WWW_%s_GATEWAY", acc_method);
-	gateway = getenv(gateway_parameter); /* coerce for decstation */
+	gateway = LYGetEnv(gateway_parameter); /* coerce for decstation */
 
 	/*
 	**  Search for proxy servers.
@@ -507,7 +501,7 @@ PRIVATE int get_physical ARGS2(
 	    strcpy(gateway_parameter, "ftp_proxy");
 	else
 	    sprintf(gateway_parameter, "%s_proxy", acc_method);
-	proxy = getenv(gateway_parameter);
+	proxy = LYGetEnv(gateway_parameter);
 	FREE(gateway_parameter);
 
 	if (gateway)
@@ -544,8 +538,8 @@ PRIVATE int get_physical ARGS2(
 	    FREE(gatewayed);
 	    FREE(acc_method);
 
-	    acc_method =  HTParse(HTAnchor_physical(anchor),
-		"http:", PARSE_ACCESS);
+	    acc_method = HTParse(HTAnchor_physical(anchor),
+				 STR_HTTP_URL, PARSE_ACCESS);
 
 	} else if (gateway) {
 	    char * path = HTParse(addr, "",
@@ -557,8 +551,8 @@ PRIVATE int get_physical ARGS2(
 	    FREE(gatewayed);
 	    FREE(acc_method);
 
-	    acc_method =  HTParse(HTAnchor_physical(anchor),
-		"http:", PARSE_ACCESS);
+	    acc_method = HTParse(HTAnchor_physical(anchor),
+				 STR_HTTP_URL, PARSE_ACCESS);
 	}
     }
     FREE(Server_addr);
@@ -781,7 +775,7 @@ PRIVATE BOOL HTLoadDocument ARGS4(
     if (LYinternal_flag && !LYforce_no_cache &&
 	anchor->post_data && !anchor->safe &&
 	(text = (HText *)HTAnchor_document(anchor)) == NULL &&
-	strncmp(full_address, "LYNXIMGMAP:", 11) &&
+	!isLYNXIMGMAP(full_address) &&
 	HTConfirm(gettext("Document with POST content not found in cache.  Resubmit?"))
 	!= TRUE) {
 	return NO;
@@ -896,7 +890,7 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 #else
 	if (LYoverride_no_cache ||
 	    ((LYinternal_flag || !HText_hasNoCacheSet(text)) &&
-	     strncmp(full_address, "LYNXIMGMAP:", 11)))
+	     !isLYNXIMGMAP(full_address)))
 #endif /* TRACK_INTERNAL_LINKS */
 	{
 	    CTRACE((tfp, "HTAccess: Document already in memory.\n"));
@@ -1349,7 +1343,7 @@ PUBLIC BOOL HTSearchAbsolute ARGS2(
 PUBLIC HTParentAnchor * HTHomeAnchor NOARGS
 {
     char * my_home_document = NULL;
-    char * home = (char *)getenv(LOGICAL_DEFAULT);
+    char * home = LYGetEnv(LOGICAL_DEFAULT);
     char * ref;
     HTParentAnchor * anchor;
 
@@ -1379,8 +1373,8 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS
 #ifdef UNIX
     if (my_home_document == NULL) {
 	FILE * fp = NULL;
-	CONST char * home =  (CONST char*)getenv("HOME");
-	if (home != null) {
+	char * home = LYGetEnv("HOME");
+	if (home != 0) {
 	    HTSprintf0(&my_home_document, "%s/%s", home, PERSONAL_DEFAULT);
 	    fp = fopen(my_home_document, "r");
 	}
@@ -1401,7 +1395,7 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS
     ref = HTParse((my_home_document ?
 		   my_home_document : (HTClientHost ?
 				     REMOTE_ADDRESS : LAST_RESORT)),
-		  "file:",
+		  STR_FILE_URL,
 		  PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION);
     if (my_home_document) {
 	CTRACE((tfp, "HTAccess: Using custom home page %s i.e., address %s\n",
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c
index be8b59dd..a489c4c0 100644
--- a/WWW/Library/Implementation/HTAnchor.c
+++ b/WWW/Library/Implementation/HTAnchor.c
@@ -215,7 +215,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2(
     child = HTChildAnchor_new();
     CTRACE((tfp, "HTAnchor: New Anchor %p named `%s' is child of %p\n",
 		(void *)child,
-		tag ? tag : (CONST char *)"",
+		NonNull(tag),
 		(void *)parent)); /* int for apollo */
     HTList_addObject (parent->children, child);
     child->parent = parent;
diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c
index 47f31283..91e6db41 100644
--- a/WWW/Library/Implementation/HTDOS.c
+++ b/WWW/Library/Implementation/HTDOS.c
@@ -3,6 +3,7 @@
  */
 
 #include <HTUtils.h>
+#include <LYUtils.h>
 #include <HTDOS.h>
 #include <LYStrings.h>
 
@@ -72,6 +73,21 @@ char * HTDOS_wwwName ARGS1(CONST char *, dosname)
 }
 
 
+/*
+ * Convert slashes from Unix to DOS
+ */
+char * HTDOS_slashes (char * path)
+{
+    char *s;
+
+    for (s = path; *s != '\0'; ++s)	{
+	if (*s == '/')	{
+	    *s = '\\';
+	}
+    }
+    return path;
+}
+
 /* PUBLIC							HTDOS_name()
 **		CONVERTS WWW name into a DOS name
 ** ON ENTRY:
@@ -101,11 +117,7 @@ char * HTDOS_name ARGS1(char *, wwwname)
     }
 #endif /* __DJGPP__ */
 
-    for (joe = 0; result[joe] != '\0'; joe++)	{
-	if (result[joe] == '/')	{
-	    result[joe] = '\\';	/* convert slashes to dos-style */
-	}
-    }
+    (void) HTDOS_slashes(result);
 
     /* pesky leading slash, rudiment from file://localhost/  */
     /* the rest of path may be with or without drive letter  */
@@ -115,26 +127,20 @@ char * HTDOS_name ARGS1(char *, wwwname)
     }
 
 #ifdef _WINDOWS	/* 1998/04/02 (Thu) 08:59:48 */
-    if (strchr(result, '\\') != NULL
-     && strchr(result, ':') == NULL) {
+    if (LYLastPathSep(result) != NULL
+     && !LYIsDosDrive(result)) {
 	sprintf(temp_buff, "%.3s\\%.*s", windows_drive,
 		(int)(sizeof(temp_buff) - 5), result);
 	StrAllocCopy(result, temp_buff);
-    } else {
-	char *p = strchr(result, ':');
-	if (p && (strcmp(p, ":\\") == 0)) {
-	    p[2] = '.';
-	    p[3] = '\0';
-	}
     }
 #endif
     /*
      * If we have only a device, add a trailing slash.  Otherwise it just
      * refers to the current directory on the given device.
      */
-    if (strchr(result, '\\') == 0
-     && result[1] == ':')
-	StrAllocCat(result, "\\");
+    if (LYLastPathSep(result) == NULL
+     && LYIsDosDrive(result))
+	LYAddPathSep0(result);
 
     CTRACE((tfp, "HTDOS_name changed `%s' to `%s'\n", wwwname, result));
     return (result);
diff --git a/WWW/Library/Implementation/HTDOS.h b/WWW/Library/Implementation/HTDOS.h
index 319a6358..6aa61bda 100644
--- a/WWW/Library/Implementation/HTDOS.h
+++ b/WWW/Library/Implementation/HTDOS.h
@@ -18,6 +18,10 @@
 */
 char * HTDOS_wwwName PARAMS((CONST char * dosname));
 
+/*
+ * Converts Unix slashes to DOS
+ */
+char * HTDOS_slashes (char * path);
 
 /* PUBLIC                                                       HTDOS_name()
 **              CONVERTS WWW name into a DOS name
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index 42e7cad0..39cfd1c9 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -872,7 +872,7 @@ PRIVATE int get_connection ARGS2(
 		/*
 		 * Use an environment variable and the host global. - FM
 		 */
-		if ((cp=getenv("USER")) != NULL)
+		if ((cp=LYGetEnv("USER")) != NULL)
 		    StrAllocCopy(user, cp);
 		else
 		    StrAllocCopy(user, "WWWuser");
@@ -1786,7 +1786,7 @@ PRIVATE void parse_vms_dir_entry ARGS2(
     /** Wrap it up **/
     CTRACE((tfp, "HTFTP: VMS filename: %s  date: %s  size: %d\n",
 		entry_info->filename,
-		entry_info->date ? entry_info->date : "",
+		NonNull(entry_info->date),
 		entry_info->size));
     return;
 } /* parse_vms_dir_entry() */
@@ -1859,7 +1859,7 @@ PRIVATE void parse_ms_windows_dir_entry ARGS2(
     /** Wrap it up **/
     CTRACE((tfp, "HTFTP: MS Windows filename: %s  date: %s  size: %d\n",
 		entry_info->filename,
-		entry_info->date ? entry_info->date : "",
+		NonNull(entry_info->date),
 		entry_info->size));
     return;
 } /* parse_ms_windows_dir_entry */
@@ -1968,7 +1968,7 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2(
     /** Wrap it up **/
     CTRACE((tfp, "HTFTP: Windows NT filename: %s  date: %s  size: %d\n",
 		entry_info->filename,
-		entry_info->date ? entry_info->date : "",
+		NonNull(entry_info->date),
 		entry_info->size));
     return;
 } /* parse_windows_nt_dir_entry */
@@ -2109,7 +2109,7 @@ PRIVATE void parse_cms_dir_entry ARGS2(
     /** Wrap it up. **/
     CTRACE((tfp, "HTFTP: VM/CMS filename: %s  date: %s  size: %d\n",
 		entry_info->filename,
-		entry_info->date ? entry_info->date : "",
+		NonNull(entry_info->date),
 		entry_info->size));
     return;
 } /* parse_cms_dir_entry */
@@ -2657,7 +2657,6 @@ PRIVATE int read_directory ARGS4(
     }
     FREE (filename);
 
-
     {
 	HTBTree * bt = HTBTree_new((HTComparer)compare_EntryInfo_structs);
 	int ic;
@@ -3018,7 +3017,7 @@ PUBLIC int HTFTPLoad ARGS4(
 		    return -99;
 		}
 		passive_port = (p0<<8) + p1;
-		snprintf(dst, sizeof(dst), "%d.%d.%d.%d", h0, h1, h2, h3);
+		sprintf(dst, "%d.%d.%d.%d", h0, h1, h2, h3);
 	    } else if (strcmp(p, "EPSV") == 0) {
 		unsigned char c0, c1, c2, c3;
 		struct sockaddr_storage ss;
@@ -3077,10 +3076,10 @@ PUBLIC int HTFTPLoad ARGS4(
 	    /* Open connection for data:  */
 
 #ifdef INET6
-	    HTSprintf0(&command, "ftp://%s:%d/", dst, passive_port);
+	    HTSprintf0(&command, "%s//%s:%d/", STR_FTP_URL, dst, passive_port);
 #else
-	    HTSprintf0(&command, "ftp://%d.%d.%d.%d:%d/",
-		    h0, h1, h2, h3, passive_port);
+	    HTSprintf0(&command, "%s//%d.%d.%d.%d:%d/",
+		    STR_FTP_URL, h0, h1, h2, h3, passive_port);
 #endif
 	    status = HTDoConnect(command, "FTP data", passive_port, &data_soc);
 	    FREE(command);
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 562ac645..3a90e3b2 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -23,7 +23,7 @@
 #include <HTUtils.h>
 
 #ifndef VMS
-#ifdef DOSPATH
+#if defined(DOSPATH)
 #undef LONG_LIST
 #define LONG_LIST  /* Define this for long style unix listings (ls -l),
 		     the actual style is configurable from lynx.cfg */
@@ -31,13 +31,17 @@
 /* #define NO_PARENT_DIR_REFERENCE */ /* Define this for no parent links */
 #endif /* !VMS */
 
-#ifdef DOSPATH
+#if defined(DOSPATH)
 #define HAVE_READDIR 1
 #define USE_DIRENT
+#endif
+
+#if defined(USE_DOS_DRIVES)
 #include <HTDOS.h>
-#endif /* DOSPATH */
+#endif
 
 #include <HTFile.h>		/* Implemented here */
+
 #ifdef VMS
 #include <stat.h>
 #endif /* VMS */
@@ -591,9 +595,10 @@ PRIVATE int HTCreatePath ARGS1(CONST char *,path)
 **  On exit:
 **	Returns a malloc'ed string which must be freed by the caller.
 */
-PUBLIC char * HTURLPath_toFile ARGS2(
+PUBLIC char * HTURLPath_toFile ARGS3(
 	CONST char *,	name,
-	BOOL,		expand_all)
+	BOOL,		expand_all,
+	BOOL,		is_remote GCC_UNUSED)
 {
     char * path = NULL;
     char * result = NULL;
@@ -605,21 +610,11 @@ PUBLIC char * HTURLPath_toFile ARGS2(
 	HTUnEscapeSome(path, "/");	/* Interpret % signs for path delims */
 
     CTRACE((tfp, "URLPath `%s' means path `%s'\n", name, path));
-#ifdef DOSPATH
-    StrAllocCopy(result, HTDOS_name(path));
-#else
-#ifdef __EMX__
-    if (path[0] == '/'
-	&& isalpha(path[1])
-	&& path[2] == ':') /* pesky leading slash */
-	StrAllocCopy(result, path+1);
-    else
-	StrAllocCopy(result, path);
-    CTRACE((tfp, "EMX hack changed `%s' to `%s'\n", path, result));
+#if defined(USE_DOS_DRIVES)
+    StrAllocCopy(result, is_remote ? path : HTDOS_name(path));
 #else
     StrAllocCopy(result, path);
-#endif /* __EMX__ */
-#endif /* DOSPATH */
+#endif
 
     FREE(path);
 
@@ -661,21 +656,7 @@ PUBLIC char * HTnameOfFile_WWW ARGS3(
 	if ((0 == strcasecomp(host, HTHostName())) ||
 	    (0 == strcasecomp(host, "localhost")) || !*host) {
 	    CTRACE((tfp, "Node `%s' means path `%s'\n", name, path));
-#ifdef DOSPATH
-	    StrAllocCopy(result, HTDOS_name(path));
-#else
-#ifdef __EMX__
-	    if (path[0] == '/'
-	     && isalpha(path[1])
-	     && path[2] == ':') /* pesky leading slash */
-		StrAllocCopy(result, path+1);
-	    else
-		StrAllocCopy(result, path);
-	    CTRACE((tfp, "EMX hack changed `%s' to `%s'\n", path, result));
-#else
-	    StrAllocCopy(result, path);
-#endif /* __EMX__ */
-#endif /* DOSPATH */
+	    StrAllocCopy(result, HTSYS_name(path));
 	} else if (WWW_prefix) {
 	    HTSprintf0(&result, "%s%s%s", "/Net/", host, path);
 	    CTRACE((tfp, "Node `%s' means file `%s'\n", name, result));
@@ -684,7 +665,7 @@ PUBLIC char * HTnameOfFile_WWW ARGS3(
 	}
     } else if (WWW_prefix) {  /* other access */
 #ifdef VMS
-	if ((home = getenv("HOME")) == 0)
+	if ((home = LYGetEnv("HOME")) == 0)
 	    home = HTCacheRoot;
 	else
 	    home = HTVMS_wwwName(home);
@@ -692,7 +673,7 @@ PUBLIC char * HTnameOfFile_WWW ARGS3(
 #if defined(_WINDOWS)	/* 1997/10/16 (Thu) 20:42:51 */
 	home =  (char *)Home_Dir();
 #else
-	home = getenv("HOME");
+	home = LYGetEnv("HOME");
 #endif
 	if (home == 0)
 	    home = "/tmp";
@@ -726,13 +707,13 @@ PUBLIC char * WWW_nameOfFile ARGS1(
     char * result = NULL;
 #ifdef NeXT
     if (0 == strncmp("/private/Net/", name, 13)) {
-	HTSprintf0(&result, "file://%s", name+13);
+	HTSprintf0(&result, "%s//%s", STR_FILE_URL, name+13);
     } else
 #endif /* NeXT */
     if (0 == strncmp(HTMountRoot, name, 5)) {
-	HTSprintf0(&result, "file://%s", name+5);
+	HTSprintf0(&result, "%s//%s", STR_FILE_URL, name+5);
     } else {
-	HTSprintf0(&result, "file://%s%s", HTHostName(), name);
+	HTSprintf0(&result, "%s//%s%s", STR_FILE_URL, HTHostName(), name);
     }
     CTRACE((tfp, "File `%s'\n\tmeans node `%s'\n", name, result));
     return result;
@@ -1381,11 +1362,15 @@ PUBLIC BOOL HTDirTitles ARGS3(
     char * cp = NULL;
     BOOL need_parent_link = FALSE;
     int i;
-
-#ifdef DOSPATH
-    BOOL local_link = FALSE;
-    if (strlen(logical) > 18 && logical[18] == ':') local_link = TRUE;
+#if defined(USE_DOS_DRIVES)
+    BOOL local_link = (strlen(logical) > 18
+		     && !strncasecomp(logical, "file://localhost/", 17)
+		     && LYIsDosDrive(logical + 17));
+    BOOL is_remote = !local_link;
+#else
+#define is_remote TRUE
 #endif
+
     /*
     **	Check tildeIsTop for treating home directory as Welcome
     **	(assume the tilde is not followed by a username). - FM
@@ -1423,7 +1408,8 @@ PUBLIC BOOL HTDirTitles ARGS3(
 	    (0 == strncasecomp(path, "/%2F", 4))	/* "//" ? */
 	    ? (path+1)
 	    : path,
-	    TRUE);
+	    TRUE,
+	    is_remote);
       if (0 == strncasecomp(printable, "/vmsysu:", 8) ||
 	  0 == strncasecomp(printable, "/anonymou.", 10)) {
 	  StrAllocCopy(cp, (printable+1));
@@ -1474,10 +1460,7 @@ PUBLIC BOOL HTDirTitles ARGS3(
     /*
     **	Make link back to parent directory.
     */
-#ifdef DOSPATH
-    if (current != path)	/* leave "/c:" alone */
-#endif
-    if (current - path > 1
+    if (current - path > 0
       && LYIsPathSep(current[-1])
       && current[0] != '\0') {	/* was a slash AND something else too */
 	char * parent = NULL;
@@ -1498,7 +1481,7 @@ PUBLIC BOOL HTDirTitles ARGS3(
 	relative = 0;
 	HTSprintf0(&relative, "%s/..", current);
 
-#ifdef DOSPATH
+#if defined(DOSPATH) || defined(__EMX__)
 	if (local_link) {
 	    if (parent != 0 && strlen(parent) == 3 ) {
 		StrAllocCat(relative, "/.");
@@ -1761,7 +1744,7 @@ PRIVATE int print_local_dir ARGS5(
 				   (HTAnchor *)anchor, FALSE);
 
 #ifdef DIRED_SUPPORT
-    if (strncmp(anchor->address, "lynxcgi:", 8)) {
+    if (!isLYNXCGI(anchor->address)) {
 	HTAnchor_setFormat((HTParentAnchor *) anchor, WWW_DIRED);
 	lynx_edit_mode = TRUE;
     }
@@ -1769,7 +1752,6 @@ PRIVATE int print_local_dir ARGS5(
     if (HTDirReadme == HT_DIR_README_TOP)
 	do_readme(target, localname);
 
-
     {
 	HTBTree * bt = HTBTree_new(dired_cmp);
 	int num_of_entries = 0;	    /* lines counter */
@@ -1782,7 +1764,7 @@ PRIVATE int print_local_dir ARGS5(
 	    */
 	    DIRED *data = NULL;
 
-#ifndef DOSPATH
+#if !(defined(DOSPATH) || defined(__EMX__))
 	    if (dirbuf->d_ino == 0)
 		/*
 		**  If the entry is not being used, skip it.
@@ -2129,13 +2111,8 @@ PUBLIC int HTLoadFile ARGS4(
     */
     acc_method = HTParse(newname, "", PARSE_ACCESS);
     if (strcmp("ftp", acc_method) == 0 ||
-       (strcmp("localhost", nodename) != 0 &&
-#ifdef VMS
-	strcasecomp(nodename, HTHostName()) != 0
-#else
-	strcmp(nodename, HTHostName()) != 0
-#endif /* VMS */
-    )) {
+       (!LYSameHostname("localhost", nodename) &&
+	!LYSameHostname(nodename, HTHostName()))) {
 	status = -1;
 	FREE(newname);
 	FREE(filename);
@@ -2149,7 +2126,7 @@ PUBLIC int HTLoadFile ARGS4(
 	FREE(newname);
 	FREE(acc_method);
     }
-#if defined(VMS) || defined(DOSPATH)
+#if defined(VMS) || defined(USE_DOS_DRIVES)
     HTUnEscape(filename);
 #endif /* VMS */
 
@@ -2437,7 +2414,7 @@ PUBLIC int HTLoadFile ARGS4(
 		/*
 		**  While there are directory entries to be read...
 		*/
-#ifndef DOSPATH
+#if !(defined(DOSPATH) || defined(__EMX__))
 		if (dirbuf->d_ino == 0)
 		    continue;	/* if the entry is not being used, skip it */
 #endif
@@ -2531,6 +2508,10 @@ PUBLIC int HTLoadFile ARGS4(
 	**  will hold the directory entry, and a type 'DIR' which is used
 	**  to point to the current directory being read.
 	*/
+#if defined(USE_DOS_DRIVES)
+	if (strlen(localname) == 2 && LYIsDosDrive(localname))
+	    LYAddPathSep(&localname);
+#endif
 	if (HTStat(localname,&dir_info) == -1)	   /* get file information */
 	{
 				/* if can't read file information */
diff --git a/WWW/Library/Implementation/HTFile.h b/WWW/Library/Implementation/HTFile.h
index edee6ded..bd0a90ee 100644
--- a/WWW/Library/Implementation/HTFile.h
+++ b/WWW/Library/Implementation/HTFile.h
@@ -42,7 +42,7 @@ extern int HTDirReadme;         /* Include readme files in listing? */
 /*
 **  Convert filenames between local and WWW formats
 */
-extern char * HTURLPath_toFile PARAMS((CONST char * name, BOOL expand_all));
+extern char * HTURLPath_toFile PARAMS((CONST char * name, BOOL expand_all, BOOL is_remote));
 extern char * HTnameOfFile_WWW PARAMS((CONST char * name, BOOL WWW_prefix, BOOL expand_all));
 #define HTLocalName(name)      HTnameOfFile_WWW(name,TRUE,TRUE)
 #define HTfullURL_toFile(name) HTnameOfFile_WWW(name,FALSE,TRUE)
diff --git a/WWW/Library/Implementation/HTFinger.c b/WWW/Library/Implementation/HTFinger.c
index 9f205e0c..46ec892b 100644
--- a/WWW/Library/Implementation/HTFinger.c
+++ b/WWW/Library/Implementation/HTFinger.c
@@ -203,7 +203,7 @@ PRIVATE int response ARGS5(
 	     */
 	    p = l = line;
 	    while (*l) {
-		if (strncmp(l, "news:", 5) &&
+		if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
 		    strncmp(l, "snews://", 8) &&
 		    strncmp(l, "nntp://", 7) &&
 		    strncmp(l, "snewspost:", 10) &&
@@ -216,7 +216,7 @@ PRIVATE int response ARGS5(
 		    strncmp(l, "http://", 7) &&
 		    strncmp(l, "https://", 8) &&
 		    strncmp(l, "wais://", 7) &&
-		    strncmp(l, "mailto:", 7) &&
+		    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
 		    strncmp(l, "cso://", 6) &&
 		    strncmp(l, "gopher://", 9))
 		    PUTC(*l++);
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index 96681e66..34d28772 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -327,23 +327,16 @@ PRIVATE void parse_menu ARGS2(
 
 	    } else if (port) {		/* Other types need port */
 		char *address = 0;
+		char *format = *selector ? "%s//%s@%s/" : "%s//%s/";
 
 		if (gtype == GOPHER_TELNET) {
 		    PUTS(" (TEL) ");
-		    if (*selector)
-			HTSprintf0(&address, "telnet://%s@%s/",
-					   selector, host);
-		    else
-			HTSprintf0(&address, "telnet://%s/", host);
+		    HTSprintf0(&address, format, STR_TELNET_URL, selector, host);
 		}
 		else if (gtype == GOPHER_TN3270)
 		{
 		    PUTS("(3270) ");
-		    if (*selector)
-			HTSprintf0(&address, "tn3270://%s@%s/",
-				selector, host);
-		    else
-			HTSprintf0(&address, "tn3270://%s/", host);
+		    HTSprintf0(&address, format, STR_TN3270_URL, selector, host);
 		}
 		else {			/* If parsed ok */
 		    char *r;
@@ -1339,7 +1332,7 @@ PRIVATE int generate_cso_report ARGS1(
 			    } else if (*l == '>') {
 				StrAllocCat(buf, "&gt;");
 				l++;
-			    } else if (strncmp(l, "news:", 5) &&
+			    } else if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
 				       strncmp(l, "snews://", 8) &&
 				       strncmp(l, "nntp://", 7) &&
 				       strncmp(l, "snewspost:", 10) &&
@@ -1352,7 +1345,7 @@ PRIVATE int generate_cso_report ARGS1(
 				       strncmp(l, "http://", 7) &&
 				       strncmp(l, "https://", 8) &&
 				       strncmp(l, "wais://", 7) &&
-				       strncmp(l, "mailto:", 7) &&
+				       strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
 				       strncmp(l, "cso://", 6) &&
 				       strncmp(l, "gopher://", 9)) {
 				HTSprintf(&buf, "%c", *l++);
@@ -1383,7 +1376,7 @@ PRIVATE int generate_cso_report ARGS1(
 			} else if (*l == '>') {
 			    StrAllocCat(buf, "&gt;");
 			    l++;
-			} else if (strncmp(l, "news:", 5) &&
+			} else if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
 				   strncmp(l, "snews://", 8) &&
 				   strncmp(l, "nntp://", 7) &&
 				   strncmp(l, "snewspost:", 10) &&
@@ -1396,7 +1389,7 @@ PRIVATE int generate_cso_report ARGS1(
 				   strncmp(l, "http://", 7) &&
 				   strncmp(l, "https://", 8) &&
 				   strncmp(l, "wais://", 7) &&
-				   strncmp(l, "mailto:", 7) &&
+				   strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
 				   strncmp(l, "cso://", 6) &&
 				   strncmp(l, "gopher://", 9)) {
 			    HTSprintf(&buf, "%c", *l++);
@@ -1521,7 +1514,7 @@ PRIVATE int HTLoadCSO ARGS4(
 	return HT_NOT_LOADED;
     }
     host = HTParse(arg, "", PARSE_HOST);
-    if ((cp=strchr(host, ':')) != NULL) {
+    if ((cp = strchr(host, ':')) != NULL) {
 	if (cp[1] >= '0' && cp[1] <= '9') {
 	    port = atoi((cp+1));
 	    if (port == CSO_PORT) {
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index fe51cd9c..1750a5e3 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -181,19 +181,19 @@ PRIVATE char *parse_parameter ARGS2(
     do {
 	if ((string = strchr(string, ';')) == NULL)
 	    return NULL;
-	while (*string != '\0' && (*string == ';' || isspace(*string))) {
+	while (*string != '\0' && (*string == ';' || isspace(UCH(*string)))) {
 	    string++;
 	}
 	if (strlen(string) < len) return NULL;
     } while (strncasecomp(string, name, len) != 0);
     string += len;
-    while (*string != '\0' && (isspace(*string) || *string == '=')) {
+    while (*string != '\0' && (UCH(isspace(*string)) || *string == '=')) {
 	string++;
     }
 
     StrAllocCopy(result, string);
     len = 0;
-    while (isprint(string[len]) && string[len] != ';') {
+    while (isprint(UCH(string[len])) && string[len] != ';') {
 	len++;
     }
     result[len] = '\0';
@@ -387,7 +387,7 @@ PRIVATE int pumpData ARGS1(HTStream *, me)
 		LYmktime(me->anchor->date, TRUE)) {
 		me->anchor->no_cache = TRUE;
 	    }
-	} else if (LYmktime(me->anchor->expires, FALSE) <= 0) {
+	} else if (LYmktime(me->anchor->expires, FALSE) == 0) {
 	    /*
 	    **  We don't have a Date header, and
 	    **  the value is in past for us. - FM
@@ -474,7 +474,7 @@ PRIVATE int pumpData ARGS1(HTStream *, me)
 
 	if (url != NULL) {
 	    CTRACE((tfp, "Formatting refresh-url as first line of result\n"));
-	    while (isdigit(me->refresh_url[num]))
+	    while (isdigit(UCH(me->refresh_url[num])))
 	    	++num;
 	    HTSprintf0(&txt, gettext("Refresh: "));
 	    if (num != 0)
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index 2d8a8f5d..ce7c16df 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -59,7 +59,8 @@ PRIVATE char HTNewsGetCharacter NOPARAMS;
 #include <LYGlobalDefs.h>
 #include <LYLeaks.h>
 
-#define SnipIn(d,fmt,len,s) sprintf(d, fmt, (int)sizeof(d)-len, s)
+#define SnipIn(d,fmt,len,s)      sprintf(d, fmt,      (int)sizeof(d)-len, s)
+#define SnipIn2(d,fmt,tag,len,s) sprintf(d, fmt, tag, (int)sizeof(d)-len, s)
 
 struct _HTStructured {
 	CONST HTStructuredClass *	isa;
@@ -203,8 +204,8 @@ PRIVATE BOOL initialize NOARGS
 	cp = NULL;
     }
 #else
-    if (getenv("NNTPSERVER")) {
-	StrAllocCopy(HTNewsHost, (char *)getenv("NNTPSERVER"));
+    if (LYGetEnv("NNTPSERVER")) {
+	StrAllocCopy(HTNewsHost, LYGetEnv("NNTPSERVER"));
 	CTRACE((tfp, "HTNews: NNTPSERVER defined as `%s'\n",
 		    HTNewsHost));
     } else {
@@ -845,7 +846,7 @@ PRIVATE void post_article ARGS1(
     **	Open the temporary file with the
     **	nntp headers and message body. - FM
     */
-    if ((fd = fopen((postfile ? postfile : ""), TXT_R)) == NULL) {
+    if ((fd = fopen(NonNull(postfile), TXT_R)) == NULL) {
 	HTAlert(FAILED_CANNOT_OPEN_POST);
 	return;
     }
@@ -941,8 +942,7 @@ PRIVATE void post_article ARGS1(
 }
 
 #ifdef SH_EX	/* for MIME */
-#define NEWS_DEBUG 0
-#if NEWS_DEBUG
+#ifdef NEWS_DEBUG
 /* for DEBUG 1997/11/07 (Fri) 17:20:16 */
 void debug_print(unsigned char *p)
 {
@@ -984,7 +984,7 @@ static char *decode_mime(char *str)
 	    q = p + 1;
 	}
     }
-#if NEWS_DEBUG
+#ifdef NEWS_DEBUG
     printf("new=[");
     debug_print(temp);
 #endif
@@ -1143,7 +1143,7 @@ PRIVATE int read_article ARGS1(
 	if (from || replyto) {
 	    char *temp = NULL;
 	    StrAllocCopy(temp, author_address(replyto ? replyto : from));
-	    StrAllocCopy(href,"mailto:");
+	    StrAllocCopy(href, STR_MAILTO_URL);
 	    if (strchr(temp, '%') || strchr(temp, '?')) {
 		cp = HTEscape(temp, URL_XPALPHAS);
 		StrAllocCat(href, cp);
@@ -1289,7 +1289,7 @@ PRIVATE int read_article ARGS1(
 	    **	so add a link for posting followups for
 	    **	this article. - FM
 	    */
-	    if (!strncasecomp(NewsHREF, "snews:", 6))
+	    if (!strncasecomp(NewsHREF, STR_SNEWS_URL, 6))
 		StrAllocCopy(href,"snewsreply://");
 	    else
 		StrAllocCopy(href,"newsreply://");
@@ -1388,7 +1388,7 @@ PRIVATE int read_article ARGS1(
 	if (((char)ich == LF) || (p == &line[LINE_LENGTH])) {
 	    *p++ = '\0';			/* Terminate the string */
 	    CTRACE((tfp, "B %s", line));
-#if NEWS_DEBUG	/* 1997/11/09 (Sun) 15:56:11 */
+#ifdef NEWS_DEBUG	/* 1997/11/09 (Sun) 15:56:11 */
 	    debug_print(line);	/* @@@ */
 #endif
 	    if (line[0] == '.') {
@@ -1438,7 +1438,7 @@ PRIVATE int read_article ARGS1(
 			    p2 += 7;
 			    *p2 = 0;
 			    while (*l) {
-				if (strncmp(l, "news:", 5) &&
+				if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
 				    strncmp(l, "snews://", 8) &&
 				    strncmp(l, "nntp://", 7) &&
 				    strncmp(l, "snewspost:", 10) &&
@@ -1451,7 +1451,7 @@ PRIVATE int read_article ARGS1(
 				    strncmp(l, "http://", 7) &&
 				    strncmp(l, "https://", 8) &&
 				    strncmp(l, "wais://", 7) &&
-				    strncmp(l, "mailto:", 7) &&
+				    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
 				    strncmp(l, "cso://", 6) &&
 				    strncmp(l, "gopher://", 9)) {
 				    PUTC (*l++);
@@ -1477,7 +1477,7 @@ PRIVATE int read_article ARGS1(
 			}
 		    }
 		    while (*l) {		/* Last bit of the line */
-			if (strncmp(l, "news:", 5) &&
+			if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
 			    strncmp(l, "snews://", 8) &&
 			    strncmp(l, "nntp://", 7) &&
 			    strncmp(l, "snewspost:", 10) &&
@@ -1490,7 +1490,7 @@ PRIVATE int read_article ARGS1(
 			    strncmp(l, "http://", 7) &&
 			    strncmp(l, "https://", 8) &&
 			    strncmp(l, "wais://", 7) &&
-			    strncmp(l, "mailto:", 7) &&
+			    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
 			    strncmp(l, "cso://", 6) &&
 			    strncmp(l, "gopher://", 9))
 			    PUTC (*l++);
@@ -2094,7 +2094,7 @@ add_post:
 
 	START(HTML_HR);
 	PUTC('\n');
-	if (!strncasecomp(NewsHREF, "snews:", 6))
+	if (!strncasecomp(NewsHREF, STR_SNEWS_URL, 6))
 	    StrAllocCopy(href,"snewspost://");
 	else
 	    StrAllocCopy(href,"newspost://");
@@ -2175,7 +2175,7 @@ PRIVATE int HTLoadNews ARGS4(
 	**	xxxxx			News group (no "@")
 	**	group/n1-n2		Articles n1 to n2 in group
 	*/
-	normal_url = (BOOL) (!strncmp(arg, "news:", 5) || !strncmp(arg, "nntp:", 5));
+	normal_url = (BOOL) (!strncmp(arg, STR_NEWS_URL, LEN_NEWS_URL) || !strncmp(arg, "nntp:", 5));
 	spost_wanted = (BOOL) (!normal_url && strstr(arg, "snewspost:") != NULL);
 	sreply_wanted = (BOOL) (!(normal_url || spost_wanted) &&
 			 strstr(arg, "snewsreply:") != NULL);
@@ -2251,7 +2251,7 @@ PRIVATE int HTLoadNews ARGS4(
 	**  rules.  For instance, if the article reference contains a '#',
 	**  the rest of it is lost -- JFG 10/7/92, from a bug report
 	*/
-	} else if (!strncasecomp (arg, "nntp:", 5)) {
+	} else if (isNNTP_URL(arg)) {
 	    if (((*(arg + 5) == '\0') ||
 		 (!strcmp((arg + 5), "/") ||
 		  !strcmp((arg + 5), "//") ||
@@ -2282,10 +2282,10 @@ PRIVATE int HTLoadNews ARGS4(
 		StrAllocCopy(NewsHost, cp);
 	    }
 	    FREE(cp);
-	    SnipIn(command, "nntp://%.*s/", 9, NewsHost);
+	    SnipIn2(command, "%s//%.*s/", STR_NNTP_URL, 9, NewsHost);
 	    StrAllocCopy(NewsHREF, command);
 	}
-	else if (!strncasecomp(arg, "snews:", 6)) {
+	else if (!strncasecomp(arg, STR_SNEWS_URL, 6)) {
 #ifdef USE_SSL
 	    if (((*(arg + 6) == '\0') ||
 		 (!strcmp((arg + 6), "/") ||
@@ -2317,7 +2317,7 @@ PRIVATE int HTLoadNews ARGS4(
 	    StrAllocCopy(NewsHost, cp);
 	    }
 	    FREE(cp);
-	    sprintf(command, "snews://%.250s/", NewsHost);
+	    sprintf(command, "%s//%.250s/", STR_SNEWS_URL, NewsHost);
 	    StrAllocCopy(NewsHREF, command);
 #else
 	    HTAlert(gettext("This client does not contain support for SNEWS URLs."));
@@ -2366,7 +2366,7 @@ PRIVATE int HTLoadNews ARGS4(
 		s = -1;
 	    }
 	    StrAllocCopy(NewsHost, HTNewsHost);
-	    StrAllocCopy(NewsHREF, "news:");
+	    StrAllocCopy(NewsHREF, STR_NEWS_URL);
 	}
 
 	/*
@@ -2375,15 +2375,15 @@ PRIVATE int HTLoadNews ARGS4(
 	**  doing the conversion itself, and for handling posts
 	**  or followups.  - TZ & FM
 	*/
-	if (!strncasecomp(p1, "snews:", 6) ||
+	if (!strncasecomp(p1, STR_SNEWS_URL, 6) ||
 	    !strncasecomp(p1, "snewspost:", 10) ||
 	    !strncasecomp(p1, "snewsreply:", 11)) {
 	    StrAllocCopy(ProxyHost, NewsHost);
 	    if ((cp = HTParse(p1, "", PARSE_HOST)) != NULL && *cp != '\0') {
-		SnipIn(command, "snews://%.*s", 10, cp);
+		SnipIn2(command, "%s//%.*s", STR_SNEWS_URL, 10, cp);
 		StrAllocCopy(NewsHost, cp);
 	    } else {
-		SnipIn(command, "snews://%.*s", 10, NewsHost);
+		SnipIn2(command, "%s//%.*s", STR_SNEWS_URL, 10, NewsHost);
 	    }
 	    command[sizeof(command)-2] = '\0';
 	    FREE(cp);
@@ -2549,7 +2549,7 @@ PRIVATE int HTLoadNews ARGS4(
 	if (s < 0) {
 	    /* CONNECTING to news host */
 	    char url[260];
-	    if (!strcmp(NewsHREF, "news:")) {
+	    if (!strcmp(NewsHREF, STR_NEWS_URL)) {
 		SnipIn (url, "lose://%.*s/", 9, NewsHost);
 	    } else if (ProxyHREF) {
 		SnipIn (url, "%.*s", 1, ProxyHREF);
@@ -2562,7 +2562,7 @@ PRIVATE int HTLoadNews ARGS4(
 
 #ifdef USE_SSL
 	    if (!using_proxy &&
-		(!strncmp(arg, "snews:", 6) ||
+		(!strncmp(arg, STR_SNEWS_URL, 6) ||
 		 !strncmp(arg, "snewspost:", 10) ||
 		 !strncmp(arg, "snewsreply:", 11)))
 		status = HTDoConnect (url, "NNTPS", SNEWS_PORT, &s);
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index 34703652..4b09e64a 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -5,6 +5,7 @@
 #include <HTUtils.h>
 #include <HTParse.h>
 
+#include <LYUtils.h>
 #include <LYLeaks.h>
 
 #define HEX_ESCAPE '%'
@@ -150,19 +151,6 @@ PRIVATE void scan ARGS2(
 	    }
 	}
     }
-
-#ifdef NOT_DEFINED	/* search is just treated as part of path */
-    {
-	char *p = (relative ? relative : absolute);
-	if (p != NULL) {
-	    char *q = strchr(p, '?');	/* Any search string? */
-	    if (q != NULL) {
-		*q = '\0';		/* If so, chop that off. */
-		parts->search = (q + 1);
-	    }
-	}
-    }
-#endif /* NOT_DEFINED */
 } /*scan */
 
 
@@ -420,9 +408,9 @@ PUBLIC char * HTParse ARGS3(
 	    strcat(result, related.relative);
 	    CTRACE((tfp, "HTParse: (Related-REL)\n"));
 	} else {  /* No inheritance */
-	    if (strncasecomp(aName, "lynxcgi:", 8) &&
-		strncasecomp(aName, "lynxexec:", 9) &&
-		strncasecomp(aName, "lynxprog:", 9)) {
+	    if (!isLYNXCGI(aName) &&
+		!isLYNXEXEC(aName) &&
+		!isLYNXPROG(aName)) {
 		strcat(result, "/");
 	    }
 	    if (!strcmp(result, "news:/"))
@@ -697,8 +685,8 @@ PUBLIC char * HTRelative ARGS2(
     return result;
 }
 
-/*		Escape undesirable characters using %		HTEscape()
-**		-------------------------------------
+/*	Escape undesirable characters using %			HTEscape()
+**	-------------------------------------
 **
 **	This function takes a pointer to a string in which
 **	some characters may be unacceptable unescaped.
@@ -711,7 +699,7 @@ PRIVATE CONST unsigned char isAcceptable[96] =
 
 /*	Bit 0		xalpha		-- see HTFile.h
 **	Bit 1		xpalpha		-- as xalpha but with plus.
-**	Bit 3 ...	path		-- as xpalphas but with /
+**	Bit 2 ...	path		-- as xpalphas but with /
 */
     /*	 0 1 2 3 4 5 6 7 8 9 A B C D E F */
     {	 0,0,0,0,0,0,0,0,0,0,7,6,0,7,7,4,	/* 2x	!"#$%&'()*+,-./  */
@@ -741,13 +729,51 @@ PUBLIC char * HTEscape ARGS2(
     for (q = result, p = str; *p; p++) {
 	unsigned char a = TOASCII(*p);
 	if (!ACCEPTABLE(a)) {
-	    *q++ = HEX_ESCAPE;	/* Means hex commming */
+	    *q++ = HEX_ESCAPE;	/* Means hex coming */
 	    *q++ = hex[a >> 4];
 	    *q++ = hex[a & 15];
 	}
 	else *q++ = *p;
     }
-    *q++ = '\0';			/* Terminate */
+    *q++ = '\0';		/* Terminate */
+    return result;
+}
+
+/*	Escape unsafe characters using %			HTEscapeUnsafe()
+**	--------------------------------
+**
+**	This function takes a pointer to a string in which
+**	some characters may be that may be unsafe are unescaped.
+**	It returns a string which has these characters
+**	represented by a '%' character followed by two hex digits.
+**
+**	Unlike HTUnEscape(), this routine returns a malloc'd string.
+*/
+#define UNSAFE(ch) (((ch) <= 32) || ((ch) >= 127))
+
+PUBLIC char *HTEscapeUnsafe ARGS1(
+	CONST char *,	str)
+{
+    CONST char * p;
+    char * q;
+    char * result;
+    int unacceptable = 0;
+    for (p = str; *p; p++)
+	if (UNSAFE(UCH(TOASCII(*p))))
+	    unacceptable++;
+    result = typecallocn(char, p-str + unacceptable + unacceptable + 1);
+    if (result == NULL)
+	outofmem(__FILE__, "HTEscapeUnsafe");
+    for (q = result, p = str; *p; p++) {
+	unsigned char a = TOASCII(*p);
+	if (UNSAFE(a)) {
+	    *q++ = HEX_ESCAPE;	/* Means hex coming */
+	    *q++ = hex[a >> 4];
+	    *q++ = hex[a & 15];
+	}
+	else *q++ = *p;
+    }
+    *q++ = '\0';		/* Terminate */
     return result;
 }
 
diff --git a/WWW/Library/Implementation/HTParse.h b/WWW/Library/Implementation/HTParse.h
index 0f433bb0..39f276a4 100644
--- a/WWW/Library/Implementation/HTParse.h
+++ b/WWW/Library/Implementation/HTParse.h
@@ -113,26 +113,39 @@ extern char * HTRelative PARAMS((
 **		-------------------------------------
 **
 **	This function takes a pointer to a string in which
-**	some characters may be unacceptable unescaped.
+**	some characters may be unacceptable are unescaped.
 **	It returns a string which has these characters
 **	represented by a '%' character followed by two hex digits.
 **
-**	Unlike HTUnEscape(), this routine returns a malloced string.
+**	Unlike HTUnEscape(), this routine returns a malloc'd string.
 */
 extern char * HTEscape PARAMS((
 	CONST char *	str,
 	unsigned char	mask));
 
+/*		Escape unsafe characters using %		HTEscapeUnsafe()
+**		--------------------------------
+**
+**	This function takes a pointer to a string in which
+**	some characters may be that may be unsafe are unescaped.
+**	It returns a string which has these characters
+**	represented by a '%' character followed by two hex digits.
+**
+**	Unlike HTUnEscape(), this routine returns a malloc'd string.
+*/
+extern char * HTEscapeUnsafe PARAMS((
+	CONST char *	str));
+
 /*	Escape undesirable characters using % but space to +.	HTEscapeSP()
 **	-----------------------------------------------------
 **
 **	This function takes a pointer to a string in which
-**	some characters may be unacceptable unescaped.
+**	some characters may be unacceptable are unescaped.
 **	It returns a string which has these characters
 **	represented by a '%' character followed by two hex digits,
 **	except that spaces are converted to '+' instead of %2B.
 **
-**	Unlike HTUnEscape(), this routine returns a malloced string.
+**	Unlike HTUnEscape(), this routine returns a malloc'd string.
 */
 extern char * HTEscapeSP PARAMS((
 	CONST char *	str,
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index 1d5beeb1..d753edc8 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -99,6 +99,13 @@ extern char *sys_errlist[];		/* see man perror on cernvax */
 extern int sys_nerr;
 #endif /* DECL_SYS_ERRLIST */
 
+#ifdef __DJGPP__
+static int ResolveYield (void)
+{
+    return HTCheckForInterrupt() ? 0 : 1;
+}
+#endif
+
 #ifdef _WINDOWS_NSL
 char host[512];
 struct hostent  *phost;	/* Pointer to host - See netdb.h */
@@ -641,6 +648,11 @@ PUBLIC struct hostent * LYGetHostByName ARGS1(
 #ifndef _WINDOWS_NSL
     char *host = str;
 #endif
+
+#ifdef __DJGPP__
+    _resolve_hook = ResolveYield;
+#endif
+
 #ifdef NSL_FORK
     /* for transfer of result between from child to parent: */
     static AlignedHOSTENT aligned_full_rehostent;
@@ -728,7 +740,7 @@ PUBLIC struct hostent * LYGetHostByName ARGS1(
 	**	Pipe, child pid, status buffers, start time, select()
 	**	control variables.
 	*/
-	pid_t fpid, waitret;
+	int fpid, waitret;
 	int pfd[2], selret, readret;
 #ifdef HAVE_TYPE_UNIONWAIT
 	union wait waitstat;
@@ -1074,7 +1086,7 @@ PUBLIC struct hostent * LYGetHostByName ARGS1(
 #endif /* WCOREDUMP */
 	    } else if (WIFSTOPPED(waitstat)) {
 		CTRACE((tfp, "LYGetHostByName: NSL_FORK child %d is stopped, status 0x%x!\n",
-			(int)waitret, WEXITSTATUS(waitstat)));
+			(int)waitret, WSTOPSIG(waitstat)));
 	    }
 	}
 	if (!got_rehostent) {
@@ -1368,7 +1380,7 @@ HTGetAddrInfo ARGS2(
     char *p;
     char *s;
     char *host, *port;
-    char pbuf[10];
+    char pbuf[80];
 
     s = strdup(str);
 
@@ -1383,7 +1395,7 @@ HTGetAddrInfo ARGS2(
     if (port) {
 	*port++ = '\0';
     } else {
-	snprintf(pbuf, sizeof(pbuf), "%d", defport);
+	sprintf(pbuf, "%d", defport);
 	port = pbuf;
     }
 
@@ -1449,9 +1461,9 @@ PRIVATE void get_host_details NOARGS
     **	Get rest from UCX$BIND_DOM logical.
     */
     if (strchr(hostname,'.') == NULL) {		  /* Not full address */
-	domain_name = getenv("UCX$BIND_DOMAIN");
+	domain_name = LYGetEnv("UCX$BIND_DOMAIN");
 	if (domain_name == NULL)
-	    domain_name = getenv("TCPIP$BIND_DOMAIN");
+	    domain_name = LYGetEnv("TCPIP$BIND_DOMAIN");
 	if (domain_name != NULL) {
 	    StrAllocCat(hostname, ".");
 	    StrAllocCat(hostname, domain_name);
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 62175551..3dfad753 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -70,6 +70,8 @@ extern BOOL dump_output_immediately;  /* TRUE if no interactive user */
 
 #ifdef USE_SSL
 PUBLIC SSL_CTX * ssl_ctx = NULL;	/* SSL ctx */
+PUBLIC SSL * SSL_handle = NULL;
+PUBLIC int ssl_okay;
 
 PRIVATE void free_ssl_ctx NOARGS
 {
@@ -77,6 +79,25 @@ PRIVATE void free_ssl_ctx NOARGS
 	SSL_CTX_free(ssl_ctx);
 }
 
+PRIVATE int HTSSLCallback(int preverify_ok, X509_STORE_CTX *x509_ctx)
+{
+    char *msg = NULL;
+    int result = 1;
+
+    if (!(preverify_ok || ssl_okay)) {
+
+	HTSprintf0(&msg, "SSL error:%s-Continue?",
+		   X509_verify_cert_error_string(X509_STORE_CTX_get_error(x509_ctx)));
+	if (HTConfirmDefault(msg, TRUE))
+	    ssl_okay = 1;
+	else
+	    result = 0;
+
+	FREE(msg);
+    }
+    return result;
+}
+
 PUBLIC SSL * HTGetSSLHandle NOARGS
 {
     if (ssl_ctx == NULL) {
@@ -91,9 +112,11 @@ PUBLIC SSL * HTGetSSLHandle NOARGS
 	ssl_ctx = SSL_CTX_new(SSLv23_client_method());
 	SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL);
 	SSL_CTX_set_default_verify_paths(ssl_ctx);
+	SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, HTSSLCallback);
 #endif /* SSLEAY_VERSION_NUMBER < 0x0800 */
 	atexit(free_ssl_ctx);
     }
+    ssl_okay = 0;
     return(SSL_new(ssl_ctx));
 }
 
@@ -103,7 +126,7 @@ PUBLIC void HTSSLInitPRNG NOARGS
     if (RAND_status() == 0) {
 	char rand_file[256];
 	time_t t;
-	pid_t pid;
+	int pid;
 	long l,seed;
 
 	t = time(NULL);
@@ -117,7 +140,7 @@ PUBLIC void HTSSLInitPRNG NOARGS
 	/* Seed in time (mod_ssl does this) */
 	RAND_seed((unsigned char *)&t, sizeof(time_t));
 	/* Seed in pid (mod_ssl does this) */
-	RAND_seed((unsigned char *)&pid, sizeof(pid_t));
+	RAND_seed((unsigned char *)&pid, sizeof(pid));
 	/* Initialize system's random number generator */
 	RAND_bytes((unsigned char *)&seed, sizeof(long));
 	lynx_srand(seed);
@@ -140,7 +163,7 @@ PUBLIC void HTSSLInitPRNG NOARGS
 #define HTTP_NETWRITE(sock, buff, size, handle) \
 	(handle ? SSL_write(handle, buff, size) : NETWRITE(sock, buff, size))
 #define HTTP_NETCLOSE(sock, handle)  \
-	{ (void)NETCLOSE(sock); if (handle) SSL_free(handle); handle = NULL; }
+	{ (void)NETCLOSE(sock); if (handle) SSL_free(handle); SSL_handle = handle = NULL; }
 
 #else
 #define HTTP_NETREAD(a, b, c, d)   NETREAD(a, b, c)
@@ -323,7 +346,7 @@ PUBLIC int ws_netread(int fd, char *buf, int len)
 
 /*
  * Strip any username from the given string so we retain only the host.
- * If the 
+ * If the
  */
 PRIVATE void strip_userid ARGS1(
 	char *,		host)
@@ -408,10 +431,15 @@ PRIVATE int HTLoadHTTP ARGS4 (
   CONST char *connect_url = NULL; /* The URL being proxied */
   char *connect_host = NULL;	/* The host being proxied */
   SSL * handle = NULL;		/* The SSL handle */
-  char SSLprogress[256];	/* progress bar message */
+  char ssl_dn[256];
+  char *cert_host;
+  char *ssl_host;
+  char *p;
+  char *msg = NULL;
 #if SSLEAY_VERSION_NUMBER >= 0x0900
   BOOL try_tls = TRUE;
 #endif /* SSLEAY_VERSION_NUMBER >= 0x0900 */
+  SSL_handle = NULL;
 #else
   void * handle = NULL;
 #endif /* USE_SSL */
@@ -528,7 +556,7 @@ use_tunnel:
   ** then do the SSL stuff here
   */
   if (did_connect || !strncmp(url, "https", 5)) {
-      handle = HTGetSSLHandle();
+      SSL_handle = handle = HTGetSSLHandle();
       SSL_set_fd(handle, s);
 #if SSLEAY_VERSION_NUMBER >= 0x0900
       if (!try_tls)
@@ -540,8 +568,7 @@ use_tunnel:
       if (status <= 0) {
 #if SSLEAY_VERSION_NUMBER >= 0x0900
 	  if (try_tls) {
-	      CTRACE((tfp, "HTTP: Retrying connection without TLS\n"));
-	      _HTProgress("Retrying connection.");
+	      _HTProgress(gettext("Retrying connection without TLS."));
 	      try_tls = FALSE;
 	      if (did_connect)
 		  HTTP_NETCLOSE(s, handle);
@@ -577,20 +604,32 @@ use_tunnel:
 	  goto done;
 #endif /* SSLEAY_VERSION_NUMBER >= 0x0900 */
       }
-      sprintf(SSLprogress,"Secure %d-bit %s (%s) HTTP connection",SSL_get_cipher_bits(handle,NULL),SSL_get_cipher_version(handle),SSL_get_cipher(handle));
-      _HTProgress(SSLprogress);
-
-#ifdef NOTDEFINED
-      if (strcmp(HTParse(url, "", PARSE_HOST),
-		 strstr(X509_NAME_oneline(
-			X509_get_subject_name(
-				handle->session->peer)),"/CN=")+4)) {
-	  HTAlert("Certificate is for different host name");
-	  HTAlert(strstr(X509_NAME_oneline(
-			 X509_get_subject_name(
-				handle->session->peer)),"/CN=")+4);
+
+      X509_NAME_oneline(X509_get_subject_name(SSL_get_peer_certificate(handle)),
+		        ssl_dn, sizeof(ssl_dn));
+      cert_host = strstr(ssl_dn, "/CN=") + 4;
+      if ((p = strchr(cert_host, '/')) != NULL)
+	  *p = '\0';
+      ssl_host = HTParse(url, "", PARSE_HOST);
+      if (strcmp(ssl_host, cert_host)) {
+	  HTSprintf0(&msg,
+		     gettext("SSL error:host(%s)!=cert(%s)-Continue?"),
+		     ssl_host,
+		     cert_host);
+	  if (! HTConfirmDefault(msg, TRUE)) {
+	      status = HT_NOT_LOADED;
+	      FREE(msg);
+	      goto done;
+	  }
       }
-#endif /* NOTDEFINED */
+
+      HTSprintf0(&msg,
+		 gettext("Secure %d-bit %s (%s) HTTP connection"),
+		 SSL_get_cipher_bits(handle, NULL),
+		 SSL_get_cipher_version(handle),
+		 SSL_get_cipher(handle));
+      _HTProgress(msg);
+      FREE(msg);
   }
 #endif /* USE_SSL */
 
@@ -712,8 +751,19 @@ use_tunnel:
       if (LYPrependBaseToSource && dump_output_immediately) {
 	  CTRACE((tfp, "omit Accept-Encoding to work-around interaction with -source\n"));
       } else {
-	  HTSprintf(&command, "Accept-Encoding: %s, %s%c%c",
-		    "gzip", "compress", CR, LF);
+	  char *list = 0;
+#if defined(USE_ZLIB) || defined(GZIP_PATH)
+	  StrAllocCopy(list, "gzip");
+#endif
+#if defined(USE_ZLIB) || defined(COMPRESS_PATH)
+	  if (list != 0)
+	      StrAllocCat(list, ", ");
+	  StrAllocCat(list, "compress");
+#endif
+	  if (list != 0) {
+	      HTSprintf(&command, "Accept-Encoding: %s%c%c", list, CR, LF);
+	      free(list);
+	  }
       }
 
       if (language && *language) {
@@ -796,13 +846,10 @@ use_tunnel:
 	  char *cp = LYRequestReferer;
 	  if (!cp) cp = HTLoadedDocumentURL(); /* @@@ Try both? - kw */
 	  StrAllocCat(command, "Referer: ");
-	  if (!strncasecomp(cp, "LYNXIMGMAP:", 11)) {
-	      char *cp1 = strchr(cp, '#');
-	      if (cp1)
-		  *cp1 = '\0';
-	      StrAllocCat(command, cp + 11);
-	      if (cp1)
-		  *cp1 = '#';
+	  if (isLYNXIMGMAP(cp)) {
+	      char *cp1 = trimPoundSelector(cp);
+	      StrAllocCat(command, cp + LEN_LYNXIMGMAP);
+	      restorePoundSelector(cp1);
 	  } else {
 	      StrAllocCat(command, cp);
 	  }
@@ -2070,7 +2117,7 @@ done:
   FREE(connect_host);
   if (handle) {
     SSL_free(handle);
-    handle = NULL;
+    SSL_handle = handle = NULL;
   }
 #endif /* USE_SSL */
   return status;
diff --git a/WWW/Library/Implementation/HTTP.h b/WWW/Library/Implementation/HTTP.h
index cd6925f2..b8212a98 100644
--- a/WWW/Library/Implementation/HTTP.h
+++ b/WWW/Library/Implementation/HTTP.h
@@ -24,6 +24,10 @@ extern char * redirecting_url;
 extern BOOL permanent_redirection;
 extern BOOL redirect_post_content;
 
+#ifdef USE_SSL
+extern SSL * SSL_handle;
+#endif
+
 #endif /* HTTP_H */
 
 /*
diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c
index e01043c3..e5182b90 100644
--- a/WWW/Library/Implementation/HTTelnet.c
+++ b/WWW/Library/Implementation/HTTelnet.c
@@ -213,22 +213,22 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	if (login_protocol == rlogin) {
 	    HTSprintf0(&command, "RLOGIN%s%s%s%s%s %s",  /*lm 930713 */
 		user ? "/USERNAME=\"" : "",
-		user ? user : "",
+		NonNull(user),
 		user ? "\"" : "",
 		port ? "/PORT=" : "",
-		port ? port : "",
+		NonNull(port),
 		hostname);
 
 	} else if (login_protocol == tn3270) {
 	    HTSprintf0(&command, "TELNET/TN3270 %s%s %s",
 		port ? "/PORT=" : "",
-		port ? port : "",
+		NonNull(port),
 		hostname);
 
 	} else {  /* TELNET */
 	    HTSprintf0(&command, "TELNET %s%s %s",
 		port ? "/PORT=" : "",
-		port ? port : "",
+		NonNull(port),
 		hostname);
 	}
 
@@ -242,22 +242,22 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	    if (login_protocol == rlogin) {
 		HTSprintf0(&command, "RLOGIN%s%s%s%s%s %s",  /*lm 930713 */
 		    user ? "/USERNAME=\"" : "",
-		    user ? user : "",
+		    NonNull(user),
 		    user ? "\"" : "",
 		    port ? "/PORT=" : "",
-		    port ? port : "",
+		    NonNull(port),
 		    hostname);
 
 	    } else if (login_protocol == tn3270) {
 		HTSprintf0(&command, "TELNET/TN3270 %s%s %s",
 		    port ? "/PORT=" : "",
-		    port ? port : "",
+		    NonNull(port),
 		    hostname);
 
 	    } else {  /* TELNET */
 		HTSprintf0(&command, "TELNET %s%s %s",
 		    port ? "/PORT=" : "",
-		    port ? port : "",
+		    NonNull(port),
 		    hostname);
 	    }
 
@@ -267,18 +267,18 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 		   hostname,
 		   user ? " -l " : "",
 		   user ? "\"" : "",
-		   user ? user : "",
+		   NonNull(user),
 		   user ? "\"" : "");
 
 	    } else if (login_protocol == tn3270) {
 		HTSprintf0(&command, "TN3270 %s %s",
 		    hostname,
-		    port ? port : "");
+		    NonNull(port));
 
 	    } else {  /* TELNET */
 		HTSprintf0(&command, "TELNET %s %s",
 		    hostname,
-		    port ? port : "");
+		    NonNull(port));
 	    }
 	}
 
@@ -290,20 +290,20 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	if (login_protocol == rlogin) {
 	    HTSprintf0(&command, "RLOGIN%s%s%s %s %s",
 		user ? "/USERNAME=\"" : "",
-		user ? user : "",
+		NonNull(user),
 		user ? "\"" : "",
 		hostname,
-		port ? port : "");
+		NonNull(port));
 
 	} else if (login_protocol == tn3270) {
 	    HTSprintf0(&command, "TN3270 %s %s",
 		hostname,
-		port ? port : "");
+		NonNull(port));
 
 	} else {  /* TELNET */
 	    HTSprintf0(&command, "TELNET %s %s",
 		hostname,
-		port ? port : "");
+		NonNull(port));
 	}
 
 	do_system(command);
@@ -314,7 +314,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	if (login_protocol == telnet) {
 	    HTSprintf0(&command, "TELNET %s%s %s",
 		port ? "/PORT=" : "",
-		port ? port : "",
+		NonNull(port),
 		hostname);
 	    do_system(command);
 	}
@@ -336,21 +336,21 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	if (login_protocol == rlogin) {
 	    HTSprintf0(&command, "MULTINET RLOGIN%s%s%s%s %s",  /*lm 930713 */
 		user ? "/USERNAME=" : "",
-		user ? user : "",
+		NonNull(user),
 		port ? "/PORT=" : "",
-		port ? port : "",
+		NonNull(port),
 		hostname);
 
 	} else if (login_protocol == tn3270) {
 	    HTSprintf0(&command, "MULTINET TELNET/TN3270 %s%s %s",
 		port ? "/PORT=" : "",
-		port ? port : "",
+		NonNull(port),
 		hostname);
 
 	} else {  /* TELNET */
 	    HTSprintf0(&command, "MULTINET TELNET %s%s %s",
 		port ? "/PORT=" : "",
-		port ? port : "",
+		NonNull(port),
 		hostname);
 	}
 
@@ -362,19 +362,19 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	    if (login_protocol == rlogin) {
 		HTSprintf0(&command, "RLOGIN%s%s%s%s %s",  /*lm 930713 */
 		    user ? "/USERNAME=" : "",
-		    user ? user : "",
+		    NonNull(user),
 		    port ? "/PORT=" : "",
-		    port ? port : "",
+		    NonNull(port),
 		    hostname);
 	    } else if (login_protocol == tn3270) {
 		HTSprintf0(&command, "TELNET/TN3270 %s%s %s",
 		    port ? "/PORT=" : "",
-		    port ? port : "",
+		    NonNull(port),
 		    hostname);
 	    } else {  /* TELNET */
 		HTSprintf0(&command, "TELNET %s%s %s",
 		    port ? "/PORT=" : "",
-		    port ? port : "",
+		    NonNull(port),
 		    hostname);
 	    }
 	} else { /* UNIX command syntax */
@@ -382,15 +382,15 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 		HTSprintf0(&command, "RLOGIN %s%s%s",
 		    hostname,
 		    user ? " -l " : "",
-		    user ? user : "");
+		    NonNull(user));
 	    } else if (login_protocol == tn3270) {
 		HTSprintf0(&command, "TN3270 %s %s",
 		    hostname,
-		    port ? port : "");
+		    NonNull(port));
 	    } else {  /* TELNET */
 		HTSprintf0(&command, "TELNET %s %s",
 		    hostname,
-		    port ? port : "");
+		    NonNull(port));
 	    }
 	}
 
@@ -402,19 +402,19 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	if (login_protocol == rlogin) {
 	    HTSprintf0(&command, "RLOGIN%s%s %s %s",
 		user ? "/USERNAME=" : "",
-		user ? user : "",
+		NonNull(user),
 		hostname,
-		port ? port : "");
+		NonNull(port));
 
 	} else if (login_protocol == tn3270) {
 	    HTSprintf0(&command, "TN3270 %s %s",
 		hostname,
-		port ? port : "");
+		NonNull(port));
 
 	} else {  /* TELNET */
 	    HTSprintf0(&command, "TELNET %s %s",
 		hostname,
-		port ? port : "");
+		NonNull(port));
 	}
 
 	do_system(command);
@@ -424,7 +424,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	if (login_protocol == telnet) {
 	    HTSprintf0(&command, "TELNET %s%s %s",
 		port ? "/PORT=" : "",
-		port ? port : "",
+		NonNull(port),
 		hostname);
 	    do_system(command);
 	}
@@ -443,7 +443,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	if (login_protocol == telnet) {
 	    HTSprintf0(&command, "TELNET %s%s %s",
 		port ? "/PORT=" : "",
-		port ? port : "",
+		NonNull(port),
 		hostname);
 	    do_system(command);
 	}
@@ -528,7 +528,7 @@ ARGS4
 	CTRACE((tfp, "HTTelnet: Can't output a live session -- must be interactive!\n"));
 	return HT_NO_DATA;
     }
-    acc_method =  HTParse(addr, "file:", PARSE_ACCESS);
+    acc_method =  HTParse(addr, STR_FILE_URL, PARSE_ACCESS);
 
     host = HTParse(addr, "", PARSE_HOST);
     if (!host || *host == '\0') {
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index 95e15456..8b097216 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -175,6 +175,18 @@ typedef unsigned short mode_t;
 #  define USE_BLINK
 #endif
 
+#if defined(DOSPATH) || defined(__EMX__)
+#  define USE_DOS_DRIVES	/* we allow things like "c:" in paths */
+#endif
+
+#if defined(UNIX)
+#  if (defined(__BEOS__) || defined(__CYGWIN__) || defined(__EMX__))
+#    define SINGLE_USER_UNIX	/* well, at least they try */
+#  else
+#    define MULTI_USER_UNIX
+#  endif
+#endif
+
 /*
 
   ERROR TYPE
@@ -311,6 +323,7 @@ Macros for declarations
 #define NULL ((void *)0)
 #endif
 
+#define NonNull(s) (((s) != 0) ? s : "")
 #define NONNULL(s) (((s) != 0) ? s : "(null)")
 
 /* array/table size */
@@ -431,7 +444,7 @@ are generally not the response status from any specific protocol.
  * their parameters).
  */
 #ifndef GCC_PRINTFLIKE
-#if defined(GCC_PRINTF) && !defined(printf)
+#if defined(GCC_PRINTF) && !defined(printf) && !defined(HAVE_LIBUTF8_H)
 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
 #else
 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
@@ -590,7 +603,7 @@ extern char HTGetSSLCharacter PARAMS((void * handle));
 
 #endif /* USE_SSL */
 
-#if HAVE_LIBDMALLOC
+#ifdef HAVE_LIBDMALLOC
 #include <dmalloc.h>    /* Gray Watson's library */
 #define show_alloc() dmalloc_log_unfreed()
 #else
@@ -598,7 +611,7 @@ extern char HTGetSSLCharacter PARAMS((void * handle));
 #define HAVE_LIBDMALLOC 0
 #endif
 
-#if HAVE_LIBDBMALLOC
+#ifdef HAVE_LIBDBMALLOC
 #include <dbmalloc.h>   /* Conor Cahill's library */
 #define show_alloc() malloc_dump(fileno(stderr))
 #else
diff --git a/WWW/Library/Implementation/HTVMSUtils.c b/WWW/Library/Implementation/HTVMSUtils.c
index 5d372035..98dc8f77 100644
--- a/WWW/Library/Implementation/HTVMSUtils.c
+++ b/WWW/Library/Implementation/HTVMSUtils.c
@@ -752,7 +752,7 @@ PUBLIC int HTVMSBrowseDir ARGS4(
     struct stat file_info;
     time_t NowTime;
     static char ThisYear[8];
-    VMSEntryInfo *entry_info=0;
+    VMSEntryInfo *entry_info = 0;
     char string_buffer[64];
     extern BOOLEAN no_dotfiles, show_dotfiles;
 
@@ -766,10 +766,10 @@ PUBLIC int HTVMSBrowseDir ARGS4(
      *  to /sys$sysroot/syshlp) before calling this routine.
      */
     if (((*pathname != '/') ||
-	 (cp=strchr(pathname+1, '/')) == NULL ||
-	 *(cp+1) == '\0' ||
-	 0==strncmp((cp+1), "000000", 6)) ||
-	(dp=HTVMSopendir(pathname)) == NULL) {
+	 (cp = strchr(pathname+1, '/')) == NULL ||
+	 *(cp + 1) == '\0' ||
+	 0 == strncmp((cp + 1), "000000", 6)) ||
+	(dp = HTVMSopendir(pathname)) == NULL) {
 	FREE(pathname);
 	return HTLoadError(sink, 403, COULD_NOT_ACCESS_DIR);
     }
diff --git a/WWW/Library/Implementation/HTWAIS.c b/WWW/Library/Implementation/HTWAIS.c
index 86e8701d..035ebbe5 100644
--- a/WWW/Library/Implementation/HTWAIS.c
+++ b/WWW/Library/Implementation/HTWAIS.c
@@ -123,7 +123,7 @@ PRIVATE int fd_mosaic_connect_to_server ARGS3(
     int status;
     int result;
 
-    HTSprintf0(&dummy, "wais://%s:%d/", host_name, port);
+    HTSprintf0(&dummy, "%s//%s:%d/", STR_WAIS_URL, host_name, port);
 
     status = HTDoConnect (dummy, "WAIS", 210, (int *)fd);
     if (status == HT_INTERRUPTED) {
diff --git a/WWW/Library/Implementation/HTWSRC.c b/WWW/Library/Implementation/HTWSRC.c
index 9d69669b..9071baac 100644
--- a/WWW/Library/Implementation/HTWSRC.c
+++ b/WWW/Library/Implementation/HTWSRC.c
@@ -11,7 +11,7 @@
 #include <HTUtils.h>
 
 #include <HTWSRC.h>
-
+#include <LYUtils.h>
 
 #include <HTML.h>
 #include <HTParse.h>
@@ -335,7 +335,8 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
 	    char * www_database;
 	    www_database = HTEscape(me->par_value[PAR_DATABASE_NAME],
 		URL_XALPHAS);
-	    HTSprintf0(&WSRC_address, "wais://%s%s%s/%s",
+	    HTSprintf0(&WSRC_address, "%s//%s%s%s/%s",
+		STR_WAIS_URL,
 		me->par_value[PAR_IP_NAME],
 		me->par_value[PAR_TCP_PORT] ? ":" : "",
 		me->par_value[PAR_TCP_PORT] ? me->par_value[PAR_TCP_PORT] :"",
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index 6497f8ea..a11532c2 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -1806,7 +1806,8 @@ top1:
     CTRACE2(TRACE_SGML, (tfp, "SGML before %s|%.*s|%c\n",
 	    state_name(context->state),
 	    string->size,
-	    string->data != NULL ? string->data : "", UCH(c)));
+	    NonNull(string->data),
+	    UCH(c)));
     switch(context->state) {
 
     case S_in_kanji:
@@ -4333,7 +4334,8 @@ top1:
     CTRACE2(TRACE_SGML, (tfp, "SGML after  %s|%.*s|%c\n",
 	    state_name(context->state),
 	    string->size,
-	    string->data != NULL ? string->data : "", UCH(c)));
+	    NonNull(string->data),
+	    UCH(c)));
 
 after_switch:
     /*
diff --git a/WWW/Library/Implementation/www_tcp.h b/WWW/Library/Implementation/www_tcp.h
index ff8cceb3..b2aafd2b 100644
--- a/WWW/Library/Implementation/www_tcp.h
+++ b/WWW/Library/Implementation/www_tcp.h
@@ -192,10 +192,6 @@ extern int ws_netread(int fd, char *buf, int len);
 #include <errno.h>
 #include <direct.h>
 
-#ifndef pid_t
-typedef int pid_t;
-#endif /* !pid_t */
-
 #ifdef USE_WINSOCK2_H
 #include <winsock2.h>		/* normally included in windows.h */
 
@@ -635,10 +631,6 @@ Regular BSD unix versions
 typedef unsigned short mode_t;
 #endif /* !mode_t */
 
-#ifndef pid_t
-typedef int pid_t;
-#endif /* !pid_t */
-
 #endif /* NeXT || sony_news */
 
 #define INCLUDES_DONE
@@ -688,6 +680,10 @@ typedef int pid_t;
 #include <libintl.h>
 #endif
 
+#ifdef HAVE_LIBGETTEXT_H
+#include <libgettext.h>
+#endif
+
 #define N_(s) (s)
 
 #ifndef HAVE_GETTEXT
diff --git a/WWW/Library/Implementation/www_wait.h b/WWW/Library/Implementation/www_wait.h
index 730b3ec5..3e40e889 100644
--- a/WWW/Library/Implementation/www_wait.h
+++ b/WWW/Library/Implementation/www_wait.h
@@ -23,4 +23,12 @@
 # endif
 #endif
 
+#ifndef WSTOPSIG
+# ifdef HAVE_TYPE_UNIONWAIT
+#  define	WSTOPSIG(status)	(status.w_stopsig)
+# else
+#  define	WSTOPSIG(status)	WEXITSTATUS(status)
+# endif
+#endif
+
 #endif /* WWW_WAIT_H */
diff --git a/WWW/Library/vms/libmake.com b/WWW/Library/vms/libmake.com
index 4ad07d19..bf905fe7 100644
--- a/WWW/Library/vms/libmake.com
+++ b/WWW/Library/vms/libmake.com
@@ -67,12 +67,20 @@ $!
 $ if transport .eqs. "SOCKETSHR_TCP" then extra = extra + ",_DECC_V4_SOURCE"
 $ if transport .eqs. "TCPWARE" then extra = extra + ",UCX"
 $!
+$ if p2 .nes. ""
+$ then
+$   ssl_arg = "openssl"
+$   extra = extra + ",USE_SSL,USE_OPENSSL_INCL"
+$ else
+$   ssl_arg = ""
+$ endif
+$!
 $!	Compiler options can be specified here.  If there was
 $!	a second argument (with any value), then debugger mode
 $!	with no optimization will be specified as well. - FM
 $!
 $ cc_opts = ""
-$ if p2 .nes. "" then cc_opts = cc_opts + "/DEBUG/NOOPT"
+$ if p3 .nes. "" then cc_opts = cc_opts + "/DEBUG/NOOPT"
 $!
 $ IF f$trnlnm("VAXCMSG") .eqs. "DECC$MSG" .or. -
      f$trnlnm("DECC$CC_DEFAULT") .eqs. "/DECC" .or. -