about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c99
-rw-r--r--src/GridText.h2
-rw-r--r--src/HTAlert.c19
-rw-r--r--src/HTFWriter.c1
-rw-r--r--src/HTInit.c10
-rw-r--r--src/HTML.c27
-rw-r--r--src/LYBookmark.c20
-rw-r--r--src/LYCgi.c1
-rw-r--r--src/LYCharSets.c15
-rw-r--r--src/LYCharUtils.c1
-rw-r--r--src/LYClean.c2
-rw-r--r--src/LYCookie.c12
-rw-r--r--src/LYCurses.c38
-rw-r--r--src/LYDownload.c3
-rw-r--r--src/LYEdit.c1
-rw-r--r--src/LYGetFile.c4
-rw-r--r--src/LYGlobalDefs.h3
-rw-r--r--src/LYHistory.c141
-rw-r--r--src/LYHistory.h4
-rw-r--r--src/LYKeymap.c4
-rw-r--r--src/LYList.c1
-rw-r--r--src/LYLocal.c3
-rw-r--r--src/LYMail.c31
-rw-r--r--src/LYMain.c94
-rw-r--r--src/LYMainLoop.c723
-rw-r--r--src/LYMap.c1
-rw-r--r--src/LYNews.c23
-rw-r--r--src/LYOptions.c47
-rw-r--r--src/LYReadCFG.c223
-rw-r--r--src/LYShowInfo.c2
-rw-r--r--src/LYStrings.c47
-rw-r--r--src/LYStrings.h2
-rw-r--r--src/LYStyle.c16
-rw-r--r--src/LYTraversal.c36
-rw-r--r--src/LYUpload.c1
-rw-r--r--src/LYUtils.c6
-rw-r--r--src/LYUtils.h97
-rw-r--r--src/LYrcFile.c552
-rw-r--r--src/Makefile.old108
-rw-r--r--src/UCdomap.c1
-rw-r--r--src/chrtrans/Makefile.old113
-rw-r--r--src/makefile.dos1
-rw-r--r--src/makefile.dsl1
-rw-r--r--src/makefile.in2
-rw-r--r--src/makefile.wsl1
45 files changed, 1448 insertions, 1091 deletions
diff --git a/src/GridText.c b/src/GridText.c
index d637cdb8..4b836bfd 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -123,6 +123,7 @@ PUBLIC BOOLEAN bold_on      = OFF;
 PUBLIC char * source_cache_filename = NULL;
 PUBLIC HTChunk * source_cache_chunk = NULL;
 PUBLIC int LYCacheSource = SOURCE_CACHE_NONE;
+PUBLIC BOOLEAN from_source_cache = FALSE;  /* mutable */
 #endif
 
 #if defined(USE_COLOR_STYLE)
@@ -561,7 +562,7 @@ PUBLIC HText *	HText_new ARGS1(
     self->LastChar = '\0';
     self->IgnoreExcess = FALSE;
 
-#ifndef PSRC_TEST
+#ifndef USE_PSRC
     if (HTOutputFormat == WWW_SOURCE)
 	self->source = YES;
     else
@@ -1951,7 +1952,7 @@ PRIVATE void split_line ARGS2(
 	    linedata[line->size++] = LY_BOLD_START_CHAR;
 	    linedata[line->size] = '\0';
 	    ctrl_chars_on_this_line++;
-	    SpecialAttrChars++;;
+	    SpecialAttrChars++;
 	}
 	if (plen) {
 	    for (i = (plen - 1); i >= 0; i--) {
@@ -6186,14 +6187,15 @@ PUBLIC BOOLEAN HTreparse_document NOARGS
 
 	/*
 	 * This is more or less copied out of HTLoadFile(), except we don't
-	 * get a content encoding.  This may be overkill...
+	 * get a content encoding.  This may be overkill.  -dsb
 	 */
 	if (HTMainText->node_anchor->content_type) {
 	    format = HTAtom_for(HTMainText->node_anchor->content_type);
 	} else {
 	    format = HTFileFormat(HTMainText->source_cache_file, NULL, NULL);
 	    format = HTCharsetFormat(format, HTMainText->node_anchor,
-				     UCLYhndl_HTFile_for_unspec);
+					     UCLYhndl_for_unspec);
+	    /* not UCLYhndl_HTFile_for_unspec - we are talking about remote documents... */
 	}
 	CTRACE(tfp, "  Content type is \"%s\"\n", format->name);
 
@@ -6210,12 +6212,29 @@ PUBLIC BOOLEAN HTreparse_document NOARGS
 	    FREE(source_cache_filename);
 	    return FALSE;
 	}
+#ifdef DISP_PARTIAL
+	display_partial = display_partial_flag;  /* restore */
+	Newline_partial = Newline;  /* initialize */
+#endif
+	if (lynx_mode == FORMS_LYNX_MODE) {
+	    /*
+	     *  Note that if there are no form links on the current
+	     *  page, lynx_mode won't have this setting and we won't
+	     *  know that this warning should be issued. - FM
+	     */
+	    HTAlert(RELOADING_FORM);
+	}
 	ret = HTParseFile(format, HTOutputFormat, HTMainText->node_anchor,
 			  fp, NULL);
 	fclose(fp);
 	ok = (ret == HT_LOADED);
-	if (!ok)
+	if (!ok) {
 	    FREE(source_cache_filename);
+	}
+#ifdef USE_PSRC
+	else if (LYpsrc && psrc_view)
+	    HTMainText->source = TRUE;
+#endif
     }
 
     if (LYCacheSource == SOURCE_CACHE_MEMORY &&
@@ -6233,6 +6252,18 @@ PUBLIC BOOLEAN HTreparse_document NOARGS
 	source_cache_chunk = HTMainText->source_cache_chunk;
 	HTMainText->source_cache_chunk = NULL;
 
+#ifdef DISP_PARTIAL
+	display_partial = display_partial_flag;  /* restore */
+	Newline_partial = Newline;  /* initialize */
+#endif
+	if (lynx_mode == FORMS_LYNX_MODE) {
+	    /*
+	     *  Note that if there are no form links on the current
+	     *  page, lynx_mode won't have this setting and we won't
+	     *  know that this warning should be issued. - FM
+	     */
+	    HTAlert(RELOADING_FORM);
+	}
 	ret = HTParseMem(format, HTOutputFormat, HTMainText->node_anchor,
 			 source_cache_chunk, NULL);
 	ok = (ret == HT_LOADED);
@@ -6240,12 +6271,59 @@ PUBLIC BOOLEAN HTreparse_document NOARGS
 	    HTChunkFree(source_cache_chunk);
 	    source_cache_chunk = NULL;
 	}
+#ifdef USE_PSRC
+	else if (LYpsrc && psrc_view)
+	    HTMainText->source = TRUE;
+#endif
     }
 
+    /*
+     * I have no idea what this does, but it seems to be necessary... -dsb
+     */
+    LYUCPopAssumed();
+
     CTRACE(tfp, "Reparse %s\n", (ok ? "succeeded" : "failed"));
+
+    if (ok)  {/* fix few flags: */
+	from_source_cache = TRUE;  /* flag for mainloop events */
+#ifdef USE_PSRC
+	if (LYpsrc && psrc_view)
+	    HTMainText->source = TRUE;
+#endif
+	more = HText_canScrollDown();  /* the length may be changed */
+    }
+
     return ok;
 }
 
+PUBLIC BOOLEAN HTcan_reparse_document NOARGS
+{
+    if (!HTMainText || LYCacheSource == SOURCE_CACHE_NONE ||
+	(LYCacheSource == SOURCE_CACHE_FILE &&
+	 !HTMainText->source_cache_file) ||
+	(LYCacheSource == SOURCE_CACHE_MEMORY &&
+	 !HTMainText->source_cache_chunk))
+	return FALSE;
+
+    if (LYCacheSource == SOURCE_CACHE_FILE && HTMainText->source_cache_file) {
+	FILE * fp;
+
+	fp = fopen(HTMainText->source_cache_file, "r");
+	if (!fp) {
+	    return FALSE;
+	}
+	fclose(fp);
+	return TRUE;
+    }
+
+    if (LYCacheSource == SOURCE_CACHE_MEMORY &&
+	HTMainText->source_cache_chunk) {
+	return TRUE;
+    }
+
+    return FALSE;  /* if came to here */
+}
+
 PRIVATE void trace_setting_change ARGS3(
 	CONST char *,	name,
 	BOOLEAN,	prev_setting,
@@ -6305,7 +6383,7 @@ PUBLIC BOOLEAN HTdocument_settings_changed NOARGS
 	    HTMainText->cols != LYcols);
 }
 #endif
- 
+
 PUBLIC int HTisDocumentSource NOARGS
 {
     return (HTMainText != 0) ? HTMainText->source : FALSE;
@@ -6473,6 +6551,15 @@ PUBLIC void HText_NegateLineOne ARGS1(
     return;
 }
 
+PUBLIC BOOL HText_inLineOne ARGS1(
+	HText *,	text)
+{
+    if (text) {
+	return text->in_line_1;
+    }
+    return YES;
+}
+
 /*
  *  This function is for removing the first of two
  *  successive blank lines.  It should be called after
diff --git a/src/GridText.h b/src/GridText.h
index 3e83a740..a25ed496 100644
--- a/src/GridText.h
+++ b/src/GridText.h
@@ -168,6 +168,7 @@ extern int HTisDocumentSource NOPARAMS;
 extern void HTuncache_current_document NOPARAMS;
 #ifdef SOURCE_CACHE
 extern BOOLEAN HTreparse_document NOPARAMS;
+extern BOOLEAN HTcan_reparse_document NOPARAMS;
 extern BOOLEAN HTdocument_settings_changed NOPARAMS;
 #endif
 extern int HText_getTopOfScreen NOPARAMS;
@@ -186,6 +187,7 @@ extern char * HTLoadedDocumentBookmark NOPARAMS;
 extern int HText_LastLineSize PARAMS((HText *me, BOOL IgnoreSpaces));
 extern int HText_PreviousLineSize PARAMS((HText *me, BOOL IgnoreSpaces));
 extern void HText_NegateLineOne PARAMS((HText *text));
+extern BOOL HText_inLineOne PARAMS((HText *text));
 extern void HText_RemovePreviousLine PARAMS((HText *text));
 extern int HText_getCurrentColumn PARAMS((HText *text));
 extern int HText_getMaximumColumn PARAMS((HText *text));
diff --git a/src/HTAlert.c b/src/HTAlert.c
index 34b828ba..205dc82c 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -18,6 +18,7 @@
 #include <LYClean.h>
 #include <GridText.h>
 #include <LYCookie.h>
+#include <LYHistory.h> /* store statusline messages */
 
 #include <LYLeaks.h>
 
@@ -30,6 +31,7 @@ PUBLIC void HTAlert ARGS1(
     CTRACE(tfp, "\nAlert!: %s\n\n", Msg);
     CTRACE_FLUSH(tfp);
     _user_message(ALERT_FORMAT, Msg);
+    LYstore_message2(ALERT_FORMAT, Msg);
 
     sleep(AlertSecs);
 }
@@ -69,6 +71,7 @@ PUBLIC void HTInfoMsg ARGS1(
     _statusline(Msg);
     if (Msg && *Msg) {
 	CTRACE(tfp, "Info message: %s\n", Msg);
+	LYstore_message(Msg);
 	sleep(InfoSecs);
     }
 }
@@ -82,6 +85,7 @@ PUBLIC void HTUserMsg ARGS1(
     _statusline(Msg);
     if (Msg && *Msg) {
 	CTRACE(tfp, "User message: %s\n", Msg);
+	LYstore_message(Msg);
 	sleep(MessageSecs);
     }
 }
@@ -95,6 +99,7 @@ PUBLIC void HTUserMsg2 ARGS2(
 	CTRACE(tfp, "User message: ");
 	CTRACE(tfp, Msg2, Arg);
 	CTRACE(tfp, "\n");
+	LYstore_message2(Msg2, Arg);
 	sleep(MessageSecs);
     }
 }
@@ -105,10 +110,9 @@ PUBLIC void HTUserMsg2 ARGS2(
 PUBLIC void HTProgress ARGS1(
 	CONST char *,	Msg)
 {
-    if (TRACE)
-	fprintf(tfp, "%s\n", Msg);
-    else
-	statusline(Msg);
+    statusline(Msg);
+    LYstore_message(Msg); 
+    CTRACE(tfp, "%s\n", Msg); 
 }
 
 /*	Issue a read-progress message.			HTReadProgress()
@@ -174,7 +178,12 @@ PUBLIC void HTReadProgress ARGS2(
 		if (total < -1)
 		    strcat(line, gettext(" (Press 'z' to abort)"));
 	    }
-	    HTProgress(line);
+ 
+	    /* do not store the message for history page. */ 
+	    if (TRACE) 
+		fprintf(tfp, "%s\n", line); 
+	    else 
+		statusline(line); 
 	}
     }
 }
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index 4f33d01e..60b710f6 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -23,7 +23,6 @@
 #include <LYUtils.h>
 #include <LYGlobalDefs.h>
 #include <LYClean.h>
-#include <LYSignal.h>
 #include <GridText.h>
 #include <LYexit.h>
 #include <LYLeaks.h>
diff --git a/src/HTInit.c b/src/HTInit.c
index f6ab32fa..836a3422 100644
--- a/src/HTInit.c
+++ b/src/HTInit.c
@@ -272,16 +272,14 @@ PRIVATE int ProcessMailcapEntry ARGS2(
 	struct MailcapEntry *,	mc)
 {
     size_t rawentryalloc = 2000, len;
-    char *rawentry, *s, *t, *LineBuf;
+    char *rawentry, *s, *t;
+    char *LineBuf = NULL;
 
-    LineBuf = (char *)malloc(LINE_BUF_SIZE);
-    if (!LineBuf)
-	ExitWithError(MEMORY_EXHAUSTED_ABORT);
     rawentry = (char *)malloc(1 + rawentryalloc);
     if (!rawentry)
 	ExitWithError(MEMORY_EXHAUSTED_ABORT);
     *rawentry = '\0';
-    while (fgets(LineBuf, LINE_BUF_SIZE, fp)) {
+    while ((LineBuf = LYSafeGets(LineBuf, fp)) != 0) {
 	if (LineBuf[0] == '#')
 	    continue;
 	len = strlen(LineBuf);
@@ -304,8 +302,6 @@ PRIVATE int ProcessMailcapEntry ARGS2(
 	}
     }
 
-    FREE(LineBuf);
-
     s = LYSkipBlanks(rawentry);
     if (!*s) {
 	/* totally blank entry -- quietly ignore */
diff --git a/src/HTML.c b/src/HTML.c
index 40cb1f2d..09c10d4e 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -49,12 +49,15 @@
 #include <LYCurses.h>
 #endif /* VMS */
 
+#ifdef USE_PSRC
+#include <LYPrettySrc.h>
+#endif
+
 #ifdef USE_COLOR_STYLE
 #include <SGML.h>
 #include <AttrList.h>
 #include <LYHash.h>
 #include <LYStyle.h>
-#include <LYPrettySrc.h>
 #undef SELECTED_STYLES
 #define pHText_changeStyle(X,Y,Z) {}
 
@@ -2281,7 +2284,23 @@ PRIVATE void HTML_start_element ARGS6(
     case HTML_DT:
 	CHECK_ID(HTML_GEN_ID);
 	if (!me->style_change) {
+	    BOOL in_line_1 = HText_inLineOne(me->text);
+	    HTCoord saved_spaceBefore = me->sp->style->spaceBefore;
+	    HTCoord saved_spaceAfter = me->sp->style->spaceAfter;
+	    /*
+	     *  If there are several DT elements and this is not the first,
+	     *  and the preceding DT element's first (and normally only) line
+	     *  has not yet been ended, suppress intervening blank line by
+	     *  temporarily modifying the paragraph style in place.  Ugly
+	     *  but there's ample precedence. - kw
+	     */
+	    if (in_line_1) {
+		me->sp->style->spaceBefore = 0;	/* temporary change */
+		me->sp->style->spaceAfter = 0;	/* temporary change */
+	    }
 	    HText_appendParagraph(me->text);
+	    me->sp->style->spaceBefore = saved_spaceBefore; /* undo */
+	    me->sp->style->spaceAfter = saved_spaceAfter; /* undo */
 	    me->in_word = NO;
 	    me->sp->style->alignment = HT_LEFT;
 	}
@@ -7696,19 +7715,19 @@ PRIVATE HTStream* CacheThru_new ARGS2(
 {
     char filename[LY_MAXPATH];
     HTStream *stream = NULL;
-    HTProtocol *p = (HTProtocol *)anchor->protocol;
+/*    HTProtocol *p = (HTProtocol *)anchor->protocol; */
 
     /*
      * Neatly and transparently vanish if source caching is disabled.
      */
     if (LYCacheSource == SOURCE_CACHE_NONE)
 	return target;
-
+/*
     if (strcmp(p->name, "http") != 0) {
 	CTRACE(tfp, "Protocol is \"%s\"; not caching\n", p->name);
 	return target;
     }
-
+*/
     stream = (HTStream *) malloc(sizeof(*stream));
     if (!stream)
 	outofmem(__FILE__, "CacheThru_new");
diff --git a/src/LYBookmark.c b/src/LYBookmark.c
index 752de49d..4fe72e30 100644
--- a/src/LYBookmark.c
+++ b/src/LYBookmark.c
@@ -53,7 +53,7 @@ PUBLIC char * get_bookmark_filename ARGS1(
 	char **,	URL)
 {
     static char filename_buffer[LY_MAXPATH];
-    char string_buffer[BUFSIZ];
+    char *string_buffer;
     FILE *fp;
     int MBM_tmp;
 
@@ -107,21 +107,21 @@ success:
      *	We now have the file open.
      *	Check if it is a mosaic hotlist.
      */
-    if (fgets(string_buffer, sizeof(string_buffer)-1, fp) &&
-	!strncmp(string_buffer, "ncsa-xmosaic-hotlist-format-1", 29)) {
+    if ((string_buffer = LYSafeGets(NULL, fp)) != 0
+     && !strncmp(string_buffer, "ncsa-xmosaic-hotlist-format-1", 29)) {
 	char *newname;
 	/*
 	 *  It is a mosaic hotlist file.
 	 */
 	is_mosaic_hotlist = TRUE;
-	fclose(fp);
 	newname = convert_mosaic_bookmark_file(filename_buffer);
 	LYLocalFileToURL(URL, newname);
     } else {
-	fclose(fp);
 	is_mosaic_hotlist = FALSE;
 	LYLocalFileToURL(URL, filename_buffer);
     }
+    FREE(string_buffer);
+    fclose(fp);
 
     return(filename_buffer);  /* bookmark file exists */
 
@@ -136,7 +136,7 @@ PRIVATE char * convert_mosaic_bookmark_file ARGS1(
 {
     static char newfile[LY_MAXPATH];
     FILE *fp, *nfp;
-    char buf[BUFSIZ];
+    char *buf = NULL;
     int line = -2;
     char *endline;
 
@@ -157,7 +157,7 @@ PRIVATE char * convert_mosaic_bookmark_file ARGS1(
      remove bookmark command, it is usually the 'R' key but may have\n\
      been remapped by you or your system administrator."));
 
-    while (fgets(buf, sizeof(buf), fp) != NULL) {
+    while ((buf = LYSafeGets(buf, fp)) != NULL) {
 	if(line >= 0) {
 	    endline = &buf[strlen(buf)-1];
 	    if(*endline == '\n')
@@ -414,7 +414,7 @@ PUBLIC void remove_bookmark_link ARGS2(
 	char *, 	cur_bookmark_page)
 {
     FILE *fp, *nfp;
-    char buf[BUFSIZ];
+    char *buf = NULL;
     int n;
 #ifdef VMS
     char filename_buffer[NAM$C_MAXRSS+12];
@@ -466,7 +466,7 @@ PUBLIC void remove_bookmark_link ARGS2(
     if (is_mosaic_hotlist) {
 	int del_line = cur*2;  /* two lines per entry */
 	n = -3;  /* skip past cookie and name lines */
-	while (fgets(buf, sizeof(buf), fp) != NULL) {
+	while ((buf = LYSafeGets(buf, fp)) != NULL) {
 	    n++;
 	    if (n == del_line || n == del_line+1)
 		continue;  /* remove two lines */
@@ -480,7 +480,7 @@ PUBLIC void remove_bookmark_link ARGS2(
 	int seen;
 
 	n = -1;
-	while (fgets(buf, sizeof(buf), fp) != NULL) {
+	while ((buf = LYSafeGets(buf, fp)) != NULL) {
 	    retain = TRUE;
 	    seen = 0;
 	    cp = buf;
diff --git a/src/LYCgi.c b/src/LYCgi.c
index 099a514e..981d1c8e 100644
--- a/src/LYCgi.c
+++ b/src/LYCgi.c
@@ -41,7 +41,6 @@
 #include <LYBookmark.h>
 #include <GridText.h>
 #include <LYCgi.h>
-#include <LYSignal.h>
 #include <LYStrings.h>
 #include <LYLocal.h>
 
diff --git a/src/LYCharSets.c b/src/LYCharSets.c
index 7f43fbe6..f4bd9b39 100644
--- a/src/LYCharSets.c
+++ b/src/LYCharSets.c
@@ -6,7 +6,6 @@
 #include <UCMap.h>
 #include <UCDefs.h>
 #include <LYCharSets.h>
-#include <LYCharUtils.h>
 #include <HTFont.h>
 #include <GridText.h>
 #include <LYCurses.h>
@@ -396,6 +395,8 @@ PUBLIC int LYlowest_eightbit[MAXCHARSETS]={
 PUBLIC void HTMLSetCharacterHandling ARGS1(int,i)
 {
     int chndl = safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset);
+    BOOLEAN LYRawMode_flag = LYRawMode;
+    int UCLYhndl_for_unspec_flag = UCLYhndl_for_unspec;
 
     if (LYCharSet_UC[i].enc != UCT_ENC_CJK) {
 	HTCJK = NOCJK;
@@ -483,6 +484,18 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i)
 
     ena_csi((LYlowest_eightbit[current_char_set] > 155));
 
+    /* some diagnostics */
+    if (TRACE) {
+	if (LYRawMode_flag != LYRawMode)
+	    CTRACE(tfp, "HTMLSetCharacterHandling: LYRawMode changed %s -> %s\n",
+			(LYRawMode_flag ? "ON" : "OFF"),
+			(LYRawMode	? "ON" : "OFF"));
+	if (UCLYhndl_for_unspec_flag != UCLYhndl_for_unspec)
+	    CTRACE(tfp, "HTMLSetCharacterHandling: UCLYhndl_for_unspec changed %d -> %d\n",
+			UCLYhndl_for_unspec_flag,
+			UCLYhndl_for_unspec);
+    }
+
     return;
 }
 
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index f6ef85d3..b21c43e4 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -29,7 +29,6 @@
 #include <HTForms.h>
 #include <HTNestedList.h>
 #include <GridText.h>
-#include <LYSignal.h>
 #include <LYStrings.h>
 #include <LYUtils.h>
 #include <LYMap.h>
diff --git a/src/LYClean.c b/src/LYClean.c
index 1b6b5e32..34961766 100644
--- a/src/LYClean.c
+++ b/src/LYClean.c
@@ -5,7 +5,6 @@
 #include <LYClean.h>
 #include <LYMainLoop.h>
 #include <LYGlobalDefs.h>
-#include <LYStrings.h>
 #include <LYTraversal.h>
 #include <LYCookie.h>
 #include <UCAuto.h>
@@ -104,6 +103,7 @@ PUBLIC void cleanup_sig ARGS1(
 	    cleanup();
 	}
 	if (sig != 0) {
+	    SetOutputMode(O_TEXT);
 	    printf("\n\n%s %d\n\n",
 		   gettext("Exiting via interrupt:"),
 		   sig);
diff --git a/src/LYCookie.c b/src/LYCookie.c
index 6c56aa85..162bd765 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -59,7 +59,6 @@
 #include <HTParse.h>
 #include <HTAlert.h>
 #include <LYCurses.h>
-#include <LYSignal.h>
 #include <LYUtils.h>
 #include <LYCharUtils.h>
 #include <LYClean.h>
@@ -1952,7 +1951,7 @@ PUBLIC void LYLoadCookies ARGS1 (
 	char *,		cookie_file)
 {
     FILE *cookie_handle;
-    char buf[max_cookies_buffer+10]; /* should be long enough for a cookie line */
+    char *buf = NULL;
     static char domain[256], path[LY_MAXPATH], name[256], value[4100];
     static char what[8], secure[8], expires_a[16];
     static struct {
@@ -1977,18 +1976,13 @@ PUBLIC void LYLoadCookies ARGS1 (
     CTRACE(tfp, "LYLoadCookies: reading cookies from %s\n", cookie_file);
 
     number_of_file_cookies = 0;
-    while (!feof(cookie_handle)) {
+    while ((buf = LYSafeGets(buf, cookie_handle)) != 0) {
 	cookie *moo;
 	unsigned i = 0;
 	int tok_loop;
 	char *tok_out, *tok_ptr;
-	char *j;
-
-	j = fgets(buf, sizeof(buf)-1, cookie_handle);
 
-	if((j == NULL) || (buf[0] == '\0' || buf[0] == '\n' || buf[0] == '#')) {
-	    if (j == NULL && ferror(cookie_handle))
-		break;
+	if ((buf[0] == '\0' || buf[0] == '\n' || buf[0] == '#')) {
 	    continue;
 	}
 
diff --git a/src/LYCurses.c b/src/LYCurses.c
index 8433cec5..f836bb4d 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -622,6 +622,7 @@ PUBLIC void lynx_setup_colors NOARGS
 }
 #endif /* USE_COLOR_TABLE */
 
+#ifdef NOTUSED
 #if defined (DJGPP) && !defined (USE_SLANG)
 /*
  * Sorry about making a completely new function,
@@ -660,6 +661,10 @@ PUBLIC void start_curses NOARGS
     noecho();
 }
 #else
+#endif /* defined (DJGPP) && !defined (USE_SLANG) */
+#endif /* NOTUSED */
+
+
 PUBLIC void start_curses NOARGS
 {
 #ifdef USE_SLANG
@@ -758,13 +763,15 @@ PUBLIC void start_curses NOARGS
 
 #else /* Using curses: */
 
+
 #ifdef VMS
     /*
      *	If we are VMS then do initscr() everytime start_curses()
      *	is called!
      */
     initscr();	/* start curses */
-#else /* Unix: */
+#else  /* Unix: */
+
     static BOOLEAN first_time = TRUE;
 
     if (first_time) {
@@ -827,7 +834,10 @@ PUBLIC void start_curses NOARGS
 	lynx_called_initscr = TRUE;
 #endif /* USE_COLOR_TABLE */
     }
-#endif /* VMS */
+#ifdef __DJGPP__
+    else sock_init();
+#endif /* __DJGPP__ */
+#endif /* not VMS */
 
     /* nonl();	 */ /* seems to slow things down */
 
@@ -862,7 +872,7 @@ PUBLIC void start_curses NOARGS
 
     LYCursesON = TRUE;
 }
-#endif /* defined (DJGPP) && !defined (USE_SLANG) */
+
 
 PUBLIC void lynx_enable_mouse ARGS1(int,state)
 {
@@ -1048,8 +1058,8 @@ PUBLIC BOOLEAN setup ARGS1(
 PUBLIC BOOLEAN setup ARGS1(
 	char *, 	terminal)
 {
-    static char term_putenv[112];
-    char buffer[108];
+    char *term_putenv;
+    char *buffer = NULL;
     char *cp;
 #if defined(HAVE_SIZECHANGE) && !defined(USE_SLANG) && defined(NOTDEFINED)
 /*
@@ -1085,7 +1095,7 @@ PUBLIC BOOLEAN setup ARGS1(
     }
 
     if (terminal != NULL) {
-	sprintf(term_putenv, "TERM=%.106s", terminal);
+	HTSprintf0(&term_putenv, "TERM=%.106s", terminal);
 	(void) putenv(term_putenv);
     }
 
@@ -1097,15 +1107,17 @@ PUBLIC BOOLEAN setup ARGS1(
 
 	printf("\n\n  %s\n\n", gettext("Your Terminal type is unknown!"));
 	printf("  %s [vt100] ", gettext("Enter a terminal type:"));
-	*buffer = '\0';
-	fgets(buffer, sizeof(buffer), stdin);
-	if ((s = strchr(buffer, '\n')) != NULL)
-	    *s = '\0';
 
-	if (strlen(buffer) == 0)
-	    strcpy(buffer,"vt100");
+	if ((buffer = LYSafeGets(buffer, stdin)) != 0)
+	    if ((s = strchr(buffer, '\n')) != NULL)
+		*s = '\0';
+
+	if (buffer == 0 || *buffer == 0)
+	    StrAllocCopy(buffer,"vt100");
+
+	HTSprintf0(&term_putenv,"TERM=%.106s", buffer);
+	FREE(buffer);
 
-	sprintf(term_putenv,"TERM=%.106s", buffer);
 	(void) putenv(term_putenv);
 	printf("\n%s %s\n", gettext("TERMINAL TYPE IS SET TO"), getenv("TERM"));
 	sleep(MESSAGESECS);
diff --git a/src/LYDownload.c b/src/LYDownload.c
index 15f292d0..30e374d6 100644
--- a/src/LYDownload.c
+++ b/src/LYDownload.c
@@ -6,7 +6,6 @@
 #include <LYUtils.h>
 #include <LYGlobalDefs.h>
 #include <LYStrings.h>
-#include <LYGetFile.h>
 #include <LYDownload.h>
 
 #include <LYLeaks.h>
@@ -414,7 +413,7 @@ check_recall:
 	     */
 	    count = 1;
 	    HTAddParam(&the_command, download_command->command, count, file);
-	    if (HTCountCommandArgs(download_command->command) > 1) 
+	    if (HTCountCommandArgs(download_command->command) > 1)
 		HTAddParam(&the_command, download_command->command, ++count, buffer);
 	    HTEndParam(&the_command, download_command->command, count);
 
diff --git a/src/LYEdit.c b/src/LYEdit.c
index d7445630..8e2ab7a9 100644
--- a/src/LYEdit.c
+++ b/src/LYEdit.c
@@ -5,7 +5,6 @@
 #include <LYUtils.h>
 #include <LYGlobalDefs.h>
 #include <LYEdit.h>
-#include <LYStrings.h>
 #ifdef VMS
 #include <unixio.h>
 #endif /* VMS */
diff --git a/src/LYGetFile.c b/src/LYGetFile.c
index 678bf56b..7475f0ef 100644
--- a/src/LYGetFile.c
+++ b/src/LYGetFile.c
@@ -259,6 +259,10 @@ Try_Redirected_URL:
 		    return(lynx_compile_opts(doc));
 #endif
 
+		} else if (url_type == LYNXMESSAGES_URL_TYPE) {
+		    /* show list of recent statusline messages */
+		    return(LYshow_statusline_messages(doc));
+
 #ifndef DISABLE_NEWS
 		} else if (url_type == NEWSPOST_URL_TYPE ||
 			   url_type == NEWSREPLY_URL_TYPE ||
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index a7ae11e3..adf37ba6 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -252,6 +252,7 @@ extern BOOLEAN soft_dquotes;
 #ifdef SOURCE_CACHE
 extern char * source_cache_filename;
 extern HTChunk * source_cache_chunk;
+extern BOOLEAN from_source_cache; /* mutable */
 extern int LYCacheSource;
 #define SOURCE_CACHE_NONE	0
 #define SOURCE_CACHE_FILE	1
@@ -271,6 +272,8 @@ extern int Newline_partial;          /* -//- "current" newline position */
 extern int NumOfLines_partial;       /* -//- "current" number of lines */
 extern int partial_threshold;
 extern BOOLEAN debug_display_partial;  /* show with MessageSecs delay */
+extern BOOLEAN display_partial_flag; /* permanent flag, not mutable */
+extern int Newline; /* original newline position, from mainloop() */
 #endif
 extern char *form_post_data;         /* User data for post form */
 extern char *form_get_data;          /* User data for get form */
diff --git a/src/LYHistory.c b/src/LYHistory.c
index 813eedb6..a25e6602 100644
--- a/src/LYHistory.c
+++ b/src/LYHistory.c
@@ -1,5 +1,6 @@
 #include <HTUtils.h>
 #include <HTTP.h>
+#include <GridText.h>
 #include <HTAlert.h>
 #include <HText.h>
 #include <LYGlobalDefs.h>
@@ -11,9 +12,9 @@
 #include <LYKeymap.h>
 #include <LYList.h>
 #include <LYShowInfo.h>
-#include <LYSignal.h>
 #include <LYStrings.h>
 #include <LYCharUtils.h>
+#include <LYGetFile.h>
 
 #ifdef DIRED_SUPPORT
 #include <LYUpload.h>
@@ -83,6 +84,7 @@ PUBLIC void LYAddVisitedLink ARGS1(
 	!strcmp((doc->title ? doc->title : ""), ADDRLIST_PAGE_TITLE) ||
 #endif
 	!strcmp((doc->title ? doc->title : ""), SHOWINFO_TITLE) ||
+	!strcmp((doc->title ? doc->title : ""), STATUSLINES_TITLE) ||
 	!strcmp((doc->title ? doc->title : ""), CONFIG_DEF_TITLE) ||
 	!strcmp((doc->title ? doc->title : ""), LYNXCFG_TITLE) ||
 	!strcmp((doc->title ? doc->title : ""), COOKIE_JAR_TITLE) ||
@@ -335,7 +337,6 @@ PUBLIC void LYpop ARGS1(
 #ifdef DISP_PARTIAL
 	/* assume we pop the 'doc' to show it soon... */
 	Newline_partial = doc->line;	/* reinitialize */
-	NumOfLines_partial = -1;	/* initialize to -1 */
 #endif /* DISP_PARTIAL */
 	CTRACE(tfp, "LYpop[%d]: address:%s\n     title:%s\n",
 		    nhist, doc->address, doc->title);
@@ -365,7 +366,6 @@ PUBLIC void LYpop_num ARGS2(
 #ifdef DISP_PARTIAL
 	/* assume we pop the 'doc' to show it soon... */
 	Newline_partial = doc->line;	/* reinitialize */
-	NumOfLines_partial = -1;	/* initialize to -1 */
 #endif /* DISP_PARTIAL */
     }
 }
@@ -394,7 +394,11 @@ PUBLIC int showhistory ARGS1(
 
     BeginInternalPage(fp0, HISTORY_PAGE_TITLE, HISTORY_PAGE_HELP);
 
+    fprintf(fp0, "<tr align=right> <a href=\"LYNXMESSAGES:\">[%s]</a> </tr>\n",
+		 STATUSLINES_TITLE);
+
     fprintf(fp0, "<pre>\n");
+
     fprintf(fp0, "<em>%s</em>\n", gettext("You selected:"));
     for (x = nhist-1; x >= 0; x--) {
 	/*
@@ -459,6 +463,12 @@ PUBLIC BOOLEAN historytarget ARGS1(
     if ((number = atoi(newdoc->address+9)) > nhist || number < 0)
 	return(FALSE);
 
+    /*
+     * Optimization: assume we came from the History Page,
+     * so never return back - always a new version next time.
+     */
+    HTuncache_current_document();  /* don't waste the cache */
+
     LYpop_num(number, newdoc);
     if (((newdoc->internal_link &&
 	  history[number].intern_seq_start == history[nhist-1].intern_seq_start) ||
@@ -591,3 +601,128 @@ PUBLIC int LYShowVisitedLinks ARGS1(
     FREE(Address);
     return(0);
 }
+
+
+/*
+ *  Keep cycled buffer for statusline messages.
+ */
+#define STATUSBUFSIZE   40
+PRIVATE char * buffstack[STATUSBUFSIZE];
+PRIVATE int topOfStack = 0;
+
+PRIVATE void to_stack ARGS1(char *, str)
+{
+    /*
+     *  Cycle buffer:
+     */
+    if (topOfStack == STATUSBUFSIZE) {
+        topOfStack = 0;
+    }
+
+    /*
+     *  Register string.
+     */
+    FREE(buffstack[topOfStack]);
+    buffstack[topOfStack] = str;
+    topOfStack++;
+}
+
+#ifdef LY_FIND_LEAKS
+PRIVATE void free_messages_stack NOARGS
+{
+    topOfStack = STATUSBUFSIZE;
+
+    while (--topOfStack >= 0) {
+	FREE(buffstack[topOfStack]);
+    }
+}
+#endif
+
+/*
+ *  Status line messages list, LYNXMESSAGES:/ internal page,
+ *  called from getfile() cyrcle.
+ */
+PUBLIC int LYshow_statusline_messages ARGS1(
+    document *,			      newdoc)
+{
+    static char tempfile[LY_MAXPATH];
+    static char *info_url;
+    DocAddress WWWDoc;  /* need on exit */
+    FILE *fp0;
+    int i;
+
+    LYRemoveTemp(tempfile);
+    if ((fp0 = LYOpenTemp (tempfile, HTML_SUFFIX, "w")) == 0) {
+	HTAlert(CANNOT_OPEN_TEMP);
+	return(NOT_FOUND);
+    }
+    LYLocalFileToURL(&info_url, tempfile);
+
+    LYforce_no_cache = TRUE;  /* don't cache this doc */
+
+    BeginInternalPage (fp0, STATUSLINES_TITLE, NULL);
+    fprintf(fp0, "<pre>\n");
+    fprintf(fp0, "<ol>\n");
+
+    i = topOfStack;
+    while (--i >= 0) {
+	if (buffstack[i] != NULL)
+	    fprintf(fp0,  "<li> <em>%s</em>\n",  buffstack[i]);
+    }
+    i = STATUSBUFSIZE;
+    while (--i >= topOfStack) {
+	if (buffstack[i] != NULL)
+	fprintf(fp0,  "<li> <em>%s</em>\n",  buffstack[i]);
+    }
+
+    fprintf(fp0, "</ol>\n");
+    fprintf(fp0, "</pre>\n");
+    EndInternalPage(fp0);
+    LYCloseTempFP(fp0);
+
+
+    /* exit to getfile() cyrcle */
+    StrAllocCopy(newdoc->address, info_url);
+    WWWDoc.address = newdoc->address;
+    WWWDoc.post_data = newdoc->post_data;
+    WWWDoc.post_content_type = newdoc->post_content_type;
+    WWWDoc.bookmark = newdoc->bookmark;
+    WWWDoc.isHEAD = newdoc->isHEAD;
+    WWWDoc.safe = newdoc->safe;
+
+    if (!HTLoadAbsolute(&WWWDoc))
+	return(NOT_FOUND);
+    return(NORMAL);
+}
+
+
+PUBLIC void LYstore_message2 ARGS2(
+	CONST char *,	message,
+	CONST char *,	argument)
+{
+    char *temp = NULL;
+
+    if (message == NULL)
+	return;
+
+    HTSprintf(&temp, message, (argument == 0) ? "" : argument);
+
+    to_stack(temp);
+
+    return;
+}
+PUBLIC void LYstore_message ARGS1(
+	CONST char *,	message)
+{
+    char *temp = NULL;
+
+    if (message == NULL)
+	return;
+
+    HTSprintf(&temp, message);
+
+    to_stack(temp);
+
+    return;
+}
+
diff --git a/src/LYHistory.h b/src/LYHistory.h
index 7593a2ca..054b2a30 100644
--- a/src/LYHistory.h
+++ b/src/LYHistory.h
@@ -14,4 +14,8 @@ extern void LYpop PARAMS((document *doc));
 extern void LYpop_num PARAMS((int number, document *doc));
 extern void LYpush PARAMS((document *doc, BOOLEAN force_push));
 
+extern void LYstore_message2 PARAMS((CONST char *message, CONST char *argument));
+extern void LYstore_message PARAMS((CONST char *message));
+extern int LYshow_statusline_messages PARAMS((document *newdoc));
+
 #endif /* LYHISTORY_H */
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index 3a165dce..b7dd523a 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -297,8 +297,8 @@ LYK_UP_TWO,       LYK_DOWN_TWO,     LYK_DO_NOTHING, LYK_FASTBACKW_LINK,
    0,                  0,              0,             0,
    0,                  0,              0,             0,
    0,                  0,              0,             0,
-   0,                  0,              LYK_WHEREIS,   LYK_ACTIVATE,
-                                       /* KP_SLASH    KP_ENTER */
+   0,                  0,              LYK_WHEREIS,   0,
+                                       /* KP_SLASH */
    0,                  0,              0,           LYK_IMAGE_TOGGLE,
                                                     /* KP_* */
    LYK_PREV_PAGE,      LYK_NEXT_PAGE,  0,             0,
diff --git a/src/LYList.c b/src/LYList.c
index b73bb61d..0374f31e 100644
--- a/src/LYList.c
+++ b/src/LYList.c
@@ -11,7 +11,6 @@
 #include <GridText.h>
 #include <LYList.h>
 #include <LYClean.h>
-#include <LYSignal.h>
 #include <LYGlobalDefs.h>
 #include <LYCharUtils.h>
 
diff --git a/src/LYLocal.c b/src/LYLocal.c
index 9a590758..f968da0b 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -39,7 +39,6 @@
 #include <LYStrings.h>
 #include <LYCharUtils.h>
 #include <LYStructs.h>
-#include <LYGetFile.h>
 #include <LYHistory.h>
 #include <LYUpload.h>
 #include <LYLocal.h>
@@ -329,7 +328,7 @@ PRIVATE BOOLEAN not_already_exists ARGS1(char *, name)
     return FALSE;
 }
 
-PRIVATE BOOLEAN dir_has_same_owner ARGS2(struct stat *, info, int, owner)
+PRIVATE BOOLEAN dir_has_same_owner ARGS2(struct stat *, info, uid_t, owner)
 {
     if (S_ISDIR(info->st_mode)) {
 	if (info->st_uid == owner) {
diff --git a/src/LYMail.c b/src/LYMail.c
index 3250ccbf..eeb96cd5 100644
--- a/src/LYMail.c
+++ b/src/LYMail.c
@@ -594,7 +594,7 @@ PUBLIC void mailmsg ARGS4(
     FILE *fd, *fp;
     char *address = NULL;
     char *searchpart = NULL;
-    char cmd[512], *cp, *cp0, *cp1;
+    char *cmd = NULL, *cp, *cp0, *cp1;
 #if defined(VMS) || defined(DOSPATH)
     char my_tmpfile[LY_MAXPATH];
     char *command = NULL;
@@ -693,7 +693,7 @@ PUBLIC void mailmsg ARGS4(
     }
 
 #ifdef UNIX
-    sprintf(cmd, "%s %s", system_mail, system_mail_flags);
+    HTSprintf0(&cmd, "%s %s", system_mail, system_mail_flags);
     if ((fd = popen(cmd, "w")) == NULL) {
 	FREE(address);
 	CTRACE(tfp, "mailmsg: '%s' failed.\n",
@@ -744,7 +744,8 @@ PUBLIC void mailmsg ARGS4(
     if ((LynxSigFile != NULL) &&
 	(fp = fopen(LynxSigFile, "r")) != NULL) {
 	fputs("-- \n", fd);
-	while (fgets(cmd, sizeof(cmd), fp) != NULL)
+	FREE(cmd);
+	while ((cmd = LYSafeGets(cmd, fp) )!= NULL)
 	    fputs(cmd, fd);
 	fclose(fp);
     }
@@ -764,7 +765,7 @@ PUBLIC void mailmsg ARGS4(
 	/*
 	 *  Now set up the command. - FM
 	 */
-	sprintf(cmd,
+	HTSprintf0(&command,
 		"%s %s %s,%s ",
 		system_mail,
 		system_mail_flags,
@@ -775,14 +776,13 @@ PUBLIC void mailmsg ARGS4(
 	 *  For "generic" VMS MAIL, include the
 	 *  subject in the command. - FM
 	 */
-	sprintf(cmd,
+	HTSprintf0(&command,
 		"%s %s/self/subject=\"Lynx Error in %.56s\" %s ",
 		system_mail,
 		system_mail_flags,
 		filename,
 		my_tmpfile);
     }
-    StrAllocCopy(command, cmd);
     address_ptr1 = address;
     do {
 	if ((cp = strchr(address_ptr1, ',')) != NULL) {
@@ -799,20 +799,18 @@ PUBLIC void mailmsg ARGS4(
 	 *  ignore addresses so long that they would overflow the
 	 *  temporary buffer (i.e., about 500 chars). - BL
 	 */
-	if (strlen(address) > 3 &&
-	    strlen(address) + strlen(mail_adrs) < sizeof(cmd)) {
-	    if (!first) {
-		StrAllocCat(command, ",");
-	    }
-	    sprintf(cmd, mail_adrs, address_ptr1);
-	    StrAllocCat(command, cmd);
-	    first = FALSE;
+	if (!first) {
+	    StrAllocCat(command, ",");
 	}
+	HTSprintf0(&cmd, mail_adrs, address_ptr1);
+	StrAllocCat(command, cmd);
+	first = FALSE;
 	address_ptr1 = address_ptr2;
     } while (address_ptr1 != NULL);
 
     LYSystem(command);
     FREE(command);
+    FREE(cmd);
     LYRemoveTemp(my_tmpfile);
     if (isPMDF) {
 	LYRemoveTemp(hdrfile);
@@ -1691,9 +1689,10 @@ PUBLIC void reply_by_mail ARGS4(
 	LYStatusLine = -1;
 	if (c == YES) {
 	    if ((fd = fopen(my_tmpfile, "a")) != NULL) {
+		char *buffer = NULL;
 		fputs("-- \n", fd);
-		while (fgets(user_input, sizeof(user_input), fp) != NULL) {
-		    fputs(user_input, fd);
+		while ((buffer = LYSafeGets(buffer, fp)) != NULL) {
+		    fputs(buffer, fd);
 		}
 		fclose(fd);
 	    }
diff --git a/src/LYMain.c b/src/LYMain.c
index 43511c64..f726f2b9 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -384,7 +384,7 @@ PUBLIC BOOLEAN LYPrependCharsetToSource = TRUE;
 PUBLIC BOOLEAN LYQuitDefaultYes = QUIT_DEFAULT_YES;
 
 #ifdef DISP_PARTIAL
-PUBLIC BOOLEAN display_partial = TRUE; /* Display document during download */
+PUBLIC BOOLEAN display_partial_flag = TRUE; /* Display document during download */
 PUBLIC BOOLEAN debug_display_partial = FALSE; /* Show with MessageSecs delay */
 PUBLIC int partial_threshold = -1;  /* # of lines to be d/l'ed until we repaint */
 #endif
@@ -972,9 +972,9 @@ PUBLIC int main ARGS2(
 	}
     }
     if (LYGetStdinArgs == TRUE) {
-	char buf[LINESIZE];
+	char *buf = NULL;
 
-	while (fgets(buf, sizeof(buf) - 1, stdin)) {
+	while ((buf = LYSafeGets(buf, stdin)) != 0) {
 	    int j;
 
 	    for (j = strlen(buf) - 1; j > 0 &&
@@ -1051,7 +1051,7 @@ PUBLIC int main ARGS2(
 		 *  Build GET data for later.  Stop reading when we see
 		 *  a line with "---" as its first three characters.
 		 */
-		while (fgets(buf, sizeof(buf), stdin) &&
+		while ((buf = LYSafeGets(buf, stdin)) != 0 &&
 		       strncmp(buf, "---", 3) != 0) {
 		    int j2;
 
@@ -1089,7 +1089,7 @@ PUBLIC int main ARGS2(
 		 *  Build post data for later.	Stop reading when we see
 		 *  a line with "---" as its first three characters.
 		 */
-		while (fgets(buf, sizeof(buf), stdin) &&
+		while ((buf = LYSafeGets(buf, stdin)) != 0 &&
 		       strncmp(buf, "---", 3) != 0) {
 		    int j2;
 
@@ -1257,6 +1257,14 @@ PUBLIC int main ARGS2(
     StrAllocCopy(UCAssume_MIMEcharset,
 			LYCharSet_UC[UCLYhndl_for_unspec].MIMEname);
 
+    /*
+     *	Make sure we have the edit map declared. - FM
+     */
+    if (!LYEditmapDeclared()) {
+	fprintf(stderr, gettext("\nLynx edit map not declared.\n\n"));
+	exit(-1);
+    }
+
 #if defined(USE_HASH)
     /*
      *	If no alternate lynx-style file was specified on
@@ -1304,15 +1312,7 @@ PUBLIC int main ARGS2(
 	fclose(fp);
 	style_readFromFile(lynx_lss_file);
     }
-#endif
-
-    /*
-     *	Make sure we have the edit map declared. - FM
-     */
-    if (!LYEditmapDeclared()) {
-	fprintf(stderr, gettext("\nLynx edit map not declared.\n\n"));
-	exit(-1);
-    }
+#endif /* USE_HASH */
 
 #if USE_COLOR_TABLE
     /*
@@ -1584,6 +1584,13 @@ PUBLIC int main ARGS2(
     if (dump_output_immediately)
 	LYCacheSource = SOURCE_CACHE_NONE;
 #endif
+#ifdef DISP_PARTIAL
+    /*
+     * Disable partial mode if not interactive.
+     */
+    if (dump_output_immediately)
+	display_partial_flag = FALSE;
+#endif
 
 #ifdef VMS
     set_vms_keys();
@@ -1782,7 +1789,8 @@ PUBLIC int main ARGS2(
 	 *  mode.  Instead of calling cleanup() here, let's only call
 	 *  this one. - BJP
 	 */
-	LYStoreCookies(LYCookieFile);
+	if (persistent_cookies)
+	    LYStoreCookies(LYCookieFile);
 #endif /* EXP_PERSISTENT_COOKIES */
 	exit_immediately(status);
     } else {
@@ -1832,6 +1840,7 @@ PUBLIC void LYRegisterLynxProtocols NOARGS
     HTRegisterProtocol(&LYLynxCookies);
 }
 
+#ifndef NO_CONFIG_INFO
 /*
  *  Some staff to reload lynx.cfg without restarting new lynx session,
  *  also load options menu items and command-line options
@@ -1842,11 +1851,19 @@ PUBLIC void LYRegisterLynxProtocols NOARGS
  */
 PUBLIC void reload_read_cfg NOARGS
 {
-    if (!LYRestricted) {
+    if (LYRestricted) return;  /* for sure */
+
+    /* save .lynxrc file in case we change something from Options Menu */
+    if (!save_rc()) return;    /* can not write the very own file :( */
 
-	/* save .lynxrc file in case we change something from Options Menu */
-	if (!save_rc()) return;
+    {
+	/* set few safe flags: */
+#ifdef PERSISTENT_COOKIES
+	BOOLEAN persistent_cookies_flag = persistent_cookies;
+	char * LYCookieFile_flag = LYCookieFile;
+#endif
 
+	free_lynx_cfg(); /* free downloaders, printers, not always environments */
 	/*
 	 *  Process the configuration file.
 	 */
@@ -1862,13 +1879,13 @@ PUBLIC void reload_read_cfg NOARGS
 	/* but other things may be lost: */
 
 	/*
-	 *  Process any command line arguments not already handled. - FM
+	 *  Process any command line arguments not already handled.
 	 */
 		/* Not implemented yet here */
 
 	/*
 	 *  Process any stdin-derived arguments for a lone "-"  which we've
-	 *  loaded into LYStdinArgs. - FM
+	 *  loaded into LYStdinArgs.
 	 */
 		/* Not implemented yet here */
 
@@ -1877,11 +1894,23 @@ PUBLIC void reload_read_cfg NOARGS
 	 */
 		/* Not implemented yet here,
 		 * a major problem: file paths
-		 * like lynx_temp_space, LYCookieFile etc.
+		 * like lynx_save_space, LYCookieFile etc.
 		 */
+#ifdef PERSISTENT_COOKIES
+	/* restore old settings */
+	 if (persistent_cookies != persistent_cookies_flag) {
+	     persistent_cookies = persistent_cookies_flag;
+	     HTAlert(gettext("persistent cookies state will be changed in next session only."));
+	 }
+	 if (strcmp(LYCookieFile, LYCookieFile_flag)) {
+	     StrAllocCopy(LYCookieFile, LYCookieFile_flag);
+	     CTRACE(tfp, "cookies file can be changed in next session only, restored.\n")
+	 }
+#endif
 
     }
 }
+#endif /* !NO_CONFIG_INFO */
 
 
 /* There are different ways of setting arguments on the command line, and
@@ -1913,13 +1942,13 @@ typedef union {
 #ifdef  PARSE_DEBUG
 #define ParseData BOOLEAN *set_value; int *int_value; char **str_value; ParseFunc fun_value
 #define PARSE_SET(n,t,v,h) {n,t,    v,  0,  0,  0,    h}
-#define PARSE_INT(n,t,v,h) {n,t,    0, &v,  0,  0,    h}
+#define PARSE_INT(n,t,v,h) {n,t,    0,  v,  0,  0,    h}
 #define PARSE_STR(n,t,v,h) {n,t,    0,  0,  v,  0,    h}
 #define PARSE_FUN(n,t,v,h) {n,t,    0,  0,  0,  v,    h}
 #else
 #define ParseData long value
 #define PARSE_SET(n,t,v,h) {n,t,   (long) (v),        h}
-#define PARSE_INT(n,t,v,h) {n,t,   (long)&(v),        h}
+#define PARSE_INT(n,t,v,h) {n,t,   (long) (v),        h}
 #define PARSE_STR(n,t,v,h) {n,t,   (long) (v),        h}
 #define PARSE_FUN(n,t,v,h) {n,t,   (long) (v),        h}
 #endif
@@ -2180,7 +2209,7 @@ static int get_data_fun ARGS1(
      *  User data for GET form.
      */
     char **get_data;
-    char buf[1024];
+    char *buf = NULL;
 
     /*
      *  On Unix, conflicts with curses when interactive
@@ -2201,7 +2230,7 @@ static int get_data_fun ARGS1(
      *  Build GET data for later.  Stop reading when we see a line
      *  with "---" as its first three characters.
      */
-    while (fgets(buf, sizeof(buf), stdin) &&
+    while ((buf = LYSafeGets(buf, stdin)) != 0 &&
 	  strncmp(buf, "---", 3) != 0) {
 	int j;
 
@@ -2349,7 +2378,7 @@ static int post_data_fun ARGS1(
      *  User data for POST form.
      */
     char **post_data;
-    char buf[1024];
+    char *buf = NULL;
 
     /*
      * On Unix, conflicts with curses when interactive so let's force a dump.
@@ -2369,7 +2398,7 @@ static int post_data_fun ARGS1(
      * Build post data for later.  Stop reading when we see a line with "---"
      * as its first three characters.
      */
-    while (fgets(buf, sizeof(buf), stdin) &&
+    while ((buf = LYSafeGets(buf, stdin)) != 0 &&
 	  strncmp(buf, "---", 3) != 0) {
 	int j;
 
@@ -2522,6 +2551,9 @@ static int version_fun ARGS1(
 	  LYNX_DATE_LEN,
 	  LYNX_RELEASE ? LYNX_RELEASE_DATE : &LYNX_DATE[LYNX_DATE_OFF]
 	  );
+#ifdef SYSTEM_NAME
+    printf(gettext("Built on %s %s %s\n"), SYSTEM_NAME, __DATE__, __TIME__);
+#endif
     printf("\n");
     printf(gettext(
 	  "Copyrights held by the University of Kansas, CERN, and other contributors.\n"
@@ -2751,7 +2783,7 @@ keys (may be incompatible with some curses packages)"
       "toggles inclusion of ISMAP links when client-side\nMAPs are present"
    ),
    PARSE_INT(
-      "link",		NEED_INT_ARG,		ccount,
+      "link",		NEED_INT_ARG,		&ccount,
       "=NUMBER\nstarting count for lnk#.dat files produced by -crawl"
    ),
    PARSE_SET(
@@ -2838,11 +2870,11 @@ keys (may be incompatible with some curses packages)"
    ),
 #ifdef DISP_PARTIAL
    PARSE_SET(
-      "partial",	TOGGLE_ARG,		&display_partial,
+      "partial",	TOGGLE_ARG,		&display_partial_flag,
       "toggles display partial pages while downloading"
    ),
    PARSE_INT(
-      "partial_thres",  IGNORE_ARG|INT_ARG,     partial_threshold,
+      "partial_thres",  NEED_INT_ARG,          &partial_threshold,
       "[=NUMBER]\nnumber of lines to render before repainting display\n\
 with partial-display logic"
    ),
@@ -2862,7 +2894,7 @@ with partial-display logic"
    PARSE_SET(
       "preparsed",	SET_ARG,		&LYPreparsedSource,
       "show parsed text/html with -source and in source view\n\
-       to visualize how lynx behaves with invalid HTML"
+to visualize how lynx behaves with invalid HTML"
    ),
 #ifdef USE_PSRC
    PARSE_SET(
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 55de2ba5..8249e4e7 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -55,6 +55,7 @@
 #include <LYLeaks.h>
 
 
+PRIVATE void print_status_message PARAMS((CONST linkstruct curlink, char **cp));
 PRIVATE BOOL confirm_post_resub PARAMS((
     CONST char*		address,
     CONST char*		title,
@@ -85,16 +86,17 @@ PUBLIC char * LYRequestTitle = NULL; /* newdoc.title in calls to getfile() */
 
 #ifdef DISP_PARTIAL
 PUBLIC int Newline_partial = 0;     /* required for display_partial mode */
-PUBLIC int NumOfLines_partial = -1; /* required for display_partial mode */
+PUBLIC int NumOfLines_partial = -1; /* initialize to -1 the very first time */
+PUBLIC BOOLEAN display_partial = FALSE;
+PUBLIC int Newline = 0;
+#else
+PRIVATE int Newline = 0;
 #endif
 
 PRIVATE document newdoc;
 PRIVATE document curdoc;
 PRIVATE char *traversal_host = NULL;
 PRIVATE char *traversal_link_to_add = NULL;
-PRIVATE char *CurrentUserAgent = NULL;
-PRIVATE char *CurrentNegoLanguage = NULL;
-PRIVATE char *CurrentNegoCharset = NULL;
 
 #ifdef LY_FIND_LEAKS
 /*
@@ -118,9 +120,6 @@ PRIVATE void free_mainloop_variables NOARGS
 #endif
     FREE(traversal_host);
     FREE(traversal_link_to_add);
-    FREE(CurrentUserAgent);
-    FREE(CurrentNegoLanguage);
-    FREE(CurrentNegoCharset);
 #ifdef DIRED_SUPPORT
     clear_tags();
 #endif /* DIRED_SUPPORT */
@@ -234,8 +233,6 @@ int mainloop NOARGS
     int cmd = LYK_DO_NOTHING, real_cmd = LYK_DO_NOTHING;
     int getresult;
     int arrowup = FALSE, show_help = FALSE;
-    int lines_in_file = -1;
-    int Newline = 0;
     char prev_target[512];
     char user_input_buffer[1024];
     char *owner_address = NULL;  /* Holds the responsible owner's address     */
@@ -250,22 +247,8 @@ int mainloop NOARGS
     BOOLEAN rlink_allowed;
     BOOLEAN vi_keys_flag = vi_keys;
     BOOLEAN emacs_keys_flag = emacs_keys;
-    BOOLEAN LYRawMode_flag = LYRawMode;
-#ifndef NO_OPTION_MENU
-    BOOLEAN LYSelectPopups_flag = LYSelectPopups;
-    BOOLEAN verbose_img_flag = verbose_img;
-    BOOLEAN keypad_mode_flag = keypad_mode;
-    BOOLEAN show_dotfiles_flag = show_dotfiles;
-    BOOLEAN user_mode_flag = user_mode;
-    int CurrentAssumeCharSet_flag = UCLYhndl_for_unspec;
-    int CurrentCharSet_flag = current_char_set;
-    int HTfileSortMethod_flag = HTfileSortMethod;
-#endif
     BOOLEAN trace_mode_flag = FALSE;
     BOOLEAN forced_HTML_mode = LYforce_HTML_mode;
-#ifdef DISP_PARTIAL
-    BOOLEAN display_partial_flag = display_partial;
-#endif
     char cfile[128];
     FILE *cfp;
     char *cp, *toolbar;
@@ -312,12 +295,6 @@ int mainloop NOARGS
     user_input_buffer[(sizeof(user_input_buffer) - 1)] = '\0';
     *prev_target = '\0';
     *user_input_buffer = '\0';
-    StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
-				    LYUserAgent : ""));
-    StrAllocCopy(CurrentNegoLanguage, (language ?
-				       language : ""));
-    StrAllocCopy(CurrentNegoCharset, (pref_charset ?
-				      pref_charset : ""));
 #ifdef LY_FIND_LEAKS
     atexit(free_mainloop_variables);
 #endif
@@ -544,27 +521,21 @@ try_again:
 		    LYPermitURL = TRUE;
 		}
 
+		Newline = newdoc.line; /* bypass for partial mode */
 #ifdef DISP_PARTIAL
 		display_partial = display_partial_flag; /* restore */
-		Newline_partial = newdoc.line; /* initialize */
-		NumOfLines_partial = -1;       /* initialize to -1 */
-				/* -1 restrict HTDisplayPartial()   */
-				/* until HText_new() start new HTMainText */
-				/* and set the flag to 0  */
-		if (display_partial) {
-		    /*
-		     * Disable display_partial if requested URL has #fragment
-		     * and we are not popped from the history stack
-		     * so can't calculate correct newline position for fragment.
-		     * Otherwise user got the new document from the first page
-		     * and be moved to #fragment later after download
-		     * completed, but only if s/he did not mess screen up by
-		     * scrolling before...  So fall down to old behavior here.
-		     */
-		    if (!LYCursesON ||
-			       (Newline_partial == 1 && strchr(newdoc.address, '#')))
-			display_partial = FALSE;
-		}
+		Newline_partial = Newline;  /* initialize */
+		/*
+		 * Disable display_partial if requested URL has #fragment
+		 * and we are not popped from the history stack
+		 * so can't calculate correct newline position for fragment.
+		 * Otherwise user got the new document from the first page
+		 * and be moved to #fragment later after download
+		 * completed, but only if s/he did not mess screen up by
+		 * scrolling before...  So fall down to old behavior here.
+		 */
+		if (Newline_partial == 1 && strchr(newdoc.address, '#'))
+		    display_partial = FALSE;
 #endif /* DISP_PARTIAL */
 #ifdef USE_PSRC
 		psrc_first_tag = TRUE;
@@ -680,15 +651,15 @@ try_again:
 			    cleanup();
 #ifdef UNIX
 			if (dump_output_immediately)
-			    fprintf(stderr,gettext("\nlynx: Can't access startfile %s\n"),
-			       startfile);
+			    fprintf(stderr, gettext("\nlynx: Can't access startfile %s\n"),
+				    startfile);
 			else
 #endif /* UNIX */
 			{
 
 			    SetOutputMode( O_TEXT );
 			    printf(gettext("\nlynx: Can't access startfile %s\n"),
-			       startfile);
+				   startfile);
 			    SetOutputMode( O_BINARY );
 			}
 
@@ -990,6 +961,7 @@ try_again:
 			newdoc.line = curdoc.line;
 			newdoc.link = curdoc.link;
 			newdoc.internal_link = FALSE; /* can't be true. - kw */
+			Newline = newdoc.line; /* now here, no partial mode */
 		    }
 
 		    /*
@@ -997,23 +969,9 @@ try_again:
 		     *	line the user was on if s/he has been in the file
 		     *	before, or it is 1 if this is a new file.
 		     */
-		    Newline = newdoc.line;
-#ifdef DISP_PARTIAL
-		    if (display_partial) {
-			/*
-			 *  Override newdoc.line with a new value if user
-			 *  scrolled the document while downloading.
-			 */
-			if (Newline_partial != newdoc.line
-			 && NumOfLines_partial > 0)
-			    Newline = Newline_partial;
-
-			/*
-			 *  End of incremental rendering stage here.
-			 */
-			display_partial = FALSE;
-		    }
-#endif /* DISP_PARTIAL */
+		    /* Newline = newdoc.line; */
+		    /* - alreary set and probably updated in partial mode */
+		    /*  End of incremental rendering stage here. */
 
 		    /*
 		     *	If we are going to a target line or
@@ -1078,7 +1036,7 @@ try_again:
 	    } else if (!dump_output_immediately) {
 		StrAllocCopy(curdoc.title, newdoc.title);
 	    }
-	    owner_address = (char *)HText_getOwner();
+	    StrAllocCopy(owner_address, HText_getOwner());
 	    curdoc.safe = HTLoadedDocumentIsSafe();
 	    if (!dump_output_immediately) {
 		LYAddVisitedLink(&curdoc);
@@ -1144,7 +1102,6 @@ try_again:
 	      */
 	     Newline = www_search_result;
 	     www_search_result = -1;  /* reset */
-	     more = HText_canScrollDown();
 	}
 
 	if (first_file == TRUE) {
@@ -1260,23 +1217,47 @@ try_again:
 #ifdef SOURCE_CACHE
 	/*
 	 * If the parse settings have changed since this HText was
-	 * generated, we need to reparse and redraw it.
+	 * generated, we need to reparse and redraw it.  -dsb
 	 */
 	if (HTdocument_settings_changed()) {
 	    HTUserMsg(gettext("Reparsing document under current settings..."));
-	    if (HTreparse_document())
-		refresh_screen = TRUE;
+	    if (HTreparse_document()) {}
 	    else {
 		/*
 		 * Urk.  I have no idea how to recover from a failure here.
-		 * At a guess, I'll try reloading.
+		 * At a guess, I'll try reloading.  -dsb
 		 */
 		cmd = LYK_RELOAD;
 		goto new_cmd;
 	    }
 	}
+
+	/*
+	 *  Trying to accomodate HTreparse_document() logic
+	 *  with mainloop events. Set all the necessaty flags here...
+	 */
+	if (from_source_cache) {
+		from_source_cache = FALSE; /* reset */
+
+		    /*
+		     *	Make sure curdoc.line will not be equal
+		     *	to Newline, so we get a redraw.
+		     */
+		    curdoc.line = -1;
+
+	    /*
+	     * This information can get clobbered if we go to an internal
+	     * page while viewing source.  Normally it would be recreated
+	     * by reloading the file; we have to do it ourselves.  -dsb
+	     */
+	    if (curdoc.link < 0 && nlinks > 0)
+		curdoc.link = 0;
+
+		refresh_screen = TRUE; /* ? */
+	}
 #endif
 
+
 	/*
 	 *  If the curdoc.line is different than Newline then there must
 	 *  have been a change since last update.  Run HText_pageDisplay()
@@ -1292,13 +1273,12 @@ try_again:
 	    if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))
 	      showtags(tagged);
 #endif /* DIRED_SUPPORT */
+
 	    /*
-	     *	If more equals TRUE, then there is more
-	     *	info below this page .
+	     *  If more equals TRUE, then there is more info below this page.
 	     */
 	    more = HText_canScrollDown();
 	    curdoc.line = Newline = HText_getTopOfScreen()+1;
-	    lines_in_file = HText_getNumOfLines();
 
 	    if (curdoc.title == NULL) {
 		/*
@@ -1358,6 +1338,22 @@ try_again:
 	    if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))
 		showtags(tagged);
 #endif /* DIRED_SUPPORT */
+
+	    /*
+	     *  If more equals TRUE, then there is more info below this page.
+	     */
+	    more = HText_canScrollDown();
+
+#ifdef SOURCE_CACHE
+	    /*
+	     * This information can get clobbered if we go to an internal
+	     * page while viewing source, or if the page length changes
+	     * between reparses.  Normally it would be recreated by
+	     * reloading the file; we have to do it ourselves.  -dsb
+	     */
+	    if (curdoc.link < 0 && nlinks > 0)
+		curdoc.link = 0;
+#endif
 	    if (user_mode == NOVICE_MODE)
 		noviceline(more);  /* print help message */
 	    refresh_screen = FALSE;
@@ -1376,196 +1372,7 @@ try_again:
 	 *  to tell the user other misc info.
 	 */
 	if (!show_help) {
-	    /*
-	     *	Make sure form novice lines are replaced.
-	     */
-	    if (user_mode == NOVICE_MODE) {
-		noviceline(more);
-	    }
-
-	    /*
-	     *	If we are in forms mode then explicitly
-	     *	tell the user what each kind of link is.
-	     */
-	    if (HTisDocumentSource()) {
-		/*
-		 *  Currently displaying HTML source.
-		 */
-		_statusline(SOURCE_HELP);
-
-#ifdef INDICATE_FORMS_MODE_FOR_ALL_LINKS_ON_PAGE
-	    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0) {
-#else
-#ifdef NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES
-	    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0 &&
-		       !(links[curdoc.link].type & WWW_LINK_TYPE)) {
-#else
-	    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0 &&
-		       !(user_mode == ADVANCED_MODE &&
-			 (links[curdoc.link].type & WWW_LINK_TYPE))) {
-#endif /* NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES */
-#endif /* INDICATE_FORMS_MODE_FOR_ALL_LINKS_ON_PAGE */
-		if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) {
-		    switch(links[curdoc.link].form->type) {
-		    case F_PASSWORD_TYPE:
-			if (links[curdoc.link].form->disabled == YES)
-			    statusline(FORM_LINK_PASSWORD_UNM_MSG);
-			else
-			    statusline(FORM_LINK_PASSWORD_MESSAGE);
-			break;
-		    case F_OPTION_LIST_TYPE:
-			if (links[curdoc.link].form->disabled == YES)
-			    statusline(FORM_LINK_OPTION_LIST_UNM_MSG);
-			else
-			    statusline(FORM_LINK_OPTION_LIST_MESSAGE);
-			break;
-		    case F_CHECKBOX_TYPE:
-			if (links[curdoc.link].form->disabled == YES)
-			    statusline(FORM_LINK_CHECKBOX_UNM_MSG);
-			else
-			    statusline(FORM_LINK_CHECKBOX_MESSAGE);
-			break;
-		    case F_RADIO_TYPE:
-			if (links[curdoc.link].form->disabled == YES)
-			    statusline(FORM_LINK_RADIO_UNM_MSG);
-			else
-			    statusline(FORM_LINK_RADIO_MESSAGE);
-			break;
-		    case F_TEXT_SUBMIT_TYPE:
-			if (links[curdoc.link].form->disabled == YES) {
-			    statusline(FORM_LINK_TEXT_SUBMIT_UNM_MSG);
-			} else if (links[curdoc.link].form->submit_method ==
-				 URL_MAIL_METHOD) {
-			    if (no_mail)
-				statusline(FORM_LINK_TEXT_SUBMIT_MAILTO_DIS_MSG);
-			    else
-				statusline(FORM_LINK_TEXT_SUBMIT_MAILTO_MSG);
-			} else if (links[curdoc.link].form->no_cache) {
-			    statusline(FORM_LINK_TEXT_RESUBMIT_MESSAGE);
-			} else {
-			    statusline(FORM_LINK_TEXT_SUBMIT_MESSAGE);
-			}
-			break;
-		    case F_SUBMIT_TYPE:
-		    case F_IMAGE_SUBMIT_TYPE:
-			if (links[curdoc.link].form->disabled == YES) {
-			    statusline(FORM_LINK_SUBMIT_DIS_MSG);
-			} else if (links[curdoc.link].form->submit_method ==
-				 URL_MAIL_METHOD) {
-			    if (no_mail) {
-				statusline(FORM_LINK_SUBMIT_MAILTO_DIS_MSG);
-			    } else {
-				if(user_mode == ADVANCED_MODE) {
-				    char *submit_str = NULL;
-
-				    StrAllocCopy(submit_str, FORM_LINK_SUBMIT_MAILTO_PREFIX);
-				    StrAllocCat(submit_str, links[curdoc.link].form->submit_action);
-				    statusline(submit_str);
-				    FREE(submit_str);
-				} else {
-				    statusline(FORM_LINK_SUBMIT_MAILTO_MSG);
-				}
-			    }
-			} else if (links[curdoc.link].form->no_cache) {
-			    if(user_mode == ADVANCED_MODE) {
-				char *submit_str = NULL;
-
-				StrAllocCopy(submit_str, FORM_LINK_RESUBMIT_PREFIX);
-				StrAllocCat(submit_str, links[curdoc.link].form->submit_action);
-				statusline(submit_str);
-				FREE(submit_str);
-			    } else {
-				statusline(FORM_LINK_RESUBMIT_MESSAGE);
-			    }
-			} else {
-			    if(user_mode == ADVANCED_MODE) {
-				char *submit_str = NULL;
-
-				StrAllocCopy(submit_str, FORM_LINK_SUBMIT_PREFIX);
-				StrAllocCat(submit_str, links[curdoc.link].form->submit_action);
-				statusline(submit_str);
-				FREE(submit_str);
-			    } else {
-				statusline(FORM_LINK_SUBMIT_MESSAGE);
-			    }
-			}
-			break;
-		    case F_RESET_TYPE:
-			if (links[curdoc.link].form->disabled == YES)
-			    statusline(FORM_LINK_RESET_DIS_MSG);
-			else
-			    statusline(FORM_LINK_RESET_MESSAGE);
-			break;
-		    case F_TEXT_TYPE:
-			if (links[curdoc.link].form->disabled == YES)
-			    statusline(FORM_LINK_TEXT_UNM_MSG);
-			else
-			    statusline(FORM_LINK_TEXT_MESSAGE);
-			break;
-		    case F_TEXTAREA_TYPE:
-			if (links[curdoc.link].form->disabled == YES)
-			    statusline(FORM_LINK_TEXT_UNM_MSG);
-			else
-			    statusline(FORM_LINK_TEXTAREA_MESSAGE);
-			break;
-		    }
-		} else {
-		    statusline(NORMAL_LINK_MESSAGE);
-		}
-
-		/*
-		 *  Let them know if it's an index -- very rare.
-		 */
-		if (is_www_index) {
-		    move(LYlines-1, LYcols-8);
-		    start_reverse();
-		    addstr("-index-");
-		    stop_reverse();
-		}
-
-	    } else if (user_mode == ADVANCED_MODE && nlinks > 0) {
-		/*
-		 *  Show the URL or, for some internal links, the fragment
-		 */
-		cp = NULL;
-		if (links[curdoc.link].type == WWW_INTERN_LINK_TYPE &&
-		    strncmp(links[curdoc.link].lname, "LYNXIMGMAP:", 11)) {
-		    cp = strchr(links[curdoc.link].lname, '#');
-		}
-		if (!cp)
-		    cp = links[curdoc.link].lname;
-		if (more) {
-		    if (is_www_index)
-			_user_message("-more- -index- %s",
-						 cp);
-		    else
-			_user_message("-more- %s",cp);
-		} else {
-		    if (is_www_index)
-			_user_message("-index- %s",cp);
-		    else
-			statusline(cp);
-		}
-	    } else if (is_www_index && more) {
-		char buf[128];
-
-		sprintf(buf, WWW_INDEX_MORE_MESSAGE, key_for_func(LYK_INDEX_SEARCH));
-		_statusline(buf);
-	    } else if (is_www_index) {
-		char buf[128];
-
-		sprintf(buf, WWW_INDEX_MESSAGE, key_for_func(LYK_INDEX_SEARCH));
-		_statusline(buf);
-	    } else if (more) {
-		if (user_mode == NOVICE_MODE)
-			_statusline(MORE);
-		else
-			_statusline(MOREHELP);
-	    } else {
-	       _statusline(HELP);
-	    }
-	   /* turn off cursor since now it's probably on statusline -HV */
-	   move((LYlines - 1), (LYcols - 1));
+	   print_status_message(links[curdoc.link], &cp);
 	} else {
 	   show_help = FALSE;
 	}
@@ -1671,7 +1478,6 @@ try_again:
 				      links[curdoc.link+1].form->name) != 0)))))) {
 
 			HText_ExpandTextarea (&links[curdoc.link], 1);
-			lines_in_file = HText_getNumOfLines();
 
 			if (links[curdoc.link].ly < display_lines) {
 			    refresh_screen = TRUE;
@@ -2109,7 +1915,17 @@ new_cmd:  /*
 #endif
 #ifdef SOURCE_CACHE
 	    if (HTreparse_document()) {
-		refresh_screen = TRUE;
+		/*
+		 * These normally get cleaned up after getfile() returns;
+		 * since we're not calling getfile(), we have to clean them
+		 * up ourselves.  -dsb
+		 */
+		HTOutputFormat = WWW_PRESENT;
+#ifdef USE_PSRC
+		if (psrc_view)
+		    HTMark_asSource();
+		psrc_view = FALSE;
+#endif
 		break;
 	    }
 #endif
@@ -2187,6 +2003,9 @@ new_cmd:  /*
 	    break;
 
 	case LYK_HISTORICAL:	/* toggle 'historical' comments parsing */
+#ifdef SOURCE_CACHE
+	    if (!HTcan_reparse_document()) {
+#endif
 	    /*
 	     *	Check if this is a reply from a POST, and if so,
 	     *	seek confirmation of reload if the safe element
@@ -2198,14 +2017,15 @@ new_cmd:  /*
 				   0, 0) == FALSE) {
 		HTInfoMsg(WILL_NOT_RELOAD_DOC);
 	    } else {
-#ifndef SOURCE_CACHE
 		HTuncache_current_document();
 		StrAllocCopy(newdoc.address, curdoc.address);
 		FREE(curdoc.address);
 		newdoc.line = curdoc.line;
 		newdoc.link = curdoc.link;
-#endif
 	    }
+#ifdef SOURCE_CACHE
+	    } /* end if no bypass */
+#endif
 	    if (historical_comments)
 		historical_comments = FALSE;
 	    else
@@ -2219,19 +2039,16 @@ new_cmd:  /*
 	    }
 #ifdef SOURCE_CACHE
 	    if (HTreparse_document()) {
-		refresh_screen = TRUE;
-		break;
+		break; /* OK */
 	    }
-	    HTuncache_current_document();
-	    StrAllocCopy(newdoc.address, curdoc.address);
-	    FREE(curdoc.address);
-	    newdoc.line = curdoc.line;
-	    newdoc.link = curdoc.link;
 #endif
 	    break;
 
 	case LYK_MINIMAL:	/* toggle 'minimal' comments parsing */
 	    if (!historical_comments) {
+#ifdef SOURCE_CACHE
+	    if (!HTcan_reparse_document()) {
+#endif
 		/*
 		 *  Check if this is a reply from a POST, and if so,
 		 *  seek confirmation of reload if the safe element
@@ -2243,15 +2060,16 @@ new_cmd:  /*
 				       0, 0) == FALSE) {
 		    HTInfoMsg(WILL_NOT_RELOAD_DOC);
 		} else {
-#ifndef SOURCE_CACHE
 		    HTuncache_current_document();
 		    StrAllocCopy(newdoc.address, curdoc.address);
 		    FREE(curdoc.address);
 		    newdoc.line = curdoc.line;
 		    newdoc.link = curdoc.link;
-#endif
 		}
 	    }
+#ifdef SOURCE_CACHE
+	    } /* end if no bypass */
+#endif
 	    if (minimal_comments)
 		minimal_comments = FALSE;
 	    else
@@ -2265,18 +2083,15 @@ new_cmd:  /*
 	    }
 #ifdef SOURCE_CACHE
 	    if (HTreparse_document()) {
-		refresh_screen = TRUE;
-		break;
+                break; /* OK */
 	    }
-	    HTuncache_current_document();
-	    StrAllocCopy(newdoc.address, curdoc.address);
-	    FREE(curdoc.address);
-	    newdoc.line = curdoc.line;
-	    newdoc.link = curdoc.link;
 #endif
 	    break;
 
 	case LYK_SOFT_DQUOTES:
+#ifdef SOURCE_CACHE
+            if (!HTcan_reparse_document()) {
+#endif
 	    /*
 	     *	Check if this is a reply from a POST, and if so,
 	     *	seek confirmation of reload if the safe element
@@ -2288,14 +2103,15 @@ new_cmd:  /*
 				   1, 1) == FALSE) {
 		HTInfoMsg(WILL_NOT_RELOAD_DOC);
 	    } else {
-#ifndef SOURCE_CACHE
 		HTuncache_current_document();
 		StrAllocCopy(newdoc.address, curdoc.address);
 		FREE(curdoc.address);
 		newdoc.line = curdoc.line;
 		newdoc.link = curdoc.link;
-#endif
 	    }
+#ifdef SOURCE_CACHE
+	    } /* end if no bypass */
+#endif
 	    if (soft_dquotes)
 		soft_dquotes = FALSE;
 	    else
@@ -2304,18 +2120,15 @@ new_cmd:  /*
 		      SOFT_DOUBLE_QUOTE_ON : SOFT_DOUBLE_QUOTE_OFF);
 #ifdef SOURCE_CACHE
 	    if (HTreparse_document()) {
-		refresh_screen = TRUE;
-		break;
+		break; /* OK */
 	    }
-	    HTuncache_current_document();
-	    StrAllocCopy(newdoc.address, curdoc.address);
-	    FREE(curdoc.address);
-	    newdoc.line = curdoc.line;
-	    newdoc.link = curdoc.link;
 #endif
 	    break;
 
 	case LYK_SWITCH_DTD:
+#ifdef SOURCE_CACHE
+	    if (!HTcan_reparse_document()) {
+#endif
 	    /*
 	     *	Check if this is a reply from a POST, and if so,
 	     *	seek confirmation of reload if the safe element
@@ -2346,30 +2159,37 @@ new_cmd:  /*
 #endif
 		    HTOutputFormat = WWW_SOURCE;
 		}
-#ifndef SOURCE_CACHE
 		HTuncache_current_document();
 		StrAllocCopy(newdoc.address, curdoc.address);
 		FREE(curdoc.address);
-#endif
-	    }
 #ifdef NO_ASSUME_SAME_DOC
-	    newdoc.line = 1;
-	    newdoc.link = 0;
+		newdoc.line = 1;
+		newdoc.link = 0;
 #else
-	    newdoc.line = curdoc.line;
-	    newdoc.link = curdoc.link;
+		newdoc.line = curdoc.line;
+		newdoc.link = curdoc.link;
 #endif /* NO_ASSUME_SAME_DOC */
+	    }
+#ifdef SOURCE_CACHE
+            } /* end if no bypass */
+#endif
 	    Old_DTD = !Old_DTD;
 	    HTSwitchDTD(!Old_DTD);
 	    HTUserMsg(Old_DTD ? USING_DTD_0 : USING_DTD_1);
 #ifdef SOURCE_CACHE
-	    if (HTreparse_document()) {
-		refresh_screen = TRUE;
-		break;
-	    }
-	    HTuncache_current_document();
-	    StrAllocCopy(newdoc.address, curdoc.address);
-	    FREE(curdoc.address);
+            if (HTcan_reparse_document()) {
+            if (HTisDocumentSource() && LYPreparsedSource) {
+#ifdef USE_PSRC
+                if (LYpsrc)
+                    psrc_view = TRUE;
+                else
+#endif
+                HTOutputFormat = WWW_SOURCE;
+            }
+            if (HTreparse_document()) {
+                break;
+            }
+	    } /* end if no bypass */
 #endif
 	    break;
 
@@ -2512,7 +2332,7 @@ new_cmd:  /*
 
 	case LYK_END:
 	    if (more) {
-	       Newline = lines_in_file - display_lines + 3;  /* go to end of file */
+	       Newline = HText_getNumOfLines() - display_lines + 3;  /* go to end of file */
 	       arrowup = TRUE;	 /* position on last link */
 	    } else {
 		cmd = LYK_NEXT_PAGE;
@@ -4020,8 +3840,26 @@ check_goto_URL:
 #endif /* DIRED_SUPPORT */
 #ifndef NO_OPTION_MENU
 if (!LYUseFormsOptions) {
+	    BOOLEAN LYUseDefaultRawMode_flag = LYUseDefaultRawMode;
+	    BOOLEAN LYSelectPopups_flag = LYSelectPopups;
+	    BOOLEAN verbose_img_flag = verbose_img;
+	    BOOLEAN keypad_mode_flag = keypad_mode;
+	    BOOLEAN show_dotfiles_flag = show_dotfiles;
+	    BOOLEAN user_mode_flag = user_mode;
+	    int CurrentAssumeCharSet_flag = UCLYhndl_for_unspec;
+	    int CurrentCharSet_flag = current_char_set;
+	    int HTfileSortMethod_flag = HTfileSortMethod;
+	    char *CurrentUserAgent = NULL;
+	    char *CurrentNegoLanguage = NULL;
+	    char *CurrentNegoCharset = NULL;
+	    StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
+					    LYUserAgent : ""));
+	    StrAllocCopy(CurrentNegoLanguage, (language ?
+					       language : ""));
+	    StrAllocCopy(CurrentNegoCharset, (pref_charset ?
+					      pref_charset : ""));
 
-	    LYoptions(); /* do the old-style options stuff */
+	    LYoptions(); /** do the old-style options stuff **/
 
 	    if (keypad_mode_flag != keypad_mode ||
 		(user_mode_flag != user_mode &&
@@ -4037,7 +3875,7 @@ if (!LYUseFormsOptions) {
 		CurrentCharSet_flag != current_char_set ||
 		CurrentAssumeCharSet_flag != UCLYhndl_for_unspec ||
 		verbose_img_flag != verbose_img ||
-		LYRawMode_flag != LYRawMode ||
+		LYUseDefaultRawMode_flag != LYUseDefaultRawMode ||
 		LYSelectPopups_flag != LYSelectPopups ||
 		((strcmp(CurrentUserAgent, (LYUserAgent ?
 					    LYUserAgent : "")) ||
@@ -4080,11 +3918,8 @@ if (!LYUseFormsOptions) {
 			 */
 			reloading = TRUE;
 		    }
-		    if (lynx_mode == FORMS_LYNX_MODE) {
-			HTAlert(RELOADING_FORM);
-		    }
 		    if (HTisDocumentSource()) {
-#ifndef PSRC_VIEW
+#ifndef USE_PSRC
 			HTOutputFormat = WWW_SOURCE;
 #else
 			if (LYpsrc)
@@ -4093,6 +3928,25 @@ if (!LYUseFormsOptions) {
 			    HTOutputFormat = WWW_SOURCE;
 #endif
 		    }
+#ifdef SOURCE_CACHE
+		    if (reloading == FALSE) {
+			/* one more attempt to be smart enough: */
+			if (HTreparse_document()) {
+			    FREE(CurrentUserAgent);
+			    FREE(CurrentNegoLanguage);
+			    FREE(CurrentNegoCharset);
+			    break;
+			}
+		    }
+#endif
+		    if (lynx_mode == FORMS_LYNX_MODE) {
+			/*
+			 *  Note that if there are no form links on the current
+			 *  page, lynx_mode won't have this setting and we won't
+			 *  know that this warning should be issued. - FM
+			 */
+			HTAlert(RELOADING_FORM);
+		    }
 		    HEAD_request = HTLoadedDocumentIsHEAD();
 		    HTuncache_current_document();
 #ifdef NO_ASSUME_SAME_DOC
@@ -4106,21 +3960,9 @@ if (!LYUseFormsOptions) {
 		    FREE(curdoc.address); /* So it doesn't get pushed. */
 		}
 	    }
-	    keypad_mode_flag = keypad_mode;
-	    user_mode_flag = user_mode;
-	    HTfileSortMethod_flag = HTfileSortMethod;
-	    CurrentCharSet_flag = current_char_set;
-	    CurrentAssumeCharSet_flag = UCLYhndl_for_unspec;
-	    show_dotfiles_flag = show_dotfiles;
-	    verbose_img_flag = verbose_img;
-	    LYRawMode_flag = LYRawMode;
-	    LYSelectPopups_flag = LYSelectPopups;
-	    StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
-					    LYUserAgent : ""));
-	    StrAllocCopy(CurrentNegoLanguage, (language ?
-					       language : ""));
-	    StrAllocCopy(CurrentNegoCharset, (pref_charset ?
-					      pref_charset : ""));
+	    FREE(CurrentUserAgent);
+	    FREE(CurrentNegoLanguage);
+	    FREE(CurrentNegoCharset);
 	    refresh_screen = TRUE; /* to repaint screen */
 	    break;
 } /* end if !LYUseFormsOptions */
@@ -4145,7 +3987,6 @@ if (!LYUseFormsOptions) {
 		newdoc.safe = FALSE;
 		if (check_realm)
 		    LYPermitURL = TRUE;
-		refresh_screen = TRUE;	/* redisplay */
 
 		/*
 		 * FIXME:  this was a temporary solution until we find the
@@ -4153,7 +3994,7 @@ if (!LYUseFormsOptions) {
 		 * before the 'options menu' only when (few) important options
 		 * were changed.
 		 */
-/*	       HTuncache_current_document(); */
+		/* HTuncache_current_document(); */
 	    }
 #endif /* !NO_OPTION_FORMS */
 	    break;
@@ -4656,8 +4497,8 @@ if (!LYUseFormsOptions) {
 	     */
 	    if (strcmp((curdoc.title ? curdoc.title : ""),
 		       SHOWINFO_TITLE)) {
-		if (showinfo(&curdoc, lines_in_file,
-			      &newdoc, owner_address) < 0)
+		if (showinfo(&curdoc, HText_getNumOfLines(),
+			     &newdoc, owner_address) < 0)
 		    break;
 		StrAllocCopy(newdoc.title, SHOWINFO_TITLE);
 		FREE(newdoc.post_data);
@@ -4698,8 +4539,6 @@ if (!LYUseFormsOptions) {
 
 		n = HText_ExtEditForm (&links[curdoc.link]);
 
-		lines_in_file = HText_getNumOfLines();
-
 		/*
 		 *  TODO: Move cursor "n" lines from the current line to
 		 *	  position it on the 1st trailing blank line in
@@ -4731,7 +4570,6 @@ if (!LYUseFormsOptions) {
 
 		HText_ExpandTextarea (&links[curdoc.link], TEXTAREA_EXPAND_SIZE);
 
-		lines_in_file  = HText_getNumOfLines();
 		refresh_screen = TRUE;
 
 	    } else {
@@ -4749,8 +4587,6 @@ if (!LYUseFormsOptions) {
 
 		n = HText_InsertFile (&links[curdoc.link]);
 
-		lines_in_file = HText_getNumOfLines();
-
 		/*
 		 *  TODO: Move cursor "n" lines from the current line to
 		 *	  position it on the 1st line following the text
@@ -4788,7 +4624,7 @@ if (!LYUseFormsOptions) {
 		       PRINT_OPTIONS_TITLE)) {
 
 		if (print_options(&newdoc.address,
-				&curdoc.address, lines_in_file) < 0)
+				  &curdoc.address, HText_getNumOfLines()) < 0)
 		    break;
 		StrAllocCopy(newdoc.title, PRINT_OPTIONS_TITLE);
 		FREE(newdoc.post_data);
@@ -5594,7 +5430,6 @@ check_add_bookmark_to_self:
 		     CLICKABLE_IMAGES_ON : CLICKABLE_IMAGES_OFF);
 #ifdef SOURCE_CACHE
 	    if (HTreparse_document()) {
-		refresh_screen = TRUE;
 		break;
 	    }
 #endif
@@ -5611,7 +5446,6 @@ check_add_bookmark_to_self:
 		      PSEUDO_INLINE_ALTS_ON : PSEUDO_INLINE_ALTS_OFF);
 #ifdef SOURCE_CACHE
 	    if (HTreparse_document()) {
-		refresh_screen = TRUE;
 		break;
 	    }
 #endif
@@ -5626,10 +5460,8 @@ check_add_bookmark_to_self:
 		LYUseDefaultRawMode = !LYUseDefaultRawMode;
 		HTUserMsg(LYRawMode ? RAWMODE_OFF : RAWMODE_ON);
 		HTMLSetCharacterHandling(current_char_set);
-		LYRawMode_flag = LYRawMode;
 #ifdef SOURCE_CACHE
 		if (HTreparse_document()) {
-		    refresh_screen = TRUE;
 		    break;
 		}
 #endif
@@ -6184,3 +6016,202 @@ PUBLIC void HTAddGotoURL ARGS1(
 
     return;
 }
+
+/*
+ *  When help is not on the screen,
+ *  put a message on the screen
+ *  to tell the user other misc info.
+ */
+PRIVATE void print_status_message(CONST linkstruct curlink, char **cp)
+{
+    /*
+     *	Make sure form novice lines are replaced.
+     */
+    if (user_mode == NOVICE_MODE) {
+	noviceline(more);
+    }
+
+    /*
+     *	If we are in forms mode then explicitly
+     *	tell the user what each kind of link is.
+     */
+    if (HTisDocumentSource()) {
+	/*
+	 *  Currently displaying HTML source.
+	 */
+	_statusline(SOURCE_HELP);
+
+#ifdef INDICATE_FORMS_MODE_FOR_ALL_LINKS_ON_PAGE
+    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0) {
+#else
+#ifdef NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES
+    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0 &&
+	       !(curlink.type & WWW_LINK_TYPE)) {
+#else
+    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0 &&
+	       !(user_mode == ADVANCED_MODE &&
+		 (curlink.type & WWW_LINK_TYPE))) {
+#endif /* NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES */
+#endif /* INDICATE_FORMS_MODE_FOR_ALL_LINKS_ON_PAGE */
+	if (curlink.type == WWW_FORM_LINK_TYPE) {
+	    switch(curlink.form->type) {
+	    case F_PASSWORD_TYPE:
+		if (curlink.form->disabled == YES)
+		    statusline(FORM_LINK_PASSWORD_UNM_MSG);
+		else
+		    statusline(FORM_LINK_PASSWORD_MESSAGE);
+		break;
+	    case F_OPTION_LIST_TYPE:
+		if (curlink.form->disabled == YES)
+		    statusline(FORM_LINK_OPTION_LIST_UNM_MSG);
+		else
+		    statusline(FORM_LINK_OPTION_LIST_MESSAGE);
+		break;
+	    case F_CHECKBOX_TYPE:
+		if (curlink.form->disabled == YES)
+		    statusline(FORM_LINK_CHECKBOX_UNM_MSG);
+		else
+		    statusline(FORM_LINK_CHECKBOX_MESSAGE);
+		break;
+	    case F_RADIO_TYPE:
+		if (curlink.form->disabled == YES)
+		    statusline(FORM_LINK_RADIO_UNM_MSG);
+		else
+		    statusline(FORM_LINK_RADIO_MESSAGE);
+		break;
+	    case F_TEXT_SUBMIT_TYPE:
+		if (curlink.form->disabled == YES) {
+		    statusline(FORM_LINK_TEXT_SUBMIT_UNM_MSG);
+		} else if (curlink.form->submit_method ==
+			 URL_MAIL_METHOD) {
+		    if (no_mail)
+			statusline(FORM_LINK_TEXT_SUBMIT_MAILTO_DIS_MSG);
+		    else
+			statusline(FORM_LINK_TEXT_SUBMIT_MAILTO_MSG);
+		} else if (curlink.form->no_cache) {
+		    statusline(FORM_LINK_TEXT_RESUBMIT_MESSAGE);
+		} else {
+		    statusline(FORM_LINK_TEXT_SUBMIT_MESSAGE);
+		}
+		break;
+	    case F_SUBMIT_TYPE:
+	    case F_IMAGE_SUBMIT_TYPE:
+		if (curlink.form->disabled == YES) {
+		    statusline(FORM_LINK_SUBMIT_DIS_MSG);
+		} else if (curlink.form->submit_method ==
+			 URL_MAIL_METHOD) {
+		    if (no_mail) {
+			statusline(FORM_LINK_SUBMIT_MAILTO_DIS_MSG);
+		    } else {
+			if(user_mode == ADVANCED_MODE) {
+			    char *submit_str = NULL;
+
+			    StrAllocCopy(submit_str, FORM_LINK_SUBMIT_MAILTO_PREFIX);
+			    StrAllocCat(submit_str, curlink.form->submit_action);
+			    statusline(submit_str);
+			    FREE(submit_str);
+			} else {
+			    statusline(FORM_LINK_SUBMIT_MAILTO_MSG);
+			}
+		    }
+		} else if (curlink.form->no_cache) {
+		    if(user_mode == ADVANCED_MODE) {
+			char *submit_str = NULL;
+
+			StrAllocCopy(submit_str, FORM_LINK_RESUBMIT_PREFIX);
+			StrAllocCat(submit_str, curlink.form->submit_action);
+			statusline(submit_str);
+			FREE(submit_str);
+		    } else {
+			statusline(FORM_LINK_RESUBMIT_MESSAGE);
+		    }
+		} else {
+		    if(user_mode == ADVANCED_MODE) {
+			char *submit_str = NULL;
+
+			StrAllocCopy(submit_str, FORM_LINK_SUBMIT_PREFIX);
+			StrAllocCat(submit_str, curlink.form->submit_action);
+			statusline(submit_str);
+			FREE(submit_str);
+		    } else {
+			statusline(FORM_LINK_SUBMIT_MESSAGE);
+		    }
+		}
+		break;
+	    case F_RESET_TYPE:
+		if (curlink.form->disabled == YES)
+		    statusline(FORM_LINK_RESET_DIS_MSG);
+		else
+		    statusline(FORM_LINK_RESET_MESSAGE);
+		break;
+	    case F_TEXT_TYPE:
+		if (curlink.form->disabled == YES)
+		    statusline(FORM_LINK_TEXT_UNM_MSG);
+		else
+		    statusline(FORM_LINK_TEXT_MESSAGE);
+		break;
+	    case F_TEXTAREA_TYPE:
+		if (curlink.form->disabled == YES)
+		    statusline(FORM_LINK_TEXT_UNM_MSG);
+		else
+		    statusline(FORM_LINK_TEXTAREA_MESSAGE);
+		break;
+	    }
+	} else {
+	    statusline(NORMAL_LINK_MESSAGE);
+	}
+
+	/*
+	 *  Let them know if it's an index -- very rare.
+	 */
+	if (is_www_index) {
+	    move(LYlines-1, LYcols-8);
+	    start_reverse();
+	    addstr("-index-");
+	    stop_reverse();
+	}
+
+    } else if (user_mode == ADVANCED_MODE && nlinks > 0) {
+	/*
+	 *  Show the URL or, for some internal links, the fragment
+	 */
+	*cp = NULL;
+	if (curlink.type == WWW_INTERN_LINK_TYPE &&
+	    strncmp(curlink.lname, "LYNXIMGMAP:", 11)) {
+	    *cp = strchr(curlink.lname, '#');
+	}
+	if (!(*cp))
+	    *cp = curlink.lname;
+	if (more) {
+	    if (is_www_index)
+		_user_message("-more- -index- %s",
+					 *cp);
+	    else
+		_user_message("-more- %s",*cp);
+	} else {
+	    if (is_www_index)
+		_user_message("-index- %s",*cp);
+	    else
+		statusline(*cp);
+	}
+    } else if (is_www_index && more) {
+	char buf[128];
+
+	sprintf(buf, WWW_INDEX_MORE_MESSAGE, key_for_func(LYK_INDEX_SEARCH));
+	_statusline(buf);
+    } else if (is_www_index) {
+	char buf[128];
+
+	sprintf(buf, WWW_INDEX_MESSAGE, key_for_func(LYK_INDEX_SEARCH));
+	_statusline(buf);
+    } else if (more) {
+	if (user_mode == NOVICE_MODE)
+		_statusline(MORE);
+	else
+		_statusline(MOREHELP);
+    } else {
+	_statusline(HELP);
+    }
+    /* turn off cursor since now it's probably on statusline -HV */
+    move((LYlines - 1), (LYcols - 1));
+}
diff --git a/src/LYMap.c b/src/LYMap.c
index 27033d1c..6df8924f 100644
--- a/src/LYMap.c
+++ b/src/LYMap.c
@@ -15,7 +15,6 @@
 #include <LYUtils.h>
 #include <LYMap.h>
 #include <GridText.h>
-#include <LYSignal.h>
 #include <LYGlobalDefs.h>
 #include <LYKeymap.h>
 #include <LYCharUtils.h>
diff --git a/src/LYNews.c b/src/LYNews.c
index 1c4cd6ad..d5106bb7 100644
--- a/src/LYNews.c
+++ b/src/LYNews.c
@@ -10,7 +10,6 @@
 #include <LYUtils.h>
 #include <LYClean.h>
 #include <LYStrings.h>
-#include <LYGetFile.h>
 #include <LYHistory.h>
 #include <GridText.h>
 #include <LYCharSets.h>
@@ -30,7 +29,7 @@ PRIVATE BOOLEAN message_has_content ARGS1(
     CONST char *,		filename)
 {
     FILE *fp;
-    char buffer[72];
+    char *buffer = NULL;
     BOOLEAN in_headers = TRUE;
 
     if (!filename || (fp = fopen(filename, "r")) == NULL) {
@@ -38,7 +37,7 @@ PRIVATE BOOLEAN message_has_content ARGS1(
 	       filename ? filename : "(<null>)");
 	return FALSE;
     }
-    while (fgets(buffer, sizeof(buffer), fp) != NULL) {
+    while ((buffer = LYSafeGets(buffer, fp)) != NULL) {
 	char *cp = buffer;
 	char firstnonblank = '\0';
 	if (*cp == '\0') {
@@ -63,6 +62,7 @@ PRIVATE BOOLEAN message_has_content ARGS1(
 	if (firstnonblank && firstnonblank != '>') {
 	    if (!in_headers) {
 		fclose(fp);
+		FREE(buffer);
 		return TRUE;
 	    }
 	}
@@ -239,12 +239,13 @@ PUBLIC char *LYNewsPost ARGS2(
 	StrAllocCat(cp, org);
 #ifndef VMS
     } else if ((fp = fopen("/etc/organization", "r")) != NULL) {
-	if (fgets(user_input, sizeof(user_input), fp) != NULL) {
-	    if ((org = strchr(user_input, '\n')) != NULL) {
+	char *buffer;
+	if ((buffer = LYSafeGets(NULL, fp)) != NULL) {
+	    if ((org = strchr(buffer, '\n')) != NULL) {
 		*org = '\0';
 	    }
 	    if (user_input[0] != '\0') {
-		StrAllocCat(cp, user_input);
+		StrAllocCat(cp, buffer);
 	    }
 	}
 	fclose(fp);
@@ -381,9 +382,10 @@ PUBLIC char *LYNewsPost ARGS2(
 	    _user_message(APPEND_SIG_FILE, LynxSigFile);
 	} else if (HTConfirm(msg) == YES) {
 	    if ((fd = LYAppendToTxtFile (my_tempfile)) != NULL) {
+		char *buffer = NULL;
 		fputs("-- \n", fd);
-		while (fgets(user_input, sizeof(user_input), fp) != NULL) {
-		    fputs(user_input, fd);
+		while ((buffer = LYSafeGets(buffer, fp)) != NULL) {
+		    fputs(buffer, fd);
 		}
 		fclose(fd);
 	    }
@@ -403,8 +405,9 @@ PUBLIC char *LYNewsPost ARGS2(
      */
     if (CJKfile[0] != '\0') {
 	if ((fd = fopen(my_tempfile, "r")) != NULL) {
-	    while (fgets(user_input, sizeof(user_input), fd) != NULL) {
-		TO_JIS((unsigned char *)user_input,
+	    char *buffer = NULL;
+	    while ((buffer = LYSafeGets(buffer, fd)) != NULL) {
+		TO_JIS((unsigned char *)buffer,
 		       (unsigned char *)CJKinput);
 		fputs(CJKinput, fc);
 	    }
diff --git a/src/LYOptions.c b/src/LYOptions.c
index b128dfb5..a99e6b0d 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -11,7 +11,6 @@
 #include <LYSignal.h>
 #include <LYClean.h>
 #include <LYCharSets.h>
-#include <LYCharUtils.h>
 #include <UCMap.h>
 #include <UCAux.h>
 #include <LYKeymap.h>
@@ -21,6 +20,7 @@
 #include <GridText.h>
 #include <LYGetFile.h>
 #include <LYReadCFG.h>
+#include <LYPrettySrc.h>
 
 #include <LYLeaks.h>
 
@@ -3911,6 +3911,7 @@ PUBLIC int postoptions ARGS1(
 
     /*
      *  Exit: working around the previous document.
+     *  Being out of mainloop()/getfile() cycle, do things manually.
      */
     CTRACE(tfp, "\nLYOptions.c/postoptions(): exiting...\n");
 
@@ -3935,6 +3936,7 @@ PUBLIC int postoptions ARGS1(
     if (!HTLoadAbsolute(&WWWDoc))
 	return(NOT_FOUND);
 
+    HTuncache_current_document(); /* will never use again */
 
     /*
      *  Return to previous doc, not to options menu!
@@ -3960,6 +3962,7 @@ PUBLIC int postoptions ARGS1(
     if (!HTLoadAbsolute(&WWWDoc))
        return(NOT_FOUND);
 
+    reloading = FALSE;  /* set manually */ 
     /*  force end-to-end reload from remote server if change LYUserAgent
      *  or language or pref_charset (marked by need_end_reload flag above),
      *  from old-style LYK_OPTIONS (mainloop):
@@ -3982,13 +3985,45 @@ PUBLIC int postoptions ARGS1(
 	need_reload = TRUE;
     }
 
-    if (need_reload == TRUE) {
-	/*  update HText cache */
-	HTuncache_current_document();
-	LYpush(newdoc, FALSE);
+    if (need_reload == FALSE) {
+	/*  no uncache, already loaded */
 	CTRACE(tfp, "LYOptions.c/postoptions(): now really exit.\n\n");
-	return(NULLFILE);
+	return(NORMAL);
     } else {
+	/*  update HText cache */
+
+	/*
+	 *  Check to see if should reload source, or load html
+	 *  (from LYK_RELOAD & LYK_OPTIONS)
+	 */
+	if (HTisDocumentSource()) {
+#ifndef USE_PSRC
+	    HTOutputFormat = WWW_SOURCE;
+#else
+	    if (LYpsrc)
+		psrc_view = TRUE;
+	    else
+		HTOutputFormat = WWW_SOURCE;
+#endif
+	}
+	if (lynx_mode == FORMS_LYNX_MODE) {
+	    /* Sorry! lynx_mode set according the last display_page() state,
+	     * it always in form mode since we came from form-based option menu
+	     * so the information from mainloop() apperently lost.
+	     * reset here until we learn how to do it properly.
+	     */
+	    lynx_mode = NORMAL_LYNX_MODE;
+	}
+#ifdef SOURCE_CACHE
+	if (reloading == FALSE) {
+	    /* one more attempt to be smart enough: */
+	    if (HTreparse_document()) {
+		CTRACE(tfp, "LYOptions.c/postoptions(): now really exit.\n\n");
+		return(NORMAL);
+	    }
+	}
+#endif
+	HEAD_request = HTLoadedDocumentIsHEAD();
 	/*  no uncache, already loaded */
 	CTRACE(tfp, "LYOptions.c/postoptions(): now really exit.\n\n");
 	return(NORMAL);
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index 8a18fb1d..afdfbd77 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -7,6 +7,7 @@
 #include <UCMap.h>
 
 #include <LYUtils.h>
+#include <GridText.h>
 #include <LYStrings.h>
 #include <LYStructs.h>
 #include <LYGlobalDefs.h>
@@ -17,7 +18,6 @@
 #include <LYGetFile.h>
 #include <LYCgi.h>
 #include <LYCurses.h>
-#include <LYSignal.h>
 #include <LYBookmark.h>
 #include <LYCookie.h>
 #include <LYReadCFG.h>
@@ -37,8 +37,8 @@ extern int HTNewsMaxChunk;  /* Max news articles before chunking (HTNews.c) */
 extern int HTNewsChunkSize; /* Number of news articles per chunk (HTNews.c) */
 #endif
 
-PUBLIC BOOLEAN have_read_cfg=FALSE;
-PUBLIC BOOLEAN LYUseNoviceLineTwo=TRUE;
+PUBLIC BOOLEAN have_read_cfg = FALSE;
+PUBLIC BOOLEAN LYUseNoviceLineTwo = TRUE;
 
 /*
  *  Translate a TRUE/FALSE field in a string buffer.
@@ -76,7 +76,6 @@ PRIVATE char *find_colon ARGS1(
     return NULL;
 }
 
-#ifdef LY_FIND_LEAKS
 /*
  *  Function for freeing the DOWNLOADER and UPLOADER menus list. - FM
  */
@@ -121,7 +120,6 @@ PRIVATE void free_item_list NOARGS
 
     return;
 }
-#endif /* LY_FIND_LEAKS */
 
 /*
  *  Process string buffer fields for DOWNLOADER or UPLOADER menus.
@@ -201,7 +199,6 @@ PRIVATE void add_item_to_list ARGS2(
 }
 
 
-#ifdef LY_FIND_LEAKS
 /*
  *  Function for freeing the PRINTER menus list. - FM
  */
@@ -221,7 +218,6 @@ PRIVATE void free_printer_item_list NOARGS
 
     return;
 }
-#endif /* LY_FIND_LEAKS */
 
 /*
  *  Process string buffer fields for PRINTER menus.
@@ -408,12 +404,9 @@ PRIVATE void parse_color ARGS1(
 {
     int color;
     char *fg, *bg;
-    char temp[501];
+    char *temp = 0;
 
-    if (strlen(buffer) < sizeof(temp))
-	strcpy(temp, buffer);
-    else
-	strcpy(temp, "Color config line too long");
+    StrAllocCopy(temp, buffer);	/* save a copy, for error messages */
 
     /*
      *	We are expecting a line of the form:
@@ -440,11 +433,10 @@ PRIVATE void parse_color ARGS1(
 	check_color(bg, default_bg)) < 0)
 	exit_with_color_syntax(temp);
 #endif
+    FREE(temp);
 }
 #endif /* USE_COLOR_TABLE */
 
-#define MAX_LINE_BUFFER_LEN	501
-
 typedef int (*ParseFunc) PARAMS((char *));
 
 typedef union {
@@ -620,11 +612,12 @@ static int dired_menu_fun ARGS1(
 static int jumpfile_fun ARGS1(
 	char *,		value)
 {
-    char buffer [MAX_LINE_BUFFER_LEN];
+    char *buffer = NULL;
 
-    sprintf (buffer, "JUMPFILE:%s", value);
+    HTSprintf0 (&buffer, "JUMPFILE:%s", value);
     if (!LYJumpInit(buffer))
 	CTRACE(tfp, "Failed to register %s\n", buffer);
+    free(buffer);
 
     return 0;
 }
@@ -868,12 +861,11 @@ static void html_src_bad_syntax ARGS2(
 	    char*, value,
 	    char*, option_name)
 {
-    char buf[100];
+    char *buf = 0;
 
-    strcpy(buf,"HTMLSRC_");
-    strcat(buf,option_name);
+    HTSprintf0(&buf,"HTMLSRC_%s", option_name);
     LYUpperCase(buf);
-    fprintf(stderr,"Bad syntax in TAGSPEC %s:%s\n",buf,value);
+    fprintf(stderr,"Bad syntax in TAGSPEC %s:%s\n", buf, value);
     exit_immediately(-1);
 }
 
@@ -1121,7 +1113,7 @@ static Config_Type Config_Table [] =
      PARSE_SET("no_referer_header", CONF_BOOL, &LYNoRefererHeader),
      PARSE_FUN("outgoing_mail_charset", CONF_FUN, outgoing_mail_charset_fun),
 #ifdef DISP_PARTIAL
-     PARSE_SET("partial", CONF_BOOL, &display_partial),
+     PARSE_SET("partial", CONF_BOOL, &display_partial_flag),
      PARSE_INT("partial_thres", CONF_INT, &partial_threshold),
 #endif
 #ifdef EXP_PERSISTENT_COOKIES
@@ -1206,26 +1198,66 @@ PUBLIC void free_lynx_cfg NOARGS
 	    if (q->str_value != 0) {
 		FREE(*(q->str_value));
 		FREE(q->str_value);
+		/* is it enough for reload_read_cfg() to clean up
+		 * the result of putenv()?  No for certain platforms.
+		 */
 	    }
 	    break;
 	default:
 	    break;
 	}
     }
+    free_item_list();
+    free_printer_item_list();
 }
 
+PRIVATE Config_Type *lookup_config ARGS1(
+	char *,		name)
+{
+    Config_Type *tbl = Config_Table;
+    char ch = TOUPPER(*name);
+
+    while (tbl->name != 0) {
+	char ch1 = tbl->name[0];
+
+	if ((ch == TOUPPER(ch1))
+	    && (0 == strcasecomp (name, tbl->name)))
+	    break;
+
+	tbl++;
+    }
+    return tbl;
+}
+
+#define NOPTS_ ( (sizeof Config_Table)/(sizeof Config_Table[0]) - 1 )
+typedef BOOL (optidx_set_t) [ NOPTS_ ];
+ /* if element is FALSE, then it's allowed in the current file*/
+
+#define optidx_set_AND(r,a,b) \
+    {\
+	unsigned i1;\
+	for (i1 = 0; i1 < NOPTS_; ++i1) \
+	    (r)[i1]= (a)[i1] || (b)[i1]; \
+    }
+
+
 /*
  * Process the configuration file (lynx.cfg).
+ *
+ * 'allowed' is a pointer to HTList of allowed options.  Since the included
+ * file can also include other files with a list of acceptable options, these
+ * lists are ANDed.
  */
-PUBLIC void read_cfg ARGS4(
+PRIVATE void do_read_cfg ARGS5(
 	char *, cfg_filename,
 	char *, parent_filename,
 	int,	nesting_level,
-	FILE *,	fp0)
+	FILE *,	fp0,
+	optidx_set_t*, allowed)
 {
     FILE *fp;
     char mypath[LY_MAXPATH];
-    char buffer[MAX_LINE_BUFFER_LEN];
+    char *buffer = 0;
 
     CTRACE(tfp, "Loading cfg file '%s'.\n", cfg_filename);
 
@@ -1262,11 +1294,10 @@ PUBLIC void read_cfg ARGS4(
     /*
      *	Process each line in the file.
      */
-    while (fgets(buffer, sizeof(buffer), fp) != 0) {
+    while ((buffer = LYSafeGets(buffer, fp)) != 0) {
 	char *name, *value;
 	char *cp;
 	Config_Type *tbl;
-	char ch;
 #ifdef PARSE_DEBUG
 	Config_Type *q;
 #else
@@ -1309,21 +1340,20 @@ PUBLIC void read_cfg ARGS4(
 		*cp = 0;
 	}
 
-	tbl = Config_Table;
-	ch = TOUPPER(*name);
-	while (tbl->name != 0) {
-	    char ch1 = tbl->name[0];
-
-	    if ((ch == TOUPPER(ch1))
-		&& (0 == strcasecomp (name, tbl->name)))
-		break;
-
-	    tbl++;
+	tbl = lookup_config(name);
+	if (tbl->name == 0) {
+	    /* lynx ignores unknown keywords */
+	    continue;
 	}
 
-	if (tbl->name == 0) {
-	    /* Apparently, lynx ignores unknown keywords */
-	    /* fprintf (stderr, "%s not found in config file */
+	if ( allowed && (*allowed)[ tbl-Config_Table ] ) {
+	    if (fp0 == NULL)
+		fprintf (stderr, "%s is not allowed in the %s\n",
+		    name,cfg_filename);
+	    /*FIXME: we can do something wiser if we are generating
+	    the html representation of lynx.cfg - say include this line
+	    in bold, or something...*/
+
 	    continue;
 	}
 
@@ -1374,24 +1404,29 @@ PUBLIC void read_cfg ARGS4(
 #ifdef VMS
 		Define_VMSLogical(name, value);
 #else
-		char tmpbuf[MAX_LINE_BUFFER_LEN];
-		sprintf (tmpbuf, "%s=%s", name, value);
-		if ((q->str_value = (char **)calloc(1, sizeof(char **))) != 0) {
-		    StrAllocCopy(*(q->str_value), tmpbuf);
-		    putenv (*(q->str_value));
-		} else {
-		    outofmem(__FILE__, "read_cfg");
-		}
+		if (q->str_value == 0)
+			q->str_value = calloc(1, sizeof(char *));
+		HTSprintf0 (q->str_value, "%s=%s", name, value);
+		putenv (*(q->str_value));
 #endif
 	    }
 	    break;
 
-	case CONF_INCLUDE:
+	case CONF_INCLUDE: {
 	    /* include another file */
+	    optidx_set_t cur_set,anded_set;
+	    optidx_set_t* resultant_set = NULL;
+	    char* p1, *p2, savechar;
+	    BOOL any_optname_found = FALSE;
+
+	    char *url = NULL;
+	    char *cp1 = NULL;
+
+	    if ((p1 = strchr(value,':')) != 0)
+		*p1++ ='\0';
+
 #ifndef NO_CONFIG_INFO
 	    if (fp0 != 0  &&  !LYRestricted) {
-		char *url = 0;
-		char *cp1 = NULL;
 		LYLocalFileToURL(&url, value);
 		StrAllocCopy(cp1, value);
 		if (strchr(value, '&') || strchr(value, '<')) {
@@ -1400,17 +1435,79 @@ PUBLIC void read_cfg ARGS4(
 
 		fprintf(fp0, "%s:<a href=\"%s\">%s</a>\n\n", name, url, cp1);
 		fprintf(fp0, "	  #&lt;begin  %s&gt;\n", cp1);
+	    }
+#endif
 
-		read_cfg (value, cfg_filename, nesting_level + 1, fp0);
+	    if (p1) {
+		while (*(p1 = LYSkipBlanks(p1)) != 0) {
+		    Config_Type *tbl2;
+
+		    p2 = LYSkipNonBlanks(p1);
+		    savechar = *p2;
+		    *p2 = 0;
+
+		    tbl2 = lookup_config(p1);
+		    if (tbl2->name == 0) {
+			if (fp0 == NULL)
+			    fprintf (stderr, "unknown option name %s in %s\n",
+				     p1, cfg_filename);
+		    } else {
+			unsigned i;
+			if (!any_optname_found) {
+			    any_optname_found = TRUE;
+			    for (i = 0; i < NOPTS_; ++i)
+				cur_set[i] = TRUE;
+			}
+			cur_set[tbl2 - Config_Table] = FALSE;
+		    }
+		    *p2 = savechar;
+		}
+	    }
+	    if (!allowed) {
+		if (!any_optname_found)
+		    resultant_set = NULL;
+		else
+		    resultant_set = &cur_set;
+	    } else {
+		if (!any_optname_found)
+		    resultant_set = allowed;
+		else {
+		    optidx_set_AND(anded_set, *allowed, cur_set);
+		    resultant_set = &anded_set;
+		}
+	    }
 
+#ifndef NO_CONFIG_INFO
+	    /*now list the opts that are allowed in included file. If all opts
+	    are allowed, then emit nothing, else emit an effective set of
+	    allowed options in <ul>. Option names will be and uppercased.
+	    FIXME: uppercasing option names can be considered redundant. */
+
+	    if (fp0 != 0  &&  !LYRestricted && resultant_set) {
+		char *buf = NULL;
+		unsigned i;
+
+		fprintf(fp0,"	  Options allowed in this file:\n");
+		for (i = 0; i < NOPTS_; ++i) {
+		    if ((*resultant_set)[i])
+			continue;
+		    StrAllocCopy(buf, Config_Table[i].name);
+		    LYUpperCase(buf);
+		    fprintf(fp0,"	  * %s\n", buf);
+		}
+		free(buf);
+	    }
+#endif
+	    do_read_cfg (value, cfg_filename, nesting_level + 1, fp0,resultant_set);
+
+#ifndef NO_CONFIG_INFO
+	    if (fp0 != 0  &&  !LYRestricted) {
 		fprintf(fp0, "	  #&lt;end of %s&gt;\n\n", cp1);
 		FREE(url);
 		FREE(cp1);
-	    } else
-#endif /* !NO_CONFIG_INFO */
-
-	    read_cfg (value, cfg_filename, nesting_level + 1, fp0);
-
+	    }
+#endif
+	    }
 	    break;
 
 	case CONF_ADD_ITEM:
@@ -1514,6 +1611,17 @@ PUBLIC void read_cfg ARGS4(
     }
 
 }
+/* this is a public interface to do_read_cfg */
+PUBLIC void read_cfg ARGS4(
+	char *, cfg_filename,
+	char *, parent_filename,
+	int,	nesting_level,
+	FILE *,	fp0)
+{
+    do_read_cfg(cfg_filename,parent_filename,nesting_level,fp0,
+	NULL);
+}
+
 
 /*
  *  Show rendered lynx.cfg data without comments, LYNXCFG:/ internal page.
@@ -1541,7 +1649,7 @@ PUBLIC int lynx_cfg_infopage ARGS1(
 	/*
 	 *  Some staff to reload read_cfg(),
 	 *  but also load options menu items and command-line options
-	 *  to made things consistent.	Not implemented yet. Dummy.
+	 *  to make things consistent.	Implemented in LYMain.c
 	 */
 	reload_read_cfg();
 
@@ -1572,6 +1680,7 @@ PUBLIC int lynx_cfg_infopage ARGS1(
 	if (!HTLoadAbsolute(&WWWDoc))
 	    return(NOT_FOUND);
 
+	HTuncache_current_document();  /* will never use again */
 
 	/*  now set up the flag and fall down to create a new LYNXCFG:/ page */
 	local_url = 0;	/* see below */
diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c
index ea97a9e6..81369a1e 100644
--- a/src/LYShowInfo.c
+++ b/src/LYShowInfo.c
@@ -4,12 +4,10 @@
 #include <HTAlert.h>
 #include <HTTP.h>
 #include <LYCurses.h>
-#include <LYStrings.h>
 #include <LYUtils.h>
 #include <LYStructs.h>
 #include <LYGlobalDefs.h>
 #include <LYShowInfo.h>
-#include <LYSignal.h>
 #include <LYCharUtils.h>
 #include <GridText.h>
 #include <LYReadCFG.h>
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 01556b95..357a8d65 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -637,8 +637,10 @@ PRIVATE char *expand_tiname (char *first, size_t len, char **result)
     name[len] = '\0';
     if ((code = lookup_tiname(name, strnames)) >= 0
      || (code = lookup_tiname(name, strfnames)) >= 0) {
-	strcpy(*result, cur_term->type.Strings[code]);
-	(*result) += strlen(*result);
+	if (cur_term->type.Strings[code] != 0) {
+	    strcpy(*result, cur_term->type.Strings[code]);
+	    (*result) += strlen(*result);
+	}
     }
     return first + len;
 }
@@ -889,7 +891,7 @@ PRIVATE int read_keymap_file NOARGS
 	{"unsetkey", unsetkey_cmd },
     };
 
-    char line[1024];
+    char *line = NULL;
     FILE *fp;
     char file[LY_MAXPATH];
     int ret;
@@ -903,7 +905,7 @@ PRIVATE int read_keymap_file NOARGS
 
     linenum = 0;
     ret = 0;
-    while ((fgets (line, sizeof (line), fp) != 0) && (ret == 0))
+    while ((line = LYSafeGets(line, fp)) != 0 && (ret == 0))
     {
 	char *s = LYSkipBlanks(line);
 
@@ -923,6 +925,7 @@ PRIVATE int read_keymap_file NOARGS
 	    }
 	}
     }
+    FREE(line);
 
     fclose (fp);
 
@@ -1364,7 +1367,12 @@ re_read:
 	case KEY_ENTER:		   /* enter/return	*/
 	   c = '\n';
 	   break;
-#endif /* KEY_END */
+#endif /* KEY_ENTER */
+#ifdef PADENTER			   /* PDCURSES */
+	case PADENTER:
+	   c = '\n';
+	   break;
+#endif /* PADENTER */
 #ifdef KEY_END
 	case KEY_END:		   /* end key		001 */
 	   c = END_KEY;
@@ -2936,3 +2944,32 @@ PUBLIC int UPPER8 ARGS2(int,ch1, int,ch2)
     return(-10);  /* mismatch, if we come to here */
 }
 #endif /* NOTUSED */
+
+/*
+ * Replaces 'fgets()' calls into a fixed-size buffer with reads into a buffer
+ * that is allocated.  When an EOF or error is found, the buffer is automatically
+ * freed.
+ */
+PUBLIC char *LYSafeGets ARGS2(
+	char *,	src,
+	FILE *,	fp)
+{
+    char buffer[BUFSIZ];
+    char *result = 0;
+
+    if (src != 0)
+	*src = 0;
+
+    while (fgets(buffer, sizeof(buffer)-1, fp) != 0) {
+	if (*buffer)
+	    result = StrAllocCat(src, buffer);
+	if (strchr(buffer, '\n') != 0)
+	    break;
+	if (feof(fp)
+	 || ferror(fp)) {
+	    FREE(src);
+	    break;
+	}
+    }
+    return result;
+}
diff --git a/src/LYStrings.h b/src/LYStrings.h
index 9161bb89..14092080 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -82,6 +82,8 @@ extern char * SNACat PARAMS((
 #define StrnAllocCopy(dest, src, n)  SNACopy (&(dest), src, n)
 #define StrnAllocCat(dest, src, n)   SNACat  (&(dest), src, n)
 
+extern char *LYSafeGets PARAMS((char * src, FILE * fp));
+
 /* values for LYgetch */
 #define UPARROW		256	/* 0x100 */
 #define DNARROW		257	/* 0x101 */
diff --git a/src/LYStyle.c b/src/LYStyle.c
index d74c14d3..ae172168 100644
--- a/src/LYStyle.c
+++ b/src/LYStyle.c
@@ -1,10 +1,9 @@
 /* character level styles for Lynx
  * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-)
- * @Id: LYStyle.c 1.24 Tue, 13 Apr 1999 03:39:16 -0600 dickey @
+ * @Id: LYStyle.c 1.25 Fri, 23 Apr 1999 08:56:35 -0600 dickey @
  */
 #include <HTUtils.h>
 #include <HTML.h>
-#include <LYSignal.h>
 #include <LYGlobalDefs.h>
 
 #include <LYStructs.h>
@@ -399,7 +398,7 @@ PUBLIC void style_defaultStyleSheet NOARGS
 PUBLIC int style_readFromFile ARGS1(char*, file)
 {
     FILE *fh;
-    char buffer[1024];
+    char *buffer = NULL;
     int len;
 
     CTRACE(tfp, "CSS:Reading styles from file: %s\n", file ? file : "?!? empty ?!?");
@@ -416,16 +415,9 @@ PUBLIC int style_readFromFile ARGS1(char*, file)
     style_initialiseHashTable();
     style_deleteStyleList();
 
-    while (!feof(fh)
-    && fgets(buffer, sizeof(buffer)-1, fh) != NULL)
+    while ((buffer = LYSafeGets(buffer, fh)) != NULL)
     {
-	len = strlen(buffer);
-	if (len > 0) {
-	    if (buffer[len-1] == '\n' || buffer[len-1] == '\r')
-		buffer[len-1] = '\0'; /* hack */
-	    else
-		buffer[sizeof(buffer)-1] = '\0'; /* hack */
-	}
+	LYTrimTrailing(buffer);
 	LYTrimTail(buffer);
 	LYTrimHead(buffer);
 	if (buffer[0] != '#' && (len = strlen(buffer)) > 0)
diff --git a/src/LYTraversal.c b/src/LYTraversal.c
index ed7a1b58..fd528ecc 100644
--- a/src/LYTraversal.c
+++ b/src/LYTraversal.c
@@ -3,6 +3,7 @@
 #include <LYUtils.h>
 #include <LYClean.h>
 #include <LYCurses.h>
+#include <LYStrings.h>
 #include <LYTraversal.h>
 
 #include <LYexit.h>
@@ -32,7 +33,9 @@ PRIVATE void exit_with_perror ARGS1(CONST char *,msg)
 PUBLIC BOOLEAN lookup ARGS1(char *,target)
 {
     FILE *ifp;
-    char buffer[200], line[200];
+    char *buffer = NULL;
+    char *line = NULL;
+    int result = FALSE;
 
     if ((ifp = fopen(TRAVERSE_FILE,"r")) == NULL) {
 	if ((ifp = LYNewTxtFile(TRAVERSE_FILE)) == NULL) {
@@ -43,17 +46,19 @@ PUBLIC BOOLEAN lookup ARGS1(char *,target)
 	}
     }
 
-    sprintf(line,"%s\n",target);
+    HTSprintf0(&line, "%s\n", target);
 
-    while(fgets(buffer, 200, ifp) != NULL) {
+    while((buffer = LYSafeGets(buffer, ifp)) != NULL) {
 	if (STREQ(line,buffer)) {
-	    fclose(ifp);
-	    return(TRUE);
+	    result = TRUE;
+	    break;
 	}
     } /* end while */
+    FREE(line);
+    FREE(buffer);
 
     fclose(ifp);
-    return(FALSE);
+    return(result);
 }
 
 PUBLIC void add_to_table ARGS1(char *,target)
@@ -134,33 +139,36 @@ PUBLIC void add_to_reject_list ARGS1(char *,target)
 PUBLIC BOOLEAN lookup_reject ARGS1(char *,target)
 {
     FILE *ifp;
-    char buffer[200], line[200], ch;
+    char *buffer = NULL;
+    char *line = NULL;
+    char ch;
     int  frag;
+    int result = FALSE;
 
     if ((ifp = fopen(TRAVERSE_REJECT_FILE,"r")) == NULL){
 	return(FALSE);
     }
 
-    sprintf(line,"%s\n",target);
+    HTSprintf0(&line, "%s\n", target);
 
-    while (fgets(buffer, 200, ifp) != NULL) {
+    while ((buffer = LYSafeGets(buffer, ifp)) != NULL && !result) {
 	frag = strlen(buffer) - 1; /* real length, minus trailing null */
 	ch   = buffer[frag - 1];   /* last character in buffer */
 	if (frag > 0) { 	   /* if not an empty line */
 	    if (ch == '*') {
 		if (frag == 1 || ((strncmp(line,buffer,frag - 1)) == 0)) {
-		   fclose(ifp);
-		   return(TRUE);
+		    result = TRUE;
 		}
 	    } else { /* last character = "*" test */
 		if (STREQ(line,buffer)) {
-		    fclose(ifp);
-		    return(TRUE);
+		    result = TRUE;
 		}
 	    } /* last character = "*" test */
 	} /* frag >= 0 */
     } /* end while */
+    FREE(buffer);
+    FREE(line);
 
     fclose(ifp);
-    return(FALSE);
+    return(result);
 }
diff --git a/src/LYUpload.c b/src/LYUpload.c
index 3ccb4728..3615f613 100644
--- a/src/LYUpload.c
+++ b/src/LYUpload.c
@@ -21,7 +21,6 @@
 #include <LYCurses.h>
 #include <LYUtils.h>
 #include <LYGlobalDefs.h>
-#include <LYSignal.h>
 #include <LYStrings.h>
 #include <LYClean.h>
 #include <LYGetFile.h>
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 301cb1bc..debd52fc 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -2706,6 +2706,12 @@ PUBLIC int is_url ARGS1(
 	 */
 	return(LYNXCFG_URL_TYPE);
 
+    } else if (compare_type(cp, "LYNXMESSAGES:", 13)) {
+	/*
+	 *  Special Internal Lynx type.
+	 */
+	return(LYNXMESSAGES_URL_TYPE);
+
     } else if (compare_type(cp, "LYNXCOMPILEOPTS:", 16)) {
 	/*
 	 *  Special Internal Lynx type.
diff --git a/src/LYUtils.h b/src/LYUtils.h
index c5057307..f2362422 100644
--- a/src/LYUtils.h
+++ b/src/LYUtils.h
@@ -110,7 +110,6 @@ extern void LYTrimPathSep PARAMS((char *path));
 extern void LYTrimRelFromAbsPath PARAMS((char *path));
 extern void LYsetXDisplay PARAMS((char *new_display));
 extern void change_sug_filename PARAMS((char *fname));
-extern void checkmail NOPARAMS;
 extern void convert_to_spaces PARAMS((char *string, BOOL condense));
 extern void free_and_clear PARAMS((char **obj));
 extern void highlight PARAMS((int flag, int cur, char *target));
@@ -144,52 +143,56 @@ extern BOOLEAN mustshow;
  *
  *  Universal document id types.
  */
-#define HTTP_URL_TYPE		 1
-#define FILE_URL_TYPE		 2
-#define FTP_URL_TYPE		 3
-#define WAIS_URL_TYPE		 4
-#define NEWS_URL_TYPE		 5
-#define NNTP_URL_TYPE		 6
-#define TELNET_URL_TYPE		 7
-#define TN3270_URL_TYPE		 8
-#define RLOGIN_URL_TYPE		 9
-#define GOPHER_URL_TYPE		10
-#define HTML_GOPHER_URL_TYPE	11
-#define TELNET_GOPHER_URL_TYPE	12
-#define INDEX_GOPHER_URL_TYPE	13
-#define MAILTO_URL_TYPE		14
-#define FINGER_URL_TYPE		15
-#define CSO_URL_TYPE		16
-#define HTTPS_URL_TYPE		17
-#define SNEWS_URL_TYPE		18
-#define PROSPERO_URL_TYPE	19
-#define AFS_URL_TYPE		20
-
-#define DATA_URL_TYPE		21
-
-#define LYNXEXEC_URL_TYPE	22
-#define LYNXPROG_URL_TYPE	23
-#define LYNXCGI_URL_TYPE	24
-
-#define NEWSPOST_URL_TYPE	25
-#define NEWSREPLY_URL_TYPE	26
-#define SNEWSPOST_URL_TYPE	27
-#define SNEWSREPLY_URL_TYPE	28
-
-#define LYNXPRINT_URL_TYPE	29
-#define LYNXHIST_URL_TYPE	30
-#define LYNXDOWNLOAD_URL_TYPE	31
-#define LYNXKEYMAP_URL_TYPE	32
-#define LYNXIMGMAP_URL_TYPE	33
-#define LYNXCOOKIE_URL_TYPE	34
-#define LYNXDIRED_URL_TYPE	35
-#define LYNXOPTIONS_URL_TYPE	36
-#define LYNXCFG_URL_TYPE	37
-#define LYNXCOMPILE_OPTS_URL_TYPE 38
-
-#define PROXY_URL_TYPE		39
-
-#define UNKNOWN_URL_TYPE	40
+typedef enum {
+    UNKNOWN_URL_TYPE = 0,
+
+    HTTP_URL_TYPE,
+    FILE_URL_TYPE,
+    FTP_URL_TYPE,
+    WAIS_URL_TYPE,
+    NEWS_URL_TYPE,
+    NNTP_URL_TYPE,
+    TELNET_URL_TYPE,
+    TN3270_URL_TYPE,
+    RLOGIN_URL_TYPE,
+    GOPHER_URL_TYPE,
+    HTML_GOPHER_URL_TYPE,
+    TELNET_GOPHER_URL_TYPE,
+    INDEX_GOPHER_URL_TYPE,
+    MAILTO_URL_TYPE,
+    FINGER_URL_TYPE,
+    CSO_URL_TYPE,
+    HTTPS_URL_TYPE,
+    SNEWS_URL_TYPE,
+    PROSPERO_URL_TYPE,
+    AFS_URL_TYPE,
+
+    DATA_URL_TYPE,
+
+    LYNXEXEC_URL_TYPE,
+    LYNXPROG_URL_TYPE,
+    LYNXCGI_URL_TYPE,
+
+    NEWSPOST_URL_TYPE,
+    NEWSREPLY_URL_TYPE,
+    SNEWSPOST_URL_TYPE,
+    SNEWSREPLY_URL_TYPE,
+
+    LYNXPRINT_URL_TYPE,
+    LYNXHIST_URL_TYPE,
+    LYNXDOWNLOAD_URL_TYPE,
+    LYNXKEYMAP_URL_TYPE,
+    LYNXIMGMAP_URL_TYPE,
+    LYNXCOOKIE_URL_TYPE,
+    LYNXDIRED_URL_TYPE,
+    LYNXOPTIONS_URL_TYPE,
+    LYNXCFG_URL_TYPE,
+    LYNXCOMPILE_OPTS_URL_TYPE,
+    LYNXMESSAGES_URL_TYPE,
+
+    PROXY_URL_TYPE,
+
+} UrlTypes;
 
 /*
  *  For change_sug_filename().
diff --git a/src/LYrcFile.c b/src/LYrcFile.c
index aea6fa9c..531a03c2 100644
--- a/src/LYrcFile.c
+++ b/src/LYrcFile.c
@@ -31,7 +31,7 @@ PRIVATE char *SkipEquals ARGS1(char *, src)
 
 PUBLIC void read_rc NOPARAMS
 {
-    char line_buffer[LINESIZE];
+    char *line_buffer = NULL;
     char rcfile[LY_MAXPATH];
     FILE *fp;
     char *cp;
@@ -56,13 +56,7 @@ PUBLIC void read_rc NOPARAMS
     /*
      *  Process the entries.
      */
-    while (fgets(line_buffer, sizeof(line_buffer)-1, fp) != NULL) {
-	/*
-	 *  Remove the /n from the end of the line.
-	 */
-	if (line_buffer[0] && line_buffer[strlen(line_buffer)-1] == '\n')
-	    line_buffer[strlen(line_buffer)-1] = '\0';
-
+    while ((line_buffer = LYSafeGets(line_buffer, fp)) != NULL) {
 	/*
 	 *  Remove any trailing white space.
 	 */
@@ -473,6 +467,17 @@ PUBLIC void read_rc NOPARAMS
 		user_mode = NOVICE_MODE;
 	    }
 
+#ifdef DISP_PARTIAL
+	/*
+	 *  Partial display logic--set the threshold # of lines before
+	 *  Lynx redraws the screen
+	 */
+	} else if (FIND_KEYWORD(cp, "partial_thres")) {
+	    cp = SkipEquals(cp);
+	    if (atoi(cp) != 0)
+		partial_threshold = atoi(cp);
+#endif /* DISP_PARTIAL */
+
 #ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS
 	/*
 	 *  Local execution mode - all links.
@@ -485,17 +490,6 @@ PUBLIC void read_rc NOPARAMS
 	     else
 		local_exec = FALSE;
 
-#ifdef DISP_PARTIAL
-	/*
-	 *  Partial display logic--set the threshold # of lines before
-	 *  Lynx redraws the screen
-	 */
-	} else if (FIND_KEYWORD(cp, "partial_thres")) {
-	    cp = SkipEquals(cp);
-	    if (atoi(cp) != 0)
-		partial_threshold = atoi(cp);
-#endif /* DISP_PARTIAL */
-
 	/*
 	 *  Local execution mode - only links in local files.
 	 */
@@ -521,6 +515,29 @@ PUBLIC void read_rc NOPARAMS
     fclose(fp);
 } /* big end */
 
+/*
+ * Write a set of comments.  Doing it this way avoids preprocessor problems
+ * with the leading '#', makes it simpler to use gettext.
+ */
+PRIVATE void write_list ARGS2(
+    	FILE *,		fp,
+	char *,		list)
+{
+    int first = TRUE;
+    while (*list != 0) {
+	int ch = *list++;
+	if (ch == '\n') {
+	    first = TRUE;
+	} else {
+	    if (first) {
+		fputs("# ", fp);
+		first = FALSE;
+	    }
+	}
+	fputc(ch, fp);
+    }
+}
+
 PUBLIC int save_rc NOPARAMS
 {
     char rcfile[LY_MAXPATH];
@@ -543,48 +560,55 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  Header.
      */
-    fprintf(fp, gettext("# Lynx User Defaults File\n#\n\
-# This file contains options saved from the Lynx Options Screen (normally\n\
-# with the '>' key).  There is normally no need to edit this file manually,\n\
-# since the defaults here can be controlled from the Options Screen, and the\n\
-# next time options are saved from the Options Screen this file will be\n\
-# completely rewritten.  You have been warned...\n\
-# If you are looking for the general configuration file - it is normally\n\
-# called lynx.cfg, and it has different content and a different format.\n\
-# It is not this file.\n\n"));
+    write_list(fp, gettext("\
+Lynx User Defaults File\n\
+\n\
+This file contains options saved from the Lynx Options Screen (normally\n\
+with the '>' key).  There is normally no need to edit this file manually,\n\
+since the defaults here can be controlled from the Options Screen, and the\n\
+next time options are saved from the Options Screen this file will be\n\
+completely rewritten.  You have been warned...\n\
+If you are looking for the general configuration file - it is normally\n\
+called lynx.cfg, and it has different content and a different format.\n\
+It is not this file.\n\
+"));
+    fprintf(fp, "\n");
 
     /*
      *  File editor
      */
-    fprintf(fp, gettext("\
-# file_editor specifies the editor to be invoked when editing local files\n\
-# or sending mail.  If no editor is specified, then file editing is disabled\n\
-# unless it is activated from the command line, and the built-in line editor\n\
-# will be used for sending mail.\n"));
+    write_list(fp, gettext("\
+file_editor specifies the editor to be invoked when editing local files\n\
+or sending mail.  If no editor is specified, then file editing is disabled\n\
+unless it is activated from the command line, and the built-in line editor\n\
+will be used for sending mail.\n\
+"));
     fprintf(fp, "file_editor=%s\n\n", (editor ? editor : ""));
 
     /*
      *  Default bookmark file.
      */
-    fprintf(fp, gettext("\
-# bookmark_file specifies the name and location of the default bookmark\n\
-# file into which the user can paste links for easy access at a later\n\
-# date.\n"));
+    write_list(fp, gettext("\
+bookmark_file specifies the name and location of the default bookmark\n\
+file into which the user can paste links for easy access at a later\n\
+date.\n\
+"));
     fprintf(fp, "bookmark_file=%s\n\n", (bookmark_page ? bookmark_page : ""));
 
     /*
      *  Multiple (sub)bookmark support settings.
      */
-    fprintf(fp, gettext("\
-# If sub_bookmarks is not turned \"off\", and multiple bookmarks have\n\
-# been defined (see below), then all bookmark operations will first\n\
-# prompt the user to select an active sub-bookmark file.  If the default\n\
-# Lynx bookmark_file is defined (see above), it will be used as the\n\
-# default selection.  When this option is set to \"advanced\", and the\n\
-# user mode is advanced, the 'v'iew bookmark command will invoke a\n\
-# statusline prompt instead of the menu seen in novice and intermediate\n\
-# user modes.  When this option is set to \"standard\", the menu will be\n\
-# presented regardless of user mode.\n"));
+    write_list(fp, gettext("\
+If sub_bookmarks is not turned \"off\", and multiple bookmarks have\n\
+been defined (see below), then all bookmark operations will first\n\
+prompt the user to select an active sub-bookmark file.  If the default\n\
+Lynx bookmark_file is defined (see above), it will be used as the\n\
+default selection.  When this option is set to \"advanced\", and the\n\
+user mode is advanced, the 'v'iew bookmark command will invoke a\n\
+statusline prompt instead of the menu seen in novice and intermediate\n\
+user modes.  When this option is set to \"standard\", the menu will be\n\
+presented regardless of user mode.\n\
+"));
     fprintf(fp, "sub_bookmarks=%s\n\n", (LYMultiBookmarks ?
 					   (LYMBMAdvanced ?
 					       "advanced" : "standard")
@@ -593,11 +617,12 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  Multiple (sub)bookmark definitions and descriptions.
      */
-    fprintf(fp, gettext("\
-# The following allow you to define sub-bookmark files and descriptions.\n\
-# The format is multi_bookmark<capital_letter>=<filename>,<description>\n\
-# Up to 26 bookmark files (for the English capital letters) are allowed.\n\
-# We start with \"multi_bookmarkB\" since 'A' is the default (see above).\n"));
+    write_list(fp, gettext("\
+The following allow you to define sub-bookmark files and descriptions.\n\
+The format is multi_bookmark<capital_letter>=<filename>,<description>\n\
+Up to 26 bookmark files (for the English capital letters) are allowed.\n\
+We start with \"multi_bookmarkB\" since 'A' is the default (see above).\n\
+"));
     for (MBM_c = 1; MBM_c <= MBM_V_MAXFILES; MBM_c++)
        fprintf(fp, "multi_bookmark%c=%s%s%s\n",
 		   (MBM_c + 'A'),
@@ -612,13 +637,14 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  FTP/file sorting method.
      */
-    fprintf(fp, gettext("\
-# The file_sorting_method specifies which value to sort on when viewing\n\
-# file lists such as FTP directories.  The options are:\n\
-#    BY_FILENAME -- sorts on the name of the file\n\
-#    BY_TYPE     -- sorts on the type of the file\n\
-#    BY_SIZE     -- sorts on the size of the file\n\
-#    BY_DATE     -- sorts on the date of the file\n"));
+    write_list(fp, gettext("\
+The file_sorting_method specifies which value to sort on when viewing\n\
+file lists such as FTP directories.  The options are:\n\
+   BY_FILENAME -- sorts on the name of the file\n\
+   BY_TYPE     -- sorts on the type of the file\n\
+   BY_SIZE     -- sorts on the size of the file\n\
+   BY_DATE     -- sorts on the date of the file\n\
+"));
     fprintf(fp, "file_sorting_method=%s\n\n",
 		(HTfileSortMethod == FILE_BY_NAME ? "BY_FILENAME"
 						  :
@@ -630,36 +656,39 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  Personal mail address.
      */
-    fprintf(fp, gettext("\
-# personal_mail_address specifies your personal mail address.  The\n\
-# address will be sent during HTTP file transfers for authorization and\n\
-# logging purposes, and for mailed comments.\n\
-# If you do not want this information given out, set the NO_FROM_HEADER\n\
-# to TRUE in lynx.cfg, or use the -nofrom command line switch.  You also\n\
-# could leave this field blank, but then you won't have it included in\n\
-# your mailed comments.\n"));
+    write_list(fp, gettext("\
+personal_mail_address specifies your personal mail address.  The\n\
+address will be sent during HTTP file transfers for authorization and\n\
+logging purposes, and for mailed comments.\n\
+If you do not want this information given out, set the NO_FROM_HEADER\n\
+to TRUE in lynx.cfg, or use the -nofrom command line switch.  You also\n\
+could leave this field blank, but then you won't have it included in\n\
+your mailed comments.\n\
+"));
     fprintf(fp, "personal_mail_address=%s\n\n",
 		(personal_mail_address ? personal_mail_address : ""));
 
     /*
      *  Searching type.
      */
-    fprintf(fp, gettext("\
-# If case_sensitive_searching is \"on\" then when the user invokes a search\n\
-# using the 's' or '/' keys, the search performed will be case sensitive\n\
-# instead of case INsensitive.  The default is usually \"off\".\n"));
+    write_list(fp, gettext("\
+If case_sensitive_searching is \"on\" then when the user invokes a search\n\
+using the 's' or '/' keys, the search performed will be case sensitive\n\
+instead of case INsensitive.  The default is usually \"off\".\n\
+"));
     fprintf(fp, "case_sensitive_searching=%s\n\n",
 		(case_sensitive ? "on" : "off"));
 
     /*
      *  Character set.
      */
-    fprintf(fp, gettext("\
-# The character_set definition controls the representation of 8 bit\n\
-# characters for your terminal.  If 8 bit characters do not show up\n\
-# correctly on your screen you may try changing to a different 8 bit\n\
-# set or using the 7 bit character approximations.\n\
-# Current valid characters sets are:\n"));
+    write_list(fp, gettext("\
+The character_set definition controls the representation of 8 bit\n\
+characters for your terminal.  If 8 bit characters do not show up\n\
+correctly on your screen you may try changing to a different 8 bit\n\
+set or using the 7 bit character approximations.\n\
+Current valid characters sets are:\n\
+"));
     for (i = 0; LYchar_set_names[i]; i++)
 	fprintf(fp, "#    %s\n", LYchar_set_names[i]);
     fprintf(fp, "character_set=%s\n\n", LYchar_set_names[current_char_set]);
@@ -668,30 +697,32 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  Preferred language.
      */
-    fprintf(fp, gettext("\
-# preferred_language specifies the language in MIME notation (e.g., en,\n\
-# fr, may be a comma-separated list in decreasing preference)\n\
-# which Lynx will indicate you prefer in requests to http servers.\n\
-# If a file in that language is available, the server will send it.\n\
-# Otherwise, the server will send the file in it's default language.\n"));
+    write_list(fp, gettext("\
+preferred_language specifies the language in MIME notation (e.g., en,\n\
+fr, may be a comma-separated list in decreasing preference)\n\
+which Lynx will indicate you prefer in requests to http servers.\n\
+If a file in that language is available, the server will send it.\n\
+Otherwise, the server will send the file in it's default language.\n\
+"));
     fprintf(fp, "preferred_language=%s\n\n", (language ? language : ""));
 
     /*
      *  Preferred charset.
      */
-    fprintf(fp, gettext("\
-# preferred_charset specifies the character set in MIME notation (e.g.,\n\
-# ISO-8859-2, ISO-8859-5) which Lynx will indicate you prefer in requests\n\
-# to http servers using an Accept-Charset header.  The value should NOT\n\
-# include ISO-8859-1 or US-ASCII, since those values are always assumed\n\
-# by default.  May be a comma-separated list.\n\
-# If a file in that character set is available, the server will send it.\n\
-# If no Accept-Charset header is present, the default is that any\n\
-# character set is acceptable.  If an Accept-Charset header is present,\n\
-# and if the server cannot send a response which is acceptable\n\
-# according to the Accept-Charset header, then the server SHOULD send\n\
-# an error response, though the sending of an unacceptable response\n\
-# is also allowed.\n"));
+    write_list(fp, gettext("\
+preferred_charset specifies the character set in MIME notation (e.g.,\n\
+ISO-8859-2, ISO-8859-5) which Lynx will indicate you prefer in requests\n\
+to http servers using an Accept-Charset header.  The value should NOT\n\
+include ISO-8859-1 or US-ASCII, since those values are always assumed\n\
+by default.  May be a comma-separated list.\n\
+If a file in that character set is available, the server will send it.\n\
+If no Accept-Charset header is present, the default is that any\n\
+character set is acceptable.  If an Accept-Charset header is present,\n\
+and if the server cannot send a response which is acceptable\n\
+according to the Accept-Charset header, then the server SHOULD send\n\
+an error response, though the sending of an unacceptable response\n\
+is also allowed.\n\
+"));
     fprintf(fp, "preferred_charset=%s\n\n",
 		(pref_charset ? pref_charset : ""));
 
@@ -699,22 +730,23 @@ PUBLIC int save_rc NOPARAMS
      *  Show color.
      */
     if (LYChosenShowColor != SHOW_COLOR_UNKNOWN) {
-	fprintf(fp, gettext("\
-# show_color specifies how to set the color mode at startup.  A value of\n\
-# \"never\" will force color mode off (treat the terminal as monochrome)\n\
-# at startup even if the terminal appears to be color capable.  A value of\n\
-# \"always\" will force color mode on even if the terminal appears to be\n\
-# monochrome, if this is supported by the library used to build lynx.\n\
-# A value of \"default\" will yield the behavior of assuming\n\
-# a monochrome terminal unless color capability is inferred at startup\n\
-# based on the terminal type, or the -color command line switch is used, or\n\
-# the COLORTERM environment variable is set.  The default behavior always is\n\
-# used in anonymous accounts or if the \"option_save\" restriction is set.\n\
-# The effect of the saved value can be overridden via\n\
-# the -color and -nocolor command line switches.\n\
-# The mode set at startup can be changed via the \"show color\" option in\n\
-# the 'o'ptions menu.  If the option settings are saved, the \"on\" and\n\
-# \"off\" \"show color\" settings will be treated as \"default\".\n"));
+	write_list(fp, gettext("\
+show_color specifies how to set the color mode at startup.  A value of\n\
+\"never\" will force color mode off (treat the terminal as monochrome)\n\
+at startup even if the terminal appears to be color capable.  A value of\n\
+\"always\" will force color mode on even if the terminal appears to be\n\
+monochrome, if this is supported by the library used to build lynx.\n\
+A value of \"default\" will yield the behavior of assuming\n\
+a monochrome terminal unless color capability is inferred at startup\n\
+based on the terminal type, or the -color command line switch is used, or\n\
+the COLORTERM environment variable is set.  The default behavior always is\n\
+used in anonymous accounts or if the \"option_save\" restriction is set.\n\
+The effect of the saved value can be overridden via\n\
+the -color and -nocolor command line switches.\n\
+The mode set at startup can be changed via the \"show color\" option in\n\
+the 'o'ptions menu.  If the option settings are saved, the \"on\" and\n\
+\"off\" \"show color\" settings will be treated as \"default\".\n\
+"));
      fprintf(fp, "show_color=%s\n\n",
 	     ((LYChosenShowColor == SHOW_COLOR_NEVER  ? "never"  :
 	       (LYChosenShowColor == SHOW_COLOR_ALWAYS ? "always" :
@@ -724,90 +756,99 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  VI keys.
      */
-    fprintf(fp, gettext("\
-# If vi_keys is set to \"on\", then the normal VI movement keys:\n\
-#   j = down    k = up\n\
-#   h = left    l = right\n\
-# will be enabled.  These keys are only lower case.\n\
-# Capital 'H', 'J' and 'K will still activate help, jump shortcuts,\n\
-# and the keymap display, respectively.\n"));
+    write_list(fp, gettext("\
+If vi_keys is set to \"on\", then the normal VI movement keys:\n\
+  j = down    k = up\n\
+  h = left    l = right\n\
+will be enabled.  These keys are only lower case.\n\
+Capital 'H', 'J' and 'K will still activate help, jump shortcuts,\n\
+and the keymap display, respectively.\n\
+"));
      fprintf(fp, "vi_keys=%s\n\n", (vi_keys ? "on" : "off"));
 
     /*
      *  EMACS keys.
      */
-    fprintf(fp, gettext("\
-# If emacs_keys is to \"on\" then the normal EMACS movement keys:\n\
-#   ^N = down    ^P = up\n\
-#   ^B = left    ^F = right\n\
-# will be enabled.\n"));
+    write_list(fp, gettext("\
+If emacs_keys is to \"on\" then the normal EMACS movement keys:\n\
+  ^N = down    ^P = up\n\
+  ^B = left    ^F = right\n\
+will be enabled.\n\
+"));
     fprintf(fp, "emacs_keys=%s\n\n", (emacs_keys ? "on" : "off"));
 
     /*
      *  Show dot files.
      */
-    fprintf(fp, gettext("\
-# show_dotfiles specifies that the directory listing should include\n\
-# \"hidden\" (dot) files/directories.  If set \"on\", this will be\n\
-# honored only if enabled via userdefs.h and/or lynx.cfg, and not\n\
-# restricted via a command line switch.  If display of hidden files\n\
-# is disabled, creation of such files via Lynx also is disabled.\n"));
+    write_list(fp, gettext("\
+show_dotfiles specifies that the directory listing should include\n\
+\"hidden\" (dot) files/directories.  If set \"on\", this will be\n\
+honored only if enabled via userdefs.h and/or lynx.cfg, and not\n\
+restricted via a command line switch.  If display of hidden files\n\
+is disabled, creation of such files via Lynx also is disabled.\n\
+"));
     fprintf(fp, "show_dotfiles=%s\n\n", (show_dotfiles ? "on" : "off"));
 
     /*
      *  Select popups.
      */
-    fprintf(fp, gettext("\
-# select_popups specifies whether the OPTIONs in a SELECT block which\n\
-# lacks a MULTIPLE attribute are presented as a vertical list of radio\n\
-# buttons or via a popup menu.  Note that if the MULTIPLE attribute is\n\
-# present in the SELECT start tag, Lynx always will create a vertical list\n\
-# of checkboxes for the OPTIONs.  A value of \"on\" will set popup menus\n\
-# as the default while a value of \"off\" will set use of radio boxes.\n\
-# The default can be overridden via the -popup command line toggle.\n"));
+    write_list(fp, gettext("\
+select_popups specifies whether the OPTIONs in a SELECT block which\n\
+lacks a MULTIPLE attribute are presented as a vertical list of radio\n\
+buttons or via a popup menu.  Note that if the MULTIPLE attribute is\n\
+present in the SELECT start tag, Lynx always will create a vertical list\n\
+of checkboxes for the OPTIONs.  A value of \"on\" will set popup menus\n\
+as the default while a value of \"off\" will set use of radio boxes.\n\
+The default can be overridden via the -popup command line toggle.\n\
+"));
     fprintf(fp, "select_popups=%s\n\n", (LYSelectPopups ? "on" : "off"));
 
     /*
      *  Show cursor.
      */
-    fprintf(fp, gettext("\
-# show_cursor specifies whether to 'hide' the cursor to the right (and\n\
-# bottom, if possible) of the screen, or to place it to the left of the\n\
-# current link in documents, or current option in select popup windows.\n\
-# Positioning the cursor to the left of the current link or option is\n\
-# helpful for speech or braille interfaces, and when the terminal is\n\
-# one which does not distinguish the current link based on highlighting\n\
-# or color.  A value of \"on\" will set positioning to the left as the\n\
-# default while a value of \"off\" will set 'hiding' of the cursor.\n\
-# The default can be overridden via the -show_cursor command line toggle.\n"));
+    write_list(fp, gettext("\
+show_cursor specifies whether to 'hide' the cursor to the right (and\n\
+bottom, if possible) of the screen, or to place it to the left of the\n\
+current link in documents, or current option in select popup windows.\n\
+Positioning the cursor to the left of the current link or option is\n\
+helpful for speech or braille interfaces, and when the terminal is\n\
+one which does not distinguish the current link based on highlighting\n\
+or color.  A value of \"on\" will set positioning to the left as the\n\
+default while a value of \"off\" will set 'hiding' of the cursor.\n\
+The default can be overridden via the -show_cursor command line toggle.\n\
+"));
     fprintf(fp, "show_cursor=%s\n\n", (LYShowCursor ? "on" : "off"));
 
     /*
      *  Keypad mode.
      */
-    fprintf(fp, gettext("\
-# If keypad_mode is set to \"NUMBERS_AS_ARROWS\", then the numbers on\n\
-# your keypad when the numlock is on will act as arrow keys:\n\
-#             8 = Up Arrow\n\
-#   4 = Left Arrow    6 = Right Arrow\n\
-#             2 = Down Arrow\n\
-# and the corresponding keyboard numbers will act as arrow keys,\n\
-# regardless of whether numlock is on.\n"));
-    fprintf(fp, gettext("\
-# If keypad_mode is set to \"LINKS_ARE_NUMBERED\", then numbers will\n\
-# appear next to each link and numbers are used to select links.\n"));
-    fprintf(fp, gettext("\
-# If keypad_mode is set to \"LINKS_AND_FORM_FIELDS_ARE_NUMBERED\", then\n\
-# numbers will appear next to each link and visible form input field.\n\
-# Numbers are used to select links, or to move the \"current link\" to a\n\
-# form input field or button.  In addition, options in popup menus are\n\
-# indexed so that the user may type an option number to select an option in\n\
-# a popup menu, even if the option isn't visible on the screen.  Reference\n\
-# lists and output from the list command also enumerate form inputs.\n"));
-    fprintf(fp, gettext("\
-# NOTE: Some fixed format documents may look disfigured when\n\
-# \"LINKS_ARE_NUMBERED\" or \"LINKS_AND_FORM_FIELDS_ARE_NUMBERED\" are\n\
-# enabled.\n"));
+    write_list(fp, gettext("\
+If keypad_mode is set to \"NUMBERS_AS_ARROWS\", then the numbers on\n\
+your keypad when the numlock is on will act as arrow keys:\n\
+            8 = Up Arrow\n\
+  4 = Left Arrow    6 = Right Arrow\n\
+            2 = Down Arrow\n\
+and the corresponding keyboard numbers will act as arrow keys,\n\
+regardless of whether numlock is on.\n\
+"));
+    write_list(fp, gettext("\
+If keypad_mode is set to \"LINKS_ARE_NUMBERED\", then numbers will\n\
+appear next to each link and numbers are used to select links.\n\
+"));
+    write_list(fp, gettext("\
+If keypad_mode is set to \"LINKS_AND_FORM_FIELDS_ARE_NUMBERED\", then\n\
+numbers will appear next to each link and visible form input field.\n\
+Numbers are used to select links, or to move the \"current link\" to a\n\
+form input field or button.  In addition, options in popup menus are\n\
+indexed so that the user may type an option number to select an option in\n\
+a popup menu, even if the option isn't visible on the screen.  Reference\n\
+lists and output from the list command also enumerate form inputs.\n\
+"));
+    write_list(fp, gettext("\
+NOTE: Some fixed format documents may look disfigured when\n\
+\"LINKS_ARE_NUMBERED\" or \"LINKS_AND_FORM_FIELDS_ARE_NUMBERED\" are\n\
+enabled.\n\
+"));
     fprintf(fp, "keypad_mode=%s\n\n",
 		((keypad_mode == NUMBERS_AS_ARROWS) ?  "NUMBERS_AS_ARROWS" :
 	       ((keypad_mode == LINKS_ARE_NUMBERED) ? "LINKS_ARE_NUMBERED" :
@@ -817,30 +858,32 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  Partial display threshold
      */
-    fprintf(fp, gettext("\
-# partial_thres specifies the number of lines Lynx should download and render\n\
-# before we redraw the screen in Partial Display logic\n\
-# e.g., partial_thres=2\n\
-# would have Lynx redraw every 2 lines that it renders\n\
-# partial_thres=-1 would use the entire screensize\n"));
+    write_list(fp, gettext("\
+partial_thres specifies the number of lines Lynx should download and render\n\
+before we redraw the screen in Partial Display logic\n\
+e.g., partial_thres=2\n\
+would have Lynx redraw every 2 lines that it renders\n\
+partial_thres=-1 would use the entire screensize\n\
+"));
     fprintf(fp, "partial_thres=%d\n\n", partial_threshold);
 #endif /* DISP_PARTIAL */
 
     /*
      *  Line edit mode.
      */
-    fprintf(fp, gettext("\
-# lineedit_mode specifies the key binding used for inputting strings in\n\
-# prompts and forms.  If lineedit_mode is set to \"Default Binding\" then\n\
-# the following control characters are used for moving and deleting:\n\
-#\n\
-#              Prev  Next       Enter = Accept input\n\
-#    Move char: <-    ->        ^G    = Cancel input\n\
-#    Move word: ^P    ^N        ^U    = Erase line\n\
-#  Delete char: ^H    ^R        ^A    = Beginning of line\n\
-#  Delete word: ^B    ^F        ^E    = End of line\n\
-#\n\
-# Current lineedit modes are:\n"));
+    write_list(fp, gettext("\
+lineedit_mode specifies the key binding used for inputting strings in\n\
+prompts and forms.  If lineedit_mode is set to \"Default Binding\" then\n\
+the following control characters are used for moving and deleting:\n\
+\n\
+             Prev  Next       Enter = Accept input\n\
+   Move char: <-    ->        ^G    = Cancel input\n\
+   Move word: ^P    ^N        ^U    = Erase line\n\
+ Delete char: ^H    ^R        ^A    = Beginning of line\n\
+ Delete word: ^B    ^F        ^E    = End of line\n\
+\n\
+Current lineedit modes are:\n\
+"));
     {
 	char **bindings = LYLineeditNames;
 	while (*bindings) {
@@ -857,11 +900,12 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  Directory list style.
      */
-    fprintf(fp, gettext("\
-# dir_list_styles specifies the directory list style under DIRED_SUPPORT\n\
-# (if implemented).  The default is \"MIXED_STYLE\", which sorts both\n\
-# files and directories together.  \"FILES_FIRST\" lists files first and\n\
-# \"DIRECTORIES_FIRST\" lists directories first.\n"));
+    write_list(fp, gettext("\
+dir_list_styles specifies the directory list style under DIRED_SUPPORT\n\
+(if implemented).  The default is \"MIXED_STYLE\", which sorts both\n\
+files and directories together.  \"FILES_FIRST\" lists files first and\n\
+\"DIRECTORIES_FIRST\" lists directories first.\n\
+"));
     fprintf(fp, "dir_list_style=%s\n\n",
 		(dir_list_style==FILES_FIRST ? "FILES_FIRST"
 					     :
@@ -872,13 +916,14 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  User mode.
      */
-    fprintf(fp, gettext("\
-# user_mode specifies the users level of knowledge with Lynx.  The\n\
-# default is \"NOVICE\" which displays two extra lines of help at the\n\
-# bottom of the screen to aid the user in learning the basic Lynx\n\
-# commands.  Set user_mode to \"INTERMEDIATE\" to turn off the extra info.\n\
-# Use \"ADVANCED\" to see the URL of the currently selected link at the\n\
-# bottom of the screen.\n"));
+    write_list(fp, gettext("\
+user_mode specifies the users level of knowledge with Lynx.  The\n\
+default is \"NOVICE\" which displays two extra lines of help at the\n\
+bottom of the screen to aid the user in learning the basic Lynx\n\
+commands.  Set user_mode to \"INTERMEDIATE\" to turn off the extra info.\n\
+Use \"ADVANCED\" to see the URL of the currently selected link at the\n\
+bottom of the screen.\n\
+"));
     fprintf(fp, "user_mode=%s\n\n",
 		(user_mode == NOVICE_MODE ? "NOVICE" :
 			 (user_mode == ADVANCED_MODE ?
@@ -887,20 +932,22 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  Cookie options
      */
-    fprintf(fp, gettext("\
-# accept_all_cookies allows the user to tell Lynx to automatically\n\
-# accept all cookies if desired.  The default is \"FALSE\" which will\n\
-# prompt for each cookie.  Set accept_all_cookies to \"TRUE\" to accept\n\
-# all cookies.\n"));
+    write_list(fp, gettext("\
+accept_all_cookies allows the user to tell Lynx to automatically\n\
+accept all cookies if desired.  The default is \"FALSE\" which will\n\
+prompt for each cookie.  Set accept_all_cookies to \"TRUE\" to accept\n\
+all cookies.\n\
+"));
     fprintf(fp, "accept_all_cookies=%s\n\n",
 		(LYAcceptAllCookies == FALSE ? "FALSE" : "TRUE"));
 
-    fprintf(fp, gettext("\
-# cookie_accept_domains and cookie_reject_domains are comma-delimited\n\
-# lists of domains from which Lynx should automatically accept or reject\n\
-# all cookies.  If a domain is specified in both options, rejection will\n\
-# take precedence.  The accept_all_cookies parameter will override any\n\
-# settings made here.\n"));
+    write_list(fp, gettext("\
+cookie_accept_domains and cookie_reject_domains are comma-delimited\n\
+lists of domains from which Lynx should automatically accept or reject\n\
+all cookies.  If a domain is specified in both options, rejection will\n\
+take precedence.  The accept_all_cookies parameter will override any\n\
+settings made here.\n\
+"));
     fprintf(fp, "cookie_accept_domains=%s\n",
 		    (LYCookieAcceptDomains == NULL ? ""
 		    : LYCookieAcceptDomains));
@@ -909,14 +956,15 @@ PUBLIC int save_rc NOPARAMS
 		    : LYCookieRejectDomains));
 
 
-    fprintf(fp, gettext("\
-# cookie_loose_invalid_domains, cookie_strict_invalid_domains, and\n\
-# cookie_query_invalid_domains are comma-delimited lists of which domains\n\
-# should be subjected to varying degrees of validity checking.  If a\n\
-# domain is set to strict checking, strict conformance to RFC2109 will\n\
-# be applied.  A domain with loose checking will be allowed to set cookies\n\
-# with an invalid path or domain attribute.  All domains will default to\n\
-# querying the user for an invalid path or domain.\n"));
+    write_list(fp, gettext("\
+cookie_loose_invalid_domains, cookie_strict_invalid_domains, and\n\
+cookie_query_invalid_domains are comma-delimited lists of which domains\n\
+should be subjected to varying degrees of validity checking.  If a\n\
+domain is set to strict checking, strict conformance to RFC2109 will\n\
+be applied.  A domain with loose checking will be allowed to set cookies\n\
+with an invalid path or domain attribute.  All domains will default to\n\
+querying the user for an invalid path or domain.\n\
+"));
     fprintf(fp, "cookie_loose_invalid_domains=%s\n",
 	    (LYCookieLooseCheckDomains == NULL) ? ""
 		    : LYCookieLooseCheckDomains);
@@ -932,9 +980,10 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  Cookie file.
      */
-    fprintf(fp, gettext("\
-# cookie_file specifies the file in which to store persistent cookies.\n\
-# The default is ~/.lynx_cookies.\n"));
+    write_list(fp, gettext("\
+cookie_file specifies the file in which to store persistent cookies.\n\
+The default is ~/.lynx_cookies.\n\
+"));
     fprintf(fp, "cookie_file=%s\n\n",
 		(LYCookieFile == NULL ? "~/.lynx_cookies" : LYCookieFile));
 #endif /* EXP_PERSISTENT_COOKIES */
@@ -945,43 +994,46 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  Local execution mode - all links.
      */
-    fprintf(fp, gettext("\
-# If run_all_execution_links is set \"on\" then all local execution links\n\
-# will be executed when they are selected.\n\
-#\n\
-# WARNING - This is potentially VERY dangerous.  Since you may view\n\
-#           information that is written by unknown and untrusted sources\n\
-#           there exists the possibility that Trojan horse links could be\n\
-#           written.  Trojan horse links could be written to erase files\n\
-#           or compromise security.  This should only be set to \"on\" if\n\
-#           you are viewing trusted source information.\n"));
+    write_list(fp, gettext("\
+If run_all_execution_links is set \"on\" then all local execution links\n\
+will be executed when they are selected.\n\
+\n\
+WARNING - This is potentially VERY dangerous.  Since you may view\n\
+          information that is written by unknown and untrusted sources\n\
+          there exists the possibility that Trojan horse links could be\n\
+          written.  Trojan horse links could be written to erase files\n\
+          or compromise security.  This should only be set to \"on\" if\n\
+          you are viewing trusted source information.\n\
+"));
     fprintf(fp, "run_all_execution_links=%s\n\n",
 		(local_exec ? "on" : "off"));
 
     /*
      *  Local execution mode - only links in local files.
      */
-    fprintf(fp, gettext("\
-# If run_execution_links_on_local_files is set \"on\" then all local\n\
-# execution links that are found in LOCAL files will be executed when they\n\
-# are selected.  This is different from run_all_execution_links in that\n\
-# only files that reside on the local system will have execution link\n\
-# permissions.\n\
-#\n\
-# WARNING - This is potentially dangerous.  Since you may view\n\
-#           information that is written by unknown and untrusted sources\n\
-#           there exists the possibility that Trojan horse links could be\n\
-#           written.  Trojan horse links could be written to erase files\n\
-#           or compromise security.  This should only be set to \"on\" if\n\
-#           you are viewing trusted source information.\n"));
+    write_list(fp, gettext("\
+If run_execution_links_on_local_files is set \"on\" then all local\n
+execution links that are found in LOCAL files will be executed when they\n\
+are selected.  This is different from run_all_execution_links in that\n\
+only files that reside on the local system will have execution link\n\
+permissions.\n\
+\n\
+WARNING - This is potentially dangerous.  Since you may view\n\
+          information that is written by unknown and untrusted sources\n\
+          there exists the possibility that Trojan horse links could be\n\
+          written.  Trojan horse links could be written to erase files\n\
+          or compromise security.  This should only be set to \"on\" if\n\
+          you are viewing trusted source information.\n\
+"));
     fprintf(fp, "run_execution_links_on_local_files=%s\n\n",
 		(local_exec_on_local_files ? "on" : "off"));
 #endif /* defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) */
 
-    fprintf(fp, gettext("\
-# If verbose_images is \"on\", lynx will print the name of the image\n\
-# source file in place of [INLINE], [LINK] or [IMAGE]\n\
-# See also VERBOSE_IMAGES in lynx.cfg\n"));
+    write_list(fp, gettext("\
+If verbose_images is \"on\", lynx will print the name of the image\n\
+source file in place of [INLINE], [LINK] or [IMAGE]\n\
+See also VERBOSE_IMAGES in lynx.cfg\n\
+"));
     fprintf(fp, "verbose_images=%s\n\n",
 		verbose_img ? "on" : "off");
 
diff --git a/src/Makefile.old b/src/Makefile.old
deleted file mode 100644
index 9ca8a343..00000000
--- a/src/Makefile.old
+++ /dev/null
@@ -1,108 +0,0 @@
-SHELL = /bin/sh
-
-CHARTRANS_OBJS=UCdomap.o UCAux.o UCAuto.o
-OBJS=  LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
-LYMail.o HTAlert.o GridText.o LYGetFile.o \
-LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
-LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
-LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
-HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
-LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \
-LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o\
-LYStyle.o LYHash.o $(CHARTRANS_OBJS)
-
-CFLAGS= $(MCFLAGS) -I.. $(SLANGINC)
-
-all: lynx
-
-lynx:   message do_chartrans_stuff $(OBJS) $(WWWLIB)
-	@echo "Linking and creating Lynx executable"
-	$(CC) $(CFLAGS) -o lynx  $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
-	@echo "Copying Lynx executable into this directory"
-	cp lynx ..
-	@echo "Welcome to Lynx!"
-
-message:
-	@echo "Compiling Lynx sources"
-
-do_chartrans_stuff:
-	-cd chrtrans; $(MAKE) MCFLAGS="$(MCFLAGS)" CC="$(CC)" tables
-
-dbg:	$(OBJS) $(WWWLIB)
-	@echo "Making Lynx code"
-	$(CC) -g $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)
-
-lint:
-	lint *.c  > ../lint.out
-
-clean:
-	rm -f lynx core *.[ob]
-	cd chrtrans && $(MAKE) clean
-
-LYMain.o: ../userdefs.h
-LYMainLoop.o: ../userdefs.h
-LYReadCFG.o: ../userdefs.h
-HTFWriter.o: ../userdefs.h
-LYGetFile.o: ../userdefs.h
-LYOptions.o: ../userdefs.h
-LYrcFile.o: ../userdefs.h
-LYMail.o: ../userdefs.h
-LYUtils.o: ../userdefs.h
-HTInit.o: ../userdefs.h
-LYKeymap.o: ../userdefs.h
-LYShowInfo.o: ../userdefs.h
-LYTraversal.o: ../userdefs.h
-LYMail.o: ../userdefs.h
-LYCharSets.o: ../userdefs.h
-
-CHRTR= chrtrans/
-
-TABLES= \
- $(CHRTR)cp1250_uni.h \
- $(CHRTR)cp1251_uni.h \
- $(CHRTR)cp1252_uni.h \
- $(CHRTR)cp1253_uni.h \
- $(CHRTR)cp1255_uni.h \
- $(CHRTR)cp1256_uni.h \
- $(CHRTR)cp1257_uni.h \
- $(CHRTR)cp437_uni.h \
- $(CHRTR)cp737_uni.h \
- $(CHRTR)cp775_uni.h \
- $(CHRTR)cp850_uni.h \
- $(CHRTR)cp852_uni.h \
- $(CHRTR)cp862_uni.h \
- $(CHRTR)cp864_uni.h \
- $(CHRTR)cp866_uni.h \
- $(CHRTR)cp869_uni.h \
- $(CHRTR)def7_uni.h \
- $(CHRTR)dmcs_uni.h \
- $(CHRTR)iso01_uni.h \
- $(CHRTR)iso02_uni.h \
- $(CHRTR)iso03_uni.h \
- $(CHRTR)iso04_uni.h \
- $(CHRTR)iso05_uni.h \
- $(CHRTR)iso06_uni.h \
- $(CHRTR)iso07_uni.h \
- $(CHRTR)iso08_uni.h \
- $(CHRTR)iso09_uni.h \
- $(CHRTR)iso10_uni.h \
- $(CHRTR)koi8r_uni.h \
- $(CHRTR)mac_uni.h \
- $(CHRTR)mnem_suni.h \
- $(CHRTR)mnem2_suni.h \
- $(CHRTR)next_uni.h \
- $(CHRTR)rfc_suni.h \
- $(CHRTR)utf8_uni.h \
- $(CHRTR)viscii_uni.h
-
-CMN=../WWW/Library/Implementation/
-
-$(TABLES):
-	-cd chrtrans; $(MAKE) tables
-
-UCdomap.o: UCdomap.c chrtrans/UCkd.h chrtrans/makeuctb chrtrans/makeuctb.c \
-                 UCdomap.h $(CMN)UCMap.h $(TABLES) ../userdefs.h
-	$(CC) -c $(CFLAGS) -o $@ $<
-
-UCAux.o : UCAux.c $(CMN)UCAux.h $(CMN)UCDefs.h
-LYCookie.o: ../userdefs.h
diff --git a/src/UCdomap.c b/src/UCdomap.c
index f3d6c87c..6ba65391 100644
--- a/src/UCdomap.c
+++ b/src/UCdomap.c
@@ -25,7 +25,6 @@
 #include <UCMap.h>
 #include <UCDefs.h>
 #include <LYCharSets.h>
-#include <LYStrings.h>
 
 #include <LYLeaks.h>
 
diff --git a/src/chrtrans/Makefile.old b/src/chrtrans/Makefile.old
deleted file mode 100644
index 42b49eec..00000000
--- a/src/chrtrans/Makefile.old
+++ /dev/null
@@ -1,113 +0,0 @@
-#
-# Makefile for the makeuctb and unicode tables.
-#
-# This may not yet work for the general case.
-# Only some dependencies included.
-#
-#
-CFLAGS = $(MCFLAGS) -I.. -I../.. -I../../WWW/Library/Implementation
-
-.SUFFIXES: .tbl
-#
-# This file contains the font map for the default (hardware) font
-#
-
-FONTMAP_INC = iso01_uni.h# default, if not set by recursive call
-
-### #include $(TOPDIR)/Rules.make ???
-
-### fastdep: $(FONTMAP_INC)
-
-### MCFLAGS=-g -DUNIX -DLINUX -DNO_KEYPAD -DNO_TTYTYPE -I.. -I../../WWW/Library/Implementation -I../..
-
-TABLES= \
- cp1250_uni.h \
- cp1251_uni.h \
- cp1252_uni.h \
- cp1253_uni.h \
- cp1255_uni.h \
- cp1256_uni.h \
- cp1257_uni.h \
- cp437_uni.h \
- cp737_uni.h \
- cp775_uni.h \
- cp850_uni.h \
- cp852_uni.h \
- cp862_uni.h \
- cp864_uni.h \
- cp866_uni.h \
- cp869_uni.h \
- def7_uni.h \
- dmcs_uni.h \
- iso01_uni.h \
- iso02_uni.h \
- iso03_uni.h \
- iso04_uni.h \
- iso05_uni.h \
- iso06_uni.h \
- iso07_uni.h \
- iso08_uni.h \
- iso09_uni.h \
- iso10_uni.h \
- koi8r_uni.h \
- mac_uni.h \
- mnem_suni.h \
- mnem2_suni.h \
- next_uni.h \
- rfc_suni.h \
- utf8_uni.h \
- viscii_uni.h
-
-default: $(FONTMAP_INC)
-
-tables: $(TABLES)
-
-makeuctb: makeuctb.c UCkd.h
-	$(CC) $(CFLAGS) -o makeuctb makeuctb.c
-
-.tbl.h:
-	./makeuctb $*.tbl > $@
-
-cp1250_uni.h: cp1250_uni.tbl makeuctb
-cp1251_uni.h: cp1251_uni.tbl makeuctb
-cp1252_uni.h: cp1252_uni.tbl makeuctb
-cp1253_uni.h: cp1253_uni.tbl makeuctb
-cp1255_uni.h: cp1255_uni.tbl makeuctb
-cp1256_uni.h: cp1256_uni.tbl makeuctb
-cp1257_uni.h: cp1257_uni.tbl makeuctb
-cp437_uni.h: cp437_uni.tbl makeuctb
-cp737_uni.h: cp737_uni.tbl makeuctb
-cp775_uni.h: cp775_uni.tbl makeuctb
-cp850_uni.h: cp850_uni.tbl makeuctb
-cp852_uni.h: cp852_uni.tbl makeuctb
-cp862_uni.h: cp862_uni.tbl makeuctb
-cp864_uni.h: cp864_uni.tbl makeuctb
-cp866_uni.h: cp866_uni.tbl makeuctb
-cp869_uni.h: cp869_uni.tbl makeuctb
-def7_uni.h: def7_uni.tbl makeuctb
-dmcs_uni.h: dmcs_uni.tbl makeuctb
-iso01_uni.h: iso01_uni.tbl makeuctb
-iso02_uni.h: iso02_uni.tbl makeuctb
-iso03_uni.h: iso03_uni.tbl makeuctb
-iso04_uni.h: iso04_uni.tbl makeuctb
-iso05_uni.h: iso05_uni.tbl makeuctb
-iso06_uni.h: iso06_uni.tbl makeuctb
-iso07_uni.h: iso07_uni.tbl makeuctb
-iso08_uni.h: iso08_uni.tbl makeuctb
-iso09_uni.h: iso09_uni.tbl makeuctb
-iso10_uni.h: iso10_uni.tbl makeuctb
-koi8r_uni.h: koi8r_uni.tbl makeuctb
-mac_uni.h: mac_uni.tbl makeuctb
-mnem_suni.h: mnem_suni.tbl makeuctb
-mnem2_suni.h: mnem2_suni.tbl makeuctb
-next_uni.h: next_uni.tbl makeuctb
-rfc_suni.h: rfc_suni.tbl makeuctb
-utf8_uni.h: utf8_uni.tbl makeuctb
-viscii_uni.h: viscii_uni.tbl makeuctb
-
-clean:
-	rm -f makeuctb *.o *uni.h
-
-distclean: clean
-	-rm -rf obsolete
-	rm -f core *.bak *.sav *~ *.h_old
diff --git a/src/makefile.dos b/src/makefile.dos
index 1e05433f..1a69fc84 100644
--- a/src/makefile.dos
+++ b/src/makefile.dos
@@ -13,6 +13,7 @@ CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)
 

 CC = gcc

 MCFLAGS = -O2 -DHAVE_GETBKGD -DDISP_PARTIAL -DUSE_ZLIB \

+ -DSOURCE_CACHE -DUSE_PSRC \

  -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES \

  -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP \

  -Ichrtrans -I../WWW/library/implementation \

diff --git a/src/makefile.dsl b/src/makefile.dsl
index acdbfcd4..0be75cd2 100644
--- a/src/makefile.dsl
+++ b/src/makefile.dsl
@@ -13,6 +13,7 @@ CFLAGS= $(MCFLAGS) $(INTLFLAGS) -I. -I.. $(SLANGINC)
 

 CC = gcc

 MCFLAGS = -O2 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \

+-DSOURCE_CACHE -DUSE_PSRC \

 -DUSE_SLANG -DDJGPP_KEYHANDLER -DACCESS_AUTH -DNO_CUSERID \

 -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/Library/Implementation \

 -I../djgpp/tcplib/include -I./chrtrans -I../djgpp/tcplib/include/tcp

diff --git a/src/makefile.in b/src/makefile.in
index 4712a331..415bb8a0 100644
--- a/src/makefile.in
+++ b/src/makefile.in
@@ -33,7 +33,7 @@ SITE_LIBS	= # FIXME: set in parent makefile
 WAISLIB		= # FIXME: set in parent makefile
 
 WWWINC		= WWW/Library/Implementation
-WWWLIB		= $(top_builddir)/WWW/Library/unix/libwww.a
+WWWLIB		= $(top_builddir)/WWW/Library/Implementation/libwww.a
 
 INTLLIB		= @INTLDIR_MAKE@@INTLLIBS@
 
diff --git a/src/makefile.wsl b/src/makefile.wsl
index 893746cc..a54731d2 100644
--- a/src/makefile.wsl
+++ b/src/makefile.wsl
@@ -13,6 +13,7 @@ CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)
 

 CC = gcc

 MCFLAGS = -O2 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \

+-DSOURCE_CACHE -DUSE_PSRC \

 -DUSE_SLANG -DACCESS_AUTH -DNO_CUSERID \

 -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/library/implement -I../djgpp/tcplib/include \

 -I./chrtrans -I../djgpp/tcplib/include/tcp