about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-09-17 12:13:52 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1998-09-17 12:13:52 -0400
commit03b222bbbdbc58cbe5a4eb93e500d490800dee9c (patch)
tree317783cc00147ee45e2cadfa578b6e468581343c /src
parent02f2851492143446abaaa33cc9536fade7b51124 (diff)
downloadlynx-snapshots-03b222bbbdbc58cbe5a4eb93e500d490800dee9c.tar.gz
snapshot of project "lynx", label v2-8-1dev_28
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c14
-rw-r--r--src/HTAlert.c14
-rw-r--r--src/HTFWriter.c12
-rw-r--r--src/HTInit.c2
-rw-r--r--src/HTML.c22
-rw-r--r--src/LYBookmark.c6
-rw-r--r--src/LYCgi.c3
-rw-r--r--src/LYCharSets.c61
-rw-r--r--src/LYCharUtils.c12
-rw-r--r--src/LYCookie.c26
-rw-r--r--src/LYDownload.c17
-rw-r--r--src/LYGlobalDefs.h1
-rw-r--r--src/LYHistory.c49
-rw-r--r--src/LYList.c6
-rw-r--r--src/LYLocal.c332
-rw-r--r--src/LYMain.c9
-rw-r--r--src/LYMainLoop.c24
-rw-r--r--src/LYNews.c4
-rw-r--r--src/LYOptions.c8
-rw-r--r--src/LYPrint.c11
-rw-r--r--src/LYShowInfo.c52
-rw-r--r--src/LYShowInfo.h4
-rw-r--r--src/LYStrings.c6
-rw-r--r--src/LYUpload.c27
-rw-r--r--src/LYUtils.c74
-rw-r--r--src/LYUtils.h4
-rw-r--r--src/LYrcFile.c2
-rw-r--r--src/UCdomap.c8
-rw-r--r--src/chrtrans/cp437_uni.tbl19
29 files changed, 337 insertions, 492 deletions
diff --git a/src/GridText.c b/src/GridText.c
index be443759..a390b8c1 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -2458,18 +2458,14 @@ PUBLIC void HText_appendCharacter ARGS2(
     else {
 	/*
 	 * If we're displaying document source, wrap long lines to keep all of
-	 * the source visible.  Note that we splice the pieces together with
-	 * a recursion on this function to supply the character that is removed
-	 * by 'split_line'.
+	 * the source visible.
 	 */
 	int target = (int)(line->offset + line->size);
-	if ((target > (LYcols-1) - style->rightIndent) &&
+	if ((target >= (LYcols-1) - style->rightIndent) &&
 		HTisDocumentSource()) {
-	    int gap = line->data[line->size - 1];
 	    new_line(text);
 	    line = text->last_line;
 	    HText_appendCharacter (text, LY_SOFT_NEWLINE);
-	    HText_appendCharacter (text, gap);
 	}
     }
 
@@ -4746,8 +4742,7 @@ PUBLIC void print_wwwfile_to_fd ARGS2(
     line = HTMainText->last_line->next;
     for (;; line = line->next) {
 	if (!first
-	 && line->data[0] != LY_SOFT_NEWLINE
-	 && line->data[0] != '\0')
+	 && line->data[0] != LY_SOFT_NEWLINE)
 	    fputc('\n',fp);
 	first = FALSE;
 
@@ -4836,8 +4831,7 @@ PUBLIC void print_crawl_to_fd ARGS3(
 
     for (;; line = line->next) {
 	if (!first
-	 && line->data[0] != LY_SOFT_NEWLINE
-	 && line->data[0] != '\0')
+	 && line->data[0] != LY_SOFT_NEWLINE)
 	    fputc('\n',fp);
 	first = FALSE;
 	/*
diff --git a/src/HTAlert.c b/src/HTAlert.c
index 0482ca1e..a4c57b8f 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -41,8 +41,10 @@ PUBLIC void HTInfoMsg ARGS1(
 	CONST char *,	Msg)
 {
     _statusline(Msg);
-    if (Msg && *Msg)
+    if (Msg && *Msg) {
+	CTRACE(tfp, "Info: %s\n", Msg);
 	sleep(InfoSecs);
+    }
 }
 
 /*	Issue an important message.			HTUserMsg()
@@ -52,8 +54,10 @@ PUBLIC void HTUserMsg ARGS1(
 	CONST char *,	Msg)
 {
     _statusline(Msg);
-    if (Msg && *Msg)
+    if (Msg && *Msg) {
+	CTRACE(tfp, "User: %s\n", Msg);
 	sleep(MessageSecs);
+    }
 }
 
 PUBLIC void HTUserMsg2 ARGS2(
@@ -61,8 +65,10 @@ PUBLIC void HTUserMsg2 ARGS2(
 	CONST char *,	Arg)
 {
     _user_message(Msg, Arg);
-    if (Msg && *Msg)
+    if (Msg && *Msg) {
+	CTRACE(tfp, "User: %s (%s)\n", Msg, Arg);
 	sleep(MessageSecs);
+    }
 }
 
 /*	Issue a progress message.			HTProgress()
@@ -120,7 +126,7 @@ PUBLIC void HTReadProgress ARGS2(
 	    if (total <= 0)
 		sprintf (line, "Read %ld %s of data.", bytes, units);
 	     if (transfer_rate > 0)
-		sprintf (line + strlen(line), " %ld kb/sec.", transfer_rate / 1024);
+		sprintf (line + strlen(line), " %ld KB/sec.", transfer_rate / 1024);
 	    if (total <  0) {
 		if (total < -1)
 		    strcat(line, " (Press 'z' to abort)");
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index f171905a..92665d1d 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -237,17 +237,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
 			}
 		    }
 #endif /* FNAMES_8_3 */
-		    StrAllocCopy(addr, "file://localhost");
-#ifdef DOSPATH
-		    StrAllocCat(addr, "/");
-		    StrAllocCat(addr, HTDOS_wwwName(path));
-#else
-#ifdef VMS
-		    StrAllocCat(addr, HTVMS_wwwName(path));
-#else
-		    StrAllocCat(addr, path);
-#endif /* VMS */
-#endif /* DOSPATH */
+		    LYLocalFileToURL (&addr, path);
 		    if (!use_gzread) {
 			StrAllocCopy(me->anchor->FileCache, path);
 			StrAllocCopy(me->anchor->content_encoding, "binary");
diff --git a/src/HTInit.c b/src/HTInit.c
index 9e6eccf1..6d46ee30 100644
--- a/src/HTInit.c
+++ b/src/HTInit.c
@@ -687,6 +687,8 @@ PUBLIC void HTFileInit NOARGS
 
     HTSetSuffix(".zip",		"application/x-Zip File", "binary", 1.0);
 
+    HTSetSuffix(".bz2",		"application/x-bzip2", "binary", 1.0);
+
     HTSetSuffix(".uu",		"application/x-UUencoded", "8bit", 1.0);
 
     HTSetSuffix(".hqx",		"application/x-Binhex", "8bit", 1.0);
diff --git a/src/HTML.c b/src/HTML.c
index c54761d6..964af7f8 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -222,14 +222,18 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
     case HTML_TITLE:
 	if (c == LY_SOFT_HYPHEN)
 	    return;
-	if (c != '\n' && c != '\t' && c != '\r')
+	if (c != '\n' && c != '\t' && c != '\r') {
 	    HTChunkPutc(&me->title, c);
-	else if (HTCJK == CHINESE || HTCJK == JAPANESE || HTCJK == TAIPEI)
-	    if (c == '\t')
+	} else if (HTCJK == CHINESE || HTCJK == JAPANESE || HTCJK == TAIPEI) {
+	    if (c == '\t') {
 		HTChunkPutc(&me->title, ' ');
-	    else return;
+	    } else {
+		return;
+	    }
 	    /* don't replace '\n' with ' ' if Chinese or Japanese - HN */
-	else HTChunkPutc(&me->title, ' ');
+	} else {
+	    HTChunkPutc(&me->title, ' ');
+	}
 	return;
 
     case HTML_STYLE:
@@ -7256,16 +7260,16 @@ PUBLIC HTStructured* HTML_new ARGS3(
 	    LYUCcharset *p_in = HTAnchor_getUCInfoStage(me->node_anchor,
 							UCT_STAGE_MIME);
 	    if (p_in->enc == UCT_ENC_CJK && HTCJK == NOCJK) {
-		HTAnchor_resetUCInfoStage(me->node_anchor, 0,
+		HTAnchor_resetUCInfoStage(me->node_anchor, LATIN1,
 					  UCT_STAGE_MIME,
 					  UCT_SETBY_DEFAULT);
-		HTAnchor_setUCInfoStage(me->node_anchor, 0,
+		HTAnchor_setUCInfoStage(me->node_anchor, LATIN1,
 					UCT_STAGE_MIME,
 					UCT_SETBY_DEFAULT);
-		HTAnchor_resetUCInfoStage(me->node_anchor, 0,
+		HTAnchor_resetUCInfoStage(me->node_anchor, LATIN1,
 					  UCT_STAGE_PARSER,
 					  UCT_SETBY_DEFAULT);
-		HTAnchor_setUCInfoStage(me->node_anchor, 0,
+		HTAnchor_setUCInfoStage(me->node_anchor, LATIN1,
 					UCT_STAGE_PARSER,
 					UCT_SETBY_DEFAULT);
 	    }
diff --git a/src/LYBookmark.c b/src/LYBookmark.c
index 60dcda52..31e27beb 100644
--- a/src/LYBookmark.c
+++ b/src/LYBookmark.c
@@ -44,7 +44,6 @@ PRIVATE char * convert_mosaic_bookmark_file PARAMS((char *filename_buffer));
 PUBLIC char * get_bookmark_filename ARGS1(
 	char **,	URL)
 {
-    char URL_buffer[256];
     static char filename_buffer[256];
     char string_buffer[256];
     FILE *fp;
@@ -113,14 +112,13 @@ success:
 	is_mosaic_hotlist = TRUE;
 	fclose(fp);
 	newname = convert_mosaic_bookmark_file(filename_buffer);
-	LYLocalFileToURL(URL_buffer, newname);
+	LYLocalFileToURL(URL, newname);
     } else {
 	fclose(fp);
 	is_mosaic_hotlist = FALSE;
-	LYLocalFileToURL(URL_buffer, filename_buffer);
+	LYLocalFileToURL(URL, filename_buffer);
     }
 
-    StrAllocCopy(*URL, URL_buffer);
     return(filename_buffer);  /* bookmark file exists */
 
 } /* big end */
diff --git a/src/LYCgi.c b/src/LYCgi.c
index b5cdcb2e..5e7ea902 100644
--- a/src/LYCgi.c
+++ b/src/LYCgi.c
@@ -230,8 +230,7 @@ PRIVATE int LYLoadCGI ARGS4(
 	    return(status);
 	}
 	    
-	StrAllocCopy(new_arg, "file://localhost");
-	StrAllocCat(new_arg, orig_pgm);
+	LYLocalFileToURL (&new_arg, orig_pgm);
 
 	CTRACE(tfp, "%s is not an executable file, passing the buck.\n", arg);
 	status = HTLoadFile(new_arg, anAnchor, format_out, sink);
diff --git a/src/LYCharSets.c b/src/LYCharSets.c
index 5858b4e1..c2540e13 100644
--- a/src/LYCharSets.c
+++ b/src/LYCharSets.c
@@ -467,16 +467,15 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i)
     if (LYCharSet_UC[i].enc != UCT_ENC_CJK) {
 	HTCJK = NOCJK;
 	kanji_code = NOKANJI;
+	if (i == chndl)
+	    LYRawMode = LYUseDefaultRawMode;
+	else
+	    LYRawMode = (!LYUseDefaultRawMode);
 
 	HTPassEightBitNum =
 	    ((LYCharSet_UC[i].codepoints & UCT_CP_SUPERSETOF_LAT1) ||
 		(LYCharSet_UC[i].like8859 & UCT_R_HIGH8BIT));
 
-	if (i == chndl) {
-	    LYRawMode = LYUseDefaultRawMode ? TRUE : FALSE;
-	} else {
-	    LYRawMode = LYUseDefaultRawMode ? FALSE : TRUE;
-	}
 	if (LYRawMode) {
 	    HTPassEightBitRaw = (LYlowest_eightbit[i] <= 160);
 	} else {
@@ -494,51 +493,30 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i)
 	CONST char *mime = LYCharSet_UC[i].MIMEname;
 
 	if (!strcmp(mime, "euc-cn")) {
-	    HTCJK = LYUseDefaultRawMode ? CHINESE : NOCJK;
-	    LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE;
+	    HTCJK = CHINESE;
 	    kanji_code = EUC;
-	    HTPassEightBitRaw = FALSE;
-	    HTPassEightBitNum = FALSE;
-	    HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE;
-	    HTPassHighCtrlNum = FALSE;
-
 	} else if (!strcmp(mime, "euc-jp")) {
-	    HTCJK = LYUseDefaultRawMode ? JAPANESE : NOCJK;
-	    LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE;
+	    HTCJK = JAPANESE;
 	    kanji_code = EUC;
-	    HTPassEightBitRaw = FALSE;
-	    HTPassEightBitNum = FALSE;
-	    HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE;
-	    HTPassHighCtrlNum = FALSE;
-
 	} else if (!strcmp(mime, "shift_jis")) {
-	    HTCJK = LYUseDefaultRawMode ? JAPANESE : NOCJK;
-	    LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE;
+	    HTCJK = JAPANESE;
 	    kanji_code = SJIS;
-	    HTPassEightBitRaw = FALSE;
-	    HTPassEightBitNum = FALSE;
-	    HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE;
-	    HTPassHighCtrlNum = FALSE;
-
 	} else if (!strcmp(mime, "euc-kr")) {
-	    HTCJK = LYUseDefaultRawMode ? KOREAN : NOCJK;
-	    LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE;
+	    HTCJK = KOREAN;
 	    kanji_code = EUC;
-	    HTPassEightBitRaw = FALSE;
-	    HTPassEightBitNum = FALSE;
-	    HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE;
-	    HTPassHighCtrlNum = FALSE;
-
 	} else if (!strcmp(mime, "big5")) {
-	    HTCJK = LYUseDefaultRawMode ? TAIPEI : NOCJK;
-	    LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE;
+	    HTCJK = TAIPEI;
 	    kanji_code = EUC;
-	    HTPassEightBitRaw = FALSE;
-	    HTPassEightBitNum = FALSE;
-	    HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE;
-	    HTPassHighCtrlNum = FALSE;
-
 	}
+
+	/* for any CJK: */
+	if (!LYUseDefaultRawMode)
+		HTCJK = NOCJK;
+	LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE;
+	HTPassEightBitRaw = FALSE;
+	HTPassEightBitNum = FALSE;
+	HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE;
+	HTPassHighCtrlNum = FALSE;
     }
 
     /*
@@ -608,6 +586,9 @@ PUBLIC void Set_HTCJK ARGS2(
 /*
  *  Function to set the LYDefaultRawMode value
  *  based on the selected character set. - FM
+ *
+ *  Currently unused: the default value so obvious
+ *  that LYUseDefaultRawMode utilized directly by someone's mistake. - LP
  */
 PRIVATE void HTMLSetRawModeDefault ARGS1(int,i)
 {
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index 8dda30ef..d9f01c15 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -333,12 +333,10 @@ PUBLIC void LYFillLocalFileURL ARGS2(
 	    StrAllocCat(*href, "localhost");
 	} else if (!strncmp(*href, "file:///", 8)) {
 	    StrAllocCopy(temp, (*href+7));
-	    StrAllocCopy(*href, "file://localhost");
-	    StrAllocCat(*href, temp);
+	    LYLocalFileToURL (href, temp);
 	} else if (!strncmp(*href, "file:/", 6) && !LYIsHtmlSep(*(*href+6))) {
 	    StrAllocCopy(temp, (*href+5));
-	    StrAllocCopy(*href, "file://localhost");
-	    StrAllocCat(*href, temp);
+	    LYLocalFileToURL (href, temp);
 	}
     }
 
@@ -1257,7 +1255,7 @@ PUBLIC void LYExpandString ARGS2(
 	**  back translate for our character set. - FM
 	*/
 	if (code > 160 && code < 256 &&
-	     me->outUCLYhndl != 0 &&
+	     me->outUCLYhndl != LATIN1 &&
 	     (!(HTPassEightBitRaw ||
 		(me->T.do_8bitraw && !me->T.trans_from_uni)))) {
 	    value = (code - 160);
@@ -2279,9 +2277,7 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9(
 		*/
 		} else if (code < 161 ||
 			   (code < 256 &&
-			    (HTPassEightBitNum ||
-			     !strncmp(LYchar_set_names[cs_to],
-				      "ISO Latin 1", 11)))) {
+			    (HTPassEightBitNum || cs_to == LATIN1))) {
 		    /*
 		    **	No conversion needed.
 		    */
diff --git a/src/LYCookie.c b/src/LYCookie.c
index e586cf04..1cbf6966 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -354,18 +354,20 @@ PRIVATE void store_cookie ARGS3(
 
 	    if (msg == 0)
 		outofmem(__FILE__, "store_cookie");
-	    sprintf(msg,
-		    INVALID_COOKIE_DOMAIN_CONFIRMATION,
-		    co->domain,
-		    hostname);
-	    if (!HTConfirm(msg)) {
-		CTRACE(tfp, "store_cookie: Rejecting domain '%s' for host '%s'.\n",
-			    co->domain,
-			    hostname);
-		freeCookie(co);
-		co = NULL;
-		FREE(msg);
-		return;
+	    if (!LYAcceptAllCookies) {
+		sprintf(msg,
+			INVALID_COOKIE_DOMAIN_CONFIRMATION,
+			co->domain,
+			hostname);
+		if (!HTConfirm(msg)) {
+		    CTRACE(tfp, "store_cookie: Rejecting domain '%s' for host '%s'.\n",
+				co->domain,
+				hostname);
+		    freeCookie(co);
+		    co = NULL;
+		    FREE(msg);
+		    return;
+		}
 	    }
 	    FREE(msg);
 	}
diff --git a/src/LYDownload.c b/src/LYDownload.c
index 26b1eef9..5c4473be 100644
--- a/src/LYDownload.c
+++ b/src/LYDownload.c
@@ -33,7 +33,7 @@
 PUBLIC BOOLEAN LYDidRename = FALSE;
 #endif /* VMS */
 
-PRIVATE char LYValidDownloadFile[256] = "\0";
+PRIVATE char LYValidDownloadFile[LY_MAXPATH] = "\0";
 
 PUBLIC void LYDownload ARGS1(
 	char *, 	line)
@@ -100,6 +100,7 @@ PUBLIC void LYDownload ARGS1(
     }
 
 #ifdef DIRED_SUPPORT
+    /* FIXME: use HTLocalName */
     if (!strncmp(file, "file://localhost", 16))
 	file += 16;
     else if (!strncmp(file, "file:", 5))
@@ -586,8 +587,7 @@ PUBLIC int LYdownload_options ARGS2(
 	char **,	newfile,
 	char *, 	data_file)
 {
-    static char tempfile[256];
-    static char download_filename[256];
+    static char tempfile[LY_MAXPATH];
     char *sug_filename = NULL;
     FILE *fp0;
     lynx_html_item_type *cur_download;
@@ -604,12 +604,11 @@ PUBLIC int LYdownload_options ARGS2(
 	HTAlert(CANNOT_OPEN_TEMP);
 	return(-1);
     }
-    LYLocalFileToURL(download_filename, tempfile);
+    LYLocalFileToURL(newfile, tempfile);
 
     LYstrncpy(LYValidDownloadFile,
 	      data_file,
 	      (sizeof(LYValidDownloadFile) - 1));
-    StrAllocCopy(*newfile, download_filename);
     LYforce_no_cache = TRUE;  /* don't cache this doc */
 
 
@@ -622,7 +621,7 @@ PUBLIC int LYdownload_options ARGS2(
 	data_file, (lynx_save_space ? lynx_save_space : ""), sug_filename);
     fprintf(fp0, "\nStandard download options:\n");
 
-    if(!no_disk_save && !child_lynx)
+    if(!no_disk_save && !child_lynx) {
 #ifdef DIRED_SUPPORT
 	/*
 	 *  Disable save to disk option for local files.
@@ -632,11 +631,9 @@ PUBLIC int LYdownload_options ARGS2(
 	    fprintf(fp0,"   \
 <a href=\"LYNXDOWNLOAD://Method=-1/File=%s/SugFile=%s%s\">Save to disk</a>\n",
 	   data_file, (lynx_save_space ? lynx_save_space : ""), sug_filename);
-#ifdef DIRED_SUPPORT
-	else {}
-#endif /* DIRED_SUPPORT */
-    else
+    } else {
 	fprintf(fp0,"   <em>Save to disk disabled.</em>\n");
+    }
 
     fprintf(fp0, "\nLocal additions:\n");
 
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index 37550ce3..d4840f91 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -142,6 +142,7 @@ extern BOOLEAN LYNewsPosting;	/* News posting supported if TRUE */
 extern char *LynxSigFile;	/* Signature file, in or off home */
 extern char *system_mail;
 extern char *system_mail_flags;
+extern char *lynx_cfg_file;	/* location of active lynx.cfg file */
 extern char *lynx_temp_space;
 extern char *lynx_save_space;
 extern BOOLEAN LYforce_HTML_mode;
diff --git a/src/LYHistory.c b/src/LYHistory.c
index e046a9e5..f09099e3 100644
--- a/src/LYHistory.c
+++ b/src/LYHistory.c
@@ -187,35 +187,6 @@ PUBLIC void LYpush ARGS2(
 	    return;
 	}
     }
-
-#ifdef NOTDEFINED
-/*
-**  The following segment not used any more - What's it good for,
-**  anyway??  Doing a pop when a push is requested is confusing,
-**  also to the user.  Moreover, the way it was done seems to cause
-**  a memory leak. - KW
-*/  /*
-     *	If file is identical to one two before it, don't push it.
-     */
-    if (nhist > 2 &&
-	STREQ(history[nhist-2].address, doc->address) &&
-	!strcmp(history[nhist-2].post_data ?
-		history[nhist-2].post_data : "",
-		doc->post_data ?
-		doc->post_data : "") &&
-	!strcmp(history[nhist-2].bookmark ?
-		history[nhist-2].bookmark : "",
-		doc->bookmark ?
-		doc->bookmark : "") &&
-	history[nhist-2].isHEAD == doc->isHEAD) {
-	/*
-	 *  Pop one off the stack.
-	 */
-	nhist--;
-	return;
-    }
-#endif /* NOTDEFINED */
-
     /*
      *	OK, push it if we have stack space.
      */
@@ -320,9 +291,9 @@ PUBLIC void LYpush ARGS2(
 			    "but didn't check out!");
 	    }
 	}
+	CTRACE(tfp, "\nLYpush[%d]: address:%s\n        title:%s\n",
+		    nhist, doc->address, doc->title);
 	nhist++;
-	CTRACE(tfp, "\nLYpush: address:%s\n        title:%s\n",
-		    doc->address, doc->title);
     } else {
 	if (LYCursesON) {
 	    HTAlert(MAXHIST_REACHED);
@@ -355,8 +326,8 @@ PUBLIC void LYpop ARGS1(
 	doc->isHEAD = history[nhist].isHEAD;
 	doc->safe = history[nhist].safe;
 	doc->internal_link = history[nhist].internal_link;
-	CTRACE(tfp, "LYpop: address:%s\n     title:%s\n",
-		    doc->address, doc->title);
+	CTRACE(tfp, "LYpop[%d]: address:%s\n     title:%s\n",
+		    nhist, doc->address, doc->title);
     }
 }
 
@@ -389,8 +360,7 @@ PUBLIC void LYpop_num ARGS2(
 PUBLIC int showhistory ARGS1(
 	char **,	newfile)
 {
-    static char tempfile[256];
-    static char hist_filename[256];
+    static char tempfile[LY_MAXPATH];
     char *Title = NULL;
     int x = 0;
     FILE *fp0;
@@ -401,9 +371,8 @@ PUBLIC int showhistory ARGS1(
 	return(-1);
     }
 
-    LYLocalFileToURL(hist_filename, tempfile);
+    LYLocalFileToURL(newfile, tempfile);
 
-    StrAllocCopy(*newfile, hist_filename);
     LYforce_HTML_mode = TRUE;	/* force this file to be HTML */
     LYforce_no_cache = TRUE;	/* force this file to be new */
 
@@ -530,8 +499,7 @@ PUBLIC BOOLEAN historytarget ARGS1(
 PUBLIC int LYShowVisitedLinks ARGS1(
 	char **,	newfile)
 {
-    static char tempfile[256];
-    static char vl_filename[256];
+    static char tempfile[LY_MAXPATH];
     char *Title = NULL;
     char *Address = NULL;
     int x;
@@ -548,9 +516,8 @@ PUBLIC int LYShowVisitedLinks ARGS1(
 	return(-1);
     }
 
-    LYLocalFileToURL(vl_filename, tempfile);
+    LYLocalFileToURL(newfile, tempfile);
 
-    StrAllocCopy(*newfile, vl_filename);
     LYforce_HTML_mode = TRUE;	/* force this file to be HTML */
     LYforce_no_cache = TRUE;	/* force this file to be new */
 
diff --git a/src/LYList.c b/src/LYList.c
index e31036fb..7f669db9 100644
--- a/src/LYList.c
+++ b/src/LYList.c
@@ -32,7 +32,7 @@
 **			Clear:	we only get addresses.
 */
 
-static char list_filename[256] = "\0";
+static char *list_filename = 0;
 
 /*
  *  Returns the name of the file used for the List Page, if one has
@@ -41,7 +41,7 @@ static char list_filename[256] = "\0";
  */
 PUBLIC char * LYlist_temp_url NOARGS
 {
-    return list_filename;
+    return list_filename ? list_filename : "";
 }
 
 PUBLIC int showlist ARGS2(
@@ -74,7 +74,7 @@ PUBLIC int showlist ARGS2(
 	return(-1);
     }
 
-    LYLocalFileToURL(list_filename, tempfile);
+    LYLocalFileToURL(&list_filename, tempfile);
 
     StrAllocCopy(newdoc->address, list_filename);
     LYforce_HTML_mode = TRUE;	/* force this file to be HTML */
diff --git a/src/LYLocal.c b/src/LYLocal.c
index 21288e67..0037d5c9 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -29,6 +29,7 @@
 */
 
 #include <HTUtils.h>
+#include <HTFile.h>
 #include <HTAlert.h>
 #include <HTParse.h>
 #include <LYCurses.h>
@@ -47,7 +48,6 @@
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
-#include <errno.h>
 #include <grp.h>
 #endif /*_WINDOWS */
 #endif /* VMS */
@@ -76,8 +76,8 @@ PRIVATE int LYExecv PARAMS((
 	char *		msg));
 
 #ifdef DIRED_SUPPORT
-PUBLIC char LYPermitFileURL[256] = "\0";
-PUBLIC char LYDiredFileURL[256] = "\0";
+PUBLIC char LYPermitFileURL[LY_MAXPATH] = "\0";
+PUBLIC char LYDiredFileURL[LY_MAXPATH] = "\0";
 
 PRIVATE char *filename PARAMS((
 	char *		prompt,
@@ -236,6 +236,59 @@ struct dired_menu {
 		    NULL, NULL, 				NULL }
 };
 
+PRIVATE BOOLEAN ok_stat ARGS2(char *, name, struct stat*, sb)
+{
+    char tmpbuf[512];
+
+    if (stat(name, sb) < 0) {
+	sprintf(tmpbuf, "Unable to get status of '%s'.", name);
+	HTAlert(tmpbuf);
+	return FALSE;
+    }
+    return TRUE;
+}
+
+#ifdef HAVE_LSTAT
+PRIVATE BOOLEAN ok_lstat ARGS2(char *, name, struct stat*, sb)
+{
+    char tmpbuf[512];
+
+    if (lstat(name, sb) < 0) {
+	sprintf(tmpbuf, "Unable to get status of '%s'.", name);
+	HTAlert(tmpbuf);
+	return FALSE;
+    }
+    return TRUE;
+}
+#else
+#define ok_lstat(name,sb) ok_stat(name,sb)
+#endif
+
+PRIVATE BOOLEAN ok_file_or_dir ARGS1(struct stat*, sb)
+{
+    if (!S_ISDIR(sb->st_mode)
+     && !S_ISREG(sb->st_mode)) {
+	HTAlert("The selected item is not a file or a directory! Request ignored.");
+	return FALSE;
+    }
+    return TRUE;
+}
+
+PRIVATE BOOLEAN ok_localname ARGS2(char*, dst, char*, src)
+{
+    char *s = HTfullURL_toFile(strip_trailing_slash(src));
+    struct stat dir_info;
+
+    if (!ok_stat(s, &dir_info)
+     || !ok_file_or_dir(&dir_info)) {
+	free(s);
+	return FALSE;
+    }
+    strcpy(dst, s);
+    free(s);
+    return TRUE;
+}
+
 /*
  *  Remove all tagged files and directories.
  */
@@ -261,24 +314,16 @@ PRIVATE BOOLEAN remove_tagged NOARGS
     tag = tagged;
     while (ans == 'Y' && (cp = (char *)HTList_nextObject(tag)) != NULL) {
 	if (is_url(cp) == FILE_URL_TYPE) { /* unnecessary check */
-	    tp = cp;
-	    if (!strncmp(tp, "file://localhost", 16)) {
-		tp += 16;
-	    } else if (!strncmp(tp, "file:", 5)) {
-		tp += 5;
-	    }
+	    tp = HTfullURL_toFile(cp);
 	    StrAllocCopy(testpath, tp);
-	    HTUnEscape(testpath);
+	    free(tp);
+
 	    LYTrimPathSep(testpath);
 
 	    /*
 	     *	Check the current status of the path to be deleted.
 	     */
-	    if (stat(testpath,&dir_info) == -1) {
-		sprintf(tmpbuf,
-			"System error - failed to get status of '%s'.",
-			testpath);
-		HTAlert(tmpbuf);
+	    if (!ok_stat(testpath, &dir_info)) {
 		return count;
 	    } else {
 		args[0] = "rm";
@@ -353,24 +398,20 @@ PRIVATE BOOLEAN modify_tagged ARGS1(
 	    if (!cp)	/* Last resort, should never happen. */
 		cp = "/";
 	}
-	if (!strncmp(cp, "file://localhost", 16)) {
-	    cp += 16;
-	} else if (!strncmp(cp, "file:", 5)) {
-	    cp += 5;
-	}
+
 	if (testpath == NULL) {
 	    /*
 	     *	Get the directory containing the file or subdir.
 	     */
-	    cp = strip_trailing_slash(cp);
+	    cp = HTfullURL_toFile(strip_trailing_slash(cp));
 	    savepath = HTParse(".", cp, PARSE_PATH+PARSE_PUNCTUATION);
 	} else {
+	    cp = HTfullURL_toFile(cp);
 	    StrAllocCopy(savepath, cp);
 	}
-	HTUnEscape(savepath);
-	if (stat(savepath, &dir_info) == -1) {
-	    sprintf(tmpbuf, "Unable to get status of '%s'.", savepath);
-	    HTAlert(tmpbuf);
+	free(cp);
+
+	if (!ok_stat(savepath, &dir_info)) {
 	    FREE(savepath);
 	    return 0;
 	}
@@ -414,9 +455,7 @@ PRIVATE BOOLEAN modify_tagged ARGS1(
 	/*
 	 *  stat() the target location to determine type and ownership.
 	 */
-	if (stat(savepath, &dir_info) == -1) {
-	    sprintf(tmpbuf,"Unable to get status of '%s'.",savepath);
-	    HTAlert(tmpbuf);
+	if (!ok_stat(savepath, &dir_info)) {
 	    FREE(savepath);
 	    return 0;
 	}
@@ -443,13 +482,9 @@ PRIVATE BOOLEAN modify_tagged ARGS1(
 		 *  Move all tagged items to the target location.
 		 */
 		while ((cp = (char *)HTList_nextObject(tag)) != NULL) {
-		    if (!strncmp(cp, "file://localhost", 16)) {
-			cp += 16;
-		    } else if (!strncmp(cp, "file:", 5)) {
-			cp += 5;
-		    }
+		    cp = HTfullURL_toFile(cp);
 		    StrAllocCopy(srcpath, cp);
-		    HTUnEscape(srcpath);
+		    free(cp);
 
 		    sprintf(tmpbuf, "move %s to %s", srcpath, savepath);
 		    args[0] = "mv";
@@ -500,10 +535,7 @@ PRIVATE BOOLEAN modify_name ARGS1(
      */
     testpath = strip_trailing_slash(testpath);
 
-    if (stat(testpath, &dir_info) == -1) {
-	sprintf(tmpbuf, "Unable to get status of '%s'.", testpath);
-	HTAlert(tmpbuf);
-    } else {
+    if (ok_stat(testpath, &dir_info)) {
 	/*
 	 *  Change the name of the file or directory.
 	 */
@@ -582,9 +614,7 @@ PRIVATE BOOLEAN modify_location ARGS1(
      */
     testpath = strip_trailing_slash(testpath);
 
-    if (stat(testpath, &dir_info) == -1) {
-	sprintf(tmpbuf, "Unable to get status of '%s'.", testpath);
-	HTAlert(tmpbuf);
+    if (!ok_stat(testpath, &dir_info)) {
 	return 0;
     }
 
@@ -632,9 +662,7 @@ PRIVATE BOOLEAN modify_location ARGS1(
 	mode = dir_info.st_mode;
 	inode = dir_info.st_ino;
 	owner = dir_info.st_uid;
-	if (stat(newpath, &dir_info) == -1) {
-	    sprintf(tmpbuf,"Unable to get status of '%s'.",newpath);
-	    HTAlert(tmpbuf);
+	if (!ok_stat(newpath, &dir_info)) {
 	    return 0;
 	}
 	if (S_ISDIR(dir_info.st_mode)) {
@@ -679,14 +707,10 @@ PUBLIC BOOLEAN local_modify ARGS2(
     int count;
 
     if (!HTList_isEmpty(tagged)) {
-	cp = doc->address;
-	if (!strncmp(cp, "file://localhost", 16)) {
-	    cp += 16;
-	} else if (!strncmp(cp, "file:", 5)) {
-	    cp += 5;
-	}
+	cp = HTpartURL_toFile(doc->address);
 	strcpy(testpath, cp);
-	HTUnEscapeSome(testpath, "/");
+	free(cp);
+
 	count = modify_tagged(testpath);
 
 	if (doc->link > (nlinks-count - 1))
@@ -715,14 +739,9 @@ PUBLIC BOOLEAN local_modify ARGS2(
     ans = TOUPPER(c);
 
     if (strchr("NLP", ans) != NULL) {
-	cp = links[doc->link].lname;
-	if (!strncmp(cp, "file://localhost", 16)) {
-	    cp += 16;
-	} else if(!strncmp(cp, "file:", 5)) {
-	    cp += 5;
-	}
+	cp = HTfullURL_toFile(links[doc->link].lname);
 	strcpy(testpath, cp);
-	HTUnEscape(testpath);
+	free(cp);
 
 	if (ans == 'N') {
 	    return(modify_name(testpath));
@@ -877,14 +896,9 @@ PUBLIC BOOLEAN local_create ARGS1(
     c = LYgetch();
     ans = TOUPPER(c);
 
-    cp = doc->address;
-    if (!strncmp(cp, "file://localhost", 16)) {
-	cp += 16;
-    } else if (!strncmp(cp, "file:", 5)) {
-	cp += 5;
-    }
+    cp = HTfullURL_toFile(doc->address);
     strcpy(testpath,cp);
-    HTUnEscape(testpath);
+    free(cp);
 
     if (ans == 'F') {
 	return(create_file(testpath));
@@ -907,14 +921,7 @@ PRIVATE BOOLEAN remove_single ARGS1(
     struct stat dir_info;
     char *args[5];
 
-    /*
-     *	lstat() first in case it's a symbolic link.
-     */
-    if (lstat(testpath, &dir_info) == -1 &&
-	stat(testpath, &dir_info) == -1) {
-	sprintf(tmpbuf,
-		"System error - failed to get status of '%s'.", testpath);
-	HTAlert(tmpbuf);
+    if (!ok_lstat(testpath, &dir_info)) {
 	return 0;
     }
 
@@ -991,23 +998,10 @@ PUBLIC BOOLEAN local_remove ARGS1(
     }
     cp = links[doc->link].lname;
     if (is_url(cp) == FILE_URL_TYPE) {
-	tp = cp;
-#ifndef __EMX__
-	if (!strncmp(tp, "file://localhost", 16)) {
-	    tp += 16;
-	} else if (!strncmp(tp, "file:", 5)) {
-	    tp += 5;
-	}
-#else
-	if (!strncmp(tp, "file://localhost/", 17)) {
-	    tp += 17;
-	} else if (!strncmp(tp, "file:/", 6)) {
-	    tp +=6;
-	}
-#endif /* !EMX */
-
+	tp = HTfullURL_toFile(cp);
 	strcpy(testpath, tp);
-	HTUnEscape(testpath);
+	free(tp);
+
 	if ((i = strlen(testpath)) && testpath[i - 1] == '/')
 	    testpath[(i - 1)] = '\0';
 
@@ -1042,7 +1036,7 @@ static struct {
 				   use shell access for that. */
 };
 
-PRIVATE char LYValidPermitFile[256] = "\0";
+PRIVATE char LYValidPermitFile[LY_MAXPATH] = "\0";
 
 /*
  *  Handle DIRED permissions.
@@ -1056,7 +1050,7 @@ PRIVATE BOOLEAN permit_location ARGS3(
     HTAlert("Sorry, don't know how to permit non-UNIX files yet.");
     return(0);
 #else
-    static char tempfile[256] = "\0";
+    static char tempfile[LY_MAXPATH] = "\0";
     char *cp;
     char tmpbuf[LINESIZE];
     struct stat dir_info;
@@ -1066,31 +1060,23 @@ PRIVATE BOOLEAN permit_location ARGS3(
 	 *  Create form.
 	 */
 	FILE *fp0;
+	char local_src[LY_MAXPATH];
 	char * user_filename;
 	struct group * grp;
 	char * group_name;
 
+	cp = HTfullURL_toFile(strip_trailing_slash(srcpath));
+	strcpy(local_src, cp);
+	free(cp);
+
 	/*
 	 *  A couple of sanity tests.
 	 */
-	srcpath = strip_trailing_slash(srcpath);
-	if (strncmp(srcpath, "file://localhost", 16) == 0)
-	    srcpath += 16;
-	if (lstat(srcpath, &dir_info) == -1) {
-	    sprintf(tmpbuf, "Unable to get status of '%s'.", srcpath);
-	    HTAlert(tmpbuf);
+	if (!ok_lstat(local_src, &dir_info)
+	 || !ok_file_or_dir(&dir_info))
 	    return 0;
-	} else if (!S_ISDIR(dir_info.st_mode) &&
-	           !S_ISREG(dir_info.st_mode)) {
-	    HTAlert("The specified item is not a file nor a directory - request ignored.");
-	    return(0);
-	}
 
-	user_filename = srcpath;
-	cp = strrchr(srcpath, '/');
-	if (cp != NULL) {
-	    user_filename = (cp + 1);
-	}
+	user_filename = LYPathLeaf(local_src);
 
 	LYRemoveTemp(tempfile);
 	if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) {
@@ -1101,9 +1087,8 @@ PRIVATE BOOLEAN permit_location ARGS3(
 	/*
 	 * Make the tempfile a URL.
 	 */
-	strcpy(LYPermitFileURL, "file://localhost");
-	strcat(LYPermitFileURL, tempfile);
-	StrAllocCopy(*newpath, LYPermitFileURL);
+	LYLocalFileToURL(newpath, tempfile);
+	strcpy(LYPermitFileURL, *newpath);
 
 	grp = getgrgid(dir_info.st_gid);
 	if (grp == NULL) {
@@ -1238,13 +1223,8 @@ form to permit %s %s.\n</Ol>\n</Form>\n",
 	 *  A couple of sanity tests.
 	 */
 	destpath = strip_trailing_slash(destpath);
-	if (stat(destpath, &dir_info) == -1) {
-	    sprintf(tmpbuf, "Unable to get status of '%s'.", destpath);
-	    HTAlert(tmpbuf);
-	    return 0;
-	} else if (!S_ISDIR(dir_info.st_mode) &&
-	           !S_ISREG(dir_info.st_mode)) {
-	    HTAlert("The specified item is not a file nor a directory - request ignored.");
+	if (!ok_stat(destpath, &dir_info)
+	 || !ok_file_or_dir(&dir_info)) {
 	    return 0;
 	}
 
@@ -1601,20 +1581,14 @@ PUBLIC int dired_options ARGS2(
 	document *,	doc,
 	char **,	newfile)
 {
-    static char tempfile[256];
+    static char tempfile[LY_MAXPATH];
     char path[512], dir[512]; /* much too large */
-    char tmpbuf[LINESIZE];
     lynx_html_item_type *nxt;
     struct stat dir_info;
     FILE *fp0;
     char *cp = NULL;
-    char *dir_url = NULL;	/* Will hold URL-escaped path of
-				   directory from where DIRED_MENU was
-				   invoked (NOT its full URL). */
-    char *path_url = NULL;	/* Will hold URL-escaped path of file
-				   (or directory) which was selected
-				   when DIRED_MENU was invoked (NOT
-				   its full URL). */
+    char *dir_url;
+    char *path_url;
     BOOLEAN nothing_tagged;
     int count;
     struct dired_menu *mp;
@@ -1629,49 +1603,26 @@ PUBLIC int dired_options ARGS2(
     /*
      *  Make the tempfile a URL.
      */
-    strcpy(LYDiredFileURL, "file://localhost");
-    strcat(LYDiredFileURL, tempfile);
-    StrAllocCopy(*newfile, LYDiredFileURL);
-
-    cp = doc->address;
-    if (!strncmp(cp, "file://localhost", 16)) {
-	cp += 16;
-    } else if (!strncmp(cp, "file:", 5)) {
-	cp += 5;
-    }
-    StrAllocCopy(dir_url, cp);
-    LYTrimHtmlSep(dir_url);
+    LYLocalFileToURL(newfile, tempfile);
+    strcpy(LYDiredFileURL, *newfile);
 
+    cp = HTpartURL_toFile(doc->address);
     strcpy(dir, cp);
-    HTUnEscape(dir);
     LYTrimPathSep(dir);
 
     if (doc->link > -1 && doc->link < (nlinks+1)) {
-	cp = links[doc->link].lname;
-	if (!strncmp(cp, "file://localhost", 16)) {
-	    cp += 16;
-	} else if (!strncmp(cp, "file:", 5)) {
-	    cp += 5;
-	}
-	StrAllocCopy(path_url, cp);
-	LYTrimHtmlSep(path_url);
-
+	cp = HTfullURL_toFile(links[doc->link].lname);
 	strcpy(path, cp);
-	HTUnEscape(path);
 	LYTrimPathSep(path);
+	free(cp);
 
-	if (lstat(path, &dir_info) == -1 && stat(path, &dir_info) == -1) {
-	    sprintf(tmpbuf, "Unable to get status of '%s'.", path);
-	    HTAlert(tmpbuf);
+	if (!ok_lstat(path, &dir_info)) {
 	    LYCloseTempFP(fp0);
-	    FREE(dir_url);
-	    FREE(path_url);
 	    return 0;
 	}
 
     } else {
 	path[0] = '\0';
-	StrAllocCopy(path_url, path);
     }
 
     nothing_tagged = (HTList_isEmpty(tagged));
@@ -1749,12 +1700,16 @@ PUBLIC int dired_options ARGS2(
 	    (strlen(path) < strlen(mp->sfx) ||
 	     strcmp(mp->sfx, &path[(strlen(path) - strlen(mp->sfx))]) != 0))
 	    continue;
+	dir_url  = HTEscape(dir, URL_PATH);
+	path_url = HTEscape(path, URL_PATH);
 	fprintf(fp0, "<a href=\"%s",
-		render_item(mp->href, path_url, dir_url, buf,2048, YES));
+		render_item(mp->href, path_url, dir_url, buf,sizeof(buf), YES));
 	fprintf(fp0, "\">%s</a> ",
-		render_item(mp->link, path, dir, buf,2048, NO));
+		render_item(mp->link, path, dir, buf,sizeof(buf), NO));
 	fprintf(fp0, "%s<br>\n",
-		render_item(mp->rest, path, dir, buf,2048, NO));
+		render_item(mp->rest, path, dir, buf,sizeof(buf), NO));
+	FREE(dir_url);
+	FREE(path_url);
     }
 
     if (uploaders != NULL) {
@@ -1771,9 +1726,6 @@ PUBLIC int dired_options ARGS2(
     EndInternalPage(fp0);
     LYCloseTempFP(fp0);
 
-    FREE(dir_url);
-    FREE(path_url);
-
     LYforce_no_cache = TRUE;
 
     return(0);
@@ -1833,32 +1785,18 @@ PUBLIC BOOLEAN local_install ARGS3(
      *	Determine the status of the selected item.
      */
     if (srcpath) {
-	srcpath = strip_trailing_slash(srcpath);
-	if (strncmp(srcpath, "file://localhost", 16) == 0)
-	    srcpath += 16;
-	if (stat(srcpath, &dir_info) == -1) {
-	    sprintf(tmpbuf, "Unable to get status of '%s'.", srcpath);
-	    HTAlert(tmpbuf);
-	    return 0;
-	} else if (!S_ISDIR(dir_info.st_mode) &&
-		   !S_ISREG(dir_info.st_mode)) {
-	    HTAlert("The selected item is not a file or a directory! Request ignored.");
+	if (!ok_localname(savepath, srcpath))
 	    return 0;
-	}
-	strcpy(savepath, srcpath);
+
 	LYforce_no_cache = TRUE;
-	strcpy(tmpbuf, "file://localhost");
-	strcat(tmpbuf, Home_Dir());
-	strcat(tmpbuf, "/.installdirs.html");
-	StrAllocCopy(*newpath, tmpbuf);
+	LYLocalFileToURL(newpath, Home_Dir());
+	StrAllocCat(*newpath, "/.installdirs.html");
 	return 0;
     }
 
     destpath = strip_trailing_slash(destpath);
 
-    if (stat(destpath,&dir_info) == -1) {
-	sprintf(tmpbuf,"Unable to get status of '%s'.",destpath);
-	HTAlert(tmpbuf);
+    if (!ok_stat(destpath, &dir_info)) {
 	return 0;
     } else if (!S_ISDIR(dir_info.st_mode)) {
 	HTAlert("The selected item is not a directory! Request ignored.");
@@ -1887,11 +1825,11 @@ PUBLIC BOOLEAN local_install ARGS3(
     } else {
 	char *name;
 	while ((name = (char *)HTList_nextObject(tag))) {
-	    args[src] = name;
-	    if (strncmp("file://localhost", args[src], 16) == 0)
-		 args[src] = (name + 16);
-
-	    if (LYExecv(INSTALL_PATH, args, tmpbuf) <= 0)
+	    int err;
+	    args[src] = HTfullURL_toFile(name);
+	    err = (LYExecv(INSTALL_PATH, args, tmpbuf) <= 0);
+	    free(args[src]);
+	    if (err)
 		return ((count == 0) ? -1 : count);
 	    count++;
 	}
@@ -2001,17 +1939,6 @@ PRIVATE char * render_item ARGS6(
 	    switch (*s) {
 		case '%':
 		    *BP_INC = '%';
-#ifdef NOTDEFINED
-		    /*
-		     *	These chars come from lynx.cfg or the default, let's
-		     *	just assume there won't be any improper %'s there that
-		     *	would need escaping.
-		     */
-		    if(url_syntax) {
-			*BP_INC = '2';
-			*BP_INC = '5';
-		    }
-#endif /* NOTDEFINED */
 		    break;
 		case 'p':
 		    cp = path;
@@ -2058,12 +1985,6 @@ PRIVATE char * render_item ARGS6(
 		    break;
 		default:
 		    *BP_INC = '%';
-#ifdef NOTDEFINED
-		    if (url_syntax) {
-			*BP_INC = '2';
-			*BP_INC = '5';
-		    }
-#endif /* NOTDEFINED */
 		    *BP_INC =*s;
 		    break;
 	    }
@@ -2108,6 +2029,13 @@ PRIVATE int LYExecv ARGS3(
     int wstatus;
 #endif
 
+    if (TRACE) {
+	int n;
+	CTRACE(tfp, "LYExecv path='%s'\n", path);
+	for (n = 0; argv[n] != 0; n++)
+	    CTRACE(tfp, "argv[%d] = '%s'\n", n, argv[n]);
+    }
+
     rc = 1;		/* It will work */
     tmpbuf[0] = '\0';	/* empty buffer for alert messages */
     stop_curses();
diff --git a/src/LYMain.c b/src/LYMain.c
index 3322b390..6ab74c50 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -264,6 +264,7 @@ PUBLIC BOOLEAN LYNewsPosting = NEWS_POSTING; /* News posting supported? */
 PUBLIC char *LynxSigFile = NULL;    /* Signature file, in or off home */
 PUBLIC char *system_mail = NULL;	  /* The path for sending mail */
 PUBLIC char *system_mail_flags = NULL;	  /* Flags for sending mail */
+PUBLIC char *lynx_cfg_file = NULL;	  /* location of active lynx.cfg */
 PUBLIC char *lynx_temp_space = NULL; /* The prefix for temporary file paths */
 PUBLIC char *lynx_save_space = NULL; /* The prefix for save to disk paths */
 PUBLIC char *LYHostName = NULL; 	/* treat as a local host name */
@@ -514,7 +515,6 @@ PUBLIC int main ARGS2(
 {
     int  i;		/* indexing variable */
     int status = 0;	/* exit status */
-    char *lynx_cfg_file = NULL;
     char *temp = NULL;
     char *cp;
     FILE *fp;
@@ -1238,7 +1238,6 @@ PUBLIC int main ARGS2(
      *	Process the configuration file.
      */
     read_cfg(lynx_cfg_file, "main program", 1);
-    FREE(lynx_cfg_file);
 
     HTSwitchDTD(New_DTD);
 
@@ -2478,7 +2477,11 @@ static int version_fun ARGS3(
 {
     SetOutputMode( O_TEXT );
 
-    printf("\n%s Version %s (1998)\n", LYNX_NAME, LYNX_VERSION);
+    printf("\n%s Version %s (%.*s)\n",
+	  LYNX_NAME, LYNX_VERSION,
+	  LYNX_DATE_LEN,
+	  LYNX_RELEASE ? LYNX_RELEASE_DATE : &LYNX_DATE[LYNX_DATE_OFF]
+	  );
     printf(
 	  "Copyrights held by the University of Kansas, CERN, and other contributors.\n"
 	  );
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index bba831b3..23d2de7a 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -4214,22 +4214,15 @@ check_goto_URL:
 		if (nlinks > 0) {
 		    cp = links[curdoc.link].lname;
 		    if (is_url(cp) == FILE_URL_TYPE) {
-			if (!strncmp(cp, "file://localhost", 16)) {
-			    /*
-			     *	This is the only case that should occur. - kw
-			     */
-			    StrAllocCopy(tp, cp + 16);
-			} else if (!strncmp(cp, "file:", 5)) {
-			    StrAllocCopy(tp, cp + 5);
-			} else {
-			    StrAllocCopy(tp, cp);
-			}
-			HTUnEscape(tp);
+			cp = HTfullURL_toFile(cp);
+			StrAllocCopy(tp, cp);
+			free(cp);
+
 			if (stat(tp, &dir_info) == -1) {
 			    HTAlert(NO_STATUS);
 			} else {
 			    if (S_ISREG(dir_info.st_mode)) {
-				StrAllocCopy(tp, cp);
+				StrAllocCopy(tp, links[curdoc.link].lname);
 				HTUnEscapeSome(tp, "/");
 				if (edit_current_file(tp,
 						      curdoc.link, Newline)) {
@@ -5134,12 +5127,7 @@ check_add_bookmark_to_self:
 	    if (!LYReopenTracelog(&trace_mode_flag))
 		break;
 
-	    StrAllocCopy(newdoc.address, "file://localhost");
-#ifdef VMS
-	    StrAllocCat(newdoc.address, HTVMS_wwwName(LYTraceLogPath));
-#else
-	    StrAllocCat(newdoc.address, LYTraceLogPath);
-#endif /* VMS */
+	    LYLocalFileToURL (&(newdoc.address), LYTraceLogPath);
 	    StrAllocCopy(newdoc.title, LYNX_TRACELOG_TITLE);
 	    FREE(newdoc.post_data);
 	    FREE(newdoc.post_content_type);
diff --git a/src/LYNews.c b/src/LYNews.c
index 97e93e24..d644de6c 100644
--- a/src/LYNews.c
+++ b/src/LYNews.c
@@ -75,8 +75,8 @@ PUBLIC char *LYNewsPost ARGS2(
      *  open a temporary file for a conversion to JIS. - FM
      */
     CJKfile[0] = '\0';
-    if (!strncmp(LYchar_set_names[current_char_set], "Japanese (EUC)", 14) ||
-	!strncmp(LYchar_set_names[current_char_set], "Japanese (SJIS)", 15)) {
+    if (current_char_set == UCGetLYhndl_byMIME("euc-jp") ||
+	current_char_set == UCGetLYhndl_byMIME("shift_jis")) {
 	if ((fc = LYOpenTemp(CJKfile, HTML_SUFFIX, "w")) == NULL) {
 	    HTAlert(CANNOT_OPEN_TEMP);
 	    LYRemoveTemp(my_tempfile);
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 50643fb8..8d22ad30 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -3210,7 +3210,7 @@ static char * user_agent_string		= "user_agent";
 #define PutTextInput(fp, name, value, size, disable) \
 	fprintf(fp,\
 	"<input size=%d type=\"text\" name=\"%s\" value=\"%s\" %s>\n",\
-		size, name, value, disable)
+		(int) size, name, value, disable)
 
 #define PutOption(fp, flag, html, name) \
 	fprintf(fp,"<option value=\"%s\" %s>%s\n", html, SELECTED(flag), name)
@@ -3679,8 +3679,7 @@ PUBLIC int gen_options ARGS1(
 {
     int i;
     BOOLEAN can_do_colors;
-    static char tempfile[256];
-    char any_filename[256];
+    static char tempfile[LY_MAXPATH];
     FILE *fp0;
     size_t cset_len = 0;
     size_t text_len = COLS - 38;	/* cf: PutLabel */
@@ -3692,9 +3691,8 @@ PUBLIC int gen_options ARGS1(
 	return(-1);
     }
 
-    LYLocalFileToURL(any_filename, tempfile);
+    LYLocalFileToURL(newfile, tempfile);
 
-    StrAllocCopy(*newfile, any_filename);
     LYforce_no_cache = TRUE;
 
     BeginInternalPage(fp0, OPTIONS_TITLE, NULL); /* help link below */
diff --git a/src/LYPrint.c b/src/LYPrint.c
index 8b95de3a..55bf1b52 100644
--- a/src/LYPrint.c
+++ b/src/LYPrint.c
@@ -66,7 +66,7 @@ PRIVATE int remove_quotes PARAMS((char *string));
 PUBLIC int printfile ARGS1(
 	document *,	newdoc)
 {
-    static char tempfile[256];
+    static char tempfile[LY_MAXPATH];
     char buffer[LINESIZE];
     char filename[LINESIZE];
     char user_response[256];
@@ -95,7 +95,7 @@ PUBLIC int printfile ARGS1(
     char *envbuffer = NULL;
 #ifdef VMS
     BOOLEAN isPMDF = FALSE;
-    char hdrfile[256];
+    char hdrfile[LY_MAXPATH];
     FILE *hfd;
 
     if (!strncasecomp(system_mail, "PMDF SEND", 9)) {
@@ -1249,8 +1249,7 @@ PUBLIC int print_options ARGS3(
 	char **,	printed_url,
 	int,		lines_in_file)
 {
-    static char tempfile[256];
-    static char print_filename[256];
+    static char tempfile[LY_MAXPATH];
     char buffer[LINESIZE];
     int count;
     int pages;
@@ -1264,9 +1263,7 @@ PUBLIC int print_options ARGS3(
 	return(-1);
     }
 
-    LYLocalFileToURL(print_filename, tempfile);
-
-    StrAllocCopy(*newfile, print_filename);
+    LYLocalFileToURL(newfile, tempfile);
 
     BeginInternalPage(fp0, PRINT_OPTIONS_TITLE, PRINT_OPTIONS_HELP);
 
diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c
index 9ab29041..e9bbfcb6 100644
--- a/src/LYShowInfo.c
+++ b/src/LYShowInfo.c
@@ -1,4 +1,5 @@
 #include <HTUtils.h>
+#include <HTFile.h>
 #include <HTParse.h>
 #include <HTAlert.h>
 #include <HTTP.h>
@@ -11,6 +12,7 @@
 #include <LYSignal.h>
 #include <LYCharUtils.h>
 #include <GridText.h>
+#include <LYReadCFG.h>
 
 #include <LYLeaks.h>
 
@@ -39,7 +41,7 @@ PRIVATE char *lynx_compile_opts NOARGS
 	    tempfile[0] = '\0';
 	    return(0);
 	}
-	BeginInternalPage (fp0, CONFIG_DEF_TITLE, (char *)0);
+	BeginInternalPage (fp0, CONFIG_DEF_TITLE, NULL);
 	fprintf(fp0, "<pre>\n");
 	fprintf(fp0, "\n<em>config.cache</em>\n");
 	for (n = 0; n < TABLESIZE(config_cache); n++) {
@@ -57,7 +59,7 @@ PRIVATE char *lynx_compile_opts NOARGS
 }
 #else
 #undef HAVE_CFG_DEFS_H
-#endif
+#endif /* HAVE_CONFIG_H */
 
 /*
  *  Showinfo prints a page of info about the current file and the link
@@ -71,7 +73,7 @@ PUBLIC int showinfo ARGS4(
 	char *, 	owner_address)
 {
     static char tempfile[256];
-    static char info_url[256];
+    static char *info_url;
     int url_type;
     FILE *fp0;
     char *Address = NULL, *Title = NULL;
@@ -90,7 +92,7 @@ PUBLIC int showinfo ARGS4(
 	return(-1);
     }
 
-    LYLocalFileToURL(info_url, tempfile);
+    LYLocalFileToURL(&info_url, tempfile);
 
     /*
      *	Point the address pointer at this Url
@@ -114,43 +116,41 @@ PUBLIC int showinfo ARGS4(
     fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n",
 		 SHOWINFO_TITLE);
 
-#ifdef HAVE_CFG_DEFS_H
-    fprintf(fp0, "<h1>%s %s (<a href=\"%s\">%s</a>) - <a href=\"%s\">compile time settings</a></h1>\n",
+    LYLocalFileToURL(&info_url, lynx_compile_opts());
+    fprintf(fp0, "<h1>%s %s (%.*s) (<a href=\"%s\">%s</a>)",
 		 LYNX_NAME, LYNX_VERSION,
+		 LYNX_DATE_LEN,
+		 (LYNX_RELEASE ? LYNX_RELEASE_DATE : &LYNX_DATE[LYNX_DATE_OFF]),
 		 (LYNX_RELEASE ? LYNX_WWW_HOME   : LYNX_WWW_DIST),
-		 (LYNX_RELEASE ? "major release" : "development version"),
-		 lynx_compile_opts());
+		 (LYNX_RELEASE ? "latest release" : "development version") );
+#ifdef HAVE_CFG_DEFS_H
+    fprintf(fp0, " - <a href=\"%s\">compile time settings</a></h1>\n",
+		 info_url);
 #else
-    fprintf(fp0, "<h1>%s %s (<a href=\"%s\">%s</a>)</h1>\n",
-		 LYNX_NAME, LYNX_VERSION,
-		 (LYNX_RELEASE ? LYNX_WWW_HOME   : LYNX_WWW_DIST),
-		 (LYNX_RELEASE ? "major release" : "development version") );
+    fprintf(fp0, "</h1>\n"
+		 ); /* do not forget to close </h1> */
 #endif
 
 #ifdef DIRED_SUPPORT
     if (lynx_edit_mode && nlinks > 0) {
+	char *s;
+
 	fprintf(fp0, "<pre>\n");
 	fprintf(fp0, "\nDirectory that you are currently viewing\n\n");
 
-	cp = doc->address;
-	if (!strncmp(cp, "file://localhost", 16))
-	    cp += 16;
-	else if (!strncmp(cp, "file:", 5))
-	    cp += 5;
-	strcpy(temp, cp);
-	HTUnEscape(temp);
+	s = HTfullURL_toFile(doc->address);
+	strcpy(temp, s);
+	free(s);
 
 	fprintf(fp0,"   <em>Name:</em>  %s\n", temp);
 	fprintf(fp0,"   <em> URL:</em>  %s\n", doc->address);
 
-	cp = links[doc->link].lname;
-	if (!strncmp(cp, "file://localhost", 16))
-	    cp += 16;
-	else if (!strncmp(cp, "file:", 5))
-	    cp += 5;
-	strcpy(temp, cp);
-	HTUnEscape(temp);
+	s = HTfullURL_toFile(links[doc->link].lname);
+	strcpy(temp, s);
+	free(s);
+
 	if (lstat(temp, &dir_info) == -1) {
+	    CTRACE(tfp, "lstat(%s) failed, errno=%d\n", temp, errno);
 	    HTAlert(CURRENT_LINK_STATUS_FAILED);
 	} else {
 	    char modes[80];
diff --git a/src/LYShowInfo.h b/src/LYShowInfo.h
index 3333cb4b..65eb88e5 100644
--- a/src/LYShowInfo.h
+++ b/src/LYShowInfo.h
@@ -1,4 +1,3 @@
-
 #ifndef LYSHOWINFO_H
 #define LYSHOWINFO_H
 
@@ -9,8 +8,5 @@
 extern int showinfo PARAMS((document *doc, int size_of_file, document *newdoc,
 							char *owner_address));
 
-#define SHOWINFO_TITLE "Information about the current document"
-
-
 #endif /* LYSHOWINFO_H */
 
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 58fb3452..54375259 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -277,12 +277,16 @@ PUBLIC int LYmbcsstrlen ARGS2(
 /*
  * Workaround a bug in ncurses order-of-refresh by setting a pointer to
  * the topmost window that should be displayed.
+ *
+ * FIXME: the associated call on 'keypad()' is not needed for Unix, but
+ * something in the OS/2 EMX port requires it.
  */
 PRIVATE WINDOW *my_subwindow;
 
 PUBLIC void LYsubwindow ARGS1(WINDOW *, param)
 {
-	my_subwindow = param;
+    if ((my_subwindow = param) != 0)
+	keypad(param, TRUE);
 }
 #endif
 
diff --git a/src/LYUpload.c b/src/LYUpload.c
index 8d1c5e62..b07c6818 100644
--- a/src/LYUpload.c
+++ b/src/LYUpload.c
@@ -15,6 +15,7 @@
 */
 
 #include <HTUtils.h>
+#include <HTFile.h>
 #include <HTParse.h>
 #include <HTAlert.h>
 #include <LYCurses.h>
@@ -30,7 +31,7 @@
 #include <LYexit.h>
 #include <LYLeaks.h>
 
-PUBLIC char LYUploadFileURL[256] = "\0";
+PUBLIC char LYUploadFileURL[LY_MAXPATH] = "\0";
 
 /*
  *  LYUpload uploads a file to a given location using a
@@ -44,13 +45,13 @@ PUBLIC int LYUpload ARGS1(
     char *method, *directory, *dir;
     int method_number;
     int count;
-    char tmpbuf[256];
-    char buffer[256];
+    char tmpbuf[LY_MAXPATH];
+    char buffer[LY_MAXPATH];
     lynx_html_item_type *upload_command = 0;
     int c;
     char *cp;
     FILE *fp;
-    char cmd[512];
+    char cmd[20 + (LY_MAXPATH*2)];
 #ifdef VMS
     extern BOOLEAN HadVMSInterrupt;
 #endif /* VMS */
@@ -62,7 +63,7 @@ PUBLIC int LYUpload ARGS1(
 	goto failed;
     *(directory - 1) = '\0';
     /* go past "Directory=" */
-    directory+=3;
+    directory += 3;
 
     if((method = (char *)strstr(line, "UPLOAD=")) == NULL)
 	goto failed;
@@ -207,11 +208,11 @@ PUBLIC int LYUpload_options ARGS2(
 	char **,	newfile,
 	char *, 	directory)
 {
-    static char tempfile[256];
+    static char tempfile[LY_MAXPATH];
     FILE *fp0;
     lynx_html_item_type *cur_upload;
     int count;
-    static char curloc[256];
+    static char curloc[LY_MAXPATH];
     char *cp;
 
     LYRemoveTemp(tempfile);
@@ -223,18 +224,14 @@ PUBLIC int LYUpload_options ARGS2(
 #ifdef VMS
     strcpy(curloc, "/sys$login");
 #else
-    cp = directory;
-    if (!strncmp(cp, "file://localhost", 16))
-	cp += 16;
-    else if (!strncmp(cp, "file:", 5))
-	cp += 5;
+    cp = HTfullURL_toFile(directory);
     strcpy(curloc,cp);
-    HTUnEscape(curloc);
     LYTrimPathSep(curloc);
+    free(cp);
 #endif /* VMS */
 
-    LYLocalFileToURL(LYUploadFileURL, tempfile);
-    StrAllocCopy(*newfile, LYUploadFileURL);
+    LYLocalFileToURL(newfile, tempfile);
+    strcpy(LYUploadFileURL, *newfile);
 
     BeginInternalPage(fp0, UPLOAD_OPTIONS_TITLE, UPLOAD_OPTIONS_HELP);
 
diff --git a/src/LYUtils.c b/src/LYUtils.c
index bbf90ac1..428d9281 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -14,7 +14,7 @@
 #include <LYCharSets.h>
 #include <LYCharUtils.h>
 
-#ifdef DOSPATH
+#if defined(DOSPATH) || defined(__EMX__)
 #include <HTDOS.h>
 #endif
 #ifdef DJGPP_KEYHANDLER
@@ -1933,7 +1933,7 @@ PUBLIC void statusline ARGS1(
     return;
 }
 
-static CONST char *novice_lines[] = {
+static char *novice_lines[] = {
 #ifndef NOVICE_LINE_TWO_A
 #define NOVICE_LINE_TWO_A	NOVICE_LINE_TWO
 #define NOVICE_LINE_TWO_B	""
@@ -2469,9 +2469,9 @@ PUBLIC int is_url ARGS1(
 	return(0);
 
 #if defined (DOSPATH) || defined (__EMX__) /* sorry! */
-	if (strncmp(cp, "file:///", 8) && strlen(cp) == 19 &&
-	    cp[strlen(cp)-1] == ':')
-	    StrAllocCat(cp,"/");
+    if (strncmp(cp, "file:///", 8) && strlen(cp) == 19 &&
+	cp[strlen(cp)-1] == ':')
+	StrAllocCat(cp,"/");
 #endif
 
     if (compare_type(cp, "news:", 5)) {
@@ -2734,6 +2734,7 @@ PUBLIC void remove_backslashes ARGS1(
  */
 PUBLIC char * quote_pathname ARGS1(
 	char *, 	pathname)
+#ifndef __DJGPP__
 {
     size_t i, n = 0;
     char * result;
@@ -2746,9 +2747,7 @@ PUBLIC char * quote_pathname ARGS1(
 	outofmem(__FILE__, "quote_pathname");
 
     n = 0;
-#ifndef __DJGPP__
     result[n++] = '\'';
-#endif /* __DJGPP__ */
     for (i = 0; i < strlen(pathname); i++) {
 	if (pathname[i] == '\'') {
 	    result[n++] = '\'';
@@ -2760,12 +2759,15 @@ PUBLIC char * quote_pathname ARGS1(
 	    result[n++] = pathname[i];
 	}
     }
-#ifndef __DJGPP__
     result[n++] = '\'';
-#endif /* !__DJGPP__ */
     result[n] = '\0';
     return result;
 }
+#else
+{
+	return pathname;
+}
+#endif /* !__DJGPP__ */
 
 #if HAVE_UTMP
 extern char *ttyname PARAMS((int fd));
@@ -3258,9 +3260,9 @@ PRIVATE char *fmt_tempname ARGS3(
     char *leaf;
 
     if (prefix == 0)
-    	prefix = "";
+	prefix = "";
     if (suffix == 0)
-    	suffix = "";
+	suffix = "";
     strcpy(result, prefix);
     leaf = result + strlen(result);
     counter++;
@@ -3688,10 +3690,6 @@ PUBLIC void LYConvertToURL ARGS1(
 	 cp_url--;
 	 if(*cp_url == ':')
 		 StrAllocCat(*AllocatedString,"/");
-#ifdef NOTDEFINED
-	 if(strlen(old_string) > 3 && *cp_url == '/')
-		*cp_url = '\0';
-#endif
     }
 #endif /* DOSPATH */
 
@@ -4765,7 +4763,7 @@ PUBLIC char *LYPathLeaf ARGS1(char *, pathname)
 #else
 #ifdef VMS
     if ((leaf = strrchr(pathname, ']')) == 0)
-    	leaf = strrchr(pathname, ':');
+	leaf = strrchr(pathname, ':');
     if (leaf != 0)
 	leaf++;
 #else
@@ -5339,9 +5337,6 @@ License along with the GNU C Library; see the file  COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675  Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <sys/types.h>
-#include <errno.h>
-
 #if defined(STDC_HEADERS) || defined(USG)
 #include <string.h>
 #else /* Not (STDC_HEADERS or USG): */
@@ -5444,7 +5439,7 @@ PRIVATE BOOL IsOurFile ARGS1(char *, name)
 	    if ((leaf = LYPathLeaf(path)) != path)
 		*--leaf = '\0';	/* write a null on the '/' */
 	    if (lstat(*path ? path : "/", &data) != 0) {
-	    	break;
+		break;
 	    }
 	    /*
 	     * If we find a symbolic link, it has to be in a directory that's
@@ -5822,43 +5817,48 @@ PUBLIC void LYCleanupTemp NOARGS
  * Convert a local filename to a URL
  */
 PUBLIC void LYLocalFileToURL ARGS2(
-	char *, 	target,
-	char *, 	source)
+	char **, 	target,
+	CONST char *, 	source)
 {
-#ifdef DOSPATH
-    sprintf(target, "file://localhost/%s", HTDOS_wwwName(source));
+    char *leaf;
+
+    StrAllocCopy(*target, "file://localhost");
+
+#if defined(DOSPATH) || defined(__EMX__)
+    leaf = HTDOS_wwwName(source);
 #else
 #ifdef VMS
-    sprintf(target, "file://localhost%s", HTVMS_wwwName(source));
+    leaf = HTVMS_wwwName(source);
 #else
-#ifdef __EMX__
-    sprintf(target, "file://localhost/%s", source);
-#else
-    sprintf(target, "file://localhost%s", source);
-#endif /* __EMX__ */
+    leaf = (char *)source;
 #endif /* VMS */
 #endif /* DOSPATH */
+
+    if (!LYIsHtmlSep(*leaf))
+	LYAddHtmlSep(target);
+    StrAllocCat(*target, leaf);
 }
 
+#ifdef NOTDEFINED
+/* FIXME: this may be useful for pages that do not allow nested pages */
 PUBLIC int LYOpenInternalPage ARGS2(
-	FILE *,  fp0,
+	FILE **,  fp0,
 	char **, newfile)
 {
     static char tempfile[256];
-    static char local_address[256];
 
     LYRemoveTemp(tempfile);
-    if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) {
+    if ((*fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) {
 	HTAlert(CANNOT_OPEN_TEMP);
 	return(-1);
     }
 
-    LYLocalFileToURL(local_address, tempfile);
-    StrAllocCopy(*newfile, local_address);
+    LYLocalFileToURL(newfile, tempfile);
     LYforce_no_cache = TRUE;  /* don't cache this doc */
 
     return(0);  /* OK */
 }
+#endif
 
 PUBLIC void BeginInternalPage ARGS3(
 	FILE *, fp0,
@@ -5914,7 +5914,7 @@ PUBLIC void LYTrimPathSep ARGS1(
     if (path != 0
      && (len = strlen(path)) != 0
      && LYIsPathSep(path[len-1]))
-    	path[len-1] = 0;
+	path[len-1] = 0;
 }
 
 #ifdef DOSPATH
@@ -5969,7 +5969,7 @@ PUBLIC void LYTrimHtmlSep ARGS1(
     if (path != 0
      && (len = strlen(path)) != 0
      && LYIsHtmlSep(path[len-1]))
-    	path[len-1] = 0;
+	path[len-1] = 0;
 }
 
 /*
diff --git a/src/LYUtils.h b/src/LYUtils.h
index 687007c1..e70673ea 100644
--- a/src/LYUtils.h
+++ b/src/LYUtils.h
@@ -42,7 +42,7 @@ extern int LYSystem PARAMS((char *command));
 extern int is_url PARAMS((char *filename));
 extern int number2arrows PARAMS((int number));
 extern time_t LYmktime PARAMS((char *string, BOOL absolute));
-extern int LYOpenInternalPage PARAMS((FILE *fp0, char **newfile));
+extern int LYOpenInternalPage PARAMS((FILE **fp0, char **newfile));
 extern void BeginInternalPage PARAMS((FILE *fp0, char *Title, char *HelpURL));
 extern void EndInternalPage PARAMS((FILE *fp0));
 extern void HTAddSugFilename PARAMS((char *fname));
@@ -61,7 +61,7 @@ extern void LYConvertToURL PARAMS((char **AllocatedString));
 extern void LYDoCSI PARAMS((char *url, CONST char *comment, char **csi));
 extern void LYEnsureAbsoluteURL PARAMS((char **href, CONST char *name));
 extern void LYFakeZap PARAMS((BOOL set));
-extern void LYLocalFileToURL PARAMS((char *target, char *source));
+extern void LYLocalFileToURL PARAMS((char **target, CONST char *source));
 extern void LYLocalhostAliases_free NOPARAMS;
 extern void LYRemoveTemp PARAMS((char *name));
 extern void LYTrimHtmlSep PARAMS((char *path));
diff --git a/src/LYrcFile.c b/src/LYrcFile.c
index 78639b05..579b6db5 100644
--- a/src/LYrcFile.c
+++ b/src/LYrcFile.c
@@ -43,7 +43,7 @@ PUBLIC void read_rc NOPARAMS
     /*
      *  Process the entries.
      */
-    while (fgets(line_buffer, 256, fp) != NULL) {
+    while (fgets(line_buffer, sizeof(line_buffer)-1, fp) != NULL) {
 	/*
 	 *  Remove the /n from the end of the line.
 	 */
diff --git a/src/UCdomap.c b/src/UCdomap.c
index 146538e0..4a579f34 100644
--- a/src/UCdomap.c
+++ b/src/UCdomap.c
@@ -1861,15 +1861,9 @@ PRIVATE int UC_Register_with_LYCharSets ARGS4(
     }
 
     /*
-     *	Do different kinds of searches...
-     *	Normally the first should find the match if there is one!
+     *	Search by MIME name, (LYchar_set_names may differ...)
      */
     for (i = 0; i < MAXCHARSETS && LYchar_set_names[i] && LYhndl < 0; i++) {
-	if (!strcmp(UC_LYNXcharset, LYchar_set_names[i])) {
-	    LYhndl = i;
-	}
-    }
-    for (i = 0; i < MAXCHARSETS && LYchar_set_names[i] && LYhndl < 0; i++) {
 	if (LYCharSet_UC[i].MIMEname &&
 	    !strcmp(UC_MIMEcharset, LYCharSet_UC[i].MIMEname)) {
 	    LYhndl = i;
diff --git a/src/chrtrans/cp437_uni.tbl b/src/chrtrans/cp437_uni.tbl
index 289f73ea..b84f503f 100644
--- a/src/chrtrans/cp437_uni.tbl
+++ b/src/chrtrans/cp437_uni.tbl
@@ -6,20 +6,21 @@ D0
 Mcp437
 
 #Name as a Display Charset (used on Options screen)
-OLatinUS (cp437)
+OIBM PC US codepage (cp437)
+
 #
 #    Name:     cp437_DOSLatinUS to Unicode table
-#    Unicode version: 1.1
-#    Table version: 1.1
+#    Unicode version: 2.0
+#    Table version: 2.00
 #    Table format:  Format A
-#    Date:          03/31/95
-#    Authors:       Michel Suignard <michelsu@microsoft.com>
-#                   Lori Hoerth <lorih@microsoft.com>
+#    Date:          04/24/96
+#    Authors:       Lori Brownell <loribr@microsoft.com>
+#                   K.D. Chang    <a-kchang@microsoft.com>
 #    General notes: none
 #
 #    Format: Three tab-separated columns
-#        Column #1 is the cp437_DosLatinUS code (in hex)
-#        Column #2 is the Unicode (in hex as U+XXXX)
+#        Column #1 is the cp437_DOSLatinUS code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
 #        Column #3 is the Unicode name (follows a comment sign, '#')
 #
 #    The entries are in cp437_DosLatinUS order
@@ -27,6 +28,8 @@ OLatinUS (cp437)
 # some mapppings of greek letters to latin letters added,
 #  just for fun.. - KW
 #
+#######################################
+
 0x20-0x7f	idem
 #
 0x80	U+00c7	#LATIN CAPITAL LETTER C WITH CEDILLA