about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-01-02 18:12:23 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1998-01-02 18:12:23 -0500
commit55ebd12c7fa4c97b88a5ca39320ac5d39c13ead0 (patch)
tree3db71bfe46ed30cb00c3429112923496412c8d5a /src
parentb6c832d07f5a1c68607a9cff0da25cee0de89dad (diff)
downloadlynx-snapshots-55ebd12c7fa4c97b88a5ca39320ac5d39c13ead0.tar.gz
snapshot of project "lynx", label v2-7-1ac_0-105
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c17
-rw-r--r--src/HTFWriter.c9
-rw-r--r--src/HTML.c207
-rw-r--r--src/LYCharUtils.c7
-rw-r--r--src/LYClean.c7
-rw-r--r--src/LYCookie.c93
-rw-r--r--src/LYCurses.c5
-rw-r--r--src/LYExtern.c11
-rw-r--r--src/LYGlobalDefs.h1
-rw-r--r--src/LYKeymap.c5
-rw-r--r--src/LYKeymap.h7
-rw-r--r--src/LYList.c56
-rw-r--r--src/LYMail.c1122
-rw-r--r--src/LYMain.c140
-rw-r--r--src/LYMainLoop.c383
-rw-r--r--src/LYOptions.c8
-rw-r--r--src/LYPrint.c436
-rw-r--r--src/LYReadCFG.c7
-rw-r--r--src/LYStrings.c67
-rw-r--r--src/LYexit.c8
-rw-r--r--src/LYrcFile.c8
-rw-r--r--src/Makefile.old41
-rw-r--r--src/UCAuto.c29
-rw-r--r--src/UCAux.c4
-rw-r--r--src/UCdomap.c314
-rw-r--r--src/chrtrans/MAKEW32.BAT46
-rw-r--r--src/chrtrans/Makefile.old111
-rw-r--r--src/chrtrans/build-chrtrans.com14
-rw-r--r--src/chrtrans/cp1250_uni.tbl2
-rw-r--r--src/chrtrans/cp1251_uni.tbl2
-rw-r--r--src/chrtrans/cp1252_uni.tbl2
-rw-r--r--src/chrtrans/cp1257_uni.tbl278
-rw-r--r--src/chrtrans/cp775_uni.tbl281
-rw-r--r--src/chrtrans/makefile.dos110
-rw-r--r--src/chrtrans/makefile.in114
-rw-r--r--src/chrtrans/mnem2_suni.tbl1903
-rw-r--r--src/chrtrans/next_uni.tbl8
-rw-r--r--src/chrtrans/utf8_uni.tbl2
-rw-r--r--src/descrip.mms2
-rw-r--r--src/makefile.dos2
-rw-r--r--src/makefile.in42
41 files changed, 4666 insertions, 1245 deletions
diff --git a/src/GridText.c b/src/GridText.c
index 1848efa4..2b8fa027 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1112,20 +1112,8 @@ PRIVATE void display_page ARGS3(
 	 *  Currently implemented only for LINUX
 	 */
 	stop_curses();
-	if (LYTraceLogFP)
-	    /*
-	     *  Set stderr back to its original value,
-	     *  because the current UCChangeTerminalCodepage()
-	     *  writes escape sequences to stderr. - KW
-	     */
-	    *stderr = LYOrigStderr;
 	UCChangeTerminalCodepage(current_char_set,
 				 &LYCharSet_UC[current_char_set]);
-	if (LYTraceLogFP)
-	    /*
-	     *  Set stderr back to the log file on return.
-	     */
-	    *stderr = *LYTraceLogFP;
 	start_curses();
 #endif /* LINUX */
 #endif /* EXP_CHARTRANS_AUTOSWITCH */
@@ -1787,9 +1775,10 @@ PRIVATE void split_line ARGS2(
 		    "........... ", previous->data);
     }
     if (line->numstyles > 0 && line->numstyles < MAX_STYLES_ON_LINE) {
+	int n;
 	inew ++;
-	memmove(line->styles, &line->styles[inew],
-		line->numstyles * sizeof(line->styles[0]));
+	for (n = line->numstyles; n >= 0; n--)
+		line->styles[n + inew] = line->styles[n];
     } else
 	if (line->numstyles == 0)
 	/* FIXME: RJP - shouldn't use 0xffffffff for largest integer */
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index a6295ee9..a67a6a9d 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -117,6 +117,9 @@ PRIVATE void HTFWriter_write ARGS3(HTStream *, me, CONST char*, s, int, l)
 }
 
 
+extern int HTLoadFile PARAMS((
+	CONST char *addr,	HTParentAnchor *anchor,
+	HTFormat format_out,	HTStream *sink));
 
 
 /*	Free an HTML object
@@ -133,9 +136,6 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
     char *path = NULL;
     char *addr = NULL;
     int status;
-    extern int HTLoadFile PARAMS((
-    	CONST char *addr,	HTParentAnchor *anchor,
-	HTFormat format_out,	HTStream *sink));
     BOOL use_gzread = NO;
 
     fflush(me->fp);
@@ -868,7 +868,8 @@ SaveToFile_tempname:
 
     StrAllocCopy(anchor->FileCache, fnam);
 Prepend_BASE:
-    if (!strncasecomp(pres->rep->name, "text/html", 9) &&
+    if (LYPrependBaseToSource &&
+        !strncasecomp(pres->rep->name, "text/html", 9) &&
 	!anchor->content_encoding) {
         /*
 	 *  Add the document's base as a BASE tag at the top of the file,
diff --git a/src/HTML.c b/src/HTML.c
index a21fee2c..b769c3ad 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -206,10 +206,10 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
      *  Handle SGML_LITTERAL tags that have HTChunk elements. - FM
      */
     switch (me->sp[0].tag_number) {
- 
+
     case HTML_COMMENT:
     	return;	/* Do Nothing */
-	
+
     case HTML_TITLE:
         if (c == LY_SOFT_HYPHEN)
 	    return;
@@ -227,16 +227,16 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
 	HTChunkPutc(&me->script, c);
         return;
 
-    case HTML_OBJECT:	
+    case HTML_OBJECT:
     	HTChunkPutc(&me->object, c);
 	return;
 
-    case HTML_TEXTAREA:	
+    case HTML_TEXTAREA:
     	HTChunkPutc(&me->textarea, c);
 	return;
 
-    case HTML_SELECT:	
-    case HTML_OPTION:	
+    case HTML_SELECT:
+    case HTML_OPTION:
     	HTChunkPutc(&me->option, c);
 	return;
 
@@ -269,7 +269,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
      *  Handle all other tag content. - FM
      */
     switch (me->sp[0].tag_number) {
- 
+
     case HTML_PRE:				/* Formatted text */
 	/*
 	 *  We guarrantee that the style is up-to-date in begin_litteral
@@ -279,7 +279,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
 	    !(c == '\n' && me->inLABEL && !me->inP) &&
 	    !(c == '\n' && !me->inPRE)) {
 	    me->inP = TRUE;
-	    me->inLABEL = FALSE; 
+	    me->inLABEL = FALSE;
 	    HText_appendCharacter(me->text, c);
 	}
 	me->inPRE = TRUE;
@@ -294,11 +294,11 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
 	 */
 	if (c != '\r')	{
 	    me->inP = TRUE;
-	    me->inLABEL = FALSE; 
+	    me->inLABEL = FALSE;
 	    HText_appendCharacter(me->text, c);
 	}
 	break;
-	
+
     default:
         /*
 	 *  Free format text.
@@ -307,8 +307,8 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
 	    if (c != '\r' &&
 	        !(c == '\n' && me->inLABEL && !me->inP) &&
 		!(c == '\n' && !me->inPRE)) {
-		me->inP = TRUE; 
-		me->inLABEL = FALSE; 
+		me->inP = TRUE;
+		me->inLABEL = FALSE;
 	        HText_appendCharacter(me->text, c);
 	    }
 	    me->inPRE = TRUE;
@@ -316,11 +316,11 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
 	} else if (!strcmp(me->sp->style->name,"Listing") ||
 		   !strcmp(me->sp->style->name,"Example")) {
 	    if (c != '\r') {
-		me->inP = TRUE; 
-		me->inLABEL = FALSE; 
+		me->inP = TRUE;
+		me->inLABEL = FALSE;
 	        HText_appendCharacter(me->text, c);
 	    }
-	
+
 	} else {
 	    if (me->style_change) {
 	        if ((c == '\n') || (c == ' '))
@@ -340,7 +340,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
 	    } else if (c == ' ' || c == '\t') {
 	        if (HText_getLastChar(me->text) != ' ') {
 		    me->inP = TRUE;
-		    me->inLABEL = FALSE; 
+		    me->inLABEL = FALSE;
 	            HText_appendCharacter(me->text, ' ');
 		}
 
@@ -386,7 +386,7 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
 
     case HTML_COMMENT:
     	break;					/* Do Nothing */
-	
+
     case HTML_TITLE:
     	HTChunkPuts(&me->title, s);
 	break;
@@ -408,20 +408,20 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
 	 */
     	HText_appendText(me->text, s);
 	break;
-	
-    case HTML_OBJECT:	
+
+    case HTML_OBJECT:
     	HTChunkPuts(&me->object, s);
 	break;
 
-    case HTML_TEXTAREA:	
+    case HTML_TEXTAREA:
     	HTChunkPuts(&me->textarea, s);
 	break;
 
-    case HTML_SELECT:	
-    case HTML_OPTION:	
+    case HTML_SELECT:
+    case HTML_OPTION:
     	HTChunkPuts(&me->option, s);
 	break;
-	
+
     case HTML_MATH:
     	HTChunkPuts(&me->math, s);
 	break;
@@ -458,7 +458,7 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
 		    c = *p;
 		}
 		if (me->style_change) {
-		    if ((c == '\n') || (c == ' ') || (c == '\t')) 
+		    if ((c == '\n') || (c == ' ') || (c == '\t'))
 			continue;  /* Ignore it */
 		    UPDATE_STYLE;
 		}
@@ -472,7 +472,7 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
 		} else if (c == ' ' || c == '\t') {
 		   if (HText_getLastChar(me->text) != ' ')
 			HText_appendCharacter(me->text, ' ');
-			
+
 		} else if (c == '\r') {
 			/* ignore */
 		} else {
@@ -486,7 +486,7 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
         	    HText_setLastChar(me->text, ' ');
     		} else if (c == '\r' &&
 			   HText_getLastChar(me->text) == ' ') {
-		    /* 
+		    /*
 		     *  \r's are ignored.  In order to keep collapsing
 		     *  spaces correctly, we must default back to the
 		     *  previous seperator, if there was one.  So we
@@ -568,7 +568,7 @@ PUBLIC void HTML_write ARGS3(HTStructured *, me, CONST char*, s, int, l)
    string (resolution of relative URLs etc.). This variable only used
    locally here, don't confuse with LYinternal_flag which is for
    for overriding non-caching similar to LYoverride_no_cache. - kw */
-#define CHECK_FOR_INTERN(s) intern_flag = (s && (*s=='#' || *s=='\0')) ? TRUE : FALSE; 
+#define CHECK_FOR_INTERN(s) intern_flag = (s && (*s=='#' || *s=='\0')) ? TRUE : FALSE;
 
 /* Last argument to pass to HTAnchor_findChildAndLink() calls,
    just an abbreviation. - kw */
@@ -770,7 +770,7 @@ PRIVATE void HTML_start_element ARGS6(
     }
 #endif /* USE_COLOR_STYLE */
 
-#if 0 
+#if 0
 	me->inStyle[element_number]=1; /* this is a goodthing(tm) */
 #endif
 
@@ -823,12 +823,12 @@ PRIVATE void HTML_start_element ARGS6(
 		}
 	    }
 
-	    /* 
+	    /*
 	     *  Get parent's address for defaulted fields.
 	     */
 	    StrAllocCopy(related, me->node_anchor->address);
 
-	    /* 
+	    /*
 	     *  Create the access field.
 	     */
 	    if ((temp = HTParse(base, related,
@@ -884,6 +884,7 @@ PRIVATE void HTML_start_element ARGS6(
 	    FREE(base);
 
             me->inBASE = TRUE;
+	    StrAllocCopy(me->node_anchor->content_base, me->base_href);
 	}
 	break;
 
@@ -974,7 +975,7 @@ PRIVATE void HTML_start_element ARGS6(
 		    /*
 		     *  Load the RevTitle element if a TITLE attribute
 		     *  and value are present. - FM
-		     */ 
+		     */
 		    if (present && present[HTML_LINK_TITLE] &&
 		        value[HTML_LINK_TITLE] &&
 			*value[HTML_LINK_TITLE] != '\0') {
@@ -1121,7 +1122,7 @@ PRIVATE void HTML_start_element ARGS6(
 	        StrAllocCopy(href, helpfile);
 	    } else if (!strcasecomp(value[HTML_LINK_REL], "Index")) {
 	        StrAllocCopy(href, indexfile);
-	    } else { 
+	    } else {
 	        if (TRACE) {
 		    fprintf(stderr,
 			    "HTML: LINK with REL=\"%s\" and no HREF ignored.\n",
@@ -1136,7 +1137,7 @@ PRIVATE void HTML_start_element ARGS6(
 	     *  Create a title (link name) from the TITLE value,
 	     *  if present, or default to the REL value that was
 	     *  loaded into title. - FM
-	     */ 
+	     */
 	    if (present && present[HTML_LINK_TITLE] &&
 		value[HTML_LINK_TITLE] && *value[HTML_LINK_TITLE] != '\0') {
 		StrAllocCopy(title, value[HTML_LINK_TITLE]);
@@ -1233,7 +1234,7 @@ PRIVATE void HTML_start_element ARGS6(
 	    }
 	    else
 		HTML_put_string(me, title);
-#else	
+#else
 	    HTML_put_string(me, title);
 #endif
 	    if (me->inBoldH == FALSE)
@@ -1553,7 +1554,7 @@ PRIVATE void HTML_start_element ARGS6(
 	if (me->Division_Level < (MAX_NESTING - 1)) {
 	    me->Division_Level++;
 	} else if (TRACE) {
-            fprintf(stderr, 
+            fprintf(stderr,
 		"HTML: ****** Maximum nesting of %d divisions exceeded!\n",
             	MAX_NESTING);
 	}
@@ -1671,7 +1672,7 @@ PRIVATE void HTML_start_element ARGS6(
 	}
 	UPDATE_STYLE;
 	CHECK_ID(HTML_H_ID);
-	    
+
 	if ((bold_headers == TRUE ||
 	     (ElementNumber == HTML_H1 && bold_H1 == TRUE)) &&
 	    (styles[ElementNumber]->font&HT_BOLD)) {
@@ -1716,7 +1717,7 @@ PRIVATE void HTML_start_element ARGS6(
 	    }
 	} else if (me->sp[0].tag_number == HTML_ADDRESS) {
 	    /*
-	     *  We're in an ADDRESS. Treat P as an instruction 
+	     *  We're in an ADDRESS. Treat P as an instruction
 	     *  to start a newline, if needed, then fall through
 	     *  to handle attributes. - FM
 	     */
@@ -2026,7 +2027,7 @@ PRIVATE void HTML_start_element ARGS6(
     case HTML_BLINK:
     case HTML_I:
     case HTML_U:
-    
+
     case HTML_CITE:			/* Logical character highlighting */
     case HTML_EM:
     case HTML_STRONG:
@@ -2052,7 +2053,7 @@ PRIVATE void HTML_start_element ARGS6(
 	        fprintf(stderr,"Underline Level is %d\n", me->Underline_Level);
 	}
     	break;
-	
+
     case HTML_ABBREV:	/* Miscellaneous character containers */
     case HTML_ACRONYM:
     case HTML_AU:
@@ -2206,13 +2207,13 @@ PRIVATE void HTML_start_element ARGS6(
 
 	} else {
             change_paragraph_style(me, present && present[HTML_DL_COMPACT]
-    		 ? styles[(HTML_DLC1 - 1) + me->List_Nesting_Level] 
+    		 ? styles[(HTML_DLC1 - 1) + me->List_Nesting_Level]
 		 : styles[(HTML_DL1 - 1) + me->List_Nesting_Level]);
 	}
 	UPDATE_STYLE;	  /* update to the new style */
 	CHECK_ID(HTML_DL_ID);
 	break;
-	
+
     case HTML_DLC:
         me->List_Nesting_Level++;  /* increment the List nesting level */
         if (me->List_Nesting_Level <= 0) {
@@ -2222,7 +2223,7 @@ PRIVATE void HTML_start_element ARGS6(
             change_paragraph_style(me, styles[HTML_DLC6]);
 
         } else {
-            change_paragraph_style(me, 
+            change_paragraph_style(me,
                             styles[(HTML_DLC1 - 1) + me->List_Nesting_Level]);
         }
 	UPDATE_STYLE;	  /* update to the new style */
@@ -2270,7 +2271,7 @@ PRIVATE void HTML_start_element ARGS6(
 	 *  Check whether we have a starting sequence number,
 	 *  or want to continue the numbering from a previous
 	 *  OL in this nest. - FM
-	 */ 
+	 */
         if (present && (present[HTML_OL_SEQNUM] || present[HTML_OL_START])) {
 	    int seqnum;
 
@@ -2359,7 +2360,7 @@ PRIVATE void HTML_start_element ARGS6(
        	    change_paragraph_style(me, styles[HTML_OL6]);
 
 	} else {
-            change_paragraph_style(me, 
+            change_paragraph_style(me,
 		          styles[HTML_OL1 + me->List_Nesting_Level - 1]);
 	}
 	UPDATE_STYLE;  /* update to the new style */
@@ -2396,10 +2397,10 @@ PRIVATE void HTML_start_element ARGS6(
 	        !(present && present[HTML_UL_TYPE] &&
 		  value[HTML_UL_TYPE] &&
 		  0==strcasecomp(value[HTML_UL_TYPE], "PLAIN"))) {
-                change_paragraph_style(me, 
+                change_paragraph_style(me,
 		          styles[HTML_OL1 + me->List_Nesting_Level - 1]);
 	    } else {
-                change_paragraph_style(me, 
+                change_paragraph_style(me,
 		          styles[HTML_MENU1 + me->List_Nesting_Level - 1]);
 		ElementNumber = HTML_DIR;
 	    }
@@ -2419,13 +2420,13 @@ PRIVATE void HTML_start_element ARGS6(
        	    change_paragraph_style(me, styles[HTML_MENU6]);
 
 	} else {
-            change_paragraph_style(me, 
+            change_paragraph_style(me,
 		          styles[HTML_MENU1 + me->List_Nesting_Level - 1]);
 	}
 	UPDATE_STYLE;  /* update to the new style */
 	CHECK_ID(HTML_UL_ID);
 	break;
-	
+
     case HTML_LH:
         UPDATE_STYLE;  /* update to the new style */
 	HText_appendParagraph(me->text);
@@ -2554,7 +2555,7 @@ PRIVATE void HTML_start_element ARGS6(
 		case 6:
 	    	    HTML_put_character(me, '=');
 		    break;
-		    
+
 	    }
 	    /*
 	     *  Keep using HTML_put_character so that any other
@@ -2751,7 +2752,7 @@ PRIVATE void HTML_start_element ARGS6(
 		(HTLinkType*)HTAtom_for(temp) : INTERN_LT);  /* Type */
 	FREE(temp);
 	FREE(id_string);
-	    
+
 	if (me->CurrentA && present) {
 	    if (present[HTML_A_TITLE] &&
 	        value[HTML_A_TITLE] && *value[HTML_A_TITLE] != '\0') {
@@ -3343,7 +3344,7 @@ PRIVATE void HTML_start_element ARGS6(
 	dest = NULL;
 	dest_ismap = FALSE;
 	break;
-    
+
     case HTML_MAP:
 	/*
 	 *  Load id_string if we have a NAME or ID. - FM
@@ -4226,7 +4227,7 @@ PRIVATE void HTML_start_element ARGS6(
 	    char * method = NULL;
 	    char * enctype = NULL;
 	    CONST char * accept_cs = NULL;
-	    
+
 	    HTChildAnchor * source;
 	    HTAnchor *link_dest;
 
@@ -4299,7 +4300,7 @@ PRIVATE void HTML_start_element ARGS6(
 		}
 	    }
 	    if (action) {
-	        source = HTAnchor_findChildAndLink(me->node_anchor, 
+	        source = HTAnchor_findChildAndLink(me->node_anchor,
 						   NULL,
 						   action,
 						   (HTLinkType*)0);
@@ -4511,7 +4512,7 @@ PRIVATE void HTML_start_element ARGS6(
 		while (len > 0 && I.value[len] == ' ')
 		    I.value[len--] = '\0';
 	    }
-		
+
 	    if (present && present[HTML_BUTTON_DISABLED])
 		I.disabled = YES;
 
@@ -4825,7 +4826,7 @@ PRIVATE void HTML_start_element ARGS6(
 		BOOLEAN CurrentUseDefaultRawMode = LYUseDefaultRawMode;
 		HTCJKlang CurrentHTCJK = HTCJK;
 		int len;
-		
+
 		if (I.type && !strcasecomp(I.type, "hidden")) {
 		    me->HiddenValue = TRUE;
 		    current_char_set = 0;	/* Default ISO-Latin1 */
@@ -4874,7 +4875,7 @@ PRIVATE void HTML_start_element ARGS6(
 		        I.value[len--] = '\0';
 		}
 		me->UsePlainSpace = FALSE;
-		
+
 
 		if (I.type && !strcasecomp(I.type, "hidden")) {
 		    me->HiddenValue = FALSE;
@@ -5083,7 +5084,7 @@ PRIVATE void HTML_start_element ARGS6(
 	    break;
 	}
 
-	/* 
+	/*
 	 *  Set to know we are in a textarea.
 	 */
 	me->inTEXTAREA = TRUE;
@@ -5116,14 +5117,14 @@ PRIVATE void HTML_start_element ARGS6(
 
 	if (present && present[HTML_TEXTAREA_COLS] &&
 	    value[HTML_TEXTAREA_COLS] &&
-	    isdigit((unsigned char)*value[HTML_TEXTAREA_COLS]))  
+	    isdigit((unsigned char)*value[HTML_TEXTAREA_COLS]))
 	    StrAllocCopy(me->textarea_cols, value[HTML_TEXTAREA_COLS]);
 	else
 	    StrAllocCopy(me->textarea_cols, "60");
 
 	if (present && present[HTML_TEXTAREA_ROWS] &&
 	    value[HTML_TEXTAREA_ROWS] &&
-	    isdigit((unsigned char)*value[HTML_TEXTAREA_ROWS]))  
+	    isdigit((unsigned char)*value[HTML_TEXTAREA_ROWS]))
 	    me->textarea_rows = atoi(value[HTML_TEXTAREA_ROWS]);
 	else
 	    me->textarea_rows = 4;
@@ -5238,9 +5239,9 @@ PRIVATE void HTML_start_element ARGS6(
 		StrAllocCopy(name, value[HTML_SELECT_NAME]);
 		UNESCAPE_FIELDNAME_TO_STD(&name);
 	    }
-	    if (present && present[HTML_SELECT_MULTIPLE])  
+	    if (present && present[HTML_SELECT_MULTIPLE])
 		multiple=YES;
-	    if (present && present[HTML_SELECT_DISABLED])  
+	    if (present && present[HTML_SELECT_DISABLED])
 		me->select_disabled = TRUE;
 	    if (present && present[HTML_SELECT_SIZE] &&
 	        value[HTML_SELECT_SIZE] && *value[HTML_SELECT_SIZE]) {
@@ -5376,7 +5377,7 @@ PRIVATE void HTML_start_element ARGS6(
 		I.value_cs = current_char_set;
 
 	        I.type = "OPTION";
-    
+
 	        if ((present && present[HTML_OPTION_SELECTED]) ||
 		    (me->first_option && LYSelectPopups == FALSE &&
 		     HTCurSelectGroupType == F_RADIO_TYPE))
@@ -5442,7 +5443,7 @@ PRIVATE void HTML_start_element ARGS6(
 		}
 
 	        HText_beginInput(me->text, me->inUnderline, &I);
-    
+
 		if (HTCurSelectGroupType == F_CHECKBOX_TYPE) {
 	            /*
 		     *  Put a "[_]" placeholder, and one space
@@ -5572,7 +5573,7 @@ PRIVATE void HTML_start_element ARGS6(
 	if (me->Division_Level < (MAX_NESTING - 1)) {
 	    me->Division_Level++;
 	} else if (TRACE) {
-            fprintf(stderr, 
+            fprintf(stderr,
 	    "HTML: ****** Maximum nesting of %d divisions/tables exceeded!\n",
             	    MAX_NESTING);
 	}
@@ -5672,7 +5673,7 @@ PRIVATE void HTML_start_element ARGS6(
         UPDATE_STYLE;
 	CHECK_ID(HTML_TR_ID);
         break;
-    
+
     case HTML_COL:
     case HTML_COLGROUP:
         /*
@@ -5689,7 +5690,7 @@ PRIVATE void HTML_start_element ARGS6(
         UPDATE_STYLE;
 	CHECK_ID(HTML_COL_ID);
         break;
-    
+
     case HTML_TH:
 	if (me->inA) {
 	    SET_SKIP_STACK(HTML_A);
@@ -5754,10 +5755,10 @@ PRIVATE void HTML_start_element ARGS6(
 	if (me->sp == me->stack) {
 	    if (me->stack_overrun == FALSE) {
 		if (TRACE) {
-		    fprintf(stderr, 
+		    fprintf(stderr,
 			"HTML: ****** Maximum nesting of %d tags exceeded!\n",
 			MAX_NESTING);
-	    
+
 		} else {
 		    HTAlert(HTML_STACK_OVERRUN);
 		}
@@ -5773,7 +5774,7 @@ PRIVATE void HTML_start_element ARGS6(
 	if (TRACE)
 	    fprintf(stderr,"HTML:begin_element: adding style to stack - %s\n",
 							me->new_style->name);
-    }	
+    }
 
 #if defined(USE_COLOR_STYLE)
 /* end empty tags straight away */
@@ -5848,7 +5849,7 @@ PRIVATE void HTML_end_element ARGS3(
 #ifdef CAREFUL			/* parser assumed to produce good nesting */
     if (element_number != me->sp[0].tag_number &&
         HTML_dtd.tags[element_number].contents != SGML_EMPTY) {
-        fprintf(stderr, 
+        fprintf(stderr,
 		"HTMLText: end of element %s when expecting end of %s\n",
 		HTML_dtd.tags[element_number].name,
 		HTML_dtd.tags[me->sp->tag_number].name);
@@ -6055,7 +6056,7 @@ PRIVATE void HTML_end_element ARGS3(
 	    }
 	}
 	break;
-	
+
     case HTML_STYLE:
 	if (!me->text)
 	    UPDATE_STYLE;
@@ -6215,7 +6216,7 @@ PRIVATE void HTML_end_element ARGS3(
 	    }
 	} else if (me->sp[0].tag_number == HTML_ADDRESS) {
 	    /*
-	     *  We're in an ADDRESS. Treat </P> as an instruction 
+	     *  We're in an ADDRESS. Treat </P> as an instruction
 	     *  to start a newline, if needed. - kw
 	     */
 	    if (HText_LastLineSize(me->text, FALSE)) {
@@ -6267,7 +6268,7 @@ PRIVATE void HTML_end_element ARGS3(
     case HTML_BLINK:
     case HTML_I:
     case HTML_U:
-    
+
     case HTML_CITE:			/* Logical character highlighting */
     case HTML_EM:
     case HTML_STRONG:
@@ -6295,7 +6296,7 @@ PRIVATE void HTML_end_element ARGS3(
 	        fprintf(stderr,"Underline Level is %d\n", me->Underline_Level);
 	}
     	break;
-	
+
     case HTML_ABBREV:	/* Miscellaneous character containers */
     case HTML_ACRONYM:
     case HTML_AU:
@@ -6844,7 +6845,7 @@ End_Object:
 	 *  and in that case SGML_character() in SGML.c is
 	 *  not able to ensure correct nesting; or it may have
 	 *  failed to enforce valid nesting.  If a SELECT is open,
-	 *  issue a message, then 
+	 *  issue a message, then
 	 *  call HTML_end_element() directly (with a
 	 *  check in that to bypass decrementing of the HTML
 	 *  parser's stack) to close the SELECT. - kw
@@ -7142,7 +7143,7 @@ End_Object:
 		     */
 		    for (i = 0; i < 6; i++) {
 		        if (*ptr == ' ')
-	    	            HText_appendCharacter(me->text,HT_NON_BREAK_SPACE); 
+	    	            HText_appendCharacter(me->text,HT_NON_BREAK_SPACE);
 		        else
 	    	            HText_appendCharacter(me->text,*ptr);
 			ptr++;
@@ -7151,7 +7152,7 @@ End_Object:
 	        }
 	        for (; ptr && *ptr != '\0'; ptr++) {
 		    if (*ptr == ' ')
-	    	        HText_appendCharacter(me->text,HT_NON_BREAK_SPACE); 
+	    	        HText_appendCharacter(me->text,HT_NON_BREAK_SPACE);
 		    else
 	    	        HText_appendCharacter(me->text,*ptr);
 		}
@@ -7163,7 +7164,7 @@ End_Object:
 		    HText_setLastChar(me->text, ']');
 		    me->in_word = YES;
 		}
-		HText_setIgnoreExcess(me->text, FALSE); 
+		HText_setIgnoreExcess(me->text, FALSE);
 	    }
     	    HTChunkClear(&me->option);
 
@@ -7251,7 +7252,7 @@ End_Object:
     default:
 	change_paragraph_style(me, me->sp->style);  /* Often won't really change */
 	break;
-	
+
     } /* switch */
 #ifdef USE_COLOR_STYLE
     {
@@ -7309,11 +7310,11 @@ End_Object:
 PUBLIC int HTML_put_entity ARGS2(HTStructured *, me, int, entity_number)
 {
     int nent = HTML_dtd.number_of_entities;
-  
-    if (entity_number < nent) {		
+
+    if (entity_number < nent) {
 	HTML_put_string(me, p_entity_values[entity_number]);
 	return HT_OK;
-#ifdef EXP_CHARTRANS	
+#ifdef EXP_CHARTRANS
     } else if (me->UCLYhndl < 0) {
 	return HT_CANNOT_TRANSLATE;
     } else {
@@ -7345,7 +7346,7 @@ PUBLIC int HTML_put_entity ARGS2(HTStructured *, me, int, entity_number)
 **	of document, so we don't.
 **
 **	If non-interactive, everything is freed off.   No: crashes -listrefs
-**	Otherwise, the interactive object is left.	
+**	Otherwise, the interactive object is left.
 */
 PRIVATE void HTML_free ARGS1(HTStructured *, me)
 {
@@ -7379,7 +7380,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
 	 *
 	 *  IF those tags are not declared SGML_EMPTY, but we let
 	 *  the SGML.c parser take care of correctly stacked ordering,
-	 *  and of correct wind-down on end-of-stream (in SGML_free 
+	 *  and of correct wind-down on end-of-stream (in SGML_free
 	 *  SGML_abort),
 	 *  THEN these and other checks here in HTML.c should not be
 	 *  necessary.  Still it can't hurt to include them. - kw
@@ -7674,14 +7675,14 @@ PRIVATE void get_styles NOARGS
     styles[HTML_OL6] =		HTStyleNamed(styleSheet, "List6");
 
     styles[HTML_MENU] =
-    styles[HTML_DIR] =		HTStyleNamed(styleSheet, "Menu");    
+    styles[HTML_DIR] =		HTStyleNamed(styleSheet, "Menu");
 	/* nested list styles */
-    styles[HTML_MENU1] =	HTStyleNamed(styleSheet, "Menu1");    
-    styles[HTML_MENU2] =	HTStyleNamed(styleSheet, "Menu2");    
-    styles[HTML_MENU3] =	HTStyleNamed(styleSheet, "Menu3");    
-    styles[HTML_MENU4] =	HTStyleNamed(styleSheet, "Menu4");    
-    styles[HTML_MENU5] =	HTStyleNamed(styleSheet, "Menu5");    
-    styles[HTML_MENU6] =	HTStyleNamed(styleSheet, "Menu6");    
+    styles[HTML_MENU1] =	HTStyleNamed(styleSheet, "Menu1");
+    styles[HTML_MENU2] =	HTStyleNamed(styleSheet, "Menu2");
+    styles[HTML_MENU3] =	HTStyleNamed(styleSheet, "Menu3");
+    styles[HTML_MENU4] =	HTStyleNamed(styleSheet, "Menu4");
+    styles[HTML_MENU5] =	HTStyleNamed(styleSheet, "Menu5");
+    styles[HTML_MENU6] =	HTStyleNamed(styleSheet, "Menu6");
 
     styles[HTML_DLC] =		HTStyleNamed(styleSheet, "GlossaryCompact");
 	/* nested list styles */
@@ -7711,14 +7712,14 @@ PRIVATE void get_styles NOARGS
 **	-----------------------
 */
 PUBLIC CONST HTStructuredClass HTMLPresentation = /* As opposed to print etc */
-{		
+{
 	"Lynx_HTML_Handler",
 	HTML_free,
 	HTML_abort,
 	HTML_put_character, 	HTML_put_string,  HTML_write,
 	HTML_start_element, 	HTML_end_element,
 	HTML_put_entity
-}; 
+};
 
 /*		New Structured Text object
 **		--------------------------
@@ -7733,7 +7734,7 @@ PUBLIC HTStructured* HTML_new ARGS3(
 {
 
     HTStructured * me;
-   
+
     if (format_out != WWW_PLAINTEXT && format_out != WWW_PRESENT) {
         HTStream * intermediate = HTStreamStack(WWW_HTML, format_out,
 						stream, anchor);
@@ -7794,7 +7795,7 @@ PUBLIC HTStructured* HTML_new ARGS3(
     me->object_codetype = NULL;
     me->object_usemap = NULL;
     me->object_name = NULL;
- 
+
     me->option.size = 0;
     me->option.growby = 128;
     me->option.allocated = 0;
@@ -7882,7 +7883,7 @@ PUBLIC HTStructured* HTML_new ARGS3(
     me->inUnderline = FALSE;
 
     me->needBoldH = FALSE;
- 
+
     me->comment_start = NULL;
     me->comment_end = NULL;
 
@@ -7988,7 +7989,7 @@ PUBLIC HTStructured* HTML_new ARGS3(
     me->target = stream;
     if (stream)
         me->targetClass = *stream->isa;			/* Copy pointers */
-    
+
     return (HTStructured*) me;
 }
 
@@ -7999,7 +8000,7 @@ PUBLIC HTStructured* HTML_new ARGS3(
 */
 PUBLIC HTStream* HTMLToPlain ARGS3(
 	HTPresentation *,	pres,
-	HTParentAnchor *,	anchor,	
+	HTParentAnchor *,	anchor,
 	HTStream *,		sink)
 {
     return SGML_new(&HTML_dtd, anchor, HTML_new(anchor, pres->rep_out, sink));
@@ -8012,7 +8013,7 @@ PUBLIC HTStream* HTMLToPlain ARGS3(
 */
 PUBLIC HTStream* HTMLParsedPresent ARGS3(
 	HTPresentation *,	pres,
-	HTParentAnchor *,	anchor,	
+	HTParentAnchor *,	anchor,
 	HTStream *,		sink)
 {
     HTStream * intermediate = sink;
@@ -8067,11 +8068,11 @@ PUBLIC HTStream* HTMLParsedPresent ARGS3(
 */
 PUBLIC HTStream* HTMLToC ARGS3(
 	HTPresentation *,	pres,
-	HTParentAnchor *,	anchor,	
+	HTParentAnchor *,	anchor,
 	HTStream *,		sink)
 {
     HTStructured * html;
-    
+
     (*sink->isa->put_string)(sink, "/* ");	/* Before even title */
     html = HTML_new(anchor, WWW_PLAINTEXT, sink);
     html->comment_start = "/* ";
@@ -8090,7 +8091,7 @@ PUBLIC HTStream* HTMLToC ARGS3(
 #ifndef GUI
 PUBLIC HTStream* HTMLPresent ARGS3(
 	HTPresentation *,	pres,
-	HTParentAnchor *,	anchor,	
+	HTParentAnchor *,	anchor,
 	HTStream *,		sink)
 {
     return SGML_new(&HTML_dtd, anchor, HTML_new(anchor, WWW_PRESENT, NULL));
@@ -8122,4 +8123,4 @@ PUBLIC int HTLoadError ARGS3(
 {
     HTAlert(message);		/* @@@@@@@@@@@@@@@@@@@ */
     return -number;
-} 
+}
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index 4de3728e..d7bdf33f 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -1062,6 +1062,13 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9(
     */
     if (!str || *str == NULL || **str == '\0')
         return str;
+
+    /*
+     * FIXME: something's wrong with the limit checks here (clearing the
+     * buffer helps).
+     */
+    memset(replace_buf, 0, sizeof(replace_buf));
+
     /*
     **  Don't do byte translation
     **  if original AND target character sets
diff --git a/src/LYClean.c b/src/LYClean.c
index aefb6810..8358674d 100644
--- a/src/LYClean.c
+++ b/src/LYClean.c
@@ -185,6 +185,11 @@ PUBLIC void cleanup NOARGS
     fflush(stdout);
     fflush(stderr);
     if (LYTraceLogFP != NULL) {
-        fclose(LYTraceLogFP);
+	fclose(LYTraceLogFP);
+	LYTraceLogFP = 0;
+	LYTraceLogFP = NULL;
+#if !defined(VMS) || (defined(VMS) && !defined(VAXC) && !defined(UCX))
+	*stderr = LYOrigStderr;
+#endif /* !VMS || (VMS && !VAXC && !UCX) */
     }
 }
diff --git a/src/LYCookie.c b/src/LYCookie.c
index ea1e25b1..ae8bc4b8 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -1,4 +1,4 @@
-/*	  		       Lynx Cookie Support	           LYCookies.c
+/*	  		       Lynx Cookie Support	           LYCookie.c
 **			       ===================
 **
 **	Author:	AMK	A.M. Kuchling (amk@magnet.com)	12/25/96
@@ -28,8 +28,8 @@
 	out in practice.
       * The prompt should show more information about the cookie being
         set in Novice mode.
-      * The truncation heuristic in HTConfirmCookie should probably be 
-        smarter, smart enough to leave a really short name/value string 
+      * The truncation heuristic in HTConfirmCookie should probably be
+        smarter, smart enough to leave a really short name/value string
 	alone.
       * We protect against denial-of-service attacks (see section 6.3.1
         of the draft) by limiting a domain to 50 cookies, limiting the
@@ -103,7 +103,7 @@ typedef struct _cookie cookie;
 #define COOKIE_FLAG_EXPIRES_SET 4  /* If set, an expiry date was set */
 #define COOKIE_FLAG_DOMAIN_SET 8   /* If set, an non-default domain was set */
 #define COOKIE_FLAG_PATH_SET 16    /* If set, an non-default path was set */
-struct _HTStream 
+struct _HTStream
 {
   HTStreamClass * isa;
 };
@@ -114,7 +114,7 @@ PRIVATE void MemAllocCopy ARGS3(
 	CONST char *,	end)
 {
     char *temp;
-    
+
     if (!(start && end) || (end <= start)) {
         HTSACopy(dest, "");
 	return;
@@ -137,7 +137,7 @@ PRIVATE cookie * newCookie NOARGS
         outofmem(__FILE__, "newCookie");
     sprintf(lynxID, "%p", p);
     StrAllocCopy(p->lynxID, lynxID);
-    p->port = 80; 
+    p->port = 80;
     return p;
 }
 
@@ -146,7 +146,7 @@ PRIVATE void freeCookie ARGS1(
 {
     if (co) {
         FREE(co->lynxID);
-	FREE(co->name); 
+	FREE(co->name);
 	FREE(co->value);
 	FREE(co->comment);
 	FREE(co->commentURL);
@@ -295,7 +295,7 @@ PRIVATE void store_cookie ARGS3(
         return;
     }
     /*
-     *  The next 4 conditions do NOT apply if the domain is still 
+     *  The next 4 conditions do NOT apply if the domain is still
      *  the default of request-host.
      */
     if (strcmp(co->domain, hostname) != 0) {
@@ -314,7 +314,7 @@ PRIVATE void store_cookie ARGS3(
 
 	/*
 	 *  Section 4.3.2, condition 2: The value for the Domain attribute
-	 *  contains no embedded dots or does not start with a dot. 
+	 *  contains no embedded dots or does not start with a dot.
 	 *  (A dot is embedded if it's neither the first nor last character.)
 	 *  Note that we added a lead dot ourselves if a domain attribute
 	 *  value otherwise qualified. - FM
@@ -338,7 +338,7 @@ PRIVATE void store_cookie ARGS3(
 	    co = NULL;
 	    return;
 	}
-      
+
         /*
 	 *  Section 4.3.2, condition 3: The value for the request-host does
 	 *  not domain-match the Domain attribute.
@@ -354,19 +354,35 @@ PRIVATE void store_cookie ARGS3(
 	}
 
         /*
-	 *  Section 4.3.2, condition 4: The request-host is a FQDN (not IP
+	 *  Section 4.3.2, condition 4: The request-host is an HDN (not IP
 	 *  address) and has the form HD, where D is the value of the Domain
 	 *  attribute, and H is a string that contains one or more dots.
 	 */
 	ptr = ((hostname + strlen(hostname)) - strlen(co->domain));
 	if (strchr(hostname, '.') < ptr) {
-	    if (TRACE)
-		fprintf(stderr,
-			"store_cookie: Rejecting domain '%s' for host '%s'.\n",
-			co->domain, hostname);
-	    freeCookie(co);
-	    co = NULL;
-	    return;
+	    char *msg = calloc(1,
+			       (strlen(co->domain) +
+			        strlen(hostname) +
+				strlen(INVALID_COOKIE_DOMAIN_CONFIRMATION) +
+				1));
+
+	    sprintf(msg,
+		    INVALID_COOKIE_DOMAIN_CONFIRMATION,
+		    co->domain,
+		    hostname);
+	    if (!HTConfirm(msg)) {
+		if (TRACE) {
+		    fprintf(stderr,
+		       "store_cookie: Rejecting domain '%s' for host '%s'.\n",
+			    co->domain,
+			    hostname);
+		}
+		freeCookie(co);
+	    	co = NULL;
+		FREE(msg);
+		return;
+	    }
+	    FREE(msg);
 	}
     }
 
@@ -409,7 +425,7 @@ PRIVATE void store_cookie ARGS3(
 	    HTList_addObject(domain_list, de);
 	}
     }
-  
+
     /*
      *  Loop over the cookie list, deleting expired and matching cookies.
      */
@@ -488,7 +504,7 @@ PRIVATE void store_cookie ARGS3(
      *  Get confirmation if we need it, and add cookie
      *  if confirmed or 'allow' is set to always. - FM
      */
-    } else if (HTConfirmCookie(de, hostname, 
+    } else if (HTConfirmCookie(de, hostname,
 			       co->domain, co->path, co->name, co->value)) {
 	HTList_insertObjectAt(cookie_list, co, pos);
 	total_cookies++;
@@ -526,7 +542,7 @@ PRIVATE char * scan_cookie_sublist ARGS6(
 		    	    (long)hl,
 			    (co->name ? co->name : "(no name)"),
 			    (co->value ? co->value : "(no value)"));
-	    fprintf(stderr, "%s %s %i %s %s %i%s\n",
+	    fprintf(stderr, "%s %s %d %s %s %d%s\n",
 	    		    hostname,
 			    (co->domain ? co->domain : "(no domain)"),
 			    host_matches(hostname, co->domain),
@@ -550,7 +566,7 @@ PRIVATE char * scan_cookie_sublist ARGS6(
 	 *  Check if we have a unexpired match, and handle if we do.
 	 */
 	if (((co != NULL) &&
-	     host_matches(hostname, co->domain)) && 
+	     host_matches(hostname, co->domain)) &&
 	    (co->pathlen == 0 || !strncmp(path, co->path, co->pathlen))) {
 	    /*
 	     *  Skip if the secure flag is set and we don't have
@@ -582,7 +598,7 @@ PRIVATE char * scan_cookie_sublist ARGS6(
 		     *  first cookie.
 		     */
 		    char version[16];
-		    sprintf(version, "$Version=\"%i\"; ", co->version);
+		    sprintf(version, "$Version=\"%d\"; ", co->version);
 		    StrAllocCopy(header, version);
 		    len += strlen(header);
 		}
@@ -654,14 +670,14 @@ PRIVATE char * scan_cookie_sublist ARGS6(
 	}
 	hl = next;
     }
- 
+
     return(header);
 }
 
 /*
 **  Process potentially concatenated Set-Cookie2 and/or Set-Cookie
 **  headers. - FM
-*/  
+*/
 PRIVATE void LYProcessSetCookies ARGS6(
 	CONST char *,	SetCookie,
 	CONST char *,	SetCookie2,
@@ -722,7 +738,7 @@ PRIVATE void LYProcessSetCookies ARGS6(
 	while (*p != '\0' && isspace((unsigned char)*p)) {
 	    p++;
 	}
-      
+
         /*
 	 *  Check for an '=' delimiter, or an 'expires' name followed
 	 *  by white, since Netscape's bogus parser doesn't require
@@ -748,7 +764,7 @@ PRIVATE void LYProcessSetCookies ARGS6(
 	     *  Hack alert!  We must handle Netscape-style cookies with
 	     *		"Expires=Mon, 01-Jan-96 13:45:35 GMT" or
 	     *		"Expires=Mon,  1 Jan 1996 13:45:35 GMT".
-	     *  No quotes, but there are spaces.  Argh... 
+	     *  No quotes, but there are spaces.  Argh...
 	     *  Anyway, we know it will have at least 3 space separators
 	     *  within it, and two dashes or two more spaces, so this code
 	     *  looks for a space after the 5th space separator or dash to
@@ -1223,7 +1239,7 @@ PRIVATE void LYProcessSetCookies ARGS6(
 	while (*p != '\0' && isspace((unsigned char)*p)) {
 	    p++;
 	}
-      
+
         /*
 	 *  Check for an '=' delimiter, or an 'expires' name followed
 	 *  by white, since Netscape's bogus parser doesn't require
@@ -1245,13 +1261,13 @@ PRIVATE void LYProcessSetCookies ARGS6(
 	     *  Hack alert!  We must handle Netscape-style cookies with
 	     *		"Expires=Mon, 01-Jan-96 13:45:35 GMT" or
 	     *		"Expires=Mon,  1 Jan 1996 13:45:35 GMT".
-	     *  No quotes, but there are spaces.  Argh... 
+	     *  No quotes, but there are spaces.  Argh...
 	     *  Anyway, we know it will have at least 3 space separators
 	     *  within it, and two dashes or two more spaces, so this code
 	     *  looks for a space after the 5th space separator or dash to
 	     *  mark the end of the value. - FM
 	     */
-	    if ((attr_end - attr_start) == 7 && 
+	    if ((attr_end - attr_start) == 7 &&
 		!strncasecomp(attr_start, "Expires", 7)) {
 		int spaces = 6;
 		value_start = p;
@@ -1746,14 +1762,14 @@ PUBLIC void LYSetCookie ARGS3(
         port = atoi(ptr);
     } else if (!strncasecomp(address, "https:", 6)) {
         port = 443;
-    } 
+    }
     if (((path = HTParse(address, "",
     			 PARSE_PATH|PARSE_PUNCTUATION)) != NULL) &&
 	(ptr = strrchr(path, '/')) != NULL) {
 	if (ptr == path) {
 	    *(ptr+1) = '\0';	/* Leave a single '/' alone */
 	} else {
-	    *ptr = '\0'; 
+	    *ptr = '\0';
 	}
     }
     if (!(SetCookie && *SetCookie) &&
@@ -1818,7 +1834,7 @@ PUBLIC char * LYCookie ARGS4(
 
     if (TRACE) {
 	fprintf(stderr,
-		"LYCookie: Searching for '%s:%i', '%s'.\n",
+		"LYCookie: Searching for '%s:%d', '%s'.\n",
 		(hostname ? hostname : "(null)"),
 		port,
 		(path ? path : "(null)"));
@@ -1934,7 +1950,7 @@ PRIVATE int LYHandleCookies ARGS4 (
 	     *  If there is a path string (not just a slash) in the
 	     *  LYNXCOOKIE: URL, that's a cookie's lynxID and this
 	     *  is a request to delete it from the Cookie Jar. - FM
-	     */ 
+	     */
 	    if ((lynxID = HTParse(arg, "", PARSE_PATH)) != NULL) {
 	        if (*lynxID == '\0') {
 		    FREE(lynxID);
@@ -2025,7 +2041,7 @@ PRIVATE int LYHandleCookies ARGS4 (
 			switch(TOUPPER(ch)) {
 			    case 'A':
 			        /*
-				 *  Set to accept all cookies 
+				 *  Set to accept all cookies
 				 *  from this domain. - FM
 				 */
 				de->bv = QUERY_USER;
@@ -2154,7 +2170,7 @@ Delete_all_cookies_in_domain:
      *  deletion request.  Set up an HTML stream and
      *  return an updated Cookie Jar Page. - FM
      */
-    target = HTStreamStack(format_in, 
+    target = HTStreamStack(format_in,
 			   format_out,
 			   sink, anAnchor);
     if (!target || target == NULL) {
@@ -2251,9 +2267,10 @@ Delete_all_cookies_in_domain:
 	    } else {
 	        StrAllocCopy(path, "/");
 	    }
-	    sprintf(buf, "<DD>Path=%s\n<DD>Port: %i Secure: %s\n",
+	    sprintf(buf, "<DD>Path=%s\n<DD>Port: %d Secure: %s Discard: %s\n",
 			 path, co->port,
-			 ((co->flags & COOKIE_FLAG_SECURE) ? "YES" : "NO"));
+			 ((co->flags & COOKIE_FLAG_SECURE) ? "YES" : "NO"),
+			 ((co->flags & COOKIE_FLAG_DISCARD) ? "YES" : "NO"));
 	    FREE(path);
 	    (*target->isa->put_block)(target, buf, strlen(buf));
 
diff --git a/src/LYCurses.c b/src/LYCurses.c
index bea0ad43..41f75a53 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -634,6 +634,10 @@ PUBLIC void start_curses NOARGS
 		  keypad(stdscr, TRUE);
 		  fflush(stdin);
 		  fflush(stdout);
+		  if (has_colors()) {
+		      lynx_has_color = TRUE;
+		      start_color();
+		  }
 		  lynx_init_colors();
 		  lynx_called_initscr = TRUE;
 
@@ -1308,7 +1312,6 @@ PUBLIC void VMSexit NOARGS
 	fflush(stdout);
 	fflush(stderr);
     }
-    *stderr = LYOrigStderr;
 }
 
 /*
diff --git a/src/LYExtern.c b/src/LYExtern.c
index 69607d02..9e793a04 100644
--- a/src/LYExtern.c
+++ b/src/LYExtern.c
@@ -19,13 +19,14 @@
 #include "LYGlobalDefs.h"
 #include "LYUtils.h"
 #include "LYExtern.h"
+#include "LYCurses.h"
 
 #include "LYLeaks.h"
 
 #ifdef USE_EXTERNALS
 #define FREE(x) if (x) {free(x); x = NULL;}
 
-void run_external(char * c)
+void run_external ARGS1(char *, c)
 {
 	char command[1024];
 	lynx_html_item_type *externals2=0;
@@ -74,13 +75,13 @@ void run_external(char * c)
 		 stop_curses();
 		 fflush(stdout);
 #ifdef __DJGPP__
-              __djgpp_set_ctrl_c(0);
-              _go32_want_ctrl_break(1);
+		__djgpp_set_ctrl_c(0);
+		_go32_want_ctrl_break(1);
 #endif /* __DJGPP__ */
 		 system(command);
 #ifdef __DJGPP__
-              __djgpp_set_ctrl_c(1);
-              _go32_want_ctrl_break(0);
+		__djgpp_set_ctrl_c(1);
+		_go32_want_ctrl_break(0);
 #endif /* __DJGPP__ */
 
 		 fflush(stdout);
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index c66b26bd..0a2f1526 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -325,6 +325,7 @@ extern BOOLEAN LYStripDotDotURLs;	/* Try to fix ../ in some URLs?  */
 extern BOOLEAN LYForceSSLCookiesSecure;
 extern BOOLEAN LYNoCc;
 extern BOOLEAN LYPreparsedSource;	/* Show source as preparsed?	 */
+extern BOOLEAN LYPrependBaseToSource;
 
 #ifdef RAWDOSKEYHACK
 extern BOOLEAN raw_dos_key_hack; /* Turn on and off DOS key hack */
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index 8cad69e7..2dd590a7 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -1,8 +1,8 @@
 #include "HTUtils.h"
 #include "tcp.h"
 #include "LYUtils.h"
-#include "LYKeymap.h"
 #include "LYGlobalDefs.h"
+#include "LYKeymap.h"
 #include "HTAccess.h"
 #include "HTFormat.h"
 #include "HTAlert.h"
@@ -84,7 +84,7 @@ LYK_UP_LINK,         LYK_INFO,     LYK_DOWN_LINK,   LYK_HELP,
 LYK_RAW_TOGGLE,  LYK_ADD_BOOKMARK, LYK_PREV_PAGE,   LYK_COMMENT,
 /* @ */              /* A */         /* B */        /* C */
 
-LYK_DOWNLOAD,        LYK_EDIT,             
+LYK_DOWNLOAD,        LYK_ELGOTO,             
 /* D */              /* E */         
 
 #if defined(DIRED_SUPPORT) || defined(VMS)
@@ -464,6 +464,7 @@ PRIVATE struct rmap revmap[] = {
 { "F_LINK_NUM",		"invoke the 'Follow link (or page) number:' prompt" },
 { "CLEAR_AUTH",		"clear all authorization info for this session" },
 { "SWITCH_DTD",		"switch between two ways of parsing HTML" },
+{ "ELGOTO",		"edit the current link's URL or ACTION and go to it" },
 #ifdef USE_EXTERNALS
 { "EXTERN",		"run external program with url" },
 #endif
diff --git a/src/LYKeymap.h b/src/LYKeymap.h
index 049ade2b..77feb48f 100644
--- a/src/LYKeymap.h
+++ b/src/LYKeymap.h
@@ -94,15 +94,16 @@ extern char override[];
 #define       LYK_F_LINK_NUM    70
 #define       LYK_CLEAR_AUTH    71
 #define       LYK_SWITCH_DTD    72
+#define       LYK_ELGOTO        73
 
 #ifdef USE_EXTERNALS
-#define       LYK_EXTERN        73
+#define       LYK_EXTERN        74
 #if defined(VMS) || defined(DIRED_SUPPORT)
-#define       LYK_DIRED_MENU    74
+#define       LYK_DIRED_MENU    75
 #endif /* VMS || DIRED_SUPPORT */
 #else  /* USE_EXTERNALS */
 #if defined(VMS) || defined(DIRED_SUPPORT)
-#define       LYK_DIRED_MENU    73
+#define       LYK_DIRED_MENU    74
 #endif /* VMS || DIRED_SUPPORT */
 #endif /* !defined(USE_EXTERNALS) */
 
diff --git a/src/LYList.c b/src/LYList.c
index f5225c7b..255c6671 100644
--- a/src/LYList.c
+++ b/src/LYList.c
@@ -21,12 +21,12 @@
 
 #include "LYexit.h"
 #include "LYLeaks.h"
- 
+
 #define FREE(x) if (x) {free(x); x = NULL;}
 
-/* 	showlist - F.Macrides (macrides@sci.wfeb.edu)
+/*	showlist - F.Macrides (macrides@sci.wfeb.edu)
 **	--------
-**  	Create a temporary text/html file with a list of links to
+**	Create a temporary text/html file with a list of links to
 **	HyperText References in the current document.
 **
 **  On entry
@@ -118,11 +118,16 @@ PUBLIC int showlist ARGS2(
 		 LIST_PAGE_TITLE);
     fprintf(fp0, "<h1>You have reached the List Page</h1>\n");
     fprintf(fp0, "<h2>%s Version %s</h2>\n", LYNX_NAME, LYNX_VERSION);
-
-    fprintf(fp0, "  References in this document:<p>\n");
+    StrAllocCopy(Address, HTLoadedDocumentURL());
+    LYEntify(&Address, FALSE);
+    fprintf(fp0,
+	    "  References in %s<p>\n",
+	    ((Address != NULL && *Address != '\0') ?
+					   Address : "this document:"));
+    FREE(Address);
     if (refs > 0) {
 	fprintf(fp0, "<%s compact>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ?
-    				       "ol" : "ul"));
+				       "ol" : "ul"));
 	if (hidden_links > 0)
 	    fprintf(fp0, "<lh><em>Visible links:</em>\n");
     }
@@ -154,8 +159,8 @@ PUBLIC int showlist ARGS2(
 	     */
 	    if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) {
 		HText_FormDescNumber(cnt, (char **)&desc);
-		/* fprintf(fp0, "<li>[%d](<em>%s</em>)\n", cnt, desc); */
-		fprintf(fp0, "<li><a id=%d href='#%d'></a>(<em>%s</em>)\n",
+		fprintf(fp0,
+		"<li><a id=%d href=\"#%d\">form field</a> = <em>%s</em>\n",
 			cnt, cnt, desc);
 	    }
 	    continue;
@@ -196,8 +201,8 @@ PUBLIC int showlist ARGS2(
 	}
 
         fprintf(fp0, "<li><a href=\"%s\"%s>%s%s%s%s%s</a>\n", Address,
-		        dest_intl ? " TYPE=\"internal link\"" : "", 
-		        dest_intl ? "(internal) " : "", 
+		        dest_intl ? " TYPE=\"internal link\"" : "",
+		        dest_intl ? "(internal) " : "",
 			((HTAnchor*)parent != dest) && Title ? "in " : "",
 			(char *)(Title ? Title : Address),
 			(Title && cp) ? " - " : "",
@@ -210,11 +215,11 @@ PUBLIC int showlist ARGS2(
     if (hidden_links > 0) {
         if (refs > 0)
 	    fprintf(fp0, "\n</%s>\n\n<p>\n",
-	    		 ((keypad_mode == NUMBERS_AS_ARROWS) ?
-						        "ol" : "ul"));
-        fprintf(fp0, "<%s compact>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ?
-    				        "ol continue" : "ul"));
-        fprintf(fp0, "<lh><em>Hidden links:</em>\n");
+			 ((keypad_mode == NUMBERS_AS_ARROWS) ?
+							"ol" : "ul"));
+	fprintf(fp0, "<%s compact>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ?
+					"ol continue" : "ul"));
+	fprintf(fp0, "<lh><em>Hidden links:</em>\n");
     }
 
     for (cnt = 0; cnt < hidden_links; cnt++) {
@@ -230,7 +235,7 @@ PUBLIC int showlist ARGS2(
     }
 
     fprintf(fp0,"\n</%s>\n</body>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ?
-    				       "ol" : "ul"));
+				       "ol" : "ul"));
 
     /*
      *  Make necessary changes to newdoc before returning to caller.
@@ -254,11 +259,11 @@ PUBLIC int showlist ARGS2(
     newdoc->safe = FALSE;
     fclose(fp0);
     return(0);
-}      
+}
 
-/* 	printlist - F.Macrides (macrides@sci.wfeb.edu)
+/*	printlist - F.Macrides (macrides@sci.wfeb.edu)
 **	---------
-**  	Print a text/plain list of HyperText References
+**	Print a text/plain list of HyperText References
 **	in the current document.
 **
 **  On entry
@@ -301,13 +306,14 @@ PUBLIC void printlist ARGS2(
 		 *  child should not be 0 unless form field numbering is on
 		 *  and cnt is the number of a form intput field.
 		 *  HText_FormDescNumber() will set desc to a description
-		 *  of what type of input field this is.  We'll list it to
-		 *  ensure that the link numbers on the list page match the
-		 *  numbering in the original document. - FM && LE
+		 *  of what type of input field this is.  We'll create a
+		 *  within-document link to ensure that the link numbers on
+		 *  the list page match the numbering in the original document,
+		 *  but won't create a forward link to the form. - FM && LE
 		 */
 		if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED) {
 		    HText_FormDescNumber(cnt, (char **)&desc);
-		    fprintf(fp, "%4d. (%s)\n", cnt, desc);
+		    fprintf(fp, "%4d. form field = %s\n", cnt, desc);
 		}
 		continue;
 	    }
@@ -330,7 +336,7 @@ PUBLIC void printlist ARGS2(
 	    FREE(address);
 #ifdef VMS
 	    if (HadVMSInterrupt)
-	        break;
+		break;
 #endif /* VMS */
 	}
 
@@ -351,4 +357,4 @@ PUBLIC void printlist ARGS2(
 	}
     }
     return;
-}      
+}
diff --git a/src/LYMail.c b/src/LYMail.c
index 59d8deb6..e56c0ec6 100644
--- a/src/LYMail.c
+++ b/src/LYMail.c
@@ -35,6 +35,8 @@ PUBLIC void mailform ARGS4(
 {
     FILE *fd;
     char *address = NULL;
+    char *ccaddr = NULL;
+    char *keywords = NULL;
     char *searchpart = NULL;
     char *cp = NULL, *cp0 = NULL, *cp1 = NULL;
     char subject[80];
@@ -42,9 +44,17 @@ PUBLIC void mailform ARGS4(
     char cmd[512];
     int len, i, ch;
 #if defined(VMS) || defined(DOSPATH)
-    char my_tempfile[256];
+    char my_tmpfile[256];
     char *address_ptr1, *address_ptr2;
+    char *command = NULL;
     BOOLEAN first = TRUE;
+    BOOLEAN isPMDF = FALSE;
+    char hdrfile[256];
+    FILE *hfd;
+
+    if (!strncasecomp(system_mail, "PMDF SEND", 9)) {
+	isPMDF = TRUE;
+    }
 #endif /* VMS */
 
     if (!mailto_address || !mailto_content) {
@@ -63,17 +73,17 @@ PUBLIC void mailform ARGS4(
      */
     if ((cp = strchr(address, '?')) != NULL) {
 	StrAllocCopy(searchpart, cp);
-        *cp = '\0';
+	*cp = '\0';
 	cp = (searchpart + 1);
 	if (*cp != '\0') {
 	    /*
 	     *  Seek and handle a subject=foo. - FM
 	     */
 	    while (*cp != '\0') {
-	        if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
+		if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
 		    !strncasecomp(cp, "subject=", 8))
 		    break;
-	        cp++;
+		cp++;
 	    }
 	    if (*cp) {
 		cp += 8;
@@ -81,9 +91,8 @@ PUBLIC void mailform ARGS4(
 		    *cp1 = '\0';
 		}
 		if (*cp) {
-		    strncpy(subject, cp, 70);
-		    subject[70] = '\0';
 		    HTUnEscape(subject);
+		    LYstrncpy(subject, cp, 70);
 		}
 		if (cp1) {
 		    *cp1 = '&';
@@ -92,33 +101,107 @@ PUBLIC void mailform ARGS4(
 	    }
 
 	    /*
-	     *  Seek and handle cc=foo fields.  Excludes Bcc=foo
-	     *  and appends to address, so we can use our own cc
-	     *  field for the actual mailing. - FM
+	     *  Seek and handle to=address(es) fields.
+	     *  Appends to address. - FM
 	     */
 	    cp = (searchpart + 1);
 	    while (*cp != '\0') {
-	        if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
-		    !strncasecomp(cp, "cc=", 3)) {
+		if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
+		    !strncasecomp(cp, "to=", 3)) {
 		    cp += 3;
 		    if ((cp1 = strchr(cp, '&')) != NULL) {
-		        *cp1 = '\0';
+			*cp1 = '\0';
 		    }
-		    while (*cp == ',')
-		        cp++;
+		    while (*cp == ',' || isspace((unsigned char)*cp))
+			cp++;
 		    if (*cp) {
-			StrAllocCat(address, ",");
+			if (*address) {
+			    StrAllocCat(address, ",");
+			}
 			StrAllocCat(address, cp);
 		    }
 		    if (cp1) {
-		        *cp1 = '&';
+			*cp1 = '&';
+			cp = cp1;
+			cp1 = NULL;
+		    } else {
+			break;
+		    }
+		}
+		cp++;
+	    }
+
+	    /*
+	     *  Seek and handle cc=address(es) fields.  Excludes
+	     *  Bcc=address(es) as unsafe.  We may append our own
+	     *  cc (below) as a list for the actual mailing. - FM
+	     */
+	    cp = (searchpart + 1);
+	    while (*cp != '\0') {
+		if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
+		    !strncasecomp(cp, "cc=", 3)) {
+		    cp += 3;
+		    if ((cp1 = strchr(cp, '&')) != NULL) {
+			*cp1 = '\0';
+		    }
+		    while (*cp == ',' || isspace((unsigned char)*cp))
+			cp++;
+		    if (*cp) {
+			if (ccaddr == NULL) {
+			    StrAllocCopy(ccaddr, cp);
+			} else {
+			    StrAllocCat(ccaddr, ",");
+			    StrAllocCat(ccaddr, cp);
+			}
+		    }
+		    if (cp1) {
+			*cp1 = '&';
 			cp = cp1;
 			cp1 = NULL;
 		    } else {
-		        break;
+			break;
 		    }
 		}
-	        cp++;
+		cp++;
+	    }
+
+	    /*
+	     *  Seek and handle keywords=term(s) fields. - FM
+	     */
+	    cp = (searchpart + 1);
+	    while (*cp != '\0') {
+		if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
+		    !strncasecomp(cp, "keywords=", 9)) {
+		    cp += 9;
+		    if ((cp1 = strchr(cp, '&')) != NULL) {
+			*cp1 = '\0';
+		    }
+		    while (*cp == ',' || isspace((unsigned char)*cp))
+			cp++;
+		    if (*cp) {
+			if (keywords == NULL) {
+			    StrAllocCopy(keywords, cp);
+			} else {
+			    StrAllocCat(keywords, cp);
+			    StrAllocCat(keywords, ", ");
+			}
+		    }
+		    if (cp1) {
+			*cp1 = '&';
+			cp = cp1;
+			cp1 = NULL;
+		    } else {
+			break;
+		    }
+		}
+		cp++;
+	    }
+	    if (keywords != NULL) {
+		if (*keywords != '\0') {
+		    HTUnEscape(keywords);
+		} else {
+		    FREE(keywords);
+		}
 	    }
 
 	    FREE(searchpart);
@@ -126,11 +209,6 @@ PUBLIC void mailform ARGS4(
     }
 
     /*
-     *  Unescape the address field. - FM
-     */
-    HTUnEscape(address);
-
-    /*
      * Convert any Explorer semi-colon Internet address
      * separators to commas. - FM
      */
@@ -143,18 +221,51 @@ PUBLIC void mailform ARGS4(
 	}
 	cp = cp1;
     }
+    if (address[(strlen(address) - 1)] == ',')
+	address[(strlen(address) - 1)] = '\0';
+    if (*address == '\0') {
+	FREE(address);
+	FREE(ccaddr);
+	FREE(keywords);
+	HTAlert(BAD_FORM_MAILTO);
+	return;
+    }
+    if (ccaddr != NULL) {
+	cp = ccaddr;
+	while ((cp1 = strchr(cp, '@')) != NULL) {
+	    cp1++;
+	    if ((cp0 = strchr(cp1, ';')) != NULL) {
+		*cp0 = ',';
+		cp1 = cp0 + 1;
+	    }
+	    cp = cp1;
+	}
+	if (ccaddr[(strlen(ccaddr) - 1)] == ',') {
+	    ccaddr[(strlen(ccaddr) - 1)] = '\0';
+	}
+	if (*ccaddr == '\0') {
+	    FREE(ccaddr);
+	}
+    }
+
+    /*
+     *  Unescape the address and ccaddr fields. - FM
+     */
+    HTUnEscape(address);
+    if (ccaddr != NULL) {
+	HTUnEscape(ccaddr);
+    }
 
     /*
      *  Allow user to edit the default Subject - FM
      */
     if (subject[0] == '\0') {
-        if (mailto_subject && *mailto_subject) {
-	    strncpy(subject, mailto_subject, 70);
+	if (mailto_subject && *mailto_subject) {
+	    LYstrncpy(subject, mailto_subject, 70);
 	} else {
 	    strcpy(subject, "mailto:");
-	    strncpy((char*)&subject[7], address, 63);
+	    LYstrncpy((char*)&subject[7], address, 63);
 	}
-	subject[70] = '\0';
     }
     _statusline(SUBJECT_PROMPT);
     if ((ch = LYgetstr(subject, VISIBLE, 71, NORECALL)) < 0) {
@@ -164,6 +275,8 @@ PUBLIC void mailform ARGS4(
 	_statusline(FORM_MAILTO_CANCELLED);
 	sleep(InfoSecs);
 	FREE(address);
+	FREE(ccaddr);
+	FREE(keywords);
 	return;
     }
 
@@ -172,8 +285,8 @@ PUBLIC void mailform ARGS4(
      *  entry, if permitted. - FM
      */
     if (!LYNoCc) {
-	sprintf(self,"%.79s", (personal_mail_address ? 
-			       personal_mail_address : ""));
+	sprintf(self, "%.79s", (personal_mail_address ?
+				personal_mail_address : ""));
 	self[79] = '\0';
 	_statusline("Cc: ");
 	if ((ch = LYgetstr(self, VISIBLE, sizeof(self), NORECALL)) < 0) {
@@ -183,29 +296,60 @@ PUBLIC void mailform ARGS4(
 	    _statusline(FORM_MAILTO_CANCELLED);
 	    sleep(InfoSecs);
 	    FREE(address);
+	    FREE(ccaddr);
+	    FREE(keywords);
 	    return;
 	}
+	remove_tildes(self);
+	if (ccaddr == NULL) {
+	    StrAllocCopy(ccaddr, self);
+	} else {
+	    StrAllocCat(ccaddr, ",");
+	    StrAllocCat(ccaddr, self);
+	}
     }
 
 #if defined(VMS) || defined(DOSPATH)
-    sprintf(my_tempfile, "%s%s", lynx_temp_space, "temp_mail.txt");
-    if ((fd = LYNewTxtFile(my_tempfile)) == NULL) {
+    tempname(my_tmpfile, NEW_FILE);
+    if (((cp = strrchr(my_tmpfile, '.')) != NULL) &&
+	NULL == strchr(cp, ']') &&
+	NULL == strchr(cp, '/')) {
+	*cp = '\0';
+	strcat(my_tmpfile, ".txt");
+    }
+    if ((fd = LYNewTxtFile(my_tmpfile)) == NULL) {
 	HTAlert(FORM_MAILTO_FAILED);
 	FREE(address);
+	FREE(ccaddr);
+	FREE(keywords);
 	return;
     }
-    if (*self) {
-        cp = self;
-	while (*cp == ' ' || *cp == ',')
-	    cp++;
-	if (*cp) {
-	    StrAllocCat(address, ",");
-	    StrAllocCat(address, cp);
+    if (isPMDF) {
+	tempname(hdrfile, NEW_FILE);
+	if (((cp = strrchr(hdrfile, '.')) != NULL) &&
+	    NULL == strchr(cp, ']') &&
+	    NULL == strchr(cp, '/')) {
+	    *cp = '\0';
+	    strcat(hdrfile, ".txt");
+	}
+	if ((hfd = LYNewTxtFile(hdrfile)) == NULL) {
+	    HTAlert(FORM_MAILTO_FAILED);
+	    FREE(address);
+	    FREE(ccaddr);
+	    FREE(keywords);
+	    return;
 	}
     }
 #ifdef VMS
-    if (mailto_type &&
-        !strncasecomp(mailto_type, "multipart/form-data", 19)) {
+    if (isPMDF) {
+	if (mailto_type && *mailto_type) {
+	    fprintf(hfd, "Mime-Version: 1.0\n");
+	    fprintf(hfd, "Content-Type: %s\n", mailto_type);
+	    if (personal_mail_address && *personal_mail_address)
+		fprintf(hfd, "From: %s\n", personal_mail_address);
+	    }
+    } else if (mailto_type &&
+	       !strncasecomp(mailto_type, "multipart/form-data", 19)) {
 	/*
 	 *  Ugh!  There's no good way to include headers while
 	 *  we're still using "generic" VMS MAIL, so we'll put
@@ -227,10 +371,11 @@ PUBLIC void mailform ARGS4(
 
 #else
     sprintf(cmd, "%s %s", system_mail, system_mail_flags);
-
     if ((fd = popen(cmd, "w")) == NULL) {
 	HTAlert(FORM_MAILTO_FAILED);
 	FREE(address);
+	FREE(ccaddr);
+	FREE(keywords);
 	return;
     }
 
@@ -238,13 +383,14 @@ PUBLIC void mailform ARGS4(
 	fprintf(fd, "Mime-Version: 1.0\n");
 	fprintf(fd, "Content-Type: %s\n", mailto_type);
     }
-    fprintf(fd,"To: %s\n", address);
+    fprintf(fd, "To: %s\n", address);
     if (personal_mail_address && *personal_mail_address)
-	fprintf(fd,"From: %s\n", personal_mail_address);
-    remove_tildes(self);
-    if (*self)
-	fprintf(fd,"Cc: %s\n", self);
-    fprintf(fd,"Subject: %.70s\n\n", subject);
+	fprintf(fd, "From: %s\n", personal_mail_address);
+    if (ccaddr != NULL && *ccaddr != '\0')
+	fprintf(fd, "Cc: %s\n", ccaddr);
+    fprintf(fd, "Subject: %s\n\n", subject);
+    if (keywords != NULL && *keywords != '\0')
+	fprintf(fd, "Keywords: %s\n", keywords);
     _statusline(SENDING_FORM_CONTENT);
 #endif /* VMS */
 
@@ -256,7 +402,7 @@ PUBLIC void mailform ARGS4(
      */
     while((cp = strchr(mailto_content, '\n')) != NULL) {
 	*cp = '\0';
-        i = 0;
+	i = 0;
 	len = strlen(mailto_content);
 	while (len > 78) {
 	    strncpy(cmd, (char *)&mailto_content[i], 78);
@@ -287,40 +433,125 @@ PUBLIC void mailform ARGS4(
 #if defined(VMS) || defined(DOSPATH)
     fclose(fd);
 #ifdef VMS
-    sprintf(cmd, "%s %s/subject=\"%.70s\" %s ",
-    		 system_mail,
-		 (strncasecomp(system_mail, "MAIL", 4) ? "" : "/noself"),
-		 subject, my_tempfile);
+    /*
+     *  Set the mail command. - FM
+     */
+    if (isPMDF) {
+	/*
+	 *  For PMDF, put any keywords and the subject
+	 *  in the header file and close it. - FM
+	 */
+	if (keywords != NULL && *keywords != '\0') {
+	    fprintf(hfd, "Keywords: %s\n", keywords);
+	}
+	fprintf(hfd, "Subject: %s\n\n", subject);
+	fclose(hfd);
+	/*
+	 *  Now set up the command. - FM
+	 */
+	sprintf(cmd,
+		"%s %s %s,%s ",
+		system_mail,
+		system_mail_flags,
+		hdrfile,
+		my_tmpfile);
+    } else {
+	/*
+	 *  For "generic" VMS MAIL, include the subject in the
+	 *  command, and ignore any keywords to minimize risk
+	 *  of them making the line too long or having problem
+	 *  characters. - FM
+	 */
+	sprintf(cmd,
+		"%s %s%s/subject=\"%s\" %s ",
+		system_mail,
+		system_mail_flags,
+		(strncasecomp(system_mail, "MAIL", 4) ? "" : "/noself"),
+		subject,
+		my_tmpfile);
+    }
+    StrAllocCopy(command, cmd);
 
+    /*
+     *  Now add all the people in the address field. - FM
+     */
     address_ptr1 = address;
     do {
 	if ((cp = strchr(address_ptr1, ',')) != NULL) {
 	    address_ptr2 = (cp+1);
 	    *cp = '\0';
-	} else
+	} else {
 	    address_ptr2 = NULL;
+	}
 
-	if (strlen(address) > 3) {
-	    if (!first)
-		strcat(cmd, ",");  /* add a comma */
-	    sprintf( &cmd[strlen(cmd)], mail_adrs, address_ptr1);
+	/*
+	 *  4 letters is arbitrarily the smallest posible mail
+	 *  address, at least for lynx.  That way extra spaces
+	 *  won't confuse the mailer and give a blank address.
+	 */
+	if (strlen(address_ptr1) > 3) {
+	    if (!first) {
+		StrAllocCat(command, ",");
+	    }
+	    sprintf(cmd, mail_adrs, address_ptr1);
+	    StrAllocCat(command, cmd);
 	    first = FALSE;
 	}
-
 	address_ptr1 = address_ptr2;
     } while (address_ptr1 != NULL);
-#else
-	 sprintf(cmd, "%s -t \"%s\" -F %s", system_mail, address, my_tempfile);
-#endif
+
+    /*
+     *  Now add all the people in the CC field. - FM
+     */
+    if (ccaddr != NULL && *ccaddr != '\0') {
+	address_ptr1 = ccaddr;
+	do {
+	    if ((cp = strchr(address_ptr1, ',')) != NULL) {
+		address_ptr2 = (cp+1);
+		*cp = '\0';
+	    } else {
+		address_ptr2 = NULL;
+	    }
+
+	    /*
+	     *  4 letters is arbitrarily the smallest possible mail
+	     *  address, at least for lynx.  That way extra spaces
+	     *  won't confuse the mailer and give a blank address.
+	     */
+	    if (strlen(address_ptr1) > 3) {
+		StrAllocCat(command, ",");
+		sprintf(cmd, mail_adrs, address_ptr1);
+		if (isPMDF) {
+		    strcat(cmd, "/CC");
+		}
+		StrAllocCat(command, cmd);
+	    }
+	    address_ptr1 = address_ptr2;
+	} while (address_ptr1 != NULL);
+    }
+
+    stop_curses();
+    printf("Sending form content:\n\n$ %s\n\nPlease wait...", command);
+    system(command);
+    FREE(command);
+    sleep(AlertSecs);
+    start_curses();
+    remove(my_tmpfile);
+    remove(hdrfile);
+#else /* DOSPATH */
+    sprintf(cmd, "%s -t \"%s\" -F %s", system_mail, address, my_tmpfile);
     stop_curses();
     printf("Sending form content:\n\n$ %s\n\nPlease wait...", cmd);
     system(cmd);
     sleep(MessageSecs);
     start_curses();
-    remove(my_tempfile);
+    remove(my_tmpfile);
+#endif
 #endif /* VMS */
 
     FREE(address);
+    FREE(ccaddr);
+    FREE(keywords);
     return;
 }
 
@@ -328,34 +559,80 @@ PUBLIC void mailform ARGS4(
 **  mailmsg() sends a message to the owner of the file, if one is defined,
 **  telling of errors (i.e., link not available).
 */
-PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address, 
-		char *,filename, char *,linkname)
+PUBLIC void mailmsg ARGS4(
+	int,		cur,
+	char *,		owner_address,
+	char *,		filename,
+	char *,		linkname)
 {
     FILE *fd, *fp;
     char *address = NULL;
+    char *searchpart = NULL;
     char cmd[512], *cp, *cp0, *cp1;
 #if defined(VMS) || defined(DOSPATH)
-    char my_tempfile[256];
+    char my_tmpfile[256];
     char *address_ptr1, *address_ptr2;
+    char *command = NULL;
     BOOLEAN first = TRUE;
+    BOOLEAN isPMDF = FALSE;
+    char hdrfile[256];
+    FILE *hfd;
+
+    if (!strncasecomp(system_mail, "PMDF SEND", 9)) {
+	isPMDF = TRUE;
+    }
 #endif /* VMS */
 
+    if (owner_address == NULL || *owner_address == '\0') {
+	return;
+    }
     if ((cp = (char *)strchr(owner_address,'\n')) != NULL)
 	*cp = '\0';
     StrAllocCopy(address, owner_address);
 
     /*
-     *  Check for a ?searchpart and trim it. - FM
+     *  Check for a ?searchpart. - FM
      */
-    if ((cp = strchr(address, '?')) != NULL)
+    if ((cp = strchr(address, '?')) != NULL) {
+	StrAllocCopy(searchpart, cp);
 	*cp = '\0';
+	cp = (searchpart + 1);
+	if (*cp != '\0') {
+	    /*
+	     *  Seek and handle to=address(es) fields.
+	     *  Appends to address.  We ignore any other
+	     *  headers in the ?searchpart. - FM
+	     */
+	    cp = (searchpart + 1);
+	    while (*cp != '\0') {
+		if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
+		    !strncasecomp(cp, "to=", 3)) {
+		    cp += 3;
+		    if ((cp1 = strchr(cp, '&')) != NULL) {
+			*cp1 = '\0';
+		    }
+		    while (*cp == ',' || isspace((unsigned char)*cp))
+			cp++;
+		    if (*cp) {
+			if (*address) {
+			    StrAllocCat(address, ",");
+			}
+			StrAllocCat(address, cp);
+		    }
+		    if (cp1) {
+			*cp1 = '&';
+			cp = cp1;
+			cp1 = NULL;
+		    } else {
+			break;
+		    }
+		}
+		cp++;
+	    }
+	}
+    }
 
     /*
-     *  Unescape the address field. - FM
-     */
-    HTUnEscape(address);
-	
-    /*
      *  Convert any Explorer semi-colon Internet address
      *  separators to commas. - FM
      */
@@ -369,39 +646,97 @@ PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address,
 	cp = cp1;
     }
 
+    /*
+     *  Unescape the address field. - FM
+     */
+    HTUnEscape(address);
+    if (address[(strlen(address) - 1)] == ',')
+	address[(strlen(address) - 1)] = '\0';
+    if (*address == '\0') {
+	FREE(address);
+	if (TRACE) {
+	    fprintf(stderr,
+		    "mailmsg: No address in '%s'.\n",
+		    owner_address);
+	}
+	return;
+    }
+
 #ifdef UNIX
     sprintf(cmd, "%s %s", system_mail, system_mail_flags);
-
     if ((fd = popen(cmd, "w")) == NULL) {
 	FREE(address);
+	if (TRACE) {
+	    fprintf(stderr,
+		    "mailmsg: '%s' failed.\n",
+		    cmd);
+	}
 	return;
     }
 
-    fprintf(fd,"To: %s\n", address);
-    fprintf(fd,"Subject: Lynx Error in %s\n", filename);
-    fprintf(fd,"X-URL: %s\n", filename);
-    fprintf(fd,"X-Mailer: Lynx, Version %s\n\n", LYNX_VERSION);
+    fprintf(fd, "To: %s\n", address);
+    fprintf(fd, "Subject: Lynx Error in %s\n", filename);
+    if (personal_mail_address != NULL && *personal_mail_address != '\0') {
+	fprintf(fd, "Cc: %s\n", personal_mail_address);
+    }
+    fprintf(fd, "X-URL: %s\n", filename);
+    fprintf(fd, "X-Mailer: Lynx, Version %s\n\n", LYNX_VERSION);
 #endif /* UNIX */
 #if defined(VMS) || defined(DOSPATH)
-    sprintf(my_tempfile, "%s%s", lynx_temp_space, "temp_mail.txt");
-    if ((fd = LYNewTxtFile(my_tempfile)) == NULL) {
+    tempname(my_tmpfile, NEW_FILE);
+    if (((cp = strrchr(my_tmpfile, '.')) != NULL) &&
+	NULL == strchr(cp, ']') &&
+	NULL == strchr(cp, '/')) {
+	*cp = '\0';
+	strcat(my_tmpfile, ".txt");
+    }
+    if ((fd = LYNewTxtFile(my_tmpfile)) == NULL) {
+	if (TRACE) {
+	    fprintf(stderr,
+		    "mailmsg: Could not fopen '%s'.\n",
+		    my_tmpfile);
+	}
 	FREE(address);
 	return;
     }
+    if (isPMDF) {
+	tempname(hdrfile, NEW_FILE);
+	if (((cp = strrchr(hdrfile, '.')) != NULL) &&
+	    NULL == strchr(cp, ']') &&
+	    NULL == strchr(cp, '/')) {
+	    *cp = '\0';
+	    strcat(hdrfile, ".txt");
+	}
+	if ((hfd = LYNewTxtFile(hdrfile)) == NULL) {
+	    if (TRACE) {
+		fprintf(stderr,
+			"mailmsg: Could not fopen '%s'.\n",
+			hdrfile);
+	    }
+	    FREE(address);
+	    return;
+	}
+
+	if (personal_mail_address != NULL && *personal_mail_address != '\0') {
+	    fprintf(fd, "Cc: %s\n", personal_mail_address);
+	}
+	fprintf(fd, "X-URL: %s\n", filename);
+	fprintf(fd, "X-Mailer: Lynx, Version %s\n\n", LYNX_VERSION);
+    }
 #endif /* VMS */
 
     fprintf(fd, "The link   %s :?: %s \n",
-    		links[cur].lname, links[cur].target);
+		links[cur].lname, links[cur].target);
     fprintf(fd, "called \"%s\"\n", links[cur].hightext);
     fprintf(fd, "in the file \"%s\" called \"%s\"", filename, linkname);
 
-    fputs("\nwas requested but was not available.",fd);
-    fputs("\n\nThought you might want to know.",fd);
+    fputs("\nwas requested but was not available.", fd);
+    fputs("\n\nThought you might want to know.", fd);
 
     fputs("\n\nThis message was automatically generated by\n", fd);
     fprintf(fd, "Lynx ver. %s", LYNX_VERSION);
     if ((LynxSigFile != NULL) &&
-        (fp = fopen(LynxSigFile, "r")) != NULL) {
+	(fp = fopen(LynxSigFile, "r")) != NULL) {
 	fputs("-- \n", fd);
 	while (fgets(cmd, sizeof(cmd), fp) != NULL)
 	    fputs(cmd, fd);
@@ -413,9 +748,35 @@ PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address,
 #if defined(VMS) || defined(DOSPATH)
     fclose(fd);
 #ifdef VMS
-    sprintf(cmd, "%s /subject=\"Lynx Error in %s\" %s ",
-    		 system_mail, filename, my_tempfile);
-
+    if (isPMDF) {
+	/*
+	 *  For PMDF, put the subject in the
+	 *  header file and close it. - FM
+	 */
+	fprintf(hfd, "Subject: Lynx Error in %.56s\n\n", filename);
+	fclose(hfd);
+	/*
+	 *  Now set up the command. - FM
+	 */
+	sprintf(cmd,
+		"%s %s %s,%s ",
+		system_mail,
+		system_mail_flags,
+		hdrfile,
+		my_tmpfile);
+    } else {
+	/*
+	 *  For "generic" VMS MAIL, include the
+	 *  subject in the command. - FM
+	 */
+	sprintf(cmd,
+		"%s %s/self/subject=\"Lynx Error in %.56s\" %s ",
+		system_mail,
+		system_mail_flags,
+		filename,
+		my_tmpfile);
+    }
+    StrAllocCopy(command, cmd);
     address_ptr1 = address;
     do {
 	if ((cp = strchr(address_ptr1, ',')) != NULL) {
@@ -425,20 +786,27 @@ PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address,
 	    address_ptr2 = NULL;
 
 	if (strlen(address) > 3) {
-	    if (!first)
-		strcat(cmd, ",");  /* add a comma */
-	    sprintf(&cmd[strlen(cmd)], mail_adrs, address_ptr1);
+	    if (!first) {
+		StrAllocCat(command, ",");
+	    }
+	    sprintf(cmd, mail_adrs, address_ptr1);
+	    StrAllocCat(command, cmd);
 	    first = FALSE;
 	}
-
 	address_ptr1 = address_ptr2;
     } while (address_ptr1 != NULL);
 
-#else
-	 sprintf(cmd, "%s -t \"%s\" -F %s", system_mail, address, my_tempfile);
-#endif
+    system(command);
+    FREE(command);
+    remove(my_tmpfile);
+    if (isPMDF) {
+	remove(hdrfile);
+    }
+#else /* DOSPATH */
+    sprintf(cmd, "%s -t \"%s\" -F %s", system_mail, address, my_tmpfile);
     system(cmd);
-    remove(my_tempfile);
+    remove(my_tmpfile);
+#endif
 #endif /* VMS */
 
     if (traversal) {
@@ -459,7 +827,7 @@ PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address,
 		    (void) signal(SIGTSTP,SIG_DFL);
 #endif /* SIGTSTP */
 		exit(-1);
-            }
+	    }
 	}
 
 	fprintf(ofp, "%s\t%s \tin %s\n",
@@ -473,7 +841,7 @@ PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address,
 
 /*
 **  reply_by_mail() invokes sendmail on Unix or mail on VMS to send
-**  a comment  from the users to the owner 
+**  a comment  from the users to the owner
 */
 PUBLIC void reply_by_mail ARGS3(
 	char *,		mail_address,
@@ -483,21 +851,31 @@ PUBLIC void reply_by_mail ARGS3(
     char user_input[1000];
     FILE *fd, *fp;
     char *address = NULL;
+    char *ccaddr = NULL;
+    char *keywords = NULL;
     char *searchpart = NULL;
     char *body = NULL;
     char *cp = NULL, *cp0 = NULL, *cp1 = NULL;
     char *temp = NULL;
     int i, len;
     int c = 0;  /* user input */
-    char my_tempfile[256], cmd[512];
+    char my_tmpfile[256], cmd[512];
 #ifdef DOSPATH
-	 char tmpfile2[256];
+    char tmpfile2[256];
 #endif
     static char *personal_name = NULL;
     char subject[80];
 #ifdef VMS
     char *address_ptr1 = NULL, *address_ptr2 = NULL;
+    char *command = NULL;
     BOOLEAN first = TRUE;
+    BOOLEAN isPMDF = FALSE;
+    char hdrfile[256];
+    FILE *hfd;
+
+    if (!strncasecomp(system_mail, "PMDF SEND", 9)) {
+	isPMDF = TRUE;
+    }
 #else
     char buf[512];
     char *header = NULL;
@@ -513,19 +891,34 @@ PUBLIC void reply_by_mail ARGS3(
 	return;
     }
 
-    tempname(my_tempfile,NEW_FILE);
-    if (((cp = strrchr(my_tempfile, '.')) != NULL) &&
+    tempname(my_tmpfile, NEW_FILE);
+    if (((cp = strrchr(my_tmpfile, '.')) != NULL) &&
 #ifdef VMS
 	NULL == strchr(cp, ']') &&
 #endif /* VMS */
 	NULL == strchr(cp, '/')) {
 	*cp = '\0';
-	strcat(my_tempfile, ".txt");
+	strcat(my_tmpfile, ".txt");
     }
-    if ((fd = LYNewTxtFile(my_tempfile)) == NULL) {
+    if ((fd = LYNewTxtFile(my_tmpfile)) == NULL) {
 	HTAlert(MAILTO_URL_TEMPOPEN_FAILED);
 	return;
     }
+#ifdef VMS
+    if (isPMDF) {
+	tempname(hdrfile, NEW_FILE);
+	if (((cp = strrchr(hdrfile, '.')) != NULL) &&
+	    NULL == strchr(cp, ']') &&
+	    NULL == strchr(cp, '/')) {
+	    *cp = '\0';
+	    strcat(hdrfile, ".txt");
+	}
+	if ((hfd = LYNewTxtFile(hdrfile)) == NULL) {
+	    HTAlert(MAILTO_URL_TEMPOPEN_FAILED);
+	    return;
+	}
+    }
+#endif /* VMS */
     subject[0] = '\0';
 
     /*
@@ -540,10 +933,10 @@ PUBLIC void reply_by_mail ARGS3(
 	     *  Seek and handle a subject=foo. - FM
 	     */
 	    while (*cp != '\0') {
-	        if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
+		if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
 		    !strncasecomp(cp, "subject=", 8))
 		    break;
-	        cp++;
+		cp++;
 	    }
 	    if (*cp) {
 		cp += 8;
@@ -562,33 +955,108 @@ PUBLIC void reply_by_mail ARGS3(
 	    }
 
 	    /*
-	     *  Seek and handle cc=foo fields.  Excludes Bcc=foo
-	     *  and appends to address, so we can use our own cc
-	     *  field for the actual mailing. - FM
+	     *  Seek and handle to=address(es) fields.
+	     *  Appends to address. - FM
 	     */
 	    cp = (searchpart + 1);
 	    while (*cp != '\0') {
-	        if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
-		    !strncasecomp(cp, "cc=", 3)) {
+		if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
+		    !strncasecomp(cp, "to=", 3)) {
 		    cp += 3;
 		    if ((cp1 = strchr(cp, '&')) != NULL) {
-		        *cp1 = '\0';
+			*cp1 = '\0';
 		    }
-		    while (*cp == ',')
-		        cp++;
+		    while (*cp == ',' || isspace((unsigned char)*cp))
+			cp++;
 		    if (*cp) {
-		        StrAllocCat(address, ",");
+			if (*address) {
+			    StrAllocCat(address, ",");
+			}
 			StrAllocCat(address, cp);
 		    }
 		    if (cp1) {
-		        *cp1 = '&';
+			*cp1 = '&';
 			cp = cp1;
 			cp1 = NULL;
 		    } else {
-		        break;
+			break;
 		    }
 		}
-	        cp++;
+		cp++;
+	    }
+
+	    /*
+	     *  Seek and handle cc=address(es) fields.  Excludes
+	     *  Bcc=address(es) as unsafe.  We may append our own
+	     *  cc (below) as a list for the actual mailing. - FM
+	     */
+	    cp = (searchpart + 1);
+	    while (*cp != '\0') {
+		if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
+		    !strncasecomp(cp, "cc=", 3)) {
+		    cp += 3;
+		    if ((cp1 = strchr(cp, '&')) != NULL) {
+			*cp1 = '\0';
+		    }
+		    while (*cp == ',' || isspace((unsigned char)*cp))
+			cp++;
+		    if (*cp) {
+			if (ccaddr == NULL) {
+			    StrAllocCopy(ccaddr, cp);
+			} else {
+			    StrAllocCat(ccaddr, ",");
+			    StrAllocCat(ccaddr, cp);
+			}
+		    }
+		    if (cp1) {
+			*cp1 = '&';
+			cp = cp1;
+			cp1 = NULL;
+		    } else {
+			break;
+		    }
+		}
+		cp++;
+	    }
+
+	    /*
+	     *  Seek and handle keywords=term(s) fields. - FM
+	     */
+	    cp = (searchpart + 1);
+	    while (*cp != '\0') {
+		if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
+		    !strncasecomp(cp, "keywords=", 9)) {
+		    cp += 9;
+		    if ((cp1 = strchr(cp, '&')) != NULL) {
+			*cp1 = '\0';
+		    }
+		    while (*cp == ',' || isspace((unsigned char)*cp))
+			cp++;
+		    if (*cp) {
+			if (keywords == NULL) {
+			    StrAllocCopy(keywords, cp);
+			} else {
+			    StrAllocCat(keywords, cp);
+			    StrAllocCat(keywords, ", ");
+			}
+			StrAllocCat(keywords, cp);
+		    }
+		    if (cp1) {
+			*cp1 = '&';
+			cp = cp1;
+			cp1 = NULL;
+		    } else {
+			break;
+		    }
+		}
+		cp++;
+	    }
+	    if (keywords != NULL) {
+		if (*keywords != '\0') {
+		    HTUnEscape(keywords);
+		} else {
+		    FREE(keywords);
+		}
 	    }
 
 	    /*
@@ -596,24 +1064,24 @@ PUBLIC void reply_by_mail ARGS3(
 	     */
 	    cp = (searchpart + 1);
 	    while (*cp != '\0') {
-	        if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
+		if ((*(cp - 1) == '?' || *(cp - 1) == '&') &&
 		    !strncasecomp(cp, "body=", 5)) {
 		    cp += 5;
 		    if ((cp1 = strchr(cp, '&')) != NULL) {
-		        *cp1 = '\0';
+			*cp1 = '\0';
 		    }
 		    if (*cp) {
 			/*
 			 *  Break up the value into lines with
 			 *  a maximimum length of 78. - FM
 			 */
-		        StrAllocCopy(temp, cp);
+			StrAllocCopy(temp, cp);
 			HTUnEscape(temp);
 			cp0 = temp;
 			while((cp = strchr(cp0, '\n')) != NULL) {
 			    *cp = '\0';
 			    if (cp > cp0) {
-			        if (*(cp - 1) == '\r') {
+				if (*(cp - 1) == '\r') {
 				    *(cp - 1) = '\0';
 				}
 			    }
@@ -648,28 +1116,19 @@ PUBLIC void reply_by_mail ARGS3(
 			FREE(temp);
 		    }
 		    if (cp1) {
-		        *cp1 = '&';
+			*cp1 = '&';
 			cp = cp1;
 			cp1 = NULL;
 		    } else {
-		        break;
+			break;
 		    }
 		}
-	        cp++;
+		cp++;
 	    }
 
 	    FREE(searchpart);
 	}
     }
-    if (subject[0] == '\0' && title && *title) {
-	strncpy(subject, title, 70);
-	subject[70] = '\0';
-    }
-
-    /*
-     *  Unescape the address field. - FM
-     */
-    HTUnEscape(address);
 
     /*
      *  Convert any Explorer semi-colon Internet address
@@ -685,15 +1144,50 @@ PUBLIC void reply_by_mail ARGS3(
 	cp = cp1;
     }
     if (address[(strlen(address) - 1)] == ',')
-        address[(strlen(address) - 1)] = '\0';
+	address[(strlen(address) - 1)] = '\0';
     if (*address == '\0') {
-        FREE(address);
+	FREE(address);
+	FREE(ccaddr);
+	FREE(keywords);
 	FREE(body);
 	fclose(fd);		/* Close the tmpfile.  */
-	remove(my_tempfile);	/* Delete the tmpfile. */
+	remove(my_tmpfile);	/* Delete the tmpfile. */
 	HTAlert(NO_ADDRESS_IN_MAILTO_URL);
 	return;
     }
+    if (ccaddr != NULL) {
+	cp = ccaddr;
+	while ((cp1 = strchr(cp, '@')) != NULL) {
+	    cp1++;
+	    if ((cp0 = strchr(cp1, ';')) != NULL) {
+		*cp0 = ',';
+		cp1 = cp0 + 1;
+	    }
+	    cp = cp1;
+	}
+	if (ccaddr[(strlen(ccaddr) - 1)] == ',') {
+	    ccaddr[(strlen(ccaddr) - 1)] = '\0';
+	}
+	if (*ccaddr == '\0') {
+	    FREE(ccaddr);
+	}
+    }
+
+    /*
+     *  Unescape the address and ccaddr fields. - FM
+     */
+    HTUnEscape(address);
+    if (ccaddr != NULL) {
+	HTUnEscape(ccaddr);
+    }
+
+    /*
+     *  Set the default subject. - FM
+     */
+    if (subject[0] == '\0' && title && *title) {
+	strncpy(subject, title, 70);
+	subject[70] = '\0';
+    }
 
     /*
      *  Use ^G to cancel mailing of comment
@@ -701,18 +1195,23 @@ PUBLIC void reply_by_mail ARGS3(
      */
     signal(SIGINT, terminate_letter);
 
-    
+
 #ifdef VMS
-    if (!body) {
+    if (isPMDF || !body) {
 	/*
-	 *  Put the X-URL and X-Mailer lines in the tmpfile.
+	 *  Put the X-URL and X-Mailer lines in the hdrfile
+	 *  for PMDF or my_tmpfile for VMS MAIL. - FM
 	 */
-	fprintf(fd, "X-URL: %s%s\n",
-		    (filename && *filename) ? filename : "mailto:",
-		    (filename && *filename) ? "" : address);
-	fprintf(fd,"X-Mailer: Lynx, Version %s\n",LYNX_VERSION);
+	fprintf((isPMDF ? hfd : fd),
+		"X-URL: %s%s\n",
+		(filename && *filename) ? filename : "mailto:",
+		(filename && *filename) ? "" : address);
+	fprintf((isPMDF ? hfd : fd),
+		"X-Mailer: Lynx, Version %s\n",LYNX_VERSION);
 #ifdef NO_ANONYMOUS_MAIL
-	fprintf(fd,"\n");
+	if (!isPMDF) {
+	    fprintf(fd, "\n");
+	}
 #endif /* NO_ANONYMOUS_MAIL */
     }
 #else /* Unix: */
@@ -720,7 +1219,7 @@ PUBLIC void reply_by_mail ARGS3(
      *  Put the To: line in the header.
      */
 #ifndef DOSPATH
-    sprintf(buf,"To: %s\n", address);
+    sprintf(buf, "To: %s\n", address);
     StrAllocCopy(header, buf);
 #endif
 
@@ -753,11 +1252,12 @@ PUBLIC void reply_by_mail ARGS3(
     /*
      *  Put the X-URL and X-Mailer lines in the header.
      */
-    sprintf(buf, "X-URL: %s%s\n",
-    		 (filename && *filename) ? filename : "mailto:",
-		 (filename && *filename) ? "" : address);
+    sprintf(buf,
+	    "X-URL: %s%s\n",
+	    (filename && *filename) ? filename : "mailto:",
+	    (filename && *filename) ? "" : address);
     StrAllocCat(header, buf);
-    sprintf(buf,"X-Mailer: Lynx, Version %s\n",LYNX_VERSION);
+    sprintf(buf, "X-Mailer: Lynx, Version %s\n", LYNX_VERSION);
     StrAllocCat(header, buf);
 #endif /* VMS */
 
@@ -773,7 +1273,7 @@ PUBLIC void reply_by_mail ARGS3(
 	addstr(SENDING_COMMENT_TO);
     cp = address;
     while ((cp1 = strchr(cp, ',')) != NULL) {
-        *cp1 = '\0';
+	*cp1 = '\0';
 	while (*cp == ' ')
 	    cp++;
 	if (*cp) {
@@ -783,12 +1283,40 @@ PUBLIC void reply_by_mail ARGS3(
 	*cp1 = ',';
 	cp = (cp1 + 1);
     }
-    if (*cp)
-        addstr(cp);
+    if (*cp) {
+	addstr(cp);
+    }
+#ifdef VMS
+    if ((isPMDF == TRUE) &&
+	(cp = ccaddr) != NULL)
+#else
+    if ((cp = ccaddr) != NULL)
+#endif /* VMS */
+    {
+	if (strchr(cp, ',') != NULL) {
+	    addstr(WITH_COPIES_TO);
+	} else {
+	    addstr(WITH_COPY_TO);
+	}
+	while ((cp1 = strchr(cp, ',')) != NULL) {
+	    *cp1 = '\0';
+	    while (*cp == ' ')
+		cp++;
+	    if (*cp) {
+		addstr(cp);
+		addstr(",\n  ");
+	    }
+	    *cp1 = ',';
+	    cp = (cp1 + 1);
+	}
+	if (*cp) {
+	    addstr(cp);
+	}
+    }
     addstr(CTRL_G_TO_CANCEL_SEND);
 
 #ifdef VMS
-    if (!body) {
+    if (isPMDF || !body) {
 #endif /* VMS */
 #ifndef NO_ANONYMOUS_EMAIL
     /*
@@ -802,7 +1330,11 @@ PUBLIC void reply_by_mail ARGS3(
 	strcpy(user_input, personal_name);
     }
 #ifdef VMS
-    addstr("X_Personal_name: ");
+    if (isPMDF) {
+	addstr("Personal_name: ");
+    } else {
+	addstr("X_Personal_name: ");
+    }
 #else
     addstr("Personal Name: ");
 #endif /* VMS */
@@ -821,9 +1353,10 @@ PUBLIC void reply_by_mail ARGS3(
     term_letter = FALSE;
     if (*user_input) {
 #ifdef VMS
-	fprintf(fd,"X-Personal_name: %s\n",user_input);
+	fprintf((isPMDF ? hfd : fd),
+		"X-Personal_name: %s\n",user_input);
 #else
-	sprintf(buf,"X-Personal_name: %s\n",user_input);
+	sprintf(buf, "X-Personal_name: %s\n", user_input);
 	StrAllocCat(header, buf);
 #endif /* VMS */
     }
@@ -836,13 +1369,17 @@ PUBLIC void reply_by_mail ARGS3(
     if (personal_mail_address)
 	addstr(CTRL_U_TO_ERASE);
 #ifdef VMS
-    addstr("X-From: ");
+    if (isPMDF) {
+	addstr("From: ");
+    } else {
+	addstr("X-From: ");
+    }
 #else
     addstr("From: ");
 #endif /* VMS */
     /* Add the personal mail address if there is one. */
-    sprintf(user_input,"%s", (personal_mail_address ? 
-			      personal_mail_address : ""));
+    sprintf(user_input, "%s", (personal_mail_address ?
+			       personal_mail_address : ""));
     if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 ||
 	term_letter) {
 	addstr("\n");
@@ -855,12 +1392,17 @@ PUBLIC void reply_by_mail ARGS3(
     addstr("\n");
     remove_tildes(user_input);
 #ifdef VMS
-    if (*user_input)
-	fprintf(fd,"X-From: %s\n\n",user_input);
-    else
+    if (*user_input) {
+	if (isPMDF) {
+	    fprintf(hfd, "From: %s\n", user_input);
+	} else {
+	    fprintf(fd, "X-From: %s\n\n", user_input);
+	}
+    } else if (!isPMDF) {
 	fprintf(fd, "\n");
+    }
 #else
-    sprintf(buf,"From: %s\n",user_input);
+    sprintf(buf, "From: %s\n", user_input);
     StrAllocCat(header, buf);
 #endif /* VMS */
 #endif /* !NO_ANONYMOUS_EMAIL */
@@ -876,7 +1418,7 @@ PUBLIC void reply_by_mail ARGS3(
     addstr("Subject: ");
     /* Add the default subject. */
     sprintf(user_input, "%.70s%.63s",
-    			(subject[0] != '\0') ?
+			(subject[0] != '\0') ?
 				     subject :
 		    ((filename && *filename) ?
 				    filename : "mailto:"),
@@ -898,7 +1440,7 @@ PUBLIC void reply_by_mail ARGS3(
 #ifdef VMS
     sprintf(subject, "%.70s", user_input);
 #else
-    sprintf(buf,"Subject: %s\n",user_input);
+    sprintf(buf, "Subject: %s\n", user_input);
     StrAllocCat(header, buf);
 #endif /* VMS */
 
@@ -915,15 +1457,15 @@ PUBLIC void reply_by_mail ARGS3(
 	/*
 	 *  Add the mail address if there is one.
 	 */
-	sprintf(user_input,"%s", (personal_mail_address ? 
-				  personal_mail_address : ""));
+	sprintf(user_input, "%s", (personal_mail_address ?
+				   personal_mail_address : ""));
 	if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 ||
 	    term_letter) {
 	    addstr("\n");
 	    _statusline(COMMENT_REQUEST_CANCELLED);
 	    sleep(InfoSecs);
 	    fclose(fd);			/* Close the tmpfile. */
-	    scrollok(stdscr,FALSE);	/* Stop scrolling.    */
+	    scrollok(stdscr, FALSE);	/* Stop scrolling.    */
 	    goto cleanup;
 	}
 	addstr("\n");
@@ -931,36 +1473,54 @@ PUBLIC void reply_by_mail ARGS3(
     remove_tildes(user_input);
 #if defined (VMS) || defined (DOSPATH)
     if (*user_input) {
-        cp = user_input;
-	while (*cp == ' ' || *cp == ',')
+	cp = user_input;
+	while (*cp == ',' || isspace((unsigned char)*cp))
 	    cp++;
 	if (*cp) {
-	    StrAllocCat(address, ",");
-	    StrAllocCat(address, cp);
+	    if (ccaddr == NULL) {
+		StrAllocCopy(ccaddr, cp);
+	    } else {
+		StrAllocCat(ccaddr, ",");
+		StrAllocCat(ccaddr, cp);
+	    }
 	}
     }
+#endif
 #ifdef DOSPATH
-	 if (*address) {
-		sprintf(buf,"To: %s\n",address);
-		StrAllocCat(header, buf);
-	 }
+    if (*address) {
+	sprintf(buf, "To: %s\n", address);
+	StrAllocCat(header, buf);
+    }
 #endif
 
-#else
-    if (*user_input) {
-	sprintf(buf,"Cc: %s\n",user_input);
-	StrAllocCat(header, buf);
+#ifndef VMS
+    /*
+    **  Add the Cc: header. - FM
+    */
+    if (ccaddr != NULL && *ccaddr != '\0') {
+	StrAllocCat(header, "Cc: ");
+	StrAllocCat(header, ccaddr);
+	StrAllocCat(header, "\n");
+    }
+
+    /*
+    **  Add the Keywords: header. - FM
+    */
+    if (keywords != NULL && *keywords != '\0') {
+	StrAllocCat(header, "Keywords: ");
+	StrAllocCat(header, keywords);
+	StrAllocCat(header, "\n");
     }
 
     /*
      *  Terminate the header.
      */
-    sprintf(buf,"\n");
+    sprintf(buf, "\n");
     StrAllocCat(header, buf);
-#endif /* VMS */
+#endif /* !VMS */
 
     if (!no_editor && editor && *editor != '\0') {
-        /*
+	/*
 	 *  Use an external editor for the message.
 	 */
 	char *editor_arg = "";
@@ -968,12 +1528,12 @@ PUBLIC void reply_by_mail ARGS3(
 	if (body) {
 	    cp1 = body;
 	    while((cp = strchr(cp1, '\n')) != NULL) {
-	        *cp++ = '\0';
+		*cp++ = '\0';
 		fprintf(fd, "%s\n", cp1);
 		cp1 = cp;
 	    }
 	} else if (strcmp(HTLoadedDocumentURL(), "")) {
-            /*
+	    /*
 	     *  Ask if the user wants to include the original message.
 	     */
 	    BOOLEAN is_preparsed = (LYPreparsedSource &&
@@ -982,12 +1542,12 @@ PUBLIC void reply_by_mail ARGS3(
 		_statusline(INC_PREPARSED_MSG_PROMPT);
 	    else
 		_statusline(INC_ORIG_MSG_PROMPT);
-            c = 0;
-            while (TOUPPER(c) != 'Y' && TOUPPER(c) != 'N' &&
-	           !term_letter && c != 7   && c != 3)
-                c = LYgetch();
-            if (TOUPPER(c) == 'Y') {
-                /*
+	    c = 0;
+	    while (TOUPPER(c) != 'Y' && TOUPPER(c) != 'N' &&
+		   !term_letter && c != 7   && c != 3)
+		c = LYgetch();
+	    if (TOUPPER(c) == 'Y') {
+		/*
 		 *  The 1 will add the reply "> " in front of every line.
 		 */
 		if (is_preparsed)
@@ -995,7 +1555,7 @@ PUBLIC void reply_by_mail ARGS3(
 		else
 		    print_wwwfile_to_fd(fd, 1);
 	    }
-        }
+	}
 	fclose(fd);		/* Close the tmpfile. */
 	scrollok(stdscr,FALSE);	/* Stop scrolling.    */
 
@@ -1008,7 +1568,7 @@ PUBLIC void reply_by_mail ARGS3(
 	if (strstr(editor, "pico")) {
 	    editor_arg = " -t"; /* No prompt for filename to use */
 	}
-	sprintf(user_input,"%s%s %s",editor,editor_arg,my_tempfile);
+	sprintf(user_input, "%s%s %s", editor, editor_arg, my_tmpfile);
 	_statusline(SPAWNING_EDITOR_FOR_MAIL);
 	stop_curses();
 	if (system(user_input)) {
@@ -1031,7 +1591,7 @@ PUBLIC void reply_by_mail ARGS3(
 	i = (LYlines - 5);
 	while((cp = strchr(cp1, '\n')) != NULL) {
 	    if (i <= 0) {
-	        addstr(RETURN_TO_CONTINUE);
+		addstr(RETURN_TO_CONTINUE);
 		refresh();
 		c = LYgetch();
 		addstr("\n");
@@ -1060,7 +1620,7 @@ PUBLIC void reply_by_mail ARGS3(
 	scrollok(stdscr,FALSE);	/* Stop scrolling.	  */
 
     } else {
-        /*
+	/*
 	 *  Use the internal line editor for the message.
 	 */
 	addstr(ENTER_MESSAGE_BELOW);
@@ -1068,9 +1628,9 @@ PUBLIC void reply_by_mail ARGS3(
 	addstr(ENTER_PERIOD_WHEN_DONE_B);
 	addstr("\n\n");
 	refresh();
-    	*user_input = '\0';
+	*user_input = '\0';
 	if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 ||
-	    term_letter || STREQ(user_input,".")) {
+	    term_letter || STREQ(user_input, ".")) {
 	    _statusline(COMMENT_REQUEST_CANCELLED);
 	    sleep(InfoSecs);
 	    fclose(fd);			/* Close the tmpfile. */
@@ -1078,13 +1638,13 @@ PUBLIC void reply_by_mail ARGS3(
 	    goto cleanup;
 	}
 
-	while (!STREQ(user_input,".") && !term_letter) { 
+	while (!STREQ(user_input, ".") && !term_letter) {
 	    addstr("\n");
 	    remove_tildes(user_input);
-	    fprintf(fd,"%s\n",user_input);
+	    fprintf(fd, "%s\n", user_input);
 	    *user_input = '\0';
 	    if (LYgetstr(user_input, VISIBLE,
-	    		 sizeof(user_input), NORECALL) < 0) {
+			 sizeof(user_input), NORECALL) < 0) {
 		_statusline(COMMENT_REQUEST_CANCELLED);
 		sleep(InfoSecs);
 		fclose(fd);		/* Close the tmpfile. */
@@ -1093,7 +1653,7 @@ PUBLIC void reply_by_mail ARGS3(
 	    }
 	}
 
-	fprintf(fd,"\n");	/* Terminate the message. */
+	fprintf(fd, "\n");	/* Terminate the message. */
 	fclose(fd);		/* Close the tmpfile.	  */
 	scrollok(stdscr,FALSE);	/* Stop scrolling.	  */
     }
@@ -1106,31 +1666,31 @@ PUBLIC void reply_by_mail ARGS3(
 #endif /* !VMS */
     LYStatusLine = (LYlines - 1);
     if (body)
-        _statusline(SEND_MESSAGE_PROMPT);
+	_statusline(SEND_MESSAGE_PROMPT);
     else
-        _statusline(SEND_COMMENT_PROMPT);
+	_statusline(SEND_COMMENT_PROMPT);
     LYStatusLine = -1;
     c = 0;
     while (TOUPPER(c) != 'Y' && TOUPPER(c) != 'N' &&
 	   !term_letter && c != 7   && c != 3)
 	c = LYgetch();
     if (TOUPPER(c) != 'Y') {
-        clear();  /* clear the screen */
+	clear();  /* clear the screen */
 	goto cleanup;
     }
     if ((body == NULL && LynxSigFile != NULL) &&
-        (fp = fopen(LynxSigFile, "r")) != NULL) {
+	(fp = fopen(LynxSigFile, "r")) != NULL) {
 	LYStatusLine = (LYlines - 1);
 	_user_message(APPEND_SIG_FILE, LynxSigFile);
 	c = 0;
-        LYStatusLine = -1;
+	LYStatusLine = -1;
 	while (TOUPPER(c) != 'Y' && TOUPPER(c) != 'N' &&
 	       !term_letter && c != 7   && c != 3)
 	    c = LYgetch();
 	if (TOUPPER(c) == 'Y') {
-	    if ((fd = fopen(my_tempfile, "a")) != NULL) {
-	        fputs("-- \n", fd);
-	        while (fgets(user_input, sizeof(user_input), fp) != NULL) {
+	    if ((fd = fopen(my_tmpfile, "a")) != NULL) {
+		fputs("-- \n", fd);
+		while (fgets(user_input, sizeof(user_input), fp) != NULL) {
 		    fputs(user_input, fd);
 		}
 		fclose(fd);
@@ -1145,62 +1705,126 @@ PUBLIC void reply_by_mail ARGS3(
      */
 #ifdef VMS
     /*
-     *  Set the mail command.
+     *  Set the mail command. - FM
      */
-    sprintf(cmd, "%s %s/subject=\"%s\" %s ",
-    		 system_mail,
-		 (strncasecomp(system_mail, "MAIL", 4) ? "" : "/noself"),
-		 subject, my_tempfile);
+    if (isPMDF) {
+	/*
+	 *  For PMDF, put any keywords and the subject
+	 *  in the header file and close it. - FM
+	 */
+	if (keywords != NULL && *keywords != '\0') {
+	    fprintf(hfd, "Keywords: %s\n", keywords);
+	}
+	fprintf(hfd, "Subject: %s\n\n", subject);
+	fclose(hfd);
+	/*
+	 *  Now set up the command. - FM
+	 */
+	sprintf(cmd,
+		"%s %s %s,%s ",
+		system_mail,
+		system_mail_flags,
+		hdrfile,
+		my_tmpfile);
+    } else {
+	/*
+	 *  For "generic" VMS MAIL, include the subject in the
+	 *  command, and ignore any keywords to minimize risk
+	 *  of them making the line too long or having problem
+	 *  characters. - FM
+	 */
+	sprintf(cmd,
+		"%s %s%s/subject=\"%s\" %s ",
+		system_mail,
+		system_mail_flags,
+		(strncasecomp(system_mail, "MAIL", 4) ? "" : "/noself"),
+		subject,
+		my_tmpfile);
+    }
+    StrAllocCopy(command, cmd);
 
     /*
-     *  Now add all the people in the address field.
+     *  Now add all the people in the address field. - FM
      */
     address_ptr1 = address;
     do {
 	if ((cp = strchr(address_ptr1, ',')) != NULL) {
 	    address_ptr2 = (cp+1);
 	    *cp = '\0';
-	} else
+	} else {
 	    address_ptr2 = NULL;
+	}
 
 	/*
 	 *  4 letters is arbitrarily the smallest posible mail
 	 *  address, at least for lynx.  That way extra spaces
 	 *  won't confuse the mailer and give a blank address.
 	 */
-	if (strlen(address_ptr1) > 3) {	
-	    if (!first)
-		strcat(cmd, ",");  /* add a comma */
-	    sprintf( &cmd[strlen(cmd)], mail_adrs, address_ptr1);
+	if (strlen(address_ptr1) > 3) {
+	    if (!first) {
+		StrAllocCat(command, ",");
+	    }
+	    sprintf(cmd, mail_adrs, address_ptr1);
+	    StrAllocCat(command, cmd);
 	    first = FALSE;
 	}
-
 	address_ptr1 = address_ptr2;
     } while (address_ptr1 != NULL);
 
+    /*
+     *  Now add all the people in the CC field. - FM
+     */
+    if (ccaddr != NULL && *ccaddr != '\0') {
+	address_ptr1 = ccaddr;
+	do {
+	    if ((cp = strchr(address_ptr1, ',')) != NULL) {
+		address_ptr2 = (cp+1);
+		*cp = '\0';
+	    } else {
+		address_ptr2 = NULL;
+	    }
+
+	    /*
+	     *  4 letters is arbitrarily the smallest posible mail
+	     *  address, at least for lynx.  That way extra spaces
+	     *  won't confuse the mailer and give a blank address.
+	     */
+	    if (strlen(address_ptr1) > 3) {
+		StrAllocCat(command, ",");
+		sprintf(cmd, mail_adrs, address_ptr1);
+		if (isPMDF) {
+		    strcat(cmd, "/CC");
+		}
+		StrAllocCat(command, cmd);
+	    }
+	    address_ptr1 = address_ptr2;
+	} while (address_ptr1 != NULL);
+    }
+
     stop_curses();
-    printf("Sending your comment:\n\n$ %s\n\nPlease wait...", cmd);
-    system(cmd);
-    sleep(MessageSecs);
+    printf("Sending your comment:\n\n$ %s\n\nPlease wait...", command);
+    system(command);
+    FREE(command);
+    sleep(AlertSecs);
     start_curses();
     goto cleandown;
 #else /* Unix: */
     /*
-     *  Send the tmpfile into sendmail.  
+     *  Send the tmpfile into sendmail.
      */
     _statusline(SENDING_YOUR_MSG);
     sprintf(cmd, "%s %s", system_mail, system_mail_flags);
 #ifdef DOSPATH
-	 tempname(tmpfile2,NEW_FILE);
-	 if (((cp = strrchr(tmpfile2, '.')) != NULL) &&
-		NULL == strchr(cp, '/')) {
-			*cp = '\0';
-			strcat(tmpfile2, ".txt");
-	 }
-	 if ((fp = fopen(tmpfile2,"w")) == NULL) {
-		HTAlert(MAILTO_URL_TEMPOPEN_FAILED);
-		return;
-	 }
+    tempname(tmpfile2, NEW_FILE);
+    if (((cp = strrchr(tmpfile2, '.')) != NULL) &&
+	NULL == strchr(cp, '/')) {
+	*cp = '\0';
+	strcat(tmpfile2, ".txt");
+    }
+    if ((fp = LYNewTxtFile(tmpfile2)) == NULL) {
+	HTAlert(MAILTO_URL_TEMPOPEN_FAILED);
+	return;
+    }
 #else
     signal(SIGINT, SIG_IGN);
     fp = popen(cmd, "w");
@@ -1210,7 +1834,7 @@ PUBLIC void reply_by_mail ARGS3(
 	goto cleanup;
     }
 #endif /* DOSPATH */
-    fd = fopen(my_tempfile, "r");
+    fd = fopen(my_tmpfile, "r");
     if (fd == NULL) {
 	_statusline(COMMENT_REQUEST_CANCELLED);
 	sleep(InfoSecs);
@@ -1235,7 +1859,7 @@ PUBLIC void reply_by_mail ARGS3(
     fclose(fd);	/* Close the tmpfile. */
 
     if (TRACE)
-	printf("%s\n",cmd);
+	printf("%s\n", cmd);
 #endif /* VMS */
 
     /*
@@ -1251,8 +1875,19 @@ cleanup:
 cleandown:
 #endif /* VMS */
     term_letter = FALSE;
-    remove(my_tempfile);	/* Delete the tmpfile. */
+#ifdef VMS
+    FREE(command);
+    while (remove(my_tmpfile) == 0)
+	;		 /* Delete the tmpfile(s). */
+    if (isPMDF) {
+	remove(hdrfile); /* Delete the hdrfile. */
+    }
+#else
+    remove(my_tmpfile);	 /* Delete the tmpfile. */
+#endif /* VMS */
     FREE(address);
+    FREE(ccaddr);
+    FREE(keywords);
     FREE(body);
     return;
 }
@@ -1263,7 +1898,9 @@ PRIVATE void terminate_letter ARGS1(int,sig)
     /* Reassert the AST */
     signal(SIGINT, terminate_letter);
 #if defined(VMS) || defined(DOSPATH)
-    /* Refresh the screen to get rid of the "interrupt" message */
+    /*
+     *  Refresh the screen to get rid of the "interrupt" message.
+     */
     if (!dump_output_immediately) {
 	lynx_force_repaint();
 	refresh();
@@ -1273,9 +1910,10 @@ PRIVATE void terminate_letter ARGS1(int,sig)
 
 PRIVATE void remove_tildes ARGS1(char *,string)
 {
-       /* change the first character to a space if
-	* it is a '~'
-	*/
-    if(*string == '~')
+   /*
+    *  Change the first character to
+    *  a space if it is a '~'.
+    */
+    if (*string == '~')
 	*string = ' ';
 }
diff --git a/src/LYMain.c b/src/LYMain.c
index c3d208cd..7aaee2da 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -265,7 +265,7 @@ 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. */
 PUBLIC char *startfile = NULL;	/* the first file */
-PUBLIC char *helpfile = NULL; 	/* the main help file */
+PUBLIC char *helpfile = NULL;	/* the main help file */
 PUBLIC char *helpfilepath = NULL;   /* the path to the help file set */
 PUBLIC char *lynxjumpfile = NULL;   /* the current jump file URL */
 PUBLIC char *lynxlistfile = NULL;   /* the current list file URL */
@@ -282,8 +282,8 @@ 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;    /* The 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 */
@@ -293,7 +293,7 @@ PUBLIC BOOLEAN pseudo_inline_alts = MAKE_PSEUDO_ALTS_FOR_INLINES;
 PUBLIC BOOLEAN crawl=FALSE;	     /* Do crawl? */
 PUBLIC BOOLEAN traversal=FALSE;     /* Do traversals? */
 PUBLIC BOOLEAN check_realm=FALSE;   /* Restrict to the starting realm? */
-	       /* Links beyond a displayed page with no links? */ 
+	       /* Links beyond a displayed page with no links? */
 PUBLIC BOOLEAN more_links=FALSE;
 PUBLIC int     ccount=0;  /* Starting number for lnk#.dat files in crawls */
 PUBLIC BOOLEAN LYCancelledFetch=FALSE; /* TRUE if cancelled binary fetch */
@@ -369,6 +369,7 @@ PUBLIC BOOLEAN LYStripDotDotURLs = TRUE;	/* Try to fix ../ in some URLs? */
 PUBLIC BOOLEAN LYForceSSLCookiesSecure = FALSE;
 PUBLIC BOOLEAN LYNoCc = FALSE;
 PUBLIC BOOLEAN LYPreparsedSource = FALSE;	/* Show source as preparsed?	 */
+PUBLIC BOOLEAN LYPrependBaseToSource = TRUE;
 
 /* These are declared in cutil.h for current freeWAIS libraries. - FM */
 #ifdef DECLARE_WAIS_LOGFILES
@@ -527,7 +528,7 @@ PUBLIC int main ARGS2(
     char filename[256];
     BOOL LYGetStdinArgs = FALSE;
 
-#ifdef _WINDOWS 
+#ifdef _WINDOWS
     WSADATA WSAData;
     {
 	int err;
@@ -720,7 +721,7 @@ PUBLIC int main ARGS2(
 	    StrAllocCopy(lynx_temp_space, "sys$scratch:");
 	} else {
 	    if (lynx_temp_space[len-1] != '/')
-	        StrAllocCat(lynx_temp_space, "/");
+		StrAllocCat(lynx_temp_space, "/");
             StrAllocCopy(temp, HTVMS_name("", lynx_temp_space));
 	    StrAllocCopy(lynx_temp_space, temp);
 	    FREE(temp);
@@ -792,13 +793,13 @@ PUBLIC int main ARGS2(
 	    WWW_TraceFlag = TRUE;
 	} else if (strncmp(argv[i], "-tlog", 5) == 0) {
 	    if (LYUseTraceLog) {
-	        LYUseTraceLog = FALSE;
+		LYUseTraceLog = FALSE;
 	    } else {
-	        LYUseTraceLog = TRUE;
+		LYUseTraceLog = TRUE;
 	    }
 	} else if (strncmp(argv[i], "-anonymous", 10) == 0) {
 	    if (!LYValidate)
-	        parse_restrictions("default");
+		parse_restrictions("default");
 	    anon_restrictions_set = TRUE;
 	} else if (strcmp(argv[i], "-validate") == 0) {
 	    /*
@@ -854,11 +855,11 @@ PUBLIC int main ARGS2(
     }
     if (LYGetStdinArgs == TRUE) {
 	char buf[1025];
- 
+
 	while (fgets(buf, sizeof(buf) - 1, stdin)) {
 	    int j;
-     
-	    for (j = strlen(buf) - 1; j > 0 && 
+
+	    for (j = strlen(buf) - 1; j > 0 &&
 		(buf[j] == CR || buf[j] == LF); j--) {
 		buf[j] = '\0';
 	    }
@@ -895,7 +896,7 @@ PUBLIC int main ARGS2(
 			cp++;
 		    if (*cp)
 			StrAllocCopy(lynx_cfg_file, cp);
-	        }
+		}
 #if defined(USE_HASH)
 	    } else if (strncmp(buf, "-lss", 4) == 0) {
 		if ((cp = strchr(buf,'=')) != NULL) {
@@ -908,7 +909,7 @@ PUBLIC int main ARGS2(
 			cp++;
 		    if (*cp)
 			StrAllocCopy(lynx_cfg_file, cp);
-	        }
+		}
 		if (TRACE)
 		    fprintf(stderr, "LYMain found -lss flag, lss file is %s\n",
 			lynx_lss_file ? lynx_lss_file : "<NONE>");
@@ -991,7 +992,7 @@ PUBLIC int main ARGS2(
 		    StrAllocCat(*post_data, buf);
 		}
 	    } else if (buf[0] != '\0') {
-	        char *argument = NULL;
+		char *argument = NULL;
 
 		if (LYStdinArgs == NULL) {
 		    LYStdinArgs = HTList_new();
@@ -1072,6 +1073,8 @@ PUBLIC int main ARGS2(
 	    exit(-1);
 	}
 #endif /* VMS */
+	fflush(stdout);
+	fflush(stderr);
 	*stderr = *LYTraceLogFP;
 	fprintf(stderr, "\t\t%s\n\n", LYNX_TRACELOG_TITLE);
     }
@@ -1120,7 +1123,7 @@ PUBLIC int main ARGS2(
      *  use the userdefs.h definition.
      */
     if (!lynx_cfg_file)
-    	StrAllocCopy(lynx_cfg_file, LYNX_CFG_FILE);
+	StrAllocCopy(lynx_cfg_file, LYNX_CFG_FILE);
 
     /*
      *  Convert a '~' in the configuration file path to $HOME.
@@ -1232,7 +1235,7 @@ PUBLIC int main ARGS2(
      */
     strcpy(filename, LYNX_SIG_FILE);
     if (LYPathOffHomeOK(filename, sizeof(filename))) {
-    	StrAllocCopy(LynxSigFile, filename);
+	StrAllocCopy(LynxSigFile, filename);
 	LYAddPathToHome(filename, sizeof(filename), LynxSigFile);
 	StrAllocCopy(LynxSigFile, filename);
 	if (TRACE)
@@ -1240,7 +1243,7 @@ PUBLIC int main ARGS2(
     } else {
 	if (TRACE)
 	    fprintf(stderr, "LYNX_SIG_FILE '%s' is bad. Ignoring.\n",
-	    		    LYNX_SIG_FILE);
+			    LYNX_SIG_FILE);
     }
 
     /*
@@ -1274,7 +1277,7 @@ PUBLIC int main ARGS2(
 	    *(cp++) = '\0';
 	    StrAllocCopy(temp, lynx_save_space);
 	    if (((len = strlen(temp)) > 0) && temp[len-1] == '/')
-	        temp[len-1] = '\0';
+		temp[len-1] = '\0';
 #ifdef DOSPATH
 	    StrAllocCat(temp, HTDOS_wwwName((char *)Home_Dir()));
 #else
@@ -1293,13 +1296,13 @@ PUBLIC int main ARGS2(
             lynx_save_space[i] = TOLOWER(lynx_save_space[i]);
         if (strchr(lynx_save_space, '/') != NULL) {
 	    if ((len = strlen(lynx_save_space)) == 1) {
-	        StrAllocCopy(lynx_save_space, "sys$login:");
+		StrAllocCopy(lynx_save_space, "sys$login:");
 	    } else {
-	        if (lynx_save_space[len-1] != '/')
-	            StrAllocCat(lynx_save_space, "/");
+		if (lynx_save_space[len-1] != '/')
+		    StrAllocCat(lynx_save_space, "/");
                 StrAllocCopy(temp, HTVMS_name("", lynx_save_space));
-	        StrAllocCopy(lynx_save_space, temp);
-	        FREE(temp);
+		StrAllocCopy(lynx_save_space, temp);
+		FREE(temp);
 	    }
         }
 	if (strchr(lynx_save_space, ':') == NULL &&
@@ -1408,25 +1411,22 @@ PUBLIC int main ARGS2(
     if (LYPreparsedSource) {
 	HTPreparsedFormatInit();
     }
-    if (dump_output_width > 0) {
-	LYcols = dump_output_width;
-    }
-	
+
 #if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS)
 #ifdef NEVER_ALLOW_REMOTE_EXEC
     if (local_exec) {
         local_exec = FALSE;
-	local_exec_on_local_files=TRUE;
+	local_exec_on_local_files = TRUE;
     }
 #endif /* NEVER_ALLOW_REMOTE_EXEC */
 #endif /* EXEC_LINKS || EXEC_SCRIPTS */
 
     if (emacs_keys)
         set_emacs_keys();
- 
+
     if (vi_keys)
         set_vi_keys();
- 
+
     if (number_links && keypad_mode == NUMBERS_AS_ARROWS)
 	keypad_mode = LINKS_ARE_NUMBERED;
     if (keypad_mode == NUMBERS_AS_ARROWS)
@@ -1453,6 +1453,13 @@ PUBLIC int main ARGS2(
     }
 
     /*
+     *  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,
@@ -1470,7 +1477,7 @@ PUBLIC int main ARGS2(
     set_vms_keys();
 #endif /* VMS */
 
-    /* trap interrupts */    
+    /* trap interrupts */
     if (!dump_output_immediately)
 #ifndef NOSIGHUP
         (void) signal(SIGHUP, cleanup_sig);
@@ -1684,6 +1691,9 @@ PUBLIC int main ARGS2(
 	if (display != NULL && *display != '\0') {
 	    LYisConfiguredForX = TRUE;
 	}
+	if (dump_output_width > 0) {
+	    LYcols = dump_output_width;
+	}
 	status = mainloop();
 	if (!nolist &&
 	    (keypad_mode == LINKS_ARE_NUMBERED ||
@@ -1705,16 +1715,16 @@ PUBLIC int main ARGS2(
 	 *  Finish setting up and start an
 	 *  INTERACTIVE session. - FM
 	 */
- 	if (setup(terminal)) {
+	if (setup(terminal)) {
 	    if (display != NULL && *display != '\0') {
-	        LYisConfiguredForX = TRUE;
+		LYisConfiguredForX = TRUE;
 	    }
 	    ena_csi((LYlowest_eightbit[current_char_set] > 155));
 	    status = mainloop();
 	    cleanup();
 	}
     }
- 
+
     exit(status);
 }
 
@@ -1826,7 +1836,7 @@ PRIVATE void parse_arg ARGS3(
 	    int j;
 
 	    for (j = 0; cp[j]; j++)
-	        cp[j] = TOLOWER(cp[j]);
+		cp[j] = TOLOWER(cp[j]);
 	    if (local_flag) {
 		StrAllocCopy(UCAssume_localMIMEcharset, cp);
 		if (UCAssume_localMIMEcharset && *UCAssume_localMIMEcharset)
@@ -1860,7 +1870,7 @@ PRIVATE void parse_arg ARGS3(
 	 *  Authentication information for protected documents.
 	 */
 	char *auth_info = NULL;
-	
+
 	if (nextarg) {
 	    StrAllocCopy(auth_info, cp);
 	    memset(cp, ' ', strlen(cp));	/* Let's not show too much */
@@ -1874,7 +1884,7 @@ PRIVATE void parse_arg ARGS3(
 		}
 	    }
 	    if (*auth_info) {					/* Id */
-	        HTUnEscape(auth_info);
+		HTUnEscape(auth_info);
 		StrAllocCopy(authentication_info[0], auth_info);
 	    }
 	    FREE(auth_info);
@@ -1889,12 +1899,17 @@ PRIVATE void parse_arg ARGS3(
     if (strcmp(argv[0], "-base") == 0) {
         /*
 	 *  Treat -source equivalently to an interactive
-	 *  download, so that a BASE tag is prepended for
-	 *  text/html content types. - FM
+	 *  download with LYPrefixBaseToSource configured
+	 *  to TRUE, so that a BASE tag is prepended for
+	 *  text/html content types.  We normally treat
+	 *  the module-wide global LYPrefixBaseToSource
+	 *  flag as FALSE with -source, but force it TRUE,
+	 *  later, if LYPrependBase is set TRUE here. - FM
 	 */
 	LYPrependBase = TRUE;
-	if (HTOutputFormat == HTAtom_for("www/dump"))
+	if (HTOutputFormat == HTAtom_for("www/dump")) {
 	    HTOutputFormat = HTAtom_for("www/download");
+	}
 
     } else if (strcmp(argv[0], "-book") == 0) {
         /*
@@ -1935,7 +1950,7 @@ PRIVATE void parse_arg ARGS3(
 
     } else if (strncmp(argv[0], "-cfg", 4) == 0) {
 	/*
-	 *  Already read the alternate configuration file 
+	 *  Already read the alternate configuration file
 	 *  so just check whether we need to increment i
 	 */
 	if (nextarg)
@@ -1982,7 +1997,7 @@ PRIVATE void parse_arg ARGS3(
 #ifdef VMS
 	    int j;
 	    for (j = 0; cp[j]; j++)
-	        cp[j] = TOUPPER(cp[j]);
+		cp[j] = TOUPPER(cp[j]);
 	    Define_VMSLogical(DISPLAY, cp ? cp : "");
 #else
 	    sprintf(display_putenv_command, "DISPLAY=%s", cp ? cp : "");
@@ -2049,7 +2064,7 @@ PRIVATE void parse_arg ARGS3(
 #else
 	break;;
 #endif /* VMS */
-	
+
     } else if (strncmp(argv[0], "-force_secure", 13) == 0) {
         if (LYForceSSLCookiesSecure)
 	    LYForceSSLCookiesSecure = FALSE;
@@ -2147,7 +2162,7 @@ PRIVATE void parse_arg ARGS3(
 	    StrAllocCopy(homepage, cp);
 	    LYTrimHead(homepage);
 	    if (!strncasecomp(homepage, "lynxexec:", 9) ||
-	        !strncasecomp(homepage, "lynxprog:", 9)) {
+		!strncasecomp(homepage, "lynxprog:", 9)) {
 		/*
 		 *  The original implementions of these schemes expected
 		 *  white space without hex escaping, and did not check
@@ -2245,7 +2260,7 @@ PRIVATE void parse_arg ARGS3(
 	     * increase HTNewsMaxChunk to this size. - FM
 	     */
 	    if (HTNewsChunkSize > HTNewsMaxChunk) {
-	        HTNewsMaxChunk = HTNewsChunkSize; 
+		HTNewsMaxChunk = HTNewsChunkSize;
 	    }
 	}
 
@@ -2257,7 +2272,7 @@ PRIVATE void parse_arg ARGS3(
 	     * reduce HTNewsChunkSize to this maximum. - FM
 	     */
 	    if (HTNewsChunkSize > HTNewsMaxChunk) {
-	        HTNewsChunkSize = HTNewsMaxChunk;
+		HTNewsChunkSize = HTNewsMaxChunk;
 	    }
 	}
 
@@ -2305,7 +2320,7 @@ PRIVATE void parse_arg ARGS3(
     } else if (strncmp(argv[0], "-noreferer", 10) == 0) {
 	LYNoRefererHeader = TRUE;
 
-#ifdef SOCKS	
+#ifdef SOCKS
     } else if (strncmp(argv[0], "-nosocks", 8) == 0) {
 	socks_flag = FALSE;
 #endif /* SOCKS */
@@ -2327,7 +2342,7 @@ PRIVATE void parse_arg ARGS3(
 	 *  Authentication information for protected proxy server. - AJL
 	 */
 	char *pauth_info = NULL;
-	
+
 	if (nextarg) {
 	    StrAllocCopy(pauth_info, cp);
 	    memset(cp, ' ', strlen(cp));	/* Let's not show too much */
@@ -2341,7 +2356,7 @@ PRIVATE void parse_arg ARGS3(
 		}
 	    }
 	    if (*pauth_info) {					/* Id */
-	        HTUnEscape(pauth_info);
+		HTUnEscape(pauth_info);
 		StrAllocCopy(proxyauth_info[0], pauth_info);
 	    }
 	    FREE(pauth_info);
@@ -2423,16 +2438,16 @@ PRIVATE void parse_arg ARGS3(
    USAGE: lynx -restrictions=[option][,option][,option]\n\
    List of Options:\n\
    all             restricts all options.\n");
-	        printf("\
+		printf("\
    bookmark        disallow changing the location of the bookmark file.\n\
    bookmark_exec   disallow execution links via the bookmark file\n");
 #if defined(DIRED_SUPPORT) && defined(OK_PERMIT)
-	        printf("\
+		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");
 #endif /* DIRED_SUPPORT && OK_PERMIT */
-	        printf("\
+		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\
@@ -2440,10 +2455,10 @@ PRIVATE void parse_arg ARGS3(
 		   outside_rlogin, goto, jump and mail.  Defaults\n\
                    are settable within userdefs.h\n");
 #ifdef DIRED_SUPPORT
-	        printf("\
+		printf("\
    dired_support   disallow local file management\n");
 #endif /* DIRED_SUPPORT */
-	        printf("\
+		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\
@@ -2459,7 +2474,7 @@ PRIVATE void parse_arg ARGS3(
                    file: URL's\n\
    goto            disable the 'g' (goto) command\n");
 #if !defined(HAVE_UTMP) || defined(VMS) /* not selective */
-	        printf("\
+		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\
@@ -2469,21 +2484,21 @@ PRIVATE void parse_arg ARGS3(
    inside_telnet   disallow telnets for people coming from inside your\n\
                    domain (utmp required for selectivity)\n");
 #else
-	        printf("\
+		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");
 #endif /* HAVE_UTMP || VMS */
-	        printf("\
+		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");
 #if !defined(HAVE_UTMP) || defined(VMS) /* not selective */
-	        printf("\
+		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\
@@ -2552,7 +2567,7 @@ PRIVATE void parse_arg ARGS3(
 #ifndef VMS
 #ifdef SYSLOG_REQUESTED_URLS
     } else if (strncmp(argv[0], "-syslog", 7) == 0) {
-	if (nextarg) 
+	if (nextarg)
 	    StrAllocCopy(syslog_txt, cp);
 #endif /* SYSLOG_REQUESTED_URLS */
 #endif /* !VMS */
@@ -2643,7 +2658,7 @@ PRIVATE void parse_arg ARGS3(
 	if (nextarg) {
 	    int w = atoi(cp);
 	    if (w > 0) {
-		dump_output_width = w;
+		dump_output_width = ((w < 999) ? w : 999);
 		break;
 	    }
 	}
@@ -2682,7 +2697,7 @@ Output_Help_List:
 #endif /* EXP_CHARTRANS */
     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 or -mime_header dumps\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);
@@ -2794,6 +2809,7 @@ Output_Help_List:
     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");
     if (strncmp(argv[0], "-help", 5) != 0)
 	exit(-1);
     exit(0);
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 208ad88b..a4691f49 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -191,7 +191,7 @@ int mainloop NOARGS
 
 /*
  *  curdoc.address contains the name of the file that is currently open.
- *  newdoc.address contains the name of the file that will soon be 
+ *  newdoc.address contains the name of the file that will soon be
  *		     opened if it exits.
  *  prev_target    contains the last search string the user searched for.
  *  newdoc.title   contains the link name that the user last chose to get
@@ -264,9 +264,9 @@ initialize:
 	    bookmark_start = FALSE;
 	    goto initialize;
 	} else {
-	    /* 
+	    /*
 	     *  See if a bookmark page exists.  If it does,
-	     *  replace newdoc.address with it's name 
+	     *  replace newdoc.address with it's name
 	     */
 	    if ((cp = get_bookmark_filename(&newdoc.address)) != NULL &&
 	         *cp != '\0' && strcmp(cp, " ")) {
@@ -434,6 +434,7 @@ try_again:
 			if (TRACE)
 			    fprintf(stderr,
 				    "\nTurning off TRACE for fetch of log.\n");
+			fflush(stdout);
 			fflush(stderr);
 			fclose(LYTraceLogFP);
 			*stderr = LYOrigStderr;
@@ -469,7 +470,7 @@ try_again:
 		    if (newdoc.address &&
 			0==strncmp(newdoc.address, "LYNXIMGMAP:", 11)) {
 			try_internal = FALSE;
-		    } else if (curdoc.address &&	
+		    } else if (curdoc.address &&
 			0==strncmp(curdoc.address, "LYNXIMGMAP:", 11)) {
 			try_internal = FALSE;
 		    }
@@ -530,7 +531,7 @@ try_again:
 			trace_mode_flag = FALSE;
 			fprintf(stderr, "Turning TRACE back on.\n\n");
 		    }
-		    if (error_logging && 
+		    if (error_logging &&
 		        first_file && owner_address && !LYCancelledFetch) {
 		        /*
 			 *  Email a bad link message to the owner of
@@ -540,7 +541,7 @@ try_again:
 			    if (strncasecomp((owner_address + 7),
 			    		     "lynx-dev@", 9)) {
 				mailmsg(curdoc.link,
-					(owner_address+7), 
+					(owner_address+7),
 					history[nhist-1].address,
 					history[nhist-1].title);
 			    }
@@ -567,7 +568,7 @@ try_again:
 			    }
 		        }
 		        fprintf(ofp, "%s %s\tin %s\n",
-		       		     links[curdoc.link].lname, 
+		       		     links[curdoc.link].lname,
 				     links[curdoc.link].target,
 				     history[nhist-1].address);
 		        fclose(ofp);
@@ -578,8 +579,8 @@ try_again:
 		     *  old file, unless the first file wasn't found or
 		     *  has gone missing.
 		     */
-		    if (!nhist) { 
-			/* 
+		    if (!nhist) {
+			/*
 			 *  If nhist = 0 then it must be the first file.
 			 */
 			if (!dump_output_immediately)
@@ -647,7 +648,7 @@ try_again:
 		    *  Make sure the first file was found and
 		    *  has not gone missing.
 		    */
-		   if (!nhist) { 
+		   if (!nhist) {
 		       /*
 		        *  If nhist = 0 then it must be the first file.
 			*/
@@ -658,11 +659,11 @@ try_again:
 			   strcmp(homepage, startfile) != 0
 #endif /* VMS */
 			   ) {
-			   /* 
+			   /*
 			    *  Couldn't return to the first file but there is a
 			    *  homepage we can use instead. Useful for when the
 			    *  first URL causes a program to be invoked. - GL
-			    * 
+			    *
 			    *  But first make sure homepage is different from
 			    *  startfile (above), then make it the same (below)
 			    *  so we don't enter an infinite getfile() loop on
@@ -896,7 +897,7 @@ try_again:
 		    if (traversal) {
 		        /*
 			 *  During traversal build up lists of all links
-			 *  traversed.  Traversal mode is a special 
+			 *  traversed.  Traversal mode is a special
 			 *  feature for traversing http links in the web.
 			 */
 			if (traversal_link_to_add) {
@@ -938,12 +939,12 @@ try_again:
 		     */
                     Newline = newdoc.line;
 
-		    /* 
+		    /*
 		     *  If we are going to a target line or
 		     *  the first page of a popped document,
 		     *  override any www_search line result.
 		     */
-		    if (Newline > 1 || popped_doc == TRUE)	
+		    if (Newline > 1 || popped_doc == TRUE)
 			 www_search_result = -1;
 
 		    /*
@@ -952,7 +953,7 @@ try_again:
 		     */
 		    curdoc.line = -1;
 
-	  	    break;	
+	  	    break;
 		}  /* end switch */
 
 	    if (TRACE) {
@@ -1029,11 +1030,11 @@ try_again:
 
 	/*
 	 *  If the recent_sizechange variable is set to TRUE
-	 *  then the window size changed recently. 
+	 *  then the window size changed recently.
 	 */
 	if (recent_sizechange) {
 		stop_curses();
-		start_curses(); 
+		start_curses();
 		clear();
 		refresh_screen = TRUE; /* to force a redraw */
 		recent_sizechange = FALSE;
@@ -1058,7 +1059,7 @@ try_again:
 	    /*
 	     *  We can never again have the first file.
 	     */
-	    first_file = FALSE; 
+	    first_file = FALSE;
 
 	    /*
 	     *  Set the startrealm, and deal as best we can
@@ -1179,7 +1180,7 @@ try_again:
 	 *  create a fresh screen of text out.
          */
 	if (curdoc.line != Newline) {
-	
+
    	    refresh_screen = FALSE;
 
 	    HText_pageDisplay(Newline, prev_target);
@@ -1208,7 +1209,7 @@ try_again:
 		}
 	    }
 
-	    if (arrowup) { 
+	    if (arrowup) {
 		/*
 		 *  arrowup is set if we just came up from
 		 *  a page below.
@@ -1239,10 +1240,15 @@ try_again:
 	 *  Refresh the screen if neccessary.
 	 */
 	if (refresh_screen) {
-	    if (enable_scrollback)
+#if defined(FANCY_CURSES) || defined (USE_SLANG)
+	    if (enable_scrollback) {
 		clear();
-	    else
+	    } else {
 		erase();
+	    }
+#else
+	    clear();
+#endif /* FANCY_CURSES || USE_SLANG */
 	    HText_pageDisplay(Newline, prev_target);
 
 #ifdef DIRED_SUPPORT
@@ -1351,7 +1357,7 @@ try_again:
 			    }
    			} else if (links[curdoc.link].form->no_cache) {
                             statusline(FORM_LINK_RESUBMIT_MESSAGE);
- 			} else { 
+ 			} else {
                             statusline(FORM_LINK_SUBMIT_MESSAGE);
 			}
 		        break;
@@ -1381,7 +1387,7 @@ try_again:
 		    addstr("-index-");
 		    stop_reverse();
 		}
-			
+
 	    } else if (user_mode == ADVANCED_MODE && nlinks > 0) {
 		/*
 		 *  Show the URL or, for some internal links, the fragment
@@ -1421,7 +1427,7 @@ try_again:
 			_statusline(MOREHELP);
 	    } else {
 	       _statusline(HELP);
-   	    }	     
+   	    }
 	} else {
 	   show_help = FALSE;
 	}
@@ -1518,7 +1524,7 @@ try_again:
 		 *  redundant error reporting.
 	         */
 	        real_c = c = LYgetch();	/* get user input */
-		
+
 #ifndef VMS
 		if (c == 3) {		/* ^C */
 		    /*
@@ -1573,7 +1579,7 @@ new_keyboard_input:
 					 ?
 		links[curdoc.link].lname : (links[curdoc.link].lname + 11)),
 			      strlen(traversal_host)));
-	    } else {	
+	    } else {
 	        rlink_allowed = FALSE;
 	    }
 	    if (rlink_exists && rlink_allowed) {
@@ -1914,7 +1920,7 @@ new_cmd:  /*
 		_statusline(CANCELLED);
 		sleep(InfoSecs);
 		break;
-	    } 
+	    }
 
 	    if (HTisDocumentSource()) {
 	        HTOutputFormat = WWW_PRESENT;
@@ -1939,7 +1945,7 @@ new_cmd:  /*
 		_statusline(CANCELLED);
 		sleep(InfoSecs);
 		break;
-	    } 
+	    }
 
 	    /*
 	     *  Check to see if should reload source, or load html
@@ -1996,7 +2002,7 @@ new_cmd:  /*
 		reloading = TRUE;
 	    break;
 
-	case LYK_HISTORICAL:  
+	case LYK_HISTORICAL:
 	    /*
 	     *  Check if this is a reply from a POST, and if so,
 	     *  seek confirmation of reload if the safe element
@@ -2027,7 +2033,7 @@ new_cmd:  /*
 	    sleep(AlertSecs);
 	    break;
 
-	case LYK_MINIMAL:  
+	case LYK_MINIMAL:
 	    if (!historical_comments) {
 	        /*
 		 *  Check if this is a reply from a POST, and if so,
@@ -2060,7 +2066,7 @@ new_cmd:  /*
 	    sleep(AlertSecs);
 	    break;
 
-	case LYK_SOFT_DQUOTES:  
+	case LYK_SOFT_DQUOTES:
 	    /*
 	     *  Check if this is a reply from a POST, and if so,
 	     *  seek confirmation of reload if the safe element
@@ -2128,7 +2134,7 @@ new_cmd:  /*
 	    break;
 
 #ifdef NOT_DONE_YET
-	case LYK_PIPE:  
+	case LYK_PIPE:
 	    /* ignore for now */
 	    break;
 #endif /* NOT_DONE_YET */
@@ -2148,7 +2154,7 @@ new_cmd:  /*
 		sleep(InfoSecs);
 	    }
 	    break;
-	
+
 	case LYK_ABORT:		/* don't ask the user about quitting */
 	    return(0);
 	    break;
@@ -2287,7 +2293,7 @@ new_cmd:  /*
 		curdoc.link--;
 
 	    } else if (!more &&
-	    	       curdoc.link==0 && Newline==1) { /* at the top of list */ 
+	    	       curdoc.link==0 && Newline==1) { /* at the top of list */
 		/*
 		 *  If there is only one page of data and the user
 		 *  goes off the top, then unhighlight the current
@@ -2347,11 +2353,11 @@ new_cmd:  /*
 		curdoc.link++;
 #endif /* FASTTAB */
 	    /*
-	     *  At the bottom of list and there is only one page. 
+	     *  At the bottom of list and there is only one page.
 	     *  Move to the top link on the page.
 	     */
 	    } else if (!more && Newline == 1 && curdoc.link == nlinks-1) {
-		highlight(OFF, curdoc.link, prev_target); 
+		highlight(OFF, curdoc.link, prev_target);
 		curdoc.link = 0;
 
             } else if (more) {  /* next page */
@@ -2433,7 +2439,7 @@ new_cmd:  /*
 			newlink = i;
 			break;
 		   }
-			
+
 		if (newlink > -1) {
                     highlight(OFF, curdoc.link, prev_target);
                     curdoc.link = newlink;
@@ -2489,7 +2495,7 @@ new_cmd:  /*
         case LYK_COOKIE_JAR:       /* show the cookie jar */
 	    /*
 	     *  Don't do if already viewing the cookie jar.
-	     */	
+	     */
 	    if (strcmp((curdoc.title ? curdoc.title : ""),
 		       COOKIE_JAR_TITLE)) {
 	        StrAllocCopy(newdoc.address, "LYNXCOOKIE:/");
@@ -2550,7 +2556,7 @@ new_cmd:  /*
 		if (LYValidate || check_realm) {
 		    LYPermitURL = TRUE;
 		}
-	        break; 
+	        break;
 	    } /* end if strncmp */
 	    /*
 	     *  Don't put break here so that if the backspace key
@@ -2644,7 +2650,7 @@ new_cmd:  /*
 			break;
 		    }
 		}
-		
+
 		if (!first)
 		    curdoc.internal_link = FALSE;
 
@@ -2657,7 +2663,7 @@ new_cmd:  /*
 		    HTuncache_current_document();
 #endif /* DIRED_SUPPORT */
 	    } else if (child_lynx == TRUE) {
-	   	return(0); /* exit on left arrow in main screen */ 
+	   	return(0); /* exit on left arrow in main screen */
 
 	    } else if (old_c != real_c) {
 		old_c = real_c;
@@ -2923,7 +2929,7 @@ new_cmd:  /*
 			    break;
 			}
 		    /*
-		     *  Follow a normal link or anchor. 
+		     *  Follow a normal link or anchor.
 		     */
 		    StrAllocCopy(newdoc.address, links[curdoc.link].lname);
 		    StrAllocCopy(newdoc.title, links[curdoc.link].hightext);
@@ -3088,15 +3094,155 @@ new_cmd:  /*
 	    }
 	    break;
 
+	case LYK_ELGOTO:   /* edit URL of current link and go to it  */
+	    if (no_goto && !LYValidate) {
+		/*
+		 *  Go to not allowed. - FM
+		 */
+		if (old_c != real_c) {
+		    old_c = real_c;
+		    _statusline(GOTO_DISALLOWED);
+		    sleep(MessageSecs);
+		}
+		break;
+	    }
+	    if (!(nlinks > 0 && curdoc.link > -1) ||
+		(links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
+		 links[curdoc.link].form->type != F_SUBMIT_TYPE &&
+		 links[curdoc.link].form->type != F_IMAGE_SUBMIT_TYPE &&
+		 links[curdoc.link].form->type != F_TEXT_SUBMIT_TYPE)) {
+		/*
+		 *  No links on page, or not a normal link
+		 *  or form submit button. - FM
+		 */
+		if (old_c != real_c) {
+		    old_c = real_c;
+		    _statusline(NOT_ON_SUBMIT_OR_LINK);
+		    sleep(MessageSecs);
+		}
+		break;
+	    }
+	    if ((links[curdoc.link].type == WWW_FORM_LINK_TYPE) &&
+		(!links[curdoc.link].form->submit_action ||
+		 *links[curdoc.link].form->submit_action == '\0')) {
+		/*
+		 *  Form submit button with no ACTION defined. - FM
+		 */
+		if (old_c != real_c) {
+		    old_c = real_c;
+		    _statusline(NO_FORM_ACTION);
+		    sleep(MessageSecs);
+		}
+		break;
+	    }
+#ifdef DIRED_SUPPORT
+	    if (!strncmp(links[curdoc.link].lname,
+			 "LYNXDIRED:", 10) ||
+		!strcmp(curdoc.address, LYDiredFileURL) ||
+		!strcmp((curdoc.title ? curdoc.title : ""),
+			DIRED_MENU_TITLE) ||
+		!strcmp(curdoc.address, LYPermitFileURL) ||
+		!strcmp((curdoc.title ? curdoc.title : ""),
+			PERMIT_OPTIONS_TITLE) ||
+		!strcmp(curdoc.address, LYUploadFileURL) ||
+		!strcmp((curdoc.title ? curdoc.title : ""),
+			UPLOAD_OPTIONS_TITLE)) {
+		/*
+		 *  Disallow editing of File Management URLs. - FM
+		 */
+		if (old_c != real_c) {
+		    old_c = real_c;
+		    _statusline(EDIT_FM_MENU_URLS_DISALLOWED);
+		    sleep(MessageSecs);
+		}
+		break;
+	    }
+#endif /* DIRED_SUPPORT */
+
+	    /*
+	     *  Save the current user_input_buffer string,
+	     *  and load the current link's address. - FM
+	     */
+	    StrAllocCopy(temp, user_input_buffer);
+	    LYstrncpy(user_input_buffer,
+		      ((links[curdoc.link].type == WWW_FORM_LINK_TYPE)
+						?
+	 links[curdoc.link].form->submit_action : links[curdoc.link].lname),
+		      (sizeof(user_input_buffer) - 1));
+
+	    /*
+	     *  Offer the current link's URL for editing. - FM
+	     */
+	    _statusline(EDIT_CURLINK_URL);
+	    if (((ch = LYgetstr(user_input_buffer, VISIBLE,
+				sizeof(user_input_buffer), RECALL)) >= 0) &&
+		user_input_buffer[0] != '\0' &&
+		strcmp(user_input_buffer,
+		       ((links[curdoc.link].type == WWW_FORM_LINK_TYPE)
+				? links[curdoc.link].form->submit_action
+				: links[curdoc.link].lname))) {
+		LYTrimHead(user_input_buffer);
+		if (!strncasecomp(user_input_buffer, "lynxexec:", 9) ||
+		    !strncasecomp(user_input_buffer, "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
+		     */
+		    HTUnEscapeSome(user_input_buffer, " \r\n\t");
+		    convert_to_spaces(user_input_buffer, TRUE);
+		} else {
+		    collapse_spaces(user_input_buffer);
+		}
+		if (user_input_buffer[0] != '\0') {
+		    goto check_goto_URL;
+		}
+	    }
+	    /*
+	     *  User cancelled via ^G, a full deletion,
+	     *  or not modifying the URL. - FM
+	     */
+	    _statusline(CANCELLED);
+	    sleep(InfoSecs);
+	    strcpy(user_input_buffer, temp);
+	    FREE(temp);
+	    break;
+
 	case LYK_ECGOTO:   /* edit current URL and go to to it  */
+	    /*
+	     *  Go to not allowed. - FM
+	     */
 	    if (no_goto && !LYValidate) {
-	        if (old_c != real_c) {
-	   	    old_c = real_c;
-	    	    _statusline(GOTO_DISALLOWED);
+		if (old_c != real_c) {
+		    old_c = real_c;
+		    _statusline(GOTO_DISALLOWED);
+		    sleep(MessageSecs);
+		}
+		break;
+	    }
+#ifdef DIRED_SUPPORT
+	    if (!strcmp(curdoc.address, LYDiredFileURL) ||
+		!strcmp((curdoc.title ? curdoc.title : ""),
+			DIRED_MENU_TITLE) ||
+		!strcmp(curdoc.address, LYPermitFileURL) ||
+		!strcmp((curdoc.title ? curdoc.title : ""),
+			PERMIT_OPTIONS_TITLE) ||
+		!strcmp(curdoc.address, LYUploadFileURL) ||
+		!strcmp((curdoc.title ? curdoc.title : ""),
+			UPLOAD_OPTIONS_TITLE)) {
+		/*
+		 *  Disallow editing of File Management URLs. - FM
+		 */
+		if (old_c != real_c) {
+		    old_c = real_c;
+		    _statusline(EDIT_FM_MENU_URLS_DISALLOWED);
 		    sleep(MessageSecs);
 		}
 		break;
 	    }
+#endif /* DIRED_SUPPORT */
 
 	    /*
 	     *  Save the current user_input_buffer string,
@@ -3160,7 +3306,7 @@ new_cmd:  /*
 		}
 		break;
 	    }
-	 
+
 	    StrAllocCopy(temp, user_input_buffer);
 	    if (!goto_buffer)
 	        *user_input_buffer = '\0';
@@ -3242,7 +3388,7 @@ check_recall:
 	    					  URLNum)) != NULL) {
 		    strcpy(user_input_buffer, cp);
 		    if (goto_buffer && *temp &&
-		        !strcmp(temp, user_input_buffer)) { 
+		        !strcmp(temp, user_input_buffer)) {
 		        _statusline(EDIT_CURRENT_GOTO);
 		    } else if ((goto_buffer && URLTotal == 2) ||
 			       (!goto_buffer && URLTotal == 1)) {
@@ -3287,7 +3433,7 @@ check_recall:
 	    					    URLNum)) != NULL) {
 		    strcpy(user_input_buffer, cp);
 		    if (goto_buffer && *temp &&
-		        !strcmp(temp, user_input_buffer)) { 
+		        !strcmp(temp, user_input_buffer)) {
 		        _statusline(EDIT_CURRENT_GOTO);
 		    } else if ((goto_buffer && URLTotal == 2) ||
 			       (!goto_buffer && URLTotal == 1)) {
@@ -3454,13 +3600,13 @@ check_goto_URL:
 		    newdoc.internal_link = FALSE;
 		    force_load = TRUE;
 #ifdef DIRED_SUPPORT
-		    if (lynx_edit_mode) 
+		    if (lynx_edit_mode)
 		        HTuncache_current_document();
 #endif /* DIRED_SUPPORT */
 		}
 		LYUserSpecifiedURL = TRUE;
 		HTAddGotoURL(newdoc.address);
-	    } 
+	    }
 	    break;
 
 	case LYK_HELP:			/* show help file */
@@ -3532,7 +3678,7 @@ check_goto_URL:
 	    } else {
 		_statusline("'X' only toggles in forms mode");
 	    }
-	    break;	
+	    break;
 
 	case LYK_FORM_DOWN:  /* change form */
 	    break;	     /* not implemented */
@@ -3549,7 +3695,7 @@ check_goto_URL:
 	    } else {
 		_statusline("'Z' only toggles in forms mode");
 	    }
-	    break;	
+	    break;
 #endif /* NOT_USED */
 
 	case LYK_MAIN_MENU:	/* return to main screen */
@@ -3557,7 +3703,7 @@ check_goto_URL:
 	     *  If its already the homepage then don't reload it.
 	     */
 	    if (!STREQ(curdoc.address,homepage)) {
-		
+
 		_statusline(CONFIRM_MAIN_SCREEN);
 		c = LYgetch();
 		if (TOUPPER(c)=='Y') {
@@ -3569,7 +3715,7 @@ check_goto_URL:
 		    newdoc.isHEAD = FALSE;
 		    newdoc.safe = FALSE;
 		    newdoc.internal_link = FALSE;
-	            highlight(OFF, curdoc.link, prev_target); 
+	            highlight(OFF, curdoc.link, prev_target);
 #ifdef DIRED_SUPPORT
 		    if (lynx_edit_mode)
 		      HTuncache_current_document();
@@ -3627,7 +3773,7 @@ check_goto_URL:
 				       2, 1) == FALSE) {
 		    _statusline(WILL_NOT_RELOAD_DOC);
 		    sleep(InfoSecs);
-	    
+
 		} else {
 		    StrAllocCopy(newdoc.address, curdoc.address);
 		    if (((strcmp(CurrentUserAgent, (LYUserAgent ?
@@ -3718,7 +3864,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.
-		     */ 
+		     */
 		    StrAllocCopy(curdoc.address, newdoc.address);
 		    StrAllocCopy(newdoc.post_data, curdoc.post_data);
 		    newdoc.internal_link = FALSE;
@@ -3749,7 +3895,7 @@ check_goto_URL:
 		    /*
 		     *  Yuk, the search failed.  Restore the old file.
 		     */
-		    StrAllocCopy(newdoc.address, curdoc.address);  
+		    StrAllocCopy(newdoc.address, curdoc.address);
 		    StrAllocCopy(newdoc.post_data, curdoc.post_data);
 		    StrAllocCopy(newdoc.post_content_type,
 		    		 curdoc.post_content_type);
@@ -3780,7 +3926,7 @@ check_goto_URL:
 		StrAllocCopy(remember_old_target, "");
 
 	    if (cmd != LYK_NEXT) {
-	        /* 
+	        /*
 		 *  Reset prev_target to force prompting
 		 *  for a new search string and to turn
 		 *  off highlighting in no search string
@@ -3801,7 +3947,7 @@ check_goto_URL:
 		 */
 	        found = textsearch(&curdoc, prev_target, TRUE);
 	    }
-	    
+
 	    /*
 	     *  Force a redraw to ensure highlighting of hits
 	     *  even when found on the same page, or clearing
@@ -3891,7 +4037,7 @@ check_goto_URL:
 			    break;
 			}
 		    }
-	            if (is_url(owner_address) != MAILTO_URL_TYPE) { 
+	            if (is_url(owner_address) != MAILTO_URL_TYPE) {
 			/*
 			 *  The address is a URL.  Just follow the link.
 			 */
@@ -3908,10 +4054,10 @@ check_goto_URL:
 			      */
 	      	             reply_by_mail(strchr(owner_address,':')+1,
 					   curdoc.address,
-					   (cp ? cp : "")); 
+					   (cp ? cp : ""));
 		        else
 	      	            reply_by_mail(owner_address, curdoc.address,
-				          (cp ? cp : "")); 
+				          (cp ? cp : ""));
 
 	                refresh_screen = TRUE;  /* to force a showpage */
 	           }
@@ -3922,12 +4068,12 @@ check_goto_URL:
 #ifdef DIRED_SUPPORT
 	case LYK_TAG_LINK:	/* tag or untag the current link */
 	    if (lynx_edit_mode && nlinks > 0 && !no_dired_support) {
-	        if (!strcmp(links[curdoc.link].hightext, "..")) 
+	        if (!strcmp(links[curdoc.link].hightext, ".."))
 		    break;	/* Never tag the parent directory */
 	        if (dir_list_style == MIXED_STYLE) {
-		    if (!strcmp(links[curdoc.link].hightext, "../")) 
+		    if (!strcmp(links[curdoc.link].hightext, "../"))
 		        break;
-	        } else if (!strncmp(links[curdoc.link].hightext, "Up to ", 6)) 
+	        } else if (!strncmp(links[curdoc.link].hightext, "Up to ", 6))
 		    break;
 	        {
 		    /*
@@ -3959,7 +4105,7 @@ check_goto_URL:
 		    highlight(OFF, curdoc.link, prev_target);
 		    curdoc.link++;
 		} else if (!more && Newline == 1 && curdoc.link == nlinks-1) {
-		    highlight(OFF, curdoc.link, prev_target); 
+		    highlight(OFF, curdoc.link, prev_target);
 		    curdoc.link = 0;
 		} else if (more) {  /* next page */
 		    Newline += (display_lines);
@@ -3977,7 +4123,7 @@ check_goto_URL:
 	        } else if (ret) {
 		    HTuncache_current_document();
 		    StrAllocCopy(newdoc.address, curdoc.address);
-		    FREE(curdoc.address);	
+		    FREE(curdoc.address);
 		    FREE(newdoc.post_data);
 		    FREE(newdoc.post_content_type);
 		    FREE(newdoc.bookmark);
@@ -4136,7 +4282,7 @@ check_goto_URL:
 	    if (TOUPPER(c) == 'Y') {
 		HTuncache_current_document();
 		StrAllocCopy(newdoc.address, curdoc.address);
-		FREE(curdoc.address);	
+		FREE(curdoc.address);
 		newdoc.line = curdoc.line;
 		if (curdoc.link == nlinks-1) {
 		    /*
@@ -4159,7 +4305,7 @@ check_goto_URL:
 	case LYK_INFO:  /* show document info */
 	    /*
 	     *  Don't do if already viewing info page.
-	     */	
+	     */
 	    if (strcmp((curdoc.title ? curdoc.title : ""),
 		       SHOWINFO_TITLE)) {
 	        if (!showinfo(&curdoc, lines_in_file,
@@ -4196,9 +4342,9 @@ check_goto_URL:
 
 	    /*
 	     *  Don't do if already viewing print options page.
-	     */	
+	     */
 	    if (strcmp((curdoc.title ? curdoc.title : ""),
-	    	       PRINT_OPTIONS_TITLE)) {	
+	    	       PRINT_OPTIONS_TITLE)) {
 
                 if (print_options(&newdoc.address, lines_in_file) < 0)
 		    break;
@@ -4218,7 +4364,7 @@ check_goto_URL:
 	case LYK_LIST:  /* list links in the current document */
 	    /*
 	     *  Don't do if already viewing list page.
-	     */	
+	     */
 	    if (!strcmp((curdoc.title ? curdoc.title : ""),
 	    		LIST_PAGE_TITLE)) {
 		/*
@@ -4278,7 +4424,7 @@ check_goto_URL:
 		LYPermitURL = TRUE;
 		StrAllocCopy(lynxlinksfile, newdoc.address);
 	    }
-	    break; 
+	    break;
 
 	case LYK_TOOLBAR:  /* go to Toolbar or Banner in current document */
 	    if (!HText_hasToolbar(HTMainText)) {
@@ -4303,7 +4449,7 @@ check_goto_URL:
 	    }
 	    break;
 
-#if defined(DIRED_SUPPORT) || defined(VMS) 
+#if defined(DIRED_SUPPORT) || defined(VMS)
        case LYK_DIRED_MENU:  /* provide full file management menu */
 #ifdef VMS
 	    /*
@@ -4373,7 +4519,7 @@ check_goto_URL:
 		        /*
 			 *  We're viewing a local file.  Make it's
 			 *  directory the CSwing argument. - FM
-			 */ 
+			 */
 		        StrAllocCopy(VMSdir, HTVMS_name("", cp));
 			FREE(cp);
 			if ((cp = strrchr(VMSdir, ']')) != NULL) {
@@ -4402,7 +4548,7 @@ check_goto_URL:
 		    StrAllocCopy(newdoc.title,
 		    		 curdoc.title ? curdoc.title : "");
 		    StrAllocCopy(newdoc.bookmark, curdoc.bookmark);
-		    FREE(curdoc.address);	
+		    FREE(curdoc.address);
 		    newdoc.line = curdoc.line;
 		    newdoc.link = curdoc.link;
 		}
@@ -4427,7 +4573,7 @@ check_goto_URL:
 #else
 	    /*
 	     *  Don't do if not allowed or already viewing the menu.
-	     */	
+	     */
 	    if (lynx_edit_mode && !no_dired_support &&
 		strcmp(curdoc.address, LYDiredFileURL) &&
 	        strcmp((curdoc.title ? curdoc.title : ""),
@@ -4459,7 +4605,7 @@ check_goto_URL:
 	    if (strcmp((curdoc.title ? curdoc.title : ""),
 		       HISTORY_PAGE_TITLE) &&
 	        strcmp((curdoc.title ? curdoc.title : ""),
-		       SHOWINFO_TITLE) && 
+		       SHOWINFO_TITLE) &&
 	        strcmp((curdoc.title ? curdoc.title : ""),
 		       PRINT_OPTIONS_TITLE) &&
 #ifdef DIRED_SUPPORT
@@ -4480,13 +4626,13 @@ check_goto_URL:
 		((nlinks <= 0) ||
 		 (links[curdoc.link].lname != NULL &&
 		  strncmp(links[curdoc.link].lname,
-			 "LYNXHIST:", 9) && 
+			 "LYNXHIST:", 9) &&
 		  strncmp(links[curdoc.link].lname,
-			 "LYNXPRINT:", 10) && 
+			 "LYNXPRINT:", 10) &&
 		  strncmp(links[curdoc.link].lname,
-			 "LYNXDIRED:", 10) && 
+			 "LYNXDIRED:", 10) &&
 		  strncmp(links[curdoc.link].lname,
-			 "LYNXDOWNLOAD:", 13) && 
+			 "LYNXDOWNLOAD:", 13) &&
 		  strncmp(links[curdoc.link].lname,
 			 "LYNXCOOKIE:", 11) &&
 		  strncmp(links[curdoc.link].lname,
@@ -4558,7 +4704,7 @@ check_goto_URL:
 			 *  User does want to save the link. - FM
 			 */
 			if (links[curdoc.link].type != WWW_FORM_LINK_TYPE) {
-			    save_bookmark_link(links[curdoc.link].lname, 
+			    save_bookmark_link(links[curdoc.link].lname,
 					       links[curdoc.link].hightext);
 			    refresh_screen = TRUE; /* MultiBookmark support */
 			} else {
@@ -4600,7 +4746,7 @@ check_add_bookmark_to_self:
 		    HTuncache_current_document();
 		    StrAllocCopy(newdoc.address, curdoc.address);
 		    StrAllocCopy(newdoc.bookmark, curdoc.bookmark);
-		    FREE(curdoc.address);	
+		    FREE(curdoc.address);
 		    newdoc.line = curdoc.line;
 		    newdoc.link = curdoc.link;
 		    newdoc.internal_link = FALSE;
@@ -4658,9 +4804,9 @@ check_add_bookmark_to_self:
 
 	case LYK_SHELL:  /* shell escape */
 	    if (!no_shell) {
-	        stop_curses();
+		stop_curses();
 		printf(SPAWNING_MSG);
-	        fflush(stdout);
+		fflush(stdout);
 		fflush(stderr);
 		if (LYTraceLogFP)
 		    /*
@@ -4668,21 +4814,19 @@ check_add_bookmark_to_self:
 		     *  during the shell escape. - FM
 		     */
 		    *stderr = LYOrigStderr;
-#ifdef DOSPATH	
-	system("cls");	
-	system("echo Type EXIT to return to Lynx.");
+#ifdef DOSPATH
 #ifdef __DJGPP__
-      __djgpp_set_ctrl_c(0);
-      _go32_want_ctrl_break(1);
+		__djgpp_set_ctrl_c(0);
+		_go32_want_ctrl_break(1);
 #endif /* __DJGPP__ */
-      if (getenv("SHELL") != NULL) {
-           system(getenv("SHELL"));
-      } else {
-	   system(getenv("COMSPEC") == NULL ? "command.com" : getenv("COMSPEC"));
-      }
+		if (getenv("SHELL") != NULL) {
+		    system(getenv("SHELL"));
+		} else {
+		    system(getenv("COMSPEC") == NULL ? "command.com" : getenv("COMSPEC"));
+		}
 #ifdef __DJGPP__
-      __djgpp_set_ctrl_c(1);
-      _go32_want_ctrl_break(0);
+		__djgpp_set_ctrl_c(1);
+		_go32_want_ctrl_break(0);
 #endif /* __DJGPP__ */
 #else
 #ifdef VMS
@@ -4724,7 +4868,7 @@ check_add_bookmark_to_self:
 
 	    /*
 	     *  Don't do if already viewing download options page.
-	     */	
+	     */
 	    if (!strcmp((curdoc.title ? curdoc.title : ""),
 	    		DOWNLOAD_OPTIONS_TITLE))
 	        break;
@@ -4812,7 +4956,7 @@ check_add_bookmark_to_self:
 			_statusline(CANCELLED);
 			sleep(InfoSecs);
 			break;
-		    } 
+		    }
 		    StrAllocCopy(newdoc.address, history[number].address);
                     StrAllocCopy(newdoc.title, links[curdoc.link].hightext);
 		    StrAllocCopy(newdoc.bookmark, history[number].bookmark);
@@ -4834,7 +4978,7 @@ check_add_bookmark_to_self:
 		     *  Force the document to be reloaded.
 		     */
 		    LYforce_no_cache = TRUE;
-		    
+
 		} else if (!strncmp(links[curdoc.link].lname, "data:", 5)) {
 		    if (old_c != real_c) {
 			old_c = real_c;
@@ -4932,7 +5076,7 @@ check_add_bookmark_to_self:
 	case LYK_TRACE_TOGGLE:	/*  Toggle TRACE mode. */
 	    if (WWW_TraceFlag)
 		WWW_TraceFlag = FALSE;
-	    else 
+	    else
 		WWW_TraceFlag = TRUE;
 
 	    _statusline(WWW_TraceFlag ? TRACE_ON : TRACE_OFF);
@@ -4985,7 +5129,7 @@ check_add_bookmark_to_self:
 
 	    /*
 	     *  Don't do if already viewing the TRACE log. - FM
-	     */	
+	     */
 	    if (!strcmp((curdoc.title ? curdoc.title : ""),
 			LYNX_TRACELOG_TITLE))
 		break;
@@ -5003,6 +5147,7 @@ check_add_bookmark_to_self:
 	     */
 	    if (TRACE)
 		fprintf(stderr, "\nTurning off TRACE for fetch of log.\n");
+	    fflush(stdout);
 	    fflush(stderr);
 	    fclose(LYTraceLogFP);
 	    *stderr = LYOrigStderr;
@@ -5038,9 +5183,9 @@ check_add_bookmark_to_self:
 
 	case LYK_IMAGE_TOGGLE:
 	    if (clickable_images)
-		clickable_images = FALSE;	
-	    else 
-		clickable_images = TRUE;	
+		clickable_images = FALSE;
+	    else
+		clickable_images = TRUE;
 
 	    _statusline(clickable_images ?
 	    	     CLICKABLE_IMAGES_ON : CLICKABLE_IMAGES_OFF);
@@ -5051,9 +5196,9 @@ check_add_bookmark_to_self:
 
 	case LYK_INLINE_TOGGLE:
 	    if (pseudo_inline_alts)
-		pseudo_inline_alts = FALSE;	
-	    else 
-		pseudo_inline_alts = TRUE;	
+		pseudo_inline_alts = FALSE;
+	    else
+		pseudo_inline_alts = TRUE;
 
 	    _statusline(pseudo_inline_alts ?
 	    	     PSEUDO_INLINE_ALTS_ON : PSEUDO_INLINE_ALTS_OFF);
@@ -5068,7 +5213,7 @@ check_add_bookmark_to_self:
 	    else
 	        LYUseDefaultRawMode = TRUE;
 	    _statusline(LYRawMode ? RAWMODE_OFF : RAWMODE_ON);
- 	    HTMLSetCharacterHandling(current_char_set);	
+ 	    HTMLSetCharacterHandling(current_char_set);
 	    LYRawMode_flag = LYRawMode;
  	    sleep(MessageSecs);
 	    cmd = LYK_RELOAD;
@@ -5104,7 +5249,7 @@ check_add_bookmark_to_self:
 			    _statusline(CANCELLED);
 			    sleep(InfoSecs);
 			    break;
-			} 
+			}
 		        HEAD_request = TRUE;
 			LYforce_no_cache = TRUE;
 			StrAllocCopy(newdoc.title, curdoc.title);
@@ -5189,7 +5334,7 @@ check_add_bookmark_to_self:
 		     *  The user didn't cancel, so check if
 		     *  a HEAD request is appropriate for the
 		     *  current document. - FM
-		     */ 
+		     */
 		    if (LYCanDoHEAD(scheme) != TRUE) {
 		        _statusline(DOC_NOT_HTTP_URL);
 			sleep(MessageSecs);
@@ -5206,7 +5351,7 @@ check_add_bookmark_to_self:
 		    }
 		}
 	    }
-	    break;	
+	    break;
 
 	case LYK_TOGGLE_HELP:
     	    if (user_mode == NOVICE_MODE) {
@@ -5472,7 +5617,7 @@ PRIVATE int are_different ARGS2(
         *cp1 = '\0';
     if ((cp2 = strchr(doc2->address, '#')) != NULL)
         *cp2 = '\0';
-    /* 
+    /*
      *  Are the base addresses different?
      */
     if (strcmp(doc1->address, doc2->address))
@@ -5556,7 +5701,7 @@ PRIVATE int are_phys_different ARGS2(
         *cp1 = '\0';
     if ((cp2 = strchr(doc2->address, '#')) != NULL)
         *cp2 = '\0';
-    /* 
+    /*
      *  Are the base addresses different?
      */
     if (strcmp(ap1, ap2))
@@ -5595,7 +5740,7 @@ PRIVATE int are_phys_different ARGS2(
     return(FALSE);
 }
 
-/* 
+/*
  *  Utility for freeing the list of goto URLs. - FM
  */
 PUBLIC void HTGotoURLs_free NOARGS
@@ -5614,7 +5759,7 @@ PUBLIC void HTGotoURLs_free NOARGS
     return;
 }
 
-/* 
+/*
  *  Utility for listing Goto URLs, making any
  *  repeated URLs the most current in the list. - FM
  */
diff --git a/src/LYOptions.c b/src/LYOptions.c
index e48ada2e..948616fe 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -205,14 +205,14 @@ draw_options:
      *  might have non-ASCII or multibyte/CJK characters. - FM
      */
     response = 0;
-#ifdef FANCY_CURSES
+#if defined(FANCY_CURSES) || defined (USE_SLANG)
     if (enable_scrollback)
 	clear();
     else
 	erase();
 #else
     clear();
-#endif
+#endif /* FANCY_CURSES || USE_SLANG */
     move(0, 5);
 
     lynx_start_h1_color ();
@@ -1799,14 +1799,14 @@ draw_bookmark_list:
      *  to increase the chances that any non-ASCII or multibyte/CJK
      *  characters will be handled properly. - FM
      */
-#ifdef FANCY_CURSES
+#if defined(FANCY_CURSES) || defined (USE_SLANG)
     if (enable_scrollback)
 	clear();
     else
 	erase();
 #else
     clear();
-#endif
+#endif /* FANCY_CURSES || USE_SLANG */
     move(0, 5);
 
     lynx_start_h1_color ();
diff --git a/src/LYPrint.c b/src/LYPrint.c
index e4903ede..94b335ed 100644
--- a/src/LYPrint.c
+++ b/src/LYPrint.c
@@ -30,7 +30,7 @@ extern BOOLEAN LYHaveCJKCharacterSet;
 #define FREE(x) if (x) {free(x); x = NULL;}
 
 /*
- *  printfile prints out the current file minus the links and targets 
+ *  printfile prints out the current file minus the links and targets
  *  to a veriaty of places
  */
 
@@ -52,7 +52,7 @@ PRIVATE int remove_quotes PARAMS((char *string));
 #endif /* VMS */
 
 PUBLIC int printfile ARGS1(
-	document *,	newdoc) 
+	document *,	newdoc)
 {
     static char tempfile[256];
     static BOOLEAN first = TRUE;
@@ -83,6 +83,13 @@ PUBLIC int printfile ARGS1(
     char *envbuffer = NULL;
 #ifdef VMS
     extern BOOLEAN HadVMSInterrupt;
+    BOOLEAN isPMDF = FALSE;
+    char hdrfile[256];
+    FILE *hfd;
+
+    if (!strncasecomp(system_mail, "PMDF SEND", 9)) {
+	isPMDF = TRUE;
+    }
 #endif /* VMS */
 
     /*
@@ -101,7 +108,7 @@ PUBLIC int printfile ARGS1(
     WWWDoc.isHEAD = newdoc->isHEAD;
     WWWDoc.safe = newdoc->safe;
     if (!HTLoadAbsolute(&WWWDoc))
-        return(NOT_FOUND);
+	return(NOT_FOUND);
 
     /*
      *  If we have an explicit content-base, we may use it even
@@ -119,18 +126,18 @@ PUBLIC int printfile ARGS1(
      *  and content_location strings. - FM
      */
     if (HTisDocumentSource()) {
-    	if (HText_getContentLocation()) {
+	if (HText_getContentLocation()) {
 	    StrAllocCopy(content_location, HText_getContentLocation());
 	    collapse_spaces(content_location);
 	    if (!(content_location && *content_location)) {
-	        FREE(content_location);
+		FREE(content_location);
 	    }
 	}
 	if (!content_base) {
 	    if ((content_location) && is_url(content_location)) {
-	        StrAllocCopy(content_base, content_location);
+		StrAllocCopy(content_base, content_location);
 	    } else {
-	        StrAllocCopy(content_base, newdoc->address);
+		StrAllocCopy(content_base, newdoc->address);
 	    }
 	}
 	if (!content_location) {
@@ -142,16 +149,16 @@ PUBLIC int printfile ARGS1(
      *  Load the suggested filename string. - FM
      */
     if (HText_getSugFname() != NULL)
-        StrAllocCopy(sug_filename, HText_getSugFname()); /* must be freed */
+	StrAllocCopy(sug_filename, HText_getSugFname()); /* must be freed */
     else
-        StrAllocCopy(sug_filename, newdoc->address); /* must be freed */
+	StrAllocCopy(sug_filename, newdoc->address); /* must be freed */
     /*
      *  Strip any gzip or compress suffix, if present. - FM
      */
     cp = NULL;
     if (strlen(sug_filename) > 3) {
-        cp = (char *)&sug_filename[(strlen(sug_filename) - 3)];
-        if ((*cp == '.' || *cp == '-' || *cp == '_') &&
+	cp = (char *)&sug_filename[(strlen(sug_filename) - 3)];
+	if ((*cp == '.' || *cp == '-' || *cp == '_') &&
 	    !strcasecomp((cp + 1), "gz")) {
 	    *cp = '\0';
 	} else {
@@ -159,8 +166,8 @@ PUBLIC int printfile ARGS1(
 	}
     }
     if ((cp == NULL) && strlen(sug_filename) > 2) {
-        cp = (char *)&sug_filename[(strlen(sug_filename) - 2)];
-        if ((*cp == '.' || *cp == '-' || *cp == '_') &&
+	cp = (char *)&sug_filename[(strlen(sug_filename) - 2)];
+	if ((*cp == '.' || *cp == '-' || *cp == '_') &&
 	    !strcasecomp((cp + 1), "Z")) {
 	    *cp = '\0';
 	}
@@ -175,15 +182,15 @@ PUBLIC int printfile ARGS1(
 	 *  Terminate prev string here.
 	 */
 	*cp = '\0';
-        /*
+	/*
 	 *  Number of characters in "lines=".
 	 */
 	cp += 6;
 
-        lines_in_file = atoi(cp);
+	lines_in_file = atoi(cp);
 	pages = lines_in_file/66;
     }
-	
+
     /*
      *  Determine the type.
      */
@@ -196,19 +203,19 @@ PUBLIC int printfile ARGS1(
     } else if (strstr(link_info, "PRINTER")) {
 	type = PRINTER;
 
-        if ((cp = (char *)strstr(link_info, "number=")) != NULL) {
-            /* number of characters in "number=" */
-            cp += 7;
-            printer_number = atoi(cp);
-        }
-        if ((cp = (char *)strstr(link_info, "pagelen=")) != NULL) {
-            /* number of characters in "pagelen=" */
-            cp += 8;
+	if ((cp = (char *)strstr(link_info, "number=")) != NULL) {
+	    /* number of characters in "number=" */
+	    cp += 7;
+	    printer_number = atoi(cp);
+	}
+	if ((cp = (char *)strstr(link_info, "pagelen=")) != NULL) {
+	    /* number of characters in "pagelen=" */
+	    cp += 8;
 	    pagelen = atoi(cp);
-        } else {
-            /* default to 66 lines */
-            pagelen = 66;
-        }
+	} else {
+	    /* default to 66 lines */
+	    pagelen = 66;
+	}
     }
 
     /*
@@ -224,7 +231,7 @@ PUBLIC int printfile ARGS1(
     switch (type) {
 	case TO_FILE:
 #if defined(__DJGPP__) || defined(_WINDOWS)
-                _fmode = O_TEXT;
+		_fmode = O_TEXT;
 #endif /* __DJGPP__  or _WINDOWS */
 		_statusline(FILENAME_PROMPT);
 	retry:	strcpy(filename, sug_filename);  /* add suggestion info */
@@ -235,7 +242,7 @@ PUBLIC int printfile ARGS1(
 		    format = HTFileFormat(filename, &encoding, NULL);
 		    if (!strcasecomp(format->name, "text/html") ||
 			!IsUnityEnc(encoding)) {
-		        *cp = '\0';
+			*cp = '\0';
 			strcat(filename, ".txt");
 		    }
 		}
@@ -249,7 +256,7 @@ PUBLIC int printfile ARGS1(
 				   sizeof(filename), recall)) < 0 ||
 		    *filename == '\0' || ch == UPARROW || ch == DNARROW) {
 		    if (recall && ch == UPARROW) {
-		        if (FirstRecall) {
+			if (FirstRecall) {
 			    FirstRecall = FALSE;
 			    /*
 			     *  Use the last Fname in the list. - FM
@@ -273,17 +280,17 @@ PUBLIC int printfile ARGS1(
 			    goto retry;
 			} else if ((cp = (char *)HTList_objectAt(
 							sug_filenames,
-		    					FnameNum)) != NULL) {
+							FnameNum)) != NULL) {
 			    strcpy(filename, 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
@@ -306,12 +313,12 @@ PUBLIC int printfile ARGS1(
 			    goto retry;
 			} else if ((cp = (char *)HTList_objectAt(
 							sug_filenames,
-		    					FnameNum)) != NULL) {
+							FnameNum)) != NULL) {
 			    strcpy(filename, 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;
 			}
@@ -323,7 +330,7 @@ PUBLIC int printfile ARGS1(
 		    _statusline(SAVE_REQUEST_CANCELLED);
 		    sleep(InfoSecs);
 		    break;
-                }
+		}
 
 		if (no_dotfiles || !show_dotfiles) {
 		    if (*filename == '.' ||
@@ -358,7 +365,7 @@ PUBLIC int printfile ARGS1(
 		    *(cp++) = '\0';
 		    strcpy(buffer, filename);
 		    if ((len=strlen(buffer)) > 0 && buffer[len-1] == '/')
-		        buffer[len-1] = '\0';
+			buffer[len-1] = '\0';
 #ifdef DOSPATH
 			 strcat(buffer, HTDOS_wwwName((char *)Home_Dir()));
 #else
@@ -372,7 +379,7 @@ PUBLIC int printfile ARGS1(
 		    strcpy(filename, buffer);
 		}
 #ifdef VMS
-        	if (strchr(filename, '/') != NULL) {
+		if (strchr(filename, '/') != NULL) {
 		    strcpy(buffer, HTVMS_name("", filename));
 		    strcpy(filename, buffer);
 		}
@@ -382,22 +389,22 @@ PUBLIC int printfile ARGS1(
 		    strcat(buffer, "[]");
 		    strcat(buffer, filename);
 		} else {
-                    strcpy(buffer, filename);
+		    strcpy(buffer, filename);
 		}
 #else
-                if (*filename != '/')
+		if (*filename != '/')
 		    cp = getenv("PWD");
 		else
 		    cp = NULL;
 		if (cp)
 #ifdef DOSPATH
-		    sprintf(buffer,"%s/%s", cp, HTDOS_name(filename));
+		    sprintf(buffer, "%s/%s", cp, HTDOS_name(filename));
 #else
-                    sprintf(buffer, "%s/%s", cp, filename);
+		    sprintf(buffer, "%s/%s", cp, filename);
 #endif
 		else
 #ifdef DOSPATH
-			 strcpy(buffer, HTDOS_name(filename));
+		    strcpy(buffer, HTDOS_name(filename));
 #else
 		    strcpy(buffer, filename);
 #endif
@@ -415,8 +422,8 @@ PUBLIC int printfile ARGS1(
 #endif /* VMS */
 		    c = 0;
 		    while (TOUPPER(c)!='Y' && TOUPPER(c)!='N' &&
-		    	   c != 7 && c != 3)
-		        c = LYgetch();
+			   c != 7 && c != 3)
+			c = LYgetch();
 #ifdef VMS
 		    if (HadVMSInterrupt) {
 			HadVMSInterrupt = FALSE;
@@ -431,25 +438,22 @@ PUBLIC int printfile ARGS1(
 			break;
 		    }
 		    if (TOUPPER(c) == 'N') {
-		        _statusline(NEW_FILENAME_PROMPT);
+			_statusline(NEW_FILENAME_PROMPT);
 			FirstRecall = TRUE;
 			FnameNum = FnameTotal;
 			goto retry;
 		    }
 		}
 
-                if ((outfile_fp = fopen(buffer,"w")) == NULL) {
+		if ((outfile_fp = LYNewTxtFile(buffer)) == NULL) {
 		    HTAlert(CANNOT_WRITE_TO_FILE);
 		    _statusline(NEW_FILENAME_PROMPT);
 		    FirstRecall = TRUE;
 		    FnameNum = FnameTotal;
 		    goto retry;
-                }
-#ifdef VMS
-		chmod(buffer, 0600);
-#endif
+		}
 
-		if (HTisDocumentSource()) {
+		if (LYPrependBaseToSource && HTisDocumentSource()) {
 		    /*
 		     *  Added the document's base as a BASE tag
 		     *  to the top of the file.  May create
@@ -459,7 +463,7 @@ PUBLIC int printfile ARGS1(
 		     *  replace it. - FM
 		     */
 		    fprintf(outfile_fp,
-		    	    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n",
+			    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n",
 			    newdoc->address, content_base);
 		}
 		print_wwwfile_to_fd(outfile_fp,0);
@@ -470,9 +474,9 @@ PUBLIC int printfile ARGS1(
 #ifdef VMS
 		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);
@@ -481,11 +485,11 @@ PUBLIC int printfile ARGS1(
 		HTAddSugFilename(buffer);
 #endif /* VMS */
 #if defined(__DJGPP__) || defined(_WINDOWS)
-              _fmode = O_BINARY;
+		_fmode = O_BINARY;
 #endif /* __DJGPP__ or _WINDOWS */
 		break;
 
-	case MAIL: 
+	case MAIL:
 	    if (LYPreparsedSource && first_mail_preparsed &&
 		HTisDocumentSource()) {
 		_statusline(CONFIRM_MAIL_SOURCE_PREPARSED);
@@ -523,6 +527,28 @@ PUBLIC int printfile ARGS1(
 		    break;
 		}
 
+		/*
+		 *  Determine which mail headers should be sent.
+		 *  Use Content-Type and MIME-Version headers only
+		 *  if needed.  We need them if we are mailing HTML
+		 *  source, or if we have 8-bit characters and will
+		 *  be sending Content-Transfer-Encoding to indicate
+		 *  this.  We will append a charset parameter to the
+		 *  Content-Type if we do not have an "x-" charset,
+		 *  and we will include the Content-Transfer-Encoding
+		 *  only if we are appending the charset parameter,
+		 *  because indicating an 8-bit transfer without also
+		 *  indicating the charset can cause problems with
+		 *  many mailers. - FM & KW
+		 */
+		disp_charset = LYCharSet_UC[current_char_set].MIMEname;
+		use_cte = HTLoadedDocumentEightbit();
+		if (!(use_cte && strncasecomp(disp_charset, "x-", 2))) {
+		    disp_charset = NULL;
+		    use_cte = FALSE;
+		}
+		use_type =  (disp_charset || HTisDocumentSource());
+
 		change_sug_filename(sug_filename);
 #ifdef VMS
 		if (strchr(user_response,'@') && !strchr(user_response,':') &&
@@ -533,13 +559,23 @@ PUBLIC int printfile ARGS1(
 
 		if (first) {
 		    tempname(tempfile, NEW_FILE);
+		    if (isPMDF) {
+			tempname(hdrfile, NEW_FILE);
+			if ((len = strlen(hdrfile)) > 4) {
+			    len -= 5;
+			    if (!strcasecomp((hdrfile + len), ".html")) {
+				hdrfile[len] = '\0';
+				strcat(hdrfile, ".txt");
+			    }
+			}
+		    }
 		    first = FALSE;
 		} else {
 		    remove(tempfile);   /* remove duplicates */
 		}
 		if (HTisDocumentSource()) {
 		    if ((len = strlen(tempfile)) > 3) {
-		        len -= 4;
+			len -= 4;
 			if (!strcasecomp((tempfile + len), ".txt")) {
 			    tempfile[len] = '\0';
 			    strcat(tempfile, ".html");
@@ -548,19 +584,67 @@ PUBLIC int printfile ARGS1(
 		} else if ((len = strlen(tempfile)) > 4) {
 		    len -= 5;
 		    if (!strcasecomp((tempfile + len), ".html")) {
-		        tempfile[len] = '\0';
+			tempfile[len] = '\0';
 			strcat(tempfile, ".txt");
 		    }
 		}
-		if((outfile_fp = LYNewTxtFile(tempfile)) == NULL) {
+		if ((outfile_fp = LYNewTxtFile(tempfile)) == NULL) {
 		    HTAlert(UNABLE_TO_OPEN_TEMPFILE);
 		    break;
 		}
 
+		if (isPMDF) {
+		    if ((hfd = LYNewTxtFile(hdrfile)) == NULL) {
+			HTAlert(UNABLE_TO_OPEN_TEMPFILE);
+			break;
+		    }
+		    if (use_type) {
+			fprintf(hfd, "Mime-Version: 1.0\n");
+			if (use_cte) {
+			    fprintf(hfd,
+				    "Content-Transfer-Encoding: 8bit\n");
+			}
+		    }
+		    if (HTisDocumentSource()) {
+			/*
+			 *  Add Content-Type, Content-Location, and
+			 *  Content-Base headers for HTML source. - FM
+			 */
+			fprintf(hfd, "Content-Type: text/html");
+			if (disp_charset != NULL) {
+			    fprintf(hfd,
+				    "; charset=%s\n",
+				    disp_charset);
+			} else {
+			    fprintf(hfd, "\n");
+			}
+			fprintf(hfd,
+				"Content-Base: %s\n",
+				content_base);
+			fprintf(hfd,
+				"Content-Location: %s\n",
+				content_location);
+		    } else {
+			/*
+			 *  Add Content-Type: text/plain if we have 8-bit
+			 *  characters and a valid charset for non-source
+			 *  documents. - FM
+			 */
+			if (disp_charset != NULL) {
+			    fprintf(hfd,
+				    "Content-Type: text/plain; charset=%s\n",
+				    disp_charset);
+			}
+		    }
+		    /*
+		     *  X-URL header. - FM
+		     */
+		    fprintf(hfd, "X-URL: %s\n", newdoc->address);
+		}
 		/*
 		 *  Write the contents to a temp file.
 		 */
-		if (HTisDocumentSource()) {
+		if (LYPrependBaseToSource && HTisDocumentSource()) {
 		    /*
 		     *  Added the document's base as a BASE tag to
 		     *  the top of the message body.  May create
@@ -570,9 +654,9 @@ PUBLIC int printfile ARGS1(
 		     *  replace it. - FM
 		     */
 		    fprintf(outfile_fp,
-		    	    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
+			    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
 			    newdoc->address, content_base);
-		} else {
+		} else if (!isPMDF) {
 		    fprintf(outfile_fp, "X-URL: %s\n\n", newdoc->address);
 		}
 		print_wwwfile_to_fd(outfile_fp, 0);
@@ -580,27 +664,61 @@ PUBLIC int printfile ARGS1(
 		    printlist(outfile_fp, FALSE);
 		fclose(outfile_fp);
 
-		remove_quotes(sug_filename);
-		sprintf(buffer, "%s/subject=\"%s\" %s %s", 
-			system_mail, sug_filename, tempfile, user_response);
+		if (isPMDF) {
+		    /*
+		     *  For PMDF, put the subject in the
+		     *  header file and close it. - FM
+		     */
+		    fprintf(hfd, "Subject: %.70s\n\n", sug_filename);
+		    fclose(hfd);
+		    /*
+		     *  Now set up the command. - FM
+		     */
+		    sprintf(buffer,
+			    "%s %s %s,%s %s",
+			    system_mail,
+			    system_mail_flags,
+			    hdrfile,
+			    tempfile,
+			    user_response);
+		} else {
+		    /*
+		     *  For "generic" VMS MAIL, include
+		     *  the subject in the command. - FM
+		     */
+		    remove_quotes(sug_filename);
+		    sprintf(buffer,
+			    "%s %s/subject=\"%.70s\" %s %s",
+			    system_mail,
+			    system_mail_flags,
+			    sug_filename,
+			    tempfile,
+			    user_response);
+		}
 
-        	stop_curses();
+		stop_curses();
 		printf(MAILING_FILE);
 		fflush(stdout);
-        	system(buffer);
+		system(buffer);
 		fflush(stdout);
-		sleep(MessageSecs);
-        	start_curses();
+		sleep(AlertSecs);
+		start_curses();
+		if (isPMDF) {
+		    /*
+		     *  Delete the header file. - FM
+		     */
+		    remove(hdrfile);
+		}
 #else /* Unix: */
-    		sprintf(buffer, "%s %s", system_mail, system_mail_flags);
+		sprintf(buffer, "%s %s", system_mail, system_mail_flags);
 
 #ifdef DOSPATH
-	 sprintf(tempfile, "%s%s", lynx_temp_space, "temp_mail.txt");
-	 if ((outfile_fp = fopen(tempfile,"w")) == NULL) {
+		sprintf(tempfile, "%s%s", lynx_temp_space, "temp_mail.txt");
+		if ((outfile_fp = LYNewTxtFile(tempfile)) == NULL) {
 			_statusline(MAIL_REQUEST_FAILED);
 			sleep(AlertSecs);
 			return;
-	 }
+		}
 #else
 		if ((outfile_fp = popen(buffer, "w")) == NULL) {
 			_statusline(MAIL_REQUEST_FAILED);
@@ -608,7 +726,7 @@ PUBLIC int printfile ARGS1(
 			break;
 		}
 #endif
-		
+
 		/*
 		 *  Determine which mail headers should be sent.
 		 *  Use Content-Type and MIME-Version headers only
@@ -635,7 +753,7 @@ PUBLIC int printfile ARGS1(
 		}
 #ifdef NOTDEFINED
 		/*  Enable this if indicating an 8-bit transfer without
-                 *  also indicating the charset causes problems. - kw */
+		 *  also indicating the charset causes problems. - kw */
 		if (use_cte && !disp_charse)
 		    use_cte = FALSE;
 #endif /* NOTDEFINED */
@@ -644,8 +762,10 @@ PUBLIC int printfile ARGS1(
 
 		if (use_mime) {
 		    fprintf(outfile_fp, "Mime-Version: 1.0\n");
-		    if (use_cte)
-			fprintf(outfile_fp, "Content-Transfer-Encoding: 8bit\n");
+		    if (use_cte) {
+			fprintf(outfile_fp,
+				"Content-Transfer-Encoding: 8bit\n");
+		    }
 		}
 
 		if (HTisDocumentSource()) {
@@ -655,10 +775,10 @@ PUBLIC int printfile ARGS1(
 		     */
 		    fprintf(outfile_fp, "Content-Type: text/html");
 		    if (disp_charset != NULL) {
-		        fprintf(outfile_fp, "; charset=%s\n",
+			fprintf(outfile_fp, "; charset=%s\n",
 					    disp_charset);
 		    } else {
-		        fprintf(outfile_fp, "\n");
+			fprintf(outfile_fp, "\n");
 		    }
 		} else {
 		    /*
@@ -679,7 +799,7 @@ PUBLIC int printfile ARGS1(
 		 */
 		if (use_mime) {
 		    if (content_base)
-		        fprintf(outfile_fp, "Content-Base: %s\n",
+			fprintf(outfile_fp, "Content-Base: %s\n",
 				content_base);
 		    if (content_location)
 			fprintf(outfile_fp, "Content-Location: %s\n",
@@ -692,7 +812,7 @@ PUBLIC int printfile ARGS1(
 		fprintf(outfile_fp, "To: %s\nSubject: %s\n",
 				     user_response, sug_filename);
 		fprintf(outfile_fp, "X-URL: %s\n\n", newdoc->address);
-		if (HTisDocumentSource()) {
+		if (LYPrependBaseToSource && HTisDocumentSource()) {
 		    /*
 		     *  Added the document's base as a BASE tag to
 		     *  the top of the message body.  May create
@@ -702,7 +822,7 @@ PUBLIC int printfile ARGS1(
 		     *  replace it. - FM
 		     */
 		    fprintf(outfile_fp,
-		    	    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
+			    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
 			    newdoc->address, content_base);
 		}
 		print_wwwfile_to_fd(outfile_fp, 0);
@@ -710,28 +830,28 @@ PUBLIC int printfile ARGS1(
 		    printlist(outfile_fp, FALSE);
 
 #ifdef DOSPATH
-	 sprintf(buffer, "%s -t \"%s\" -F %s", system_mail, user_response, tempfile);
-	 fclose(outfile_fp);	/* Close the tmpfile. */
-	 stop_curses();
-	 printf("Sending \n\n$ %s\n\nPlease wait...", buffer);
-	 system(buffer);
-	 sleep(MessageSecs);
-	 start_curses();
-	 remove(tempfile);	/* Delete the tmpfile. */
+		sprintf(buffer, "%s -t \"%s\" -F %s", system_mail, user_response, tempfile);
+		fclose(outfile_fp);	/* Close the tmpfile. */
+		stop_curses();
+		printf("Sending \n\n$ %s\n\nPlease wait...", buffer);
+		system(buffer);
+		sleep(MessageSecs);
+		start_curses();
+		remove(tempfile);	/* Delete the tmpfile. */
 #else
 		pclose(outfile_fp);
 #endif
 #endif /* VMS */
 		break;
-	
+
 	case TO_SCREEN:
 		pages = lines_in_file/(LYlines+1);
 		/* count fractional pages ! */
 		if ((lines_in_file % (LYlines+1)) > 0)
-		    pages++; 
+		    pages++;
 		if (pages > 4) {
 		    sprintf(filename, CONFIRM_LONG_SCREEN_PRINT, pages);
- 		    _statusline(filename);
+		    _statusline(filename);
 		    c=LYgetch();
 #ifdef VMS
 		    if (HadVMSInterrupt) {
@@ -741,13 +861,13 @@ PUBLIC int printfile ARGS1(
 			break;
 		    }
 #endif /* VMS */
-    		    if (c == RTARROW || c == 'y' || c== 'Y'
-                         || c == '\n' || c == '\r') {
-                        addstr("   Ok...");
+		    if (c == RTARROW || c == 'y' || c== 'Y'
+			 || c == '\n' || c == '\r') {
+			addstr("   Ok...");
 		    } else {
 			_statusline(PRINT_REQUEST_CANCELLED);
 			sleep(InfoSecs);
-		        break;
+			break;
 		    }
 		}
 
@@ -756,9 +876,9 @@ PUBLIC int printfile ARGS1(
 		if (LYgetstr(filename, VISIBLE,
 			     sizeof(filename), NORECALL) < 0) {
 		      _statusline(PRINT_REQUEST_CANCELLED);
-	              sleep(InfoSecs);
+		      sleep(InfoSecs);
 		      break;
-                }
+		}
 
 		outfile_fp = stdout;
 
@@ -767,7 +887,7 @@ PUBLIC int printfile ARGS1(
 		signal(SIGINT, SIG_IGN);
 #endif /* !VMS */
 
-		if (HTisDocumentSource()) {
+		if (LYPrependBaseToSource && HTisDocumentSource()) {
 		    /*
 		     *  Added the document's base as a BASE tag
 		     *  to the top of the file.  May create
@@ -777,7 +897,7 @@ PUBLIC int printfile ARGS1(
 		     *  replace it. - FM
 		     */
 		    fprintf(outfile_fp,
-		    	    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
+			    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
 			    newdoc->address, content_base);
 		}
 		print_wwwfile_to_fd(outfile_fp, 0);
@@ -800,15 +920,15 @@ PUBLIC int printfile ARGS1(
 #endif /* VMS */
 		start_curses();
 		break;
-	
+
 	case PRINTER:
 		pages = lines_in_file/pagelen;
 		/* count fractional pages ! */
 		if ((lines_in_file % pagelen) > 0)
-		    pages++; 
+		    pages++;
 		if (pages > 4) {
 		    sprintf(filename, CONFIRM_LONG_PAGE_PRINT, pages);
- 		    _statusline(filename);
+		    _statusline(filename);
 		    c=LYgetch();
 #ifdef VMS
 		    if (HadVMSInterrupt) {
@@ -818,13 +938,13 @@ PUBLIC int printfile ARGS1(
 			break;
 		    }
 #endif /* VMS */
-    		    if (c == RTARROW || c == 'y' || c== 'Y'
-                         || c == '\n' || c == '\r') {
-                        addstr("   Ok...");
+		    if (c == RTARROW || c == 'y' || c== 'Y'
+			 || c == '\n' || c == '\r') {
+			addstr("   Ok...");
 		    } else  {
 			_statusline(PRINT_REQUEST_CANCELLED);
 			sleep(InfoSecs);
-		        break;
+			break;
 		    }
 		}
 
@@ -849,12 +969,12 @@ PUBLIC int printfile ARGS1(
 			strcat(tempfile, ".txt");
 		    }
 		}
-                if ((outfile_fp = LYNewTxtFile(tempfile)) == NULL) {
-	            HTAlert(FILE_ALLOC_FAILED);
+		if ((outfile_fp = LYNewTxtFile(tempfile)) == NULL) {
+		    HTAlert(FILE_ALLOC_FAILED);
 		    break;
-                }
+		}
 
-		if (HTisDocumentSource()) {
+		if (LYPrependBaseToSource && HTisDocumentSource()) {
 		    /*
 		     *  Added the document's base as a BASE tag
 		     *  to the top of the file.  May create
@@ -864,7 +984,7 @@ PUBLIC int printfile ARGS1(
 		     *  replace it. - FM
 		     */
 		    fprintf(outfile_fp,
-		    	    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
+			    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",
 			    newdoc->address, content_base);
 		}
 		print_wwwfile_to_fd(outfile_fp, 0);
@@ -877,12 +997,12 @@ PUBLIC int printfile ARGS1(
 		{
 		    int count=0;
 		    for (cur_printer = printers;
-		         count < printer_number;
+			 count < printer_number;
 			 count++, cur_printer = cur_printer->next)
 			; /* null body */
 		}
 
-		/* 
+		/*
 		 *  Commands have the form "command %s [%s] [etc]"
 		 *  where %s is the filename and the second optional
 		 *  %s is the suggested filename.
@@ -902,7 +1022,7 @@ PUBLIC int printfile ARGS1(
 			    format = HTFileFormat(filename, &encoding, NULL);
 			    if (!strcasecomp(format->name, "text/html") ||
 				!IsUnityEnc(encoding)) {
-			        *cp = '\0';
+				*cp = '\0';
 				strcat(filename, ".txt");
 			    }
 			}
@@ -912,7 +1032,7 @@ PUBLIC int printfile ARGS1(
 			    *filename == '\0' ||
 			    ch == UPARROW || ch == DNARROW) {
 			    if (recall && ch == UPARROW) {
-			        if (FirstRecall) {
+				if (FirstRecall) {
 				    FirstRecall = FALSE;
 				    /*
 				     *  Use the last Fname in the list. - FM
@@ -936,17 +1056,17 @@ PUBLIC int printfile ARGS1(
 				    goto again;
 				} else if ((cp = (char *)HTList_objectAt(
 							sug_filenames,
-		    					FnameNum)) != NULL) {
+							FnameNum)) != NULL) {
 				    strcpy(filename, 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_again;
 				}
 			    } else if (recall && ch == DNARROW) {
-			        if (FirstRecall) {
+				if (FirstRecall) {
 				    FirstRecall = FALSE;
 				    /*
 				     *  Use the first Fname in the list. - FM
@@ -970,12 +1090,12 @@ PUBLIC int printfile ARGS1(
 				    goto again;
 				} else if ((cp = (char *)HTList_objectAt(
 							sug_filenames,
-		    					FnameNum)) != NULL) {
+							FnameNum)) != NULL) {
 				    strcpy(filename, 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_again;
 				}
@@ -987,25 +1107,25 @@ PUBLIC int printfile ARGS1(
 			    _statusline(PRINT_REQUEST_CANCELLED);
 			    sleep(InfoSecs);
 			    break;
-	                }
+			}
 
-		        if (no_dotfiles || !show_dotfiles) {
+			if (no_dotfiles || !show_dotfiles) {
 			    if (*filename == '.' ||
 #ifdef VMS
 			       ((cp = strrchr(filename, ':')) &&
-			       			*(cp+1) == '.') ||
+						*(cp+1) == '.') ||
 			       ((cp = strrchr(filename, ']')) &&
-			       			*(cp+1) == '.') ||
+						*(cp+1) == '.') ||
 #endif /* VMS */
 			       ((cp = strrchr(filename, '/')) &&
-			       			*(cp+1) == '.')) {
+						*(cp+1) == '.')) {
 				HTAlert(FILENAME_CANNOT_BE_DOT);
 				_statusline(NEW_FILENAME_PROMPT);
 				FirstRecall = TRUE;
 				FnameNum = FnameTotal;
-			        goto again;
+				goto again;
 			    }
-		        }
+			}
 			/*
 			 *  Cancel if the user entered "/dev/null" on Unix,
 			 *  or an "nl:" path (case-insensitive) on VMS. - FM
@@ -1044,8 +1164,8 @@ PUBLIC int printfile ARGS1(
 
 		/*
 		 *  Move the cursor to the top of the screen so that
-		 *  output from system'd commands don't scroll up 
-                 *  the screen.
+		 *  output from system'd commands don't scroll up
+		 *  the screen.
 		 */
 		move(1,1);
 
@@ -1064,7 +1184,7 @@ PUBLIC int printfile ARGS1(
 #else
 		/*
 		 *  Set document's title as an environment variable. - JKT
-		 */                
+		 */
 		StrAllocCopy(envbuffer, "LYNX_PRINT_TITLE=");
 		StrAllocCat(envbuffer, HText_getTitle());
 		putenv(envbuffer);
@@ -1098,7 +1218,7 @@ PUBLIC int printfile ARGS1(
     FREE(content_base);
     FREE(content_location);
     return(NORMAL);
-}	
+}
 
 #ifdef VMS
 PRIVATE int remove_quotes ARGS1(
@@ -1121,7 +1241,7 @@ PRIVATE int remove_quotes ARGS1(
 /*
  * print_options writes out the current printer choices to a file
  * so that the user can select printers in the same way that
- * they select all other links 
+ * they select all other links
  * printer links look like
  *  LYNXPRINT://LOCAL_FILE/lines=#  	     print to a local file
  *  LYNXPRINT://TO_SCREEN/lines=#   	     print to the screen
@@ -1144,7 +1264,7 @@ PUBLIC int print_options ARGS2(
     pages = lines_in_file/66 + 1;
 
     if (first) {
-        tempname(tempfile, NEW_FILE);
+	tempname(tempfile, NEW_FILE);
 #if defined (VMS) || defined (DOSPATH)
 	sprintf(print_filename, "file://localhost/%s", tempfile);
 #else
@@ -1153,12 +1273,12 @@ PUBLIC int print_options ARGS2(
 	first = FALSE;
 #ifdef VMS
     } else {
-        remove(tempfile);   /* Remove duplicates on VMS. */
+	remove(tempfile);   /* Remove duplicates on VMS. */
 #endif /* !VMS */
     }
 
     if ((fp0 = LYNewTxtFile(tempfile)) == NULL) {
-        HTAlert(UNABLE_TO_OPEN_PRINTOP_FILE);
+	HTAlert(UNABLE_TO_OPEN_PRINTOP_FILE);
 	return(-1);
     }
 
@@ -1166,15 +1286,15 @@ PUBLIC int print_options ARGS2(
     LYforce_no_cache = TRUE;
 
     fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n",
-    		 PRINT_OPTIONS_TITLE);
+		 PRINT_OPTIONS_TITLE);
 
     fprintf(fp0,"<h1>Printing Options (%s Version %s)</h1>\n",
-    				       LYNX_NAME, LYNX_VERSION);
+				       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",
-    	    lines_in_file, pages, (pages > 1 ? "s" : ""));
+	    "There are %d lines, or approximately %d page%s, to print.<br>\n",
+	    lines_in_file, pages, (pages > 1 ? "s" : ""));
     fputs(buffer,fp0);
 
     if (no_print || no_disk_save || child_lynx || no_mail)
@@ -1184,26 +1304,26 @@ PUBLIC int print_options ARGS2(
     fputs("Please select one:<br>\n<pre>\n", fp0);
 
     if (child_lynx == FALSE && no_disk_save == FALSE && no_print == FALSE)
-        fprintf(fp0,
+	fprintf(fp0,
    "   <a href=\"LYNXPRINT://LOCAL_FILE/lines=%d\">Save to a local file</a>\n",
-	 	lines_in_file);
+		lines_in_file);
     else
 	fprintf(fp0,"   Save to disk disabled.\n");
     if (child_lynx == FALSE && no_mail == FALSE)
-         fprintf(fp0,
+	 fprintf(fp0,
    "   <a href=\"LYNXPRINT://MAIL_FILE/lines=%d\">Mail the file</a>\n",
 		lines_in_file);
-    fprintf(fp0, 
+    fprintf(fp0,
    "   <a href=\"LYNXPRINT://TO_SCREEN/lines=%d\">Print to the screen</a>\n",
-	 	lines_in_file);
+		lines_in_file);
 
-    for (count = 0, cur_printer = printers; cur_printer != NULL; 
-        cur_printer = cur_printer->next, count++)
+    for (count = 0, cur_printer = printers; cur_printer != NULL;
+	cur_printer = cur_printer->next, count++)
     if (no_print == FALSE || cur_printer->always_enabled) {
-        fprintf(fp0,
+	fprintf(fp0,
    "   <a href=\"LYNXPRINT://PRINTER/number=%d/pagelen=%d/lines=%d\">",
-                count, cur_printer->pagelen, lines_in_file);
-	fprintf(fp0, (cur_printer->name ? 
+		count, cur_printer->pagelen, lines_in_file);
+	fprintf(fp0, (cur_printer->name ?
 		      cur_printer->name : "No Name Given"));
 	fprintf(fp0, "</a>\n");
     }
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index 87d31358..4f6b1c72 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -329,10 +329,10 @@ PRIVATE int ColorCode ARGS1(
 	static int map[] = {
 		0,  4,  2,  6, 1,  5,  3,  7,
 		8, 12, 10, 14, 9, 13, 11, 15 };
-	return map[n];
+	return map[color];
 }
 #else
-#define ColorCode(n) (n)
+#define ColorCode(color) (color)
 #endif
 
 /*
@@ -1051,6 +1051,9 @@ PUBLIC void read_cfg ARGS1(
 	} else if (!strncasecomp(buffer, "PREFERRED_LANGUAGE:", 19)) {
 	    StrAllocCopy(language, buffer+19);
 
+	} else if (!strncasecomp(buffer, "PREPEND_BASE_TO_SOURCE:", 23)) {
+	    LYPrependBaseToSource = is_true(buffer+23);
+
 	} else if (!strncasecomp(buffer, "PRINTER:", 8)) {
 	    add_printer_to_list(&buffer[8], &printers);
 	}
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 9e995b39..3a4a7b46 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -496,39 +496,39 @@ re_read:
 #endif /* VMS */
                 c = '0';  /* keypad 0 */
             break;
-        case '1':                           /** VT300  Find  **/
+        case '1':                           /** VTxxx  Find  **/
             if ((b == '[' || c == 155) && (d=GetChar()) == '~')
                 c = FIND_KEY;
             break;
 	case '2':
 	    if (b == '[' || c == 155) {
-	        if ((d=GetChar())=='~')     /** VT300 Insert **/
+	        if ((d=GetChar())=='~')     /** VTxxx Insert **/
 	            c = INSERT_KEY;
 	        else if ((d == '8' ||
 			  d == '9') &&
 			 GetChar() == '~')
 	         {
-		    if (d == '8')            /** VT300  Help **/
+		    if (d == '8')            /** VTxxx  Help **/
 	                c = F1;
-	            else if (d == '9')       /** VT300   Do  **/
+	            else if (d == '9')       /** VTxxx   Do  **/
 	                c = DO_KEY;
 		    d = -1;
 		 }
 	    }
 	    break;
-	case '3':			     /** VT300 Delete **/
+	case '3':			     /** VTxxx Delete **/
 	    if ((b == '[' || c == 155) && (d=GetChar()) == '~')
 	        c = REMOVE_KEY;
 	    break;
-        case '4':                            /** VT300 Select **/
+        case '4':                            /** VTxxx Select **/
             if ((b == '[' || c == 155) && (d=GetChar()) == '~')
                 c = SELECT_KEY;
             break;
-        case '5':                            /** VT300 PrevScreen **/
+        case '5':                            /** VTxxx PrevScreen **/
             if ((b == '[' || c == 155) && (d=GetChar()) == '~')
                 c = PGUP;
             break;
-        case '6':                            /** VT300 NextScreen **/
+        case '6':                            /** VTxxx NextScreen **/
             if ((b == '[' || c == 155) && (d=GetChar()) == '~')
                 c = PGDOWN;
             break;
@@ -556,92 +556,97 @@ re_read:
 	 */
 	switch(c) {
 	case KEY_DOWN:	           /* The four arrow keys ... */
-	   c=DNARROW;
+	   c = DNARROW;
 	   break;
 	case KEY_UP:	
-	   c=UPARROW;
+	   c = UPARROW;
 	   break;
 	case KEY_LEFT:	
-	   c=LTARROW;
+	   c = LTARROW;
 	   break;
 	case KEY_RIGHT:	           /* ... */
-	   c=RTARROW;
+	   c = RTARROW;
 	   break;
 	case KEY_HOME:	           /* Home key (upward+left arrow) */
-	   c=HOME;
+	   c = HOME;
 	   break;
 	case KEY_CLEAR:	           /* Clear screen */
-	   c=18; /* CTRL-R */
+	   c = 18; /* CTRL-R */
 	   break;
 	case KEY_NPAGE:	           /* Next page */
-	   c=PGDOWN;
+	   c = PGDOWN;
 	   break;
 	case KEY_PPAGE:	           /* Previous page */
-	   c=PGUP;
+	   c = PGUP;
 	   break;
 	case KEY_LL:	           /* home down or bottom (lower left) */
-	   c=END;
+	   c = END;
 	   break;
                                         /* The keypad is arranged like this:*/
                                         /*    a1    up    a3   */
                                         /*   left   b2  right  */
                                         /*    c1   down   c3   */
 	case KEY_A1:	           /* upper left of keypad */
-	   c=HOME;
+	   c = HOME;
 	   break;
 	case KEY_A3:	           /* upper right of keypad */
-	   c=PGUP;
+	   c = PGUP;
 	   break;
 	case KEY_B2:	           /* center of keypad */
-	   c=DO_NOTHING;
+	   c = DO_NOTHING;
 	   break;
 	case KEY_C1:	           /* lower left of keypad */
-	   c=END;
+	   c = END;
 	   break;
 	case KEY_C3:	           /* lower right of keypad */
-	   c=PGDOWN;
+	   c = PGDOWN;
 	   break;
 #ifdef KEY_END
 	case KEY_END:	           /* end key           001 */
-	   c=END;
+	   c = END;
 	   break;
 #endif /* KEY_END */
 #ifdef KEY_HELP
 	case KEY_HELP:	           /* help key          001 */
-	   c=F1;
+	   c = F1;
 	   break;
 #endif /* KEY_HELP */
 #ifdef KEY_BACKSPACE
 	case KEY_BACKSPACE:
-	   c=127;		   /* backspace key (delete, not Ctrl-H) */
+	   c = 127;		   /* backspace key (delete, not Ctrl-H) */
 	   break;
 #endif /* KEY_BACKSPACE */
 #ifdef KEY_DC
 	case KEY_DC:
-	   c=REMOVE_KEY;	   /* delete character */
+	   c = REMOVE_KEY;	   /* delete character */
 	   break;
 #endif /* KEY_DC */
 #ifdef KEY_IC
 	case KEY_IC:
-	   c=INSERT_KEY;	   /* insert character */
+	   c = INSERT_KEY;	   /* insert character */
 	   break;
 #endif /* KEY_IC */
 #ifdef KEY_FIND
 	case KEY_FIND:
-	   c=FIND_KEY;		   /* find */
+	   c = FIND_KEY;	   /* find */
 	   break;
 #endif /* KEY_FIND */
+#ifdef KEY_REDO
+	case KEY_REDO:	           /* VTxxx Do */
+	   c = DO_KEY;
+	   break;
+#endif /* KEY_REDO */
 #ifdef KEY_SELECT
 	case KEY_SELECT:
-	   c=SELECT_KEY;	   /* select */
+	   c = SELECT_KEY;	   /* select */
 	   break;
 #endif /* KEY_SELECT */
 #ifdef KEY_F
 	case KEY_F(1):
-	   c=F1;		   /* help-key */
+	   c = F1;		   /* help-key */
 	   break;
 	case KEY_F(16):
-	   c=DO_KEY;		   /* help-key */
+	   c = DO_KEY;		   /* help-key */
 	   break;
 #endif /* KEY_F */
 
diff --git a/src/LYexit.c b/src/LYexit.c
index 74ce16c3..9567cb1b 100644
--- a/src/LYexit.c
+++ b/src/LYexit.c
@@ -113,7 +113,13 @@ PUBLIC void LYexit ARGS1(
 	printf("\r\n%s\r\n\r\n", MEMORY_EXHAUSTED_ABORT);
 	fflush(stdout);
     }
-    *stderr = LYOrigStderr;
+    if (LYTraceLogFP != NULL) {
+	fflush(stdout);
+	fflush(stderr);
+	fclose(LYTraceLogFP);
+	LYTraceLogFP = NULL;
+	*stderr = LYOrigStderr;
+    }
 #endif /* !VMS */
     exit(status);
 }
diff --git a/src/LYrcFile.c b/src/LYrcFile.c
index 2ba688dd..184424dd 100644
--- a/src/LYrcFile.c
+++ b/src/LYrcFile.c
@@ -34,9 +34,6 @@ PUBLIC void read_rc NOPARAMS
     sprintf(rcfile, "%s/.lynxrc", Home_Dir());
 #endif /* VMS */
 #endif /* DJGPP */
-#if defined(__DJGPP__) || defined(_WINDOWS)
-                _fmode = O_TEXT;
-#endif /* __DJGPP__  or _WINDOWS */
 
     /*
      *  Open the RC file for reading.
@@ -532,6 +529,9 @@ PUBLIC int save_rc NOPARAMS
     /*
      *  Open the file for write.
      */
+#if defined(__DJGPP__) || defined(_WINDOWS)
+    _fmode = O_TEXT;
+#endif /* __DJGPP__  or _WINDOWS */
     if ((fp = LYNewTxtFile(rcfile)) == NULL) {
 	return FALSE;
     }
@@ -632,7 +632,7 @@ PUBLIC int save_rc NOPARAMS
 # logging purposes, and for mailed comments.\n\
 # If you do not want this information given out, set the NO_FROM_HEADER\n\
 # to TRUE in lynx.cfg, or use the -nofrom command line switch.  You also\n\
-# could leave this field blank, but then you won't have if it included in\n\
+# could leave this field blank, but then you won't have it included in\n\
 # your mailed comments.\n");
     fprintf(fp, "personal_mail_address=%s\n\n",
     		(personal_mail_address ? personal_mail_address : ""));
diff --git a/src/Makefile.old b/src/Makefile.old
index 8435f4bb..49e6ea04 100644
--- a/src/Makefile.old
+++ b/src/Makefile.old
@@ -56,28 +56,27 @@ LYCharSets.o: ../userdefs.h
 
 CHRTR= chrtrans/
 
-TABLES= $(CHRTR)iso01_uni.h \
- $(CHRTR)def7_uni.h \
- $(CHRTR)iso02_uni.h \
+TABLES= \
+ $(CHRTR)cp1250_uni.h \
+ $(CHRTR)cp1251_uni.h \
  $(CHRTR)cp1252_uni.h \
- $(CHRTR)dmcs_uni.h \
- $(CHRTR)mac_uni.h \
- $(CHRTR)next_uni.h \
- $(CHRTR)koi8r_uni.h \
- $(CHRTR)viscii_uni.h \
+ $(CHRTR)cp1253_uni.h \
+ $(CHRTR)cp1255_uni.h \
+ $(CHRTR)cp1256_uni.h \
+ $(CHRTR)cp1257_uni.h \
  $(CHRTR)cp437_uni.h \
+ $(CHRTR)cp737_uni.h \
+ $(CHRTR)cp775_uni.h \
  $(CHRTR)cp850_uni.h \
  $(CHRTR)cp852_uni.h \
+ $(CHRTR)cp862_uni.h \
+ $(CHRTR)cp864_uni.h \
  $(CHRTR)cp866_uni.h \
- $(CHRTR)cp737_uni.h \
  $(CHRTR)cp869_uni.h \
- $(CHRTR)cp864_uni.h \
- $(CHRTR)cp862_uni.h \
- $(CHRTR)cp1250_uni.h \
- $(CHRTR)cp1251_uni.h \
- $(CHRTR)cp1253_uni.h \
- $(CHRTR)cp1255_uni.h \
- $(CHRTR)cp1256_uni.h \
+ $(CHRTR)def7_uni.h \
+ $(CHRTR)dmcs_uni.h \
+ $(CHRTR)iso01_uni.h \
+ $(CHRTR)iso02_uni.h \
  $(CHRTR)iso03_uni.h \
  $(CHRTR)iso04_uni.h \
  $(CHRTR)iso05_uni.h \
@@ -86,10 +85,14 @@ TABLES= $(CHRTR)iso01_uni.h \
  $(CHRTR)iso08_uni.h \
  $(CHRTR)iso09_uni.h \
  $(CHRTR)iso10_uni.h \
- $(CHRTR)utf8_uni.h \
+ $(CHRTR)koi8r_uni.h \
+ $(CHRTR)mac_uni.h \
+ $(CHRTR)mnem_suni.h \
+ $(CHRTR)mnem2_suni.h \
+ $(CHRTR)next_uni.h \
  $(CHRTR)rfc_suni.h \
- $(CHRTR)mnemonic_suni.h \
- $(CHRTR)mnem_suni.h
+ $(CHRTR)utf8_uni.h \
+ $(CHRTR)viscii_uni.h
 
 CMN=../WWW/Library/Implementation/
 
diff --git a/src/UCAuto.c b/src/UCAuto.c
index b09df4ab..0166dfac 100644
--- a/src/UCAuto.c
+++ b/src/UCAuto.c
@@ -88,6 +88,16 @@ PRIVATE void call_setfont ARGS3(
     }
 }
 
+PRIVATE void write_esc ARGS1(
+	CONST char *,	p)
+{
+    int fd = open("/dev/tty", O_WRONLY);
+    if (fd >= 0) {
+	write(fd, p, strlen(p));
+	close(fd);
+    }
+}
+
 /*
  *  This is the thing that actually gets called from display_page().
  */
@@ -96,14 +106,12 @@ PUBLIC void UCChangeTerminalCodepage ARGS2(
 	LYUCcharset *,	p)
 {
     static int lastcs = -1;
-    static char * lastname = NULL;
-    static TGNstate_t lastGN = G0;
+    static CONST char * lastname = NULL;
     static TTransT_t lastTransT = GN_dunno;
     static TGen_state_t lastUtf = Dunno;
     static TGen_state_t lastHasUmap = Dunno;
 
-    char * name = p->MIMEname;
-    TGNstate_t GN = G0;
+    CONST char * name = p->MIMEname;
     TTransT_t TransT = GN_dunno;
     TGen_state_t Utf = Dunno;
     TGen_state_t HasUmap = Dunno;
@@ -124,7 +132,6 @@ PUBLIC void UCChangeTerminalCodepage ARGS2(
      *
      *  For some reason stdout won't do; maybe needs flush() somewhere.
      */
-#define ESCOUT stderr
     if (display || (cp = getenv(DISPLAY)) != NULL) {
 	/*
 	 *  We won't do anything in an xterm.  Better that way...
@@ -220,19 +227,19 @@ PUBLIC void UCChangeTerminalCodepage ARGS2(
 	    /*
 	     *  Switch Linux console to lat1 table.
 	     */
-	    fprintf(ESCOUT, "\033(B");
+	    write_esc("\033(B");
 	} else if (TransT == GN_0decgraf) {
-	    fprintf(ESCOUT, "\033(0");
+	    write_esc("\033(0");
 	} else if (TransT == GN_Ucp437) {
 	     /*
 	      *  Switch Linux console to 437 table?
 	      */
-	    fprintf(ESCOUT, "\033(U");
+	    write_esc("\033(U");
 	} else if (TransT == GN_Kuser) {
 	     /*
 	      *  Switch Linux console to user table.
 	      */
-	    fprintf(ESCOUT, "\033(K");
+	    write_esc("\033(K");
 	}
 	if (TransT != GN_dunno && TransT != GN_dontCare) {
 	    lastTransT = TransT;
@@ -250,7 +257,7 @@ PUBLIC void UCChangeTerminalCodepage ARGS2(
 	    /*
 	     *  Turn Linux console UTF8 mode ON.
 	     */
-	    fprintf(ESCOUT, "\033%%G");
+	    write_esc("\033%G");
 	    lastUtf = Utf;
 	}
 	return;
@@ -259,7 +266,7 @@ PUBLIC void UCChangeTerminalCodepage ARGS2(
 	/*
 	 *  Turn Linux console UTF8 mode OFF.
 	 */
-	fprintf(ESCOUT, "\033%%@");
+	write_esc("\033%@");
 	lastUtf = Utf;
     }
 
diff --git a/src/UCAux.c b/src/UCAux.c
index d0323233..a88ea273 100644
--- a/src/UCAux.c
+++ b/src/UCAux.c
@@ -94,12 +94,12 @@ PUBLIC UCTQ_t UCCanTranslateFromTo ARGS2(
 	if (!strcmp(fromname, "koi8-r") || /* from cyrillic */
 	    !strcmp(fromname, "iso-8859-5") ||
 	    !strcmp(fromname, "cp866") ||
-	    !strcmp(fromname, "windows-1251") ||
+	    !strcmp(fromname, "cp1251") ||
 	    !strcmp(fromname, "koi-8")) {
 	    if (strcmp(toname, "iso-8859-5") &&
 		strcmp(toname, "koi8-r") &&
 		strcmp(toname, "cp866") &&
-		strcmp(toname, "windows-1251"))
+		strcmp(toname, "cp1251"))
 		tqmax = TQ_POOR;
 	}
 	return ((LYCharSet_UC[from].UChndl >= 0) ? tqmax : tqmin);
diff --git a/src/UCdomap.c b/src/UCdomap.c
index 2bd75f5a..a03812cc 100644
--- a/src/UCdomap.c
+++ b/src/UCdomap.c
@@ -3,8 +3,8 @@
  *  =======
  *
  * Derived from code in the Linux kernel console driver.
- * The GNU Public Licence therefore applies, see 
- * the file COPYING in the top-level directory 
+ * The GNU Public Licence therefore applies, see
+ * the file COPYING in the top-level directory
  * which should come with every Lynx distribution.
  *
  *  [ original comment: - KW ]
@@ -19,11 +19,7 @@
 #include "HTMLDTD.h"
 
 #include "LYGlobalDefs.h"
-#ifdef VMS
-#include "[.chrtrans]UCkd.h"
-#else
-#include "chrtrans/UCkd.h"
-#endif /* VMS */
+#include "UCkd.h"
 #include "UCdomap.h"
 #include "UCMap.h"
 #include "UCDefs.h"
@@ -32,89 +28,52 @@
 /*
  *  Include tables & parameters.
  */
-#ifdef VMS
-#include "[.chrtrans]def7_uni.h"	/* 7 bit approximations */
-#include "[.chrtrans]iso01_uni.h"	/* ISO Latin 1		*/
-#include "[.chrtrans]iso02_uni.h"	/* ISO Latin 2		*/
-#include "[.chrtrans]cp1252_uni.h"	/* WinLatin1 (cp1252)	*/
-#include "[.chrtrans]dmcs_uni.h"	/* DEC Multinational	*/
-#include "[.chrtrans]mac_uni.h"		/* Macintosh (8 bit)	*/
-#include "[.chrtrans]next_uni.h"	/* NeXT character set	*/
-#include "[.chrtrans]koi8r_uni.h"	/* KOI8-R Cyrillic	*/
-#include "[.chrtrans]viscii_uni.h"	/* Vietnamese (VISCII)	*/
-#include "[.chrtrans]cp437_uni.h"	/* DosLatinUS (cp437)	*/
-#include "[.chrtrans]cp850_uni.h"	/* DosLatin1 (cp850)	*/
-#include "[.chrtrans]cp852_uni.h"	/* DosLatin2 (cp852)	*/
-#include "[.chrtrans]cp866_uni.h"	/* DosCyrillic (cp866)	*/
-#include "[.chrtrans]cp737_uni.h"	/* DosGreek (cp737)	*/
-#include "[.chrtrans]cp869_uni.h"	/* DosGreek2 (cp869)	*/
-#include "[.chrtrans]cp864_uni.h"	/* DosArabic (cp864)	*/
-#include "[.chrtrans]cp862_uni.h"	/* DosHebrew (cp862)	*/
-#include "[.chrtrans]cp1250_uni.h"	/* WinLatin2 (cp1250)	*/
-#include "[.chrtrans]cp1251_uni.h"	/* WinCyrillic (cp1251)	*/
-#include "[.chrtrans]cp1253_uni.h"	/* WinGreek (cp1253)	*/
-#include "[.chrtrans]cp1255_uni.h"	/* WinHebrew (cp1255)	*/
-#include "[.chrtrans]cp1256_uni.h"	/* WinArabic (cp1256)	*/
-#include "[.chrtrans]iso03_uni.h"	/* ISO Latin 3		*/
-#include "[.chrtrans]iso04_uni.h"	/* ISO Latin 4		*/
-#include "[.chrtrans]iso05_uni.h"	/* ISO Latin 5 Cyrillic	*/
-#include "[.chrtrans]iso06_uni.h"	/* ISO 8859-6 Arabic	*/
-#include "[.chrtrans]iso07_uni.h"	/* ISO 8859-7 Greek	*/
-#include "[.chrtrans]iso08_uni.h"	/* ISO 8859-8 Hebrew	*/
-#include "[.chrtrans]iso09_uni.h"	/* ISO 8859-9 (Latin 5)	*/
-#include "[.chrtrans]iso10_uni.h"	/* ISO 8859-10		*/
-#include "[.chrtrans]utf8_uni.h"	/* UNICODE UTF 8	*/
-#include "[.chrtrans]rfc_suni.h"	/* RFC 1345 w/o Intro	*/
-#include "[.chrtrans]mnemonic_suni.h"	/* RFC 1345 Mnemonic	*/
-#ifdef NOTDEFINED 
-#include "[.chrtrans]mnem_suni.h"
-#endif /* NOTDEFINED */
-#else
-#include "chrtrans/def7_uni.h"		/* 7 bit approximations */
-#include "chrtrans/iso01_uni.h"		/* ISO Latin 1		*/
-#include "chrtrans/iso02_uni.h"		/* ISO Latin 2		*/
-#include "chrtrans/cp1252_uni.h"	/* WinLatin1 (cp1252)	*/
-#include "chrtrans/dmcs_uni.h"		/* DEC Multinational	*/
-#include "chrtrans/mac_uni.h"		/* Macintosh (8 bit)	*/
-#include "chrtrans/next_uni.h"		/* NeXT character set	*/
-#include "chrtrans/koi8r_uni.h"		/* KOI8-R Cyrillic	*/
-#include "chrtrans/viscii_uni.h"	/* Vietnamese (VISCII)	*/
-#include "chrtrans/cp437_uni.h"		/* DosLatinUS (cp437)	*/
-#include "chrtrans/cp850_uni.h"		/* DosLatin1 (cp850)	*/
-#include "chrtrans/cp852_uni.h"		/* DosLatin2 (cp852)	*/
-#include "chrtrans/cp866_uni.h" 	/* DosCyrillic (cp866)	*/
-#include "chrtrans/cp737_uni.h"		/* DosGreek (cp737)	*/
-#include "chrtrans/cp869_uni.h"		/* DosGreek2 (cp869)	*/
-#include "chrtrans/cp864_uni.h"		/* DosArabic (cp864)	*/
-#include "chrtrans/cp862_uni.h"		/* DosHebrew (cp862)	*/
-#include "chrtrans/cp1250_uni.h"	/* WinLatin2 (cp1250)	*/
-#include "chrtrans/cp1251_uni.h"	/* WinCyrillic (cp1251)	*/
-#include "chrtrans/cp1253_uni.h"	/* WinGreek (cp1253)	*/
-#include "chrtrans/cp1255_uni.h"	/* WinHebrew (cp1255)	*/
-#include "chrtrans/cp1256_uni.h"	/* WinArabic (cp1256)	*/
-#include "chrtrans/iso03_uni.h"		/* ISO Latin 3		*/
-#include "chrtrans/iso04_uni.h"		/* ISO Latin 4		*/
-#include "chrtrans/iso05_uni.h"		/* ISO Latin 5 Cyrillic	*/
-#include "chrtrans/iso06_uni.h"		/* ISO 8859-6 Arabic	*/
-#include "chrtrans/iso07_uni.h"		/* ISO 8859-7 Greek	*/
-#include "chrtrans/iso08_uni.h"		/* ISO 8859-8 Hebrew	*/
-#include "chrtrans/iso09_uni.h"		/* ISO 8859-9 (Latin 5)	*/
-#include "chrtrans/iso10_uni.h"		/* ISO 8859-10		*/
-#include "chrtrans/utf8_uni.h"		/* UNICODE UTF 8	*/
-#include "chrtrans/rfc_suni.h"		/* RFC 1345 w/o Intro	*/
-#include "chrtrans/mnemonic_suni.h"	/* RFC 1345 Mnemonic	*/
+#include "cp1250_uni.h"		/* WinLatin2 (cp1250)	*/
+#include "cp1251_uni.h"		/* WinCyrillic (cp1251)	*/
+#include "cp1252_uni.h"		/* WinLatin1 (cp1252)	*/
+#include "cp1253_uni.h"		/* WinGreek (cp1253)	*/
+#include "cp1255_uni.h"		/* WinHebrew (cp1255)	*/
+#include "cp1256_uni.h"		/* WinArabic (cp1256)	*/
+#include "cp1257_uni.h"		/* WinBaltRim (cp1257)	*/
+#include "cp437_uni.h"		/* DosLatinUS (cp437)	*/
+#include "cp737_uni.h"		/* DosGreek (cp737)	*/
+#include "cp775_uni.h"		/* DosBaltRim (cp775)	*/
+#include "cp850_uni.h"		/* DosLatin1 (cp850)	*/
+#include "cp852_uni.h"		/* DosLatin2 (cp852)	*/
+#include "cp862_uni.h"		/* DosHebrew (cp862)	*/
+#include "cp864_uni.h"		/* DosArabic (cp864)	*/
+#include "cp866_uni.h"		/* DosCyrillic (cp866)	*/
+#include "cp869_uni.h"		/* DosGreek2 (cp869)	*/
+#include "def7_uni.h"		/* 7 bit approximations */
+#include "dmcs_uni.h"		/* DEC Multinational	*/
+#include "iso01_uni.h"		/* ISO Latin 1		*/
+#include "iso02_uni.h"		/* ISO Latin 2		*/
+#include "iso03_uni.h"		/* ISO Latin 3		*/
+#include "iso04_uni.h"		/* ISO Latin 4		*/
+#include "iso05_uni.h"		/* ISO Latin 5 Cyrillic	*/
+#include "iso06_uni.h"		/* ISO 8859-6 Arabic	*/
+#include "iso07_uni.h"		/* ISO 8859-7 Greek	*/
+#include "iso08_uni.h"		/* ISO 8859-8 Hebrew	*/
+#include "iso09_uni.h"		/* ISO 8859-9 (Latin 5)	*/
+#include "iso10_uni.h"		/* ISO 8859-10		*/
+#include "koi8r_uni.h"		/* KOI8-R Cyrillic	*/
+#include "mac_uni.h"		/* Macintosh (8 bit)	*/
+#include "mnem2_suni.h"		/* RFC 1345 Mnemonic	*/
+#include "next_uni.h"		/* NeXT character set	*/
+#include "rfc_suni.h"		/* RFC 1345 w/o Intro	*/
+#include "utf8_uni.h"		/* UNICODE UTF 8	*/
+#include "viscii_uni.h"		/* Vietnamese (VISCII)	*/
 #ifdef NOTDEFINED
-#include "chrtrans/mnem_suni.h"
+#include "mnem_suni.h"
 #endif /* NOTDEFINED */
-#endif /* VMS */
 
 #define FREE(x) if (x) {free(x); x = NULL;}
 
 /*
  *  Some of the code below, and some of the comments, are left in for
  *  historical reasons.  Not all those tables below are currently
- *  really needed (and what with all those hardwired codepoints), 
- *  but let's keep them around for now.  They may come in handy if we 
+ *  really needed (and what with all those hardwired codepoints),
+ *  but let's keep them around for now.  They may come in handy if we
  *  decide to make more extended use of the mechanisms (including e.g.
  *  for chars < 127...).  - KW
  */
@@ -156,7 +115,7 @@ PRIVATE u16 translations[][256] = {
     0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
     0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
     0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
-  }, 
+  },
   /*
    *  VT100 graphics mapped to Unicode.
    */
@@ -198,7 +157,7 @@ PRIVATE u16 translations[][256] = {
    *  IBM Codepage 437 mapped to Unicode.
    */
   {
-    0x0000, 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 
+    0x0000, 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022,
     0x25d8, 0x25cb, 0x25d9, 0x2642, 0x2640, 0x266a, 0x266b, 0x263c,
     0x25ba, 0x25c4, 0x2195, 0x203c, 0x00b6, 0x00a7, 0x25ac, 0x21a8,
     0x2191, 0x2193, 0x2192, 0x2190, 0x221f, 0x2194, 0x25b2, 0x25bc,
@@ -230,7 +189,7 @@ PRIVATE u16 translations[][256] = {
     0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229,
     0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248,
     0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0
-  }, 
+  },
   /*
    *  User mapping -- default to codes for direct font mapping.
    */
@@ -301,7 +260,7 @@ PRIVATE void UC_con_set_trans PARAMS((
 	int		Gn,
 	int		update_flag));
 PRIVATE int con_insert_unipair PARAMS((
-	u16 		unicode,
+	u16		unicode,
 	u16		fontpos,
 	int		fordefault));
 PRIVATE int con_insert_unipair_str PARAMS((
@@ -309,9 +268,9 @@ PRIVATE int con_insert_unipair_str PARAMS((
 	char *		replace_str,
 	int		fordefault));
 PRIVATE void con_clear_unimap PARAMS((
-        int		fordefault));
+	int		fordefault));
 PRIVATE void con_clear_unimap_str PARAMS((
-        int		fordefault));
+	int		fordefault));
 #ifdef NOTDEFINED
 PRIVATE int con_set_unimap PARAMS((
 	u16			ct,
@@ -381,7 +340,7 @@ PRIVATE void set_inverse_transl ARGS1(
 		glyph = conv_uni_to_pc(p[j], 0);
 		if (glyph >= 0 && glyph < MAX_GLYPH && q[glyph] < 32) {
 			/* prefer '-' above SHY etc. */
-		  	q[glyph] = j;
+			q[glyph] = j;
 		}
 	}
 }
@@ -487,7 +446,7 @@ PRIVATE int con_get_trans_new ARGS1(
 #endif
 	for (i=0; i<E_TABSZ ; i++)
 	  arg[i] = p[i];
-	
+
 	return 0;
 }
 #endif /* NOTDEFINED */
@@ -509,7 +468,7 @@ PRIVATE void UC_con_set_trans ARGS3(
 
     if (!UC_valid_UC_charset(UC_charset_in_hndl)) {
 	if (TRACE)
-	    fprintf(stderr,"UC_con_set_trans: Invalid charset handle %i.\n",
+	    fprintf(stderr,"UC_con_set_trans: Invalid charset handle %d.\n",
 		    UC_charset_in_hndl);
 	return;
     }
@@ -540,7 +499,7 @@ PRIVATE void UC_con_set_trans ARGS3(
 }
 
 /*
- * Unicode -> current font conversion 
+ * Unicode -> current font conversion
  *
  * A font has at most 512 chars, usually 256.
  * But one font position may represent several Unicode chars.
@@ -550,7 +509,7 @@ PRIVATE void UC_con_set_trans ARGS3(
  */
 
 PRIVATE int unitable_contents_valid = 0; /* Use ASCII-only mode for bootup*/
-PRIVATE int unitable_str_contents_valid = 0; 
+PRIVATE int unitable_str_contents_valid = 0;
 
 static u16 **uni_pagedir[32] =
 {
@@ -575,7 +534,7 @@ PRIVATE struct unimapdesc_str *UC_current_unitable_str = NULL;
  *  as "default" - kw
  */
 PRIVATE int unidefault_contents_valid = 0; /* Use ASCII-only mode for bootup*/
-PRIVATE int unidefault_str_contents_valid = 0; 
+PRIVATE int unidefault_str_contents_valid = 0;
 
 static u16 **unidefault_pagedir[32] =
 {
@@ -596,7 +555,7 @@ PRIVATE u16 * UC_default_unitable = NULL;
 PRIVATE struct unimapdesc_str *UC_default_unitable_str = NULL;
 
 PRIVATE int con_insert_unipair ARGS3(
-	u16, 		unicode,
+	u16,		unicode,
 	u16,		fontpos,
 	int,		fordefault)
 {
@@ -632,10 +591,10 @@ PRIVATE int con_insert_unipair ARGS3(
     }
 
   p2[unicode & 0x3f] = fontpos;
-  
+
   return 0;
 }
- 
+
 PRIVATE int con_insert_unipair_str ARGS3(
 	u16,		unicode,
 	char *,		replace_str,
@@ -673,10 +632,10 @@ PRIVATE int con_insert_unipair_str ARGS3(
     }
 
   p2[unicode & 0x3f] = replace_str;
-  
+
   return 0;
 }
- 
+
 /* ui arg was a leftover, deleted -kw */
 PRIVATE void
 con_clear_unimap ARGS1(int, fordefault)
@@ -760,7 +719,7 @@ con_set_unimap ARGS2(u16, ct, struct unipair *, list)
 
   for ( i = 0 ; i <= 3 ; i++ )
     set_inverse_transl(i); /* Update all inverse translations */
-  
+
   return err;
 }
 #endif /* NOTDEFINED */
@@ -813,11 +772,11 @@ PRIVATE int UC_con_set_unimap ARGS2(
 
     if (!UC_valid_UC_charset(UC_charset_out_hndl)) {
       if (TRACE)
-	fprintf(stderr,"UC_con_set_unimap: Invalid charset handle %i.\n",
+	fprintf(stderr,"UC_con_set_unimap: Invalid charset handle %d.\n",
 		UC_charset_out_hndl);
       return -1;
     }
-    
+
   p = UCInfo[UC_charset_out_hndl].unitable;
   if (p == UC_current_unitable) {    /* test whether pointers are equal */
     return update_flag;			/* nothing to be done */
@@ -829,7 +788,7 @@ PRIVATE int UC_con_set_unimap ARGS2(
   con_clear_unimap(0);
 
     for (i = 0; i < 256; i++) {
- 	for (j = UCInfo[UC_charset_out_hndl].unicount[i]; j; j--) {
+	for (j = UCInfo[UC_charset_out_hndl].unicount[i]; j; j--) {
 	    con_insert_unipair(*(p++), i, 0);
 	}
     }
@@ -856,14 +815,14 @@ PRIVATE int UC_con_set_unimap_str ARGS3(
       list++;
     }
 
-    /* 
+    /*
      *  No inverse translations for replacement strings!
      */
     if (!err) {
 	if (fordefault)
 	    unidefault_str_contents_valid = 1;
 	else
-	    unitable_str_contents_valid = 1;  
+	    unitable_str_contents_valid = 1;
     }
 
   return err;
@@ -905,7 +864,7 @@ PRIVATE int conv_uni_to_pc ARGS2(
 {
   int h;
   u16 **p1, *p2;
-  
+
   /* Only 16-bit codes supported at this time */
   if (ucs > 0xffff)
     ucs = 0xfffd;		/* U+FFFD: REPLACEMENT CHARACTER */
@@ -920,7 +879,7 @@ PRIVATE int conv_uni_to_pc ARGS2(
    */
   else if ( (ucs & ~UNI_DIRECT_MASK) == UNI_DIRECT_BASE )
     return ucs & UNI_DIRECT_MASK;
-  
+
   if (usedefault) {
       if (!unidefault_contents_valid)
 	  return -3;
@@ -950,7 +909,7 @@ PRIVATE int conv_uni_to_str ARGS4(
 {
   char *h;
   char ***p1, **p2;
-  
+
   /* Only 16-bit codes supported at this time */
   if (ucs > 0xffff)
     ucs = 0xfffd;		/* U+FFFD: REPLACEMENT CHARACTER */
@@ -1058,7 +1017,7 @@ PUBLIC int UCTransUniChar ARGS2(
     }
     return rc;
 }
-  
+
 /*
  *  Returns string length, or negative value for error.
  */
@@ -1141,7 +1100,7 @@ PUBLIC int UCTransUniCharStr ARGS5(
 	  rc = conv_uni_to_pc(0xfffd, 1);
       if (rc >= 32) {
 	  outbuf[0] = rc; outbuf[1] = '\0';
-	  return 1; 
+	  return 1;
       }
       return rc;
   }
@@ -1157,7 +1116,7 @@ PRIVATE int UC_MapGN ARGS2(
     int i,Gn,found,lasthndl;
     found = 0;
     Gn = -1;
-    for (i=0; i<4 && Gn<0; i++) { 
+    for (i=0; i<4 && Gn<0; i++) {
 	if (UC_GNhandles[i] < 0) {
 	    Gn = i;
 	} else if (UC_GNhandles[i] == UChndl) {
@@ -1165,7 +1124,7 @@ PRIVATE int UC_MapGN ARGS2(
 	    found = 1;
 	}
     }
-    if (found) 
+    if (found)
 	return Gn;
     if (Gn >= 0) {
 	UCInfo[UChndl].GN = Gn;
@@ -1184,13 +1143,13 @@ PRIVATE int UC_MapGN ARGS2(
     }
     if (TRACE) {
 	fprintf(stderr,
-		"UC_MapGN: Using %i <- %i (%s)\n",
+		"UC_MapGN: Using %d <- %d (%s)\n",
 		Gn, UChndl, UCInfo[UChndl].MIMEname);
     }
     UC_con_set_trans(UChndl,Gn,update_flag);
     return Gn;
 }
-  
+
 PUBLIC int UCTransChar ARGS3(
 	char,		ch_in,
 	int,		charset_in,
@@ -1465,7 +1424,7 @@ PUBLIC int UCTransCharStr ARGS6(
 	    rc = conv_uni_to_pc(0xfffd, 1);
 	if (rc >= 32) {
 	    outbuf[0] = rc; outbuf[1] = '\0';
-	    return 1; 
+	    return 1;
 	} else if (rc <= 0) {
 	    outbuf[0] = '\0';
 	    return rc;
@@ -1511,7 +1470,7 @@ PUBLIC int UCGetLYhndl_byMIME ARGS1(
 
     for (i = 0;
 	 (i < MAXCHARSETS && i < LYNumCharsets &&
-          LYchar_set_names[i] && LYhndl < 0); i++) {
+	  LYchar_set_names[i] && LYhndl < 0); i++) {
 	if (LYCharSet_UC[i].MIMEname &&
 	    !strcmp(UC_MIMEcharset,LYCharSet_UC[i].MIMEname)) {
 	    LYhndl = i;
@@ -1519,70 +1478,78 @@ PUBLIC int UCGetLYhndl_byMIME ARGS1(
     }
     if (LYhndl < 0) {
 	/*
-	 *  Not yet found, special treatment for several CJK charsets, etc.
-	 *  Cheating here.  Also recognize UTF-8 as synonym for
-	 *  UNICODE-1-1-UTF-8 (The example file for now still uses the
-	 *  long name, so that's what will be used internally.).
+	 *  Not yet found, try synonyms. - FM
 	 */
-	if (!strcmp(UC_MIMEcharset, "utf-8")) {
-	  return UCGetLYhndl_byMIME("unicode-1-1-utf-8");
+	if (!strcmp(UC_MIMEcharset, "unicode-1-1-utf-8") ||
+	    !strcmp(UC_MIMEcharset, "utf8")) {
+	    return UCGetLYhndl_byMIME("utf-8");
 	}
 	if (!strncmp(UC_MIMEcharset, "iso-2022-jp", 11) ||
 	    !strcmp(UC_MIMEcharset, "x-euc-jp")) {
 	    return UCGetLYhndl_byMIME("euc-jp");
-	} else if (!strcmp(UC_MIMEcharset, "iso-2022-kr")) {
+	}
+	if (!strcmp(UC_MIMEcharset, "x-shift-jis")) {
+	    return UCGetLYhndl_byMIME("shift_jis");
+	}
+	else if (!strcmp(UC_MIMEcharset, "iso-2022-kr")) {
 	    return UCGetLYhndl_byMIME("euc-kr");
-	} else if (!strcmp(UC_MIMEcharset, "gb2312") ||
+	}
+	else if (!strcmp(UC_MIMEcharset, "gb2312") ||
 		   !strncmp(UC_MIMEcharset, "cn-gb", 5) ||
 		   !strcmp(UC_MIMEcharset, "iso-2022-cn")) {
 	    return UCGetLYhndl_byMIME("euc-cn");
-	} else if (!strcmp(UC_MIMEcharset, "cn-big5")) {
+	}
+	else if (!strcmp(UC_MIMEcharset, "cn-big5")) {
 	    return UCGetLYhndl_byMIME("big5");
-	} else if (!strcmp(UC_MIMEcharset, "x-mac-roman") ||
+	}
+	else if (!strcmp(UC_MIMEcharset, "x-mac-roman") ||
 		   !strcmp(UC_MIMEcharset, "mac-roman")) {
 	    return UCGetLYhndl_byMIME("macintosh");
-	} else if (!strcmp(UC_MIMEcharset, "next") ||
+	}
+	else if (!strcmp(UC_MIMEcharset, "x-next") ||
 		   !strcmp(UC_MIMEcharset, "nextstep") ||
 		   !strcmp(UC_MIMEcharset, "x-nextstep")) {
 	    return UCGetLYhndl_byMIME("x-next");
-	} else if (!strcmp(UC_MIMEcharset, "windows-1252")) {
+	}
+	if (!strcmp(UC_MIMEcharset,
+		   "iso-8859-1-windows-3.1-latin-1")) {
+	    return UCGetLYhndl_byMIME("cp1252");
+	}
+	if ((!strncmp(UC_MIMEcharset, "ibm", 3) ||
+	     !strncmp(UC_MIMEcharset, "cp-", 3)) &&
+	    isdigit((unsigned char)UC_MIMEcharset[3]) &&
+	    isdigit((unsigned char)UC_MIMEcharset[4]) &&
+	    isdigit((unsigned char)UC_MIMEcharset[5])) {
 	    /*
-	     *  It's not my fault that Microsoft hasn't registered
-	     *  the name people are using. - KW
+	     *  For "ibmNNN<...>" or "cp-NNN", try "cpNNN<...>"
+	     *  if not yet found. - KW & FM
 	     */
-	    return UCGetLYhndl_byMIME("iso-8859-1-windows-3.1-latin-1");
-	} else if (!strncmp(UC_MIMEcharset, "ibm", 3) ||
-		   !strncmp(UC_MIMEcharset, "cp-", 3)) {
-	    CONST char * cp = UC_MIMEcharset + 3;
 	    char * cptmp = NULL;
-	    if (*cp && isdigit(*cp) &&
-		*(cp++) && isdigit(*cp) &&
-		*(cp++) && isdigit(*cp)) {
-		/*
-		 *  For "ibmNNN<...>" or "cp-NNN", try "cpNNN<...>"
-		 *  if not yet found. - KW & FM
-		 */
-		StrAllocCopy(cptmp, UC_MIMEcharset + 1);
-		cptmp[0] = 'c';
-		cptmp[1] = 'p';
-		LYhndl = UCGetLYhndl_byMIME(cptmp);
-		FREE(cptmp);
-	    }
-	} else if (UC_MIMEcharset[0] == 'c' &&
-		   UC_MIMEcharset[1] == 'p' &&
-		   UC_MIMEcharset[2] == '1' &&
-		   strlen(UC_MIMEcharset) == 6 &&
-		   isdigit((unsigned char)UC_MIMEcharset[3]) &&
-		   isdigit((unsigned char)UC_MIMEcharset[4]) &&
-		   isdigit((unsigned char)UC_MIMEcharset[5])) {
-	    char tmp[16];
+
+	    StrAllocCopy(cptmp, (UC_MIMEcharset + 1));
+	    cptmp[0] = 'c';
+	    cptmp[1] = 'p';
+	    LYhndl = UCGetLYhndl_byMIME(cptmp);
+	    FREE(cptmp);
+	    return LYhndl;
+	}
+	if (!strncmp(UC_MIMEcharset, "windows-", 8) &&
+	    isdigit((unsigned char)UC_MIMEcharset[8]) &&
+	    isdigit((unsigned char)UC_MIMEcharset[9]) &&
+	    isdigit((unsigned char)UC_MIMEcharset[10])) {
 	    /*
-	     *  For "cp1NNN", try "windows-1NNN"
-	     *  if not yet found. - KW
+	     *  For "windows-NNN<...>", try "cpNNN<...>" - FM
 	     */
-	    sprintf(tmp, "windows-%s", UC_MIMEcharset + 2);
-	    return UCGetLYhndl_byMIME(tmp);
-	} else if (!strcmp(UC_MIMEcharset, "koi-8")) { /* accentsoft bogosity */
+	    char * cptmp = NULL;
+
+	    StrAllocCopy(cptmp, (UC_MIMEcharset + 6));
+	    cptmp[0] = 'c';
+	    cptmp[1] = 'p';
+	    LYhndl = UCGetLYhndl_byMIME(cptmp);
+	    FREE(cptmp);
+	    return LYhndl;
+	}
+	if (!strcmp(UC_MIMEcharset, "koi-8")) { /* accentsoft bugosity */
 	  return UCGetLYhndl_byMIME("koi8-r");
   }
     }
@@ -1681,7 +1648,7 @@ PRIVATE char ** UC_setup_LYCharSets_repl ARGS2(
   {
     u16 ct;
     struct unipair_str *list;
-    
+
 	/*
 	 *  Determine if we have any mapping of a Unicode in the range
 	 *  160-255 to a replacement string for our new charset...
@@ -1697,7 +1664,7 @@ PRIVATE char ** UC_setup_LYCharSets_repl ARGS2(
       }
   }
     /*
-     *  Now allocate a new table compatible with LYCharSets[] 
+     *  Now allocate a new table compatible with LYCharSets[]
      *  and with the HTMLDTD for entities.
      *  We don't know yet whether we'll keep it around. */
   p = prepl = (char **) malloc(HTML_dtd.number_of_entities * sizeof(char *));
@@ -1734,7 +1701,7 @@ PRIVATE char ** UC_setup_LYCharSets_repl ARGS2(
 		} else {
 		    /*
 		     *			      ...or another byte...
-		     */ 
+		     */
 #ifdef NOTDEFINED
 	  *p = (char *)malloc(2*sizeof(char));
 	  if (!*p) {
@@ -1826,7 +1793,7 @@ PRIVATE int UC_Register_with_LYCharSets ARGS4(
 			UC_MIMEcharset, UC_LYNXcharset);
 	    }
       return -1;
-    } 
+    }
 	/*
 	 *  Add to LYCharSets.c lists.
 	 */
@@ -1894,7 +1861,7 @@ PUBLIC void UC_Charset_Setup ARGS8(
     /*
      *  Get (new?) slot.
      */
-    found = -1;  
+    found = -1;
     for (i = 0; i < UCNumCharsets && found < 0; i++) {
 	if (!strcmp(UCInfo[i].MIMEname, UC_MIMEcharset)) {
 	    found = i;
@@ -1962,7 +1929,7 @@ PUBLIC void UCInit NOARGS
     UC_CHARSET_SETUP_iso_8859_1;	  /* ISO Latin 1	  */
     UC_CHARSET_SETUP_iso_8859_2;	  /* ISO Latin 2	  */
 
-    UC_CHARSET_SETUP_iso_8859_1_windows_; /* WinLatin1 (cp1252)	  */
+    UC_CHARSET_SETUP_cp1252;		  /* WinLatin1 (cp1252)	  */
     UC_CHARSET_SETUP_dec_mcs;		  /* DEC Multinational    */
     UC_CHARSET_SETUP_macintosh;		  /* Macintosh (8 bit)    */
     UC_CHARSET_SETUP_x_next;		  /* NeXT character set   */
@@ -1977,14 +1944,17 @@ PUBLIC void UCInit NOARGS
     UC_CHARSET_SETUP_cp866;		  /* DosCyrillic (cp866)  */
     UC_CHARSET_SETUP_cp864;		  /* DosArabic (cp864)	  */
     UC_CHARSET_SETUP_cp737;		  /* DosGreek (cp737)	  */
+    UC_CHARSET_SETUP_cp775;		  /* DosBaltRim (cp775)	  */
     UC_CHARSET_SETUP_cp869;		  /* DosGreek2 (cp869)	  */
     UC_CHARSET_SETUP_cp862;		  /* DosHebrew (cp862)	  */
 
-    UC_CHARSET_SETUP_windows_1250;	  /* WinLatin1 (cp1251)	  */
-    UC_CHARSET_SETUP_windows_1251;	  /* WinCyrillic (cp1251) */
-    UC_CHARSET_SETUP_windows_1253;		  /* WinGreek (cp1253)	  */
-    UC_CHARSET_SETUP_windows_1255;		  /* WinHebrew (cp1255)	  */
-    UC_CHARSET_SETUP_windows_1256;		  /* WinArabic (cp1256)	  */
+    UC_CHARSET_SETUP_cp1250;		  /* WinLatin2 (cp1250)	  */
+    UC_CHARSET_SETUP_cp1251;		  /* WinCyrillic (cp1251) */
+    UC_CHARSET_SETUP_windows_1253;	  /* WinGreek (cp1253)	  */
+    UC_CHARSET_SETUP_windows_1255;	  /* WinHebrew (cp1255)	  */
+    UC_CHARSET_SETUP_windows_1256;	  /* WinArabic (cp1256)	  */
+    UC_CHARSET_SETUP_cp1257;		  /* WinBaltRim (cp1257)  */
+
     UC_CHARSET_SETUP_iso_8859_3;	  /* ISO Latin 3	  */
     UC_CHARSET_SETUP_iso_8859_4;	  /* ISO Latin 4	  */
     UC_CHARSET_SETUP_iso_8859_5;	  /* ISO 8859-5 Cyrillic  */
@@ -1994,7 +1964,7 @@ PUBLIC void UCInit NOARGS
     UC_CHARSET_SETUP_iso_8859_9;	  /* ISO 8859-9 (Latin 5) */
     UC_CHARSET_SETUP_iso_8859_10;	  /* ISO 8859-10	  */
 
-    UC_CHARSET_SETUP_unicode_1_1_utf_8;	  /* UNICODE UTF 8	  */
+    UC_CHARSET_SETUP_utf_8;		  /* UNICODE UTF 8	  */
     UC_CHARSET_SETUP_mnemonic_ascii_0;	  /* RFC 1345 w/o Intro	  */
     UC_CHARSET_SETUP_mnemonic;		  /* RFC 1345 Mnemonic	  */
 #ifdef NOTDEFINED
diff --git a/src/chrtrans/MAKEW32.BAT b/src/chrtrans/MAKEW32.BAT
index 009de876..c8714cc4 100644
--- a/src/chrtrans/MAKEW32.BAT
+++ b/src/chrtrans/MAKEW32.BAT
@@ -2,6 +2,24 @@
 @echo this batch file.
 @echo .
 make -f makefile.w32
+makeuctb cp1250_uni.tbl > cp1250_uni.h
+makeuctb cp1251_uni.tbl > cp1251_uni.h
+makeuctb cp1252_uni.tbl > cp1252_uni.h
+makeuctb cp1253_uni.tbl > cp1253_uni.h
+makeuctb cp1255_uni.tbl > cp1255_uni.h
+makeuctb cp1256_uni.tbl > cp1256_uni.h
+makeuctb cp1257_uni.tbl > cp1257_uni.h
+makeuctb cp437_uni.tbl > cp437_uni.h
+makeuctb cp737_uni.tbl > cp737_uni.h
+makeuctb cp775_uni.tbl > cp775_uni.h
+makeuctb cp850_uni.tbl > cp850_uni.h
+makeuctb cp852_uni.tbl > cp852_uni.h
+makeuctb cp862_uni.tbl > cp862_uni.h
+makeuctb cp864_uni.tbl > cp864_uni.h
+makeuctb cp866_uni.tbl > cp866_uni.h
+makeuctb cp869_uni.tbl > cp869_uni.h
+makeuctb def7_uni.tbl > def7_uni.h
+makeuctb dmcs_uni.tbl > dmcs_uni.h
 makeuctb iso01_uni.tbl > iso01_uni.h
 makeuctb iso02_uni.tbl > iso02_uni.h
 makeuctb iso03_uni.tbl > iso03_uni.h
@@ -12,27 +30,11 @@ makeuctb iso07_uni.tbl > iso07_uni.h
 makeuctb iso08_uni.tbl > iso08_uni.h
 makeuctb iso09_uni.tbl > iso09_uni.h
 makeuctb iso10_uni.tbl > iso10_uni.h
-makeuctb cp437_uni.tbl > cp437_uni.h
-makeuctb cp866_uni.tbl > cp866_uni.h
-makeuctb cp850_uni.tbl > cp850_uni.h
-makeuctb cp852_uni.tbl > cp852_uni.h
-makeuctb cp1250_uni.tbl > cp1250_uni.h
-makeuctb cp1251_uni.tbl > cp1251_uni.h
-makeuctb cp1252_uni.tbl > cp1252_uni.h
-makeuctb viscii_uni.tbl > viscii_uni.h
-makeuctb utf8_uni.tbl > utf8_uni.h
-makeuctb mnemonic_suni.tbl > mnemonic_suni.h
+makeuctb koi8r_uni.tbl > koi8r_uni.h
+makeuctb mac_uni.tbl > mac_uni.h
 makeuctb mnem_suni.tbl > mnem_suni.h
+makeuctb mnem2_suni.tbl > mnem2_suni.h
+makeuctb next_uni.tbl > next_uni.h
 makeuctb rfc_suni.tbl > rfc_suni.h
-makeuctb def7_uni.tbl > def7_uni.h
-makeuctb koi8r_uni.tbl > koi8r_uni.h
-makeuctb mac_uni.tbl > mac_uni.h

-makeuctb next_uni.tbl > next_uni.h

-makeuctb dmcs_uni.tbl > dmcs_uni.h

-makeuctb cp869_uni.tbl > cp869_uni.h

-makeuctb cp864_uni.tbl > cp864_uni.h

-makeuctb cp862_uni.tbl > cp862_uni.h

-makeuctb cp737_uni.tbl > cp737_uni.h

-makeuctb cp1256_uni.tbl > cp1256_uni.h

-makeuctb cp1255_uni.tbl > cp1255_uni.h

-makeuctb cp1253_uni.tbl > cp1253_uni.h

+makeuctb utf8_uni.tbl > utf8_uni.h
+makeuctb viscii_uni.tbl > viscii_uni.h
diff --git a/src/chrtrans/Makefile.old b/src/chrtrans/Makefile.old
index 7e6c9a99..c4b04b2f 100644
--- a/src/chrtrans/Makefile.old
+++ b/src/chrtrans/Makefile.old
@@ -20,42 +20,42 @@ FONTMAP_INC = iso01_uni.h# default, if not set by recursive call
 
 ### MCFLAGS=-g -DUNIX -DLINUX -DNO_KEYPAD -DNO_TTYTYPE -DEXP_CHARTRANS -I.. -I../../WWW/Library/Implementation -I../..
 
-CHRTR=
-
-TABLES= $(CHRTR)iso01_uni.h \
- $(CHRTR)cp850_uni.h \
- $(CHRTR)cp1252_uni.h \
- $(CHRTR)cp437_uni.h \
- $(CHRTR)dmcs_uni.h \
- $(CHRTR)mac_uni.h \
- $(CHRTR)next_uni.h \
- $(CHRTR)viscii_uni.h \
- $(CHRTR)def7_uni.h \
- $(CHRTR)iso02_uni.h \
- $(CHRTR)cp852_uni.h \
- $(CHRTR)cp1250_uni.h \
- $(CHRTR)iso03_uni.h \
- $(CHRTR)iso04_uni.h \
- $(CHRTR)iso05_uni.h \
- $(CHRTR)cp866_uni.h \
- $(CHRTR)cp1251_uni.h \
- $(CHRTR)koi8r_uni.h \
- $(CHRTR)iso06_uni.h \
- $(CHRTR)cp864_uni.h \
- $(CHRTR)cp1256_uni.h \
- $(CHRTR)iso07_uni.h \
- $(CHRTR)cp737_uni.h \
- $(CHRTR)cp869_uni.h \
- $(CHRTR)cp1253_uni.h \
- $(CHRTR)iso08_uni.h \
- $(CHRTR)cp862_uni.h \
- $(CHRTR)cp1255_uni.h \
- $(CHRTR)iso09_uni.h \
- $(CHRTR)iso10_uni.h \
- $(CHRTR)utf8_uni.h \
- $(CHRTR)rfc_suni.h \
- $(CHRTR)mnemonic_suni.h \
- $(CHRTR)mnem_suni.h
+TABLES= \
+ cp1250_uni.h \
+ cp1251_uni.h \
+ cp1252_uni.h \
+ cp1253_uni.h \
+ cp1255_uni.h \
+ cp1256_uni.h \
+ cp1257_uni.h \
+ cp437_uni.h \
+ cp737_uni.h \
+ cp850_uni.h \
+ cp852_uni.h \
+ cp862_uni.h \
+ cp864_uni.h \
+ cp866_uni.h \
+ cp869_uni.h \
+ def7_uni.h \
+ dmcs_uni.h \
+ iso01_uni.h \
+ iso02_uni.h \
+ iso03_uni.h \
+ iso04_uni.h \
+ iso05_uni.h \
+ iso06_uni.h \
+ iso07_uni.h \
+ iso08_uni.h \
+ iso09_uni.h \
+ iso10_uni.h \
+ koi8r_uni.h \
+ mac_uni.h \
+ mnem_suni.h \
+ mnem2_suni.h \
+ next_uni.h \
+ rfc_suni.h \
+ utf8_uni.h \
+ viscii_uni.h
 
 default: $(FONTMAP_INC)
 
@@ -67,28 +67,25 @@ makeuctb: makeuctb.c UCkd.h
 .tbl.h:
 	./makeuctb $*.tbl > $@
 
-def7_uni.h: def7_uni.tbl makeuctb
-iso01_uni.h: iso01_uni.tbl makeuctb
-iso02_uni.h: iso02_uni.tbl makeuctb
+cp1250_uni.h: cp1250_uni.tbl makeuctb
+cp1251_uni.h: cp1251_uni.tbl makeuctb
 cp1252_uni.h: cp1252_uni.tbl makeuctb
-dmcs_uni.h: dmcs_uni.tbl makeuctb
-mac_uni.h: mac_uni.tbl makeuctb
-next_uni.h: next_uni.tbl makeuctb
-koi8r_uni.h: koi8r_uni.tbl makeuctb
-viscii_uni.h: viscii_uni.tbl makeuctb
+cp1253_uni.h: cp1253_uni.tbl makeuctb
+cp1255_uni.h: cp1255_uni.tbl makeuctb
+cp1256_uni.h: cp1256_uni.tbl makeuctb
+cp1257_uni.h: cp1257_uni.tbl makeuctb
 cp437_uni.h: cp437_uni.tbl makeuctb
+cp737_uni.h: cp737_uni.tbl makeuctb
 cp850_uni.h: cp850_uni.tbl makeuctb
 cp852_uni.h: cp852_uni.tbl makeuctb
+cp862_uni.h: cp862_uni.tbl makeuctb
+cp864_uni.h: cp864_uni.tbl makeuctb
 cp866_uni.h: cp866_uni.tbl makeuctb
-cp737_uni.h: cp737_uni.tbl makeuctb
 cp869_uni.h: cp869_uni.tbl makeuctb
-cp864_uni.h: cp864_uni.tbl makeuctb
-cp862_uni.h: cp862_uni.tbl makeuctb
-cp1250_uni.h: cp1250_uni.tbl makeuctb
-cp1251_uni.h: cp1251_uni.tbl makeuctb
-cp1253_uni.h: cp1253_uni.tbl makeuctb
-cp1255_uni.h: cp1255_uni.tbl makeuctb
-cp1256_uni.h: cp1256_uni.tbl makeuctb
+def7_uni.h: def7_uni.tbl makeuctb
+dmcs_uni.h: dmcs_uni.tbl makeuctb
+iso01_uni.h: iso01_uni.tbl makeuctb
+iso02_uni.h: iso02_uni.tbl makeuctb
 iso03_uni.h: iso03_uni.tbl makeuctb
 iso04_uni.h: iso04_uni.tbl makeuctb
 iso05_uni.h: iso05_uni.tbl makeuctb
@@ -97,10 +94,14 @@ iso07_uni.h: iso07_uni.tbl makeuctb
 iso08_uni.h: iso08_uni.tbl makeuctb
 iso09_uni.h: iso09_uni.tbl makeuctb
 iso10_uni.h: iso10_uni.tbl makeuctb
-utf8_uni.h: utf8_uni.tbl makeuctb
-rfc_suni.h: rfc_suni.tbl makeuctb
-mnemonic_suni.h: mnemonic_suni.tbl makeuctb
+koi8r_uni.h: koi8r_uni.tbl makeuctb
+mac_uni.h: mac_uni.tbl makeuctb
 mnem_suni.h: mnem_suni.tbl makeuctb
+mnem2_suni.h: mnem2_suni.tbl makeuctb
+next_uni.h: next_uni.tbl makeuctb
+rfc_suni.h: rfc_suni.tbl makeuctb
+utf8_uni.h: utf8_uni.tbl makeuctb
+viscii_uni.h: viscii_uni.tbl makeuctb
 
 clean:
 	rm -f makeuctb *.o *uni.h
diff --git a/src/chrtrans/build-chrtrans.com b/src/chrtrans/build-chrtrans.com
index 5ddb2590..ef5e6f5d 100644
--- a/src/chrtrans/build-chrtrans.com
+++ b/src/chrtrans/build-chrtrans.com
@@ -78,11 +78,11 @@ $!
 $ makeuctb := $'CHRwhere'makeuctb
 $ define/user sys$output 'CHRwhere'iso01_uni.h	!ISO Latin 1
 $ makeuctb iso01_uni.tbl
-$ define/user sys$output 'CHRwhere'cp850_uni.h	! cp850
+$ define/user sys$output 'CHRwhere'cp850_uni.h	!DosLatin1 (cp850)
 $ makeuctb cp850_uni.tbl
-$ define/user sys$output 'CHRwhere'cp1252_uni.h
+$ define/user sys$output 'CHRwhere'cp1252_uni.h	!WinLatin1 (cp1252)
 $ makeuctb cp1252_uni.tbl
-$ define/user sys$output 'CHRwhere'cp437_uni.h	! cp437
+$ define/user sys$output 'CHRwhere'cp437_uni.h	!DosLatinUS (cp437)
 $ makeuctb cp437_uni.tbl
 $ define/user sys$output 'CHRwhere'dmcs_uni.h	!DEC Multinational
 $ makeuctb dmcs_uni.tbl
@@ -104,6 +104,10 @@ $ define/user sys$output 'CHRwhere'iso03_uni.h	!ISO Latin 3
 $ makeuctb iso03_uni.tbl
 $ define/user sys$output 'CHRwhere'iso04_uni.h	!ISO Latin 4
 $ makeuctb iso04_uni.tbl
+$ define/user sys$output 'CHRwhere'cp775_uni.h	!DosBlatRim (cp775)
+$ makeuctb cp775_uni.tbl
+$ define/user sys$output 'CHRwhere'cp1257_uni.h	!WinBlatRim (cp1257)
+$ makeuctb cp1257_uni.tbl
 $ define/user sys$output 'CHRwhere'iso05_uni.h	!ISO Latin 5 Cyrillic
 $ makeuctb iso05_uni.tbl
 $ define/user sys$output 'CHRwhere'cp866_uni.h	!DosCyrillic (cp866)
@@ -140,8 +144,8 @@ $ define/user sys$output 'CHRwhere'utf8_uni.h	!UNICODE UTF 8
 $ makeuctb utf8_uni.tbl
 $ define/user sys$output 'CHRwhere'rfc_suni.h	!RFC 1345 w/o Intro
 $ makeuctb rfc_suni.tbl
-$ define/user sys$output 'CHRwhere'mnemonic_suni.h !RFC 1345 Mnemonic
-$ makeuctb mnemonic_suni.tbl
+$ define/user sys$output 'CHRwhere'mnem2_suni.h !RFC 1345 Mnemonic
+$ makeuctb mnem2_suni.tbl
 $ define/user sys$output 'CHRwhere'mnem_suni.h	!(not used)
 $ makeuctb mnem_suni.tbl
 $ v1 = 'f$verify(0)'
diff --git a/src/chrtrans/cp1250_uni.tbl b/src/chrtrans/cp1250_uni.tbl
index 6f148398..0bb7202a 100644
--- a/src/chrtrans/cp1250_uni.tbl
+++ b/src/chrtrans/cp1250_uni.tbl
@@ -1,5 +1,5 @@
 #The MIME name of this charset.
-Mwindows-1250
+Mcp1250
 
 #Name as a Display Charset (used on Options screen)
 OptionName WinLatin2 (cp1250)
diff --git a/src/chrtrans/cp1251_uni.tbl b/src/chrtrans/cp1251_uni.tbl
index 21a44414..75d7fe25 100644
--- a/src/chrtrans/cp1251_uni.tbl
+++ b/src/chrtrans/cp1251_uni.tbl
@@ -1,5 +1,5 @@
 #The MIME name of this charset.
-Mwindows-1251
+Mcp1251
 
 #Name as a Display Charset (used on Options screen)
 OWinCyrillic (cp1251)
diff --git a/src/chrtrans/cp1252_uni.tbl b/src/chrtrans/cp1252_uni.tbl
index 22fa585f..ced249b0 100644
--- a/src/chrtrans/cp1252_uni.tbl
+++ b/src/chrtrans/cp1252_uni.tbl
@@ -3,7 +3,7 @@
 D0
 #
 #The MIME name of this charset. 
-Miso-8859-1-windows-3.1-latin-1
+Mcp1252
 
 #Name as a Display Charset (used on Options screen)
 O WinLatin1 (cp1252)
diff --git a/src/chrtrans/cp1257_uni.tbl b/src/chrtrans/cp1257_uni.tbl
new file mode 100644
index 00000000..03c81637
--- /dev/null
+++ b/src/chrtrans/cp1257_uni.tbl
@@ -0,0 +1,278 @@
+#The MIME name of this charset. 
+Mcp1257
+
+#Name as a Display Charset (used on Options screen)
+OWinBaltRim (cp1257)
+
+#    Name:     cp1257_WinBaltic to Unicode table
+#    Unicode version: 2.0
+#    Table version: 2.00
+#    Table format:  Format A
+#    Date:          04/24/96
+#    Authors:       Lori Brownell <loribr@microsoft.com>
+#                   K.D. Chang    <a-kchang@microsoft.com>
+#    General notes: none
+#
+#    Format: Three tab-separated columns
+#        Column #1 is the cp1257_WinBaltic code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
+#        Column #3 is the Unicode name (follows a comment sign, '#')
+#
+#    The entries are in cp1257_WinBaltic 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
+0x20	U+0020	#SPACE
+0x21	U+0021	#EXCLAMATION MARK
+0x22	U+0022	#QUOTATION MARK
+0x23	U+0023	#NUMBER SIGN
+0x24	U+0024	#DOLLAR SIGN
+0x25	U+0025	#PERCENT SIGN
+0x26	U+0026	#AMPERSAND
+0x27	U+0027	#APOSTROPHE
+0x28	U+0028	#LEFT PARENTHESIS
+0x29	U+0029	#RIGHT PARENTHESIS
+0x2A	U+002A	#ASTERISK
+0x2B	U+002B	#PLUS SIGN
+0x2C	U+002C	#COMMA
+0x2D	U+002D	#HYPHEN-MINUS
+0x2E	U+002E	#FULL STOP
+0x2F	U+002F	#SOLIDUS
+0x30	U+0030	#DIGIT 0
+0x31	U+0031	#DIGIT 1
+0x32	U+0032	#DIGIT 2
+0x33	U+0033	#DIGIT 3
+0x34	U+0034	#DIGIT 4
+0x35	U+0035	#DIGIT 5
+0x36	U+0036	#DIGIT 6
+0x37	U+0037	#DIGIT 7
+0x38	U+0038	#DIGIT 8
+0x39	U+0039	#DIGIT 9
+0x3A	U+003A	#COLON
+0x3B	U+003B	#SEMICOLON
+0x3C	U+003C	#LESS-THAN SIGN
+0x3D	U+003D	#EQUALS SIGN
+0x3E	U+003E	#GREATER-THAN SIGN
+0x3F	U+003F	#QUESTION MARK
+0x40	U+0040	#COMMERCIAL AT
+0x41	U+0041	#LATIN CAPITAL A
+0x42	U+0042	#LATIN CAPITAL B
+0x43	U+0043	#LATIN CAPITAL C
+0x44	U+0044	#LATIN CAPITAL D
+0x45	U+0045	#LATIN CAPITAL E
+0x46	U+0046	#LATIN CAPITAL F
+0x47	U+0047	#LATIN CAPITAL G
+0x48	U+0048	#LATIN CAPITAL H
+0x49	U+0049	#LATIN CAPITAL I
+0x4A	U+004A	#LATIN CAPITAL J
+0x4B	U+004B	#LATIN CAPITAL K
+0x4C	U+004C	#LATIN CAPITAL L
+0x4D	U+004D	#LATIN CAPITAL M
+0x4E	U+004E	#LATIN CAPITAL N
+0x4F	U+004F	#LATIN CAPITAL O
+0x50	U+0050	#LATIN CAPITAL P
+0x51	U+0051	#LATIN CAPITAL Q
+0x52	U+0052	#LATIN CAPITAL R
+0x53	U+0053	#LATIN CAPITAL S
+0x54	U+0054	#LATIN CAPITAL T
+0x55	U+0055	#LATIN CAPITAL U
+0x56	U+0056	#LATIN CAPITAL V
+0x57	U+0057	#LATIN CAPITAL W
+0x58	U+0058	#LATIN CAPITAL X
+0x59	U+0059	#LATIN CAPITAL Y
+0x5A	U+005A	#LATIN CAPITAL Z
+0x5B	U+005B	#LEFT SQUARE BRACKET
+0x5C	U+005C	#BACKSLASH
+0x5D	U+005D	#RIGHT SQUARE BRACKET
+0x5E	U+005E	#CIRCUMFLEX
+0x5F	U+005F	#LOW LINE
+0x60	U+0060	#GRAVE
+0x61	U+0061	#LATIN SMALL A
+0x62	U+0062	#LATIN SMALL B
+0x63	U+0063	#LATIN SMALL C
+0x64	U+0064	#LATIN SMALL D
+0x65	U+0065	#LATIN SMALL E
+0x66	U+0066	#LATIN SMALL F
+0x67	U+0067	#LATIN SMALL G
+0x68	U+0068	#LATIN SMALL H
+0x69	U+0069	#LATIN SMALL I
+0x6A	U+006A	#LATIN SMALL J
+0x6B	U+006B	#LATIN SMALL K
+0x6C	U+006C	#LATIN SMALL L
+0x6D	U+006D	#LATIN SMALL M
+0x6E	U+006E	#LATIN SMALL N
+0x6F	U+006F	#LATIN SMALL O
+0x70	U+0070	#LATIN SMALL P
+0x71	U+0071	#LATIN SMALL Q
+0x72	U+0072	#LATIN SMALL R
+0x73	U+0073	#LATIN SMALL S
+0x74	U+0074	#LATIN SMALL T
+0x75	U+0075	#LATIN SMALL U
+0x76	U+0076	#LATIN SMALL V
+0x77	U+0077	#LATIN SMALL W
+0x78	U+0078	#LATIN SMALL X
+0x79	U+0079	#LATIN SMALL Y
+0x7A	U+007A	#LATIN SMALL Z
+0x7B	U+007B	#LEFT CURLY BRACKET
+0x7C	U+007C	#VERTICAL LINE
+0x7D	U+007D	#RIGHT CURLY BRACKET
+0x7E	U+007E	#TILDE
+#0x7F	U+007F	#DELETE
+#0x80		#UNDEFINED
+#0x81		#UNDEFINED
+0x82	U+201A	#LOW SINGLE COMMA QUOTATION MARK
+#0x83		#UNDEFINED
+0x84	U+201E	#LOW DOUBLE COMMA QUOTATION MARK
+0x85	U+2026	#HORIZONTAL ELLIPSIS
+0x86	U+2020	#DAGGER
+0x87	U+2021	#DOUBLE DAGGER
+#0x88		#UNDEFINED
+0x89	U+2030	#PER MILLE SIGN
+#0x8A		#UNDEFINED
+0x8B	U+2039	#LEFT POINTING SINGLE GUILLEMENT
+#0x8C		#UNDEFINED
+0x8D	U+00A8	#DIAERESIS
+0x8E	U+02C7	#HACEK
+0x8F	U+00B8	#CEDILLA
+#0x90		#UNDEFINED
+0x91	U+2018	#LEFT SINGLE QUOTATION MARK
+0x92	U+2019	#RIGHT SINGLE QUOTATION MARK
+0x93	U+201C	#LEFT DOUBLE QUOTATION MARK
+0x94	U+201D	#RIGHT DOUBLE QUOTATION MARK
+0x95	U+2022	#BULLET
+0x96	U+2013	#EN DASH
+0x97	U+2014	#EM DASH
+#0x98		#UNDEFINED
+0x99	U+2122	#TRADE MARK SIGN
+#0x9A		#UNDEFINED
+0x9B	U+203A	#RIGHT POINTING SINGLE GUILLEMENT
+#0x9C		#UNDEFINED
+0x9D	U+00AF	#MACRON
+0x9E	U+02DB	#OGONEK
+#0x9F		#UNDEFINED
+0xA0	U+00A0	#NO-BREAK SPACE
+#0xA1		#UNDEFINED
+0xA2	U+00A2	#CENT SIGN
+0xA3	U+00A3	#POUND SIGN
+0xA4	U+00A4	#CURRENCY SIGN
+#0xA5		#UNDEFINED
+0xA6	U+00A6	#BROKEN BAR
+0xA7	U+00A7	#SECTION SIGN
+0xA8	U+00D8	#LATIN CAPITAL O STROKE
+0xA9	U+00A9	#COPYRIGHT SIGN
+0xAA	U+0156	#LATIN CAPITAL R CEDILLA
+0xAB	U+00AB	#LEFT POINTING GUILLEMENT
+0xAC	U+00AC	#NOT SIGN
+0xAD	U+00AD	#SOFT HYPHEN
+0xAE	U+00AE	#REGISTERED SIGN
+0xAF	U+00C6	#LATIN CAPITAL AE LIGATURE
+0xB0	U+00B0	#DEGREE SIGN
+0xB1	U+00B1	#PLUS-MINUS SIGN
+0xB2	U+00B2	#SUPERSCRIPT 2
+0xB3	U+00B3	#SUPERSCRIPT 3
+0xB4	U+00B4	#ACUTE
+0xB5	U+00B5	#MICRO SIGN
+0xB6	U+00B6	#PILCROW SIGN
+0xB7	U+00B7	#MIDDLE DOT
+0xB8	U+00F8	#LATIN SAMLL O STROKE
+0xB9	U+00B9	#SUPERSCRIPT ONE
+0xBA	U+0157	#LATIN SMALL R CEDILLA
+0xBB	U+00BB	#RIGHT POINTING GUILLEMENT
+0xBC	U+00BC	#FRACTION 1/4
+0xBD	U+00BD	#FRACTION 1/2
+0xBE	U+00BE	#FRACTION 3/4
+0xBF	U+00E6	#LATIN SMALL AE LIGATURE
+0xC0	U+0104	#LATIN CAPITAL A OGONEK
+0xC1	U+012E	#LATIN CAPITAL I OGONEK
+0xC2	U+0100	#LATIN CAPITAL A MACRON
+0xC3	U+0106	#LATIN CAPITAL C ACUTE
+0xC4	U+00C4	#LATIN CAPITAL A DIAERESIS
+0xC5	U+00C5	#LATIN CAPITAL A RING ABOVE
+0xC6	U+0118	#LATIN CAPITAL E OGONEK
+0xC7	U+0112	#LATIN CAPITAL E MACRON
+0xC8	U+010C	#LATIN CAPITAL C HACEK
+0xC9	U+00C9	#LATIN CAPITAL E ACUTE
+0xCA	U+0179	#LATIN CAPITAL Z ACUTE
+0xCB	U+0116	#LATIN CAPITAL E DOT ABOVE
+0xCC	U+0122	#LATIN CAPITAL G CEDILLA
+0xCD	U+0136	#LATIN CAPITAL K CEDILLA
+0xCE	U+012A	#LATIN CAPITAL I MACRON
+0xCF	U+013B	#LATIN CAPITAL L CEDILLA
+0xD0	U+0160	#LATIN CAPITAL S HACEK
+0xD1	U+0143	#LATIN CAPITAL N ACUTE
+0xD2	U+0145	#LATIN CAPITAL N CEDILLA
+0xD3	U+00D3	#LATIN CAPITAL O ACUTE
+0xD4	U+014C	#LATIN CAPITAL O MACRON
+0xD5	U+00D5	#LATIN CAPITAL O TILDE
+0xD6	U+00D6	#LATIN CAPITAL O DIAERESIS
+0xD7	U+00D7	#MULTIPLICATION SIGN
+0xD8	U+0172	#LATIN CAPITAL U OGONEK
+0xD9	U+0141	#LATIN CAPITAL L STROKE
+0xDA	U+015A	#LATIN CAPITAL S ACUTE
+0xDB	U+016A	#LATIN CAPITAL U MACRON
+0xDC	U+00DC	#LATIN CAPITAL U DIAERESIS
+0xDD	U+017B	#LATIN CAPITAL Z DOT ABOVE
+0xDE	U+017D	#LATIN CAPITAL Z HACEK
+0xDF	U+00DF	#LATIN SMALL SHARP SS
+0xE0	U+0105	#LATIN SMALL A OGONEK
+0xE1	U+012F	#LATIN SMALL I OGONEK
+0xE2	U+0101	#LATIN SMALL A MACRON
+0xE3	U+0107	#LATIN SMALL C ACUTE
+0xE4	U+00E4	#LATIN SMALL A DIAERESIS
+0xE5	U+00E5	#LATIN SMALL A RING ABOVE
+0xE6	U+0119	#LATIN SMALL E OGONEK
+0xE7	U+0113	#LATIN SMALL E MACRON
+0xE8	U+010D	#LATIN SMALL C HACEK
+0xE9	U+00E9	#LATIN SMALL E ACUTE
+0xEA	U+017A	#LATIN SMALL Z ACUTE
+0xEB	U+0117	#LATIN SMALL E DOT ABOVE
+0xEC	U+0123	#LATIN SMALL G CEDILLA
+0xED	U+0137	#LATIN SMALL K CEDILLA
+0xEE	U+012B	#LATIN SMALL I MACRON
+0xEF	U+013C	#LATIN SMALL L CEDILLA
+0xF0	U+0161	#LATIN SMALL S HACEK
+0xF1	U+0144	#LATIN SMALL N ACUTE
+0xF2	U+0146	#LATIN SMALL N CEDILLA
+0xF3	U+00F3	#LATIN SMALL O ACUTE
+0xF4	U+014D	#LATIN SMALL O MACRON
+0xF5	U+00F5	#LATIN SMALL O TILDE
+0xF6	U+00F6	#LATIN SMALL O DIAERESIS
+0xF7	U+00F7	#DIVISION SIGN
+0xF8	U+0173	#LATIN SMALL U OGONEK
+0xF9	U+0142	#LATIN SMALL L STROKE
+0xFA	U+015B	#LATIN SMALL S ACUTE
+0xFB	U+016B	#LATIN SMALL U MACRON
+0xFC	U+00FC	#LATIN SMALL U DIAERESIS
+0xFD	U+017C	#LATIN SMALL Z DOT ABOVE
+0xFE	U+017E	#LATIN SMALL Z HACEK
+0xFF	U+02D9	#DOT ABOVE
diff --git a/src/chrtrans/cp775_uni.tbl b/src/chrtrans/cp775_uni.tbl
new file mode 100644
index 00000000..7fbf3b82
--- /dev/null
+++ b/src/chrtrans/cp775_uni.tbl
@@ -0,0 +1,281 @@
+#The MIME name of this charset. 
+Mcp775
+
+#Name as a Display Charset (used on Options screen)
+ODosBaltRim (cp775)
+
+#    Name:     cp775_DOSBaltRim to Unicode table
+#    Unicode version: 2.0
+#    Table version: 2.00
+#    Table format:  Format A
+#    Date:          04/24/96
+#    Authors:       Lori Brownell <loribr@microsoft.com>
+#                   K.D. Chang    <a-kchang@microsoft.com>
+#    General notes: none
+#
+#    Format: Three tab-separated columns
+#        Column #1 is the cp775_DOSBaltRim code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
+#        Column #3 is the Unicode name (follows a comment sign, '#')
+#
+#    The entries are in cp775_DOSBaltRim 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
+0x20	U+0020	#SPACE
+0x21	U+0021	#EXCLAMATION MARK
+0x22	U+0022	#QUOTATION MARK
+0x23	U+0023	#NUMBER SIGN
+0x24	U+0024	#DOLLAR SIGN
+0x25	U+0025	#PERCENT SIGN
+0x26	U+0026	#AMPERSAND
+0x27	U+0027	#APOSTROPHE
+0x28	U+0028	#LEFT PARENTHESIS
+0x29	U+0029	#RIGHT PARENTHESIS
+0x2a	U+002a	#ASTERISK
+0x2b	U+002b	#PLUS SIGN
+0x2c	U+002c	#COMMA
+0x2d	U+002d	#HYPHEN-MINUS
+0x2e	U+002e	#FULL STOP
+0x2f	U+002f	#SOLIDUS
+0x30	U+0030	#DIGIT ZERO
+0x31	U+0031	#DIGIT ONE
+0x32	U+0032	#DIGIT TWO
+0x33	U+0033	#DIGIT THREE
+0x34	U+0034	#DIGIT FOUR
+0x35	U+0035	#DIGIT FIVE
+0x36	U+0036	#DIGIT SIX
+0x37	U+0037	#DIGIT SEVEN
+0x38	U+0038	#DIGIT EIGHT
+0x39	U+0039	#DIGIT NINE
+0x3a	U+003a	#COLON
+0x3b	U+003b	#SEMICOLON
+0x3c	U+003c	#LESS-THAN SIGN
+0x3d	U+003d	#EQUALS SIGN
+0x3e	U+003e	#GREATER-THAN SIGN
+0x3f	U+003f	#QUESTION MARK
+0x40	U+0040	#COMMERCIAL AT
+0x41	U+0041	#LATIN CAPITAL LETTER A
+0x42	U+0042	#LATIN CAPITAL LETTER B
+0x43	U+0043	#LATIN CAPITAL LETTER C
+0x44	U+0044	#LATIN CAPITAL LETTER D
+0x45	U+0045	#LATIN CAPITAL LETTER E
+0x46	U+0046	#LATIN CAPITAL LETTER F
+0x47	U+0047	#LATIN CAPITAL LETTER G
+0x48	U+0048	#LATIN CAPITAL LETTER H
+0x49	U+0049	#LATIN CAPITAL LETTER I
+0x4a	U+004a	#LATIN CAPITAL LETTER J
+0x4b	U+004b	#LATIN CAPITAL LETTER K
+0x4c	U+004c	#LATIN CAPITAL LETTER L
+0x4d	U+004d	#LATIN CAPITAL LETTER M
+0x4e	U+004e	#LATIN CAPITAL LETTER N
+0x4f	U+004f	#LATIN CAPITAL LETTER O
+0x50	U+0050	#LATIN CAPITAL LETTER P
+0x51	U+0051	#LATIN CAPITAL LETTER Q
+0x52	U+0052	#LATIN CAPITAL LETTER R
+0x53	U+0053	#LATIN CAPITAL LETTER S
+0x54	U+0054	#LATIN CAPITAL LETTER T
+0x55	U+0055	#LATIN CAPITAL LETTER U
+0x56	U+0056	#LATIN CAPITAL LETTER V
+0x57	U+0057	#LATIN CAPITAL LETTER W
+0x58	U+0058	#LATIN CAPITAL LETTER X
+0x59	U+0059	#LATIN CAPITAL LETTER Y
+0x5a	U+005a	#LATIN CAPITAL LETTER Z
+0x5b	U+005b	#LEFT SQUARE BRACKET
+0x5c	U+005c	#REVERSE SOLIDUS
+0x5d	U+005d	#RIGHT SQUARE BRACKET
+0x5e	U+005e	#CIRCUMFLEX ACCENT
+0x5f	U+005f	#LOW LINE
+0x60	U+0060	#GRAVE ACCENT
+0x61	U+0061	#LATIN SMALL LETTER A
+0x62	U+0062	#LATIN SMALL LETTER B
+0x63	U+0063	#LATIN SMALL LETTER C
+0x64	U+0064	#LATIN SMALL LETTER D
+0x65	U+0065	#LATIN SMALL LETTER E
+0x66	U+0066	#LATIN SMALL LETTER F
+0x67	U+0067	#LATIN SMALL LETTER G
+0x68	U+0068	#LATIN SMALL LETTER H
+0x69	U+0069	#LATIN SMALL LETTER I
+0x6a	U+006a	#LATIN SMALL LETTER J
+0x6b	U+006b	#LATIN SMALL LETTER K
+0x6c	U+006c	#LATIN SMALL LETTER L
+0x6d	U+006d	#LATIN SMALL LETTER M
+0x6e	U+006e	#LATIN SMALL LETTER N
+0x6f	U+006f	#LATIN SMALL LETTER O
+0x70	U+0070	#LATIN SMALL LETTER P
+0x71	U+0071	#LATIN SMALL LETTER Q
+0x72	U+0072	#LATIN SMALL LETTER R
+0x73	U+0073	#LATIN SMALL LETTER S
+0x74	U+0074	#LATIN SMALL LETTER T
+0x75	U+0075	#LATIN SMALL LETTER U
+0x76	U+0076	#LATIN SMALL LETTER V
+0x77	U+0077	#LATIN SMALL LETTER W
+0x78	U+0078	#LATIN SMALL LETTER X
+0x79	U+0079	#LATIN SMALL LETTER Y
+0x7a	U+007a	#LATIN SMALL LETTER Z
+0x7b	U+007b	#LEFT CURLY BRACKET
+0x7c	U+007c	#VERTICAL LINE
+0x7d	U+007d	#RIGHT CURLY BRACKET
+0x7e	U+007e	#TILDE
+#0x7f	U+007f	#DELETE
+0x80	U+0106	#LATIN CAPITAL LETTER C WITH ACUTE
+0x81	U+00fc	#LATIN SMALL LETTER U WITH DIAERESIS
+0x82	U+00e9	#LATIN SMALL LETTER E WITH ACUTE
+0x83	U+0101	#LATIN SMALL LETTER A WITH MACRON
+0x84	U+00e4	#LATIN SMALL LETTER A WITH DIAERESIS
+0x85	U+0123	#LATIN SMALL LETTER G WITH CEDILLA
+0x86	U+00e5	#LATIN SMALL LETTER A WITH RING ABOVE
+0x87	U+0107	#LATIN SMALL LETTER C WITH ACUTE
+0x88	U+0142	#LATIN SMALL LETTER L WITH STROKE
+0x89	U+0113	#LATIN SMALL LETTER E WITH MACRON
+0x8a	U+0156	#LATIN CAPITAL LETTER R WITH CEDILLA
+0x8b	U+0157	#LATIN SMALL LETTER R WITH CEDILLA
+0x8c	U+012b	#LATIN SMALL LETTER I WITH MACRON
+0x8d	U+0179	#LATIN CAPITAL LETTER Z WITH ACUTE
+0x8e	U+00c4	#LATIN CAPITAL LETTER A WITH DIAERESIS
+0x8f	U+00c5	#LATIN CAPITAL LETTER A WITH RING ABOVE
+0x90	U+00c9	#LATIN CAPITAL LETTER E WITH ACUTE
+0x91	U+00e6	#LATIN SMALL LIGATURE AE
+0x92	U+00c6	#LATIN CAPITAL LIGATURE AE
+0x93	U+014d	#LATIN SMALL LETTER O WITH MACRON
+0x94	U+00f6	#LATIN SMALL LETTER O WITH DIAERESIS
+0x95	U+0122	#LATIN CAPITAL LETTER G WITH CEDILLA
+0x96	U+00a2	#CENT SIGN
+0x97	U+015a	#LATIN CAPITAL LETTER S WITH ACUTE
+0x98	U+015b	#LATIN SMALL LETTER S WITH ACUTE
+0x99	U+00d6	#LATIN CAPITAL LETTER O WITH DIAERESIS
+0x9a	U+00dc	#LATIN CAPITAL LETTER U WITH DIAERESIS
+0x9b	U+00f8	#LATIN SMALL LETTER O WITH STROKE
+0x9c	U+00a3	#POUND SIGN
+0x9d	U+00d8	#LATIN CAPITAL LETTER O WITH STROKE
+0x9e	U+00d7	#MULTIPLICATION SIGN
+0x9f	U+00a4	#CURRENCY SIGN
+0xa0	U+0100	#LATIN CAPITAL LETTER A WITH MACRON
+0xa1	U+012a	#LATIN CAPITAL LETTER I WITH MACRON
+0xa2	U+00f3	#LATIN SMALL LETTER O WITH ACUTE
+0xa3	U+017b	#LATIN CAPITAL LETTER Z WITH DOT ABOVE
+0xa4	U+017c	#LATIN SMALL LETTER Z WITH DOT ABOVE
+0xa5	U+017a	#LATIN SMALL LETTER Z WITH ACUTE
+0xa6	U+201d	#RIGHT DOUBLE QUOTATION MARK
+0xa7	U+00a6	#BROKEN BAR
+0xa8	U+00a9	#COPYRIGHT SIGN
+0xa9	U+00ae	#REGISTERED SIGN
+0xaa	U+00ac	#NOT SIGN
+0xab	U+00bd	#VULGAR FRACTION ONE HALF
+0xac	U+00bc	#VULGAR FRACTION ONE QUARTER
+0xad	U+0141	#LATIN CAPITAL LETTER L WITH STROKE
+0xae	U+00ab	#LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xaf	U+00bb	#RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xb0	U+2591	#LIGHT SHADE
+0xb1	U+2592	#MEDIUM SHADE
+0xb2	U+2593	#DARK SHADE
+0xb3	U+2502	#BOX DRAWINGS LIGHT VERTICAL
+0xb4	U+2524	#BOX DRAWINGS LIGHT VERTICAL AND LEFT
+0xb5	U+0104	#LATIN CAPITAL LETTER A WITH OGONEK
+0xb6	U+010c	#LATIN CAPITAL LETTER C WITH CARON
+0xb7	U+0118	#LATIN CAPITAL LETTER E WITH OGONEK
+0xb8	U+0116	#LATIN CAPITAL LETTER E WITH DOT ABOVE
+0xb9	U+2563	#BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+0xba	U+2551	#BOX DRAWINGS DOUBLE VERTICAL
+0xbb	U+2557	#BOX DRAWINGS DOUBLE DOWN AND LEFT
+0xbc	U+255d	#BOX DRAWINGS DOUBLE UP AND LEFT
+0xbd	U+012e	#LATIN CAPITAL LETTER I WITH OGONEK
+0xbe	U+0160	#LATIN CAPITAL LETTER S WITH CARON
+0xbf	U+2510	#BOX DRAWINGS LIGHT DOWN AND LEFT
+0xc0	U+2514	#BOX DRAWINGS LIGHT UP AND RIGHT
+0xc1	U+2534	#BOX DRAWINGS LIGHT UP AND HORIZONTAL
+0xc2	U+252c	#BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+0xc3	U+251c	#BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+0xc4	U+2500	#BOX DRAWINGS LIGHT HORIZONTAL
+0xc5	U+253c	#BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+0xc6	U+0172	#LATIN CAPITAL LETTER U WITH OGONEK
+0xc7	U+016a	#LATIN CAPITAL LETTER U WITH MACRON
+0xc8	U+255a	#BOX DRAWINGS DOUBLE UP AND RIGHT
+0xc9	U+2554	#BOX DRAWINGS DOUBLE DOWN AND RIGHT
+0xca	U+2569	#BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+0xcb	U+2566	#BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+0xcc	U+2560	#BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+0xcd	U+2550	#BOX DRAWINGS DOUBLE HORIZONTAL
+0xce	U+256c	#BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+0xcf	U+017d	#LATIN CAPITAL LETTER Z WITH CARON
+0xd0	U+0105	#LATIN SMALL LETTER A WITH OGONEK
+0xd1	U+010d	#LATIN SMALL LETTER C WITH CARON
+0xd2	U+0119	#LATIN SMALL LETTER E WITH OGONEK
+0xd3	U+0117	#LATIN SMALL LETTER E WITH DOT ABOVE
+0xd4	U+012f	#LATIN SMALL LETTER I WITH OGONEK
+0xd5	U+0161	#LATIN SMALL LETTER S WITH CARON
+0xd6	U+0173	#LATIN SMALL LETTER U WITH OGONEK
+0xd7	U+016b	#LATIN SMALL LETTER U WITH MACRON
+0xd8	U+017e	#LATIN SMALL LETTER Z WITH CARON
+0xd9	U+2518	#BOX DRAWINGS LIGHT UP AND LEFT
+0xda	U+250c	#BOX DRAWINGS LIGHT DOWN AND RIGHT
+0xdb	U+2588	#FULL BLOCK
+0xdc	U+2584	#LOWER HALF BLOCK
+0xdd	U+258c	#LEFT HALF BLOCK
+0xde	U+2590	#RIGHT HALF BLOCK
+0xdf	U+2580	#UPPER HALF BLOCK
+0xe0	U+00d3	#LATIN CAPITAL LETTER O WITH ACUTE
+0xe1	U+00df	#LATIN SMALL LETTER SHARP S (GERMAN)
+0xe2	U+014c	#LATIN CAPITAL LETTER O WITH MACRON
+0xe3	U+0143	#LATIN CAPITAL LETTER N WITH ACUTE
+0xe4	U+00f5	#LATIN SMALL LETTER O WITH TILDE
+0xe5	U+00d5	#LATIN CAPITAL LETTER O WITH TILDE
+0xe6	U+00b5	#MICRO SIGN
+0xe7	U+0144	#LATIN SMALL LETTER N WITH ACUTE
+0xe8	U+0136	#LATIN CAPITAL LETTER K WITH CEDILLA
+0xe9	U+0137	#LATIN SMALL LETTER K WITH CEDILLA
+0xea	U+013b	#LATIN CAPITAL LETTER L WITH CEDILLA
+0xeb	U+013c	#LATIN SMALL LETTER L WITH CEDILLA
+0xec	U+0146	#LATIN SMALL LETTER N WITH CEDILLA
+0xed	U+0112	#LATIN CAPITAL LETTER E WITH MACRON
+0xee	U+0145	#LATIN CAPITAL LETTER N WITH CEDILLA
+0xef	U+2019	#RIGHT SINGLE QUOTATION MARK
+0xf0	U+00ad	#SOFT HYPHEN
+0xf1	U+00b1	#PLUS-MINUS SIGN
+0xf2	U+201c	#LEFT DOUBLE QUOTATION MARK
+0xf3	U+00be	#VULGAR FRACTION THREE QUARTERS
+0xf4	U+00b6	#PILCROW SIGN
+0xf5	U+00a7	#SECTION SIGN
+0xf6	U+00f7	#DIVISION SIGN
+0xf7	U+201e	#DOUBLE LOW-9 QUOTATION MARK
+0xf8	U+00b0	#DEGREE SIGN
+0xf9	U+2219	#BULLET OPERATOR
+0xfa	U+00b7	#MIDDLE DOT
+0xfb	U+00b9	#SUPERSCRIPT ONE
+0xfc	U+00b3	#SUPERSCRIPT THREE
+0xfd	U+00b2	#SUPERSCRIPT TWO
+0xfe	U+25a0	#BLACK SQUARE
+0xff	U+00a0	#NO-BREAK SPACE
+
+# TRADE MARK SIGN:
+U+2122:(TM)
diff --git a/src/chrtrans/makefile.dos b/src/chrtrans/makefile.dos
index deb0987c..629f6a2f 100644
--- a/src/chrtrans/makefile.dos
+++ b/src/chrtrans/makefile.dos
@@ -23,42 +23,43 @@ MCFLAGS = -O3 -DEXP_CHARTRANS -DDOSPATH -DNO_TTYTYP \
 
 FONTMAP_INC = iso01_un.h
 
-CHRTR=
-
-TABLES= $(CHRTR)iso01_uni.h \
- $(CHRTR)def7_uni.h \
- $(CHRTR)iso02_uni.h \
- $(CHRTR)cp1252_uni.h \
- $(CHRTR)dmcs_uni.h \
- $(CHRTR)mac_uni.h \
- $(CHRTR)next_uni.h \
- $(CHRTR)koi8r_uni.h \
- $(CHRTR)viscii_uni.h \
- $(CHRTR)cp437_uni.h \
- $(CHRTR)cp850_uni.h \
- $(CHRTR)cp852_uni.h \
- $(CHRTR)cp866_uni.h \
- $(CHRTR)cp737_uni.h \
- $(CHRTR)cp869_uni.h \
- $(CHRTR)cp864_uni.h \
- $(CHRTR)cp862_uni.h \
- $(CHRTR)cp1250_uni.h \
- $(CHRTR)cp1251_uni.h \
- $(CHRTR)cp1253_uni.h \
- $(CHRTR)cp1255_uni.h \
- $(CHRTR)cp1256_uni.h \
- $(CHRTR)iso03_uni.h \
- $(CHRTR)iso04_uni.h \
- $(CHRTR)iso05_uni.h \
- $(CHRTR)iso06_uni.h \
- $(CHRTR)iso07_uni.h \
- $(CHRTR)iso08_uni.h \
- $(CHRTR)iso09_uni.h \
- $(CHRTR)iso10_uni.h \
- $(CHRTR)utf8_uni.h \
- $(CHRTR)rfc_suni.h \
- $(CHRTR)mnemonic_suni.h \
- $(CHRTR)mnem_suni.h
+TABLES= \
+ cp1250_uni.h \
+ cp1251_uni.h \
+ cp1252_uni.h \
+ cp1253_uni.h \
+ cp1255_uni.h \
+ cp1256_uni.h \
+ cp1257_uni.h \
+ cp437_uni.h \
+ cp737_uni.h \
+ cp775_uni.h \
+ cp850_uni.h \
+ cp852_uni.h \
+ cp862_uni.h \
+ cp864_uni.h \
+ cp866_uni.h \
+ cp869_uni.h \
+ def7_uni.h \
+ dmcs_uni.h \
+ iso01_uni.h \
+ iso02_uni.h \
+ iso03_uni.h \
+ iso04_uni.h \
+ iso05_uni.h \
+ iso06_uni.h \
+ iso07_uni.h \
+ iso08_uni.h \
+ iso09_uni.h \
+ iso10_uni.h \
+ koi8r_uni.h \
+ mac_uni.h \
+ mnem_suni.h \
+ mnem2_suni.h \
+ next_uni.h \
+ rfc_suni.h \
+ utf8_uni.h \
+ viscii_uni.h
 
 default: $(TABLES)
 
@@ -71,28 +72,25 @@ makeuctb.exe: makeuctb.c UCkd.h
 .tbl.h:
 	./makeuctb $*.tbl > $@
 
-def7_uni.h:		def7_uni.tbl		makeuctb.exe
-iso01_uni.h:		iso01_uni.tbl		makeuctb.exe
-iso02_uni.h:		iso02_uni.tbl		makeuctb.exe
+cp1250_uni.h:		cp1250_uni.tbl		makeuctb.exe
+cp1251_uni.h:		cp1251_uni.tbl		makeuctb.exe
 cp1252_uni.h:		cp1252_uni.tbl		makeuctb.exe
-dmcs_uni.h:		dmcs_uni.tbl		makeuctb.exe
-mac_uni.h:		mac_uni.tbl		makeuctb.exe
-next_uni.h:		next_uni.tbl		makeuctb.exe
-koi8r_uni.h:		koi8r_uni.tbl		makeuctb.exe
-viscii_uni.h:		viscii_uni.tbl		makeuctb.exe
+cp1253_uni.h:		cp1253_uni.tbl		makeuctb.exe
+cp1255_uni.h:		cp1255_uni.tbl		makeuctb.exe
+cp1256_uni.h:		cp1256_uni.tbl		makeuctb.exe
+cp1257_uni.h:		cp1257_uni.tbl		makeuctb.exe
 cp437_uni.h:		cp437_uni.tbl		makeuctb.exe
+cp737_uni.h:		cp737_uni.tbl		makeuctb.exe
 cp850_uni.h:		cp850_uni.tbl		makeuctb.exe
 cp852_uni.h:		cp852_uni.tbl		makeuctb.exe
+cp862_uni.h:		cp862_uni.tbl		makeuctb.exe
+cp864_uni.h:		cp864_uni.tbl		makeuctb.exe
 cp866_uni.h:		cp866_uni.tbl		makeuctb.exe
-cp737_uni.h:		cp737_uni.tbl		makeuctb.exe
 cp869_uni.h:		cp869_uni.tbl		makeuctb.exe
-cp864_uni.h:		cp864_uni.tbl		makeuctb.exe
-cp862_uni.h:		cp862_uni.tbl		makeuctb.exe
-cp1250_uni.h:		cp1250_uni.tbl		makeuctb.exe
-cp1251_uni.h:		cp1251_uni.tbl		makeuctb.exe
-cp1253_uni.h:		cp1253_uni.tbl		makeuctb.exe
-cp1255_uni.h:		cp1255_uni.tbl		makeuctb.exe
-cp1256_uni.h:		cp1256_uni.tbl		makeuctb.exe
+def7_uni.h:		def7_uni.tbl		makeuctb.exe
+dmcs_uni.h:		dmcs_uni.tbl		makeuctb.exe
+iso01_uni.h:		iso01_uni.tbl		makeuctb.exe
+iso02_uni.h:		iso02_uni.tbl		makeuctb.exe
 iso03_uni.h:		iso03_uni.tbl		makeuctb.exe
 iso04_uni.h:		iso04_uni.tbl		makeuctb.exe
 iso05_uni.h:		iso05_uni.tbl		makeuctb.exe
@@ -101,10 +99,14 @@ iso07_uni.h:		iso07_uni.tbl		makeuctb.exe
 iso08_uni.h:		iso08_uni.tbl		makeuctb.exe
 iso09_uni.h:		iso09_uni.tbl		makeuctb.exe
 iso10_uni.h:		iso10_uni.tbl		makeuctb.exe
-utf8_uni.h:		utf8_uni.tbl		makeuctb.exe
-mnemonic_suni.h:	mnemonic_suni.tbl	makeuctb.exe
+koi8r_uni.h:		koi8r_uni.tbl		makeuctb.exe
+mac_uni.h:		mac_uni.tbl		makeuctb.exe
 mnem_suni.h:		mnem_suni.tbl		makeuctb.exe
+mnem2_suni.h:		mnem2_suni.tbl		makeuctb.exe
+next_uni.h:		next_uni.tbl		makeuctb.exe
 rfc_suni.h:		rfc_suni.tbl		makeuctb.exe
+utf8_uni.h:		utf8_uni.tbl		makeuctb.exe
+viscii_uni.h:		viscii_uni.tbl		makeuctb.exe
 
 clean:
 	rm -f makeuctb.exe makeuctb *.o *un.h *u.h *c.h *i.h
diff --git a/src/chrtrans/makefile.in b/src/chrtrans/makefile.in
index cbb21618..0a64fd44 100644
--- a/src/chrtrans/makefile.in
+++ b/src/chrtrans/makefile.in
@@ -32,46 +32,45 @@ CC_OPTS		= $(CPP_OPTS) $(CFLAGS)
 
 FONTMAP_INC = iso01_uni.h# default, if not set by recursive call
 
-### #include $(TOPDIR)/Rules.make ???
-
 ### fastdep: $(FONTMAP_INC)
 
-CHRTR=
-
-TABLES= $(CHRTR)iso01_uni.h \
- $(CHRTR)def7_uni.h \
- $(CHRTR)iso02_uni.h \
- $(CHRTR)cp1252_uni.h \
- $(CHRTR)dmcs_uni.h \
- $(CHRTR)mac_uni.h \
- $(CHRTR)next_uni.h \
- $(CHRTR)koi8r_uni.h \
- $(CHRTR)viscii_uni.h \
- $(CHRTR)cp437_uni.h \
- $(CHRTR)cp850_uni.h \
- $(CHRTR)cp852_uni.h \
- $(CHRTR)cp866_uni.h \
- $(CHRTR)cp737_uni.h \
- $(CHRTR)cp869_uni.h \
- $(CHRTR)cp864_uni.h \
- $(CHRTR)cp862_uni.h \
- $(CHRTR)cp1250_uni.h \
- $(CHRTR)cp1251_uni.h \
- $(CHRTR)cp1253_uni.h \
- $(CHRTR)cp1255_uni.h \
- $(CHRTR)cp1256_uni.h \
- $(CHRTR)iso03_uni.h \
- $(CHRTR)iso04_uni.h \
- $(CHRTR)iso05_uni.h \
- $(CHRTR)iso06_uni.h \
- $(CHRTR)iso07_uni.h \
- $(CHRTR)iso08_uni.h \
- $(CHRTR)iso09_uni.h \
- $(CHRTR)iso10_uni.h \
- $(CHRTR)utf8_uni.h \
- $(CHRTR)rfc_suni.h \
- $(CHRTR)mnemonic_suni.h \
- $(CHRTR)mnem_suni.h
+TABLES= \
+ cp1250_uni.h \
+ cp1251_uni.h \
+ cp1252_uni.h \
+ cp1253_uni.h \
+ cp1255_uni.h \
+ cp1256_uni.h \
+ cp1257_uni.h \
+ cp437_uni.h \
+ cp737_uni.h \
+ cp775_uni.h \
+ cp850_uni.h \
+ cp852_uni.h \
+ cp862_uni.h \
+ cp864_uni.h \
+ cp866_uni.h \
+ cp869_uni.h \
+ def7_uni.h \
+ dmcs_uni.h \
+ iso01_uni.h \
+ iso02_uni.h \
+ iso03_uni.h \
+ iso04_uni.h \
+ iso05_uni.h \
+ iso06_uni.h \
+ iso07_uni.h \
+ iso08_uni.h \
+ iso09_uni.h \
+ iso10_uni.h \
+ koi8r_uni.h \
+ mac_uni.h \
+ mnem_suni.h \
+ mnem2_suni.h \
+ next_uni.h \
+ rfc_suni.h \
+ utf8_uni.h \
+ viscii_uni.h
 
 default: $(FONTMAP_INC)
 
@@ -97,28 +96,25 @@ 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.
-def7_uni.h:		$(srcdir)/def7_uni.tbl		makeuctb
-iso01_uni.h:		$(srcdir)/iso01_uni.tbl		makeuctb
-iso02_uni.h:		$(srcdir)/iso02_uni.tbl		makeuctb
+cp1250_uni.h:		$(srcdir)/cp1250_uni.tbl	makeuctb
+cp1251_uni.h:		$(srcdir)/cp1251_uni.tbl	makeuctb
 cp1252_uni.h:		$(srcdir)/cp1252_uni.tbl	makeuctb
-dmcs_uni.h:		$(srcdir)/dmcs_uni.tbl		makeuctb
-mac_uni.h:		$(srcdir)/mac_uni.tbl		makeuctb
-next_uni.h:		$(srcdir)/next_uni.tbl		makeuctb
-koi8r_uni.h:		$(srcdir)/koi8r_uni.tbl		makeuctb
-viscii_uni.h:		$(srcdir)/viscii_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
-cp737_uni.h:		$(srcdir)/cp737_uni.tbl		makeuctb
 cp869_uni.h:		$(srcdir)/cp869_uni.tbl		makeuctb
-cp864_uni.h:		$(srcdir)/cp864_uni.tbl		makeuctb
-cp862_uni.h:		$(srcdir)/cp862_uni.tbl		makeuctb
-cp1250_uni.h:		$(srcdir)/cp1250_uni.tbl	makeuctb
-cp1251_uni.h:		$(srcdir)/cp1251_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
+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
@@ -127,13 +123,17 @@ 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
-utf8_uni.h:		$(srcdir)/utf8_uni.tbl		makeuctb
-mnemonic_suni.h:	$(srcdir)/mnemonic_suni.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
 
 clean:
-	rm -f makeuctb *.o *uni.h
+	rm -f makeuctb *.o *uni.h *uni2.h
 
 distclean: clean
 	-rm -rf obsolete
diff --git a/src/chrtrans/mnem2_suni.tbl b/src/chrtrans/mnem2_suni.tbl
new file mode 100644
index 00000000..283ce2bd
--- /dev/null
+++ b/src/chrtrans/mnem2_suni.tbl
@@ -0,0 +1,1903 @@
+#The MIME name of this charset. 
+# (this file was renamed from mnemonic_suni.tbl)
+M mnemonic
+
+#Name as a Display Charset (used on Options screen)
+O RFC 1345 Mnemonic
+
+# Don't fall back to default table for unicode -> 8bit
+Fallback NO
+ 
+# U+0020:&SP
+U+0021:!
+U+0022:"
+U+0023:&Nb
+U+0024:&DO
+U+0025:%
+U+0026:&&
+U+0027:'
+U+0028:(
+U+0029:)
+U+002a:*
+U+002b:+
+U+002c:,
+U+002d:-
+U+002e:.
+U+002f:/
+U+0030:0
+U+0031:1
+U+0032:2
+U+0033:3
+U+0034:4
+U+0035:5
+U+0036:6
+U+0037:7
+U+0038:8
+U+0039:9
+U+003a::
+U+003b:;
+U+003c:<
+U+003d:=
+U+003e:>
+U+003f:?
+U+0040:&At
+U+0041:A
+U+0042:B
+U+0043:C
+U+0044:D
+U+0045:E
+U+0046:F
+U+0047:G
+U+0048:H
+U+0049:I
+U+004a:J
+U+004b:K
+U+004c:L
+U+004d:M
+U+004e:N
+U+004f:O
+U+0050:P
+U+0051:Q
+U+0052:R
+U+0053:S
+U+0054:T
+U+0055:U
+U+0056:V
+U+0057:W
+U+0058:X
+U+0059:Y
+U+005a:Z
+U+005b:&<(
+U+005c:&//
+U+005d:&)>
+U+005e:&'>
+U+005f:_
+U+0060:&'!
+U+0061:a
+U+0062:b
+U+0063:c
+U+0064:d
+U+0065:e
+U+0066:f
+U+0067:g
+U+0068:h
+U+0069:i
+U+006a:j
+U+006b:k
+U+006c:l
+U+006d:m
+U+006e:n
+U+006f:o
+U+0070:p
+U+0071:q
+U+0072:r
+U+0073:s
+U+0074:t
+U+0075:u
+U+0076:v
+U+0077:w
+U+0078:x
+U+0079:y
+U+007a:z
+U+007b:&(!
+U+007c:&!!
+U+007d:&!)
+U+007e:&'?
+U+00a0:&NS
+U+00a1:&!I
+U+00a2:&Ct
+U+00a3:&Pd
+U+00a4:&Cu
+U+00a5:&Ye
+U+00a6:&BB
+U+00a7:&SE
+U+00a8:&':
+U+00a9:&Co
+U+00aa:&-a
+U+00ab:&<<
+U+00ac:&NO
+U+00ad:&--
+U+00ae:&Rg
+U+00af:&'m
+U+00b0:&DG
+U+00b1:&+-
+U+00b2:&2S
+U+00b3:&3S
+U+00b4:&''
+U+00b5:&My
+U+00b6:&PI
+U+00b7:&.M
+U+00b8:&',
+U+00b9:&1S
+U+00ba:&-o
+U+00bb:&>>
+U+00bc:&14
+U+00bd:&12
+U+00be:&34
+U+00bf:&?I
+U+00c0:&A!
+U+00c1:&A'
+U+00c2:&A>
+U+00c3:&A?
+U+00c4:&A:
+U+00c5:&AA
+U+00c6:&AE
+U+00c7:&C,
+U+00c8:&E!
+U+00c9:&E'
+U+00ca:&E>
+U+00cb:&E:
+U+00cc:&I!
+U+00cd:&I'
+U+00ce:&I>
+U+00cf:&I:
+U+00d0:&D-
+U+00d1:&N?
+U+00d2:&O!
+U+00d3:&O'
+U+00d4:&O>
+U+00d5:&O?
+U+00d6:&O:
+U+00d7:&*X
+U+00d8:&O/
+U+00d9:&U!
+U+00da:&U'
+U+00db:&U>
+U+00dc:&U:
+U+00dd:&Y'
+U+00de:&TH
+U+00df:&ss
+U+00e0:&a!
+U+00e1:&a'
+U+00e2:&a>
+U+00e3:&a?
+U+00e4:&a:
+U+00e5:&aa
+U+00e6:&ae
+U+00e7:&c,
+U+00e8:&e!
+U+00e9:&e'
+U+00ea:&e>
+U+00eb:&e:
+U+00ec:&i!
+U+00ed:&i'
+U+00ee:&i>
+U+00ef:&i:
+U+00f0:&d-
+U+00f1:&n?
+U+00f2:&o!
+U+00f3:&o'
+U+00f4:&o>
+U+00f5:&o?
+U+00f6:&o:
+U+00f7:&-:
+U+00f8:&o/
+U+00f9:&u!
+U+00fa:&u'
+U+00fb:&u>
+U+00fc:&u:
+U+00fd:&y'
+U+00fe:&th
+U+00ff:&y:
+U+0100:&A-
+U+0101:&a-
+U+0102:&A(
+U+0103:&a(
+U+0104:&A;
+U+0105:&a;
+U+0106:&C'
+U+0107:&c'
+U+0108:&C>
+U+0109:&c>
+U+010a:&C.
+U+010b:&c.
+U+010c:&C<
+U+010d:&c<
+U+010e:&D<
+U+010f:&d<
+U+0110:&D/
+U+0111:&d/
+U+0112:&E-
+U+0113:&e-
+U+0114:&E(
+U+0115:&e(
+U+0116:&E.
+U+0117:&e.
+U+0118:&E;
+U+0119:&e;
+U+011a:&E<
+U+011b:&e<
+U+011c:&G>
+U+011d:&g>
+U+011e:&G(
+U+011f:&g(
+U+0120:&G.
+U+0121:&g.
+U+0122:&G,
+U+0123:&g,
+U+0124:&H>
+U+0125:&h>
+U+0126:&H/
+U+0127:&h/
+U+0128:&I?
+U+0129:&i?
+U+012a:&I-
+U+012b:&i-
+U+012c:&I(
+U+012d:&i(
+U+012e:&I;
+U+012f:&i;
+U+0130:&I.
+U+0131:&i.
+U+0132:&IJ
+U+0133:&ij
+U+0134:&J>
+U+0135:&j>
+U+0136:&K,
+U+0137:&k,
+U+0138:&kk
+U+0139:&L'
+U+013a:&l'
+U+013b:&L,
+U+013c:&l,
+U+013d:&L<
+U+013e:&l<
+U+013f:&L.
+U+0140:&l.
+U+0141:&L/
+U+0142:&l/
+U+0143:&N'
+U+0144:&n'
+U+0145:&N,
+U+0146:&n,
+U+0147:&N<
+U+0148:&n<
+U+0149:&'n
+U+014a:&NG
+U+014b:&ng
+U+014c:&O-
+U+014d:&o-
+U+014e:&O(
+U+014f:&o(
+U+0150:&O"
+U+0151:&o"
+U+0152:&OE
+U+0153:&oe
+U+0154:&R'
+U+0155:&r'
+U+0156:&R,
+U+0157:&r,
+U+0158:&R<
+U+0159:&r<
+U+015a:&S'
+U+015b:&s'
+U+015c:&S>
+U+015d:&s>
+U+015e:&S,
+U+015f:&s,
+U+0160:&S<
+U+0161:&s<
+U+0162:&T,
+U+0163:&t,
+U+0164:&T<
+U+0165:&t<
+U+0166:&T/
+U+0167:&t/
+U+0168:&U?
+U+0169:&u?
+U+016a:&U-
+U+016b:&u-
+U+016c:&U(
+U+016d:&u(
+U+016e:&U0
+U+016f:&u0
+U+0170:&U"
+U+0171:&u"
+U+0172:&U;
+U+0173:&u;
+U+0174:&W>
+U+0175:&w>
+U+0176:&Y>
+U+0177:&y>
+U+0178:&Y:
+U+0179:&Z'
+U+017a:&z'
+U+017b:&Z.
+U+017c:&z.
+U+017d:&Z<
+U+017e:&z<
+U+01a0:&O9
+U+01a1:&o9
+U+01a2:&OI
+U+01a3:&oi
+U+01a6:&yr
+U+01af:&U9
+U+01b0:&u9
+U+01b5:&Z/
+U+01b6:&z/
+U+01b7:&ED
+U+01cd:&A<
+U+01ce:&a<
+U+01cf:&I<
+U+01d0:&i<
+U+01d1:&O<
+U+01d2:&o<
+U+01d3:&U<
+U+01d4:&u<
+U+01d5:&_U:-_
+U+01d6:&_u:-_
+U+01d7:&_U:'_
+U+01d8:&_u:'_
+U+01d9:&_U:<_
+U+01da:&_u:<_
+U+01db:&_U:!_
+U+01dc:&_u:!_
+U+01de:&A1
+U+01df:&a1
+U+01e0:&A7
+U+01e1:&a7
+U+01e2:&A3
+U+01e3:&a3
+U+01e4:&G/
+U+01e5:&g/
+U+01e6:&G<
+U+01e7:&g<
+U+01e8:&K<
+U+01e9:&k<
+U+01ea:&O;
+U+01eb:&o;
+U+01ec:&O1
+U+01ed:&o1
+U+01ee:&EZ
+U+01ef:&ez
+U+01f0:&j<
+U+01f4:&G'
+U+01f5:&g'
+U+01fa:&_AA'_
+U+01fb:&_aa'_
+U+01fc:&_AE'_
+U+01fd:&_ae'_
+U+01fe:&_O/'_
+U+01ff:&_o/'_
+U+02bf:&;S
+U+02c7:&'<
+U+02d8:&'(
+U+02d9:&'.
+U+02da:&'0
+U+02db:&';
+U+02dd:&'"
+U+0386:&A%
+U+0388:&E%
+U+0389:&Y%
+U+038a:&I%
+U+038c:&O%
+U+038e:&U%
+U+038f:&W%
+U+0390:&i3
+U+0391:&A*
+U+0392:&B*
+U+0393:&G*
+U+0394:&D*
+U+0395:&E*
+U+0396:&Z*
+U+0397:&Y*
+U+0398:&H*
+U+0399:&I*
+U+039a:&K*
+U+039b:&L*
+U+039c:&M*
+U+039d:&N*
+U+039e:&C*
+U+039f:&O*
+U+03a0:&P*
+U+03a1:&R*
+U+03a3:&S*
+U+03a4:&T*
+U+03a5:&U*
+U+03a6:&F*
+U+03a7:&X*
+U+03a8:&Q*
+U+03a9:&W*
+U+03aa:&J*
+U+03ab:&V*
+U+03ac:&a%
+U+03ad:&e%
+U+03ae:&y%
+U+03af:&i%
+U+03b0:&u3
+U+03b1:&a*
+U+03b2:&b*
+U+03b3:&g*
+U+03b4:&d*
+U+03b5:&e*
+U+03b6:&z*
+U+03b7:&y*
+U+03b8:&h*
+U+03b9:&i*
+U+03ba:&k*
+U+03bb:&l*
+U+03bc:&m*
+U+03bd:&n*
+U+03be:&c*
+U+03bf:&o*
+U+03c0:&p*
+U+03c1:&r*
+U+03c2:&*s
+U+03c3:&s*
+U+03c4:&t*
+U+03c5:&u*
+U+03c6:&f*
+U+03c7:&x*
+U+03c8:&q*
+U+03c9:&w*
+U+03ca:&j*
+U+03cb:&v*
+U+03cc:&o%
+U+03cd:&u%
+U+03ce:&w%
+U+03d8:&'G
+U+03d9:&,G
+U+03da:&T3
+U+03db:&t3
+U+03dc:&M3
+U+03dd:&m3
+U+03de:&K3
+U+03df:&k3
+U+03e0:&P3
+U+03e1:&p3
+U+03f4:&'%
+U+03f5:&j3
+U+0401:&IO
+U+0402:&D%
+U+0403:&G%
+U+0404:&IE
+U+0405:&DS
+U+0406:&II
+U+0407:&YI
+U+0408:&J%
+U+0409:&LJ
+U+040a:&NJ
+U+040b:&Ts
+U+040c:&KJ
+U+040e:&V%
+U+040f:&DZ
+U+0410:&A=
+U+0411:&B=
+U+0412:&V=
+U+0413:&G=
+U+0414:&D=
+U+0415:&E=
+U+0416:&Z%
+U+0417:&Z=
+U+0418:&I=
+U+0419:&J=
+U+041a:&K=
+U+041b:&L=
+U+041c:&M=
+U+041d:&N=
+U+041e:&O=
+U+041f:&P=
+U+0420:&R=
+U+0421:&S=
+U+0422:&T=
+U+0423:&U=
+U+0424:&F=
+U+0425:&H=
+U+0426:&C=
+U+0427:&C%
+U+0428:&S%
+U+0429:&Sc
+U+042a:&="
+U+042b:&Y=
+U+042c:&%"
+U+042d:&JE
+U+042e:&JU
+U+042f:&JA
+U+0430:&a=
+U+0431:&b=
+U+0432:&v=
+U+0433:&g=
+U+0434:&d=
+U+0435:&e=
+U+0436:&z%
+U+0437:&z=
+U+0438:&i=
+U+0439:&j=
+U+043a:&k=
+U+043b:&l=
+U+043c:&m=
+U+043d:&n=
+U+043e:&o=
+U+043f:&p=
+U+0440:&r=
+U+0441:&s=
+U+0442:&t=
+U+0443:&u=
+U+0444:&f=
+U+0445:&h=
+U+0446:&c=
+U+0447:&c%
+U+0448:&s%
+U+0449:&sc
+U+044a:&='
+U+044b:&y=
+U+044c:&%'
+U+044d:&je
+U+044e:&ju
+U+044f:&ja
+U+0451:&io
+U+0452:&d%
+U+0453:&g%
+U+0454:&ie
+U+0455:&ds
+U+0456:&ii
+U+0457:&yi
+U+0458:&j%
+U+0459:&lj
+U+045a:&nj
+U+045b:&ts
+U+045c:&kj
+U+045e:&v%
+U+045f:&dz
+U+0462:&Y3
+U+0463:&y3
+U+046a:&O3
+U+046b:&o3
+U+0472:&F3
+U+0473:&f3
+U+0474:&V3
+U+0475:&v3
+U+0480:&C3
+U+0481:&c3
+U+0490:&G3
+U+0491:&g3
+U+05d0:&A+
+U+05d1:&B+
+U+05d2:&G+
+U+05d3:&D+
+U+05d4:&H+
+U+05d5:&W+
+U+05d6:&Z+
+U+05d7:&X+
+U+05d8:&Tj
+U+05d9:&J+
+U+05da:&K%
+U+05db:&K+
+U+05dc:&L+
+U+05dd:&M%
+U+05de:&M+
+U+05df:&N%
+U+05e0:&N+
+U+05e1:&S+
+U+05e2:&E+
+U+05e3:&P%
+U+05e4:&P+
+U+05e5:&Zj
+U+05e6:&ZJ
+U+05e7:&Q+
+U+05e8:&R+
+U+05e9:&Sh
+U+05ea:&T+
+U+060c:&,+
+U+061b:&;+
+U+061f:&?+
+U+0621:&H'
+U+0622:&aM
+U+0623:&aH
+U+0624:&wH
+U+0625:&ah
+U+0626:&yH
+U+0627:&a+
+U+0628:&b+
+U+0629:&tm
+U+062a:&t+
+U+062b:&tk
+U+062c:&g+
+U+062d:&hk
+U+062e:&x+
+U+062f:&d+
+U+0630:&dk
+U+0631:&r+
+U+0632:&z+
+U+0633:&s+
+U+0634:&sn
+U+0635:&c+
+U+0636:&dd
+U+0637:&tj
+U+0638:&zH
+U+0639:&e+
+U+063a:&i+
+U+0640:&++
+U+0641:&f+
+U+0642:&q+
+U+0643:&k+
+U+0644:&l+
+U+0645:&m+
+U+0646:&n+
+U+0647:&h+
+U+0648:&w+
+U+0649:&j+
+U+064a:&y+
+U+064b:&:+
+U+064c:&"+
+U+064d:&=+
+U+064e:&/+
+U+064f:&'+
+U+0650:&1+
+U+0651:&3+
+U+0652:&0+
+U+0670:&aS
+U+067e:&p+
+U+06a4:&v+
+U+06af:&gf
+U+06f0:&0a
+U+06f1:&1a
+U+06f2:&2a
+U+06f3:&3a
+U+06f4:&4a
+U+06f5:&5a
+U+06f6:&6a
+U+06f7:&7a
+U+06f8:&8a
+U+06f9:&9a
+U+1e00:&_A-0_
+U+1e01:&_a-0_
+U+1e02:&B.
+U+1e03:&b.
+U+1e04:&_B-._
+U+1e05:&_b-._
+U+1e06:&B_
+U+1e07:&b_
+U+1e08:&_C,'_
+U+1e09:&_c,'_
+U+1e0a:&D.
+U+1e0b:&d.
+U+1e0c:&_D-._
+U+1e0d:&_d-._
+U+1e0e:&D_
+U+1e0f:&d_
+U+1e10:&D,
+U+1e11:&d,
+U+1e12:&_D->_
+U+1e13:&_d->_
+U+1e14:&_E-!_
+U+1e15:&_e-!_
+U+1e16:&_E-'_
+U+1e17:&_e-'_
+U+1e18:&_E->_
+U+1e19:&_e->_
+U+1e1a:&_E-?_
+U+1e1b:&_e-?_
+U+1e1c:&_E,(_
+U+1e1d:&_e,(_
+U+1e1e:&F.
+U+1e1f:&f.
+U+1e20:&G-
+U+1e21:&g-
+U+1e22:&H.
+U+1e23:&h.
+U+1e24:&_H-._
+U+1e25:&_h-._
+U+1e26:&H:
+U+1e27:&h:
+U+1e28:&H,
+U+1e29:&h,
+U+1e2a:&_H-(_
+U+1e2b:&_h-(_
+U+1e2c:&_I-?_
+U+1e2d:&_i-?_
+U+1e2e:&_I:'_
+U+1e2f:&_i:'_
+U+1e30:&K'
+U+1e31:&k'
+U+1e32:&_K-._
+U+1e33:&_k-._
+U+1e34:&K_
+U+1e35:&k_
+U+1e36:&_L-._
+U+1e37:&_l-._
+U+1e38:&_L--._
+U+1e39:&_l--._
+U+1e3a:&L_
+U+1e3b:&l_
+U+1e3c:&_L->_
+U+1e3d:&_l->_
+U+1e3e:&M'
+U+1e3f:&m'
+U+1e40:&M.
+U+1e41:&m.
+U+1e42:&_M-._
+U+1e43:&_m-._
+U+1e44:&N.
+U+1e45:&n.
+U+1e46:&_N-._
+U+1e47:&_n-._
+U+1e48:&N_
+U+1e49:&n_
+U+1e4a:&_N->_
+U+1e4b:&_N->_
+U+1e4c:&_O?'_
+U+1e4d:&_o?'_
+U+1e4e:&_O?:_
+U+1e4f:&_o?:_
+U+1e50:&_O-!_
+U+1e51:&_o-!_
+U+1e52:&_O-'_
+U+1e53:&_o-'_
+U+1e54:&P'
+U+1e55:&p'
+U+1e56:&P.
+U+1e57:&p.
+U+1e58:&R.
+U+1e59:&r.
+U+1e5a:&_R-._
+U+1e5b:&_r-._
+U+1e5c:&_R--._
+U+1e5d:&_r--._
+U+1e5e:&R_
+U+1e5f:&r_
+U+1e60:&S.
+U+1e61:&s.
+U+1e62:&_S-._
+U+1e63:&_s-._
+U+1e64:&_S'._
+U+1e65:&_s'._
+U+1e66:&_S<._
+U+1e67:&_s<._
+U+1e68:&_S.-._
+U+1e69:&_S.-._
+U+1e6a:&T.
+U+1e6b:&t.
+U+1e6c:&_T-._
+U+1e6d:&_t-._
+U+1e6e:&T_
+U+1e6f:&t_
+U+1e70:&_T->_
+U+1e71:&_t->_
+U+1e72:&_U--:_
+U+1e73:&_u--:_
+U+1e74:&_U-?_
+U+1e75:&_u-?_
+U+1e76:&_U->_
+U+1e77:&_u->_
+U+1e78:&_U?'_
+U+1e79:&_u?'_
+U+1e7a:&_U-:_
+U+1e7b:&_u-:_
+U+1e7c:&V?
+U+1e7d:&v?
+U+1e7e:&_V-._
+U+1e7f:&_v-._
+U+1e80:&W!
+U+1e81:&w!
+U+1e82:&W'
+U+1e83:&w'
+U+1e84:&W:
+U+1e85:&w:
+U+1e86:&W.
+U+1e87:&w.
+U+1e88:&_W-._
+U+1e89:&_w-._
+U+1e8a:&X.
+U+1e8b:&x.
+U+1e8c:&X:
+U+1e8d:&x:
+U+1e8e:&Y.
+U+1e8f:&y.
+U+1e90:&Z>
+U+1e91:&z>
+U+1e92:&_Z-._
+U+1e93:&_z-._
+U+1e94:&Z_
+U+1e95:&z_
+U+1e96:&h_
+U+1e97:&t:
+U+1e98:&w0
+U+1e99:&y0
+U+1ea0:&_A-._
+U+1ea1:&_a-._
+U+1ea2:&A2
+U+1ea3:&a2
+U+1ea4:&_A>'_
+U+1ea5:&_a>'_
+U+1ea6:&_A>!_
+U+1ea7:&_a>!_
+U+1ea8:&_A>2_
+U+1ea9:&_a>2_
+U+1eaa:&_A>?_
+U+1eab:&_a>?_
+U+1eac:&_A>-._
+U+1ead:&_a>-._
+U+1eae:&_A('_
+U+1eaf:&_a('_
+U+1eb0:&_A(!_
+U+1eb1:&_a(!_
+U+1eb2:&_A(2_
+U+1eb3:&_a(2_
+U+1eb4:&_A(?_
+U+1eb5:&_a(?_
+U+1eb6:&_A(-._
+U+1eb7:&_a(-._
+U+1eb8:&_E-._
+U+1eb9:&_e-._
+U+1eba:&E2
+U+1ebb:&e2
+U+1ebc:&E?
+U+1ebd:&e?
+U+1ebe:&_E>'_
+U+1ebf:&_e>'_
+U+1ec0:&_E>!_
+U+1ec1:&_e>!_
+U+1ec2:&_E>2_
+U+1ec3:&_e>2_
+U+1ec4:&_E>?_
+U+1ec5:&_e>?_
+U+1ec6:&_E>-._
+U+1ec7:&_e>-._
+U+1ec8:&I2
+U+1ec9:&i2
+U+1eca:&_I-._
+U+1ecb:&_i-._
+U+1ecc:&_O-._
+U+1ecd:&_o-._
+U+1ece:&O2
+U+1ecf:&o2
+U+1ed0:&_O>'_
+U+1ed1:&_o>'_
+U+1ed2:&_O>!_
+U+1ed3:&_o>!_
+U+1ed4:&_O>2_
+U+1ed5:&_o>2_
+U+1ed6:&_O>?_
+U+1ed7:&_o>?_
+U+1ed8:&_O>-._
+U+1ed9:&_o>-._
+U+1eda:&_O9'_
+U+1edb:&_o9'_
+U+1edc:&_O9!_
+U+1edd:&_o9!_
+U+1ede:&_O92_
+U+1edf:&_o92_
+U+1ee0:&_O9?_
+U+1ee1:&_o9?_
+U+1ee2:&_O9-._
+U+1ee3:&_o9-._
+U+1ee4:&_U-._
+U+1ee5:&_u-._
+U+1ee6:&U2
+U+1ee7:&u2
+U+1ee8:&_U9'_
+U+1ee9:&_u9'_
+U+1eea:&_U9!_
+U+1eeb:&_u9!_
+U+1eec:&_U92_
+U+1eed:&_u92_
+U+1eee:&_U9?_
+U+1eef:&_u9?_
+U+1ef0:&_U9-._
+U+1ef1:&_u9-._
+U+1ef2:&Y!
+U+1ef3:&y!
+U+1ef4:&_Y-._
+U+1ef5:&_y-._
+U+1ef6:&Y2
+U+1ef7:&y2
+U+1ef8:&Y?
+U+1ef9:&y?
+U+1f00:&;'
+U+1f01:&,'
+U+1f02:&;!
+U+1f03:&,!
+U+1f04:&?;
+U+1f05:&?,
+U+1f06:&!:
+U+1f07:&?:
+U+2002:&1N
+U+2003:&1M
+U+2004:&3M
+U+2005:&4M
+U+2006:&6M
+U+2009:&1T
+U+200a:&1H
+U+2010:&-1
+U+2013:&-N
+U+2014:&-M
+U+2015:&-3
+U+2016:&!2
+U+2017:&=2
+U+2018:&'6
+U+2019:&'9
+U+201a:&.9
+U+201b:&9'
+U+201c:&"6
+U+201d:&"9
+U+201e:&:9
+U+201f:&9"
+U+2020:&/-
+U+2021:&/=
+U+2025:&..
+U+2030:&%0
+U+2032:&1'
+U+2033:&2'
+U+2034:&3'
+U+2035:&1"
+U+2036:&2"
+U+2037:&3"
+U+2038:&Ca
+U+2039:&<1
+U+203a:&>1
+U+203b:&:X
+U+203c:&_!*2_
+U+203e:&'-
+U+2044:&/f
+U+2070:&0S
+U+2074:&4S
+U+2075:&5S
+U+2076:&6S
+U+2077:&7S
+U+2078:&8S
+U+2079:&9S
+U+207a:&+S
+U+207b:&-S
+U+207c:&=S
+U+207d:&(S
+U+207e:&)S
+U+207f:&nS
+U+2080:&0s
+U+2081:&1s
+U+2082:&2s
+U+2083:&3s
+U+2084:&4s
+U+2085:&5s
+U+2086:&6s
+U+2087:&7s
+U+2088:&8s
+U+2089:&9s
+U+208a:&+s
+U+208b:&-s
+U+208c:&=s
+U+208d:&(s
+U+208e:&)s
+U+20a4:&Li
+U+20a7:&Pt
+U+20a9:&W=
+U+2103:&oC
+U+2105:&co
+U+2109:&oF
+U+2116:&N0
+U+2117:&PO
+U+211e:&Rx
+U+2120:&SM
+U+2122:&TM
+U+2126:&Om
+U+212b:&AO
+U+2153:&13
+U+2154:&23
+U+2155:&15
+U+2156:&25
+U+2157:&35
+U+2158:&45
+U+2159:&16
+U+215a:&56
+U+215b:&18
+U+215c:&38
+U+215d:&58
+U+215e:&78
+U+2160:&1R
+U+2161:&2R
+U+2162:&3R
+U+2163:&4R
+U+2164:&5R
+U+2165:&6R
+U+2166:&7R
+U+2167:&8R
+U+2168:&9R
+U+2169:&aR
+U+216a:&bR
+U+216b:&cR
+U+216c:&_50R_
+U+216d:&_100R_
+U+216e:&_500R_
+U+216f:&_1000R_
+U+2170:&1r
+U+2171:&2r
+U+2172:&3r
+U+2173:&4r
+U+2174:&5r
+U+2175:&6r
+U+2176:&7r
+U+2177:&8r
+U+2178:&9r
+U+2179:&ar
+U+217a:&br
+U+217b:&cr
+U+217c:&_50r_
+U+217d:&_100r_
+U+217e:&_500r_
+U+217f:&_1000r_
+U+2180:&_1000RCD_
+U+2181:&_5000R_
+U+2182:&_10000R_
+U+2190:&<-
+U+2191:&-!
+U+2192:&->
+U+2193:&-v
+U+2194:&<>
+U+2195:&UD
+U+2196:&_<!!_
+U+2197:&_//>_
+U+2198:&_!!>_
+U+2199:&_<//_
+U+21d0:&<=
+U+21d2:&=>
+U+21d4:&==
+U+2200:&FA
+U+2202:&dP
+U+2203:&TE
+U+2205:&/0
+U+2206:&DE
+U+2207:&NB
+U+2208:&(-
+U+220b:&-)
+U+220f:&*P
+U+2211:&+Z
+U+2212:&-2
+U+2213:&-+
+U+2217:&*-
+U+2218:&Ob
+U+2219:&Sb
+U+221a:&RT
+U+221d:&0(
+U+221e:&00
+U+221f:&-L
+U+2220:&-V
+U+2225:&PP
+U+2227:&AN
+U+2228:&OR
+U+2229:&(U
+U+222a:&)U
+U+222b:&In
+U+222c:&DI
+U+222e:&Io
+U+2234:&.:
+U+2235:&:.
+U+2236:&:R
+U+2237:&::
+U+223c:&?1
+U+223e:&CG
+U+2243:&?-
+U+2245:&?=
+U+2248:&?2
+U+224c:&=?
+U+2253:&HI
+U+2260:&!=
+U+2261:&=3
+U+2264:&=<
+U+2265:&>=
+U+226a:&<*
+U+226b:&*>
+U+226e:&!<
+U+226f:&!>
+U+2282:&(C
+U+2283:&)C
+U+2286:&(_
+U+2287:&)_
+U+2299:&0.
+U+229a:&02
+U+22a5:&-T
+U+22c5:&.P
+U+22ee:&:3
+U+22ef:&.3
+U+2302:&Eh
+U+2308:&<7
+U+2309:&>7
+U+230a:&7<
+U+230b:&7>
+U+2310:&NI
+U+2312:&(A
+U+2315:&TR
+U+2320:&Iu
+U+2321:&Il
+U+2329:&</
+U+232a:&/>
+U+2423:&Vs
+U+2440:&1h
+U+2441:&3h
+U+2442:&2h
+U+2443:&4h
+U+2446:&1j
+U+2447:&2j
+U+2448:&3j
+U+2449:&4j
+U+2460:&_1-o_
+U+2461:&_2-o_
+U+2462:&_3-o_
+U+2463:&_4-o_
+U+2464:&_5-o_
+U+2465:&_6-o_
+U+2466:&_7-o_
+U+2467:&_8-o_
+U+2468:&_9-o_
+U+2469:&_10-o_
+U+246a:&_11-o_
+U+246b:&_12-o_
+U+246c:&_13-o_
+U+246d:&_14-o_
+U+246e:&_15-o_
+U+246f:&_16-o_
+U+2470:&_17-o_
+U+2471:&_18-o_
+U+2472:&_19-o_
+U+2473:&_20-o_
+U+2474:&_(1)_
+U+2475:&_(2)_
+U+2476:&_(3)_
+U+2477:&_(4)_
+U+2478:&_(5)_
+U+2479:&_(6)_
+U+247a:&_(7)_
+U+247b:&_(8)_
+U+247c:&_(9)_
+U+247d:&_(10)_
+U+247e:&_(11)_
+U+247f:&_(12)_
+U+2480:&_(13)_
+U+2481:&_(14)_
+U+2482:&_(15)_
+U+2483:&_(16)_
+U+2484:&_(17)_
+U+2485:&_(18)_
+U+2486:&_(19)_
+U+2487:&_(20)_
+U+2488:&1.
+U+2489:&2.
+U+248a:&3.
+U+248b:&4.
+U+248c:&5.
+U+248d:&6.
+U+248e:&7.
+U+248f:&8.
+U+2490:&9.
+U+2491:&_10._
+U+2492:&_11._
+U+2493:&_12._
+U+2494:&_13._
+U+2495:&_14._
+U+2496:&_15._
+U+2497:&_16._
+U+2498:&_17._
+U+2499:&_18._
+U+249a:&_19._
+U+249b:&_20._
+U+249c:&_(a)_
+U+249d:&_(b)_
+U+249e:&_(c)_
+U+249f:&_(d)_
+U+24a0:&_(e)_
+U+24a1:&_(f)_
+U+24a2:&_(g)_
+U+24a3:&_(h)_
+U+24a4:&_(i)_
+U+24a5:&_(j)_
+U+24a6:&_(k)_
+U+24a7:&_(l)_
+U+24a8:&_(m)_
+U+24a9:&_(n)_
+U+24aa:&_(o)_
+U+24ab:&_(p)_
+U+24ac:&_(q)_
+U+24ad:&_(r)_
+U+24ae:&_(s)_
+U+24af:&_(t)_
+U+24b0:&_(u)_
+U+24b1:&_(v)_
+U+24b2:&_(w)_
+U+24b3:&_(x)_
+U+24b4:&_(y)_
+U+24b5:&_(z)_
+U+24b6:&_A-o_
+U+24b7:&_B-o_
+U+24b8:&_C-o_
+U+24b9:&_D-o_
+U+24ba:&_E-o_
+U+24bb:&_F-o_
+U+24bc:&_G-o_
+U+24bd:&_H-o_
+U+24be:&_I-o_
+U+24bf:&_J-o_
+U+24c0:&_K-o_
+U+24c1:&_L-o_
+U+24c2:&_M-o_
+U+24c3:&_N-o_
+U+24c4:&_O-o_
+U+24c5:&_P-o_
+U+24c6:&_Q-o_
+U+24c7:&_R-o_
+U+24c8:&_S-o_
+U+24c9:&_T-o_
+U+24ca:&_U-o_
+U+24cb:&_V-o_
+U+24cc:&_W-o_
+U+24cd:&_X-o_
+U+24ce:&_Y-o_
+U+24cf:&_Z-o_
+U+24d0:&_a-o_
+U+24d1:&_b-o_
+U+24d2:&_c-o_
+U+24d3:&_d-o_
+U+24d4:&_e-o_
+U+24d5:&_f-o_
+U+24d6:&_g-o_
+U+24d7:&_h-o_
+U+24d8:&_i-o_
+U+24d9:&_j-o_
+U+24da:&_k-o_
+U+24db:&_l-o_
+U+24dc:&_m-o_
+U+24dd:&_n-o_
+U+24de:&_o-o_
+U+24df:&_p-o_
+U+24e0:&_q-o_
+U+24e1:&_r-o_
+U+24e2:&_s-o_
+U+24e3:&_t-o_
+U+24e4:&_u-o_
+U+24e5:&_v-o_
+U+24e6:&_w-o_
+U+24e7:&_x-o_
+U+24e8:&_y-o_
+U+24e9:&_z-o_
+U+24ea:&_0-o_
+U+2500:&hh
+U+2501:&HH
+U+2502:&vv
+U+2503:&VV
+U+2504:&3-
+U+2505:&3_
+U+2506:&3!
+U+2507:&3/
+U+2508:&4-
+U+2509:&4_
+U+250a:&4!
+U+250b:&4/
+U+250c:&dr
+U+250d:&dR
+U+250e:&Dr
+U+250f:&DR
+U+2510:&dl
+U+2511:&dL
+U+2512:&Dl
+U+2513:&LD
+U+2514:&ur
+U+2515:&uR
+U+2516:&Ur
+U+2517:&UR
+U+2518:&ul
+U+2519:&uL
+U+251a:&Ul
+U+251b:&UL
+U+251c:&vr
+U+251d:&vR
+U+251e:&_Udr_
+U+251f:&_uDr_
+U+2520:&Vr
+U+2521:&_UdR_
+U+2522:&_uDR_
+U+2523:&VR
+U+2524:&vl
+U+2525:&vL
+U+2526:&_Udl_
+U+2527:&_uDl_
+U+2528:&Vl
+U+2529:&_UdL_
+U+252a:&_uDL_
+U+252b:&VL
+U+252c:&dh
+U+252d:&_dLr_
+U+252e:&_dlR_
+U+252f:&dH
+U+2530:&Dh
+U+2531:&_DLr_
+U+2532:&_DlR_
+U+2533:&DH
+U+2534:&uh
+U+2535:&_uLr_
+U+2536:&_ulR_
+U+2537:&uH
+U+2538:&Uh
+U+2539:&_ULr_
+U+253a:&_UlR_
+U+253b:&UH
+U+253c:&vh
+U+253d:&_vLr_
+U+253e:&_vlR_
+U+253f:&vH
+U+2540:&_Udh_
+U+2541:&_uDh_
+U+2542:&Vh
+U+2543:&_UdLr_
+U+2544:&_UdlR_
+U+2545:&_uDLr_
+U+2546:&_uDlR_
+U+2547:&_UdH_
+U+2548:&_uDH_
+U+2549:&_VLr_
+U+254a:&_VlR_
+U+254b:&VH
+U+2571:&FD
+U+2572:&BD
+U+2580:&TB
+U+2584:&LB
+U+2588:&FB
+U+258c:&lB
+U+2590:&RB
+U+2591:&.S
+U+2592:&:S
+U+2593:&?S
+U+25a0:&fS
+U+25a1:&OS
+U+25a2:&RO
+U+25a3:&Rr
+U+25a4:&RF
+U+25a5:&RY
+U+25a6:&RH
+U+25a7:&RZ
+U+25a8:&RK
+U+25a9:&RX
+U+25aa:&sB
+U+25ac:&SR
+U+25ad:&Or
+U+25b2:&UT
+U+25b3:&uT
+U+25b6:&PR
+U+25b7:&Tr
+U+25bc:&Dt
+U+25bd:&dT
+U+25c0:&PL
+U+25c1:&Tl
+U+25c6:&Db
+U+25c7:&Dw
+U+25ca:&LZ
+U+25cb:&0m
+U+25ce:&0o
+U+25cf:&0M
+U+25d0:&0L
+U+25d1:&0R
+U+25d8:&Sn
+U+25d9:&Ic
+U+25e2:&Fd
+U+25e3:&Bd
+U+2605:&*2
+U+2606:&*1
+U+260e:&_TEL_
+U+260f:&_tel_
+U+261c:&<H
+U+261e:&>H
+U+263a:&0u
+U+263b:&0U
+U+263c:&SU
+U+2640:&Fm
+U+2642:&Ml
+U+2660:&cS
+U+2661:&cH
+U+2662:&cD
+U+2663:&cC
+U+2664:&_cS-_
+U+2665:&_cH-_
+U+2666:&_cD-_
+U+2667:&_cC-_
+U+2669:&Md
+U+266a:&M8
+U+266b:&M2
+U+266c:&_M16_
+U+266d:&Mb
+U+266e:&Mx
+U+266f:&MX
+U+2713:&OK
+U+2717:&XX
+U+2720:&-X
+U+3000:&IS
+U+3001:&,_
+U+3002:&._
+U+3003:&+"
+U+3004:&+_
+U+3005:&*_
+U+3006:&;_
+U+3007:&0_
+U+300a:&<+
+U+300b:&>+
+U+300c:&<'
+U+300d:&>'
+U+300e:&<"
+U+300f:&>"
+U+3010:&("
+U+3011:&)"
+U+3012:&=T
+U+3013:&=_
+U+3014:&('
+U+3015:&)'
+U+3016:&(I
+U+3017:&)I
+U+301c:&-?
+U+3020:&_=T:)_
+U+3041:&A5
+U+3042:&a5
+U+3043:&I5
+U+3044:&i5
+U+3045:&U5
+U+3046:&u5
+U+3047:&E5
+U+3048:&e5
+U+3049:&O5
+U+304a:&o5
+U+304b:&ka
+U+304c:&ga
+U+304d:&ki
+U+304e:&gi
+U+304f:&ku
+U+3050:&gu
+U+3051:&ke
+U+3052:&ge
+U+3053:&ko
+U+3054:&go
+U+3055:&sa
+U+3056:&za
+U+3057:&si
+U+3058:&zi
+U+3059:&su
+U+305a:&zu
+U+305b:&se
+U+305c:&ze
+U+305d:&so
+U+305e:&zo
+U+305f:&ta
+U+3060:&da
+U+3061:&ti
+U+3062:&di
+U+3063:&tU
+U+3064:&tu
+U+3065:&du
+U+3066:&te
+U+3067:&de
+U+3068:&to
+U+3069:&do
+U+306a:&na
+U+306b:&ni
+U+306c:&nu
+U+306d:&ne
+U+306e:&no
+U+306f:&ha
+U+3070:&ba
+U+3071:&pa
+U+3072:&hi
+U+3073:&bi
+U+3074:&pi
+U+3075:&hu
+U+3076:&bu
+U+3077:&pu
+U+3078:&he
+U+3079:&be
+U+307a:&pe
+U+307b:&ho
+U+307c:&bo
+U+307d:&po
+U+307e:&ma
+U+307f:&mi
+U+3080:&mu
+U+3081:&me
+U+3082:&mo
+U+3083:&yA
+U+3084:&ya
+U+3085:&yU
+U+3086:&yu
+U+3087:&yO
+U+3088:&yo
+U+3089:&ra
+U+308a:&ri
+U+308b:&ru
+U+308c:&re
+U+308d:&ro
+U+308e:&wA
+U+308f:&wa
+U+3090:&wi
+U+3091:&we
+U+3092:&wo
+U+3093:&n5
+U+3094:&vu
+U+309b:&"5
+U+309c:&05
+U+309d:&*5
+U+309e:&+5
+U+30a1:&a6
+U+30a2:&A6
+U+30a3:&i6
+U+30a4:&I6
+U+30a5:&u6
+U+30a6:&U6
+U+30a7:&e6
+U+30a8:&E6
+U+30a9:&o6
+U+30aa:&O6
+U+30ab:&Ka
+U+30ac:&Ga
+U+30ad:&Ki
+U+30ae:&Gi
+U+30af:&Ku
+U+30b0:&Gu
+U+30b1:&Ke
+U+30b2:&Ge
+U+30b3:&Ko
+U+30b4:&Go
+U+30b5:&Sa
+U+30b6:&Za
+U+30b7:&Si
+U+30b8:&Zi
+U+30b9:&Su
+U+30ba:&Zu
+U+30bb:&Se
+U+30bc:&Ze
+U+30bd:&So
+U+30be:&Zo
+U+30bf:&Ta
+U+30c0:&Da
+U+30c1:&Ti
+U+30c2:&Di
+U+30c3:&TU
+U+30c4:&Tu
+U+30c5:&Du
+U+30c6:&Te
+U+30c7:&De
+U+30c8:&To
+U+30c9:&Do
+U+30ca:&Na
+U+30cb:&Ni
+U+30cc:&Nu
+U+30cd:&Ne
+U+30ce:&No
+U+30cf:&Ha
+U+30d0:&Ba
+U+30d1:&Pa
+U+30d2:&Hi
+U+30d3:&Bi
+U+30d4:&Pi
+U+30d5:&Hu
+U+30d6:&Bu
+U+30d7:&Pu
+U+30d8:&He
+U+30d9:&Be
+U+30da:&Pe
+U+30db:&Ho
+U+30dc:&Bo
+U+30dd:&Po
+U+30de:&Ma
+U+30df:&Mi
+U+30e0:&Mu
+U+30e1:&Me
+U+30e2:&Mo
+U+30e3:&YA
+U+30e4:&Ya
+U+30e5:&YU
+U+30e6:&Yu
+U+30e7:&YO
+U+30e8:&Yo
+U+30e9:&Ra
+U+30ea:&Ri
+U+30eb:&Ru
+U+30ec:&Re
+U+30ed:&Ro
+U+30ee:&WA
+U+30ef:&Wa
+U+30f0:&Wi
+U+30f1:&We
+U+30f2:&Wo
+U+30f3:&N6
+U+30f4:&Vu
+U+30f5:&KA
+U+30f6:&KE
+U+30f7:&Va
+U+30f8:&Vi
+U+30f9:&Ve
+U+30fa:&Vo
+U+30fb:&.6
+U+30fc:&-6
+U+30fd:&*6
+U+30fe:&+6
+U+3105:&b4
+U+3106:&p4
+U+3107:&m4
+U+3108:&f4
+U+3109:&d4
+U+310a:&t4
+U+310b:&n4
+U+310c:&l4
+U+310d:&g4
+U+310e:&k4
+U+310f:&h4
+U+3110:&j4
+U+3111:&q4
+U+3112:&x4
+U+3113:&zh
+U+3114:&ch
+U+3115:&sh
+U+3116:&r4
+U+3117:&z4
+U+3118:&c4
+U+3119:&s4
+U+311a:&a4
+U+311b:&o4
+U+311c:&e4
+U+311d:&_eh4_
+U+311e:&ai
+U+311f:&ei
+U+3120:&au
+U+3121:&ou
+U+3122:&an
+U+3123:&en
+U+3124:&aN
+U+3125:&eN
+U+3126:&er
+U+3127:&i4
+U+3128:&u4
+U+3129:&iu
+U+312a:&v4
+U+312b:&nG
+U+312c:&gn
+U+321c:&_(JU)_
+U+3220:&1c
+U+3221:&2c
+U+3222:&3c
+U+3223:&4c
+U+3224:&5c
+U+3225:&6c
+U+3226:&7c
+U+3227:&8c
+U+3228:&9c
+U+3229:&_10c_
+U+327f:&_KSC_
+U+fb00:&ff
+U+fb01:&fi
+U+fb02:&fl
+U+fb03:&_ffi_
+U+fb04:&_ffl_
+U+fb05:&ft
+U+fb06:&st
+U+fe7d:&_3+;_
+U+fe82:&_aM._
+U+fe84:&_aH._
+U+fe8d:&_a+-_
+U+fe8e:&_a+._
+U+fe8f:&_b+-_
+U+fe90:&_b+,_
+U+fe91:&_b+;_
+U+fe92:&_b+._
+U+fe93:&_tm-_
+U+fe94:&_tm._
+U+fe95:&_t+-_
+U+fe96:&_t+,_
+U+fe97:&_t+;_
+U+fe98:&_t+._
+U+fe99:&_tk-_
+U+fe9a:&_tk,_
+U+fe9b:&_tk;_
+U+fe9c:&_tk._
+U+fe9d:&_g+-_
+U+fe9e:&_g+,_
+U+fe9f:&_g+;_
+U+fea0:&_g+._
+U+fea1:&_hk-_
+U+fea2:&_hk,_
+U+fea3:&_hk;_
+U+fea4:&_hk._
+U+fea5:&_x+-_
+U+fea6:&_x+,_
+U+fea7:&_x+;_
+U+fea8:&_x+._
+U+fea9:&_d+-_
+U+feaa:&_d+._
+U+feab:&_dk-_
+U+feac:&_dk._
+U+fead:&_r+-_
+U+feae:&_r+._
+U+feaf:&_z+-_
+U+feb0:&_z+._
+U+feb1:&_s+-_
+U+feb2:&_s+,_
+U+feb3:&_s+;_
+U+feb4:&_s+._
+U+feb5:&_sn-_
+U+feb6:&_sn,_
+U+feb7:&_sn;_
+U+feb8:&_sn._
+U+feb9:&_c+-_
+U+feba:&_c+,_
+U+febb:&_c+;_
+U+febc:&_c+._
+U+febd:&_dd-_
+U+febe:&_dd,_
+U+febf:&_dd;_
+U+fec0:&_dd._
+U+fec1:&_tj-_
+U+fec2:&_tj,_
+U+fec3:&_tj;_
+U+fec4:&_tj._
+U+fec5:&_zH-_
+U+fec6:&_zH,_
+U+fec7:&_zH;_
+U+fec8:&_zH._
+U+fec9:&_e+-_
+U+feca:&_e+,_
+U+fecb:&_e+;_
+U+fecc:&_e+._
+U+fecd:&_i+-_
+U+fece:&_i+,_
+U+fecf:&_i+;_
+U+fed0:&_i+._
+U+fed1:&_f+-_
+U+fed2:&_f+,_
+U+fed3:&_f+;_
+U+fed4:&_f+._
+U+fed5:&_q+-_
+U+fed6:&_q+,_
+U+fed7:&_q+;_
+U+fed8:&_q+._
+U+fed9:&_k+-_
+U+feda:&_k+,_
+U+fedb:&_k+;_
+U+fedc:&_k+._
+U+fedd:&_l+-_
+U+fede:&_l+,_
+U+fedf:&_l+;_
+U+fee0:&_l+._
+U+fee1:&_m+-_
+U+fee2:&_m+,_
+U+fee3:&_m+;_
+U+fee4:&_m+._
+U+fee5:&_n+-_
+U+fee6:&_n+,_
+U+fee7:&_n+;_
+U+fee8:&_n+._
+U+fee9:&_h+-_
+U+feea:&_h+,_
+U+feeb:&_h+;_
+U+feec:&_h+._
+U+feed:&_w+-_
+U+feee:&_w+._
+U+feef:&_j+-_
+U+fef0:&_j+._
+U+fef1:&_y+-_
+U+fef2:&_y+,_
+U+fef3:&_y+;_
+U+fef4:&_y+._
+U+fef5:&_lM-_
+U+fef6:&_lM._
+U+fef7:&_lH-_
+U+fef8:&_lH._
+U+fef9:&_lh-_
+U+fefa:&_lh._
+U+fefb:&_la-_
+U+fefc:&_la._
+U+0000:&NU
+U+0001:&SH
+U+0002:&SX
+U+0003:&EX
+U+0004:&ET
+U+0005:&EQ
+U+0006:&AK
+U+0007:&BL
+U+0008:&BS
+U+0009:&HT
+# U+000a:&LF
+U+000b:&VT
+U+000c:&FF
+U+000d:&CR
+U+000e:&SO
+U+000f:&SI
+U+0010:&DL
+U+0011:&D1
+U+0012:&D2
+U+0013:&D3
+U+0014:&D4
+U+0015:&NK
+U+0016:&SY
+U+0017:&EB
+U+0018:&CN
+U+0019:&EM
+U+001a:&SB
+U+001b:&EC
+U+001c:&FS
+U+001d:&GS
+U+001e:&RS
+U+001f:&US
+U+007f:&DT
+U+0080:&PA
+U+0081:&HO
+U+0082:&BH
+U+0083:&NH
+U+0084:&IN
+U+0085:&NL
+U+0086:&SA
+U+0087:&ES
+U+0088:&HS
+U+0089:&HJ
+U+008a:&VS
+U+008b:&PD
+U+008c:&PU
+U+008d:&RI
+U+008e:&S2
+U+008f:&S3
+U+0090:&DC
+U+0091:&P1
+U+0092:&P2
+U+0093:&TS
+U+0094:&CC
+U+0095:&MW
+U+0096:&SG
+U+0097:&EG
+U+0098:&SS
+U+0099:&GC
+U+009a:&SC
+U+009b:&CI
+U+009c:&ST
+U+009d:&OC
+U+009e:&PM
+U+009f:&AC
+U+e001:&/c
+U+e002:&UA
+U+e003:&UB
+U+e004:&"3
+U+e005:&"1
+U+e006:&"!
+U+e007:&"'
+U+e008:&">
+U+e009:&"?
+U+e00a:&"-
+U+e00b:&"(
+U+e00c:&".
+U+e00d:&":
+U+e00e:&"0
+U+e00f:&""
+U+e010:&"<
+U+e011:&",
+U+e012:&";
+U+e013:&"_
+U+e014:&"=
+U+e015:&"/
+U+e016:&"i
+U+e017:&"d
+U+e018:&"p
+U+e019:&;;
+U+e01a:&,,
+U+e01b:&b3
+U+e01c:&Ci
+U+e01d:&f(
+U+e01e:&ed
+U+e01f:&am
+U+e020:&pm
+U+e021:&_Tel_
+U+e022:&_a+:_
+U+e023:&Fl
+U+e024:&GF
+U+e025:&>V
+U+e026:&!*
+U+e027:&?*
+U+e028:&J<
diff --git a/src/chrtrans/next_uni.tbl b/src/chrtrans/next_uni.tbl
index 95dbff8b..914a842a 100644
--- a/src/chrtrans/next_uni.tbl
+++ b/src/chrtrans/next_uni.tbl
@@ -34,10 +34,10 @@ ONeXT character set
 #	128 characters (0x0 - 0x7f) are identical to ASCII and Unicode,
 #	this table only maps the NextStep range from 0x80 - 0xFF.
 #
-#       Format:  Three tab-separated columns
-#                Column #1 is the NextStep code (in hex as 0xXX)
-#                Column #2 is the Unicode (in hex as 0xXXXX)
-#                Column #3 NextStep name, Unicode name (follows a comment sign, '#')
+#       Format: Three tab-separated columns
+#               Column #1 is the NextStep code (in hex as 0xXX)
+#               Column #2 is the Unicode (in hex as 0xXXXX)
+#               Column #3 NextStep name, Unicode name (follows a comment sign, '#')
 #
 #       The entries are in NextStep order
 #
diff --git a/src/chrtrans/utf8_uni.tbl b/src/chrtrans/utf8_uni.tbl
index 61cdb259..84aaa000 100644
--- a/src/chrtrans/utf8_uni.tbl
+++ b/src/chrtrans/utf8_uni.tbl
@@ -3,7 +3,7 @@
 # tells Lynx that "unicode-1-1-utf-8" is Unicode/UCS2 encoded in UTF8...
 #
 #The MIME name of this charset. 
-MIMEname unicode-1-1-utf-8
+Mutf-8
 
 #Name as a Display Charset (used on Options screen)
 OptionName UNICODE UTF 8
diff --git a/src/descrip.mms b/src/descrip.mms
index 6b1316a8..9f84a7b8 100644
--- a/src/descrip.mms
+++ b/src/descrip.mms
@@ -154,7 +154,7 @@ TCPFLAGS = /Define = (DEBUG, ACCESS_AUTH, $(TCP))
 TOPT = sys$disk:[]$(TCPOPT).opt
 COPT = sys$disk:[]$(COMPILER).opt
 WWWLIB = [-.WWW.Library.Implementation]WWWLib_$(TCP).olb
-CFLAGS = $(TCPFLAGS) $(CFLAGS)/Include = ([-], [-.WWW.Library.Implementation])
+CFLAGS = $(TCPFLAGS) $(CFLAGS)/Include = ([-], [.chrtrans], [-.WWW.Library.Implementation])
 
 
 lynx :	lynx.exe
diff --git a/src/makefile.dos b/src/makefile.dos
index 89d1c0ef..29f41c76 100644
--- a/src/makefile.dos
+++ b/src/makefile.dos
@@ -12,7 +12,7 @@ LYStyle.o LYHash.o
 CFLAGS= $(MCFLAGS) -I.. $(SLANGINC)

 

 CC = gcc

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

+MCFLAGS = -O3 -DALT_CHAR_SET -DUSE_ZLIB -DUSE_EXTERNALS -DNCURSES_VERSION -DEXP_CHARTRANS -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

 WWWLIB = ../WWW/library/djgpp/libwww.a ../curses/pdcurses.a ../djgpp/tcplib/obj/libtcp.a

 LIBS=-lz

 

diff --git a/src/makefile.in b/src/makefile.in
index c9e73326..f1251366 100644
--- a/src/makefile.in
+++ b/src/makefile.in
@@ -32,6 +32,7 @@ WWWLIB		= ../WWW/Library/unix/libwww.a
 CPP_OPTS	= $(DEFS) $(CPPFLAGS) \
 		-I. \
 		-I.. \
+		-I$(srcdir)/chrtrans \
 		-I$(top_srcdir) \
 		-I$(top_srcdir)/$(WWWINC) \
 		$(SITE_DEFS)
@@ -108,28 +109,27 @@ LYCharSets.o: ../userdefs.h
 
 CHRTR= chrtrans/
 
-TABLES= $(CHRTR)iso01_uni.h \
- $(CHRTR)def7_uni.h \
- $(CHRTR)iso02_uni.h \
+TABLES= \
+ $(CHRTR)cp1250_uni.h \
+ $(CHRTR)cp1251_uni.h \
  $(CHRTR)cp1252_uni.h \
- $(CHRTR)dmcs_uni.h \
- $(CHRTR)mac_uni.h \
- $(CHRTR)next_uni.h \
- $(CHRTR)koi8r_uni.h \
- $(CHRTR)viscii_uni.h \
+ $(CHRTR)cp1253_uni.h \
+ $(CHRTR)cp1255_uni.h \
+ $(CHRTR)cp1256_uni.h \
+ $(CHRTR)cp1257_uni.h \
  $(CHRTR)cp437_uni.h \
+ $(CHRTR)cp737_uni.h \
+ $(CHRTR)cp775_uni.h \
  $(CHRTR)cp850_uni.h \
  $(CHRTR)cp852_uni.h \
+ $(CHRTR)cp862_uni.h \
+ $(CHRTR)cp864_uni.h \
  $(CHRTR)cp866_uni.h \
- $(CHRTR)cp737_uni.h \
  $(CHRTR)cp869_uni.h \
- $(CHRTR)cp864_uni.h \
- $(CHRTR)cp862_uni.h \
- $(CHRTR)cp1250_uni.h \
- $(CHRTR)cp1251_uni.h \
- $(CHRTR)cp1253_uni.h \
- $(CHRTR)cp1255_uni.h \
- $(CHRTR)cp1256_uni.h \
+ $(CHRTR)def7_uni.h \
+ $(CHRTR)dmcs_uni.h \
+ $(CHRTR)iso01_uni.h \
+ $(CHRTR)iso02_uni.h \
  $(CHRTR)iso03_uni.h \
  $(CHRTR)iso04_uni.h \
  $(CHRTR)iso05_uni.h \
@@ -138,10 +138,14 @@ TABLES= $(CHRTR)iso01_uni.h \
  $(CHRTR)iso08_uni.h \
  $(CHRTR)iso09_uni.h \
  $(CHRTR)iso10_uni.h \
- $(CHRTR)utf8_uni.h \
+ $(CHRTR)koi8r_uni.h \
+ $(CHRTR)mac_uni.h \
+ $(CHRTR)mnem_suni.h \
+ $(CHRTR)mnem2_suni.h \
+ $(CHRTR)next_uni.h \
  $(CHRTR)rfc_suni.h \
- $(CHRTR)mnemonic_suni.h \
- $(CHRTR)mnem_suni.h
+ $(CHRTR)utf8_uni.h \
+ $(CHRTR)viscii_uni.h
 
 CMN=../WWW/Library/Implementation/