about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/HTML.c263
-rw-r--r--src/HTML.h1
-rw-r--r--src/LYCharUtils.c20
-rw-r--r--src/LYGlobalDefs.h10
-rw-r--r--src/LYHistory.c70
-rw-r--r--src/LYHistory.h3
-rw-r--r--src/LYMain.c3
-rw-r--r--src/LYOptions.c38
-rw-r--r--src/LYReadCFG.c11
-rw-r--r--src/LYStrings.c4
-rw-r--r--src/LYrcFile.c12
-rw-r--r--src/LYrcFile.h4
12 files changed, 328 insertions, 111 deletions
diff --git a/src/HTML.c b/src/HTML.c
index eaca6ad7..f34670ef 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTML.c,v 1.126 2009/05/29 00:24:15 tom Exp $
+ * $LynxId: HTML.c,v 1.128 2009/06/07 19:05:55 tom Exp $
  *
  *		Structured stream to Rich hypertext converter
  *		============================================
@@ -46,6 +46,7 @@
 #include <LYMap.h>
 #include <LYList.h>
 #include <LYBookmark.h>
+#include <LYHistory.h>
 
 #ifdef VMS
 #include <LYCurses.h>
@@ -214,14 +215,56 @@ static void change_paragraph_style(HTStructured * me, HTStyle *style)
     me->in_word = NO;
 }
 
+/*
+ * Return true if we should write a message (to LYNXMESSAGES, or the trace
+ * file) telling about some bad HTML that we've found.
+ */
 BOOL LYBadHTML(HTStructured * me)
 {
-    if (!TRACE && !me->inBadHTML) {
-	HTUserMsg(BAD_HTML_USE_TRACE);
-	me->inBadHTML = TRUE;
-	return FALSE;
+    BOOL code = FALSE;
+
+    switch ((enumBadHtml) cfg_bad_html) {
+    case BAD_HTML_IGNORE:
+	break;
+    case BAD_HTML_TRACE:
+	code = TRUE;
+	break;
+    case BAD_HTML_MESSAGE:
+	code = TRUE;
+	break;
+    case BAD_HTML_WARN:
+	/*
+	 * If we're already tracing, do not add a warning.
+	 */
+	if (!TRACE && !me->inBadHTML) {
+	    HTUserMsg(BAD_HTML_USE_TRACE);
+	    me->inBadHTML = TRUE;
+	}
+	code = TRACE;
+	break;
+    }
+    return code;
+}
+
+/*
+ * Handle the formatted message.
+ */
+void LYShowBadHTML(const char *message)
+{
+    switch ((enumBadHtml) cfg_bad_html) {
+    case BAD_HTML_IGNORE:
+	break;
+    case BAD_HTML_TRACE:
+	CTRACE((tfp, "%s", message));
+	break;
+    case BAD_HTML_MESSAGE:
+	CTRACE((tfp, "%s", message));
+	LYstore_message(message);
+	break;
+    case BAD_HTML_WARN:
+	CTRACE((tfp, "%s", message));
+	break;
     }
-    return TRUE;
 }
 
 /*_________________________________________________________________________
@@ -4572,8 +4615,13 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	     * Check for an unclosed TEXTAREA.
 	     */
 	    if (me->inTEXTAREA) {
-		if (LYBadHTML(me))
-		    CTRACE((tfp, "Bad HTML: Missing TEXTAREA end tag.\n"));
+		if (LYBadHTML(me)) {
+		    char *msg = NULL;
+
+		    HTSprintf0(&msg, "Bad HTML: Missing TEXTAREA end tag.\n");
+		    LYShowBadHTML(msg);
+		    FREE(msg);
+		}
 	    }
 
 	    /*
@@ -5028,9 +5076,14 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	 * Check for an already open SELECT block.  - FM
 	 */
 	if (me->inSELECT) {
-	    if (LYBadHTML(me))
-		CTRACE((tfp,
-			"Bad HTML: SELECT start tag in SELECT element.  Faking SELECT end tag. *****\n"));
+	    if (LYBadHTML(me)) {
+		char *msg = NULL;
+
+		HTSprintf0(&msg,
+			   "Bad HTML: SELECT start tag in SELECT element.  Faking SELECT end tag. *****\n");
+		LYShowBadHTML(msg);
+		FREE(msg);
+	    }
 	    if (me->sp->tag_number != HTML_SELECT) {
 		SET_SKIP_STACK(HTML_SELECT);
 	    }
@@ -5057,9 +5110,14 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	     * Make sure we're in a select tag.
 	     */
 	    if (!me->inSELECT) {
-		if (LYBadHTML(me))
-		    CTRACE((tfp,
-			    "Bad HTML: OPTION tag not within SELECT tag\n"));
+		if (LYBadHTML(me)) {
+		    char *msg = NULL;
+
+		    HTSprintf0(&msg,
+			       "Bad HTML: OPTION tag not within SELECT tag\n");
+		    LYShowBadHTML(msg);
+		    FREE(msg);
+		}
 
 		/*
 		 * Too likely to cause a crash, so we'll ignore it.  - FM
@@ -5811,8 +5869,13 @@ static int HTML_end_element(HTStructured * me, int element_number,
      * Check for unclosed TEXTAREA.  - FM
      */
     if (me->inTEXTAREA && element_number != HTML_TEXTAREA) {
-	if (LYBadHTML(me))
-	    CTRACE((tfp, "Bad HTML: Missing TEXTAREA end tag\n"));
+	if (LYBadHTML(me)) {
+	    char *msg = NULL;
+
+	    HTSprintf0(&msg, "Bad HTML: Missing TEXTAREA end tag\n");
+	    LYShowBadHTML(msg);
+	    FREE(msg);
+	}
     }
 
     if (!me->text && !LYMapsOnly) {
@@ -5826,16 +5889,21 @@ static int HTML_end_element(HTStructured * me, int element_number,
 
     case HTML_HTML:
 	if (me->inA || me->inSELECT || me->inTEXTAREA) {
-	    if (LYBadHTML(me))
-		CTRACE((tfp,
-			"Bad HTML: %s%s%s%s%s not closed before HTML end tag *****\n",
-			me->inSELECT ? "SELECT" : "",
-			(me->inSELECT && me->inTEXTAREA) ? ", " : "",
-			me->inTEXTAREA ? "TEXTAREA" : "",
-			(((me->inSELECT || me->inTEXTAREA) && me->inA)
-			 ? ", "
-			 : ""),
-			me->inA ? "A" : ""));
+	    if (LYBadHTML(me)) {
+		char *msg = NULL;
+
+		HTSprintf0(&msg,
+			   "Bad HTML: %s%s%s%s%s not closed before HTML end tag *****\n",
+			   me->inSELECT ? "SELECT" : "",
+			   (me->inSELECT && me->inTEXTAREA) ? ", " : "",
+			   me->inTEXTAREA ? "TEXTAREA" : "",
+			   (((me->inSELECT || me->inTEXTAREA) && me->inA)
+			    ? ", "
+			    : ""),
+			   me->inA ? "A" : "");
+		LYShowBadHTML(msg);
+		FREE(msg);
+	    }
 	}
 	break;
 
@@ -5931,16 +5999,21 @@ static int HTML_end_element(HTStructured * me, int element_number,
 
     case HTML_BODY:
 	if (me->inA || me->inSELECT || me->inTEXTAREA) {
-	    if (LYBadHTML(me))
-		CTRACE((tfp,
-			"Bad HTML: %s%s%s%s%s not closed before BODY end tag *****\n",
-			me->inSELECT ? "SELECT" : "",
-			(me->inSELECT && me->inTEXTAREA) ? ", " : "",
-			me->inTEXTAREA ? "TEXTAREA" : "",
-			(((me->inSELECT || me->inTEXTAREA) && me->inA)
-			 ? ", "
-			 : ""),
-			me->inA ? "A" : ""));
+	    if (LYBadHTML(me)) {
+		char *msg = NULL;
+
+		HTSprintf0(&msg,
+			   "Bad HTML: %s%s%s%s%s not closed before BODY end tag *****\n",
+			   me->inSELECT ? "SELECT" : "",
+			   (me->inSELECT && me->inTEXTAREA) ? ", " : "",
+			   me->inTEXTAREA ? "TEXTAREA" : "",
+			   (((me->inSELECT || me->inTEXTAREA) && me->inA)
+			    ? ", "
+			    : ""),
+			   me->inA ? "A" : "");
+		LYShowBadHTML(msg);
+		FREE(msg);
+	    }
 	}
 	break;
 
@@ -6306,10 +6379,15 @@ static int HTML_end_element(HTStructured * me, int element_number,
 		 * We had more end tags than start tags, so we have bad HTML or
 		 * otherwise misparsed.  - FM
 		 */
-		if (LYBadHTML(me))
-		    CTRACE((tfp,
-			    "Bad HTML: Unmatched OBJECT start and end tags.  Discarding content:\n%s\n",
-			    me->object.data));
+		if (LYBadHTML(me)) {
+		    char *msg = NULL;
+
+		    HTSprintf0(&msg,
+			       "Bad HTML: Unmatched OBJECT start and end tags.  Discarding content:\n%s\n",
+			       me->object.data);
+		    LYShowBadHTML(msg);
+		    FREE(msg);
+		}
 		goto End_Object;
 	    }
 	    if (s > e) {
@@ -6441,9 +6519,14 @@ static int HTML_end_element(HTStructured * me, int element_number,
 			goto End_Object;
 		    }
 		} else {
-		    if (LYBadHTML(me))
-			CTRACE((tfp,
-				"Bad HTML: Unmatched OBJECT start and end tags.  Discarding content.\n"));
+		    if (LYBadHTML(me)) {
+			char *msg = NULL;
+
+			HTSprintf0(&msg,
+				   "Bad HTML: Unmatched OBJECT start and end tags.  Discarding content.\n");
+			LYShowBadHTML(msg);
+			FREE(msg);
+		    }
 		    goto End_Object;
 		}
 	    }
@@ -6680,8 +6763,13 @@ static int HTML_end_element(HTStructured * me, int element_number,
 	 * FORM-related globals in GridText.c are initialized.  - FM
 	 */
 	if (!me->inFORM) {
-	    if (LYBadHTML(me))
-		CTRACE((tfp, "Bad HTML: Unmatched FORM end tag\n"));
+	    if (LYBadHTML(me)) {
+		char *msg = NULL;
+
+		HTSprintf0(&msg, "Bad HTML: Unmatched FORM end tag\n");
+		LYShowBadHTML(msg);
+		FREE(msg);
+	    }
 	}
 	EMIT_IFDEF_EXP_JUSTIFY_ELTS(form_in_htext = FALSE);
 
@@ -6695,9 +6783,14 @@ static int HTML_end_element(HTStructured * me, int element_number,
 	 * SELECT.  - kw
 	 */
 	if (me->inSELECT) {
-	    if (LYBadHTML(me))
-		CTRACE((tfp,
-			"Bad HTML: Open SELECT at FORM end. Faking SELECT end tag. *****\n"));
+	    if (LYBadHTML(me)) {
+		char *msg = NULL;
+
+		HTSprintf0(&msg,
+			   "Bad HTML: Open SELECT at FORM end. Faking SELECT end tag. *****\n");
+		LYShowBadHTML(msg);
+		FREE(msg);
+	    }
 	    if (me->sp->tag_number != HTML_SELECT) {
 		SET_SKIP_STACK(HTML_SELECT);
 	    }
@@ -6748,8 +6841,13 @@ static int HTML_end_element(HTStructured * me, int element_number,
 	     * Make sure we had a textarea start tag.
 	     */
 	    if (!me->inTEXTAREA) {
-		if (LYBadHTML(me))
-		    CTRACE((tfp, "Bad HTML: Unmatched TEXTAREA end tag\n"));
+		if (LYBadHTML(me)) {
+		    char *msg = NULL;
+
+		    HTSprintf0(&msg, "Bad HTML: Unmatched TEXTAREA end tag\n");
+		    LYShowBadHTML(msg);
+		    FREE(msg);
+		}
 		break;
 	    }
 
@@ -6944,8 +7042,14 @@ static int HTML_end_element(HTStructured * me, int element_number,
 	     * Make sure we had a select start tag.
 	     */
 	    if (!me->inSELECT) {
-		if (LYBadHTML(me))
-		    CTRACE((tfp, "Bad HTML: Unmatched SELECT end tag *****\n"));
+		if (LYBadHTML(me)) {
+		    char *msg = NULL;
+
+		    HTSprintf0(&msg,
+			       "Bad HTML: Unmatched SELECT end tag *****\n");
+		    LYShowBadHTML(msg);
+		    FREE(msg);
+		}
 		break;
 	    }
 
@@ -6963,9 +7067,14 @@ static int HTML_end_element(HTStructured * me, int element_number,
 	     * Make sure we're in a form.
 	     */
 	    if (!me->inFORM) {
-		if (LYBadHTML(me))
-		    CTRACE((tfp,
-			    "Bad HTML: SELECT end tag not within FORM element *****\n"));
+		if (LYBadHTML(me)) {
+		    char *msg = NULL;
+
+		    HTSprintf0(&msg,
+			       "Bad HTML: SELECT end tag not within FORM element *****\n");
+		    LYShowBadHTML(msg);
+		    FREE(msg);
+		}
 		/*
 		 * Hopefully won't crash, so we'll ignore it.  - kw
 		 */
@@ -7276,9 +7385,14 @@ static void HTML_free(HTStructured * me)
 	     * close of a still-open form, something must have gone very wrong. 
 	     * - kw
 	     */
-	    if (LYBadHTML(me))
-		CTRACE((tfp,
-			"Bad HTML: SELECT or OPTION not ended properly *****\n"));
+	    if (LYBadHTML(me)) {
+		char *msg = NULL;
+
+		HTSprintf0(&msg,
+			   "Bad HTML: SELECT or OPTION not ended properly *****\n");
+		LYShowBadHTML(msg);
+		FREE(msg);
+	    }
 	    HTChunkTerminate(&me->option);
 	    /*
 	     * Output the left-over data as text, maybe it was invalid markup
@@ -7295,9 +7409,14 @@ static void HTML_free(HTStructured * me)
 	     * close of a still-open form, something must have gone very wrong. 
 	     * - kw
 	     */
-	    if (LYBadHTML(me))
-		CTRACE((tfp,
-			"Bad HTML: TEXTAREA not used properly *****\n"));
+	    if (LYBadHTML(me)) {
+		char *msg = NULL;
+
+		HTSprintf0(&msg,
+			   "Bad HTML: TEXTAREA not used properly *****\n");
+		LYShowBadHTML(msg);
+		FREE(msg);
+	    }
 	    HTChunkTerminate(&me->textarea);
 	    /*
 	     * Output the left-over data as text, maybe it was invalid markup
@@ -7341,9 +7460,14 @@ static void HTML_free(HTStructured * me)
 	 * If we still have data in the me->option chunk after forcing a close
 	 * of a still-open form, something must have gone very wrong.  - kw
 	 */
-	if (LYBadHTML(me))
-	    CTRACE((tfp,
-		    "Bad HTML: SELECT or OPTION not ended properly *****\n"));
+	if (LYBadHTML(me)) {
+	    char *msg = NULL;
+
+	    HTSprintf0(&msg,
+		       "Bad HTML: SELECT or OPTION not ended properly *****\n");
+	    LYShowBadHTML(msg);
+	    FREE(msg);
+	}
 	if (TRACE) {
 	    HTChunkTerminate(&me->option);
 	    CTRACE((tfp, "HTML_free: ***** leftover option data: %s\n",
@@ -7357,9 +7481,14 @@ static void HTML_free(HTStructured * me)
 	 * close of a still-open form, something must have gone very wrong.  -
 	 * kw
 	 */
-	if (LYBadHTML(me))
-	    CTRACE((tfp,
-		    "Bad HTML: TEXTAREA not used properly *****\n"));
+	if (LYBadHTML(me)) {
+	    char *msg = NULL;
+
+	    HTSprintf0(&msg,
+		       "Bad HTML: TEXTAREA not used properly *****\n");
+	    LYShowBadHTML(msg);
+	    FREE(msg);
+	}
 	if (TRACE) {
 	    HTChunkTerminate(&me->textarea);
 	    CTRACE((tfp, "HTML_free: ***** leftover textarea data: %s\n",
diff --git a/src/HTML.h b/src/HTML.h
index 76376ebd..695ed9f2 100644
--- a/src/HTML.h
+++ b/src/HTML.h
@@ -208,6 +208,7 @@ extern "C" {
 
     extern HTStyle *LYstyles(int style_number);
     extern BOOL LYBadHTML(HTStructured * me);
+    extern void LYShowBadHTML(const char *s);
 
 /*
  *	Semi-Private functions. - FM
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index 8760ec39..2e69073c 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCharUtils.c,v 1.100 2009/05/30 11:56:03 tom Exp $
+ * $LynxId: LYCharUtils.c,v 1.101 2009/06/07 16:40:09 tom Exp $
  *
  *  Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM
  *  ==========================================================================
@@ -2737,8 +2737,13 @@ void LYHandleSELECT(HTStructured * me, const BOOL *present,
 	 * Check for unclosed TEXTAREA.
 	 */
 	if (me->inTEXTAREA) {
-	    if (LYBadHTML(me))
-		CTRACE((tfp, "Bad HTML: Missing TEXTAREA end tag\n"));
+	    if (LYBadHTML(me)) {
+		char *msg = NULL;
+
+		HTSprintf0(&msg, "Bad HTML: Missing TEXTAREA end tag\n");
+		LYShowBadHTML(msg);
+		FREE(msg);
+	    }
 	}
 
 	/*
@@ -2812,8 +2817,13 @@ void LYHandleSELECT(HTStructured * me, const BOOL *present,
 	 * Make sure we had a select start tag.
 	 */
 	if (!me->inSELECT) {
-	    if (LYBadHTML(me))
-		CTRACE((tfp, "Bad HTML: Unmatched SELECT end tag\n"));
+	    if (LYBadHTML(me)) {
+		char *msg = NULL;
+
+		HTSprintf0(&msg, "Bad HTML: Unmatched SELECT end tag\n");
+		LYShowBadHTML(msg);
+		FREE(msg);
+	    }
 	    return;
 	}
 
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index d4a643fa..98c9f45a 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYGlobalDefs.h,v 1.119 2009/05/22 00:18:05 tom Exp $
+ * $LynxId: LYGlobalDefs.h,v 1.120 2009/06/07 16:01:08 tom Exp $
  *
  * global variable definitions
  */
@@ -67,6 +67,13 @@ extern "C" {
 #endif				/* !VMS */
     extern char *ftp_format;
 
+    typedef enum {
+	BAD_HTML_IGNORE = 0
+	,BAD_HTML_TRACE
+	,BAD_HTML_MESSAGE
+	,BAD_HTML_WARN
+    } enumBadHtml;
+
 #ifdef DIRED_SUPPORT
 
     typedef enum {
@@ -89,6 +96,7 @@ extern "C" {
     extern BOOLEAN no_dired_support;
     extern HTList *tagged;
     extern int LYAutoUncacheDirLists;
+    extern int cfg_bad_html;	/* enumBadHtml */
     extern int dir_list_style;	/* enumDirListStyle */
     extern int dir_list_order;	/* enumDirListOrder */
 
diff --git a/src/LYHistory.c b/src/LYHistory.c
index 8c88b753..28494879 100644
--- a/src/LYHistory.c
+++ b/src/LYHistory.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYHistory.c,v 1.73 2009/01/01 23:22:12 tom Exp $
+ * $LynxId: LYHistory.c,v 1.75 2009/06/07 16:57:43 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -344,7 +344,8 @@ void LYAllocHistory(int entries)
 	int save = size_history;
 
 	size_history = (entries + 2) * 2;
-	want = (unsigned) size_history * sizeof(*history);
+	want = (unsigned) size_history *sizeof(*history);
+
 	if (history == 0) {
 	    history = (HistInfo *) malloc(want);
 	} else {
@@ -955,16 +956,22 @@ int LYShowVisitedLinks(char **newfile)
 #ifndef STATUSBUFSIZE
 #define STATUSBUFSIZE   40
 #endif
-static char *buffstack[STATUSBUFSIZE];
+
+int status_buf_size = STATUSBUFSIZE;
+
+static char **buffstack;
 static int topOfStack = 0;
 
 #ifdef LY_FIND_LEAKS
 static void free_messages_stack(void)
 {
-    topOfStack = STATUSBUFSIZE;
+    if (buffstack != 0) {
+	topOfStack = status_buf_size;
 
-    while (--topOfStack >= 0) {
-	FREE(buffstack[topOfStack]);
+	while (--topOfStack >= 0) {
+	    FREE(buffstack[topOfStack]);
+	}
+	FREE(buffstack);
     }
 }
 #endif
@@ -974,13 +981,16 @@ static void to_stack(char *str)
     /*
      * Cycle buffer:
      */
-    if (topOfStack >= STATUSBUFSIZE) {
+    if (topOfStack >= status_buf_size) {
 	topOfStack = 0;
     }
 
     /*
      * Register string.
      */
+    if (buffstack == 0)
+	buffstack = typecallocn(char *, status_buf_size);
+
     FREE(buffstack[topOfStack]);
     buffstack[topOfStack] = str;
     topOfStack++;
@@ -990,7 +1000,7 @@ static void to_stack(char *str)
 	atexit(free_messages_stack);
     }
 #endif
-    if (topOfStack >= STATUSBUFSIZE) {
+    if (topOfStack >= status_buf_size) {
 	topOfStack = 0;
     }
 }
@@ -1006,22 +1016,24 @@ void LYstatusline_messages_on_exit(char **buf)
 {
     int i;
 
-    StrAllocCat(*buf, "\n");
-    /* print messages in chronological order:
-     * probably a single message but let's do it.
-     */
-    i = topOfStack - 1;
-    while (++i < STATUSBUFSIZE) {
-	if (buffstack[i] != NULL) {
-	    StrAllocCat(*buf, buffstack[i]);
-	    StrAllocCat(*buf, "\n");
+    if (buffstack != 0) {
+	StrAllocCat(*buf, "\n");
+	/* print messages in chronological order:
+	 * probably a single message but let's do it.
+	 */
+	i = topOfStack - 1;
+	while (++i < status_buf_size) {
+	    if (buffstack[i] != NULL) {
+		StrAllocCat(*buf, buffstack[i]);
+		StrAllocCat(*buf, "\n");
+	    }
 	}
-    }
-    i = -1;
-    while (++i < topOfStack) {
-	if (buffstack[i] != NULL) {
-	    StrAllocCat(*buf, buffstack[i]);
-	    StrAllocCat(*buf, "\n");
+	i = -1;
+	while (++i < topOfStack) {
+	    if (buffstack[i] != NULL) {
+		StrAllocCat(*buf, buffstack[i]);
+		StrAllocCat(*buf, "\n");
+	    }
 	}
     }
 }
@@ -1072,10 +1084,12 @@ static int LYLoadMESSAGES(const char *arg GCC_UNUSED,
     int i;
     char *temp = NULL;
 
-    i = STATUSBUFSIZE;
-    while (--i >= 0) {
-	if (buffstack[i] != NULL)
-	    nummsg++;
+    if (buffstack != 0) {
+	i = status_buf_size;
+	while (--i >= 0) {
+	    if (buffstack[i] != NULL)
+		nummsg++;
+	}
     }
 
     /*
@@ -1121,7 +1135,7 @@ static int LYLoadMESSAGES(const char *arg GCC_UNUSED,
 		PUTS(buf);
 	    }
 	}
-	i = STATUSBUFSIZE;
+	i = status_buf_size;
 	while (--i >= topOfStack) {
 	    if (buffstack[i] != NULL) {
 		StrAllocCopy(temp, buffstack[i]);
diff --git a/src/LYHistory.h b/src/LYHistory.h
index db94144c..260ba45e 100644
--- a/src/LYHistory.h
+++ b/src/LYHistory.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYHistory.h,v 1.19 2008/02/11 01:05:04 tom Exp $
+ * $LynxId: LYHistory.h,v 1.20 2009/06/07 16:57:13 tom Exp $
  */
 #ifndef LYHISTORY_H
 #define LYHISTORY_H
@@ -31,6 +31,7 @@ extern "C" {
 
     extern HTList *Visited_Links;
     extern int nhist_extra;
+    extern int status_buf_size;
 
 #ifdef __cplusplus
 }
diff --git a/src/LYMain.c b/src/LYMain.c
index e7c6d767..96ac1e1b 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMain.c,v 1.202 2009/05/28 21:37:03 tom Exp $
+ * $LynxId: LYMain.c,v 1.203 2009/06/07 16:01:30 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -107,6 +107,7 @@ BOOLEAN lynx_edit_mode = FALSE;
 BOOLEAN no_dired_support = FALSE;
 HTList *tagged = NULL;
 int LYAutoUncacheDirLists = 2;	/* default dired uncaching behavior */
+int cfg_bad_html = BAD_HTML_WARN;
 int dir_list_order = ORDER_BY_NAME;
 int dir_list_style = MIXED_STYLE;
 
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 6e73d227..24cac109 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYOptions.c,v 1.130 2009/05/22 00:47:15 tom Exp $ */
+/* $LynxId: LYOptions.c,v 1.133 2009/06/07 18:24:50 tom Exp $ */
 #include <HTUtils.h>
 #include <HTFTP.h>
 #include <HTTP.h>		/* 'reloading' flag */
@@ -2277,6 +2277,16 @@ static OptValues DTD_type_values[] =
     {0, 0, 0}
 };
 
+static const char *bad_html_string = RC_BAD_HTML;
+static OptValues bad_html_values[] =
+{
+    {BAD_HTML_IGNORE, N_("Ignore"), "ignore"},
+    {BAD_HTML_TRACE, N_("Add to trace-file"), "trace"},
+    {BAD_HTML_MESSAGE, N_("Add to LYNXMESSAGES"), "message"},
+    {BAD_HTML_WARN, N_("Warn, point to trace-file"), "warn"},
+    {0, 0, 0}
+};
+
 static const char *select_popups_string = RC_SELECT_POPUPS;
 static const char *images_string = "images";
 static const char *images_ignore_all_string = N_("ignore");
@@ -2433,8 +2443,8 @@ static const char *user_agent_string = RC_USERAGENT;
 
 #define PutCheckBox(fp, Name, Value, disable) \
 	fprintf(fp,\
-	"<input type=\"checkbox\" name=\"%s\" value=\"%s\" %s>\n",\
-		Name, Value ? "true" : "false", disable_all?disabled_string:disable)
+	"<input type=\"checkbox\" name=\"%s\" %s %s>\n",\
+		Name, Value ? "checked" : "", disable_all?disabled_string:disable)
 
 #define PutTextInput(fp, Name, Value, Size, disable) \
 	fprintf(fp,\
@@ -2698,6 +2708,11 @@ int postoptions(DocInfo *newdoc)
 	return (NOT_FOUND);
     }
 
+    /*
+     * Checkbox will be missing from data if unchecked.
+     */
+    LYSendUserAgent = FALSE;
+
     for (i = 0; data[i].tag != NULL; i++) {
 	/*
 	 * This isn't really for security, but rather for avoiding that the
@@ -2846,6 +2861,12 @@ int postoptions(DocInfo *newdoc)
 	    }
 	}
 
+	/* Bad HTML warnings: SELECT */
+	if (!strcmp(data[i].tag, bad_html_string)
+	    && GetOptValues(bad_html_values, data[i].value, &code)) {
+	    cfg_bad_html = code;
+	}
+
 	/* Select Popups: ON/OFF */
 	if (!strcmp(data[i].tag, select_popups_string)
 	    && GetOptValues(bool_values, data[i].value, &code)) {
@@ -3091,6 +3112,11 @@ int postoptions(DocInfo *newdoc)
 	    }
 	}
 
+	/* Send User Agent: INPUT */
+	if (!strcmp(data[i].tag, send_user_agent_string)) {
+	    LYSendUserAgent = !strcasecomp(data[i].value, "ON");
+	}
+
 	/* User Agent: INPUT */
 	if (!strcmp(data[i].tag, user_agent_string) && (!no_useragent)) {
 	    if (strcmp(LYUserAgent, data[i].value)) {
@@ -3753,6 +3779,12 @@ static int gen_options(char **newfile)
     PutOptValues(fp0, Old_DTD, DTD_type_values);
     EndSelect(fp0);
 
+    /* Bad HTML messages: SELECT */
+    PutLabel(fp0, gettext("Bad HTML messages"), bad_html_string);
+    BeginSelect(fp0, bad_html_string);
+    PutOptValues(fp0, cfg_bad_html, bad_html_values);
+    EndSelect(fp0);
+
     /* Show Images: SELECT */
     PutLabel(fp0, gettext("Show images"), will_save_images());
     BeginSelect(fp0, images_string);
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index 0e7e43e2..e8b20dd2 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYReadCFG.c,v 1.138 2009/04/07 00:13:11 tom Exp $
+ * $LynxId: LYReadCFG.c,v 1.139 2009/06/07 16:57:29 tom Exp $
  */
 #ifndef NO_RULES
 #include <HTRules.h>
@@ -861,6 +861,14 @@ static int referer_with_query_fun(char *value)
     return 0;
 }
 
+static int status_buffer_size_fun(char *value)
+{
+    status_buf_size = atoi(value);
+    if (status_buf_size < 2)
+	status_buf_size = 2;
+    return 0;
+}
+
 static int suffix_fun(char *value)
 {
     char *mime_type, *p;
@@ -1556,6 +1564,7 @@ static Config_Type Config_Table [] =
 #endif
      PARSE_STR(RC_SSL_CERT_FILE,        SSL_cert_file),
      PARSE_STR(RC_STARTFILE,            startfile),
+     PARSE_FUN(RC_STATUS_BUFFER_SIZE,   status_buffer_size_fun),
      PARSE_SET(RC_STRIP_DOTDOT_URLS,    LYStripDotDotURLs),
      PARSE_SET(RC_SUBSTITUTE_UNDERSCORES, use_underscore),
      PARSE_FUN(RC_SUFFIX,               suffix_fun),
diff --git a/src/LYStrings.c b/src/LYStrings.c
index daecaae4..498975a5 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYStrings.c,v 1.165 2009/03/17 23:40:17 tom Exp $ */
+/* $LynxId: LYStrings.c,v 1.166 2009/06/07 19:32:16 tom Exp $ */
 #include <HTUtils.h>
 #include <HTCJK.h>
 #include <UCAux.h>
@@ -5323,7 +5323,7 @@ int LYscanFloat2(const char **source, float *result)
 	    }
 	}
 	if (src != 0 && *src != '\0' && strchr(" \t+", *src) == 0) {
-	    char *extra = malloc(2 + strlen(src));
+	    char *extra = (char *) malloc(2 + strlen(src));
 
 	    if (extra != 0) {
 		extra[0] = '1';
diff --git a/src/LYrcFile.c b/src/LYrcFile.c
index ccffaa16..dc76e41b 100644
--- a/src/LYrcFile.c
+++ b/src/LYrcFile.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYrcFile.c,v 1.77 2009/05/22 00:26:25 tom Exp $ */
+/* $LynxId: LYrcFile.c,v 1.81 2009/06/07 17:11:00 tom Exp $ */
 #include <HTUtils.h>
 #include <HTFTP.h>
 #include <LYUtils.h>
@@ -26,6 +26,14 @@ static Config_Enum tbl_DTD_recovery[] = {
     { NULL,		-1 },
 };
 
+static Config_Enum tbl_bad_html[] = {
+    { "ignore",		BAD_HTML_IGNORE	 },
+    { "trace",		BAD_HTML_TRACE	 },
+    { "message",	BAD_HTML_MESSAGE },
+    { "warn",		BAD_HTML_WARN	 },
+    { NULL,		-1		 }
+};
+
 #ifdef DIRED_SUPPORT
 static Config_Enum tbl_dir_list_style[] = {
     { "FILES_FIRST",	FILES_FIRST },
@@ -329,6 +337,8 @@ Lynx will use the personal email address.  Set anonftp_password\n\
 to a different value if you choose.\n\
 ")),
 #endif
+    MAYBE_ENU(RC_BAD_HTML,              cfg_bad_html,      tbl_bad_html,
+	      MSG_ENABLE_LYNXRC),
     PARSE_STR(RC_BOOKMARK_FILE,         bookmark_page,     N_("\
 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\
diff --git a/src/LYrcFile.h b/src/LYrcFile.h
index 56f75c68..22f56861 100644
--- a/src/LYrcFile.h
+++ b/src/LYrcFile.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYrcFile.h,v 1.31 2009/05/22 00:19:45 tom Exp $
+ * $LynxId: LYrcFile.h,v 1.33 2009/06/07 16:56:00 tom Exp $
  */
 #ifndef LYRCFILE_H
 #define LYRCFILE_H
@@ -21,6 +21,7 @@
 #define RC_ASSUME_UNREC_CHARSET         "assume_unrec_charset"
 #define RC_AUTO_SESSION                 "auto_session"
 #define RC_AUTO_UNCACHE_DIRLISTS        "auto_uncache_dirlists"
+#define RC_BAD_HTML                     "bad_html"
 #define RC_BIBP_BIBHOST                 "bibp_bibhost"
 #define RC_BIBP_GLOBALSERVER            "bibp_globalserver"
 #define RC_BLOCK_MULTI_BOOKMARKS        "block_multi_bookmarks"
@@ -218,6 +219,7 @@
 #define RC_SOURCE_CACHE_FOR_ABORTED     "source_cache_for_aborted"
 #define RC_SSL_CERT_FILE                "ssl_cert_file"
 #define RC_STARTFILE                    "startfile"
+#define RC_STATUS_BUFFER_SIZE           "status_buffer_size"
 #define RC_STRIP_DOTDOT_URLS            "strip_dotdot_urls"
 #define RC_SUBSTITUTE_UNDERSCORES       "substitute_underscores"
 #define RC_SUB_BOOKMARKS                "sub_bookmarks"