about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-02-27 19:00:00 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1998-02-27 19:00:00 -0500
commit86b4d41a7463bd35cf662fc748aa338caef609c9 (patch)
treedb4ba2deed8edca7df91182c0253ee93248c7382 /src
parent899516a7c8880df05e30bbbed72ca1d3cb7a4f00 (diff)
downloadlynx-snapshots-86b4d41a7463bd35cf662fc748aa338caef609c9.tar.gz
snapshot of project "lynx", label v2-7-1ac-0_117
Diffstat (limited to 'src')
-rw-r--r--src/DefaultStyle.c39
-rw-r--r--src/GridText.c44
-rw-r--r--src/HTFWriter.c11
-rw-r--r--src/HTML.c39
-rw-r--r--src/HTML.h5
-rw-r--r--src/LYCharSets.c65
-rw-r--r--src/LYCharSets.h15
-rw-r--r--src/LYCharUtils.c28
-rw-r--r--src/LYCurses.c56
-rw-r--r--src/LYCurses.h38
-rw-r--r--src/LYDownload.c222
-rw-r--r--src/LYKeymap.c6
-rw-r--r--src/LYLocal.c4
-rw-r--r--src/LYMail.c2
-rw-r--r--src/LYMain.c671
-rw-r--r--src/LYMainLoop.c32
-rw-r--r--src/LYNews.c2
-rw-r--r--src/LYOptions.c2
-rw-r--r--src/LYPrint.c19
-rw-r--r--src/LYReadCFG.c6
-rw-r--r--src/LYReadCFG.h26
-rw-r--r--src/LYShowInfo.c7
-rw-r--r--src/LYStrings.c135
-rw-r--r--src/LYStrings.h13
-rw-r--r--src/LYStyle.c20
-rw-r--r--src/LYUtils.c27
-rw-r--r--src/LYUtils.h4
-rw-r--r--src/UCAuto.c4
-rw-r--r--src/UCdomap.c7
-rw-r--r--src/chrtrans/README.tables2
-rw-r--r--src/chrtrans/UCkd.h1
-rw-r--r--src/chrtrans/cp1252_uni.tbl80
-rw-r--r--src/chrtrans/def7_uni.tbl7
-rw-r--r--src/chrtrans/makefile.in81
-rw-r--r--src/chrtrans/makeuctb.c2
-rw-r--r--src/makefile.dos2
-rw-r--r--src/makefile.in14
37 files changed, 981 insertions, 757 deletions
diff --git a/src/DefaultStyle.c b/src/DefaultStyle.c
index 140f0a77..7299ede1 100644
--- a/src/DefaultStyle.c
+++ b/src/DefaultStyle.c
@@ -12,7 +12,7 @@
 
 /*	Tab arrays:
 */
-PRIVATE HTTabStop tabs_8[] = {
+PRIVATE CONST HTTabStop tabs_8[] = {
 	{ 0, 8 }, {0, 16}, {0, 24}, {0, 32}, {0, 40},
 	{ 0, 48 }, {0, 56}, {0, 64}, {0, 72}, {0, 80},
 	{ 0, 88 }, {0, 96}, {0, 104}, {0, 112}, {0, 120},
@@ -364,5 +364,38 @@ PRIVATE HTStyle HTStyleHeadingRight = {
 PRIVATE HTStyleSheet sheet = { "default.style",
 				&HTStyleHeadingRight }; /* sheet */
 
-PUBLIC HTStyleSheet * styleSheet = &sheet;
- 
+PUBLIC HTStyleSheet * DefaultStyle NOARGS
+{
+    static HTStyleSheet *result;
+    HTStyle *p, *q;
+
+    /*
+     * The first time we're called, allocate a copy of the 'sheet' linked
+     * list.  Thereafter, simply copy the data from 'sheet' into our copy
+     * (preserving the copy's linked-list pointers).  We do this to reset the
+     * parameters of a style that might be altered while processing a page.
+     */
+    if (result == 0) {	/* allocate & copy */
+    	result = HTStyleSheetNew ();
+	*result = sheet;
+	result->styles = 0;
+	for (p = sheet.styles; p != 0; p = p->next) {
+	    q = HTStyleNew ();
+	    *q = *p;
+	    q->next = result->styles;
+	    result->styles = q;
+	}
+    } else {		/* recopy the data */
+    	for (p = result->styles, q = sheet.styles;
+		p != 0 && q != 0;
+		p = p->next, q = q->next) {
+    	    HTStyle *r = p->next;
+	    HTStyle temp;
+	    temp = *p;
+	    temp.next = q->next;
+	    *p = *q;
+	    p->next = r;
+	}
+    }
+    return result;
+}
diff --git a/src/GridText.c b/src/GridText.c
index 102f5a43..160b5fe9 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -78,10 +78,6 @@ extern BOOL HTPassHighCtrlRaw;
 extern HTkcode kanji_code;
 extern HTCJKlang HTCJK;
 
-/*	From default style sheet:
-*/
-extern HTStyleSheet * styleSheet;	/* Default or overridden */
-
 /*	Exports
 */
 PUBLIC HText * HTMainText = NULL;		/* Equivalent of main window */
@@ -2338,7 +2334,7 @@ PUBLIC void HText_appendCharacter ARGS2(
      *  Tabs.
      */
     if (ch == '\t') {
-	HTTabStop * Tab;
+	CONST HTTabStop * Tab;
 	int target;	/* Where to tab to */
 	int here;
 
@@ -3355,7 +3351,7 @@ re_parse:
 /*	Dump diagnostics to stderr
 */
 PUBLIC void HText_dump ARGS1(
-	HText *,	text)
+	HText *,	text GCC_UNUSED)
 {
     fprintf(stderr, "HText: Dump called\n");
 }
@@ -3491,7 +3487,9 @@ PUBLIC int HTGetLinkInfo ARGS6(
 {
     TextAnchor *a;
     HTAnchor *link_dest;
+#ifndef DONT_TRACK_INTERNAL_LINKS
     HTAnchor *link_dest_intl = NULL;
+#endif
     int anchors_this_line = 0, anchors_this_screen = 0;
     int prev_anchor_line = -1, prev_prev_anchor_line = -1;
 
@@ -4271,8 +4269,8 @@ PUBLIC BOOL HText_selectAnchor ARGS2(
 /*	Apply this style to the selection
 */
 PUBLIC void HText_applyStyle ARGS2(
-	HText *,	me,
-	HTStyle *,	style)
+	HText *,	me GCC_UNUSED,
+	HTStyle *,	style GCC_UNUSED)
 {
 
 }
@@ -4281,8 +4279,8 @@ PUBLIC void HText_applyStyle ARGS2(
 /*	Update all text with changed style.
 */
 PUBLIC void HText_updateStyle ARGS2(
-	HText *,	me,
-	HTStyle *,	style)
+	HText *,	me GCC_UNUSED,
+	HTStyle *,	style GCC_UNUSED)
 {
 
 }
@@ -4291,8 +4289,8 @@ PUBLIC void HText_updateStyle ARGS2(
 /*	Return style of  selection
 */
 PUBLIC HTStyle * HText_selectionStyle ARGS2(
-	HText *,		me,
-	HTStyleSheet *,		sheet)
+	HText *,		me GCC_UNUSED,
+	HTStyleSheet *,		sheet GCC_UNUSED)
 {
     return 0;
 }
@@ -4301,9 +4299,9 @@ PUBLIC HTStyle * HText_selectionStyle ARGS2(
 /*	Paste in styled text
 */
 PUBLIC void HText_replaceSel ARGS3(
-	HText *,	me,
-	CONST char *,	aString,
-	HTStyle *,	aStyle)
+	HText *,	me GCC_UNUSED,
+	CONST char *,	aString GCC_UNUSED,
+	HTStyle *,	aStyle GCC_UNUSED)
 {
 }
 
@@ -4312,8 +4310,8 @@ PUBLIC void HText_replaceSel ARGS3(
 **	(style recovery only)
 */
 PUBLIC void HTextApplyToSimilar ARGS2(
-	HText *,	me,
-	HTStyle *,	style)
+	HText *,	me GCC_UNUSED,
+	HTStyle *,	style GCC_UNUSED)
 {
 
 }
@@ -4323,8 +4321,8 @@ PUBLIC void HTextApplyToSimilar ARGS2(
 **	(style recovery only)
 */
 PUBLIC void HTextSelectUnstyled ARGS2(
-	HText *,		me,
-	HTStyleSheet *,		sheet)
+	HText *,		me GCC_UNUSED,
+	HTStyleSheet *,		sheet GCC_UNUSED)
 {
 
 }
@@ -4333,13 +4331,13 @@ PUBLIC void HTextSelectUnstyled ARGS2(
 /*	Anchor handling:
 */
 PUBLIC void HText_unlinkSelection ARGS1(
-	HText *,	me)
+	HText *,	me GCC_UNUSED)
 {
 
 }
 
 PUBLIC HTAnchor * HText_referenceSelected ARGS1(
-	HText *,	me)
+	HText *,	me GCC_UNUSED)
 {
      return 0;
 }
@@ -4358,8 +4356,8 @@ PUBLIC int HText_getLines ARGS1(
 }
 
 PUBLIC HTAnchor * HText_linkSelTo ARGS2(
-	HText *,	me,
-	HTAnchor *,	anchor)
+	HText *,	me GCC_UNUSED,
+	HTAnchor *,	anchor GCC_UNUSED)
 {
     return 0;
 }
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index a2c78dbe..a5390387 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -414,7 +414,9 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
 /*	Abort writing
 **	-------------
 */
-PRIVATE void HTFWriter_abort ARGS2(HTStream *, me, HTError, e)
+PRIVATE void HTFWriter_abort ARGS2(
+	HTStream *,	me,
+	HTError,	e GCC_UNUSED)
 {
     if (TRACE)
 	fprintf(stderr,"HTFWriter_abort called\n");
@@ -908,8 +910,7 @@ Prepend_BASE:
 	    StrAllocCopy(temp, anchor->charset);
 	    collapse_spaces(temp);
 		fprintf(ret_obj->fp,
-		"<META HTTP-EQUIV=\"Content-Type\" "
-		"CONTENT=\"text/html; charset=%s\">\n\n",
+		"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=%s\">\n\n",
 		temp);
 	}
 	FREE(temp);
@@ -1158,9 +1159,9 @@ Compressed_tempname:
 **
 */
 PUBLIC HTStream* HTDumpToStdout ARGS3(
-	HTPresentation *,	pres,
+	HTPresentation *,	pres GCC_UNUSED,
 	HTParentAnchor *,	anchor,
-	HTStream *,		sink)
+	HTStream *,		sink GCC_UNUSED)
 {
     HTStream * ret_obj;
     ret_obj = (HTStream*)calloc(sizeof(* ret_obj),1);
diff --git a/src/HTML.c b/src/HTML.c
index 33fe2440..8d5c705b 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -72,11 +72,15 @@ extern BOOLEAN HT_Is_Gopher_URL;
 /* from Curses.h */
 extern int LYcols;
 
-extern HTStyleSheet * styleSheet;	/* Application-wide */
+struct _HTStream {
+    CONST HTStreamClass *	isa;
+    /* .... */
+};
+
+PRIVATE HTStyleSheet * styleSheet;	/* Application-wide */
 
 /*	Module-wide style cache
 */
-PRIVATE int		got_styles = 0;
 PUBLIC  HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles  */
 					   /* and 3 header alignment styles */
 					   /* and 3 div alignment styles    */
@@ -265,7 +269,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
 
     case HTML_PRE:				/* Formatted text */
 	/*
-	 *  We guarrantee that the style is up-to-date in begin_litteral
+	 *  We guarantee that the style is up-to-date in begin_litteral
 	 *  But we still want to strip \r's
 	 */
 	if (c != '\r' &&
@@ -282,7 +286,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
     case HTML_XMP:
     case HTML_PLAINTEXT:
 	/*
-	 *  We guarrantee that the style is up-to-date in begin_litteral
+	 *  We guarantee that the style is up-to-date in begin_litteral
 	 *  But we still want to strip \r's
 	 */
 	if (c != '\r')	{
@@ -397,7 +401,7 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
     case HTML_XMP:
     case HTML_PLAINTEXT:
 	/*
-	 *  We guarrantee that the style is up-to-date in begin_litteral
+	 *  We guarantee that the style is up-to-date in begin_litteral
 	 */
 	HText_appendText(me->text, s);
 	break;
@@ -6695,8 +6699,7 @@ End_Object:
 */
 PUBLIC int HTML_put_entity ARGS2(HTStructured *, me, int, entity_number)
 {
-    int nent = HTML_dtd.number_of_entities, c_out;
-    UCode_t uni;
+    int nent = HTML_dtd.number_of_entities;
 
     if (entity_number < nent) {
 	HTML_put_string(me, p_entity_values[entity_number]);
@@ -7005,8 +7008,6 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e)
 */
 PRIVATE void get_styles NOARGS
 {
-    got_styles = YES;
-
     default_style =		HTStyleNamed(styleSheet, "Normal");
 
     styles[HTML_H1] =		HTStyleNamed(styleSheet, "Heading1");
@@ -7128,10 +7129,14 @@ PUBLIC HTStructured* HTML_new ARGS3(
     if (me == NULL)
 	outofmem(__FILE__, "HTML_new");
 
-    if (!got_styles)
-	get_styles();
-    else
-	default_style = HTStyleNamed(styleSheet, "Normal");
+    /*
+     * This used to call 'get_styles()' only on the first time through this
+     * function.  However, if the user reloads a page with ^R, the styles[]
+     * array is not necessarily the same as it was from 'get_styles()'.  So
+     * we reinitialize the whole thing.
+     */
+    styleSheet = DefaultStyle();
+    get_styles();
 
     me->isa = &HTMLPresentation;
     me->node_anchor = anchor;
@@ -7427,7 +7432,7 @@ PUBLIC HTStream* HTMLParsedPresent ARGS3(
 **	This will convert from HTML to presentation or plain text.
 */
 PUBLIC HTStream* HTMLToC ARGS3(
-	HTPresentation *,	pres,
+	HTPresentation *,	pres GCC_UNUSED,
 	HTParentAnchor *,	anchor,
 	HTStream *,		sink)
 {
@@ -7450,9 +7455,9 @@ PUBLIC HTStream* HTMLToC ARGS3(
 */
 #ifndef GUI
 PUBLIC HTStream* HTMLPresent ARGS3(
-	HTPresentation *,	pres,
+	HTPresentation *,	pres GCC_UNUSED,
 	HTParentAnchor *,	anchor,
-	HTStream *,		sink)
+	HTStream *,		sink GCC_UNUSED)
 {
     return SGML_new(&HTML_dtd, anchor, HTML_new(anchor, WWW_PRESENT, NULL));
 }
@@ -7477,7 +7482,7 @@ PUBLIC HTStream* HTMLPresent ARGS3(
 **	returns a negative number to indicate lack of success in the load.
 */
 PUBLIC int HTLoadError ARGS3(
-	HTStream *,	sink,
+	HTStream *,	sink GCC_UNUSED,
 	int,		number,
 	CONST char *,	message)
 {
diff --git a/src/HTML.h b/src/HTML.h
index 7507d3ea..5a642367 100644
--- a/src/HTML.h
+++ b/src/HTML.h
@@ -210,11 +210,6 @@ struct _HTStructured {
     int 		tag_charset; /* charset for attribute values etc. */
 };
 
-struct _HTStream {
-    CONST HTStreamClass *	isa;
-    /* .... */
-};
-
 extern  HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles  */
 					   /* and 3 header alignment styles */
 					   /* and 3 div alignment styles    */
diff --git a/src/LYCharSets.c b/src/LYCharSets.c
index 4798e8e3..2f9e4362 100644
--- a/src/LYCharSets.c
+++ b/src/LYCharSets.c
@@ -31,16 +31,25 @@ PUBLIC int LYNumCharsets = 0; /* Will be initialized later by UC_Register. */
  *  INSTRUCTIONS for adding new character sets which do not have
  *		 Unicode tables.
  *
+ *  Currently we only declare some charset's properties here
+ *  (such as MIME names, etc.), it does not include real mapping.
+ *
+ *  [We hope you need not correct/add old-style mapping
+ *  as in ISO_LATIN1[] or SevenBitApproximations[] any more -
+ *  it works now via new chartrans mechanism, but kept for compatibility only:
+ *  we should cleanup the stuff, but this is not so easy...]
+ *
+ *  There is a place marked "Add your new character sets HERE" in this file.
  *  Make up a character set and add it in the same
  *  style as the ISO_LATIN1 set below, giving it a unique name.
  *
- *  Near the end of this file is a place marked "Add your character sets HERE".
+ *  Add the name of the set to LYCharSets.
+ *  Similarly add the appropriate information to the tables below:
+ *  LYchar_set_names, LYCharSet_UC, LYlowest_eightbit.
+ *  These 4 tables all MUST have the same order.
+ *  (And this is the order you will see in Lynx Options Menu,
+ *  which is why few unicode-based charsets are listed here).
  *
- *  Add the name of the set to LYCharSets at the bottom of this file, and
- *  also add it to the LYchar_set_names table below LYCharSets.
- *  Similarly add the appropriate information to LYCharSet_UC and to
- *  LYlowest_eightbit below that.
- *  These tables all MUST have the same order.
  */
 
 /*	Entity values -- for ISO Latin 1 local representation
@@ -96,7 +105,7 @@ PRIVATE char * ISO_Latin1[] = {
 	"\251", /* copyright sign (&#169;) - copy */
 	"\244", /* currency sign (&#164;) - curren */
 	"\260", /* degree sign (&#176;) - deg */
-	"\250", /* spacing diaresis (&#168;) - die */
+	"\250", /* spacing dieresis (&#168;) - die */
 	"\367", /* division sign (&#247;) - divide */
 	"\351", /* small e, acute accent (&#233;) - eacute */
 	"\352", /* small e, circumflex accent (&#234;) - ecirc */
@@ -155,7 +164,7 @@ PRIVATE char * ISO_Latin1[] = {
 	"\372", /* small u, acute accent (&#250;) - uacute */
 	"\373", /* small u, circumflex accent (&#251;) - ucirc */
 	"\371", /* small u, grave accent (&#249;) - ugrave */
-	"\250", /* spacing diaresis (&#168;) - uml */
+	"\250", /* spacing dieresis (&#168;) - uml */
 	"\374", /* small u, dieresis or umlaut mark (&#252;) - uuml */
 	"\375", /* small y, acute accent (&#253;) - yacute */
 	"\245", /* yen sign (&#165;) - yen */
@@ -231,7 +240,7 @@ PUBLIC char * SevenBitApproximations[] = {
 	"(c)",	/* copyright sign (&#169;) - copy */
 	"CUR",	/* currency sign (&#164;) - curren */
 	"DEG",	/* degree sign (&#176;) - deg */
-	"\042", /* spacing diaresis (&#168;) - die */
+	"\042", /* spacing dieresis (&#168;) - die */
 	"/",	/* division sign (&#247;) - divide */
 	"e",	/* small e, acute accent (&#233;) - eacute */
 	"e",	/* small e, circumflex accent (&#234;) - ecirc */
@@ -294,7 +303,7 @@ PUBLIC char * SevenBitApproximations[] = {
 	"u",	/* small u, acute accent (&#250;) - uacute */
 	"u",	/* small u, circumflex accent (&#251;) - ucirc */
 	"u",	/* small u, grave accent (&#249;) - ugrave */
-	"\042", /* spacing diaresis (&#168;) - uml */
+	"\042", /* spacing dieresis (&#168;) - uml */
 #ifdef LY_UMLAUT
 	"ue",	/* small u, dieresis or umlaut mark (&#252;) - uuml */
 #else
@@ -670,7 +679,7 @@ PUBLIC CONST char * LYEntityNames[] = {
 	"yen",		/* 165, yen sign */
 	"brvbar",	/* 166, broken vertical bar, (brkbar) */
 	"sect", 	/* 167, section sign */
-	"uml",		/* 168, spacing diaresis */
+	"uml",		/* 168, spacing dieresis */
 	"copy", 	/* 169, copyright sign */
 	"ordf", 	/* 170, feminine ordinal indicator */
 	"laquo",	/* 171, angle quotation mark, left */
@@ -779,15 +788,17 @@ PUBLIC CONST char * HTMLGetEntityName ARGS1(
 
 /*
  *  Function to return the UCode_t (long int) value for entity names
- *  in the ISO_Latin1 and UC_entity_info extra_entities arrays.  It
- *  returns 0 if not found. - FM
+ *  in the ISO_Latin1 and UC_entity_info unicode_entities arrays.
+ *  It returns 0 if not found. - FM
+ *
+ *  unicode_entities[] now handles all the names from old style entities[] too.
+ *  Lynx now calls unicode_entities[] only through this function:
+ *  HTMLGetEntityUCValue().  Note, we need not check for special characters
+ *  here in function or even before it, we should check them *after*
+ *  invoking this function, see put_special_unicodes() in SGML.c.
  *
- *  Unicode-based extra_entities[] table now handles all the names from old
- *  style entities[] too.  In the future we will try to redirect all calls to
- *  both entities[] and extra_entities[] through HTMLGetEntityUCValue() only.
- *  Also, we should not worry about control characters, they will pass through
- *  Unicode anyway and should be processed *after* calling this function.
- *  (see put_special_unicodes() in SGML.c).  - LP
+ *  In the future we will try to isolate all calls to entities[]
+ *  in favor of new unicode-based chartrans scheme. - LP
  */
 PUBLIC UCode_t HTMLGetEntityUCValue ARGS1(
 	CONST char *,	name)
@@ -796,7 +807,7 @@ PUBLIC UCode_t HTMLGetEntityUCValue ARGS1(
     size_t i, high, low;
     int diff = 0;
 /*  CONST char ** entities = HTML_dtd.entity_names;  */
-    CONST UC_entity_info * extra_entities = HTML_dtd.extra_entity_info;
+    CONST UC_entity_info * unicode_entities = HTML_dtd.unicode_entity_info;
 
     /*
      *	Make sure we have a non-zero length name. - FM
@@ -807,7 +818,9 @@ PUBLIC UCode_t HTMLGetEntityUCValue ARGS1(
 
 #ifdef NOTDEFINED
 /*
-**  extra_entities[] now handle all names from entities[], so disable latter.
+**  unicode_entities[] now handles all names from entities[], so disable latter.
+**  Let us keep this some sort of comment until we remove
+**  all calls to old-style entities[] from the code. - LP
 */
 
     /*
@@ -864,23 +877,23 @@ PUBLIC UCode_t HTMLGetEntityUCValue ARGS1(
     }
 
     /*
-     *	Not yet found, so try UC_entity_info extra_entities[]. - FM
+     *	Not yet found...    - FM
      */
 #endif /* NOTDEFINED */
 
     /*
-     *	Try UC_entity_info extra_entities[].
+     *	Try UC_entity_info unicode_entities[].
      */
-    for (low = 0, high = HTML_dtd.number_of_extra_entities;
+    for (low = 0, high = HTML_dtd.number_of_unicode_entities;
 	 high > low;
 	 diff < 0 ? (low = i+1) : (high = i)) {
 	/*
 	**  Binary search.
 	*/
 	i = (low + (high-low)/2);
-	diff = strcmp(extra_entities[i].name, name);
+	diff = strcmp(unicode_entities[i].name, name);	/* Case sensitive! */
 	if (diff == 0) {
-	    value = extra_entities[i].code;
+	    value = unicode_entities[i].code;
 	    break;
 	}
     }
diff --git a/src/LYCharSets.h b/src/LYCharSets.h
index 08c9f482..17ee98e2 100644
--- a/src/LYCharSets.h
+++ b/src/LYCharSets.h
@@ -15,7 +15,8 @@ extern int current_char_set;
 extern CONST char * LYchar_set_names[];
 
 /*
- *  Initializer for LYCharSets.c.
+ *  Initializer, calls initialization function for the
+ *  CHARTRANS handling. - KW
  */
 extern int LYCharSetsDeclared NOPARAMS;
 
@@ -30,9 +31,17 @@ extern void HTMLSetCharacterHandling PARAMS((int i));
 extern void HTMLSetRawModeDefault PARAMS((int i));
 extern void HTMLSetUseDefaultRawMode PARAMS((int i, BOOLEAN modeflag));
 extern void HTMLSetHaveCJKCharacterSet PARAMS((int i));
+extern void HTMLUseCharacterSet PARAMS((int i));
+extern UCode_t HTMLGetEntityUCValue PARAMS((CONST char *name));
+
 extern CONST char * LYEntityNames[];
 extern CONST char * HTMLGetEntityName PARAMS((UCode_t code));
-extern UCode_t HTMLGetEntityUCValue PARAMS((CONST char *name));
-extern void HTMLUseCharacterSet PARAMS((int i));
+		/*
+		** HTMLGetEntityName calls LYEntityNames for iso-8859-1 entity
+		** names only.	This is an obsolete technique but widely used in
+		** the code.  Note that unicode number in general may have
+		** several equivalent entity names because of synonyms.
+		*/
+
 
 #endif /* LYCHARSETS_H */
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index acc8e0aa..33e775b0 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -833,7 +833,7 @@ PUBLIC void LYGetChartransInfo ARGS1(
 				      UCT_STAGE_STRUCTURED);
 }
 
-#if 0
+#if NOTUSED_FOTEMODS
 /*
 **  This function reallocates an allocated string and converts
 **  characters for the current display character set.  It assumes
@@ -1026,7 +1026,7 @@ PUBLIC void LYExpandString ARGS2(
 		/*
 		**  Got an ASCII character when expecting
 		**  UTF-8 multibytes, so ignore the buffered
-		**  multibye characters and fall through with
+		**  multibyte characters and fall through with
 		**  the current ASCII character. - FM
 		*/
 		utf_count = 0;
@@ -1115,7 +1115,7 @@ PUBLIC void LYExpandString ARGS2(
 	}
 	/*
 	**  Ignore low ISO 646 7-bit control characters
-	**  if they sneeked through (should have been
+	**  if they sneaked through (should have been
 	**  filtered by the parser). - FM
 	*/
 	if (code < 32 &&
@@ -1124,7 +1124,7 @@ PUBLIC void LYExpandString ARGS2(
 	}
 	/*
 	**  Ignore 127 if we don't have HTPassHighCtrlRaw
-	**  and it sneeked through (should have been
+	**  and it sneaked through (should have been
 	**  filtered by the parser). - FM
 	*/
 	if (c == 127 &&
@@ -1134,7 +1134,7 @@ PUBLIC void LYExpandString ARGS2(
 	}
 	/*
 	**  Ignore 8-bit control characters 128 - 159 if we don't
-	**  have HTPassHighCtrlRaw set and they sneeked through
+	**  have HTPassHighCtrlRaw set and they sneaked through
 	**  (should have been filtered by the parser). - FM
 	*/
 	if (code > 127 && code < 160 &&
@@ -1362,7 +1362,7 @@ PUBLIC void LYExpandString ARGS2(
 						UCGetLYhndl_byMIME("us-ascii"),
 						0) >= 0)) {
 		/*
-		**  Got a repacement string (yippey). - FM
+		**  Got a replacement string (yippey). - FM
 		*/
 		HTChunkPuts(s, replace_buf);
 		continue;
@@ -1393,7 +1393,7 @@ PUBLIC void LYExpandString ARGS2(
     StrAllocCopy(*str, s->data);
     HTChunkFree(s);
 }
-#endif
+#endif /* NOTUSED_FOTEMODS */
 
 /*
 ** Get UCS character code for one character from UTF-8 encoded string.
@@ -1547,7 +1547,7 @@ PRIVATE char *hex = "0123456789ABCDEF";
 **
 **  If `stype' is st_URL, non-ASCII characters are URL-encoded instead.
 **  The sequence of bytes being URL-encoded is the raw input character if
-**  we couldn't transtate it from `cs_in' (CJK etc.); otherwise it is the
+**  we couldn't translate it from `cs_in' (CJK etc.); otherwise it is the
 **  UTF-8 representation if either `cs_to' requires this or if the
 **  character's Unicode value is > 255, otherwise it should be the iso-8859-1
 **  representation.
@@ -1592,8 +1592,6 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9(
     long int lcode;
     BOOL output_utf8 = 0, repl_translated_C0 = 0;
     size_t len;
-    int high, low, diff = 0, i;
-    CONST char ** entities = HTML_dtd.entity_names;
     CONST char * name = NULL;
     BOOLEAN no_bytetrans;
     UCTransParams T;
@@ -2509,7 +2507,7 @@ PUBLIC void LYHandleMETA ARGS4(
 	 *  header via META tags, because it's likely
 	 *  to be untrustworthy, but do check for a
 	 *  Date header from a server when making the
-	 *  comparsion. - FM
+	 *  comparison. - FM
 	 */
 	LYUCFullyTranslateString(&content, me->tag_charset, me->tag_charset,
 				 NO, NO, YES, st_other);
@@ -3168,7 +3166,7 @@ PUBLIC void LYHandleSELECT ARGS5(
 	     *	Force a newline when we're using a popup in
 	     *	a PRE block and are within 7 columns from the
 	     *	right margin.  This will allow for the '['
-	     *	popup designater and help avoid a wrap in the
+	     *	popup designator and help avoid a wrap in the
 	     *	underscore placeholder for the retracted popup
 	     *	entry in the HText structure. - FM
 	     */
@@ -3312,7 +3310,7 @@ PUBLIC int LYLegitimizeHREF ARGS4(
     if (!strncasecomp(*href, "lynxexec:", 9) ||
 	!strncasecomp(*href, "lynxprog:", 9)) {
 	/*
-	 *  The original implementions of these schemes expected
+	 *  The original implementations of these schemes expected
 	 *  white space without hex escaping, and did not check
 	 *  for hex escaping, so we'll continue to support that,
 	 *  until that code is redone in conformance with SGML
@@ -3567,8 +3565,8 @@ PUBLIC void LYHandleID ARGS2(
 }
 
 /*
-**  This function checks whether we want to overrride
-**  the current default alignment for parargraphs and
+**  This function checks whether we want to override
+**  the current default alignment for paragraphs and
 **  instead use that specified in the element's style
 **  sheet. - FM
 */
diff --git a/src/LYCurses.c b/src/LYCurses.c
index b23c7662..70eeb249 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -113,20 +113,20 @@ PUBLIC void LYsubAttr ARGS1(
 
 PUBLIC void lynx_setup_colors NOARGS
 {
-    SLtt_set_color(0, NULL, "black", "white");
-    SLtt_set_color(1, NULL, "blue", "white");	 /* bold */
-    SLtt_set_color(2, NULL, "yellow", "blue");	 /* reverse */
-    SLtt_set_color(4, NULL, "magenta", "white"); /* underline */
+    SLtt_set_color(0, NULL, DEFAULT_FG, DEFAULT_BG);
+    SLtt_set_color(1, NULL, "blue",	DEFAULT_BG); /* bold */
+    SLtt_set_color(2, NULL, "yellow",	"blue");     /* reverse */
+    SLtt_set_color(4, NULL, "magenta",	DEFAULT_BG); /* underline */
     /*
      *	The other objects are '|'ed together to get rest.
      */
-    SLtt_set_color(3, NULL, "green", "white");	 /* bold-reverse */
-    SLtt_set_color(5, NULL, "blue", "white");	 /* bold-underline */
-    SLtt_set_color(6, NULL, "red", "white");	 /* reverse-underline */
-    SLtt_set_color(7, NULL, "magenta", "cyan");  /* reverse-underline-bold */
+    SLtt_set_color(3, NULL, "green",	DEFAULT_BG); /* bold-reverse */
+    SLtt_set_color(5, NULL, "blue",	DEFAULT_BG); /* bold-underline */
+    SLtt_set_color(6, NULL, "red",	DEFAULT_BG); /* reverse-underline */
+    SLtt_set_color(7, NULL, "magenta",	"cyan");     /* reverse-underline-bold */
 
     /*
-     *	Now set monchrome attributes.
+     *	Now set monochrome attributes.
      */
     SLtt_set_mono(1, NULL, SLTT_BOLD_MASK);
     SLtt_set_mono(2, NULL, SLTT_REV_MASK);
@@ -235,7 +235,7 @@ PUBLIC void LYbox ARGS2(
      *	If we don't have explicitly specified characters for either
      *	vertical or horizontal lines, the characters that box() would
      *	use for the corners probably also won't work well.  So we
-     *	specifiy our own ASCII characters for the corners and call
+     *	specify our own ASCII characters for the corners and call
      *	wborder() instead of box(). - kw
      */
 #ifdef HAVE_WBORDER
@@ -444,13 +444,13 @@ PRIVATE struct {
     int fg, bg;
     chtype attr;
 } lynx_color_cfg[] = {
-    /*0*/ { COLOR_BLACK,   COLOR_WHITE, A_NORMAL}, /* A_NORMAL */
-    /*1*/ { COLOR_BLUE,    COLOR_WHITE, A_NORMAL}, /* A_BOLD */
+    /*0*/ { DEFAULT_FG,    DEFAULT_BG,	A_NORMAL}, /* A_NORMAL */
+    /*1*/ { COLOR_BLUE,    DEFAULT_BG,	A_NORMAL}, /* A_BOLD */
     /*2*/ { COLOR_YELLOW,  COLOR_BLUE,	A_BOLD},   /* A_REVERSE */
-    /*3*/ { COLOR_GREEN,   COLOR_WHITE, A_NORMAL}, /* A_REVERSE | A_BOLD */
-    /*4*/ { COLOR_MAGENTA, COLOR_WHITE, A_NORMAL}, /* A_UNDERLINE */
-    /*5*/ { COLOR_BLUE,    COLOR_WHITE, A_NORMAL}, /* A_UNDERLINE | A_BOLD */
-    /*6*/ { COLOR_RED,	   COLOR_WHITE, A_NORMAL}, /* A_UNDERLINE | A_REVERSE */
+    /*3*/ { COLOR_GREEN,   DEFAULT_BG,	A_NORMAL}, /* A_REVERSE | A_BOLD */
+    /*4*/ { COLOR_MAGENTA, DEFAULT_BG,	A_NORMAL}, /* A_UNDERLINE */
+    /*5*/ { COLOR_BLUE,    DEFAULT_BG,	A_NORMAL}, /* A_UNDERLINE | A_BOLD */
+    /*6*/ { COLOR_RED,	   DEFAULT_BG,	A_NORMAL}, /* A_UNDERLINE | A_REVERSE */
     /*7*/ { COLOR_MAGENTA, COLOR_CYAN,	A_NORMAL}  /* A_UNDERLINE | A_BOLD | A_REVERSE */
 };
 
@@ -489,7 +489,7 @@ PRIVATE void LYsetWAttr ARGS1(WINDOW *, win)
 	}
 	if (no_color_video < 0)
 		no_color_video = 0;
-#endif /* __DJGPP__ */
+#endif /* !__DJGPP__ and !_WINDOWS */
 
 	if (Current_Attr & A_BOLD)
 		code |= 1;
@@ -714,12 +714,12 @@ PUBLIC void start_curses NOARGS
     SLsmg_Display_Eight_Bit = LYlowest_eightbit[current_char_set];
     if (SLsmg_Display_Eight_Bit > 191)
        SLsmg_Display_Eight_Bit = 191; /* may print ctrl chars otherwise - kw */
-    SLsmg_Newline_Moves = -1;
+    scrollok(0,0);
     SLsmg_Backspace_Moves = 1;
 #ifndef VMS
 #ifndef _WINDOWS
    SLtty_set_suspend_state(1);
-#endif /* _WINDOWS */
+#endif /* !_WINDOWS */
 #ifdef SIGTSTP
     if (!no_suspend)
 	signal(SIGTSTP, sl_suspend);
@@ -750,7 +750,7 @@ PUBLIC void start_curses NOARGS
 		"Terminal initialisation failed - unknown terminal type?\n");
 #ifndef NOSIGHUP
 	    (void) signal(SIGHUP, SIG_DFL);
-#endif /* NOSIGHUP */
+#endif /* !NOSIGHUP */
 	    (void) signal(SIGTERM, SIG_DFL);
 	    (void) signal(SIGINT, SIG_DFL);
 #ifdef SIGTSTP
@@ -791,7 +791,7 @@ PUBLIC void start_curses NOARGS
 		default_fg = DEFAULT_COLOR;
 		default_bg = DEFAULT_COLOR;
 	    }
-#endif
+#endif /* HAVE_USE_DEFAULT_COLORS */
 	}
 #endif /* USE_COLOR_STYLE || USE_COLOR_TABLE */
 
@@ -860,7 +860,7 @@ PUBLIC void lynx_enable_mouse ARGS1(int,state)
      mousemask(0, NULL);
 #else
    if (state) mouse_set(BUTTON1_CLICKED && BUTTON2_CLICKED && BUTTON3_CLICKED);
-#endif /* _WINDOWS */
+#endif /* !_WINDOWS */
 #endif /* NCURSES_MOUSE_VERSION */
 
 #if defined(DJGPP) && !defined(USE_SLANG)
@@ -1105,7 +1105,7 @@ PRIVATE int dumbterm ARGS1(
     int dumb = FALSE;
 
     /*
-     *	Began checking for terminal == NULL in case that TERM environemnt
+     *	Began checking for terminal == NULL in case that TERM environment
      *	variable is not set.  Thanks to Dick Wesseling (ftu@fi.ruu.nl).
      */
     if (terminal == NULL ||
@@ -1149,8 +1149,8 @@ PUBLIC void LYsubAttr ARGS1(
 {
     LYsubWAttr(stdscr, a);
 }
-#endif
-#endif /* USE_COLOR_STYLE */
+#endif /* USE_COLOR_TABLE */
+#endif /* !USE_COLOR_STYLE */
 #endif /* FANCY_CURSES */
 #endif /* VMS */
 
@@ -1285,7 +1285,7 @@ PUBLIC void VMSexit NOARGS
     if (!DidCleanup) {
 	if (LYOutOfMemory == FALSE) {
 	    fprintf(stderr,
-"\nA Fatal error has occured in %s Ver. %s\n", LYNX_NAME, LYNX_VERSION);
+"\nA Fatal error has occurred in %s Ver. %s\n", LYNX_NAME, LYNX_VERSION);
 	    fprintf(stderr,
 "\nPlease notify your system administrator to confirm a bug, and if\n");
 	    fprintf(stderr,
@@ -1669,7 +1669,7 @@ PUBLIC void lynx_force_repaint NOARGS
     bkgd(a | ' ');
 #endif
     attrset(a);
-#endif
+#endif /* COLOR_CURSES */
     clearok(curscr, TRUE);
 }
 
@@ -1727,7 +1727,7 @@ PUBLIC void lynx_stop_link_color ARGS2(
 #if defined(FANCY_CURSES) && defined(COLOR_CURSES)
 	if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON)
 	    stop_underline ();
-#endif /* USE_SLANG */
+#endif /* FANCY_CURSES && COLOR_CURSES */
     } else {
 	stop_bold();
 	/*
diff --git a/src/LYCurses.h b/src/LYCurses.h
index 259f2926..41d04aea 100644
--- a/src/LYCurses.h
+++ b/src/LYCurses.h
@@ -52,6 +52,29 @@
 #undef HZ  /* to prevent parse error :( */
 #endif /* HZ */
 
+/* SunOS 4.x has a redefinition between ioctl.h and termios.h */
+#if defined(sun) && !defined(__SVR4)
+#undef NL0
+#undef NL1
+#undef CR0
+#undef CR1
+#undef CR2
+#undef CR3
+#undef TAB0
+#undef TAB1
+#undef TAB2
+#undef XTABS
+#undef BS0
+#undef BS1
+#undef FF0
+#undef FF1
+#undef ECHO
+#undef NOFLSH
+#undef TOSTOP
+#undef FLUSHO
+#undef PENDIN
+#endif
+
 #ifdef HAVE_CONFIG_H
 # ifdef HAVE_NCURSES_H
 #  include <ncurses.h>
@@ -163,7 +186,7 @@ extern unsigned int Lynx_Color_Flags;
 #ifdef USE_SLANG
 #if !defined(VMS) && !defined(DJGPP)
 #define USE_SLANG_MOUSE		1
-#endif
+#endif /* USE_SLANG */
 
 #define SL_LYNX_USE_COLOR	1
 #define SL_LYNX_USE_BLINK	2
@@ -198,11 +221,18 @@ extern void LY_SLerase NOPARAMS;
 #define standout SLsmg_reverse_video
 #define standend  SLsmg_normal_video
 #define clrtoeol SLsmg_erase_eol
+
+#ifdef SLSMG_NEWLINE_SCROLLS
+#define scrollok(a,b) SLsmg_Newline_Behavior \
+   = ((b) ? SLSMG_NEWLINE_SCROLLS : SLSMG_NEWLINE_MOVES)
+#else
 #define scrollok(a,b) SLsmg_Newline_Moves = ((b) ? 1 : -1)
+#endif
+
 #define addch SLsmg_write_char
 #define echo()
 #define printw SLsmg_printf
- 
+
 extern int curscr;
 extern BOOLEAN FullRefresh;
 #ifdef clearok
@@ -308,11 +338,11 @@ extern int  lynx_chg_color PARAMS((int, int, int));
  *  so we'll use them synonymously for bold and
  *  reverse, and ignore underline. - FM
  */
-#define start_bold()		standout()  
+#define start_bold()		standout()
 #define start_underline()	/* nothing */
 #define start_reverse()		standout()
 #define wstart_reverse(a)	wstandout(a)
-#define stop_bold()		standend()  
+#define stop_bold()		standend()
 #define stop_underline()	/* nothing */
 #define stop_reverse()		standend()
 #define wstop_reverse(a)	wstandend(a)
diff --git a/src/LYDownload.c b/src/LYDownload.c
index 0934266f..bc047b87 100644
--- a/src/LYDownload.c
+++ b/src/LYDownload.c
@@ -40,7 +40,7 @@ PUBLIC BOOLEAN LYDidRename = FALSE;
 PRIVATE char LYValidDownloadFile[256] = "\0";
 
 PUBLIC void LYDownload ARGS1(
-	char *,		line) 
+	char *, 	line)
 {
     char *Line = NULL, *method, *file, *sug_file = NULL;
     int method_number;
@@ -62,65 +62,65 @@ PUBLIC void LYDownload ARGS1(
 #endif /* VMS */
 
     /*
-     *  Make sure we have a valid download
-     *  file comparison string loaded via
-     *  the download options menu. - FM
+     *	Make sure we have a valid download
+     *	file comparison string loaded via
+     *	the download options menu. - FM
      */
     if (LYValidDownloadFile[0] == '\0') {
 	goto failed;
     }
 
     /*
-     *  Make a copy of the LYNXDOWNLOAD
-     *  internal URL for parsing. - FM
+     *	Make a copy of the LYNXDOWNLOAD
+     *	internal URL for parsing. - FM
      */
     StrAllocCopy(Line, line);
 
     /*
-     *  Parse out the sug_file, Method and the File.
+     *	Parse out the sug_file, Method and the File.
      */
     if ((sug_file = (char *)strstr(Line, "SugFile=")) != NULL) {
 	*(sug_file-1) = '\0';
-        /*
+	/*
 	 *  Go past "SugFile=".
 	 */
-        sug_file += 8;
+	sug_file += 8;
     }
 
     if ((file = (char *)strstr(Line, "File=")) == NULL)
 	goto failed;
     *(file-1) = '\0';
     /*
-     *  Go past "File=".
+     *	Go past "File=".
      */
     file += 5;
 
     /*
-     *  Make sure that the file string is the one from
-     *  the last displayed download options menu. - FM
+     *	Make sure that the file string is the one from
+     *	the last displayed download options menu. - FM
      */
     if (strcmp(file, LYValidDownloadFile)) {
-        goto failed;
+	goto failed;
     }
 
 #ifdef DIRED_SUPPORT
     if (!strncmp(file, "file://localhost", 16))
-        file += 16;
+	file += 16;
     else if (!strncmp(file, "file:", 5))
-        file += 5;
+	file += 5;
     HTUnEscape(file);
 #endif /* DIRED_SUPPORT */
 
     if ((method = (char *)strstr(Line, "Method=")) == NULL)
 	goto failed;
     /*
-     *  Go past "Method=".
+     *	Go past "Method=".
      */
     method += 7;
     method_number = atoi(method);
- 
+
     /*
-     *  Set up the sug_filenames recall buffer.
+     *	Set up the sug_filenames recall buffer.
      */
     FnameTotal = (sug_filenames ? HTList_count(sug_filenames) : 0);
     recall = ((FnameTotal >= 1) ? RECALL : NORECALL);
@@ -164,32 +164,32 @@ check_recall:
 		    goto retry;
 		} else if ((cp = (char *)HTList_objectAt(
 						sug_filenames,
-	    					FnameNum)) != NULL) {
+						FnameNum)) != NULL) {
 		    strcpy(buffer, cp);
 		    if (FnameTotal == 1) {
-		        _statusline(EDIT_THE_PREV_FILENAME);
+			_statusline(EDIT_THE_PREV_FILENAME);
 		    } else {
-		        _statusline(EDIT_A_PREV_FILENAME);
+			_statusline(EDIT_A_PREV_FILENAME);
 		    }
 		    goto check_recall;
 		}
 	    } else if (recall && ch == DNARROW) {
-	        if (FirstRecall) {
+		if (FirstRecall) {
 		    FirstRecall = FALSE;
 		    /*
-		     *  Use the first Fname in the list. - FM
+		     *	Use the first Fname in the list. - FM
 		     */
 		    FnameNum = FnameTotal - 1;
 		} else {
 		    /*
-		     *  Advance to the next Fname in the list. - FM
+		     *	Advance to the next Fname in the list. - FM
 		     */
 		    FnameNum--;
 		}
 		if (FnameNum < 0) {
 		    /*
-		     *  Set the FirstRecall flag,
-		     *  and use sug_file or a blank. - FM
+		     *	Set the FirstRecall flag,
+		     *	and use sug_file or a blank. - FM
 		     */
 		    FirstRecall = TRUE;
 		    FnameNum = FnameTotal;
@@ -197,19 +197,19 @@ check_recall:
 		    goto retry;
 		} else if ((cp = (char *)HTList_objectAt(
 						sug_filenames,
-	    					FnameNum)) != NULL) {
+						FnameNum)) != NULL) {
 		    strcpy(buffer, cp);
 		    if (FnameTotal == 1) {
-		        _statusline(EDIT_THE_PREV_FILENAME);
+			_statusline(EDIT_THE_PREV_FILENAME);
 		    } else {
-		        _statusline(EDIT_A_PREV_FILENAME);
+			_statusline(EDIT_A_PREV_FILENAME);
 		    }
 		    goto check_recall;
 		}
 	    }
 
 	    /*
-	     *  Save cancelled.
+	     *	Save cancelled.
 	     */
 	    goto cancelled;
 	}
@@ -245,7 +245,7 @@ check_recall:
 	    *(cp++) = '\0';
 	    strcpy(command, buffer);
 	    if ((len = strlen(command)) > 0 && command[len-1] == '/')
-	        command[len-1] = '\0';
+		command[len-1] = '\0';
 #ifdef DOSPATH
 	    strcat(command, HTDOS_wwwName((char *)Home_Dir()));
 #else
@@ -259,24 +259,24 @@ check_recall:
 	    strcpy(buffer, command);
 	}
 #ifdef VMS
-        if (strchr(buffer, '/') != NULL) {
+	if (strchr(buffer, '/') != NULL) {
 	    strcpy(command, HTVMS_name("", buffer));
 	    strcpy(buffer, command);
 	}
 	if (buffer[0] != '/' && strchr(buffer, ':') == NULL) {
 	    strcpy(command, "sys$disk:");
 	    if (strchr(buffer, ']') == NULL)
-	        strcat(command, "[]");
+		strcat(command, "[]");
 	    strcat(command, buffer);
 	    strcpy(buffer, command);
 	}
 #else
-        if (*buffer != '/')
+	if (*buffer != '/')
 	    cp = getenv("PWD");
 	else
 	    cp = NULL;
 	if (cp) {
-            sprintf(command, "%s/%s", cp, buffer);
+	    sprintf(command, "%s/%s", cp, buffer);
 #ifdef DOSPATH
 	    strcpy(buffer, HTDOS_name(command));
 #else
@@ -292,16 +292,16 @@ check_recall:
 	    fclose(fp);
 
 #ifdef VMS
-            _statusline(FILE_EXISTS_HPROMPT);
+	    _statusline(FILE_EXISTS_HPROMPT);
 #else
-            _statusline(FILE_EXISTS_OPROMPT);
+	    _statusline(FILE_EXISTS_OPROMPT);
 #endif /* VMS */
 	    c = 0;
 	    while(TOUPPER(c)!='Y' && TOUPPER(c)!='N' && c != 7 && c != 3)
- 	        c = LYgetch();
+		c = LYgetch();
 #ifdef VMS
 	    if (HadVMSInterrupt) {
-	        HadVMSInterrupt = FALSE;
+		HadVMSInterrupt = FALSE;
 		FREE(Line);
 		return;
 	    }
@@ -344,13 +344,13 @@ check_recall:
 	    fprintf(stderr, "command: rename(%s, %s)\n", file, buffer);
 	if (rename(file, buffer)) {
 	    /*
-	     *  Failed.  Use spawned COPY_COMMAND. - FM
+	     *	Failed.  Use spawned COPY_COMMAND. - FM
 	     */
 	    if (TRACE)
-	        fprintf(stderr, "         FAILED!\n");
+		fprintf(stderr, "         FAILED!\n");
 	    sprintf(command, COPY_COMMAND, file, buffer);
 	    if (TRACE)
-	        fprintf(stderr, "command: %s\n", command);
+		fprintf(stderr, "command: %s\n", command);
 	    fflush(stderr);
 	    fflush(stdout);
 	    stop_curses();
@@ -360,9 +360,9 @@ check_recall:
 	    start_curses();
 	} else {
 	    /*
-	     *  We don't have the temporary file (it was renamed to
-	     *  a permanent file), so set a flag to pop out of the
-	     *  download menu. - FM
+	     *	We don't have the temporary file (it was renamed to
+	     *	a permanent file), so set a flag to pop out of the
+	     *	download menu. - FM
 	     */
 	    LYDidRename = TRUE;
 	}
@@ -378,13 +378,13 @@ check_recall:
 	FREE(cp1);
 	if (TRACE)
 	    fprintf(stderr, "command: %s\n", command);
-        fflush(stderr);
-        fflush(stdout);
-        stop_curses();
+	fflush(stderr);
+	fflush(stdout);
+	stop_curses();
 	system(command);
-        fflush(stdout);
+	fflush(stdout);
 	fflush(stderr);
-        start_curses();
+	start_curses();
 #if defined(UNIX)
 	LYRelaxFilePermissions(buffer);
 #endif /* defined(UNIX) */
@@ -395,19 +395,19 @@ check_recall:
 	 *  Use configured download commands.
 	 */
 	buffer[0] = '\0';
-        for (count = 0, download_command=downloaders;
+	for (count = 0, download_command=downloaders;
 	     count < method_number;
-       	     count++, download_command = download_command->next)
+	     count++, download_command = download_command->next)
 	    ; /* null body */
 
 	/*
 	 *  Commands have the form "command %s [etc]"
 	 *  where %s is the filename.
 	 */
-        if (download_command->command != NULL) {
+	if (download_command->command != NULL) {
 	    /*
-	     *  Check for two '%s' and ask for the local filename if
-	     *  there is.
+	     *	Check for two '%s' and ask for the local filename if
+	     *	there is.
 	     */
 	    char *first_s = strstr(download_command->command, "%s");
 	    if (first_s && strstr(first_s+1, "%s")) {
@@ -418,26 +418,26 @@ check_recall:
 		    *buffer = '\0';
 	check_again:
 		if ((ch = LYgetstr(buffer, VISIBLE,
-		    		   sizeof(buffer), recall)) < 0 ||
-	    	    *buffer == '\0' || ch == UPARROW || ch == DNARROW) {
+				   sizeof(buffer), recall)) < 0 ||
+		    *buffer == '\0' || ch == UPARROW || ch == DNARROW) {
 		    if (recall && ch == UPARROW) {
 			if (FirstRecall) {
 			    FirstRecall = FALSE;
 			    /*
-			     *  Use the last Fname in the list. - FM
+			     *	Use the last Fname in the list. - FM
 			     */
 			    FnameNum = 0;
 			} else {
 			    /*
-			     *  Go back to the previous Fname
-			     *  in the list. - FM
+			     *	Go back to the previous Fname
+			     *	in the list. - FM
 			     */
 			    FnameNum++;
 			}
 			if (FnameNum >= FnameTotal) {
 			    /*
-			     *  Reset the FirstRecall flag,
-			     *  and use sug_file or a blank. - FM
+			     *	Reset the FirstRecall flag,
+			     *	and use sug_file or a blank. - FM
 			     */
 			    FirstRecall = TRUE;
 			    FnameNum = FnameTotal;
@@ -445,7 +445,7 @@ check_recall:
 			    goto again;
 			} else if ((cp = (char *)HTList_objectAt(
 							sug_filenames,
-	    						FnameNum)) != NULL) {
+							FnameNum)) != NULL) {
 			    strcpy(buffer, cp);
 			    if (FnameTotal == 1) {
 				_statusline(EDIT_THE_PREV_FILENAME);
@@ -458,19 +458,19 @@ check_recall:
 			if (FirstRecall) {
 			    FirstRecall = FALSE;
 			    /*
-			     *  Use the first Fname in the list. - FM
+			     *	Use the first Fname in the list. - FM
 			     */
 			    FnameNum = FnameTotal - 1;
 			} else {
 			    /*
-			     *  Advance to the next Fname in the list. - FM
+			     *	Advance to the next Fname in the list. - FM
 			     */
 			    FnameNum--;
 			}
 			if (FnameNum < 0) {
 			    /*
-			     *  Set the FirstRecall flag,
-			     *  and use sug_file or a blank. - FM
+			     *	Set the FirstRecall flag,
+			     *	and use sug_file or a blank. - FM
 			     */
 			    FirstRecall = TRUE;
 			    FnameNum = FnameTotal;
@@ -478,7 +478,7 @@ check_recall:
 			    goto again;
 			} else if ((cp = (char *)HTList_objectAt(
 							sug_filenames,
-	    						FnameNum)) != NULL) {
+							FnameNum)) != NULL) {
 			    strcpy(buffer, cp);
 			    if (FnameTotal == 1) {
 				_statusline(EDIT_THE_PREV_FILENAME);
@@ -495,18 +495,18 @@ check_recall:
 		    goto cancelled;
 		}
 
-	        if (no_dotfiles || !show_dotfiles) {
+		if (no_dotfiles || !show_dotfiles) {
 		    if (*buffer == '.' ||
 #ifdef VMS
 		       ((cp = strrchr(buffer, ':')) && *(cp+1) == '.') ||
 		       ((cp = strrchr(buffer, ']')) && *(cp+1) == '.') ||
 #endif /* VMS */
 		       ((cp = strrchr(buffer, '/')) && *(cp+1) == '.')) {
-		        HTAlert(FILENAME_CANNOT_BE_DOT);
+			HTAlert(FILENAME_CANNOT_BE_DOT);
 			_statusline(NEW_FILENAME_PROMPT);
-		        goto again;
+			goto again;
 		    }
-	        }
+		}
 		/*
 		 *  Cancel if the user entered "/dev/null" on Unix,
 		 *  or an "nl:" path (case-insensitive) on VMS. - FM
@@ -524,52 +524,52 @@ check_recall:
 	    }
 
 	    /*
-	     *  The following is considered a bug by the community.
-	     *  If the command only takes one argument on the command
-	     *  line, then the suggested file name is not used.
-	     *  It actually is not a bug at all and does as it should,
-	     *  putting both names on the command line.
+	     *	The following is considered a bug by the community.
+	     *	If the command only takes one argument on the command
+	     *	line, then the suggested file name is not used.
+	     *	It actually is not a bug at all and does as it should,
+	     *	putting both names on the command line.
 	     */
 #ifdef VMS
-   	    sprintf(command, download_command->command, file, buffer,
+	    sprintf(command, download_command->command, file, buffer,
 			     "", "", "", "", "", "", "", "", "", "");
 #else /* Unix: */
 	    /*
-	     *  Prevent spoofing of the shell.
+	     *	Prevent spoofing of the shell.
 	     */
 	    cp = quote_pathname(file);
 	    cp1 = quote_pathname(buffer);
-   	    sprintf(command, download_command->command, cp, cp1,
+	    sprintf(command, download_command->command, cp, cp1,
 			     "", "", "", "", "", "", "", "", "", "");
 	    FREE(cp);
 	    FREE(cp1);
 #endif /* VMS */
 
-        } else {
-            _statusline(MISCONF_DOWNLOAD_COMMAND);
+	} else {
+	    _statusline(MISCONF_DOWNLOAD_COMMAND);
 	    sleep(AlertSecs);
 	    goto failed;
-        }
+	}
 
-        if (TRACE)
-            fprintf(stderr, "command: %s\n", command);
-        stop_curses();
+	if (TRACE)
+	    fprintf(stderr, "command: %s\n", command);
+	stop_curses();
 	fflush(stderr);
 	fflush(stdout);
-        system(command);
-        fflush(stderr);
+	system(command);
+	fflush(stderr);
 	fflush(stdout);
-        start_curses();
-        /* don't remove(file); */
+	start_curses();
+	/* don't remove(file); */
     }
 
     if (SecondS == TRUE) {
 #ifdef VMS
-        if (0 == strncasecomp(buffer, "sys$disk:", 9)) {
+	if (0 == strncasecomp(buffer, "sys$disk:", 9)) {
 	    if (0 == strncmp((buffer+9), "[]", 2)) {
-	        HTAddSugFilename(buffer+11);
-	    } else { 
-	        HTAddSugFilename(buffer+9);
+		HTAddSugFilename(buffer+11);
+	    } else {
+		HTAddSugFilename(buffer+9);
 	    }
 	} else {
 	    HTAddSugFilename(buffer);
@@ -592,7 +592,7 @@ cancelled:
     sleep(InfoSecs);
     FREE(Line);
     return;
-}	
+}
 
 /*
  *  LYdownload_options writes out the current download choices to
@@ -602,7 +602,7 @@ cancelled:
  */
 PUBLIC int LYdownload_options ARGS2(
 	char **,	newfile,
-	char *,		data_file)
+	char *, 	data_file)
 {
     static char tempfile[256];
     static BOOLEAN first = TRUE;
@@ -613,7 +613,7 @@ PUBLIC int LYdownload_options ARGS2(
     int count;
 
     if (first) {
-        tempname(tempfile, NEW_FILE);
+	tempname(tempfile, NEW_FILE);
 	first = FALSE;
 #if defined (VMS) || defined (DOSPATH)
     sprintf(download_filename, "file://localhost/%s", tempfile);
@@ -622,12 +622,12 @@ PUBLIC int LYdownload_options ARGS2(
 #endif /* VMS */
 #ifdef VMS
     } else {
-        remove(tempfile);   /* Remove duplicates on VMS. */
+	remove(tempfile);   /* Remove duplicates on VMS. */
 #endif /* VMS */
     }
 
     /*
-     *  Get a suggested filename.
+     *	Get a suggested filename.
      */
     StrAllocCopy(sug_filename, *newfile);
     change_sug_filename(sug_filename);
@@ -644,23 +644,23 @@ PUBLIC int LYdownload_options ARGS2(
     LYforce_no_cache = TRUE;  /* don't cache this doc */
 
     fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n",
-    		 DOWNLOAD_OPTIONS_TITLE);
+		 DOWNLOAD_OPTIONS_TITLE);
 
-    fprintf(fp0,"<h1>Download Options (%s Version %s)</h1>\n",
-    				       LYNX_NAME, LYNX_VERSION);
+    fprintf(fp0,"<h1>Download Options (%s Version %s)</h1><pre>\n",
+				       LYNX_NAME, LYNX_VERSION);
 
 
-    fputs("You have the following download choices.<br>\n", fp0);
-    fputs("Please select one:<br>\n<pre>\n", fp0);
+    fprintf(fp0, "   You have the following download choices.\n");
+    fprintf(fp0, "   Please select one:\n\n");
 
     if(!no_disk_save && !child_lynx)
 #ifdef DIRED_SUPPORT
 	/*
 	 *  Disable save to disk option for local files.
 	 */
-	if (!lynx_edit_mode) 
+	if (!lynx_edit_mode)
 #endif /* DIRED_SUPPORT */
-            fprintf(fp0,"   \
+	    fprintf(fp0,"   \
 <a href=\"LYNXDOWNLOAD://Method=-1/File=%s/SugFile=%s%s\">Save to disk</a>\n",
 	   data_file, (lynx_save_space ? lynx_save_space : ""), sug_filename);
 #ifdef DIRED_SUPPORT
@@ -670,13 +670,13 @@ PUBLIC int LYdownload_options ARGS2(
 	fprintf(fp0,"   Save to disk disabled.\n");
 
     if (downloaders != NULL) {
-        for (count = 0, cur_download = downloaders; cur_download != NULL; 
+	for (count = 0, cur_download = downloaders; cur_download != NULL;
 			cur_download = cur_download->next, count++) {
 	    if (!no_download || cur_download->always_enabled) {
-	        fprintf(fp0,"   \
-<a href=\"LYNXDOWNLOAD://Method=%d/File=%s/SugFile=%s\">", 
+		fprintf(fp0,"   \
+<a href=\"LYNXDOWNLOAD://Method=%d/File=%s/SugFile=%s\">",
 				count,data_file, sug_filename);
-		fprintf(fp0, (cur_download->name ? 
+		fprintf(fp0, (cur_download->name ?
 				cur_download->name : "No Name Given"));
 		fprintf(fp0,"</a>\n");
 	    }
@@ -690,7 +690,7 @@ an unlimited number of download methods using the lynx.cfg file.\n");
     fclose(fp0);
 
     /*
-     *  Free off temp copy.
+     *	Free off temp copy.
      */
     FREE(sug_filename);
 
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index 7b672158..bd70042b 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -552,7 +552,7 @@ PRIVATE void print_binding ARGS3(HTStream *, target, char *, buf, int, i)
 }
 
 PRIVATE int LYLoadKeymap ARGS4 (
-	CONST char *, 		arg,
+	CONST char *, 		arg GCC_UNUSED,
 	HTParentAnchor *,	anAnchor,
 	HTFormat,		format_out,
 	HTStream*,		sink)
@@ -589,7 +589,7 @@ PRIVATE int LYLoadKeymap ARGS4 (
 			  i-' ');  /* uppercase mapping is different */
 	}
     }
-    for (i = 1; i < sizeof(keymap); i++) {
+    for (i = 1; i < (int) sizeof(keymap); i++) {
 	/*
 	 *  LYK_PIPE not implemented yet.
 	 */
@@ -796,6 +796,7 @@ PUBLIC BOOL LYisNonAlnumKeyname ARGS2(
     return(keymap[ch+1] == key_name);
 }
 
+#ifdef NOTUSED_FOTEMODS
 /*
  *  This function returns the (int)ch mapped to the
  *  LYK_foo value passed to it as an argument. - FM
@@ -813,3 +814,4 @@ PUBLIC int LYReverseKeymap ARGS1(
 
     return(0);
 }
+#endif
diff --git a/src/LYLocal.c b/src/LYLocal.c
index c17c9a9a..87139561 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -87,7 +87,7 @@ PUBLIC char LYDiredFileURL[256] = "\0";
 PRIVATE char *filename PARAMS((
 	char *		prompt,
 	char *		buf,
-	int		bufsize));
+	size_t		bufsize));
 
 #ifdef OK_PERMIT
 PRIVATE BOOLEAN permit_location PARAMS((
@@ -1896,7 +1896,7 @@ PUBLIC int dired_options ARGS2(
 PRIVATE char *filename ARGS3(
 	char *, 	prompt,
 	char *, 	buf,
-	int,		bufsize)
+	size_t,		bufsize)
 {
     char *cp;
 
diff --git a/src/LYMail.c b/src/LYMail.c
index b27cbade..b7acce45 100644
--- a/src/LYMail.c
+++ b/src/LYMail.c
@@ -1887,7 +1887,7 @@ cleandown:
     return;
 }
 
-PRIVATE void terminate_letter ARGS1(int,sig)
+PRIVATE void terminate_letter ARGS1(int,sig GCC_UNUSED)
 {
     term_letter = TRUE;
     /* Reassert the AST */
diff --git a/src/LYMain.c b/src/LYMain.c
index 1af4cfd4..2e600b1e 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -94,7 +94,7 @@ PUBLIC char *finger_proxy_putenv_cmd = NULL; /* lynx.cfg defined finger_proxy */
 PUBLIC char *no_proxy_putenv_cmd = NULL;     /* lynx.cfg defined no_proxy */
 PUBLIC char *list_format=NULL;		/* LONG_LIST formatting mask */
 #ifdef SYSLOG_REQUESTED_URLS
-PUBLIC char *syslog_txt = NULL;		/* syslog arb text for session */
+PUBLIC char *syslog_txt = NULL; 	/* syslog arb text for session */
 #endif /* SYSLOG_REQUESTED_URLS */
 #endif /* !VMS */
 
@@ -162,12 +162,12 @@ PUBLIC lynx_html_item_type *uploaders = NULL;
 PUBLIC int port_syntax = 1;
 PUBLIC int LYShowColor = SHOW_COLOR_UNKNOWN; /* to show or not to show */
 PUBLIC int LYChosenShowColor = SHOW_COLOR_UNKNOWN; /* whether to show and save */
-PUBLIC int LYrcShowColor = SHOW_COLOR_UNKNOWN;  /* ... as last read or written */
+PUBLIC int LYrcShowColor = SHOW_COLOR_UNKNOWN;	/* ... as last read or written */
 PUBLIC BOOLEAN LYShowCursor = SHOW_CURSOR; /* to show or not to show */
 PUBLIC BOOLEAN LYUseDefShoCur = TRUE;	/* Command line -show_cursor toggle */
 PUBLIC BOOLEAN LYforce_no_cache = FALSE;
 PUBLIC BOOLEAN LYoverride_no_cache = FALSE;/*override no-cache b/c history etc*/
-PUBLIC BOOLEAN LYinternal_flag = FALSE;	/* override no-cache b/c internal link*/
+PUBLIC BOOLEAN LYinternal_flag = FALSE; /* override no-cache b/c internal link*/
 PUBLIC BOOLEAN LYresubmit_posts = ALWAYS_RESUBMIT_POSTS;
 PUBLIC BOOLEAN LYUserSpecifiedURL = TRUE;/* always TRUE  the first time */
 PUBLIC BOOLEAN LYJumpFileURL = FALSE;	 /* always FALSE the first time */
@@ -262,7 +262,7 @@ PUBLIC BOOLEAN LYforce_HTML_mode = FALSE;
 PUBLIC char *homepage = NULL;	/* home page or main screen */
 PUBLIC char *editor = NULL;	/* the name of the current editor */
 PUBLIC char *jumpfile = NULL;	/* the name of the default jumps file */
-PUBLIC char *jumpprompt = NULL;	/* the default jumps prompt */
+PUBLIC char *jumpprompt = NULL; /* the default jumps prompt */
 PUBLIC char *bookmark_page = NULL; /* the name of the default bookmark page */
 PUBLIC char *BookmarkPage = NULL;  /* the name of the current bookmark page */
 PUBLIC char *LynxHome = NULL;	/* the default Home HREF. */
@@ -284,11 +284,11 @@ PUBLIC char *language = NULL;	    /* preferred language */
 PUBLIC char *pref_charset = NULL;   /* preferred character set */
 PUBLIC BOOLEAN LYNewsPosting = NEWS_POSTING; /* News posting supported? */
 PUBLIC char *LynxSigFile = NULL;    /* Signature file, in or off home */
-PUBLIC char *system_mail = NULL;          /* The path for sending mail */
-PUBLIC char *system_mail_flags = NULL;    /* Flags for sending mail */
+PUBLIC char *system_mail = NULL;	  /* The path for sending mail */
+PUBLIC char *system_mail_flags = NULL;	  /* Flags for sending mail */
 PUBLIC char *lynx_temp_space = NULL; /* The prefix for temporary file paths */
 PUBLIC char *lynx_save_space = NULL; /* The prefix for save to disk paths */
-PUBLIC char *LYHostName = NULL;		/* treat as a local host name */
+PUBLIC char *LYHostName = NULL; 	/* treat as a local host name */
 PUBLIC char *LYLocalDomain = NULL;	/* treat as a local domain tail */
 PUBLIC BOOLEAN clickable_images = MAKE_LINKS_FOR_ALL_IMAGES;
 PUBLIC BOOLEAN pseudo_inline_alts = MAKE_PSEUDO_ALTS_FOR_INLINES;
@@ -326,15 +326,15 @@ PUBLIC int nlinks = 0;		/* number of links in memory */
 PUBLIC int nhist = 0;		/* number of history entries */
 PUBLIC int more = FALSE;	/* is there more text to display? */
 PUBLIC int InfoSecs;	/* Seconds to sleep() for Information messages */
-PUBLIC int MessageSecs;	/* Seconds to sleep() for important Messages   */
+PUBLIC int MessageSecs; /* Seconds to sleep() for important Messages   */
 PUBLIC int AlertSecs;	/* Seconds to sleep() for HTAlert() messages   */
 PUBLIC BOOLEAN bookmark_start = FALSE;
-PUBLIC char *LYUserAgent = NULL;	/* Lynx User-Agent header          */
-PUBLIC char *LYUserAgentDefault = NULL;	/* Lynx default User-Agent header  */
+PUBLIC char *LYUserAgent = NULL;	/* Lynx User-Agent header	   */
+PUBLIC char *LYUserAgentDefault = NULL; /* Lynx default User-Agent header  */
 PUBLIC BOOLEAN LYUseMouse = FALSE;
-PUBLIC BOOLEAN LYNoRefererHeader=FALSE;	/* Never send Referer header?      */
+PUBLIC BOOLEAN LYNoRefererHeader=FALSE; /* Never send Referer header?	   */
 PUBLIC BOOLEAN LYNoRefererForThis=FALSE;/* No Referer header for this URL? */
-PUBLIC BOOLEAN LYNoFromHeader = TRUE;	/* Never send From header?         */
+PUBLIC BOOLEAN LYNoFromHeader = TRUE;	/* Never send From header?	   */
 PUBLIC BOOLEAN LYListNewsNumbers = LIST_NEWS_NUMBERS;
 PUBLIC BOOLEAN LYListNewsDates = LIST_NEWS_DATES;
 PUBLIC BOOLEAN LYisConfiguredForX = FALSE;
@@ -371,8 +371,8 @@ PUBLIC BOOLEAN LYQuitDefaultYes = QUIT_DEFAULT_YES;
 
 /* These are declared in cutil.h for current freeWAIS libraries. - FM */
 #ifdef DECLARE_WAIS_LOGFILES
-PUBLIC char *log_file_name = NULL; /* for WAIS log file name    in libWWW */
-PUBLIC FILE *logfile = NULL;	   /* for WAIS log file output  in libWWW */
+PUBLIC char *log_file_name = NULL; /* for WAIS log file name	in libWWW */
+PUBLIC FILE *logfile = NULL;	   /* for WAIS log file output	in libWWW */
 #endif /* DECLARE_WAIS_LOGFILES */
 
 extern int HTNewsChunkSize; /* Number of news articles per chunk (HTNews.c) */
@@ -395,9 +395,9 @@ PRIVATE void FatalProblem PARAMS((int sig));
 #if defined(USE_HASH)
     char *lynx_lss_file=NULL;
 #endif
-    
+
 #ifdef __DJGPP__
-void  reset_break() 
+void  reset_break()
 {
     PDC_set_ctrl_break(init_ctrl_break[0]);
 }
@@ -576,7 +576,7 @@ else {init_ctrl_break[0] = 1;}
 
     LYShowColor = (SHOW_COLOR ? SHOW_COLOR_ON : SHOW_COLOR_OFF);
     /*
-     *  Set up the argument list.
+     *	Set up the argument list.
      */
     pgm = argv[0];
     if ((cp = strrchr(pgm, '/')) != NULL) {
@@ -584,7 +584,7 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Act on -help NOW, so we only output the help and exit. - FM
+     *	Act on -help NOW, so we only output the help and exit. - FM
      */
     for (i = 1; i < argc; i++) {
 	if (strncmp(argv[i], "-help", 5) == 0) {
@@ -600,35 +600,35 @@ else {init_ctrl_break[0] = 1;}
     atexit(LYLeaks);
 #endif /* LY_FIND_LEAKS */
     /*
-     *  Register the function which will free our allocated globals.
+     *	Register the function which will free our allocated globals.
      */
     atexit(free_lynx_globals);
 
 #ifdef LOCALE
     /*
-     *  LOCALE support for international characters.
+     *	LOCALE support for international characters.
      */
     setlocale(LC_ALL, "");
 #endif /* LOCALE */
 
     /*
-     *  Initialize our startup and global variables.
+     *	Initialize our startup and global variables.
      */
 #ifdef ULTRIX
     /*
-     *  Need this for Ultrix.
+     *	Need this for Ultrix.
      */
     terminal = getenv("TERM");
     if ((terminal == NULL) || !strncasecomp(terminal, "xterm", 5))
 	terminal = "vt100";
 #endif /* ULTRIX */
     /*
-     *  Zero the links and history struct arrays.
+     *	Zero the links and history struct arrays.
      */
     memset((void *)links, 0, sizeof(linkstruct)*MAXLINKS);
     memset((void *)history, 0, sizeof(histstruct)*MAXHIST);
     /*
-     *  Zero the MultiBookmark arrays.
+     *	Zero the MultiBookmark arrays.
      */
     memset((void *)MBM_A_subbookmark, 0, sizeof(char)*(MBM_V_MAXFILES+1));
     memset((void *)MBM_A_subdescript, 0, sizeof(char)*(MBM_V_MAXFILES+1));
@@ -638,9 +638,9 @@ else {init_ctrl_break[0] = 1;}
 #endif /* SYSLOG_REQUESTED_URLS */
     StrAllocCopy(list_format, LIST_FORMAT);
 #endif /* !VMS */
-    InfoSecs    = (int)INFOSECS;
+    InfoSecs	= (int)INFOSECS;
     MessageSecs = (int)MESSAGESECS;
-    AlertSecs   = (int)ALERTSECS;
+    AlertSecs	= (int)ALERTSECS;
     StrAllocCopy(helpfile, HELPFILE);
     StrAllocCopy(startfile, STARTFILE);
     LYTrimHead(startfile);
@@ -770,7 +770,7 @@ else {init_ctrl_break[0] = 1;}
     StrAllocCopy(URLDomainSuffixes, URL_DOMAIN_SUFFIXES);
     StrAllocCopy(XLoadImageCommand, XLOADIMAGE_COMMAND);
     /*
-     *  Set up the compilation default character set. - FM
+     *	Set up the compilation default character set. - FM
      */
     for (i = 0; LYchar_set_names[i]; i++) {
 	if (!strncmp(CHARACTER_SET, LYchar_set_names[i],
@@ -784,19 +784,19 @@ else {init_ctrl_break[0] = 1;}
     HTMLSetRawModeDefault(i);
 
     /*
-     *  Disable news posting if the compilation-based
-     *  LYNewsPosting value is FALSE.  This may be changed
-     *  further down via lynx.cfg or the -restriction
-     *  command line switch. - FM
+     *	Disable news posting if the compilation-based
+     *	LYNewsPosting value is FALSE.  This may be changed
+     *	further down via lynx.cfg or the -restriction
+     *	command line switch. - FM
      */
     no_newspost = (LYNewsPosting == FALSE);
 
     /*
-     *  Set up trace, the anonymous account defaults,
-     *  validate restrictions, and/or the nosocks flag,
-     *  if requested, and an alternate configuration
-     *  file, if specified, NOW.  Also, if we only want
-     *  the help menu, output that and exit. - FM
+     *	Set up trace, the anonymous account defaults,
+     *	validate restrictions, and/or the nosocks flag,
+     *	if requested, and an alternate configuration
+     *	file, if specified, NOW.  Also, if we only want
+     *	the help menu, output that and exit. - FM
      */
     for (i = 1; i < argc; i++) {
 	if (strncmp(argv[i], "-trace", 6) == 0) {
@@ -813,7 +813,7 @@ else {init_ctrl_break[0] = 1;}
 	    anon_restrictions_set = TRUE;
 	} else if (strcmp(argv[i], "-validate") == 0) {
 	    /*
-	     *  Follow only http URLs.
+	     *	Follow only http URLs.
 	     */
 	    LYValidate = TRUE;
 #ifdef SOCKS
@@ -844,19 +844,19 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  If we have a lone "-" switch for getting arguments from stdin,
-     *  get them NOW, and act on the relevant ones, saving the others
-     *  into an HTList for handling after the other initializations.
-     *  The primary purpose of this feature is to allow for the
-     *  potentially very long command line that can be associated with
-     *  post or get data.  The original implementation required that
-     *  the lone "-" be the only command line argument, but that
-     *  precluded its use when the lynx command is aliased with other
-     *  arguments.  When interactive, the stdin input is terminated by
-     *  by Control-D on Unix or Control-Z on VMS, and each argument
-     *  is terminated by a RETURN.  When the argument is -get_data or
-     *  -post_data, the data are terminate by a "___" string, alone
-     *  on the line (also terminated by RETURN). - FM
+     *	If we have a lone "-" switch for getting arguments from stdin,
+     *	get them NOW, and act on the relevant ones, saving the others
+     *	into an HTList for handling after the other initializations.
+     *	The primary purpose of this feature is to allow for the
+     *	potentially very long command line that can be associated with
+     *	post or get data.  The original implementation required that
+     *	the lone "-" be the only command line argument, but that
+     *	precluded its use when the lynx command is aliased with other
+     *	arguments.  When interactive, the stdin input is terminated by
+     *	by Control-D on Unix or Control-Z on VMS, and each argument
+     *	is terminated by a RETURN.  When the argument is -get_data or
+     *	-post_data, the data are terminate by a "___" string, alone
+     *	on the line (also terminated by RETURN). - FM
      */
     for (i = 1; i < argc; i++) {
 	if (strcmp(argv[i], "-") == 0) {
@@ -955,7 +955,7 @@ else {init_ctrl_break[0] = 1;}
 		    int j2;
 
 		    /*
-		     *  Strip line terminators.
+		     *	Strip line terminators.
 		     */
 		    for (j2 = strlen(buf) - 1; j2 >= 0 &&
 			 (buf[j2] == CR || buf[j2] == LF); j2--) {
@@ -985,7 +985,7 @@ else {init_ctrl_break[0] = 1;}
 		post_data = &form_post_data;
 
 		/*
-		 *  Build post data for later.  Stop reading when we see
+		 *  Build post data for later.	Stop reading when we see
 		 *  a line with "---" as its first three characters.
 		 */
 		while (fgets(buf, sizeof(buf), stdin) &&
@@ -1020,8 +1020,8 @@ else {init_ctrl_break[0] = 1;}
 #endif /* SOCKS */
 
     /*
-     *  If we had -validate set all of the restrictions
-     *  and disallow a TRACE log NOW. - FM
+     *	If we had -validate set all of the restrictions
+     *	and disallow a TRACE log NOW. - FM
      */
     if (LYValidate == TRUE) {
 	parse_restrictions("all");
@@ -1029,10 +1029,10 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  If we didn't get and act on a -validate or -anonymous
-     *  switch, but can verify that this is the anonymous account,
-     *  set the default restrictions for that account and disallow
-     *  a TRACE log NOW. - FM
+     *	If we didn't get and act on a -validate or -anonymous
+     *	switch, but can verify that this is the anonymous account,
+     *	set the default restrictions for that account and disallow
+     *	a TRACE log NOW. - FM
      */
     if (!LYValidate && !anon_restrictions_set &&
 	strlen((char *)ANONYMOUS_USER) > 0 &&
@@ -1052,7 +1052,7 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Set up the TRACE log path, and logging if appropriate. - FM
+     *	Set up the TRACE log path, and logging if appropriate. - FM
      */
 #ifdef VMS
     StrAllocCopy(LYTraceLogPath, "sys$login:Lynx.trace");
@@ -1090,15 +1090,15 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  If TRACE is on, indicate whether the
-     *  anonymous restrictions are set. - FM
+     *	If TRACE is on, indicate whether the
+     *	anonymous restrictions are set. - FM
      */
     if (TRACE && anon_restrictions_set) {
 	fprintf(stderr, "LYMain: Anonymous restrictions set.\n");
     }
 
     /*
-     *  Set up the default jump file stuff. - FM
+     *	Set up the default jump file stuff. - FM
      */
     StrAllocCopy(jumpprompt, JUMP_PROMPT);
 #ifdef JUMPFILE
@@ -1119,8 +1119,8 @@ else {init_ctrl_break[0] = 1;}
 #endif /* JUMPFILE */
 
     /*
-     *  If no alternate configuration file was specified on
-     *  the command line, see if it's in the environment.
+     *	If no alternate configuration file was specified on
+     *	the command line, see if it's in the environment.
      */
     if (!lynx_cfg_file) {
 	if (((cp=getenv("LYNX_CFG")) != NULL) ||
@@ -1129,14 +1129,14 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  If we still don't have a configuration file,
-     *  use the userdefs.h definition.
+     *	If we still don't have a configuration file,
+     *	use the userdefs.h definition.
      */
     if (!lynx_cfg_file)
 	StrAllocCopy(lynx_cfg_file, LYNX_CFG_FILE);
 
     /*
-     *  Convert a '~' in the configuration file path to $HOME.
+     *	Convert a '~' in the configuration file path to $HOME.
      */
 #ifndef _WINDOWS /* avoid the whole ~ thing for now */
    /* I think this should only be performed if lynx_cfg_file starts with ~/ */
@@ -1154,8 +1154,8 @@ else {init_ctrl_break[0] = 1;}
 #endif
 
     /*
-     *  If the configuration file is not available,
-     *  inform the user and exit.
+     *	If the configuration file is not available,
+     *	inform the user and exit.
      */
     if ((fp = fopen(lynx_cfg_file, "r")) == NULL) {
 	fprintf(stderr, "\nConfiguration file %s is not available.\n\n",
@@ -1166,7 +1166,7 @@ else {init_ctrl_break[0] = 1;}
 
     /*
      * Make sure we have the character sets declared.
-     *  This will initialize the CHARTRANS handling. - KW
+     *	This will initialize the CHARTRANS handling. - KW
      */
     if (!LYCharSetsDeclared()) {
 	fprintf(stderr, "\nLynx character sets not declared.\n\n");
@@ -1175,8 +1175,8 @@ else {init_ctrl_break[0] = 1;}
 
 #if defined(USE_HASH)
     /*
-     *  If no alternate lynx-style file was specified on
-     *  the command line, see if it's in the environment.
+     *	If no alternate lynx-style file was specified on
+     *	the command line, see if it's in the environment.
      */
     if (!lynx_lss_file) {
 	if (((cp=getenv("LYNX_LSS")) != NULL) ||
@@ -1185,14 +1185,14 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  If we still don't have a lynx-style file,
-     *  use the userdefs.h definition.
+     *	If we still don't have a lynx-style file,
+     *	use the userdefs.h definition.
      */
     if (!lynx_lss_file)
 	StrAllocCopy(lynx_lss_file, LYNX_LSS_FILE);
 
     /*
-     *  Convert a '~' in the lynx-style file path to $HOME.
+     *	Convert a '~' in the lynx-style file path to $HOME.
      */
     if ((cp = strchr(lynx_lss_file, '~'))) {
 	*(cp++) = '\0';
@@ -1209,8 +1209,8 @@ else {init_ctrl_break[0] = 1;}
 	FREE(temp);
     }
     /*
-     *  If the lynx-style file is not available,
-     *  inform the user and exit.
+     *	If the lynx-style file is not available,
+     *	inform the user and exit.
      */
     if ((fp = fopen(lynx_lss_file, "r")) == NULL) {
 	fprintf(stderr, "\nLynxile file %s is not available.\n\n",
@@ -1224,7 +1224,7 @@ else {init_ctrl_break[0] = 1;}
 #endif
 
     /*
-     *  Make sure we have the edit map declared. - FM
+     *	Make sure we have the edit map declared. - FM
      */
     if (!LYEditmapDeclared()) {
 	fprintf(stderr, "\nLynx edit map not declared.\n\n");
@@ -1233,13 +1233,13 @@ else {init_ctrl_break[0] = 1;}
 
 #if USE_COLOR_TABLE
     /*
-     *  Set up default foreground and background colors.
+     *	Set up default foreground and background colors.
      */
     lynx_setup_colors();
 #endif /* USE_SLANG */
 
     /*
-     *  Set the compilation default signature file. - FM
+     *	Set the compilation default signature file. - FM
      */
     strcpy(filename, LYNX_SIG_FILE);
     if (LYPathOffHomeOK(filename, sizeof(filename))) {
@@ -1255,7 +1255,7 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Process the configuration file.
+     *	Process the configuration file.
      */
     if (TRACE) {
 	fprintf(stderr,
@@ -1267,15 +1267,15 @@ else {init_ctrl_break[0] = 1;}
     HTSwitchDTD(New_DTD);
 
     /*
-     *  Check for a save space path in the environment.
-     *  If one was set in the configuration file, that
-     *  one will be overridden. - FM
+     *	Check for a save space path in the environment.
+     *	If one was set in the configuration file, that
+     *	one will be overridden. - FM
      */
     if ((cp=getenv("LYNX_SAVE_SPACE")) != NULL)
 	StrAllocCopy(lynx_save_space, cp);
 
     /*
-     *  We have a save space path, make sure it's valid. - FM
+     *	We have a save space path, make sure it's valid. - FM
      */
     if (lynx_save_space && *lynx_save_space == '\0') {
 	FREE(lynx_save_space);
@@ -1328,17 +1328,17 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Set up the file extension and mime type maps from
-     *  src/HTInit.c and the global and personal mime.types
-     *  and mailcap files.  These will override any SUFFIX
-     *  or VIEWER maps in userdefs.h or the configuration
-     *  file, if they overlap.
+     *	Set up the file extension and mime type maps from
+     *	src/HTInit.c and the global and personal mime.types
+     *	and mailcap files.  These will override any SUFFIX
+     *	or VIEWER maps in userdefs.h or the configuration
+     *	file, if they overlap.
      */
     HTFormatInit();
     HTFileInit();
 
     /*
-     *  Get WWW_HOME environment variable if it exists.
+     *	Get WWW_HOME environment variable if it exists.
      */
     if ((cp = getenv("WWW_HOME")) != NULL) {
 	StrAllocCopy(startfile, cp);
@@ -1346,11 +1346,11 @@ else {init_ctrl_break[0] = 1;}
 	if (!strncasecomp(startfile, "lynxexec:", 9) ||
 	    !strncasecomp(startfile, "lynxprog:", 9)) {
 	    /*
-	     *  The original implementations of these schemes expected
-	     *  white space without hex escaping, and did not check
-	     *  for hex escaping, so we'll continue to support that,
-	     *  until that code is redone in conformance with SGML
-	     *  principles.  - FM
+	     *	The original implementations of these schemes expected
+	     *	white space without hex escaping, and did not check
+	     *	for hex escaping, so we'll continue to support that,
+	     *	until that code is redone in conformance with SGML
+	     *	principles.  - FM
 	     */
 	    HTUnEscapeSome(startfile, " \r\n\t");
 	    convert_to_spaces(startfile, TRUE);
@@ -1358,24 +1358,24 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Set the LynxHome URL.  If it's a file URL and the
-     *  host is defaulted, force in "//localhost", and if
-     *  it's not an absolute URL, make it one. - FM
+     *	Set the LynxHome URL.  If it's a file URL and the
+     *	host is defaulted, force in "//localhost", and if
+     *	it's not an absolute URL, make it one. - FM
      */
     StrAllocCopy(LynxHome, startfile);
     LYFillLocalFileURL((char **)&LynxHome, "file://localhost");
     LYEnsureAbsoluteURL((char **)&LynxHome, "LynxHome");
 
     /*
-     *  Process any command line arguments not already handled. - FM
+     *	Process any command line arguments not already handled. - FM
      */
     for (i = 1; i < argc; i++) {
 	parse_arg(&argv[i], &i, argc);
     }
 
     /*
-     *  Process any stdin-derived arguments for a lone "-"  which we've
-     *  loaded into LYStdinArgs. - FM
+     *	Process any stdin-derived arguments for a lone "-"  which we've
+     *	loaded into LYStdinArgs. - FM
      */
     if (LYStdinArgs != NULL) {
 	char *my_args[2];
@@ -1399,7 +1399,7 @@ else {init_ctrl_break[0] = 1;}
 #endif /* !VMS */
 
     /*
-     *  Process the RC file.
+     *	Process the RC file.
      */
     read_rc();
 
@@ -1441,7 +1441,7 @@ else {init_ctrl_break[0] = 1;}
 	set_numbers_as_arrows();
 
     /*
-     *  Check the -popup command line toggle. - FM
+     *	Check the -popup command line toggle. - FM
      */
     if (LYUseDefSelPop == FALSE) {
 	if (LYSelectPopups == TRUE)
@@ -1451,7 +1451,7 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Check the -show_cursor command line toggle. - FM
+     *	Check the -show_cursor command line toggle. - FM
      */
     if (LYUseDefShoCur == FALSE) {
 	if (LYShowCursor == TRUE)
@@ -1461,17 +1461,17 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Check the -base command line switch with -source. - FM
+     *	Check the -base command line switch with -source. - FM
      */
     if (LYPrependBase && HTOutputFormat == HTAtom_for("www/download")) {
 	LYPrependBaseToSource = TRUE;
     }
 
     /*
-     *  Disable multiple bookmark support if not interactive,
-     *  so it doesn't crash on curses functions, or if the
-     *  support was blocked via userdefs.h and/or lynx.cfg,
-     *  or via command line restrictions. - FM
+     *	Disable multiple bookmark support if not interactive,
+     *	so it doesn't crash on curses functions, or if the
+     *	support was blocked via userdefs.h and/or lynx.cfg,
+     *	or via command line restrictions. - FM
      */
     if (no_multibook)
 	LYMBMBlocked = TRUE;
@@ -1520,23 +1520,23 @@ else {init_ctrl_break[0] = 1;}
 #endif /* !VMS */
 
     /*
-     *  Set up the proper character set with the desired
-     *  startup raw 8-bit or CJK mode handling.  - FM
+     *	Set up the proper character set with the desired
+     *	startup raw 8-bit or CJK mode handling.  - FM
      */
     HTMLUseCharacterSet(current_char_set);
 
     /*
-     *  If startfile is a file URL and the host is defaulted,
-     *  force in "//localhost", and if it's not an absolute URL,
-     *  make it one. - FM
+     *	If startfile is a file URL and the host is defaulted,
+     *	force in "//localhost", and if it's not an absolute URL,
+     *	make it one. - FM
      */
     LYFillLocalFileURL((char **)&startfile, "file://localhost");
     LYEnsureAbsoluteURL((char **)&startfile, "STARTFILE");
 
     /*
-     *  If homepage was specified and is a file URL with the
-     *  host defaulted, force in "//localhost", and if it's
-     *  not an absolute URL, make it one. - FM
+     *	If homepage was specified and is a file URL with the
+     *	host defaulted, force in "//localhost", and if it's
+     *	not an absolute URL, make it one. - FM
      */
     if (homepage) {
 	LYFillLocalFileURL((char **)&homepage, "file://localhost");
@@ -1544,9 +1544,9 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  If we don't have a homepage specified,
-     *  set it to startfile.  Otherwise, reset
-     *  LynxHome. - FM
+     *	If we don't have a homepage specified,
+     *	set it to startfile.  Otherwise, reset
+     *	LynxHome. - FM
      */
     if (!(homepage && *homepage)) {
 	StrAllocCopy(homepage, startfile);
@@ -1555,7 +1555,7 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Set up the inside/outside domain restriction flags. - FM
+     *	Set up the inside/outside domain restriction flags. - FM
      */
     if (inlocaldomain()) {
 #if !defined(HAVE_UTMP) || defined(VMS) /* not selective */
@@ -1582,14 +1582,14 @@ else {init_ctrl_break[0] = 1;}
 
 #ifdef SIGTSTP
     /*
-     *  Block Control-Z suspending if requested. - FM
+     *	Block Control-Z suspending if requested. - FM
      */
     if (no_suspend)
 	(void) signal(SIGTSTP,SIG_IGN);
 #endif /* SIGTSTP */
 
     /*
-     *  Check for a valid HEAD request. - FM
+     *	Check for a valid HEAD request. - FM
      */
     if (HEAD_request && LYCanDoHEAD(startfile) != TRUE) {
 	fprintf(stderr,
@@ -1610,7 +1610,7 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Check for a valid MIME headers request. - FM
+     *	Check for a valid MIME headers request. - FM
      */
     if (keep_mime_headers && LYCanDoHEAD(startfile) != TRUE) {
 	fprintf(stderr,
@@ -1631,7 +1631,7 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Check for a valid traversal request. - FM
+     *	Check for a valid traversal request. - FM
      */
     if (traversal && strncmp(startfile, "http", 4)) {
 	fprintf(stderr,
@@ -1652,21 +1652,21 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Set up our help and about file base paths. - FM
+     *	Set up our help and about file base paths. - FM
      */
     StrAllocCopy(helpfilepath, helpfile);
     if ((cp=strrchr(helpfilepath, '/')) != NULL)
 	*cp = '\0';
     /*
-     *  Remove code to merge the historical about_lynx
-     *  directory into lynx_help. - HN
+     *	Remove code to merge the historical about_lynx
+     *	directory into lynx_help. - HN
      */
     StrAllocCat(helpfilepath, "/");
 
 
     /*
-     *  Make sure our bookmark default strings
-     *  are all allocated and synchronized. - FM
+     *	Make sure our bookmark default strings
+     *	are all allocated and synchronized. - FM
      */
     if (!bookmark_page || *bookmark_page == '\0') {
 	StrAllocCopy(bookmark_page, "lynx_bookmarks");
@@ -1682,7 +1682,7 @@ else {init_ctrl_break[0] = 1;}
     }
 
     /*
-     *  Here's where we do all the work.
+     *	Here's where we do all the work.
      */
     if (dump_output_immediately) {
 	/*
@@ -1791,7 +1791,7 @@ PRIVATE void parse_arg ARGS3(
 #define nextarg ((cp=scan3D(&argv[0], i))!=NULL)
 
     /*
-     *  Check for a command line startfile. - FM
+     *	Check for a command line startfile. - FM
      */
     if (argv[0][0] != '-') {
 	StrAllocCopy(startfile, argv[0]);
@@ -1799,11 +1799,11 @@ PRIVATE void parse_arg ARGS3(
 	if (!strncasecomp(startfile, "lynxexec:", 9) ||
 	    !strncasecomp(startfile, "lynxprog:", 9)) {
 	    /*
-	     *  The original implementations of these schemes expected
-	     *  white space without hex escaping, and did not check
-	     *  for hex escaping, so we'll continue to support that,
-	     *  until that code is redone in conformance with SGML
-	     *  principles.  - FM
+	     *	The original implementations of these schemes expected
+	     *	white space without hex escaping, and did not check
+	     *	for hex escaping, so we'll continue to support that,
+	     *	until that code is redone in conformance with SGML
+	     *	principles.  - FM
 	     */
 	    HTUnEscapeSome(startfile, " \r\n\t");
 	    convert_to_spaces(startfile, TRUE);
@@ -1812,9 +1812,9 @@ PRIVATE void parse_arg ARGS3(
     }
 
     /*
-     *  Skip any lone "-" arguments, because we've loaded
-     *  the stdin input into an HTList structure for
-     *  special handling. - FM
+     *	Skip any lone "-" arguments, because we've loaded
+     *	the stdin input into an HTList structure for
+     *	special handling. - FM
      */
     if (strcmp(argv[0], "-") == 0) {
 	return;
@@ -2244,7 +2244,7 @@ PRIVATE void parse_arg ARGS3(
 	     HTAtom_for("www/download") : HTAtom_for("www/dump"));
 	LYcols=999;
 
-    } else if (strncmp(argv[0], "-minimal", 11) == 0) {
+    } else if (strncmp(argv[0], "-minimal", 8) == 0) {
 	if (minimal_comments)
 	    minimal_comments = FALSE;
 	else
@@ -2332,7 +2332,7 @@ PRIVATE void parse_arg ARGS3(
     } else if (strncmp(argv[0], "-nostatus", 9) == 0)	{
 	no_statusline = TRUE;
 
-    } else if (strncmp(argv[0], "-number_links", 9) == 0) {
+    } else if (strncmp(argv[0], "-number_links", 13) == 0) {
 	number_links = TRUE;
 
     } else {
@@ -2391,7 +2391,7 @@ PRIVATE void parse_arg ARGS3(
 	post_data = &form_post_data;
 
 	/*
-	 *  Build post data for later.  Stop reading when we see a line
+	 *  Build post data for later.	Stop reading when we see a line
 	 *  with "---" as its first three characters.
 	 */
 	while (fgets(buf, sizeof(buf), stdin) &&
@@ -2435,101 +2435,91 @@ PRIVATE void parse_arg ARGS3(
     } else if (strncmp(argv[0], "-restrictions", 13) == 0) {
 	if ((cp=strchr(argv[0],'=')) != NULL)
 	    parse_restrictions(cp+1);
-	else
-	    {
-		/* print help */
-		printf("\n\
-   USAGE: lynx -restrictions=[option][,option][,option]\n\
-   List of Options:\n\
-   all             restricts all options.\n");
-		printf("\
-   bookmark        disallow changing the location of the bookmark file.\n\
-   bookmark_exec   disallow execution links via the bookmark file\n");
+	else {
+		static CONST char *Usage[] = {
+ ""
+,"   USAGE: lynx -restrictions=[option][,option][,option]"
+,"   List of Options:"
+,"   all             restricts all options."
+,"   bookmark        disallow changing the location of the bookmark file."
+,"   bookmark_exec   disallow execution links via the bookmark file"
 #if defined(DIRED_SUPPORT) && defined(OK_PERMIT)
-		printf("\
-   change_exec_perms  disallow changing the eXecute permission on files\n\
-                   (but still allow it for directories) when local file\n\
-                   management is enabled.\n");
+,"   change_exec_perms  disallow changing the eXecute permission on files"
+,"                   (but still allow it for directories) when local file"
+,"                   management is enabled."
 #endif /* DIRED_SUPPORT && OK_PERMIT */
-		printf("\
-   default         same as commandline option -anonymous.  Disables\n\
-                   default services for anonymous users.  Currently set to,\n\
-                   all restricted except for: inside_telnet, outside_telnet,\n\
-                   inside_news, inside_ftp, outside_ftp, inside_rlogin,\n\
-                   outside_rlogin, goto, jump and mail.  Defaults\n\
-                   are settable within userdefs.h\n");
+,"   default         same as commandline option -anonymous.  Disables"
+,"                   default services for anonymous users.  Currently set to,"
+,"                   all restricted except for: inside_telnet, outside_telnet,"
+,"                   inside_news, inside_ftp, outside_ftp, inside_rlogin,"
+,"                   outside_rlogin, goto, jump and mail.  Defaults"
+,"                   are settable within userdefs.h"
 #ifdef DIRED_SUPPORT
-		printf("\
-   dired_support   disallow local file management\n");
+,"   dired_support   disallow local file management"
 #endif /* DIRED_SUPPORT */
-		printf("\
-   disk_save       disallow saving to disk in the download and print menus\n\
-   dotfiles        disallow access to, or creation of, hidden (dot) files\n\
-   download        disallow downloaders in the download menu\n\
-   editor          disallow editing\n\
-   exec            disable execution scripts\n\
-   exec_frozen     disallow the user from changing the execution link\n");
+,"   disk_save       disallow saving to disk in the download and print menus"
+,"   dotfiles        disallow access to, or creation of, hidden (dot) files"
+,"   download        disallow downloaders in the download menu"
+,"   editor          disallow editing"
+,"   exec            disable execution scripts"
+,"   exec_frozen     disallow the user from changing the execution link"
 #ifdef USE_EXTERNALS
-		printf("\
-   externals       disable passing URLs to external programs\n");
+,"   externals       disable passing URLs to external programs"
 #endif
-		printf("\
-   file_url        disallow using G)oto, served links or bookmarks for\n\
-                   file: URL's\n\
-   goto            disable the 'g' (goto) command\n");
+,"   file_url        disallow using G)oto, served links or bookmarks for"
+,"                   file: URL's"
+,"   goto            disable the 'g' (goto) command"
 #if !defined(HAVE_UTMP) || defined(VMS) /* not selective */
-		printf("\
-   inside_ftp      disallow ftps for people coming from inside your\n\
-                   domain (utmp required for selectivity)\n\
-   inside_news     disallow USENET news posting for people coming from\n\
-                   inside your domain (utmp required for selectivity)\n\
-   inside_rlogin   disallow rlogins for people coming from inside your\n\
-                   domain (utmp required for selectivity)\n\
-   inside_telnet   disallow telnets for people coming from inside your\n\
-                   domain (utmp required for selectivity)\n");
+,"   inside_ftp      disallow ftps for people coming from inside your"
+,"                   domain (utmp required for selectivity)"
+,"   inside_news     disallow USENET news posting for people coming from"
+,"                   inside your domain (utmp required for selectivity)"
+,"   inside_rlogin   disallow rlogins for people coming from inside your"
+,"                   domain (utmp required for selectivity)"
+,"   inside_telnet   disallow telnets for people coming from inside your"
+,"                   domain (utmp required for selectivity)"
 #else
-		printf("\
-   inside_ftp      disallow ftps for people coming from inside your domain\n\
-   inside_news     disallow USENET news posting for people coming from inside\n\
-                   your domain\n\
-   inside_rlogin   disallow rlogins for people coming from inside your domain\n\
-   inside_telnet   disallow telnets for people coming from inside your domain\n");
+,"   inside_ftp      disallow ftps for people coming from inside your domain"
+,"   inside_news     disallow USENET news posting for people coming from inside"
+,"                   your domain"
+,"   inside_rlogin   disallow rlogins for people coming from inside your domain"
+,"   inside_telnet   disallow telnets for people coming from inside your domain"
 #endif /* HAVE_UTMP || VMS */
-		printf("\
-   jump            disable the 'j' (jump) command\n\
-   mail            disallow mail\n\
-   multibook       disallow multiple bookmark files\n\
-   news_post       disallow USENET News posting.\n\
-   option_save     disallow saving options in .lynxrc\n");
+,"   jump            disable the 'j' (jump) command"
+,"   mail            disallow mail"
+,"   multibook       disallow multiple bookmark files"
+,"   news_post       disallow USENET News posting."
+,"   option_save     disallow saving options in .lynxrc"
 #if !defined(HAVE_UTMP) || defined(VMS) /* not selective */
-		printf("\
-   outside_ftp     disallow ftps for people coming from outside your\n\
-                   domain (utmp required for selectivity)\n\
-   outside_news    disallow USENET news posting for people coming from\n\
-                   outside your domain (utmp required for selectivity)\n\
-   outside_rlogin  disallow rlogins for people coming from outside your\n\
-                   domain (utmp required for selectivity)\n\
-   outside_telnet  disallow telnets for people coming from outside your\n\
-                   domain (utmp required for selectivity)\n");
+,"   outside_ftp     disallow ftps for people coming from outside your"
+,"                   domain (utmp required for selectivity)"
+,"   outside_news    disallow USENET news posting for people coming from"
+,"                   outside your domain (utmp required for selectivity)"
+,"   outside_rlogin  disallow rlogins for people coming from outside your"
+,"                   domain (utmp required for selectivity)"
+,"   outside_telnet  disallow telnets for people coming from outside your"
+,"                   domain (utmp required for selectivity)"
 #else
-		printf("\
-   outside_ftp     disallow ftps for people coming from outside your domain\n\
-   outside_news    disallow USENET news posting for people coming from outside\n\
-                   your domain\n\
-   outside_rlogin  disallow rlogins for people coming from outside your domain\n\
-   outside_telnet  disallow telnets for people coming from outside your domain\n");
+,"   outside_ftp     disallow ftps for people coming from outside your domain"
+,"   outside_news    disallow USENET news posting for people coming from outside"
+,"                   your domain"
+,"   outside_rlogin  disallow rlogins for people coming from outside your domain"
+,"   outside_telnet  disallow telnets for people coming from outside your domain"
 #endif /* !HAVE_UTMP || VMS */
-		printf("\
-   print           disallow most print options\n\
-   shell           disallow shell escapes, and lynxexec, lynxprog or lynxcgi\n\
-                   G)oto's\n\
-   suspend         disallow Control-Z suspends with escape to shell\n\
-   telnet_port     disallow specifying a port in telnet G)oto's\n\
-   useragent       disallow modifications of the User-Agent header\n");
+,"   print           disallow most print options"
+,"   shell           disallow shell escapes, and lynxexec, lynxprog or lynxcgi"
+,"                   G)oto's"
+,"   suspend         disallow Control-Z suspends with escape to shell"
+,"   telnet_port     disallow specifying a port in telnet G)oto's"
+,"   useragent       disallow modifications of the User-Agent header"
+		};
+		size_t n;
+		for (n = 0; n < sizeof(Usage)/sizeof(Usage[0]); n++)
+			printf("%s\n", Usage[n]);
 		exit(0);
 	    }
 
-    } else if (strncmp(argv[0], "-resubmit_posts", 14) == 0) {
+    } else if (strncmp(argv[0], "-resubmit_posts", 15) == 0) {
 	if (LYresubmit_posts)
 	    LYresubmit_posts = FALSE;
 	else
@@ -2615,12 +2605,19 @@ PRIVATE void parse_arg ARGS3(
     break;
 
     case 'u':
-    if (strncmp(argv[0], "-underscore", 15) == 0) {
+    if (strncmp(argv[0], "-underscore", 11) == 0) {
 	if (use_underscore)
 	    use_underscore = FALSE;
 	else
 	    use_underscore = TRUE;
 
+    } else if (strncmp(argv[0], "-useragent", 10) == 0) {
+      /*
+       *  Set alternate Lynx User-Agent header.
+       */
+      if (nextarg)
+	  StrAllocCopy(LYUserAgent, cp);
+
 #if defined(NCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE)
     } else if (strncmp(argv[0], "-use_mouse", 9) == 0) {
 	LYUseMouse = TRUE;
@@ -2690,128 +2687,136 @@ Output_Help_List:
 #else
     printf("USAGE: %s [options] [file]\n",pgm);
 #endif /* VMS */
-    printf("Options are:\n");
-    printf("    -                receive the arguments from stdin (enclose\n");
-    printf("                     in double-quotes (\"-\") on VMS)\n");
-    printf("    -anonymous       used to specify the anonymous account\n");
-    printf("    -assume_charset=MIMEname  charset for documents that don't specify it\n");
-    printf("    -assume_local_charset=MIMEname  charset assumed for local files\n");
-    printf("    -assume_unrec_charset=MIMEname  use this instead of unrecognized charsets\n");
-    printf("    -auth=id:pw      authentication information for protected documents\n");
-    printf("    -base            prepend a request URL comment and BASE tag to text/html\n");
-    printf("                     outputs for -source dumps\n");
-    printf("    -book            use the bookmark page as the startfile\n");
-    printf("    -buried_news     toggles scanning of news articles for buried references\n");
-    printf("    -cache=NUMBER    NUMBER of documents cached in memory (default is %d)\n",DEFAULT_CACHE_SIZE);
-    printf("    -case            enable case sensitive user searching\n");
-    printf("    -cfg=FILENAME    specifies a lynx.cfg file other than the default\n");
-    printf("    -child           exit on left-arrow in startfile, and disable save to disk\n");
+    {
+	static CONST char *Options[] = {
+ "Options are:"
+,"    -                receive the arguments from stdin (enclose"
+,"                     in double-quotes (\"-\") on VMS)"
+,"    -anonymous       used to specify the anonymous account"
+,"    -assume_charset=MIMEname  charset for documents that don't specify it"
+,"    -assume_local_charset=MIMEname  charset assumed for local files"
+,"    -assume_unrec_charset=MIMEname  use this instead of unrecognized charsets"
+,"    -auth=id:pw      authentication information for protected documents"
+,"    -base            prepend a request URL comment and BASE tag to text/html"
+,"                     outputs for -source dumps"
+,"    -book            use the bookmark page as the startfile"
+,"    -buried_news     toggles scanning of news articles for buried references"
+,"    -cache=NUMBER    NUMBER of documents cached in memory"
+,"    -case            enable case sensitive user searching"
+,"    -cfg=FILENAME    specifies a lynx.cfg file other than the default"
+,"    -child           exit on left-arrow in startfile, and disable save to disk"
 #ifdef USE_SLANG
-    printf("    -color           force color mode on with standard bg colors\n");
-    printf("    -blink           force high intensity bg colors in color mode\n");
+,"    -color           force color mode on with standard bg colors"
+,"    -blink           force high intensity bg colors in color mode"
 #endif /* USE_SLANG */
-    printf("    -cookies         toggles handling of Set-Cookie headers\n");
+,"    -cookies         toggles handling of Set-Cookie headers"
 #ifndef VMS
-    printf("    -core            toggles forced core dumps on fatal errors\n");
+,"    -core            toggles forced core dumps on fatal errors"
 #endif /* !VMS */
-    printf("    -crawl           with -traversal, output each page to a file\n");
-    printf("                     with -dump, format output as with -traversal, but to stdout\n");
-    printf("    -display=DISPLAY set the display variable for X execed programs\n");
-    printf("    -dump            dump the first file to stdout and exit\n");
-    printf("    -editor=EDITOR   enable edit mode with specified editor\n");
-    printf("    -emacskeys       enable emacs-like key movement\n");
-    printf("    -enable_scrollback  toggles compatibility with comm programs' scrollback\n");
-    printf("                        keys (may be incompatible with some curses packages)\n");
-    printf("    -error_file=FILE write the HTTP status code here\n");
+,"    -crawl           with -traversal, output each page to a file"
+,"                     with -dump, format output as with -traversal, but to stdout"
+,"    -display=DISPLAY set the display variable for X execed programs"
+,"    -dump            dump the first file to stdout and exit"
+,"    -editor=EDITOR   enable edit mode with specified editor"
+,"    -emacskeys       enable emacs-like key movement"
+,"    -enable_scrollback  toggles compatibility with comm programs' scrollback"
+,"                        keys (may be incompatible with some curses packages)"
+,"    -error_file=FILE write the HTTP status code here"
 #if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS)
 #ifndef NEVER_ALLOW_REMOTE_EXEC
-    printf("    -exec            enable local program execution\n");
+,"    -exec            enable local program execution"
 #endif /* !NEVER_ALLOW_REMOTE_EXEC */
-    printf("    -locexec         enable local program execution from local files only\n");
-    printf("    -noexec          disable local program execution (DEFAULT)\n");
+,"    -locexec         enable local program execution from local files only"
+,"    -noexec          disable local program execution (DEFAULT)"
 #endif /* EXEC_LINKS || EXEC_SCRIPTS */
-    printf("    -fileversions    include all versions of files in local VMS directory\n");
-    printf("                     listings\n");
-    printf("    -force_html      forces the first document to be interpreted as HTML\n");
-    printf("    -force_secure    toggles forcing of the secure flag for SSL cookies\n");
-    printf("    -from            toggle transmissions of From headers\n");
-    printf("    -ftp             disable ftp access\n");
-    printf("    -get_data        user data for get forms, read from stdin,\n");
-    printf("                     terminated by '---' on a line\n");
-    printf("    -head            send a HEAD request\n");
-    printf("    -help            print this usage message\n");
-    printf("    -hiddenlinks=[option]  hidden links: options are merge, listonly, or ignore\n");
-    printf("    -historical      toggles use of '>' or '-->' as a terminator for comments\n");
-    printf("    -homepage=URL    set homepage separate from start page\n");
-    printf("    -image_links     toggles inclusion of links for all images\n");
-    printf("    -index=URL       set the default index file to URL\n");
-    printf("    -ismap           toggles inclusion of ISMAP links when client-side\n");
-    printf("                     MAPs are present\n");
-    printf("    -link=NUMBER     starting count for lnk#.dat files produced by -crawl\n");
-    printf("    -localhost       disable URLs that point to remote hosts\n");
+,"    -fileversions    include all versions of files in local VMS directory"
+,"                     listings"
+,"    -force_html      forces the first document to be interpreted as HTML"
+,"    -force_secure    toggles forcing of the secure flag for SSL cookies"
+,"    -from            toggle transmissions of From headers"
+,"    -ftp             disable ftp access"
+,"    -get_data        user data for get forms, read from stdin,"
+,"                     terminated by '---' on a line"
+,"    -head            send a HEAD request"
+,"    -help            print this usage message"
+,"    -hiddenlinks=[option]  hidden links: options are merge, listonly, or ignore"
+,"    -historical      toggles use of '>' or '-->' as a terminator for comments"
+,"    -homepage=URL    set homepage separate from start page"
+,"    -image_links     toggles inclusion of links for all images"
+,"    -index=URL       set the default index file to URL"
+,"    -ismap           toggles inclusion of ISMAP links when client-side"
+,"                     MAPs are present"
+,"    -link=NUMBER     starting count for lnk#.dat files produced by -crawl"
+,"    -localhost       disable URLs that point to remote hosts"
 #if defined(USE_HASH)
-    printf("    -lss=FILENAME    specifies a lynx.css file other than the default\n");
+,"    -lss=FILENAME    specifies a lynx.css file other than the default"
 #endif
-    printf("    -mime_header     include mime headers and force source dump\n");
-    printf("    -minimal         toggles minimal versus valid comment parsing\n");
-    printf("    -newschunksize=NUMBER  number of articles in chunked news listings\n");
-    printf("    -newsmaxchunk=NUMBER   maximum news articles in listings before chunking\n");
-    printf("    -nobrowse        disable directory browsing\n");
-    printf("    -nocc            disable Cc: prompts for self copies of mailings\n");
-    printf("    -nofilereferer   disable transmissions of Referer headers for file URLs\n");
-    printf("    -nolist          disable the link list feature in dumps\n");
-    printf("    -nolog           disable mailing of error messages to document owners\n");
-    printf("    -nopause         disable forced pauses for statusline messages\n");
-    printf("    -noprint         disable print functions\n");
-    printf("    -noredir         don't follow Location: redirection\n");
-    printf("    -noreferer       disable transmissions of Referer headers\n");
+,"    -mime_header     include mime headers and force source dump"
+,"    -minimal         toggles minimal versus valid comment parsing"
+,"    -newschunksize=NUMBER  number of articles in chunked news listings"
+,"    -newsmaxchunk=NUMBER   maximum news articles in listings before chunking"
+,"    -nobrowse        disable directory browsing"
+,"    -nocc            disable Cc: prompts for self copies of mailings"
+,"    -nofilereferer   disable transmissions of Referer headers for file URLs"
+,"    -nolist          disable the link list feature in dumps"
+,"    -nolog           disable mailing of error messages to document owners"
+,"    -nopause         disable forced pauses for statusline messages"
+,"    -noprint         disable print functions"
+,"    -noredir         don't follow Location: redirection"
+,"    -noreferer       disable transmissions of Referer headers"
 #ifdef SOCKS
-    printf("    -nosocks         don't use SOCKS proxy for this session\n");
+,"    -nosocks         don't use SOCKS proxy for this session"
 #endif /* SOCKS */
-    printf("    -nostatus        disable the miscellaneous information messages\n");
-    printf("    -number_links    force numbering of links\n");
-    printf("    -pauth=id:pw     authentication information for protected proxy server\n");
-    printf("    -popup           toggles handling of single-choice SELECT options via\n");
-    printf("                     popup windows or as lists of radio buttons\n");
-    printf("    -post_data       user data for post forms, read from stdin,\n");
-    printf("                     terminated by '---' on a line\n");
-    printf("    -preparsed       show parsed text/html with -source and in source view\n");
-    printf("    -print           enable print functions (DEFAULT)\n");
-    printf("    -pseudo_inlines  toggles pseudo-ALTs for inlines with no ALT string\n");
-    printf("    -raw             toggles default setting of 8-bit character translations\n");
-    printf("                     or CJK mode for the startup character set\n");
-    printf("    -realm           restricts access to URLs in the starting realm\n");
-    printf("    -reload          flushes the cache on a proxy server\n");
-    printf("                     (only the first document affected)\n");
-    printf("    -restrictions=[options]  use -restrictions to see list\n");
-    printf("    -resubmit_posts  toggles forced resubmissions (no-cache) of forms with\n");
-    printf("                     method POST when the documents they returned are sought\n");
-    printf("                     with the PREV_DOC command or from the History List\n");
-    printf("    -rlogin          disable rlogins\n");
-    printf("    -selective       require .www_browsable files to browse directories\n");
-    printf("    -show_cursor     toggles hiding of the cursor in the lower right corner\n");
-    printf("    -soft_dquotes    toggles emulation of the old Netscape and Mosaic bug which\n");
-    printf("                     treated '>' as a co-terminator for double-quotes and tags\n");
-    printf("    -source          dump the source of the first file to stdout and exit\n");
-    printf("    -startfile_ok    allow non-http startfile and homepage with -validate\n");
+,"    -nostatus        disable the miscellaneous information messages"
+,"    -number_links    force numbering of links"
+,"    -pauth=id:pw     authentication information for protected proxy server"
+,"    -popup           toggles handling of single-choice SELECT options via"
+,"                     popup windows or as lists of radio buttons"
+,"    -post_data       user data for post forms, read from stdin,"
+,"                     terminated by '---' on a line"
+,"    -preparsed       show parsed text/html with -source and in source view"
+,"    -print           enable print functions (DEFAULT)"
+,"    -pseudo_inlines  toggles pseudo-ALTs for inlines with no ALT string"
+,"    -raw             toggles default setting of 8-bit character translations"
+,"                     or CJK mode for the startup character set"
+,"    -realm           restricts access to URLs in the starting realm"
+,"    -reload          flushes the cache on a proxy server"
+,"                     (only the first document affected)"
+,"    -restrictions=[options]  use -restrictions to see list"
+,"    -resubmit_posts  toggles forced resubmissions (no-cache) of forms with"
+,"                     method POST when the documents they returned are sought"
+,"                     with the PREV_DOC command or from the History List"
+,"    -rlogin          disable rlogins"
+,"    -selective       require .www_browsable files to browse directories"
+,"    -show_cursor     toggles hiding of the cursor in the lower right corner"
+,"    -soft_dquotes    toggles emulation of the old Netscape and Mosaic bug which"
+,"                     treated '>' as a co-terminator for double-quotes and tags"
+,"    -source          dump the source of the first file to stdout and exit"
+,"    -startfile_ok    allow non-http startfile and homepage with -validate"
 #ifndef VMS
 #ifdef SYSLOG_REQUESTED_URLS
-    printf("    -syslog=text     information for syslog call\n");
+,"    -syslog=text     information for syslog call"
 #endif /* SYSLOG_REQUESTED_URLS */
 #endif /* !VMS */
-    printf("    -telnet          disable telnets\n");
-    printf("    -term=TERM       set terminal type to TERM\n");
-    printf("    -tlog            toggles use of a Lynx Trace Log for the current session\n");
-    printf("    -trace           turns on Lynx trace mode\n");
-    printf("    -traversal       traverse all http links derived from startfile\n");
-    printf("    -underscore      toggles use of _underline_ format in dumps\n");
+,"    -telnet          disable telnets"
+,"    -term=TERM       set terminal type to TERM"
+,"    -tlog            toggles use of a Lynx Trace Log for the current session"
+,"    -trace           turns on Lynx trace mode"
+,"    -traversal       traverse all http links derived from startfile"
+,"    -underscore      toggles use of _underline_ format in dumps"
+,"    -useragent=Name  set alternate Lynx User-Agent header"
 #if defined(NCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE)
-    printf("    -use_mouse       enable use of the mouse\n");
+,"    -use_mouse       enable use of the mouse"
 #endif
-    printf("    -validate        accept only http URLs (for validation)\n");
-    printf("    -version         print Lynx version information\n");
-    printf("    -vikeys          enable vi-like key movement\n");
-    printf("    -width=NUMBER    screen width for formatting of dumps (default is 80)\n");
+,"    -validate        accept only http URLs (for validation)"
+,"    -version         print Lynx version information"
+,"    -vikeys          enable vi-like key movement"
+,"    -width=NUMBER    screen width for formatting of dumps (default is 80)"
+	};
+	size_t n;
+	for (n = 0; n < sizeof(Options)/sizeof(Options[0]); n++)
+	    printf("%s\n", Options[n]);
+    }
     if (strncmp(argv[0], "-help", 5) != 0)
 	exit(-1);
     exit(0);
@@ -2825,7 +2830,7 @@ PRIVATE void FatalProblem ARGS1(
 	int,		sig)
 {
     /*
-     *  Ignore further interrupts. - mhc: 11/2/91
+     *	Ignore further interrupts. - mhc: 11/2/91
      */
 #ifndef NOSIGHUP
     (void) signal(SIGHUP, SIG_IGN);
@@ -2841,13 +2846,13 @@ PRIVATE void FatalProblem ARGS1(
     (void) signal(SIGILL, SIG_IGN);
 
     /*
-     *  Flush all messages. - FM
+     *	Flush all messages. - FM
      */
     fflush(stderr);
     fflush(stdout);
 
     /*
-     *  Deal with curses, if on, and clean up. - FM
+     *	Deal with curses, if on, and clean up. - FM
      */
     if (LYOutOfMemory && LYCursesON) {
 	sleep(AlertSecs);
@@ -2862,7 +2867,7 @@ PRIVATE void FatalProblem ARGS1(
     signal(SIGILL, SIG_DFL);
 
     /*
-     *  Issue appropriate messages and abort or exit. - FM
+     *	Issue appropriate messages and abort or exit. - FM
      */
     if (LYOutOfMemory == FALSE) {
 	fprintf (stderr, "\r\n\
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 9dfd785c..07faecb7 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -3,6 +3,7 @@
 #include "HTAccess.h"
 #include "HTParse.h"
 #include "HTList.h"
+#include "HTML.h"
 #include "HTFTP.h"
 #include "HTFile.h"
 #include "HTTP.h"
@@ -64,10 +65,13 @@ PRIVATE BOOL confirm_post_resub PARAMS((
     int 		if_imgmap,
     int 		if_file));
 PRIVATE int are_different PARAMS((document *doc1, document *doc2));
-PRIVATE int are_phys_different PARAMS((document *doc1, document *doc2));
 PUBLIC void HTGotoURLs_free NOPARAMS;
 PUBLIC void HTAddGotoURL PARAMS((char *url));
 
+#ifndef DONT_TRACK_INTERNAL_LINKS
+PRIVATE int are_phys_different PARAMS((document *doc1, document *doc2));
+#endif
+
 #define FASTTAB
 #ifdef FASTTAB
 PRIVATE int sametext ARGS2(
@@ -194,7 +198,7 @@ int mainloop NOARGS
  *  newdoc.title   contains the link name that the user last chose to get
  *		     into the current link (file).
  */
-    /* initalize some variables*/
+    /* initialize some variables*/
     newdoc.address = NULL;
     newdoc.title = NULL;
     newdoc.post_data = NULL;
@@ -1234,7 +1238,7 @@ try_again:
 	}
 
 	/*
-	 *  Refresh the screen if neccessary.
+	 *  Refresh the screen if necessary.
 	 */
 	if (refresh_screen) {
 #if defined(FANCY_CURSES) || defined (USE_SLANG)
@@ -1565,7 +1569,7 @@ new_keyboard_input:
 	    /*
 	     *	This is a special feature to traverse every http link
 	     *	derived from startfile and check for errors or create
-	     *	crawl ouput files.  Only URL's that begin with
+	     *	crawl output files.  Only URL's that begin with
 	     *	"traversal_host" are searched - this keeps the search
 	     *	from crossing to other servers (a feature, not a bug!).
 	     */
@@ -1843,7 +1847,7 @@ new_cmd:  /*
 		    if (nlinks > 0 && curdoc.link > -1) {
 			if (curdoc.link == newdoc.link) {
 			    /*
-			     *	It's the current link, and presumeably
+			     *	It's the current link, and presumably
 			     *	reflects a typo in the statusline entry,
 			     *	so issue a statusline message for the
 			     *	typo-prone users (like me 8-). - FM
@@ -3479,7 +3483,7 @@ check_goto_URL:
 
 	    } else if ((no_shell || no_goto_lynxexec
 #ifdef EXEC_LINKS
-	    		|| local_exec_on_local_files
+			|| local_exec_on_local_files
 #endif /* EXEC_LINKS */
 			) &&
 		       !strncmp(user_input_buffer, "lynxexec:",9)) {
@@ -3488,7 +3492,7 @@ check_goto_URL:
 
 	    } else if ((no_shell || no_goto_lynxprog
 #ifdef EXEC_LINKS
-	    		|| local_exec_on_local_files
+			|| local_exec_on_local_files
 #endif /* EXEC_LINKS */
 			) &&
 		       !strncmp(user_input_buffer, "lynxprog:",9)) {
@@ -3866,7 +3870,7 @@ check_goto_URL:
 		    /*
 		     *	Make the curdoc.address the newdoc.address so that
 		     *	getfile doesn't try to get the newdoc.address.
-		     *	Since we have already gotton it.
+		     *	Since we have already gotten it.
 		     */
 		    StrAllocCopy(curdoc.address, newdoc.address);
 		    StrAllocCopy(newdoc.post_data, curdoc.post_data);
@@ -3974,8 +3978,8 @@ check_goto_URL:
 		refresh_screen = TRUE;
 	    } else if ((case_sensitive && 0!=strcmp(prev_target,
 						    remember_old_target)) ||
-		       (!case_sensitive && 0!=strcasecomp(prev_target,
-							  remember_old_target))) {
+		      (!case_sensitive && 0!=strcasecomp8(prev_target,
+						    remember_old_target))) {
 		refresh_screen = TRUE;
 	    }
 	    FREE(remember_old_target);
@@ -4274,7 +4278,7 @@ check_goto_URL:
 		    break;
 		remove_bookmark_link(links[curdoc.link].anchor_number-1,
 				     curdoc.bookmark);
-	    } else {	/* behave like REFRESH for backward compatability */
+	    } else {	/* behave like REFRESH for backward compatibility */
 		refresh_screen = TRUE;
 		if (old_c != real_c) {
 		    old_c = real_c;
@@ -4813,7 +4817,7 @@ check_add_bookmark_to_self:
 		fflush(stderr);
 		if (LYTraceLogFP)
 		    /*
-		     *	Set stderr back to its orginal value
+		     *	Set stderr back to its original value
 		     *	during the shell escape. - FM
 		     */
 		    *stderr = LYOrigStderr;
@@ -5443,7 +5447,7 @@ check_add_bookmark_to_self:
 			if (!strncasecomp(ret, "lynxexec:", 9) ||
 			    !strncasecomp(ret, "lynxprog:", 9)) {
 			    /*
-			     *	The original implementions of these schemes
+			     *	The original implementations of these schemes
 			     *	expected white space without hex escaping,
 			     *	and did not check for hex escaping, so we'll
 			     *	continue to support that, until that code is
@@ -5662,6 +5666,7 @@ PRIVATE int are_different ARGS2(
 /* This determines whether two docs are _physically_ different,
  * meaning they are "from different files". - kw
  */
+#ifndef DONT_TRACK_INTERNAL_LINKS
 PRIVATE int are_phys_different ARGS2(
 	document *,	doc1,
 	document *,	doc2)
@@ -5742,6 +5747,7 @@ PRIVATE int are_phys_different ARGS2(
      */
     return(FALSE);
 }
+#endif
 
 /*
  *  Utility for freeing the list of goto URLs. - FM
diff --git a/src/LYNews.c b/src/LYNews.c
index 744a29d9..77824ebd 100644
--- a/src/LYNews.c
+++ b/src/LYNews.c
@@ -416,7 +416,7 @@ cleanup:
 }
 
 PRIVATE void terminate_message ARGS1(
-	int,	sig)
+	int,	sig GCC_UNUSED)
 {
     term_message = TRUE;
     /*
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 140cbccd..c63740a4 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -1757,7 +1757,7 @@ PRIVATE int boolean_choice ARGS4(
 }
 
 PRIVATE void terminate_options ARGS1(
-	int,		sig)
+	int,		sig GCC_UNUSED)
 {
     term_options = TRUE;
     /*
diff --git a/src/LYPrint.c b/src/LYPrint.c
index f8d1c5ac..04051990 100644
--- a/src/LYPrint.c
+++ b/src/LYPrint.c
@@ -471,9 +471,9 @@ PUBLIC int printfile ARGS1(
 		     *	to the top of the file.  May create
 		     *	technically invalid HTML, but will help to resolve
 		     *	properly the document converted via chartrans:
-		     *  printed document correspond to a display charset
-		     *  and we *should* override both assume_local_charset
-		     *  and original document's META CHARSET (if any).
+		     *	printed document correspond to a display charset
+		     *	and we *should* override both assume_local_charset
+		     *	and original document's META CHARSET (if any).
 		     *
 		     *	Currently, if several META CHARSETs are found Lynx uses
 		     *	the first only, and it is opposite to BASE where the
@@ -490,8 +490,7 @@ PUBLIC int printfile ARGS1(
 			  strncasecomp(disp_charset, "x-", 2) == 0) {
 		     } else {
 			fprintf(outfile_fp,
-				"<META HTTP-EQUIV=\"Content-Type\" "
-				"CONTENT=\"text/html; charset=%s\">\n\n",
+				"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=%s\">\n\n",
 				disp_charset);
 			}
 		}
@@ -1319,20 +1318,20 @@ PUBLIC int print_options ARGS2(
     fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n",
 		 PRINT_OPTIONS_TITLE);
 
-    fprintf(fp0,"<h1>Printing Options (%s Version %s)</h1>\n",
+    fprintf(fp0,"<h1>Printing Options (%s Version %s)</h1><pre>\n",
 				       LYNX_NAME, LYNX_VERSION);
 
     pages = (lines_in_file+65)/66;
     sprintf(buffer,
-	    "There are %d lines, or approximately %d page%s, to print.<br>\n",
+	   "   There are %d lines, or approximately %d page%s, to print.\n",
 	    lines_in_file, pages, (pages > 1 ? "s" : ""));
     fputs(buffer,fp0);
 
     if (no_print || no_disk_save || child_lynx || no_mail)
-	fputs("Some print functions have been disabled!!!<br>\n", fp0);
+	fprintf(fp0, "   Some print functions have been disabled!!!\n");
 
-    fputs("You have the following print choices.<br>\n", fp0);
-    fputs("Please select one:<br>\n<pre>\n", fp0);
+    fprintf(fp0, "   You have the following print choices.\n");
+    fprintf(fp0, "   Please select one:\n\n");
 
     if (child_lynx == FALSE && no_disk_save == FALSE && no_print == FALSE)
 	fprintf(fp0,
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index d8509a00..736aeab4 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -343,13 +343,13 @@ PUBLIC int check_color ARGS2(
 {
     int i;
 
-    if (!strcasecmp(color, "default"))
+    if (!strcasecomp(color, "default"))
 	return the_default;
-    if (!strcasecmp(color, "nocolor"))
+    if (!strcasecomp(color, "nocolor"))
 	return NO_COLOR;
 
     for (i = 0; i < 16; i++) {
-	if (!strcasecmp(color, Color_Strings[i]))
+	if (!strcasecomp(color, Color_Strings[i]))
 	    return ColorCode(i);
     }
     return ERR_COLOR;
diff --git a/src/LYReadCFG.h b/src/LYReadCFG.h
index 7cf805c0..5e94f0d8 100644
--- a/src/LYReadCFG.h
+++ b/src/LYReadCFG.h
@@ -11,6 +11,32 @@
 #define NO_COLOR      -2
 #define ERR_COLOR     -3
 
+/* Note: the sense of colors that Lynx uses for defaults is the reverse of
+ * the standard for color-curses.
+ */
+#ifdef USE_DEFAULT_COLORS
+# ifdef USE_SLANG
+#  define DEFAULT_FG "default"
+#  define DEFAULT_BG "default"
+# else
+#  ifdef HAVE_USE_DEFAULT_COLORS
+#   define DEFAULT_FG DEFAULT_COLOR
+#   define DEFAULT_BG DEFAULT_COLOR
+#  else
+#   define DEFAULT_FG COLOR_BLACK
+#   define DEFAULT_BG COLOR_WHITE
+#  endif
+# endif
+#else
+# ifdef USE_SLANG
+#  define DEFAULT_FG "black"
+#  define DEFAULT_BG "white"
+# else
+#  define DEFAULT_FG COLOR_BLACK
+#  define DEFAULT_BG COLOR_WHITE
+# endif
+#endif /* USE_DEFAULT_COLORS */
+
 extern int default_fg;
 extern int default_bg;
 
diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c
index 4ede9630..dfb2f211 100644
--- a/src/LYShowInfo.c
+++ b/src/LYShowInfo.c
@@ -81,9 +81,10 @@ PUBLIC int showinfo ARGS4(
 	(url_type == LYNXEXEC_URL_TYPE ||
 	 url_type == LYNXPROG_URL_TYPE)) {
 	char *last_slash = strrchr(links[doc->link].lname,'/');
-	if (last_slash-links[doc->link].lname ==
-	    	strlen(links[doc->link].lname)-1) {
-	    links[doc->link].lname[strlen(links[doc->link].lname)-1] = '\0';
+	int next_to_last = strlen(links[doc->link].lname) - 1;
+
+	if ((last_slash - links[doc->link].lname) == next_to_last) {
+	    links[doc->link].lname[next_to_last] = '\0';
 	}
     }
 
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 8a3903af..2f546f72 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -13,6 +13,7 @@
 #include "LYNews.h"
 #include "LYOptions.h"
 #include "LYCharSets.h"
+#include "HTString.h"
 
 #include <ctype.h>
 
@@ -463,7 +464,7 @@ re_read:
 	     }
 	   else
 #endif
-	     c = '\n'; /* kepad enter on pc ncsa telnet */
+	     c = '\n'; /* keypad enter on pc ncsa telnet */
 	   break;
 
 	case 'm':
@@ -982,7 +983,7 @@ PUBLIC void LYRefreshEdit ARGS1(
  *	+---------+=============+-----------+
  *	0	  DspStart		     length
  *
- *  Insertion point can be anywhere beween 0 and stringlength.
+ *  Insertion point can be anywhere between 0 and stringlength.
  *  Figure out new display starting point.
  *
  *   The first "if" below makes Lynx scroll several columns at a time when
@@ -1060,7 +1061,7 @@ PUBLIC void LYRefreshEdit ARGS1(
 PUBLIC int LYgetstr ARGS4(
 	char *, 	inputline,
 	int,		hidden,
-	int,		bufsize,
+	size_t, 	bufsize,
 	int,		recall)
 {
     int x, y, MaxStringSize;
@@ -1140,40 +1141,35 @@ again:
 }
 
 /*
- *  LYstrstr will find the first occurence of the string
+ *  LYstrstr will find the first occurrence of the string
  *  pointed to by tarptr in the string pointed to by chptr.
+ *  It returns NULL if string not found.
  *  It is a case insensitive search.
  */
 PUBLIC char * LYstrstr ARGS2(
 	char *, 	chptr,
 	char *, 	tarptr)
 {
-    register char *tmpchptr, *tmptarptr;
+    int len = strlen(tarptr);
 
     for(; *chptr != '\0'; chptr++) {
-	if(TOUPPER(*chptr) == TOUPPER(*tarptr)) {
-	    /* see if they line up */
-	    for(tmpchptr = chptr+1, tmptarptr = tarptr+1;
-		(TOUPPER(*tmpchptr) == TOUPPER(*tmptarptr) &&
-		 *tmptarptr != '\0' && *tmpchptr != '\0');
-		tmpchptr++, tmptarptr++)
-		   ; /* null body */
-	    if(*tmptarptr == '\0')
+	if (0 == UPPER8(*chptr, *tarptr)) {
+	    if (0 == strncasecomp8(chptr+1, tarptr+1, len-1))
 		return(chptr);
 	}
     } /* end for */
 
-    return(NULL);
+    return(NULL); /* string not found or initial chptr was empty */
 }
 
 /*
- *  LYno_attr_char_case_strstr will find the first occurence of the
+ *  LYno_attr_char_case_strstr will find the first occurrence of the
  *  string pointed to by tarptr in the string pointed to by chptr.
  *  It ignores the characters: LY_UNDERLINE_START_CHAR and
  *			       LY_UNDERLINE_END_CHAR
  *			       LY_BOLD_START_CHAR
  *			       LY_BOLD_END_CHAR
- *				LY_SOFT_HYPHEN
+ *			       LY_SOFT_HYPHEN
  *			       if present in chptr.
  *  It is a case insensitive search.
  */
@@ -1190,7 +1186,7 @@ PUBLIC char * LYno_attr_char_case_strstr ARGS2(
 	chptr++;
 
     for (; *chptr != '\0'; chptr++) {
-	if (TOUPPER(*chptr) == TOUPPER(*tarptr)) {
+	 if (0 == UPPER8(*chptr, *tarptr)) {
 	    /*
 	     *	See if they line up.
 	     */
@@ -1201,18 +1197,18 @@ PUBLIC char * LYno_attr_char_case_strstr ARGS2(
 		 return(chptr);
 
 	    while (1) {
-		 if (!IsSpecialAttrChar(*tmpchptr)) {
-		    if (TOUPPER(*tmpchptr) != TOUPPER(*tmptarptr))
+		if (!IsSpecialAttrChar(*tmpchptr)) {
+		    if (0 != UPPER8(*tmpchptr, *tmptarptr))
 			break;
 		    tmpchptr++;
 		    tmptarptr++;
-		 } else {
+		} else {
 		    tmpchptr++;
-		 }
-		 if (*tmptarptr == '\0')
-		     return(chptr);
-		 if (*tmpchptr == '\0')
-		     break;
+		}
+		if (*tmptarptr == '\0')
+		    return(chptr);
+		if (*tmpchptr == '\0')
+		    break;
 	    }
 	}
     } /* end for */
@@ -1221,7 +1217,7 @@ PUBLIC char * LYno_attr_char_case_strstr ARGS2(
 }
 
 /*
- *  LYno_attr_char_strstr will find the first occurence of the
+ *  LYno_attr_char_strstr will find the first occurrence of the
  *  string pointed to by tarptr in the string pointed to by chptr.
  *  It ignores the characters: LY_UNDERLINE_START_CHAR and
  *			       LY_UNDERLINE_END_CHAR
@@ -1275,10 +1271,10 @@ PUBLIC char * LYno_attr_char_strstr ARGS2(
 }
 
 /*
- * LYno_attr_mbcs_case_strstr will find the first occurence of the string
+ * LYno_attr_mbcs_case_strstr will find the first occurrence of the string
  * pointed to by tarptr in the string pointed to by chptr.
  * It takes account of MultiByte Character Sequences (UTF8).
- * The physical lenght of the displayed string up to the end of the target
+ * The physical length of the displayed string up to the end of the target
  * string is returned in *nendp if the search is successful.
  * It ignores the characters: LY_UNDERLINE_START_CHAR and
  *			      LY_UNDERLINE_END_CHAR
@@ -1317,7 +1313,7 @@ PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
 	     *chptr == *tarptr &&
 	     *(chptr + 1) != '\0' &&
 	     !IsSpecialAttrChar(*(chptr + 1))) ||
-	    TOUPPER(*chptr) == TOUPPER(*tarptr)) {
+	    (0 == UPPER8(*chptr, *tarptr))) {
 	    int tarlen = 0;
 	    offset = len;
 	    len++;
@@ -1341,7 +1337,7 @@ PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
 		 *tmpchptr != '\0' &&
 		 !IsSpecialAttrChar(*tmpchptr)) {
 		/*
-		 *  Check the CJK mutibyte. - FM
+		 *  Check the CJK multibyte. - FM
 		 */
 		if (*tmpchptr == *tmptarptr) {
 		    /*
@@ -1381,7 +1377,7 @@ PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
 			} else {
 			break;
 			}
-		    } else if (TOUPPER(*tmpchptr) != TOUPPER(*tmptarptr)) {
+		    } else if (0 != UPPER8(*tmpchptr, *tmptarptr)) {
 			break;
 		    }
 
@@ -1419,7 +1415,7 @@ PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
 }
 
 /*
- * LYno_attr_mbcs_strstr will find the first occurence of the string
+ * LYno_attr_mbcs_strstr will find the first occurrence of the string
  * pointed to by tarptr in the string pointed to by chptr.
  *  It takes account of CJK and MultiByte Character Sequences (UTF8).
  *  The physical lengths of the displayed string up to the start and
@@ -1481,7 +1477,7 @@ PUBLIC char * LYno_attr_mbcs_strstr ARGS5(
 		 *tmpchptr != '\0' &&
 		 !IsSpecialAttrChar(*tmpchptr)) {
 		/*
-		 *  Check the CJK mutibyte. - FM
+		 *  Check the CJK multibyte. - FM
 		 */
 		if (*tmpchptr == *tmptarptr) {
 		    /*
@@ -1605,3 +1601,76 @@ PUBLIC char * SNACat ARGS3(
     }
     return *dest;
 }
+
+
+#ifdef EXP_8BIT_TOUPPER
+
+/*
+**   UPPER8 ?
+**   it was "TOUPPER(a) - TOUPPER(b)" in its previous life...
+**
+**   It was realized that case-insensitive user search
+**   got information about upper/lower mapping from TOUPPER
+**   (precisely from "(TOUPPER(a) - TOUPPER(b))==0").
+**   This function depends on locale in its 8bit mapping
+**   and usually fails with DOS/WINDOWS display charsets
+**   as well as on non-UNIX systems.
+**
+**   We extend this function for 8bit letters
+**   using Lynx internal chartrans feature:
+**   we assume that upper/lower case letters
+**   have their "7bit approximation" images (in def7_uni.tbl)
+**   matched case-insensitive (7bit).
+**
+**   By this technique we cover *any* charset known for Lynx chartrans
+**   and need no extra information for it.  - LP
+**
+*/
+PUBLIC int UPPER8(int ch1, int ch2)
+{
+    /* Use exact match for speed, but mostly for stability	    */
+    /* while doing experiments with the remainder of this function. */
+    if (ch1==ch2)
+	return(0);  /* Exact match */
+
+    /* case-insensitive match for us-ascii */
+    if ((unsigned char)ch1 < 128 && (unsigned char)ch2 < 128)
+	return(TOUPPER(ch1) - TOUPPER(ch2));
+
+    /* compare "7bit approximation" for letters >127   */
+    if ((unsigned char)ch1 > 127 && (unsigned char)ch2 >127)
+    {
+	/* BTW, if we remove the check for >127 above	   */
+	/* we get even more "relaxed" insensitive match... */
+
+	CONST char *disp_charset;
+	int charset_in, charset_out, uck1, uck2;
+	char replace_buf1 [10], replace_buf2 [10];
+
+	disp_charset = LYCharSet_UC[current_char_set].MIMEname;
+	charset_in  = UCGetLYhndl_byMIME(disp_charset);
+	charset_out = UCGetLYhndl_byMIME("us-ascii");
+
+	uck1 = UCTransCharStr(replace_buf1, sizeof(replace_buf1), ch1,
+			      charset_in, charset_out, YES);
+	uck2 = UCTransCharStr(replace_buf2, sizeof(replace_buf2), ch2,
+			      charset_in, charset_out, YES);
+	/*
+	** Got both replacement strings (yippey).  - FM
+	*/
+	if (strcmp(replace_buf1, replace_buf2)!=0)  /* case-sensitive ! */
+	/*
+	** Two strings different.  We assume the different letters
+	** should not have the equal strings for "7bit approx",
+	** overwise differently accented letters may be vanished.
+	** Now we return case-INsensitive comparision of strings:
+	*/
+
+	if ((uck1 > 0) && (uck2 > 0))
+	    return (strcasecomp(replace_buf1, replace_buf2));
+    }
+
+    return(-10);  /* mismatch */
+}
+
+#endif /* EXP_8BIT_TOUPPER */
diff --git a/src/LYStrings.h b/src/LYStrings.h
index ccf1c4b0..3162ab78 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -3,6 +3,17 @@
 
 #include <string.h>
 
+#if !defined(EXP_8BIT_TOUPPER) && !defined(LOCALE) && !defined(__DJGPP__)
+#define EXP_8BIT_TOUPPER 1
+#endif
+
+#ifdef EXP_8BIT_TOUPPER
+extern int UPPER8  PARAMS((
+	int		ch1,
+	int		ch2));
+#else
+#define UPPER8(a,b) (TOUPPER(a) - TOUPPER(b))
+#endif
 extern int get_mouse_link NOPARAMS;
 extern char * LYstrncpy PARAMS((
 	char *		dst,
@@ -13,7 +24,7 @@ extern int LYgetch NOPARAMS;
 extern int LYgetstr PARAMS((
 	char *		inputline,
 	int		hidden,
-	int		bufsize,
+	size_t		bufsize,
 	int		recall));
 extern char * LYstrstr PARAMS((
 	char *		chptr,
diff --git a/src/LYStyle.c b/src/LYStyle.c
index 082f0a6b..73a55874 100644
--- a/src/LYStyle.c
+++ b/src/LYStyle.c
@@ -65,7 +65,7 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char*
 
     for (i = 0; i <7; i++)
     {
-	if (!strcasecmp(Mono_Strings[i], mono))
+	if (!strcasecomp(Mono_Strings[i], mono))
 	{
 	    mA = ncursesMono[i];
 	}
@@ -186,37 +186,37 @@ where OBJECT is one of EM,STRONG,B,I,U,BLINK etc.\n\n", buffer);
     /*
     * We use some pseudo-elements, so catch these first
     */
-    if (!strncasecmp(element, "alink", 5)) /* active link */
+    if (!strncasecomp(element, "alink", 5)) /* active link */
     {
 	parse_attributes(mono,fg,bg,DSTYLE_ALINK,"alink");
     }
-    else if (!strcasecmp(element, "a")) /* normal link */
+    else if (!strcasecomp(element, "a")) /* normal link */
     {
 	parse_attributes(mono,fg,bg, DSTYLE_LINK,"a");
 	parse_attributes(mono,fg,bg, HTML_A,"a");
     }
-    else if (!strncasecmp(element, "status", 4)) /* status bar */
+    else if (!strncasecomp(element, "status", 4)) /* status bar */
     {
 	parse_attributes(mono,fg,bg, DSTYLE_STATUS,"status");
     }
-    else if (!strncasecmp(element, "label", 6)) /* [INLINE]'s */
+    else if (!strncasecomp(element, "label", 6)) /* [INLINE]'s */
     {
 	parse_attributes(mono,fg,bg,DSTYLE_OPTION,"label");
     }
-    else if (!strncasecmp(element, "value", 5)) /* [INLINE]'s */
+    else if (!strncasecomp(element, "value", 5)) /* [INLINE]'s */
     {
 	parse_attributes(mono,fg,bg,DSTYLE_VALUE,"value");
     }
-    else if (!strncasecmp(element, "high", 4)) /* [INLINE]'s */
+    else if (!strncasecomp(element, "high", 4)) /* [INLINE]'s */
     {
 	parse_attributes(mono,fg,bg,DSTYLE_HIGH,"high");
     }
-    else if (!strcmp(element, "normal")) /* added - kw */
+    else if (!strcasecomp(element, "normal")) /* added - kw */
     {
 	parse_attributes(mono,fg,bg,DSTYLE_NORMAL,"html");
     }
     /* this may vanish */
-    else if (!strncasecmp(element, "candy", 5)) /* [INLINE]'s */
+    else if (!strncasecomp(element, "candy", 5)) /* [INLINE]'s */
     {
 	parse_attributes(mono,fg,bg,DSTYLE_CANDY,"candy");
     }
@@ -229,7 +229,7 @@ where OBJECT is one of EM,STRONG,B,I,U,BLINK etc.\n\n", buffer);
 	int i;
 	for (i = 0; i <HTML_ELEMENTS; i++)
 	{
-	    if (!strcasecmp (HTML_dtd.tags[i].name, element))
+	    if (!strcasecomp (HTML_dtd.tags[i].name, element))
 	    {
 		if (TRACE)
 		    fprintf(stderr, "PARSECSS:applying style <%s,%s,%s> for HTML_%s\n",mono,fg,bg,HTML_dtd.tags[i].name);
diff --git a/src/LYUtils.c b/src/LYUtils.c
index dd9538ba..c60ce6ed 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -1972,7 +1972,7 @@ PUBLIC void toggle_novice_line NOARGS
 }
 
 PUBLIC void noviceline ARGS1(
-	int,		more_flag)
+	int,		more_flag GCC_UNUSED)
 {
 
     if (dump_output_immediately)
@@ -2908,7 +2908,7 @@ PUBLIC BOOLEAN inlocaldomain NOARGS
 #endif	/* TERMIO_AND_TERMIOS */
 
 PUBLIC void size_change ARGS1(
-	int,		sig)
+	int,		sig GCC_UNUSED)
 {
     int old_lines = LYlines;
     int old_cols = LYcols;
@@ -4937,6 +4937,7 @@ PUBLIC CONST char * Home_Dir NOARGS
 		StrAllocCopy(HomeDir, cp);
 	    }
 #else
+#if HAVE_UTMP
 	    /*
 	     *	One could use getlogin() and getpwnam() here instead.
 	     */
@@ -4944,7 +4945,9 @@ PUBLIC CONST char * Home_Dir NOARGS
 
 	    if (pw && pw->pw_dir) {
 		StrAllocCopy(HomeDir, pw->pw_dir);
-	    } else {
+	    } else
+#endif
+	    {
 		/*
 		 *  Use /tmp; it should be writable.
 		 */
@@ -4973,7 +4976,7 @@ PUBLIC CONST char * Home_Dir NOARGS
  */
 PUBLIC BOOLEAN LYPathOffHomeOK ARGS2(
 	char *, 	fbuffer,
-	int,		fbuffer_size)
+	size_t, 	fbuffer_size)
 {
     char *file = NULL;
     char *cp, *cp1;
@@ -5146,7 +5149,7 @@ PUBLIC BOOLEAN LYPathOffHomeOK ARGS2(
  */
 PUBLIC void LYAddPathToHome ARGS3(
 	char *, 	fbuffer,
-	int,		fbuffer_size,
+	size_t, 	fbuffer_size,
 	char *, 	fname)
 {
     char *home = NULL;
@@ -5399,7 +5402,19 @@ PUBLIC time_t LYmktime ARGS2(
 	LYstrncpy(temp, start, 4);
     } else if ((s - start) == 2) {
 	now = time(NULL);
-	LYstrncpy(temp, ((char *)ctime(&now) + 20), 2);
+	/*
+	 * Assume that received 2-digit dates >= 70 are 19xx; others
+	 * are 20xx.  Only matters when dealing with broken software
+	 * (HTTP server or web page) which is not Y2K compliant.  The
+	 * line is drawn on a best-guess basis; it is impossible for
+	 * this to be completely accurate because it depends on what
+	 * the broken sender software intends.	(This totally breaks
+	 * in 2100 -- setting up the next crisis...) - BL
+	 */
+	if (atoi(start) >= 70)
+	    LYstrncpy(temp, "19", 2);
+	else
+	    LYstrncpy(temp, "20", 2);
 	strncat(temp, start, 2);
 	temp[4] = '\0';
     } else {
diff --git a/src/LYUtils.h b/src/LYUtils.h
index 9b8a8b35..cfccb4be 100644
--- a/src/LYUtils.h
+++ b/src/LYUtils.h
@@ -51,9 +51,9 @@ extern void Define_VMSLogical PARAMS((
 	char *LogicalName, char *LogicalValue));
 #endif /* VMS */
 extern CONST char *Home_Dir NOPARAMS;
-extern BOOLEAN LYPathOffHomeOK PARAMS((char *fbuffer, int fbuffer_size));
+extern BOOLEAN LYPathOffHomeOK PARAMS((char *fbuffer, size_t fbuffer_size));
 extern void LYAddPathToHome PARAMS((
-	char *fbuffer, int fbuffer_size, char *fname));
+	char *fbuffer, size_t fbuffer_size, char *fname));
 extern time_t LYmktime PARAMS((char *string, BOOL absolute));
 #if ! HAVE_PUTENV
 extern int putenv PARAMS((CONST char *string));
diff --git a/src/UCAuto.c b/src/UCAuto.c
index f131da9a..e0c95f4d 100644
--- a/src/UCAuto.c
+++ b/src/UCAuto.c
@@ -351,8 +351,8 @@ PUBLIC void UCChangeTerminalCodepage ARGS2(
  *  This is the thing that actually gets called from display_page().
  */
 PUBLIC void UCChangeTerminalCodepage ARGS2(
-	int,		newcs,
-	LYUCcharset *,	p)
+	int,		newcs GCC_UNUSED,
+	LYUCcharset *,	p GCC_UNUSED)
 {
     if (TRACE) {
 	fprintf(stderr,
diff --git a/src/UCdomap.c b/src/UCdomap.c
index 84ab6ed3..c5b3cd83 100644
--- a/src/UCdomap.c
+++ b/src/UCdomap.c
@@ -308,7 +308,7 @@ PRIVATE void UCreset_allocated_LYCharSets NOPARAMS;
 PRIVATE void UCfree_allocated_LYCharSets NOPARAMS;
 PRIVATE char ** UC_setup_LYCharSets_repl PARAMS((
 	int		UC_charset_in_hndl,
-	int		lowest8));
+	unsigned	lowest8));
 PRIVATE int UC_Register_with_LYCharSets PARAMS((
 	int		s,
 	CONST char *	UC_MIMEcharset,
@@ -1678,7 +1678,7 @@ PRIVATE void UCfree_allocated_LYCharSets NOARGS
 
 PRIVATE char ** UC_setup_LYCharSets_repl ARGS2(
 	int,		UC_charset_in_hndl,
-	int,		lowest8)
+	unsigned,	lowest8)
 {
     char **ISO_Latin1 = LYCharSets[0];
     char **p;
@@ -1687,7 +1687,8 @@ PRIVATE char ** UC_setup_LYCharSets_repl ARGS2(
     char **tp;
     char *s7;
     char *s8;
-    int i, j, changed;
+    size_t i;
+    int j, changed;
     u16 k;
     u8 *ti;
 
diff --git a/src/chrtrans/README.tables b/src/chrtrans/README.tables
index e2815707..be6dac6a 100644
--- a/src/chrtrans/README.tables
+++ b/src/chrtrans/README.tables
@@ -6,7 +6,7 @@ for some of the RFC 1345 Mnemonic codes are out of date, a cleanup and
 update would be needed for serious use.
 
 More translation files can be easily provided (and new character entities
-added to HTMLDTD.c), this set is just to test whether the system works 
+added to entities.h), this set is just to test whether the system works 
 in principle (and also how it behaves with incomplete data...)
 
 See the file README.format for a brief explanation of what's in the
diff --git a/src/chrtrans/UCkd.h b/src/chrtrans/UCkd.h
index 1497f298..1e55716e 100644
--- a/src/chrtrans/UCkd.h
+++ b/src/chrtrans/UCkd.h
@@ -56,6 +56,7 @@ struct unimapdesc_str {
 #define UC_MAXLEN_LYNXCSNAME 40
 #define UC_LEN_LYNXCSNAME 20
 
+#undef  EX_OK			/* may be defined in system headers */
 #define EX_OK		0	/* successful termination */
 #define EX_USAGE	64	/* command line usage error */
 #define EX_DATAERR	65	/* data format error */
diff --git a/src/chrtrans/cp1252_uni.tbl b/src/chrtrans/cp1252_uni.tbl
index d1ce324d..d8adb2fa 100644
--- a/src/chrtrans/cp1252_uni.tbl
+++ b/src/chrtrans/cp1252_uni.tbl
@@ -25,38 +25,38 @@ OWinLatin1 (cp1252)
 #
 #    The entries are in cp1252_WinLatin1 order
 #
-0x00    U+0000  #Null
-0x01    U+0001  #START OF HEADING
-0x02    U+0002  #START OF TEXT
-0x03    U+0003  #END OF TEXT
-0x04    U+0004  #END OF TRANSMISSION
-0x05    U+0005  #ENQUIRY
-0x06    U+0006  #ACKNOWLEDGE
-0x07    U+0007  #BELL
-0x08    U+0008  #BACKSPACE
-0x09    U+0009  #HORIZONTAL TABULATION
-0x0a    U+000a  #LINE FEED
-0x0b    U+000b  #VERTICAL TABULATION
-0x0c    U+000c  #FORM FEED
-0x0d    U+000d  #CARRIAGE RETURN
-0x0e    U+000e  #SHIFT OUT
-0x0f    U+000f  #SHIFT IN
-0x10    U+0010  #DATA LINK ESCAPE
-0x11    U+0011  #DEVICE CONTROL ONE
-0x12    U+0012  #DEVICE CONTROL TWO
-0x13    U+0013  #DEVICE CONTROL THREE
-0x14    U+0014  #DEVICE CONTROL FOUR
-0x15    U+0015  #NEGATIVE ACKNOWLEDGE
-0x16    U+0016  #SYNCHRONOUS IDLE
-0x17    U+0017  #END OF TRANSMISSION BLOCK
-0x18    U+0018  #CANCEL
-0x19    U+0019  #END OF MEDIUM
-0x1a    U+001a  #SUBSTITUTE
-0x1b    U+001b  #ESCAPE
-0x1c    U+001c  #FILE SEPARATOR
-0x1d    U+001d  #GROUP SEPARATOR
-0x1e    U+001e  #RECORD SEPARATOR
-0x1f    U+001f  #UNIT SEPARATOR
+#0x00    U+0000  #Null
+#0x01    U+0001  #START OF HEADING
+#0x02    U+0002  #START OF TEXT
+#0x03    U+0003  #END OF TEXT
+#0x04    U+0004  #END OF TRANSMISSION
+#0x05    U+0005  #ENQUIRY
+#0x06    U+0006  #ACKNOWLEDGE
+#0x07    U+0007  #BELL
+#0x08    U+0008  #BACKSPACE
+#0x09    U+0009  #HORIZONTAL TABULATION
+#0x0a    U+000a  #LINE FEED
+#0x0b    U+000b  #VERTICAL TABULATION
+#0x0c    U+000c  #FORM FEED
+#0x0d    U+000d  #CARRIAGE RETURN
+#0x0e    U+000e  #SHIFT OUT
+#0x0f    U+000f  #SHIFT IN
+#0x10    U+0010  #DATA LINK ESCAPE
+#0x11    U+0011  #DEVICE CONTROL ONE
+#0x12    U+0012  #DEVICE CONTROL TWO
+#0x13    U+0013  #DEVICE CONTROL THREE
+#0x14    U+0014  #DEVICE CONTROL FOUR
+#0x15    U+0015  #NEGATIVE ACKNOWLEDGE
+#0x16    U+0016  #SYNCHRONOUS IDLE
+#0x17    U+0017  #END OF TRANSMISSION BLOCK
+#0x18    U+0018  #CANCEL
+#0x19    U+0019  #END OF MEDIUM
+#0x1a    U+001a  #SUBSTITUTE
+#0x1b    U+001b  #ESCAPE
+#0x1c    U+001c  #FILE SEPARATOR
+#0x1d    U+001d  #GROUP SEPARATOR
+#0x1e    U+001e  #RECORD SEPARATOR
+#0x1f    U+001f  #UNIT SEPARATOR
 0x20    U+0020  #SPACE
 0x21    U+0021  #EXCLAMATION MARK
 0x22    U+0022  #QUOTATION MARK
@@ -153,8 +153,8 @@ OWinLatin1 (cp1252)
 0x7d    U+007d  #RIGHT CURLY BRACKET
 0x7e    U+007e  #TILDE
 0x7f    U+007f  #DELETE
-# 0x80    U+0080  #NOT USED
-# 0x81    U+0081  #NOT USED
+#0x80    U+0080  #NOT USED
+#0x81    U+0081  #NOT USED
 0x82    U+201a  #SINGLE LOW-9 QUOTATION MARK
 0x83    U+0192  #LATIN SMALL LETTER F WITH HOOK
 0x84    U+201e  #DOUBLE LOW-9 QUOTATION MARK
@@ -166,10 +166,10 @@ OWinLatin1 (cp1252)
 0x8a    U+0160  #LATIN CAPITAL LETTER S WITH CARON
 0x8b    U+2039  #SINGLE LEFT-POINTING ANGLE QUOTATION MARK
 0x8c    U+0152  #LATIN CAPITAL LIGATURE OE
-0x8d    U+008d  #NOT USED
-0x8e    U+008e  #NOT USED
-0x8f    U+008f  #NOT USED
-0x90    U+0090  #NOT USED
+#0x8d    U+008d  #NOT USED
+#0x8e    U+008e  #NOT USED
+#0x8f    U+008f  #NOT USED
+#0x90    U+0090  #NOT USED
 0x91    U+2018  #LEFT SINGLE QUOTATION MARK
 0x92    U+2019  #RIGHT SINGLE QUOTATION MARK
 0x93    U+201c  #LEFT DOUBLE QUOTATION MARK
@@ -182,8 +182,8 @@ OWinLatin1 (cp1252)
 0x9a    U+0161  #LATIN SMALL LETTER S WITH CARON
 0x9b    U+203a  #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
 0x9c    U+0153  #LATIN SMALL LIGATURE OE
-0x9d    U+009d  #NOT USED
-0x9e    U+009e  #NOT USED
+#0x9d    U+009d  #NOT USED
+#0x9e    U+009e  #NOT USED
 0x9f    U+0178  #LATIN CAPITAL LETTER Y WITH DIAERESIS
 0xa0    U+00a0  #NO-BREAK SPACE
 0xa1    U+00a1  #INVERTED EXCLAMATION MARK
diff --git a/src/chrtrans/def7_uni.tbl b/src/chrtrans/def7_uni.tbl
index 880e932e..0c86d234 100644
--- a/src/chrtrans/def7_uni.tbl
+++ b/src/chrtrans/def7_uni.tbl
@@ -2168,9 +2168,10 @@ U+001f:US
 U+007f:DT
 U+0080:PA
 U+0081:HO
-# most of this characters (82-9F) may be switched ON in the code
-# as windows-1252 if come silently (HTTP default is iso-latin-1,
-# but windows-1252 is superset of iso-latin-1)
+# Most of these characters (82-9F) may be inflicted on us
+# by MS FrontPages which uses Unicode notation such as &#153;
+# but there are no assigned letters in Unicode 128-159 range.
+# It is assumed in the code that those codepoints are from windows-1252.
 #U+0082:BH
 #U+0083:NH
 #U+0084:IN
diff --git a/src/chrtrans/makefile.in b/src/chrtrans/makefile.in
index 0a64fd44..c778a324 100644
--- a/src/chrtrans/makefile.in
+++ b/src/chrtrans/makefile.in
@@ -4,8 +4,9 @@
 # This may not yet work for the general case.
 # Only some dependencies included.
 #
-#
-SHELL = /bin/sh
+SHELL		= /bin/sh
+
+x		= @PROG_EXT@
 
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
@@ -76,8 +77,8 @@ default: $(FONTMAP_INC)
 
 tables: $(TABLES)
 
-makeuctb: makeuctb.o
-	$(CC) $(CC_OPTS) -o makeuctb makeuctb.o
+makeuctb$x: makeuctb.o
+	$(CC) $(CC_OPTS) -o $@ makeuctb.o
 
 makeuctb.o: $(srcdir)/UCkd.h $(srcdir)/makeuctb.c
 
@@ -96,44 +97,44 @@ makeuctb.o: $(srcdir)/UCkd.h $(srcdir)/makeuctb.c
 
 # table files listed here once again to get the make dependencies
 # right, in case makeuctb was recompiled.
-cp1250_uni.h:		$(srcdir)/cp1250_uni.tbl	makeuctb
-cp1251_uni.h:		$(srcdir)/cp1251_uni.tbl	makeuctb
-cp1252_uni.h:		$(srcdir)/cp1252_uni.tbl	makeuctb
-cp1253_uni.h:		$(srcdir)/cp1253_uni.tbl	makeuctb
-cp1255_uni.h:		$(srcdir)/cp1255_uni.tbl	makeuctb
-cp1256_uni.h:		$(srcdir)/cp1256_uni.tbl	makeuctb
-cp1257_uni.h:		$(srcdir)/cp1257_uni.tbl	makeuctb
-cp437_uni.h:		$(srcdir)/cp437_uni.tbl		makeuctb
-cp737_uni.h:		$(srcdir)/cp737_uni.tbl		makeuctb
-cp850_uni.h:		$(srcdir)/cp850_uni.tbl		makeuctb
-cp852_uni.h:		$(srcdir)/cp852_uni.tbl		makeuctb
-cp862_uni.h:		$(srcdir)/cp862_uni.tbl		makeuctb
-cp864_uni.h:		$(srcdir)/cp864_uni.tbl		makeuctb
-cp866_uni.h:		$(srcdir)/cp866_uni.tbl		makeuctb
-cp869_uni.h:		$(srcdir)/cp869_uni.tbl		makeuctb
-def7_uni.h:		$(srcdir)/def7_uni.tbl		makeuctb
-dmcs_uni.h:		$(srcdir)/dmcs_uni.tbl		makeuctb
-iso01_uni.h:		$(srcdir)/iso01_uni.tbl		makeuctb
-iso02_uni.h:		$(srcdir)/iso02_uni.tbl		makeuctb
-iso03_uni.h:		$(srcdir)/iso03_uni.tbl		makeuctb
-iso04_uni.h:		$(srcdir)/iso04_uni.tbl		makeuctb
-iso05_uni.h:		$(srcdir)/iso05_uni.tbl		makeuctb
-iso06_uni.h:		$(srcdir)/iso06_uni.tbl		makeuctb
-iso07_uni.h:		$(srcdir)/iso07_uni.tbl		makeuctb
-iso08_uni.h:		$(srcdir)/iso08_uni.tbl		makeuctb
-iso09_uni.h:		$(srcdir)/iso09_uni.tbl		makeuctb
-iso10_uni.h:		$(srcdir)/iso10_uni.tbl		makeuctb
-koi8r_uni.h:		$(srcdir)/koi8r_uni.tbl		makeuctb
-mac_uni.h:		$(srcdir)/mac_uni.tbl		makeuctb
-mnem_suni.h:		$(srcdir)/mnem_suni.tbl		makeuctb
-mnem2_suni.h:		$(srcdir)/mnem2_suni.tbl	makeuctb
-next_uni.h:		$(srcdir)/next_uni.tbl		makeuctb
-rfc_suni.h:		$(srcdir)/rfc_suni.tbl		makeuctb
-utf8_uni.h:		$(srcdir)/utf8_uni.tbl		makeuctb
-viscii_uni.h:		$(srcdir)/viscii_uni.tbl	makeuctb
+cp1250_uni.h:		$(srcdir)/cp1250_uni.tbl	makeuctb$x
+cp1251_uni.h:		$(srcdir)/cp1251_uni.tbl	makeuctb$x
+cp1252_uni.h:		$(srcdir)/cp1252_uni.tbl	makeuctb$x
+cp1253_uni.h:		$(srcdir)/cp1253_uni.tbl	makeuctb$x
+cp1255_uni.h:		$(srcdir)/cp1255_uni.tbl	makeuctb$x
+cp1256_uni.h:		$(srcdir)/cp1256_uni.tbl	makeuctb$x
+cp1257_uni.h:		$(srcdir)/cp1257_uni.tbl	makeuctb$x
+cp437_uni.h:		$(srcdir)/cp437_uni.tbl		makeuctb$x
+cp737_uni.h:		$(srcdir)/cp737_uni.tbl		makeuctb$x
+cp850_uni.h:		$(srcdir)/cp850_uni.tbl		makeuctb$x
+cp852_uni.h:		$(srcdir)/cp852_uni.tbl		makeuctb$x
+cp862_uni.h:		$(srcdir)/cp862_uni.tbl		makeuctb$x
+cp864_uni.h:		$(srcdir)/cp864_uni.tbl		makeuctb$x
+cp866_uni.h:		$(srcdir)/cp866_uni.tbl		makeuctb$x
+cp869_uni.h:		$(srcdir)/cp869_uni.tbl		makeuctb$x
+def7_uni.h:		$(srcdir)/def7_uni.tbl		makeuctb$x
+dmcs_uni.h:		$(srcdir)/dmcs_uni.tbl		makeuctb$x
+iso01_uni.h:		$(srcdir)/iso01_uni.tbl		makeuctb$x
+iso02_uni.h:		$(srcdir)/iso02_uni.tbl		makeuctb$x
+iso03_uni.h:		$(srcdir)/iso03_uni.tbl		makeuctb$x
+iso04_uni.h:		$(srcdir)/iso04_uni.tbl		makeuctb$x
+iso05_uni.h:		$(srcdir)/iso05_uni.tbl		makeuctb$x
+iso06_uni.h:		$(srcdir)/iso06_uni.tbl		makeuctb$x
+iso07_uni.h:		$(srcdir)/iso07_uni.tbl		makeuctb$x
+iso08_uni.h:		$(srcdir)/iso08_uni.tbl		makeuctb$x
+iso09_uni.h:		$(srcdir)/iso09_uni.tbl		makeuctb$x
+iso10_uni.h:		$(srcdir)/iso10_uni.tbl		makeuctb$x
+koi8r_uni.h:		$(srcdir)/koi8r_uni.tbl		makeuctb$x
+mac_uni.h:		$(srcdir)/mac_uni.tbl		makeuctb$x
+mnem_suni.h:		$(srcdir)/mnem_suni.tbl		makeuctb$x
+mnem2_suni.h:		$(srcdir)/mnem2_suni.tbl	makeuctb$x
+next_uni.h:		$(srcdir)/next_uni.tbl		makeuctb$x
+rfc_suni.h:		$(srcdir)/rfc_suni.tbl		makeuctb$x
+utf8_uni.h:		$(srcdir)/utf8_uni.tbl		makeuctb$x
+viscii_uni.h:		$(srcdir)/viscii_uni.tbl	makeuctb$x
 
 clean:
-	rm -f makeuctb *.o *uni.h *uni2.h
+	rm -f makeuctb$x *.o *uni.h *uni2.h
 
 distclean: clean
 	-rm -rf obsolete
diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c
index f1417cb7..3e0c81c5 100644
--- a/src/chrtrans/makeuctb.c
+++ b/src/chrtrans/makeuctb.c
@@ -60,7 +60,7 @@ PRIVATE void usage ARGS1(
 }
 
 /* copied from HTString.c, not everybody has strncasecmp */
-PUBLIC int strncasecomp ARGS3(
+PRIVATE int strncasecomp ARGS3(
 	CONST char*,	a,
 	CONST char *,	b,
 	int,		n)
diff --git a/src/makefile.dos b/src/makefile.dos
index df12b6cb..91ace376 100644
--- a/src/makefile.dos
+++ b/src/makefile.dos
@@ -9,7 +9,7 @@ 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

 

-CFLAGS= $(MCFLAGS) -I.. $(SLANGINC)

+CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)

 

 CC = gcc

 MCFLAGS = -O3 -DRAWDOSKEYHACK -DUSE_ZLIB -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -Ichrtrans -I../WWW/library/implementation -I../curses  -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp

diff --git a/src/makefile.in b/src/makefile.in
index e016a999..749c7a0a 100644
--- a/src/makefile.in
+++ b/src/makefile.in
@@ -2,6 +2,8 @@
 
 SHELL = /bin/sh
 
+x		= @PROG_EXT@
+
 @SET_MAKE@
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
@@ -32,8 +34,10 @@ WWWLIB		= ../WWW/Library/unix/libwww.a
 CPP_OPTS	= $(DEFS) $(CPPFLAGS) \
 		-I. \
 		-I.. \
+		-Ichrtrans \
 		-I$(srcdir)/chrtrans \
 		-I$(top_srcdir) \
+		-I$(top_srcdir)/src \
 		-I$(top_srcdir)/$(WWWINC) \
 		$(SITE_DEFS)
 CC_OPTS		= $(CPP_OPTS) $(CFLAGS)
@@ -54,7 +58,7 @@ LYStyle.o LYHash.o $(CHARTRANS_OBJS) @LIBOBJS@
 
 C_SRC	= $(OBJS:.o=.c)
 
-all: lynx
+all: lynx$x
 
 .SUFFIXES : .i
 
@@ -66,11 +70,11 @@ all: lynx
 @RULE_CC@
 	@ECHO_CC@$(CPP) -C $(CPP_OPTS) $*.c >$@
 
-lynx:   message do_chartrans_stuff $(OBJS) $(WWWLIB)
+lynx$x:   message do_chartrans_stuff $(OBJS) $(WWWLIB)
 	@echo "Linking and creating Lynx executable"
-	$(CC) $(CC_OPTS) $(LDFLAGS) -o lynx  $(OBJS) $(WWWLIB) $(LIBS)
+	$(CC) $(CC_OPTS) $(LDFLAGS) -o $@  $(OBJS) $(WWWLIB) $(LIBS)
 	@echo "Copying Lynx executable into top-level directory"
-	cp lynx ..
+	cp $@ ..
 	@echo "Welcome to Lynx!"
 
 message:
@@ -87,7 +91,7 @@ lint:
 	$(LINT) $(LINTOPTS) $(CPP_OPTS) *.c  > ../lint.out
 
 clean:
-	rm -f lynx core *.[ob] *.bak
+	rm -f lynx$x core *.[ob] *.bak
 	cd chrtrans && $(MAKE) clean
 
 distclean: clean