about summary refs log tree commit diff stats
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
parentb6c832d07f5a1c68607a9cff0da25cee0de89dad (diff)
downloadlynx-snapshots-55ebd12c7fa4c97b88a5ca39320ac5d39c13ead0.tar.gz
snapshot of project "lynx", label v2-7-1ac_0-105
-rw-r--r--CHANGES.new168
-rw-r--r--INSTALLATION147
-rw-r--r--LYMessages_en.h11
-rw-r--r--PROBLEMS13
-rw-r--r--README.configure15
-rw-r--r--WWW/Library/Implementation/HTBTree.c4
-rw-r--r--WWW/Library/Implementation/HTFTP.c158
-rw-r--r--WWW/Library/Implementation/HTList.c2
-rw-r--r--WWW/Library/Implementation/HTMIME.c73
-rw-r--r--WWW/Library/Implementation/HTParse.c20
-rw-r--r--WWW/Library/Implementation/HTTP.c39
-rw-r--r--aclocal.m4110
-rw-r--r--config.hin9
-rwxr-xr-xconfigure1403
-rw-r--r--configure.in45
-rw-r--r--docs/CHANGES2.3 (renamed from docs/CHANGES2-3)0
-rw-r--r--docs/CHANGES2.4 (renamed from docs/CHANGES2-4)0
-rw-r--r--docs/CHANGES2.5 (renamed from docs/CHANGES2-5)0
-rw-r--r--docs/CHANGES2.6 (renamed from docs/CHANGES2-6)0
-rw-r--r--docs/CHANGES2.7 (renamed from docs/CHANGES2-7)0
-rw-r--r--lynx.cfg112
-rw-r--r--lynx_help/Lynx_users_guide.html28
-rw-r--r--lynx_help/keystrokes/keystroke_help.html4
-rw-r--r--lynx_help/keystrokes/other_help.html6
-rw-r--r--lynx_help/lynx_url_support.html40
-rw-r--r--makefile.in72
-rw-r--r--samples/lynx.cfg162
-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
-rw-r--r--userdefs.h100
69 files changed, 6287 insertions, 2365 deletions
diff --git a/CHANGES.new b/CHANGES.new
index 7f822e5f..eef17db6 100644
--- a/CHANGES.new
+++ b/CHANGES.new
@@ -3,14 +3,92 @@
 [ This file will become the CHANGES file for a new Lynx release.
 (More detailed change information may be in separate files, which could
 later disappear.  For some early changes for compilation on Win32 and DOS
-platforms see also README.win-386, for some changes for auto-configure and
+platforms see also INSTALLATION, for some changes for auto-configure and
 simple curses color see also README.configure).  Note that the 2.7 -> 2.7.1
 changes are included here. - KW]
 
+1998-01-02
+* workaround for sed expression when rerunning configure with config.cache
+  for slang libraries (reported by Hynek Med). - TD
+* fix indicated by Laura Eaves for LYUCFullyTranslateString_1() - TD
+* modify SPAWNING_MSG for DOSPATH configuration, avoid unnecessary use
+  of clear-screen in shell (patch by Doug Kaufman). - TD
+* remove install-help from list for install rule, adding message to
+  indicate how to install it. - TD
+* install lynx.lss only if color-style is configured. - TD
+* correct filemode for DJGPP when processing config-file, patch by
+  Doug Kaufman). - TD
+* add LYNX_LSS_FILE to config.hin, reported by Ambrose Li
+  <acli@acli.interlog.com>. - TD
+* new copy of INSTALLATION file from Henry Nelson Eric. - TD
+* add COPY* to install rule. - TD
+* simplify includes in UCdomap.c by using include-path in makefiles. - TD
+* build configure script with patched autoconf to workaround limited
+  environment space on CLIX 3.1 - TD
+* rename mnemonic_suni.tbl to mnem2_suni.tbl to accommodate 'make' on
+  older system with 14-character name-limit. - TD
+* sorted some lists (e.g., character sets) which were unreadable. - TD
+* incorporate most of FM's changes from 971124 to 971230 (see below). - TD
+  (Note:  don't try to use fflush(stdin) -- it's an FAQ -- nonstandard,
+  dumps core on some platforms).
+1997-12-30
+* Added Unicode translation support for "DosBaltRim (cp775)" and
+  "WinBaltRim (cp1257)". - FM
+1997-12-29
+* Fixed bug in the order of re-initializations for the 1997-12-22
+  get_connection() mods. - FM
+* Fixed typos in some LYCharUtils.c comment. - FM
+* Fixed typo in LYrcFile.c comments concerning the NO_FROM_HEADER
+  symbol. - DK
+1997-12-24
+* resolve conflict between autoconf $INSTALL and lynx's INSTALL_PATH
+  (reported by Scott McGee). - TD
+* modify CF_CHECK_FUNCDECL to work with non-gcc compilers. - TD
+* add <stdio.h> to prototype test for getgrgid getgrnam, needed on SVr3. - TD
+* add install-lss to makefile.in. - TD
+* modify order of includes in LYKeymap.c so that USE_EXTERNALS is defined
+  if it comes from userdefs.h (inferred from a report by Larry Virden). - TD
+* correct spelling of USE_EXTERNALS which prevented --enable-externs from
+  working. - TD
+* move assignment to stderr from VMSexit to cleanup function (reported
+  by Brian Tillman & FM). - TD
+* modify UCChangeTerminalCodepage() to not use stderr, disentangling it
+  from stderr/logfile hack. - TD
+* rename docs/CHANGES2-* files to docs/CHANGES2.* (reported by
+  Doug Kaufman). - TD
+* add start_color() call to DOSPATH version of start_curses() to
+  fix problem reported by Doug Kaufman - TD
+* correct typo in ColorCode() function (reported by Doug Kaufman) - TD
+* modify comments in makefile.in (patch by Henry Nelson Eric) - TD
+* minor fixes for CF_CHECK_ERRNO, CF_SIZECHANGE, CF_SLANG_CPPFLAGS
+  macros. - TD
+* add configure option --enable-nsl-fork to turn on code defined by
+  NSL_FORK. - TD
+* add configure option --enable-links to turn on code defined by
+  UNDERLINE_LINKS. - TD
+* add configure option --enable-font-switch, to turn on code defined by
+  EXP_CHARTRANS_AUTOSWITCH. - TD
+* modify configure CF_CURSES_LIBS test to look also for ncurses,
+  since some systems do not have a "curses" library (reported by
+  Michael Ritzert). - TD
+1997-12-22
+* Reworked -width=NUMBER command line switch for specifying the screen
+  width for formatting of dumps (default is 80; forced wraps occur at one
+  column less than the screen width, i.e., at 79 by default). - FM
+* Tweak of get_connection() in HTFTP.c to re-initialize the elements of
+  the connection structure when using a previously allocated connection
+  object. - DW & FM
+* Mods of LYexit.c, LYClean.c, LYMain.c and LYMainLoop.c to fflush() all
+  standard file descriptors in conjunction with all fopen() and fclose()
+  operations on the TRACE log and redirections of stderr via equality
+  statements (see 1997-12-16, 1997-12-13 and 1997-07-18 mods). - FM
 1997-12-18 
 * forgotten last } UN-inserted (John Line) - WB
 * few commented messages corrected according to RFC2068 (HTTP1.1)
   (Leonid Pauzner) - WB
+1997-12-17
+* Changed all %i tokens to %d or %ld in functions that always get decimal
+  values in their arguments. - FM
 1997-12-17 (all patches by Leonid Pauzner)
 * open text mode while writing lynx.rc and bookmarks files
   LYrcFile.c and LYBookmark.c (forgotten last } inserted). - WB
@@ -18,12 +96,50 @@ changes are included here. - KW]
   in one ifdef - WB
 * few misprinted characters (in comments) corrected in
   \chrtrans\cp850_uni.tbl - WB
+1997-12-16
+* Further mods in LYClean.c (see 1997-12-13 mods) do block the
+  *stderr = LYOrigStderr;  statement in cleanup() for VMS with VAXC. - FM
+* Added an ELGOTO keystroke command, mapped by default to upper case 'E'
+  (lower case 'e' still invokes the editor for the current document, if
+  it is a local file), for passing the URL (or ACTION) of the current
+  link to the line editor for editing as a goto URL.  Works like the
+  ECGOTO ('G') keystroke command for editing the URL of the current
+  document as a goto URL, i.e., if the URL is not modified, is set to
+  a zero-length string, or ^G is entered, the command is cancelled. - FM
+* Mods of LYMainLoop.c to disallow ECGOTO or ELGOTO commands for File
+  Management (DIRED_SUPPORT) menu URLs. - FM
+1997-12-15
+* Added reporting of the Discard value (YES or NO), in the Cookie Jar Page
+  (note that until we have code for storing cookies beyond the current
+  session, Lynx behaves as if Discard were set, whether or not it was set
+  by the server, but we still report the server's instructions, as we do
+  for the Maximum Gobble Date). - FM
 1997-12-14
 * added a lynx.cfg switch to turn on/off extended dos translations for keys. 
   -WB
 * added minor DOS tweaks by Doug Kaufman and myself. - WB
 * fixed windos binary mode piping. - WB
 1997-12-13
+* Tweaks in LYList.c to make the link numbers correspond with those in
+  the current document when LINKS_AND_FORM_FIELDS_ARE_NUMBERED in on,
+  and to show the current document's URL in the display. - FM
+* Mods in HTTP.c to show the body of a 305 return status instead of ever
+  acting on it.  A number of security/privacy problems with this status
+  are being discussed in the HTTP-WG, and it's likely to be dropped or
+  deprecated in the next revision of the HTTP/1.1 specs. - FM
+* Restored the v2.7.1 HTmmdecode() that's specific for iso-2022-jp in
+  HTMIME.c.  We still only call it when HTCJK == JAPANESE, and the
+  generalized version reportedly has problems. - FM
+* Removed the *stderr = LYOrigStderr; statement from VMSexit() in LYCurses.c
+  and added it to the if() claused section which closes the TRACE log file,
+  if opened, in cleanup() of LYClean.c.  This is just a stab in the dark
+  for dealing with reported problems on exit with VAXC on VAXen.  We may
+  need to use freopen() for redirecting TRACE messages to a file for VAXC
+  or VAXen (there's no apparent problem with the current code with DECC
+  on VMS/AXP). - FM
+* Added more function key cases to the keypad() mode switch() in LYgetch()
+  of LYStrings.c.  We don't need them with this code set, but they may as
+  well be there for completeness. - FM
 * check for and use ncurses default-color extension, use to make the
   color-style configuration usable on xterm with white background. - TD
 * add cases in LYgetch() for remaining VT220-compatible codes, reported
@@ -37,6 +153,7 @@ changes are included here. - KW]
 * suppress suffixes in top-level makefile so 'make' won't try to create
   a file named "install" from install.sh - TD 
 * make $(CPPFLAGS) inherit consistently from top-level makefile. - TD
+  (reported by Mark Mentovai)
 * add configure option --enable-externs, to turn on USE_EXTERNS. - TD
 * use explicit comparison for enum values, fix compile problem with VAX C
   for UCAux functions (reported by Brian Tillman). - TD
@@ -47,6 +164,53 @@ changes are included here. - KW]
 * Use wborder only if configure finds it, not ifdef FANCY_CURSES. - PHDM
 * List of systems having strerror replaced by configure test. - PHDM
 * Beautifying of mktime.c (`now' was misleading). - PHDM
+1997-12-02
+* Mods in LYCookie.c to prompt whether to accept (or reject) cookies with
+  an invalid domain value which yields a hostname prefix with a dot (as
+  specified in section 4.3.2 of the IETF cookie drafts and RFC), rather
+  than rejecting it silently.  Note that it is rejected in non-interactive
+  (-dump or -source) mode, because the user can't be prompted. - FM
+1997-11-27
+* Added a PREPEND_BASE_TO_SOURCE configuration symbol in lynx.cfg which
+  can be set FALSE to suppress prepending of a Request URL comment and
+  BASE element to text/html sources retrieved for 'd'ownloading or passed
+  to 'p'rint functions.  Note that this prepending is not done for -source
+  dumps unless the -base switch also was included on the command line, and
+  the latter switch overrides the setting of the PREPEND_BASE_TO_SOURCE
+  configuration variable. - FM
+1997-11-25
+* Mods in LYMail.c and LYPrint.c to handle to=address(es), cc=address(es),
+  subject=string, keywords=word_list, and body=message fields in the
+  ?searchpart of mailto URLs as specified in the 1997-11-16 draft:
+    ftp://ftp.isi.edu/internet-drafts/draft-hoffman-mailto-url-03.txt
+  The cc=address(es) values are now handled as a Cc: header, and a self
+  copy, if confirmed on prompt, is added to the Cc: header.  Note that
+  the draft now allows mailto:?to=address(es)[&foo=blah] as a format,
+  i.e., without an address before the ?searchpart.  The Netscape
+  ?searchpart tack-on broke all pre-existing implementations of mailto,
+  and this breaks Lynx's support through v2.7.1.  Though it's now
+  supported in this code set, don't use it.  Complaints and formal
+  requests to provide this functionality via a new scheme (e.g.,
+  mail: or smtp:) without breaking existing implementation of mailto:,
+  including from TimBL (HimSelf :), thus far have fallen on deaf ears.
+  You can send email to those deaf ears via:
+  	mailto:masinter@parc.xerox.com%20(Larry%20Masinter)
+  Don't allow the IETF backward compatibility principle to go down
+  the drain. - FM
+* Mods to support use of the PMDF SEND command on VMS in conjunction with
+  a temporary header file, so that all headers specified in the ?searchpart
+  of mailto URLs can be included in the mailing, and made that the compilation
+  default in userdefs.h to go with the default MAIL_ADRS mask for PMDF (If
+  the "generic" VMS MAIL utility is used, not all of the headers can be
+  specified on the command line, as it requires).  Look at the code in
+  LYMail.c and LYPrint.c that is used when isPMDF is TRUE as a model of how
+  to do this with other header-file-capable VMS mailers (but I don't have
+  any besides PMDF, and can't do it for you :). - FM
+* Tweak of the 1997-11-17 URL parsing mods so that relative symbolic
+  elements immediately preceding a ?searchpart are handled identically
+  to when a ?searchpart is not present. - FM
+* Added support for setting both SYSTEM_MAIL and SYSTEM_MAIL_FLAGS in
+  both userdefs.h and lynx.cfg. - FM
 1997-11-23
 * integrate PHDM's patch. - TD
 * Check for existence of sys/wait.h. - PHDM
@@ -88,7 +252,7 @@ changes are included here. - KW]
 * Added an LYK_CLEAR_AUTH command, mapped to underscore ('_') by default,
   which clears all authorization info for the current session.  This is
   recommended for the situation when one leaves one's terminal but doesn't
-  want to end the Browser session, nor want others to be able to retrieve
+  want to end the browser session, nor want others to be able to retrieve
   protected documents with previously entered username and password info.
   Note that we don't yet have a way to block access to any protected
   documents which are still in cache. - FM
diff --git a/INSTALLATION b/INSTALLATION
index a21d4835..eef8d3fc 100644
--- a/INSTALLATION
+++ b/INSTALLATION
@@ -36,22 +36,18 @@ Step 2. (define run-time variables -- See the lynx.cfg file for details.)
     the LYNX_CFG_FILE define in userdefs.h, specified with an environment
     variable, LYNX_CFG, or specified with the "-cfg" command line option.
 
-Step 3. (You can skip this step only if you only use English and are not
-    interested in any special characters, or if the display and local files
-    will all use the ISO-8859-1 "ISO Latin 1" Western European character
-    set.)
+Step 3. (You may skip this step if you only use English and are not
+    interested in any special characters, or if your display and local files
+    will all use the ISO-8859-1 "ISO Latin 1" Western European character set.)
     People who will be running Lynx in an environment with different and
     incompatible character sets should configure CHARACTER_SET (the Display
-    character set) and ASSUME_LOCAL_CHARSET to work correctly for them
-    before starting to create bookmark files et cetera.  Please read
-    "lynx.cfg" for detailed instructions.
-    Additional character sets and some of their properties may be defined with 
-    tables in the src/chrtrans directory.  It is not necessary to change 
-    src/LYCharSets.c to make these new character sets known to Lynx, (although 
-    definitions for the "older" character sets are still there), but the new
+    character set) and ASSUME_LOCAL_CHARSET to work correctly for them before
+    creating bookmark files et cetera.  Please read "lynx.cfg" for detailed
+    instructions.  Additional character sets and their properties may be
+    defined with tables in the src/chrtrans directory.  It is not necessary to
+    change src/LYCharSets.c to make new character sets known to Lynx, but new
     ones have to be listed in src/UCdomap.c and, currently, the makefiles in
-    src/ and src/chrtrans to be automatically used.  See the README.* files
-    in src/chrtrans/ for details.
+    src/ and src/chrtrans to be used.  See the README.* files in src/chrtrans/.
 
 Step 4. (optional -- news for UNIX and VMS)
     Set NNTPSERVER in "lynx.cfg" to your site's NNTP server, or set the
@@ -125,6 +121,7 @@ II. Compile instructions -- UNIX
 	NetBSD
 	SCO (cc with curses)
 	Solaris 2.5 (cc and gcc with curses, ncurses and slang)
+	Solaris 2.6 (gcc with slang)
 	SunOS 4.1 (cc curses, gcc ncurses and slang)
 
     NOTE:  SunOS and HP-UX come with a bundled K&R compiler, which is only
@@ -132,12 +129,10 @@ II. Compile instructions -- UNIX
     require a compiler that recognizes prototypes.
 
 1c. Options
-    To get a list of the configure script's options, type
-
-	   ./configure --help
-
-    Here's an alphabetical listing of the Lynx-specific options.  The actual
-    order shown by the -help option is different.
+    To get a list of the configure script's options, type "./configure --help".
+    Below is an alphabetical listing of the Lynx-specific options.  The actual
+    order shown by the -help option is different.  See "docs/README.defines"
+    for information on defines for which there are no option switches.
 
   --disable-dired			(defines DIRED_SUPPORT)
 	Use this option to disable the optional directory-editor.
@@ -209,13 +204,24 @@ II. Compile instructions -- UNIX
   	Use this option to enable optional and *experimental* color style.
 	(Also defines USE_HASH, LINKEDSTYLES)
 
-  --enable-debug
+  --enable-debug			(The symbol DEBUG is always defined.)
   	Use this option to compile-in support for debugging.
-	(The symbol DEBUG is always defined).
 
-  --enable-find-leaks			(defines LY_FIND_LEAKS)
+  --enable-externs			(define USE_EXTERNALS)
+	Use this option to enable external application support. (See lynx.cfg.)
+
+  --enable-find-leaks			(define LY_FIND_LEAKS)
 	Use this option to compile-in logic for testing memory leaks.
 
+  --enable-font-switch			(define EXP_CHARTRANS_AUTOSWITCH)
+	Use Linux setfont for character-translation.  (Use with discretion.)
+
+  --enable-nsl-fork			(define NSL_FORK)
+	Use this option to allow NSL requests to be aborted at will.
+
+  --enable-underlines			(define UNDERLINE_LINKS)
+	Use this option underline links rather than using boldface.
+
   --enable-warnings
 	Use this option to turn on GCC compiler warnings.
 
@@ -231,10 +237,10 @@ II. Compile instructions -- UNIX
 	standard locations for the associated header and library files,
 	unless you have preset the $CFLAGS and $LIBS variables.
 
-	--with-screen=ncurses		(defines NCURSES)
-	--with-screen=slang		(defines USE_SLANG)
+	--with-screen=ncurses		(define NCURSES)
+	--with-screen=slang		(define USE_SLANG)
 
-   --with-zlib				(defines USE_ZLIB)
+   --with-zlib				(define USE_ZLIB)
 	Use zlib for decompression of some gzip files.
 
 1d. Environment variables
@@ -268,30 +274,30 @@ II. Compile instructions -- UNIX
 1e. Example
     I use the following csh shell script to set environment variables and
     configure options rather than type them at the command line each time.
+	setenv RESOLVLIB -lbind
 
 	#!/bin/csh -f
-	setenv RESOLVLIB -lbind
-	setenv CPPFLAGS "-DNSL_FORK -I$HOME/.slang/src -I$HOME/.usr/include"
+	setenv CPPFLAGS "-SYSLOG_REQUESTED_URLS -I$HOME/slang \
+		-I$HOME/.usr/include"
 	setenv LIBS "-L$HOME/.slang/lib -L$HOME/.usr/lib"
 	./configure --exec-prefix=$HOME --bindir=$HOME/.lynx \
 		--mandir=$HOME/.usr/man --libdir=$HOME/.usr/lib \
 		--with-screen=slang --with-zlib
 
-    The syntax for setting environment variables depends upon your shell.
-    I have installed the libbind.a resolver library on this particular SunOS
-    machine, and prefer to use it to the old libresolv.a.  Setting the
-    environment variable RESOLVLIB to -lbind predefines it for the configure
-    script.  CPPFLAGS in this example defines NSL_FORK, which is not defined
-    by default, and for which there is no option switch.  (Check under the
-    "SITE_DEFS" heading in "makefile.in" for other minor defines for which
-    there are no options.)  CPPFLAGS also defines the full path to the slang
-    and zlib header files, which are not kept in standard directories.
-    Likewise, LIBS defines the nonstandard locations of libslang.a and libz.a.
-    Setting the option --bindir tells the configure script where I want to
-    install the lynx binary; setting --mandir tells it where to put the lynx.1
-    man page, and setting --libdir tells it where to put the configuration
-    file "lynx.cfg", when I type "make install".  The --with-screen=slang and
-    --with-zlib options are explained above.
+    The syntax for setting environment variables depends upon your shell.  I
+    use the libbind.a resolver library, not libresolv.a.  Setting RESOLVLIB to
+    -lbind defines this environment variable for `make', and thus must be set
+    in the same shell that `make' will be run.  CPPFLAGS in this example
+    predefines SYSLOG_REQUESTED_URLS for the configure script, since it is not
+    defined by default, and has no option switch (see "docs/README.defines").
+    CPPFLAGS also defines the full path to the slang and zlib header files,
+    which are not kept in standard directories.  Likewise, LIBS defines the
+    nonstandard locations of libslang.a and libz.a.  Setting the option
+    --bindir tells the configure script where I want to install the lynx
+    binary; setting --mandir tells it where to put the lynx.1 man page, and
+    setting --libdir tells it where to put the configuration file "lynx.cfg",
+    when I type "make install".  The --with-screen=slang and --with-zlib
+    options are explained above.
 
 2. Manual compile
     If auto-configure does not work for you, or you prefer to compile
@@ -396,15 +402,14 @@ Step 3b.  (optional compilation method)
 
 IV. Compile instructions -- Win32 (Windows95/NT)
 
-    The original Win32 port was built with Borland C++ 4.52.  Later versions
-    of Borland C++ reportedly can be used, but no other compilers have been
-    tested.  Before compiling the Lynx sources, you need a curses library, and
-    it is recommended that you have the zlib library.  Get pdcurses2.3 from
-    "http://www.lightlink.com/hessling/".  I have modified it so that mouse
-    support is no longer broken for Lynx (see "http://www.fdisk.com/doslynx/").
-    You will want to get zlib from "http://www.cdrom.com/pub/infozip/zlib/".
-    Compile these libraries, and put them in a convenient place (pdcurses
-    inside the Lynx directory).
+    The original Win32 port was built with Borland C++ 4.52, but later
+    versions reportedly can be used.  Before compiling the Lynx sources, you
+    need a curses library, and it is recommended that you have the zlib
+    library.  Get pdcurses2.3 from "http://www.lightlink.com/hessling/".  I
+    have modified it so that mouse support is no longer broken for Lynx (see
+    "http://www.fdisk.com/doslynx/").  You will want to get zlib from
+    "http://www.cdrom.com/pub/infozip/zlib/".  Compile these libraries, and
+    put them in a convenient place (pdcurses inside the Lynx directory).
 
     Unpack the latest Lynx source distribution, and make an obj directory
     under the source root to contain the compile output.  Copy in your
@@ -424,6 +429,15 @@ IV. Compile instructions -- Win32 (Windows95/NT)
 
 -- 1997/10/12 - W. Buttles <lynx-port@fdisk.com>
 
+    Although not well documented, it is possible to compile under the cygwin32
+    system, which will allow you to use the configure script described above
+    for Unix.  You also have the choice of using either slang or pdcurses.
+    See "http://www.flora.org/lynx-dev/html/month1097/msg00559.html" and
+    "http://www.flora.org/lynx-dev/html/month1097/msg00186.html", and other
+    messages along those threads.  You will have to make a minor alteration to
+    HTTCP.c (change delay to 30 seconds) and modify HTFILE.c (concerning
+    getgroups).  You will need a launch program to call helper applications.
+  
 
 V. Compile instructions -- 386 DOS
 
@@ -477,18 +491,27 @@ V. Compile instructions -- 386 DOS
     If all goes well, you will have a lynx.exe file.  If you have trouble,
     check to be sure djgpp.env is the way it came in the original package.  
 
-    You probably want to test lynx now, but lynx_386 won't work without a
-    packet driver installed.  For testing purposes, you can use
-    slip8250.com.  It is available in the  CRYNWR package (available at
-    "http://www.simtel.net/pub/simtelnet/msdos/pktdrvr/pktd11.zip").
-    Usage is "slip8250 0x60".  For connecting over a dialup PPP connection
-    you need a package such as dosppp or klos' pppshare (available at 
-    "http://www.simtel.net/pub/simtelnet/msdos/pktdrvr/dosppp05.zip" and
-    "ftp://ftp.klos.com/demo/pppshare.exe").
+    You'll want to test Lynx now, but Lynx_386 won't work without a packet
+    driver installed.  You can use slip8250.com, available in the CRYNWR
+    package "http://www.simtel.net/pub/simtelnet/msdos/pktdrvr/pktd11.zip".
+    Usage is "slip8250 0x60", but you may have to invoke it as, for example,
+    "slip8250  0x60 6 3 0x2F8" so that it uses COM2 and IRQ 3, in order to
+    avoid an IRQ conflict with a mouse or some other device.  Another packet
+    driver is slipper.exe, which is available from many sites, including
+    "ftp://jazz.trumpet.com.au/slipper".  To remove it from memory use 
+    termin.com (usage "termin 0x60"), available in the CRYNWR package.  To 
+    connect over a dialup PPP connection you need a package such as klos'
+    pppshare or dosppp (available at "ftp://ftp.klos.com/demo/pppshare.exe" and
+    "http://www.simtel.net/pub/simtelnet/msdos/pktdrvr/dosppp05.zip").
 
     See "http://www.fdisk.com/doslynx/lynxport.htm" for more hints and some
-    precompiled libraries.  If you compile lynx regularly, you may automate
-    the procedure by creating a batch file such as the following.
+    precompiled libraries.  One problem you can run into is when editing
+    userdefs.h and lynx.cfg, which have unix-style end of lines.  You would be
+    well advised to use an editor that can handle end of lines terminated with
+    a single LF character.  You can also unpack the source code using unzip386
+    or unzip with the -a switch to convert unix LF to dos CRLF.  That will make
+    texts more readable under DOS.  If you compile lynx regularly, you may
+    automate the procedure by creating a batch file such as the following.
 
 	cd djgpp\tcplib\obj
 	make
@@ -703,4 +726,4 @@ VIII. Acknowledgment
    Thanks to the many volunteers who offered suggestions for making this
    installation manual as accurate and complete as possible.
 
--- 1997/11/18 - H. Nelson <lynx-admin@irm.nara.kindai.ac.jp>
+-- 1997/12/26 - H. Nelson <lynx-admin@irm.nara.kindai.ac.jp>
diff --git a/LYMessages_en.h b/LYMessages_en.h
index dae472fb..7fb82e4e 100644
--- a/LYMessages_en.h
+++ b/LYMessages_en.h
@@ -159,8 +159,13 @@
 #define SPAWNING_MSG \
  "Spawning DCL subprocess.  Use 'logout' to return to Lynx.\n"
 #else
+#ifdef DOSPATH
+#define SPAWNING_MSG \
+ "Type EXIT to return to Lynx.\r\n"
+#else /* UNIX */
 #define SPAWNING_MSG \
  "Spawning your default shell.  Use 'exit' to return to Lynx.\n"
+#endif
 #endif /* VMS */
 #define SPAWNING_DISABLED "Spawning is currently disabled."
 #define DOWNLOAD_DISABLED "The 'd'ownload command is currently disabled."
@@ -310,6 +315,8 @@
 #define EDIT_A_PREV_GOTO "Edit a previous Goto URL: "
 #define CURRENT_DOC_HAS_POST_DATA "Current document has POST data."
 #define EDIT_CURDOC_URL "Edit this document's URL: "
+#define EDIT_CURLINK_URL "Edit the current link's URL: "
+#define EDIT_FM_MENU_URLS_DISALLOWED "You cannot edit File Management URLs"
 #define ENTER_DATABASE_QUERY "Enter a database query: "
 #define ENTER_WHEREIS_QUERY "Enter a whereis query: "
 #define EDIT_CURRENT_QUERY "Edit the current query: "
@@ -567,6 +574,8 @@
 #define SENDING_MESSAGE_WITH_BODY_TO \
  "You are sending a message with body to:\n  "
 #define SENDING_COMMENT_TO "You are sending a comment to:\n  "
+#define WITH_COPY_TO "\n With copy to:\n  "
+#define WITH_COPIES_TO "\n With copies to:\n  "
 #define CTRL_G_TO_CANCEL_SEND \
  "\n\nUse Ctrl-G to cancel if you do not want to send a message\n"
 #define ENTER_NAME_OR_BLANK \
@@ -589,6 +598,8 @@
  "\n on a line and press enter again."
 #define ADVANCED_COOKIE_CONFIRMATION \
  "%s cookie: %.*s=%.*s  Allow? (Y/N/Always/neVer)"
+#define INVALID_COOKIE_DOMAIN_CONFIRMATION \
+ "Accept invalid cookie domain=%s for '%s'?"
 #define ALLOWING_COOKIE "Allowing this cookie."
 #define REJECTING_COOKIE "Rejecting this cookie."
 #define COOKIE_JAR_IS_EMPTY "The Cookie Jar is empty."
diff --git a/PROBLEMS b/PROBLEMS
index 772c0b1c..bc02f014 100644
--- a/PROBLEMS
+++ b/PROBLEMS
@@ -88,12 +88,15 @@ they will be outlined in this file.
     Teiser (dsteis01@homer.louisville.edu)
     NOTE: If HP fixes the problem or you come up with a better workaround,
           notify the lynx-dev@sig.net list.
-    Updated NOTE (09-02-96):  A patch reportedly is available from HP to fix
-          the select() problem, so that "-lc" is no longer needed, but the
-	  curses glitch is not yet fixed, and you should still include
+    Updated NOTE (1996-09-02):  A patch reportedly is available from HP to
+          fix the select() problem, so that "-lc" is no longer needed, but
+	  the curses glitch is not yet fixed, and you should still include
 	  "-lHcurses". 
-    Updated NOTE (02-03-97): The problems reportedly are fixed with
-    	  patches PHCO_8086 and PHCO_8947 from HP.
+    Updated NOTE (1997-02-03): The problems reportedly are fixed with
+	  patches PHCO_8086 and PHCO_8947 from HP.
+    Updated NOTE (1997-12-15): PHCO_8086 & PHCO_8947 are very old and are
+	  no longer available.  The current patch to install if running
+	  under HP-UX 10.20 is PHCO_11342.
 
     Lynx juggles variable abilities of curses packages or emulations to
     display bolding and underlining simultaneously.  This may fail if
diff --git a/README.configure b/README.configure
index 3d1c8892..8f0f3080 100644
--- a/README.configure
+++ b/README.configure
@@ -143,13 +143,26 @@ the script:
   	Use this option to compile-in support for debugging.
 	(The symbol DEBUG is always defined).
 
-  --enable-externs			(define USE_EXTERNS)
+  --enable-externs			(define USE_EXTERNALS)
   	Use this option to compile-in support for passing URLs to external
 	programs.
 
   --enable-find-leaks			(defines LY_FIND_LEAKS)
   	Use this option to compile-in logic for testing memory leaks.
 
+  --enable-font-switch			(defines EXP_CHARTRANS_AUTOSWITCH)
+	Use this option to compile-in support for Linux setfont program,
+	to switch between fonts automatically.
+
+  --enable-nsl-fork			(defines NSL_FORK)
+  	Use this option to compile-in code that forks off gethostbyname
+	lookups so the 'z' key can be used to abort a lookup that hangs
+	or takes forever.
+
+  --enable-underlines			(defines UNDERLINE_LINKS)
+  	Use this option to compile-in logic that makes links underlined
+	rather than boldface.
+
   --enable-warnings
   	Use this option to turn on GCC compiler warnings.
 
diff --git a/WWW/Library/Implementation/HTBTree.c b/WWW/Library/Implementation/HTBTree.c
index cc90111a..6515be77 100644
--- a/WWW/Library/Implementation/HTBTree.c
+++ b/WWW/Library/Implementation/HTBTree.c
@@ -550,8 +550,8 @@ PUBLIC HTBTElement * HTBTree_next ARGS2(
             printf("Objet du fils droit = %s\n",
 		   (char *)father_of_element->right->object);
         else printf("Pas de fils droit\n");
-        printf("Profondeur gauche = %i\t",father_of_element->left_depth);
-        printf("Profondeur droite = %i\n",father_of_element->right_depth);
+        printf("Profondeur gauche = %d\t",father_of_element->left_depth);
+        printf("Profondeur droite = %d\n",father_of_element->right_depth);
         printf("      **************\n");
     }
 #endif
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index 615ddcee..c347116a 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -55,7 +55,7 @@
 ** If LISTEN is not defined, PASV is used instead of PORT, and not
 ** all FTP servers support PASV, so define it unless there is no
 ** alternative for your system.
-*/ 
+*/
 #ifndef NOPORT
 #define LISTEN	 /* @@@@ Test LJM */
 #endif /* !NOPORT */
@@ -65,11 +65,11 @@ BUGS:	@@@  	Limit connection cache size!
 		Error reporting to user.
 		400 & 500 errors are acked by user with windows.
 		Use configuration file for user names
-		
+
 **		Note for portablility this version does not use select() and
 **		so does not watch the control and data channels at the
 **		same time.
-*/		
+*/
 
 #ifdef DJGPP
 #define u_long unsigned long
@@ -92,7 +92,7 @@ BUGS:	@@@  	Limit connection cache size!
 #define LISTEN_BACKLOG 2	/* Number of pending connect requests (TCP)*/
 
 #define FIRST_TCP_PORT	1024	/* Region to try for a listening port */
-#define LAST_TCP_PORT	5999	
+#define LAST_TCP_PORT	5999
 
 #define LINE_LENGTH 256
 #define COMMAND_LENGTH 256
@@ -150,7 +150,7 @@ PUBLIC BOOLEAN HTfileSortMethod = FILE_BY_NAME;
 PRIVATE char ThisYear[8];
 PRIVATE char LastYear[8];
 PRIVATE int TheDate;
-PRIVATE BOOLEAN HaveYears = FALSE; 
+PRIVATE BOOLEAN HaveYears = FALSE;
 #ifdef SOCKS
 extern BOOLEAN socks_flag;
 extern unsigned long socks_bind_remoteAddr;
@@ -244,14 +244,14 @@ PRIVATE void free_FTPGlobals NOARGS
 ** Bug:	Returns pointer to static -- non-reentrant
 */
 PUBLIC char * HTMake_VMS_name ARGS2(
-	CONST char *,	nn, 
+	CONST char *,	nn,
 	CONST char *,	fn)
 {
 
 /*	We try converting the filename into Files-11 syntax. That is, we assume
 **	first that the file is, like us, on a VMS node. We try remote
 **	(or local) DECnet access. Files-11, VMS, VAX and DECnet
-**	are trademarks of Digital Equipment Corporation. 
+**	are trademarks of Digital Equipment Corporation.
 **	The node is assumed to be local if the hostname WITHOUT DOMAIN
 **	matches the local one. @@@
 */
@@ -260,7 +260,7 @@ PUBLIC char * HTMake_VMS_name ARGS2(
     char * nodename = (char*)malloc(strlen(nn)+2+1);	/* Copies to hack */
     char *second;		/* 2nd slash */
     char *last;			/* last slash */
-    
+
     CONST char * hostname = HTHostName();
 
     if (!filename || !nodename)
@@ -285,7 +285,7 @@ PUBLIC char * HTMake_VMS_name ARGS2(
 
     second = strchr(filename+1, '/');		/* 2nd slash */
     last = strrchr(filename, '/');	/* last slash */
-        
+
     if (!second) {				/* Only one slash */
 	sprintf(vmsname, "%s%s", nodename, filename + 1);
     } else if (second == last) {		/* Exactly two slashes */
@@ -377,7 +377,7 @@ PRIVATE void help_message_cache_add ARGS1(
 {
     if (help_message_buffer)
         StrAllocCat(help_message_buffer, string);
-    else	
+    else
         StrAllocCopy(help_message_buffer, string);
 
     if (TRACE)
@@ -421,13 +421,13 @@ PRIVATE int response ARGS1(
     int	continuation_response = -1;
     int status;
     extern int interrupted_in_htgetcharacter;
-    
+
     if (!control) {
           if (TRACE)
 	      fprintf(stderr, "HTFTP: No control connection set up!!\n");
 	  return -99;
     }
-    
+
     if (cmd) {
 	if (TRACE)
 	    fprintf(stderr, "  Tx: %s", cmd);
@@ -442,7 +442,7 @@ PRIVATE int response ARGS1(
 	status = NETWRITE(control->socket, cmd, (int)strlen(cmd));
 	if (status < 0) {
 	    if (TRACE)
-	        fprintf(stderr, 
+	        fprintf(stderr,
 	    		"HTFTP: Error %d sending command: closing socket %d\n",
 			status, control->socket);
 	    close_connection(control);
@@ -452,7 +452,7 @@ PRIVATE int response ARGS1(
 
     do {
 	char *p = response_text;
-	for (;;) {  
+	for (;;) {
 	    if (((*p++ = NEXT_CHAR) == LF)
 			|| (p == &response_text[LINE_LENGTH])) {
 
@@ -486,10 +486,10 @@ PRIVATE int response ARGS1(
 			if (continuation_response == result &&
 			    continuation == ' ')
 			    continuation_response = -1;	/* ended */
-		}	
-		break;	    
+		}
+		break;
 	    } /* if end of line */
-	    
+
 	    if (interrupted_in_htgetcharacter)
                {
                     if (TRACE)
@@ -511,7 +511,7 @@ PRIVATE int response ARGS1(
 	} /* Loop over characters */
 
     } while (continuation_response != -1);
-    
+
     if (result == 421) {
 	if (TRACE)
 	    fprintf(stderr, "HTFTP: They close so we close socket %d\n",
@@ -576,7 +576,7 @@ PRIVATE void get_ftp_pwd ARGS2(
 			 			 "NCSA" : "TCPC"));
         } else if (response_text[5] == '/') {
             /* path names beginning with / imply Unix,
-	     * right? 
+	     * right?
 	     */
 	    if (set_mac_binary(*server_type)) {
 		*server_type = NCSA_SERVER;
@@ -635,9 +635,6 @@ PRIVATE int get_connection ARGS2(
     char * password = NULL;
     static BOOLEAN firstuse = TRUE;
 
-    if (!arg) return -1;		/* Bad if no name sepcified	*/
-    if (!*arg) return -1;		/* Bad if name had zero length	*/
-
     if (firstuse) {
 	/*
 	**  Set up freeing at exit. - FM
@@ -648,11 +645,14 @@ PRIVATE int get_connection ARGS2(
 
     if (control) {
 	/*
-	**  Reuse this object - KW
+	**  Reuse this object - KW, DW & FM
 	*/
-	if (control->socket != -1)
+	if (control->socket != -1) {
 	    NETCLOSE(control->socket);
+	}
 	con = control;
+	con->addr = 0;
+	con->binary = FALSE;
     } else {
 	/*
 	**  Allocate and init control struct.
@@ -661,8 +661,12 @@ PRIVATE int get_connection ARGS2(
 	if (con == NULL)
 	    outofmem(__FILE__, "get_connection");
     }
+
     con->socket = -1;
 
+    if (!arg) return -1;		/* Bad if no name specified	*/
+    if (!*arg) return -1;		/* Bad if name had zero length	*/
+
 /* Get node name:
 */
     {
@@ -676,11 +680,11 @@ PRIVATE int get_connection ARGS2(
 	    p1 = p2+1;			/* point to host */
 	    pw = strchr(username, ':');
 	    if (pw != NULL) {
-	        *pw++ = '\0';
+		*pw++ = '\0';
 		password = HTUnEscape(pw);
 	    }
 	    if (*username)
-	        HTUnEscape(username);
+		HTUnEscape(username);
 
 	    /*
 	     *  If the password doesn't exist then we are going to have
@@ -712,14 +716,12 @@ PRIVATE int get_connection ARGS2(
 	    }
 	}
 
-        if (!username)
+	if (!username)
 	    FREE(p1);
     } /* scope of p1 */
 
-        
-  con->socket = -1;
   status = HTDoConnect (arg, "FTP", IPPORT_FTP, (int *)&con->socket);
-   
+
   if (status < 0)
     {
       if (TRACE)
@@ -933,7 +935,7 @@ PRIVATE int get_connection ARGS2(
             server_type = MSDOS_SERVER;
 	    use_list = TRUE;
 	    if (TRACE)
-	        fprintf(stderr, 
+	        fprintf(stderr,
 	 	 	"HTFTP: Treating as MSDOS (Unix emulation) server.\n");
 
         } else if (strncmp(response_text+4, "VMS", 3) == 0) {
@@ -1002,7 +1004,7 @@ PRIVATE int get_connection ARGS2(
 	    if (TRACE)
 	        fprintf(stderr, "HTFTP: Ugh!  A Generic server.\n");
             get_ftp_pwd(&server_type, &use_list);
-	    unsure_type = TRUE;   
+	    unsure_type = TRUE;
 	 }
     } else {
 	/* SYST fails :(  try to get the type from the PWD command */
@@ -1069,11 +1071,11 @@ PRIVATE int get_listen_socket NOARGS
     struct sockaddr_in soc_address;	/* Binary network address */
     struct sockaddr_in* sin = &soc_address;
     int new_socket;			/* Will be master_socket */
-    
-    
+
+
     FD_ZERO(&open_sockets);	/* Clear our record of open sockets */
     num_sockets = 0;
-    
+
 #ifndef REPEAT_LISTEN
     if (master_socket >= 0)
         return master_socket;  /* Done already */
@@ -1082,13 +1084,13 @@ PRIVATE int get_listen_socket NOARGS
 /*  Create internet socket
 */
     new_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-	
+
     if (new_socket < 0)
 	return HTInetStatus("socket for master socket");
-    
+
     if (TRACE)
         fprintf(stderr, "HTFTP: Opened master socket number %d\n", new_socket);
-    
+
 /*  Search for a free port.
 */
     sin->sin_family = AF_INET;	    /* Family = internet, host order  */
@@ -1096,7 +1098,7 @@ PRIVATE int get_listen_socket NOARGS
 #ifdef POLL_PORTS
     {
         unsigned short old_port_number = port_number;
-	for (port_number = (old_port_number+1); ; port_number++) { 
+	for (port_number = (old_port_number+1); ; port_number++) {
 	    int status;
 	    if (port_number > LAST_TCP_PORT)
 		port_number = FIRST_TCP_PORT;
@@ -1123,7 +1125,7 @@ PRIVATE int get_listen_socket NOARGS
 		    sizeof(soc_address))) == 0)
 		break;
 	    if (TRACE)
-	        fprintf(stderr, 
+	        fprintf(stderr,
 	    		"TCP bind attempt to port %d yields %d, errno=%d\n",
 		port_number, status, SOCKET_ERRNO);
 	} /* for */
@@ -1145,7 +1147,7 @@ PRIVATE int get_listen_socket NOARGS
 	if (status<0) return HTInetStatus("getsockname");
 	CTRACE(tfp, "HTFTP: This host is %s\n",
 	    HTInetString(sin));
-	
+
 	soc_address.sin_port = 0;	/* Unspecified: please allocate */
 #ifdef SOCKS
 	if (socks_flag)
@@ -1164,7 +1166,7 @@ PRIVATE int get_listen_socket NOARGS
 		    /* Cast to generic sockaddr */
 		    sizeof(soc_address));
 	if (status<0) return HTInetStatus("bind");
-	
+
 	address_length = sizeof(soc_address);
 #ifdef SOCKS
 	if (socks_flag)
@@ -1188,9 +1190,9 @@ PRIVATE int get_listen_socket NOARGS
     if (master_socket >= 0)
         (void) close_master_socket();
 #endif /* REPEAD_LISTEN */
-    
+
     master_socket = new_socket;
-    
+
 /*	Now we must find out who we are to tell the other guy
 */
     (void)HTHostName(); 	/* Make address valid - doesn't work*/
@@ -1448,7 +1450,7 @@ PRIVATE void parse_ls_line ARGS2(
 	        entry_info->date[j] = entry_info->date[j-1];
 	    }
 	}
-    } 
+    }
     j = i - 14;
     while (isdigit(line[j])) {
         size_num += (line[j] - '0') * base;
@@ -1630,7 +1632,7 @@ PRIVATE void parse_ms_windows_dir_entry ARGS2(
 
     /** Cut out file or directory name. **/
     cps = cp;
-    while (*cps && !isspace(*cps)) 
+    while (*cps && !isspace(*cps))
 	cps++;
     *cps++ ='\0';
     cpd = cps;
@@ -1714,7 +1716,7 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2(
     /** Cut out file or directory name. **/
     cpd = cp;
     cps = (end-1);
-    while (cps >= cpd && !isspace(*cps)) 
+    while (cps >= cpd && !isspace(*cps))
 	cps--;
     cp = (cps+1);
     if (!strcmp(cp, ".") || !strcmp(cp, "..")) {
@@ -1839,7 +1841,7 @@ PRIVATE void parse_cms_dir_entry ARGS2(
 
     /** Cut out file or directory name. **/
     cps = cp;
-    while (*cps && !isspace(*cps)) 
+    while (*cps && !isspace(*cps))
 	cps++;
     *cps++ ='\0';
     StrAllocCopy(entry_info->filename, cp);
@@ -1857,7 +1859,7 @@ PRIVATE void parse_cms_dir_entry ARGS2(
         return;
     }
     cps = cp;
-    while (*cps && !isspace(*cps)) 
+    while (*cps && !isspace(*cps))
 	cps++;
     *cps++ ='\0';
     if ((0 == strcasecomp(cp, "DIR")) && (cp - line) > 17) {
@@ -1974,8 +1976,8 @@ PRIVATE void parse_cms_dir_entry ARGS2(
 } /* parse_cms_dir_entry */
 
 /*
- *     parse_dir_entry() 
- *      Given a line of LIST/NLST output in entry, return results 
+ *     parse_dir_entry()
+ *      Given a line of LIST/NLST output in entry, return results
  *      and a file/dir name in entry_info struct
  *
  *      If first is true, this is the first name in a directory.
@@ -1991,7 +1993,7 @@ PRIVATE EntryInfo * parse_dir_entry ARGS2(
     BOOLEAN remove_size=FALSE;
     char *cp;
 
-    entry_info = (EntryInfo *)malloc(sizeof(EntryInfo));    
+    entry_info = (EntryInfo *)malloc(sizeof(EntryInfo));
     entry_info->filename = NULL;
     entry_info->type = NULL;
     entry_info->date = NULL;
@@ -2013,7 +2015,7 @@ PRIVATE EntryInfo * parse_dir_entry ARGS2(
 		parse_eplf_line(entry, entry_info);
 		break;
 	    }
-  
+
             /*
 	    **  Interpret and edit LIST output from Unix server.
 	    */
@@ -2046,7 +2048,7 @@ PRIVATE EntryInfo * parse_dir_entry ARGS2(
                 /*
 		**  It's a directory.
 		*/
-                StrAllocCopy(entry_info->type, "Directory"); 
+                StrAllocCopy(entry_info->type, "Directory");
 	        remove_size=TRUE; /* size is not useful */
 	    } else if (entry[0] == 'l') {
                 /*
@@ -2054,7 +2056,7 @@ PRIVATE EntryInfo * parse_dir_entry ARGS2(
 		**  knowing if it is symbolic?  I think so since
 		**  it might be a directory.
 		*/
-                StrAllocCopy(entry_info->type, "Symbolic Link"); 
+                StrAllocCopy(entry_info->type, "Symbolic Link");
 		remove_size=TRUE; /* size is not useful */
 
                 /*
@@ -2072,7 +2074,7 @@ PRIVATE EntryInfo * parse_dir_entry ARGS2(
                 }
             } /* link */
 
-	    parse_ls_line(entry, entry_info); 
+	    parse_ls_line(entry, entry_info);
 
 	    if (!strcmp(entry_info->filename,"..") ||
 	        !strcmp(entry_info->filename,"."))
@@ -2101,7 +2103,7 @@ PRIVATE EntryInfo * parse_dir_entry ARGS2(
 	    len = strlen(entry_info->filename);
             if ((len > 4) && !strcmp(&entry_info->filename[len-4], ".dir")) {
 		entry_info->filename[len-4] = '\0';
-                StrAllocCopy(entry_info->type, "Directory"); 
+                StrAllocCopy(entry_info->type, "Directory");
 		remove_size=TRUE; /* size is not useful */
 	    }
 	    /*
@@ -2195,7 +2197,7 @@ PRIVATE EntryInfo * parse_dir_entry ARGS2(
 	    **  Goto the bottom and get real type.
 	    */
             break;
-	
+
 	default:
 	    /*
 	    **  We can't tell if it is a directory since we only
@@ -2254,7 +2256,7 @@ PRIVATE EntryInfo * parse_dir_entry ARGS2(
 } /* parse_dir_entry */
 
 PRIVATE int compare_EntryInfo_structs ARGS2(
-	EntryInfo *,	entry1, 
+	EntryInfo *,	entry1,
 	EntryInfo *,	entry2)
 {
     int i, status;
@@ -2428,7 +2430,7 @@ PRIVATE int read_directory ARGS4(
     **  for Unix ftp servers. - FM
     */
     need_parent_link = HTDirTitles(target, (HTAnchor*)parent, tildeIsTop);
-  
+
     data_read_pointer = data_write_pointer = data_buffer;
 
     if (*filename == '\0') {		  /* Empty filename: use root. */
@@ -2438,7 +2440,7 @@ PRIVATE int read_directory ARGS4(
     } else {
         char * p = strrchr(filename, '/');	     /* Find the lastslash. */
 	char *cp;
-	
+
 	if (server_type == CMS_SERVER) {
 	    StrAllocCopy(lastpath, filename); /* Use absolute path for CMS. */
 	} else {
@@ -2455,7 +2457,7 @@ PRIVATE int read_directory ARGS4(
     }
     FREE (filename);
 
-   
+
     {
         HTBTree * bt = HTBTree_new((HTComparer)compare_EntryInfo_structs);
         char c;
@@ -2492,7 +2494,7 @@ AgainForMultiNet:
                         HTBTreeAndObject_free(bt);
                         return HT_INTERRUPTED;
                     }
-		} else if (c == CR || c == LF) {    /* Terminator? */ 
+		} else if (c == CR || c == LF) {    /* Terminator? */
 		    if (chunk->size != 0) {  /* got some text */
 		        /* Deal with MultiNet's wrapping of long lines */
                         if (server_type == VMS_SERVER) {
@@ -2574,12 +2576,12 @@ unload_btree:
 	    PUTS("\n");
 	}
 
-	/* Put up header 
+	/* Put up header
 	 */
-	/* PUTS("    Date        Type             Size     Filename\n"); 
+	/* PUTS("    Date        Type             Size     Filename\n");
 	 */
-	   
-	/* Run through tree printing out in order 
+
+	/* Run through tree printing out in order
 	 */
 	{
 	    HTBTElement * ele;
@@ -2604,7 +2606,7 @@ unload_btree:
 		}
 
 		/* start the anchor */
-		HTDirEntry(target, lastpath, entry_info->filename);  
+		HTDirEntry(target, lastpath, entry_info->filename);
 		PUTS(entry_info->filename);
 		END(HTML_A);
 
@@ -2674,7 +2676,7 @@ PUBLIC int HTFTPLoad ARGS4(
     int retry;			/* How many times tried? */
     HTFormat format;
     char command[LINE_LENGTH+1];
-    
+
 
     /* set use_list to NOT since we don't know what kind of server
      * this is yet.  And set the type to GENERIC
@@ -2697,7 +2699,7 @@ PUBLIC int HTFTPLoad ARGS4(
                somehow in the middle of it, which we currently can't. */
 	    return status;
 	}
-    
+
 #ifdef REPEAT_PORT
 /*	Inform the server of the port number we will listen on
 */
@@ -2743,7 +2745,7 @@ PUBLIC int HTFTPLoad ARGS4(
 
 	    while (--p > response_text && '0' <= *p && *p <= '9')
 		; /* null body */
-	
+
            status = sscanf(p+1, "%d,%d,%d,%d,%d,%d",
                    &h0, &h1, &h2, &h3, &p0, &p1);
            if (status < 4) {
@@ -2767,7 +2769,7 @@ PUBLIC int HTFTPLoad ARGS4(
 		NETCLOSE(data_soc);
 		return status;			/* Bad return */
 	    }
-	    
+
 	    if (TRACE)
 	        fprintf(stderr, "FTP data connected, socket %d\n", data_soc);
 	}
@@ -2778,9 +2780,9 @@ PUBLIC int HTFTPLoad ARGS4(
     } /* for retries */
     if (status < 0)
         return status;		/* Failed with this code */
-    
+
 /*	Ask for the file:
-*/    
+*/
     {
         char *filename = HTParse(name, "", PARSE_PATH + PARSE_PUNCTUATION);
 	char *fname = filename;	/** Save for subsequent free() **/
@@ -3056,7 +3058,7 @@ PUBLIC int HTFTPLoad ARGS4(
 			    strcpy(cp, "000000");
 			    filename = cp;
 			}
-		    } 
+		    }
 		} else if (0==strcmp(cp, (filename+1))) {
 		    sprintf(command, "CWD %s%c%c", cp, CR, LF);
 		    status = response (command);
@@ -3335,7 +3337,7 @@ listen:
 	        (FileName[len - 2] == '.' ||
 		 FileName[len - 2] == '-' ||
 		 FileName[len - 2] == '_')) {
-		
+
 		FileName[len - 2] = '\0';
 		format = HTFileFormat(FileName, &encoding, NULL);
 		format = HTCharsetFormat(format, anchor, -1);
@@ -3366,7 +3368,7 @@ listen:
 
 	HTInitInput(control->socket);
 	/* Reset buffering to control connection DD 921208 */
-    
+
 	status = NETCLOSE(data_soc);
 	if (TRACE)
 	    fprintf(stderr, "HTFTP: Closing data socket %d\n", data_soc);
@@ -3386,7 +3388,7 @@ listen:
 	control->socket = -1;
 	init_help_message_cache();  /* to free memory */
 	return HT_LOADED;
-    }       
+    }
 } /* open_file_read */
 
 /*
diff --git a/WWW/Library/Implementation/HTList.c b/WWW/Library/Implementation/HTList.c
index c8f191df..839e961d 100644
--- a/WWW/Library/Implementation/HTList.c
+++ b/WWW/Library/Implementation/HTList.c
@@ -117,7 +117,7 @@ PUBLIC void HTList_insertObjectAt ARGS3(
 	Pos = 0;
 	if (TRACE) {
 	    fprintf(stderr,
-		    "HTList: Treating negative object position %i as %i.\n",
+		    "HTList: Treating negative object position %d as %d.\n",
 		    pos, Pos);
 	}
     }
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index 814ed9c7..7108018a 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -1696,7 +1696,7 @@ PRIVATE void HTMIME_put_character ARGS2(
 	        HTMIME_TrimDoubleQuotes(me->value);
                 if (TRACE)
                     fprintf(stderr,
-		    	    "HTMIME: PICKED UP Content-Base: '%s'\n",
+		    	    "HTMIME: PICKED UP Content-Features: '%s'\n",
 			    me->value);
                 break;
 	    case miCONTENT_LANGUAGE:
@@ -2260,8 +2260,6 @@ PUBLIC HTStream* HTNetMIME ARGS3(
 **
 **	Written by S. Ichikawa,
 **	partially inspired by encdec.c of <jh@efd.lth.se>.
-**
-**	Generalized HTmmdecode for chartrans - K. Weide 1997-03-06
 */
 #define	BUFLEN	1024
 #ifdef ESC
@@ -2347,6 +2345,10 @@ PUBLIC void HTmmdec_quote ARGS2(
     strcpy(t, buf);
 }
 
+#ifdef NOTDEFINED
+/*
+**	Generalized HTmmdecode for chartrans - K. Weide 1997-03-06
+*/
 PUBLIC void HTmmdecode ARGS2(
 	char *,		trg,
 	char *,		str)
@@ -2440,6 +2442,71 @@ PUBLIC void HTmmdecode ARGS2(
 end:
     strcpy(trg, buf);
 }
+#else
+/*
+**	HTmmdecode for ISO-2022-JP - FM
+*/
+PUBLIC void HTmmdecode ARGS2(
+	char *,		trg,
+	char *,		str)
+{
+    char buf[BUFLEN], mmbuf[BUFLEN];
+    char *s, *t, *u;
+    int  base64, quote;
+
+    buf[0] = '\0';
+
+    for (s = str, u = buf; *s; ) {
+	if (!strncasecomp(s, "=?ISO-2022-JP?B?", 16)) {
+	    base64 = 1;
+	} else {
+	    base64 = 0;
+	}
+	if (!strncasecomp(s, "=?ISO-2022-JP?Q?", 16)) {
+	    quote = 1;
+	} else {
+	    quote = 0;
+	}
+	if (base64 || quote) {
+	    if (HTmmcont) {
+		for (t = s - 1;
+		    t >= str && (*t == ' ' || *t == '\t'); t--) {
+			u--;
+		}
+	    }
+	    for (s += 16, t = mmbuf; *s; ) {
+		if (s[0] == '?' && s[1] == '=') { 
+		    break;
+		} else {
+		    *t++ = *s++;
+		}
+	    }
+	    if (s[0] != '?' || s[1] != '=') {
+		goto end;
+	    } else {
+		s += 2;
+		*t = '\0';
+	    }
+	    if (base64)
+	        HTmmdec_base64(mmbuf, mmbuf);
+	    if (quote)
+	        HTmmdec_quote(mmbuf, mmbuf);
+	    for (t = mmbuf; *t; )
+	        *u++ = *t++;
+	    HTmmcont = 1;
+	    /* if (*s == ' ' || *s == '\t') *u++ = *s; */
+	    /* for ( ; *s == ' ' || *s == '\t'; s++) ; */
+	} else {
+	    if (*s != ' ' && *s != '\t')
+	        HTmmcont = 0;
+	    *u++ = *s++;
+	}
+    }
+    *u = '\0';
+end:
+    strcpy(trg, buf);
+}
+#endif /* NOTDEFINED */
 
 /* 
 **  Modified for Lynx-jp by Takuya ASADA (and K&Rized by FM).
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index 129af946..76be1d77 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -475,16 +475,18 @@ PUBLIC void HTSimplify ARGS1(
 	    }
 	    if (*p == '/') {
 		if ((p[1] == '.') && (p[2] == '.') &&
-		    (p[3] == '/' || p[3] == '\0')) {
+		    (p[3] == '/' || p[3] == '?' || p[3] == '\0')) {
 		    /*
-		    **  Handle "/../" or "/..".
+		    **  Handle "../", "..?" or "..".
 		    */
 		    for (q = (p - 1); (q >= filename) && (*q != '/'); q--)
 			/*
 			**  Back up to previous slash or beginning of string.
 			*/
 		        ;
-		    if ((q[0] == '/') && strncmp(q, "/../", 4) &&
+		    if ((q[0] == '/') &&
+		        (strncmp(q, "/../", 4) &&
+			 strncmp(q, "/..?", 4)) &&
 		        !((q - 1) > filename && q[-1] == '/')) {
 			/*
 			**  Not at beginning of string or in a
@@ -511,7 +513,7 @@ PUBLIC void HTSimplify ARGS1(
 		    }
 		} else if (p[1] == '.' && p[2] == '/') {
 		    /*
-		    **  Handle "/." by removing the characters.
+		    **  Handle "./" by removing both characters.
 		    */
 		    q = p;
 		    q1 = (p + 2);
@@ -519,6 +521,16 @@ PUBLIC void HTSimplify ARGS1(
 		       *q++ = *q1++;
 		    *q = '\0';		/* terminate */
 		    p--;
+		} else if (p[1] == '.' && p[2] == '?') {
+		    /*
+		    **  Handle ".?" by removing the dot.
+		    */
+		    q = (p + 1);
+		    q1 = (p + 2);
+		    while (*q1 != '\0')
+		       *q++ = *q1++;
+		    *q = '\0';		/* terminate */
+		    p--;
 		} else if (p[1] == '.' && p[2] == '\0') {
 		    /*
 		    **  Handle terminal "." by removing the character.
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index fc279af6..4c577ffd 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -130,7 +130,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
   BOOL auth_proxy = NO;		/* Generate a proxy authorization. - AJL */
 
   int length, rv;
-  BOOL doing_redirect, already_retrying = FALSE;
+  BOOL doing_redirect, already_retrying = FALSE, bad_location = FALSE;
   int len = 0;
 
   void * handle = NULL;
@@ -987,8 +987,8 @@ try_again:
 	    **  Various forms of Redirection. - FM
 	    **  300 Multiple Choices.
 	    **  301 Moved Permanently.
-	    **  302 General (temporary) Redirection (we can, and do, use GET).
-	    **  303 See Other (always use GET).
+	    **  302 Found (temporary; we can, and do, use GET).
+	    **  303 See Other (temporary; always use GET).
 	    **  304 Not Modified.
 	    **  305 Use Proxy.
 	    **  306 Set Proxy.
@@ -1047,24 +1047,12 @@ try_again:
 		break;
 	    }
 
-	    if (server_status == 305) { /* Use Proxy */
-		/*
-		 *  We don't want to compound proxying, so if we
-		 *  got this from a proxy, just show any message
-		 *  to the user.  Otherwise, we look for a Location:
-		 *  header and use that if present.  We should also
-		 *  look for a Set-Proxy: header, but that's not yet
-		 *  implemented. - FM
-		 */
-		if (using_proxy) {
-		    HTAlert("Got redirection to a proxy from the proxy!");
-		    break;
-		}
-	    } else if (server_status == 306 || server_status > 307) {
+	    if (server_status == 305 ||
+		server_status == 306 ||
+		server_status > 307) {
 	        /*
-		 *  Show user the content, if any, for 306 until we
-		 *  implement Set-Proxy: header handling, and for
-		 *  redirection statuses we don't know. - FM
+		 *  Show user the content, if any, for 305, 306,
+		 *  or unknown status. - FM
 		 */
 		HTAlert(line_buffer);
 		if (traversal) {
@@ -1385,11 +1373,8 @@ Cookie2_continuation:
 			        *cp1 = LF;
 			    if (cp2)
 			        *cp2 = CR;
+			    bad_location = TRUE;
 			    FREE(redirecting_url);
-			    doing_redirect = FALSE;
-			    permanent_redirection = FALSE;
-			    start_of_data = line_kept_clean;
-			    length = strlen(start_of_data);
 			    HTAlert(
 			       "Got redirection with a bad Location header.");
 			    HTProgress(line_buffer);
@@ -1494,8 +1479,10 @@ Cookie2_continuation:
 	      permanent_redirection = FALSE;
 	      start_of_data = line_kept_clean;
 	      length = strlen(start_of_data);
-	      HTAlert("Got redirection with no Location header.");
-	      HTProgress(line_buffer);
+	      if (!bad_location) {
+		  HTAlert("Got redirection with no Location header.");
+		  HTProgress(line_buffer);
+	      }
 	      if (traversal) {
 		  HTTP_NETCLOSE(s, handle);
 		  status = -1;
diff --git a/aclocal.m4 b/aclocal.m4
index 4cfb3777..a3697fae 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -4,7 +4,7 @@ dnl and Jim Spath <jspath@mail.bcpl.lib.md.us>
 dnl and Philippe De Muyter <phdm@macqel.be>
 dnl
 dnl Created: 1997/1/28
-dnl Updated: 1997/11/23
+dnl Updated: 1997/12/23
 dnl
 dnl ---------------------------------------------------------------------------
 dnl ---------------------------------------------------------------------------
@@ -154,35 +154,53 @@ eval 'cf_result=$cf_cv_dcl_'$1
 AC_MSG_RESULT($cf_result)
 
 # It's possible (for near-UNIX clones) that the data doesn't exist
+AC_CACHE_VAL(cf_cv_have_$1,[
 if test $cf_result = no ; then
     eval 'cf_result=DECL_'$1
     CF_UPPER(cf_result,$cf_result)
     AC_DEFINE_UNQUOTED($cf_result)
     AC_MSG_CHECKING([existence of $1])
-    AC_CACHE_VAL(cf_cv_have_$1,[
         AC_TRY_LINK([
 #undef $1
 extern long $1;
 ],
             [$1 = 2],
             [eval 'cf_cv_have_'$1'=yes'],
-            [eval 'cf_cv_have_'$1'=no'])])
-    eval 'cf_result=$cf_cv_have_'$1
-    AC_MSG_RESULT($cf_result)
+            [eval 'cf_cv_have_'$1'=no'])
+        eval 'cf_result=$cf_cv_have_'$1
+        AC_MSG_RESULT($cf_result)
+else
+    eval 'cf_cv_have_'$1'=yes'
 fi
+])
+eval 'cf_result=HAVE_'$1
+CF_UPPER(cf_result,$cf_result)
+eval 'test $cf_cv_have_'$1' = yes && AC_DEFINE_UNQUOTED($cf_result)'
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check if a function is declared by including a set of include files.
 dnl Invoke the corresponding actions according to whether it is found or not.
+dnl
+dnl Gcc (unlike other compilers) will only warn about the miscast assignment
+dnl in the first test, but most compilers will oblige with an error in the
+dnl second test.
+dnl
 dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
 AC_DEFUN(CF_CHECK_FUNCDECL,
-[AC_MSG_CHECKING([for $2 declaration])
+[
+AC_MSG_CHECKING([for $2 declaration])
 AC_CACHE_VAL(ac_cv_func_decl_$2,
 [AC_TRY_COMPILE([$1],
 [#ifndef ${ac_func}
+extern	int	${ac_func}();
+#endif],[
+AC_TRY_COMPILE([$1],
+[#ifndef ${ac_func}
 int	(*p)() = ${ac_func};
-#endif],
-eval "ac_cv_func_decl_$2=yes", eval "ac_cv_func_decl_$2=no")])dnl
+#endif],[
+eval "ac_cv_func_decl_$2=yes"],[
+eval "ac_cv_func_decl_$2=no"])],[
+eval "ac_cv_func_decl_$2=yes"])])
 if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
   AC_MSG_RESULT(yes)
   ifelse([$3], , :, [$3])
@@ -249,38 +267,67 @@ freebsd*) #(vi
 		# HP's header uses __HP_CURSES, but user claims _HP_CURSES.
 		LIBS="-lHcurses $LIBS"
 		CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS"
+		ac_cv_func_initscr=yes
 		],[
 	AC_CHECK_LIB(cur_color,initscr,[
 		LIBS="-lcur_color $LIBS"
 		CFLAGS="-I/usr/include/curses_colr $CFLAGS"
+		ac_cv_func_initscr=yes
 		])])
 	;;
 esac
+
 if test -d /usr/5lib ; then
 	# SunOS 3.x or 4.x
 	CPPFLAGS="$CPPFLAGS -I/usr/5include"
 	LIBS="$LIBS -L/usr/5lib"
-# FIXME: check if we need/use -R option
-# elif test -d /usr/ccs/lib ; then
-# 	# Solaris 5.x
-# 	LIBS="$LIBS -L/usr/ccs/lib -R/usr/ccs/lib"
 fi
 
-cf_save_LIBS="$LIBS"
-AC_CHECK_FUNC(tgoto,[
-	AC_CHECK_LIB(curses,initscr,,[
-		AC_ERROR(cannot link curses)])
-],[
-AC_CHECK_LIB(termcap, tgoto,[
-	LIBS="-ltermcap $cf_save_LIBS"
-	AC_CHECK_LIB(curses,initscr,,[
-		AC_CHECK_LIB(cursesX,initscr,,[
-			AC_CHECK_LIB(jcurses,initscr,,[
-				AC_ERROR(cannot link curses)])])])
-	],[
-	AC_CHECK_LIB(curses,initscr,,[
-		AC_ERROR(cannot link curses)])])
-])
+if test ".$ac_cv_func_initscr" != .yes ; then
+	cf_save_LIBS="$LIBS"
+	cf_term_lib=""
+	cf_curs_lib=""
+
+	# Check for library containing initscr
+	for cf_curs_lib in curses ncurses cursesX jcurses unknown
+	do
+		AC_CHECK_LIB($cf_curs_lib,initscr,[break])
+	done
+	test $cf_curs_lib = unknown && AC_ERROR(no curses library found)
+
+	# Check for library containing tgoto
+	AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
+		for cf_term_lib in termcap termlib unknown
+		do
+			AC_CHECK_LIB($cf_term_lib,tgoto,[break])
+		done
+	])
+
+	LIBS="-l$cf_curs_lib $cf_save_LIBS"
+	if test "$cf_term_lib" = unknown ; then
+		AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
+		AC_TRY_LINK([#include <$cf_cv_ncurses_header>],
+			[initscr()],
+			[cf_result=yes],
+			[cf_result=no])
+		AC_MSG_RESULT($cf_result)
+		test $cf_result = no && AC_ERROR(Cannot link curses library)
+	elif test "$cf_term_lib" != predefined ; then
+		AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
+		AC_TRY_LINK([#include <$cf_cv_ncurses_header>],
+			[initscr()],
+			[cf_result=no],
+			[
+			LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
+			AC_TRY_LINK([#include <$cf_cv_ncurses_header>],
+				[initscr()],
+				[cf_result=yes],
+				[cf_result=error])
+			])
+		AC_MSG_RESULT($cf_result)
+	fi
+fi
+
 ])])
 dnl ---------------------------------------------------------------------------
 dnl Solaris 2.x curses provides a "performance" tradeoff according to whether
@@ -1014,6 +1061,10 @@ do
     AC_TRY_COMPILE([#include <sys/types.h>
 #if HAVE_TERMIOS_H
 #include <termios.h>
+#else
+#if HAVE_TERMIO_H
+#include <termio.h>
+#endif
 #endif
 #if NEED_PTEM_H
 /* This is a workaround for SCO:  they neglected to define struct winsize in
@@ -1071,7 +1122,8 @@ AC_CACHE_VAL(cf_cv_slang_header,[
 		for cf_header in \
 			slang.h
 		do
-			if egrep "SLANG_VERSION" $cf_incdir/$cf_header 1>&5 2>&1; then
+			echo trying $cf_incdir/$cf_header 1>&AC_FD_CC
+			if egrep "SLANG_VERSION" $cf_incdir/$cf_header 1>&AC_FD_CC 2>&1; then
 				cf_cv_slang_header=$cf_incdir/$cf_header 
 				break
 			fi
@@ -1109,7 +1161,7 @@ CF_FIND_LIBRARY(slang,
 	SLtt_get_screen_size)
 cf_slang_LIBS3="$LIBS"
 AC_MSG_CHECKING(if we can link slang without termcap)
-if test -n "$cf_slang_LIBS1" ; then
+if test -n "`echo $cf_slang_LIBS1 | sed -e 's/ //g'`" ; then
 	cf_exclude=`echo ".$cf_slang_LIBS2" | sed -e "s@$cf_slang_LIBS1@@" -e 's@^.@@'`
 else
 	cf_exclude="$cf_slang_LIBS2"
diff --git a/config.hin b/config.hin
index 5e299965..57e980a2 100644
--- a/config.hin
+++ b/config.hin
@@ -16,6 +16,7 @@
 #undef DECL_SYS_ERRLIST
 #undef DIRED_SUPPORT		/* AC_ARG_WITH(dired) */
 #undef EXP_CHARTRANS		/* AC_ARG_WITH(char-trans) */
+#undef EXP_CHARTRANS_AUTOSWITCH	/* AC_ARG_WITH(font-switch) */
 #undef FANCY_CURSES		/* defined by CF_FANCY_CURSES */
 #undef GZIP_PATH		/* CF_PATH_PROG(gzip) */
 #undef HAVE_CBREAK
@@ -54,7 +55,8 @@
 #undef LINUX			/* FIXME: make tests? */
 #undef LOCALE			/* for locale support */
 #undef LONG_LIST		/* CF_ARG_DISABLE(long-list) */
-#undef LYNX_CFG_FILE		/* CF_WITH_PATH(cfg-file) */
+#undef LYNX_CFG_FILE		/* $libdir/lynx.cfg */
+#undef LYNX_LSS_FILE		/* $libdir/lynx.lss */
 #undef LY_FIND_LEAKS		/* configure --disable-leaks */
 #undef MKDIR_PATH		/* CF_PATH_PROG(mkdir) */
 #undef MV_PATH			/* CF_PATH_PROG(mv) */
@@ -65,6 +67,7 @@
 #undef NGROUPS			/* defined by CF_NGROUPS */
 #undef NO_CHANGE_EXECUTE_PERMS	/* CF_ARG_DISABLE(dired-xpermit) */
 #undef NO_PARENT_DIR_REFERENCE	/* configure --disable-parent-dir */
+#undef NSL_FORK			/* CF_ARG_ENABLE(nsl-fork) */
 #undef OK_GZIP			/* CF_ARG_DISABLE(dired-gzip) */
 #undef OK_OVERRIDE		/* CF_ARG_DISABLE(dired-override) */
 #undef OK_PERMIT		/* CF_ARG_DISABLE(dired-permit) */
@@ -80,10 +83,11 @@
 #undef TOUCH_PATH		/* CF_PATH_PROG(touch) */
 #undef ULTRIX			/* config.sub */
 #undef UNCOMPRESS_PATH		/* CF_PATH_PROG(gunzip) */
+#undef UNDERLINE_LINKS		/* CF_ARG_ENABLE(underlines) */
 #undef UNIX
 #undef UNZIP_PATH		/* CF_PATH_PROG(unzip) */
 #undef USE_COLOR_STYLE		/* CF_ARG_ENABLE(color-style) */
-#undef USE_EXTERNS		/* CF_ARG_ENABLE(externs) */
+#undef USE_EXTERNALS		/* CF_ARG_ENABLE(externs) */
 #undef USE_HASH			/* see USE_COLOR_STYLE */
 #undef USE_SIZECHANGEHACK	/* FIXME: find a case where this works! */
 #undef USE_SLANG		/* AC_ARG_WITH(screen=slang) */
@@ -106,7 +110,6 @@
 /* FIXME:EXEC_SCRIPTS */
 /* FIXME:HP_TERMINAL */
 /* FIXME:NOPORT */
-/* FIXME:NSL_FORK */
 /* FIXME:POSIX_JC */
 /* FIXME:REVERSE_CLEAR_SCREEN_PROBLEM */
 /* FIXME:SHORTENED_RBIND */
diff --git a/configure b/configure
index 4e21f31c..58136ba0 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12.970309 
+# Generated automatically using autoconf version 2.12.971230 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -15,53 +15,11 @@ ac_default_prefix=/usr/local
 ac_help="$ac_help
 Development Options:"
 ac_help="$ac_help
-  --disable-echo          test: display \"compiling\" commands (default: on)"
-ac_help="$ac_help
-  --enable-find-leaks     logic for testing memory leaks (default: off)"
-ac_help="$ac_help
-  --enable-debug          logic for traces/debugging (default: off)"
-ac_help="$ac_help
-  --enable-warnings       GCC compiler warnings (default: off)"
-ac_help="$ac_help
 Basic Configuration Options:"
 ac_help="$ac_help
-  --disable-full-paths    control whether full utility pathnames are used (default: on)"
-ac_help="$ac_help
-  --with-screen=XXX       select screen type
-                          (XXX is curses (default), ncurses or slang)"
-ac_help="$ac_help
 Miscellaneous Options:"
 ac_help="$ac_help
-  --enable-color-style    use optional/experimental color style (default: off)"
-ac_help="$ac_help
-  --enable-externs        use external commands (default: off)"
-ac_help="$ac_help
-  --with-zlib             use zlib for decompression of some gzip files"
-ac_help="$ac_help
 Directory Editor Options:"
-ac_help="$ac_help
-  --disable-dired          enable optional directory-editor, DirEd (default: on)"
-ac_help="$ac_help
-  --disable-dired-archive  disable dearchiving commands (default: on)"
-ac_help="$ac_help
-  --disable-dired-override disable private keymaps (default: on)"
-ac_help="$ac_help
-  --disable-dired-permit  disable chmod/attrib commands (default: on)"
-ac_help="$ac_help
-  --disable-dired-xpermit disable chmod/attrib commands (default: on)"
-ac_help="$ac_help
-  --disable-dired-tar     disable \"tar\" command (default: on)"
-ac_help="$ac_help
-  --disable-dired-uudecode disable \"uudecode\" command (default: on)"
-ac_help="$ac_help
-  --disable-dired-zip     disable \"zip\", \"unzip\"  commands (default: on)"
-ac_help="$ac_help
-  --disable-dired-gzip    disable \"gzip\", \"gunzip\" commands (default: on)"
-ac_help="$ac_help
-  --disable-long-list     disable long \"ls -l\" directory listings (default: on)"
-ac_help="$ac_help
-  --disable-parent-dir-refs
-                          disable \"Up-to\" links in directory listings (default: on)"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -231,9 +189,36 @@ Features and packages:
   --x-includes=DIR        X include files are in DIR
   --x-libraries=DIR       X library files are in DIR
 EOF
-    if test -n "$ac_help"; then
-      echo "--enable and --with options recognized:$ac_help"
-    fi
+cat <<EOF
+--enable and --with options recognized:
+  --disable-echo          test: display \"compiling\" commands (default: on)
+  --enable-find-leaks     logic for testing memory leaks (default: off)
+  --enable-debug          logic for traces/debugging (default: off)
+  --enable-warnings       GCC compiler warnings (default: off)
+  --disable-full-paths    control whether full utility pathnames are used (default: on)
+  --with-screen=XXX       select screen type
+                          (XXX is curses (default), ncurses or slang)
+  --enable-color-style    use optional/experimental color style (default: off)
+  --enable-externs        use external commands (default: off)
+  --enable-font-switch    use Linux setfont for character-translation (default: off)
+  --enable-nsl-fork       fork NSL requests, allowing them to be aborted (default: off)
+  --enable-underlines     underline links rather than using boldface (default: off)
+  --with-zlib             use zlib for decompression of some gzip files
+  --disable-dired          enable optional directory-editor, DirEd (default: on)
+EOF
+cat <<EOF
+  --disable-dired-archive  disable dearchiving commands (default: on)
+  --disable-dired-override disable private keymaps (default: on)
+  --disable-dired-permit  disable chmod/attrib commands (default: on)
+  --disable-dired-xpermit disable chmod/attrib commands (default: on)
+  --disable-dired-tar     disable \"tar\" command (default: on)
+  --disable-dired-uudecode disable \"uudecode\" command (default: on)
+  --disable-dired-zip     disable \"zip\", \"unzip\"  commands (default: on)
+  --disable-dired-gzip    disable \"gzip\", \"gunzip\" commands (default: on)
+  --disable-long-list     disable long \"ls -l\" directory listings (default: on)
+  --disable-parent-dir-refs
+                          disable \"Up-to\" links in directory listings (default: on)
+EOF
     exit 0 ;;
 
   -host | --host | --hos | --ho)
@@ -383,7 +368,7 @@ EOF
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.12.970309"
+    echo "configure generated by autoconf version 2.12.971230"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -598,7 +583,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:602: checking host system type" >&5
+echo "configure:587: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -623,7 +608,7 @@ echo "$ac_t""$host" 1>&6
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:627: checking for $ac_word" >&5
+echo "configure:612: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -652,7 +637,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:656: checking for $ac_word" >&5
+echo "configure:641: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -700,7 +685,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:704: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:689: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -710,11 +695,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 714 "configure"
+#line 699 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -734,12 +719,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:738: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:723: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:743: checking whether we are using GNU C" >&5
+echo "configure:728: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -748,7 +733,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:752: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:737: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -763,7 +748,7 @@ if test $ac_cv_prog_gcc = yes; then
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:767: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:752: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -791,7 +776,7 @@ else
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:795: checking how to run the C preprocessor" >&5
+echo "configure:780: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -806,13 +791,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 810 "configure"
+#line 795 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -823,13 +808,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 827 "configure"
+#line 812 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:818: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -854,7 +839,7 @@ echo "$ac_t""$CPP" 1>&6
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:858: checking for $ac_word" >&5
+echo "configure:843: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -881,7 +866,7 @@ else
 fi
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:885: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:870: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -909,7 +894,7 @@ fi
 
 
 echo $ac_n "checking for style of include in makefiles""... $ac_c" 1>&6
-echo "configure:913: checking for style of include in makefiles" >&5
+echo "configure:898: checking for style of include in makefiles" >&5
 
 make_include_left=""
 make_include_right=""
@@ -970,7 +955,7 @@ echo "$ac_t""${make_include_left}file${make_include_right}" 1>&6
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:974: checking for a BSD compatible install" >&5
+echo "configure:959: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1024,7 +1009,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1028: checking for $ac_word" >&5
+echo "configure:1013: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LINT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1058,7 +1043,8 @@ done
 
 
 echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6
-echo "configure:1062: checking if you want to see long compiling messages" >&5
+echo "configure:1047: checking if you want to see long compiling messages" >&5
+
 # Check whether --enable-echo or --disable-echo was given.
 if test "${enable_echo+set}" = set; then
   enableval="$enable_echo"
@@ -1097,7 +1083,8 @@ echo "$ac_t""$enableval" 1>&6
 
 
 echo $ac_n "checking if you want to check memory-leaks""... $ac_c" 1>&6
-echo "configure:1101: checking if you want to check memory-leaks" >&5
+echo "configure:1087: checking if you want to check memory-leaks" >&5
+
 # Check whether --enable-find-leaks or --disable-find-leaks was given.
 if test "${enable_find_leaks+set}" = set; then
   enableval="$enable_find_leaks"
@@ -1120,7 +1107,8 @@ EOF
 
 
 echo $ac_n "checking if you want to enable debug-code""... $ac_c" 1>&6
-echo "configure:1124: checking if you want to enable debug-code" >&5
+echo "configure:1111: checking if you want to enable debug-code" >&5
+
 # Check whether --enable-debug or --disable-debug was given.
 if test "${enable_debug+set}" = set; then
   enableval="$enable_debug"
@@ -1164,7 +1152,8 @@ fi
 if test -n "$GCC"
 then
 echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6
-echo "configure:1168: checking if you want to turn on gcc warnings" >&5
+echo "configure:1156: checking if you want to turn on gcc warnings" >&5
+
 # Check whether --enable-warnings or --disable-warnings was given.
 if test "${enable_warnings+set}" = set; then
   enableval="$enable_warnings"
@@ -1187,11 +1176,11 @@ then
 if test -n "$GCC"
 then
 		cat > conftest.$ac_ext <<EOF
-#line 1191 "configure"
+#line 1180 "configure"
 int main(int argc, char *argv[]) { return argv[argc-1] == 0; }
 EOF
 		echo "checking for gcc warning options" 1>&6
-echo "configure:1195: checking for gcc warning options" >&5
+echo "configure:1184: checking for gcc warning options" >&5
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS="-W -Wall"
 	cf_warn_CONST=""
@@ -1209,7 +1198,7 @@ echo "configure:1195: checking for gcc warning options" >&5
 		Wstrict-prototypes $cf_warn_CONST
 	do
 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo configure:1213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+		if { (eval echo configure:1202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 			test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6
 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 			test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES"
@@ -1227,7 +1216,8 @@ fi
 
 
 echo $ac_n "checking if you want full utility pathnames""... $ac_c" 1>&6
-echo "configure:1231: checking if you want full utility pathnames" >&5
+echo "configure:1220: checking if you want full utility pathnames" >&5
+
 # Check whether --enable-full-paths or --disable-full-paths was given.
 if test "${enable_full_paths+set}" = set; then
   enableval="$enable_full_paths"
@@ -1247,7 +1237,7 @@ echo "$ac_t""$with_full_paths" 1>&6
 
 
 echo $ac_n "checking for system mailer""... $ac_c" 1>&6
-echo "configure:1251: checking for system mailer" >&5
+echo "configure:1241: checking for system mailer" >&5
 if eval "test \"`echo '$''{'cf_cv_SYSTEM_MAIL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1274,7 +1264,7 @@ EOF
 
 
 echo $ac_n "checking system mail flags""... $ac_c" 1>&6
-echo "configure:1278: checking system mail flags" >&5
+echo "configure:1268: checking system mail flags" >&5
 if eval "test \"`echo '$''{'cf_cv_system_mail_flags'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1302,7 +1292,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "chmod", so it can be a program name with args.
 set dummy chmod; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1306: checking for $ac_word" >&5
+echo "configure:1296: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_CHMOD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1333,7 +1323,7 @@ fi
 
 else
 	echo $ac_n "checking for chmod""... $ac_c" 1>&6
-echo "configure:1337: checking for chmod" >&5
+echo "configure:1327: checking for chmod" >&5
 	echo "$ac_t""$CHMOD" 1>&6
 fi
 
@@ -1367,7 +1357,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "compress", so it can be a program name with args.
 set dummy compress; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1371: checking for $ac_word" >&5
+echo "configure:1361: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_COMPRESS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1398,7 +1388,7 @@ fi
 
 else
 	echo $ac_n "checking for compress""... $ac_c" 1>&6
-echo "configure:1402: checking for compress" >&5
+echo "configure:1392: checking for compress" >&5
 	echo "$ac_t""$COMPRESS" 1>&6
 fi
 
@@ -1432,7 +1422,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "cp", so it can be a program name with args.
 set dummy cp; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1436: checking for $ac_word" >&5
+echo "configure:1426: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_COPY'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1463,7 +1453,7 @@ fi
 
 else
 	echo $ac_n "checking for cp""... $ac_c" 1>&6
-echo "configure:1467: checking for cp" >&5
+echo "configure:1457: checking for cp" >&5
 	echo "$ac_t""$COPY" 1>&6
 fi
 
@@ -1497,7 +1487,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "gzip", so it can be a program name with args.
 set dummy gzip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1501: checking for $ac_word" >&5
+echo "configure:1491: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GZIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1528,7 +1518,7 @@ fi
 
 else
 	echo $ac_n "checking for gzip""... $ac_c" 1>&6
-echo "configure:1532: checking for gzip" >&5
+echo "configure:1522: checking for gzip" >&5
 	echo "$ac_t""$GZIP" 1>&6
 fi
 
@@ -1557,77 +1547,12 @@ EOF
 
 
 
-test -z "$INSTALL" && INSTALL=install
-if test "$with_full_paths" = yes ; then
-	# Extract the first word of "install", so it can be a program name with args.
-set dummy install; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1566: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_INSTALL'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$INSTALL" in
-  /*)
-  ac_cv_path_INSTALL="$INSTALL" # Let the user override the test with a path.
-  ;;
-  *)
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_INSTALL="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_INSTALL" && ac_cv_path_INSTALL="$INSTALL"
-  ;;
-esac
-fi
-INSTALL="$ac_cv_path_INSTALL"
-if test -n "$INSTALL"; then
-  echo "$ac_t""$INSTALL" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-	echo $ac_n "checking for install""... $ac_c" 1>&6
-echo "configure:1597: checking for install" >&5
-	echo "$ac_t""$INSTALL" 1>&6
-fi
-
-cf_path_prog=""
-cf_path_args=""
-IFS="${IFS= 	}"; cf_save_ifs="$IFS"; IFS="${IFS}:"
-for cf_temp in $ac_cv_path_INSTALL
-do
-	if test -z "$cf_path_prog" ; then
-		cf_path_prog="$cf_temp"
-	elif test -z "$cf_path_args" ; then
-		cf_path_args="$cf_temp"
-	else
-		cf_path_args="$cf_path_args $cf_temp"
-	fi
-done
-IFS="$cf_save_ifs"
-
-cat >> confdefs.h <<EOF
-#define INSTALL_PATH "$cf_path_prog"
-EOF
-
-test -n "$cf_path_args" && cat >> confdefs.h <<EOF
-#define INSTALL_ARGS "$cf_path_args"
-EOF
-
-
-
 test -z "$MKDIR" && MKDIR=mkdir
 if test "$with_full_paths" = yes ; then
 	# Extract the first word of "mkdir", so it can be a program name with args.
 set dummy mkdir; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1631: checking for $ac_word" >&5
+echo "configure:1556: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1658,7 +1583,7 @@ fi
 
 else
 	echo $ac_n "checking for mkdir""... $ac_c" 1>&6
-echo "configure:1662: checking for mkdir" >&5
+echo "configure:1587: checking for mkdir" >&5
 	echo "$ac_t""$MKDIR" 1>&6
 fi
 
@@ -1692,7 +1617,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "mv", so it can be a program name with args.
 set dummy mv; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1696: checking for $ac_word" >&5
+echo "configure:1621: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1723,7 +1648,7 @@ fi
 
 else
 	echo $ac_n "checking for mv""... $ac_c" 1>&6
-echo "configure:1727: checking for mv" >&5
+echo "configure:1652: checking for mv" >&5
 	echo "$ac_t""$MV" 1>&6
 fi
 
@@ -1757,7 +1682,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "rm", so it can be a program name with args.
 set dummy rm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1761: checking for $ac_word" >&5
+echo "configure:1686: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1788,7 +1713,7 @@ fi
 
 else
 	echo $ac_n "checking for rm""... $ac_c" 1>&6
-echo "configure:1792: checking for rm" >&5
+echo "configure:1717: checking for rm" >&5
 	echo "$ac_t""$RM" 1>&6
 fi
 
@@ -1822,7 +1747,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "tar", so it can be a program name with args.
 set dummy tar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1826: checking for $ac_word" >&5
+echo "configure:1751: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1853,7 +1778,7 @@ fi
 
 else
 	echo $ac_n "checking for tar""... $ac_c" 1>&6
-echo "configure:1857: checking for tar" >&5
+echo "configure:1782: checking for tar" >&5
 	echo "$ac_t""$TAR" 1>&6
 fi
 
@@ -1887,7 +1812,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "touch", so it can be a program name with args.
 set dummy touch; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1891: checking for $ac_word" >&5
+echo "configure:1816: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_TOUCH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1918,7 +1843,7 @@ fi
 
 else
 	echo $ac_n "checking for touch""... $ac_c" 1>&6
-echo "configure:1922: checking for touch" >&5
+echo "configure:1847: checking for touch" >&5
 	echo "$ac_t""$TOUCH" 1>&6
 fi
 
@@ -1952,7 +1877,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "gunzip", so it can be a program name with args.
 set dummy gunzip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1956: checking for $ac_word" >&5
+echo "configure:1881: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_UNCOMPRESS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1983,7 +1908,7 @@ fi
 
 else
 	echo $ac_n "checking for gunzip""... $ac_c" 1>&6
-echo "configure:1987: checking for gunzip" >&5
+echo "configure:1912: checking for gunzip" >&5
 	echo "$ac_t""$UNCOMPRESS" 1>&6
 fi
 
@@ -2017,7 +1942,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "unzip", so it can be a program name with args.
 set dummy unzip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2021: checking for $ac_word" >&5
+echo "configure:1946: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_UNZIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2048,7 +1973,7 @@ fi
 
 else
 	echo $ac_n "checking for unzip""... $ac_c" 1>&6
-echo "configure:2052: checking for unzip" >&5
+echo "configure:1977: checking for unzip" >&5
 	echo "$ac_t""$UNZIP" 1>&6
 fi
 
@@ -2082,7 +2007,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "uudecode", so it can be a program name with args.
 set dummy uudecode; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2086: checking for $ac_word" >&5
+echo "configure:2011: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_UUDECODE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2113,7 +2038,7 @@ fi
 
 else
 	echo $ac_n "checking for uudecode""... $ac_c" 1>&6
-echo "configure:2117: checking for uudecode" >&5
+echo "configure:2042: checking for uudecode" >&5
 	echo "$ac_t""$UUDECODE" 1>&6
 fi
 
@@ -2147,7 +2072,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "zcat", so it can be a program name with args.
 set dummy zcat; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2151: checking for $ac_word" >&5
+echo "configure:2076: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_ZCAT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2178,7 +2103,7 @@ fi
 
 else
 	echo $ac_n "checking for zcat""... $ac_c" 1>&6
-echo "configure:2182: checking for zcat" >&5
+echo "configure:2107: checking for zcat" >&5
 	echo "$ac_t""$ZCAT" 1>&6
 fi
 
@@ -2212,7 +2137,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "zip", so it can be a program name with args.
 set dummy zip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2216: checking for $ac_word" >&5
+echo "configure:2141: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_ZIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2243,7 +2168,7 @@ fi
 
 else
 	echo $ac_n "checking for zip""... $ac_c" 1>&6
-echo "configure:2247: checking for zip" >&5
+echo "configure:2172: checking for zip" >&5
 	echo "$ac_t""$ZIP" 1>&6
 fi
 
@@ -2272,6 +2197,21 @@ EOF
 
 
 
+case "$INSTALL" in
+$srcdir*) # (vi
+	cat >> confdefs.h <<EOF
+#define INSTALL_PATH "install"
+EOF
+
+	;;
+*) # (vi
+	cat >> confdefs.h <<EOF
+#define INSTALL_PATH "$INSTALL"
+EOF
+
+	;;
+esac
+
 
 cat >> confdefs.h <<\EOF
 #define UNIX 1
@@ -2281,7 +2221,7 @@ EOF
 if test -z "$GCC" ; then
 	
 echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:2285: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:2225: checking for ${CC-cc} option to accept ANSI C" >&5
 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2299,7 +2239,7 @@ for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc
 do
 	CFLAGS="$cf_save_CFLAGS $cf_arg"
 	cat > conftest.$ac_ext <<EOF
-#line 2303 "configure"
+#line 2243 "configure"
 #include "confdefs.h"
 
 #ifndef CC_HAS_PROTOS
@@ -2315,7 +2255,7 @@ int main() {
 	struct s2 {int (*f) (double a);};
 ; return 0; }
 EOF
-if { (eval echo configure:2319: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ansi_cc="$cf_arg"; break
 else
@@ -2343,12 +2283,12 @@ fi
 
 fi
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2347: checking for working const" >&5
+echo "configure:2287: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2352 "configure"
+#line 2292 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2397,7 +2337,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:2401: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2341: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2437,7 +2377,7 @@ clix*)
 	# contributed by Alex Matulich (matuli_a@marlin.navsea.navy.mil) also
 	# references -lmalloc and -lbsd.
 	echo $ac_n "checking for strcmp in -lc_s""... $ac_c" 1>&6
-echo "configure:2441: checking for strcmp in -lc_s" >&5
+echo "configure:2381: checking for strcmp in -lc_s" >&5
 ac_lib_var=`echo c_s'_'strcmp | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2445,7 +2385,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lc_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2449 "configure"
+#line 2389 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2456,7 +2396,7 @@ int main() {
 strcmp()
 ; return 0; }
 EOF
-if { (eval echo configure:2460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2534,7 +2474,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2538: checking for $ac_word" >&5
+echo "configure:2478: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2578,17 +2518,17 @@ sony-newsos*)
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2582: checking for $ac_hdr" >&5
+echo "configure:2522: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2587 "configure"
+#line 2527 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2592: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2632,17 +2572,17 @@ ultrix*)
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2636: checking for $ac_hdr" >&5
+echo "configure:2576: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2641 "configure"
+#line 2581 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2586: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2675,7 +2615,7 @@ esac
 
 cf_test_netlibs=no
 echo $ac_n "checking for network libraries""... $ac_c" 1>&6
-echo "configure:2679: checking for network libraries" >&5
+echo "configure:2619: checking for network libraries" >&5
 if eval "test \"`echo '$''{'cf_cv_netlibs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2686,12 +2626,12 @@ cf_test_netlibs=yes
 for ac_func in gethostname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2690: checking for $ac_func" >&5
+echo "configure:2630: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2695 "configure"
+#line 2635 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2714,7 +2654,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2737,7 +2677,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6
-echo "configure:2741: checking for gethostname in -lnsl" >&5
+echo "configure:2681: checking for gethostname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2745,7 +2685,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2749 "configure"
+#line 2689 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2756,7 +2696,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2789,7 +2729,7 @@ else
 	
 		
 echo $ac_n "checking for gethostname in -lsocket""... $ac_c" 1>&6
-echo "configure:2793: checking for gethostname in -lsocket" >&5
+echo "configure:2733: checking for gethostname in -lsocket" >&5
 ac_lib_var=`echo socket'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2797,7 +2737,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2801 "configure"
+#line 2741 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2808,7 +2748,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2852,21 +2792,21 @@ done
 # FIXME:  sequent needs this library (i.e., -lsocket -linet -lnsl), but
 # I don't know the entrypoints - 97/7/22 TD
 echo $ac_n "checking for -linet""... $ac_c" 1>&6
-echo "configure:2856: checking for -linet" >&5
+echo "configure:2796: checking for -linet" >&5
 if eval "test \"`echo '$''{'ac_cv_lib_inet'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-linet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2863 "configure"
+#line 2803 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_lib_inet=yes
 else
@@ -2889,12 +2829,12 @@ if test "$ac_cv_func_lsocket" != no ; then
 for ac_func in socket
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2893: checking for $ac_func" >&5
+echo "configure:2833: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2898 "configure"
+#line 2838 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2917,7 +2857,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2940,7 +2880,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:2944: checking for socket in -lsocket" >&5
+echo "configure:2884: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2948,7 +2888,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2952 "configure"
+#line 2892 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2959,7 +2899,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2992,7 +2932,7 @@ else
 	
 		
 echo $ac_n "checking for socket in -lbsd""... $ac_c" 1>&6
-echo "configure:2996: checking for socket in -lbsd" >&5
+echo "configure:2936: checking for socket in -lbsd" >&5
 ac_lib_var=`echo bsd'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3000,7 +2940,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3004 "configure"
+#line 2944 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3011,7 +2951,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:3015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3056,12 +2996,12 @@ fi
 for ac_func in gethostbyname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3060: checking for $ac_func" >&5
+echo "configure:3000: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3065 "configure"
+#line 3005 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3084,7 +3024,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3107,7 +3047,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:3111: checking for gethostbyname in -lnsl" >&5
+echo "configure:3051: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3115,7 +3055,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3119 "configure"
+#line 3059 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3126,7 +3066,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:3130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3167,12 +3107,12 @@ done
 for ac_func in strcasecmp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3171: checking for $ac_func" >&5
+echo "configure:3111: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3176 "configure"
+#line 3116 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3195,7 +3135,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3218,7 +3158,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for strcasecmp in -lresolv""... $ac_c" 1>&6
-echo "configure:3222: checking for strcasecmp in -lresolv" >&5
+echo "configure:3162: checking for strcasecmp in -lresolv" >&5
 ac_lib_var=`echo resolv'_'strcasecmp | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3226,7 +3166,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3230 "configure"
+#line 3170 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3237,7 +3177,7 @@ int main() {
 strcasecmp()
 ; return 0; }
 EOF
-if { (eval echo configure:3241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3282,11 +3222,12 @@ test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&6
 
 
 echo $ac_n "checking for screen type""... $ac_c" 1>&6
-echo "configure:3286: checking for screen type" >&5
+echo "configure:3226: checking for screen type" >&5
 if eval "test \"`echo '$''{'cf_cv_screen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
+
 # Check whether --with-screen or --without-screen was given.
 if test "${with_screen+set}" = set; then
   withval="$with_screen"
@@ -3316,12 +3257,12 @@ case $cf_cv_screen in
 curses)
 	
 echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:3320: checking for initscr" >&5
+echo "configure:3261: checking for initscr" >&5
 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3325 "configure"
+#line 3266 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -3344,7 +3285,7 @@ initscr();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -3365,7 +3306,7 @@ else
 case $host_os in #(vi
 freebsd*) #(vi
 	echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
-echo "configure:3369: checking for tgoto in -lmytinfo" >&5
+echo "configure:3310: checking for tgoto in -lmytinfo" >&5
 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3373,7 +3314,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmytinfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3377 "configure"
+#line 3318 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3384,7 +3325,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:3388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3407,7 +3348,7 @@ fi
 	;;
 *hp-hpux10.*)
 	echo $ac_n "checking for initscr in -lHcurses""... $ac_c" 1>&6
-echo "configure:3411: checking for initscr in -lHcurses" >&5
+echo "configure:3352: checking for initscr in -lHcurses" >&5
 ac_lib_var=`echo Hcurses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3415,7 +3356,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lHcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3419 "configure"
+#line 3360 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3426,7 +3367,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3445,12 +3386,13 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
 		# HP's header uses __HP_CURSES, but user claims _HP_CURSES.
 		LIBS="-lHcurses $LIBS"
 		CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS"
+		ac_cv_func_initscr=yes
 		
 else
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for initscr in -lcur_color""... $ac_c" 1>&6
-echo "configure:3454: checking for initscr in -lcur_color" >&5
+echo "configure:3396: checking for initscr in -lcur_color" >&5
 ac_lib_var=`echo cur_color'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3458,7 +3400,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcur_color  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3462 "configure"
+#line 3404 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3469,7 +3411,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3487,6 +3429,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   
 		LIBS="-lcur_color $LIBS"
 		CFLAGS="-I/usr/include/curses_colr $CFLAGS"
+		ac_cv_func_initscr=yes
 		
 else
   echo "$ac_t""no" 1>&6
@@ -3496,71 +3439,31 @@ fi
 
 	;;
 esac
+
 if test -d /usr/5lib ; then
 	# SunOS 3.x or 4.x
 	CPPFLAGS="$CPPFLAGS -I/usr/5include"
 	LIBS="$LIBS -L/usr/5lib"
-# FIXME: check if we need/use -R option
-# elif test -d /usr/ccs/lib ; then
-# 	# Solaris 5.x
-# 	LIBS="$LIBS -L/usr/ccs/lib -R/usr/ccs/lib"
 fi
 
-cf_save_LIBS="$LIBS"
-echo $ac_n "checking for tgoto""... $ac_c" 1>&6
-echo "configure:3512: checking for tgoto" >&5
-if eval "test \"`echo '$''{'ac_cv_func_tgoto'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3517 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char tgoto(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char tgoto();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_tgoto) || defined (__stub___tgoto)
-choke me
-#else
-tgoto();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:3540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  eval "ac_cv_func_tgoto=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_tgoto=no"
-fi
-rm -f conftest*
-fi
+if test ".$ac_cv_func_initscr" != .yes ; then
+	cf_save_LIBS="$LIBS"
+	cf_term_lib=""
+	cf_curs_lib=""
 
-if eval "test \"`echo '$ac_cv_func_'tgoto`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  
-	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:3556: checking for initscr in -lcurses" >&5
-ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
+	# Check for library containing initscr
+	for cf_curs_lib in curses ncurses cursesX jcurses unknown
+	do
+		echo $ac_n "checking for initscr in -l$cf_curs_lib""... $ac_c" 1>&6
+echo "configure:3459: checking for initscr in -l$cf_curs_lib" >&5
+ac_lib_var=`echo $cf_curs_lib'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lcurses  $LIBS"
+LIBS="-l$cf_curs_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3564 "configure"
+#line 3467 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3571,7 +3474,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3586,82 +3489,85 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo curses | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-lcurses $LIBS"
-
+  break
 else
   echo "$ac_t""no" 1>&6
-
-		{ echo "configure: error: cannot link curses" 1>&2; exit 1; }
 fi
 
+	done
+	test $cf_curs_lib = unknown && { echo "configure: error: no curses library found" 1>&2; exit 1; }
 
-else
-  echo "$ac_t""no" 1>&6
-
-echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:3609: checking for tgoto in -ltermcap" >&5
-ac_lib_var=`echo termcap'_'tgoto | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+	# Check for library containing tgoto
+	echo $ac_n "checking for tgoto""... $ac_c" 1>&6
+echo "configure:3503: checking for tgoto" >&5
+if eval "test \"`echo '$''{'ac_cv_func_tgoto'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-ltermcap  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3617 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 3508 "configure"
 #include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char tgoto(); below.  */
+#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char tgoto();
 
 int main() {
-tgoto()
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_tgoto) || defined (__stub___tgoto)
+choke me
+#else
+tgoto();
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:3628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  eval "ac_cv_func_tgoto=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  eval "ac_cv_func_tgoto=no"
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+
+if eval "test \"`echo '$ac_cv_func_'tgoto`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  
-	LIBS="-ltermcap $cf_save_LIBS"
-	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:3646: checking for initscr in -lcurses" >&5
-ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
+  cf_term_lib=predefined
+else
+  echo "$ac_t""no" 1>&6
+
+		for cf_term_lib in termcap termlib unknown
+		do
+			echo $ac_n "checking for tgoto in -l$cf_term_lib""... $ac_c" 1>&6
+echo "configure:3552: checking for tgoto in -l$cf_term_lib" >&5
+ac_lib_var=`echo $cf_term_lib'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lcurses  $LIBS"
+LIBS="-l$cf_term_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3654 "configure"
+#line 3560 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char initscr();
+char tgoto();
 
 int main() {
-initscr()
+tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:3665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3571: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3676,172 +3582,83 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo curses | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-lcurses $LIBS"
-
+  break
 else
   echo "$ac_t""no" 1>&6
+fi
+
+		done
+	
+fi
 
-		echo $ac_n "checking for initscr in -lcursesX""... $ac_c" 1>&6
-echo "configure:3692: checking for initscr in -lcursesX" >&5
-ac_lib_var=`echo cursesX'_'initscr | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lcursesX  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3700 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char initscr();
 
+	LIBS="-l$cf_curs_lib $cf_save_LIBS"
+	if test "$cf_term_lib" = unknown ; then
+		echo $ac_n "checking if we can link with $cf_curs_lib library""... $ac_c" 1>&6
+echo "configure:3599: checking if we can link with $cf_curs_lib library" >&5
+		cat > conftest.$ac_ext <<EOF
+#line 3601 "configure"
+#include "confdefs.h"
+#include <$cf_cv_ncurses_header>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  cf_result=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  cf_result=no
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo cursesX | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-lcursesX $LIBS"
-
-else
-  echo "$ac_t""no" 1>&6
-
-			echo $ac_n "checking for initscr in -ljcurses""... $ac_c" 1>&6
-echo "configure:3738: checking for initscr in -ljcurses" >&5
-ac_lib_var=`echo jcurses'_'initscr | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-ljcurses  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3746 "configure"
+		echo "$ac_t""$cf_result" 1>&6
+		test $cf_result = no && { echo "configure: error: Cannot link curses library" 1>&2; exit 1; }
+	elif test "$cf_term_lib" != predefined ; then
+		echo $ac_n "checking if we need both $cf_curs_lib and $cf_term_lib libraries""... $ac_c" 1>&6
+echo "configure:3622: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5
+		cat > conftest.$ac_ext <<EOF
+#line 3624 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char initscr();
-
+#include <$cf_cv_ncurses_header>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  cf_result=no
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo jcurses | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-ljcurses $LIBS"
-
-else
-  echo "$ac_t""no" 1>&6
-
-				{ echo "configure: error: cannot link curses" 1>&2; exit 1; }
-fi
-
-fi
-
-fi
-
-	
-else
-  echo "$ac_t""no" 1>&6
-
-	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:3795: checking for initscr in -lcurses" >&5
-ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lcurses  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3803 "configure"
+  
+			LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
+			cat > conftest.$ac_ext <<EOF
+#line 3641 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char initscr();
-
+#include <$cf_cv_ncurses_header>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  cf_result=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  cf_result=error
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo curses | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-lcurses $LIBS"
-
-else
-  echo "$ac_t""no" 1>&6
-
-		{ echo "configure: error: cannot link curses" 1>&2; exit 1; }
-fi
-
+			
 fi
-
-
+rm -f conftest*
+		echo "$ac_t""$cf_result" 1>&6
+	fi
 fi
 
 
@@ -3849,14 +3666,14 @@ fi
 
 	
 echo $ac_n "checking for curses performance tradeoff""... $ac_c" 1>&6
-echo "configure:3853: checking for curses performance tradeoff" >&5
+echo "configure:3670: checking for curses performance tradeoff" >&5
 if eval "test \"`echo '$''{'cf_cv_curs_performance'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cf_cv_curs_performance=no
     cat > conftest.$ac_ext <<EOF
-#line 3860 "configure"
+#line 3677 "configure"
 #include "confdefs.h"
 
 #include <$cf_cv_ncurses_header>
@@ -3870,11 +3687,11 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:3874: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3691: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 	cat > conftest.$ac_ext <<EOF
-#line 3878 "configure"
+#line 3695 "configure"
 #include "confdefs.h"
 
 #define CURS_PERFORMANCE
@@ -3889,7 +3706,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:3893: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_curs_performance=yes
 else
@@ -3914,13 +3731,13 @@ EOF
 ncurses)
 	
 echo $ac_n "checking for ncurses header file""... $ac_c" 1>&6
-echo "configure:3918: checking for ncurses header file" >&5
+echo "configure:3735: checking for ncurses header file" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_header'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 3924 "configure"
+#line 3741 "configure"
 #include "confdefs.h"
 #include <curses.h>
 int main() {
@@ -3937,7 +3754,7 @@ make an error
 	
 ; return 0; }
 EOF
-if { (eval echo configure:3941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3758: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ncurses_header=predefined
 else
@@ -4023,7 +3840,7 @@ done
 	;;
 esac
 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
-echo "configure:4027: checking for ncurses version" >&5
+echo "configure:3844: checking for ncurses version" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4048,7 +3865,7 @@ Autoconf "old"
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo configure:4052: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	{ (eval echo configure:3869: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's@^Autoconf @@' -e 's@^[^"]*"@@' -e 's@".*@@'`
 		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
@@ -4057,7 +3874,7 @@ EOF
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 4061 "configure"
+#line 3878 "configure"
 #include "confdefs.h"
 
 #include <$cf_cv_ncurses_header>
@@ -4080,7 +3897,7 @@ int main()
 	exit(0);
 }
 EOF
-if { (eval echo configure:4084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -4105,7 +3922,7 @@ echo "$ac_t""$cf_cv_ncurses_version" 1>&6
 cf_ncurses_LIBS=""
 cf_ncurses_SAVE="$LIBS"
 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6
-echo "configure:4109: checking for Gpm_Open in -lgpm" >&5
+echo "configure:3926: checking for Gpm_Open in -lgpm" >&5
 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4113,7 +3930,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4117 "configure"
+#line 3934 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4124,7 +3941,7 @@ int main() {
 Gpm_Open()
 ; return 0; }
 EOF
-if { (eval echo configure:4128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4140,7 +3957,7 @@ fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for initscr in -lgpm""... $ac_c" 1>&6
-echo "configure:4144: checking for initscr in -lgpm" >&5
+echo "configure:3961: checking for initscr in -lgpm" >&5
 ac_lib_var=`echo gpm'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4148,7 +3965,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4152 "configure"
+#line 3969 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4159,7 +3976,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:4163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4190,7 +4007,7 @@ freebsd*)
 	# This is only necessary if you are linking against an obsolete
 	# version of ncurses (but it should do no harm, since it's static).
 	echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
-echo "configure:4194: checking for tgoto in -lmytinfo" >&5
+echo "configure:4011: checking for tgoto in -lmytinfo" >&5
 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4198,7 +4015,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmytinfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4202 "configure"
+#line 4019 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4209,7 +4026,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:4213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4237,12 +4054,12 @@ LIBS="$cf_ncurses_LIBS $LIBS"
 	cf_cv_have_lib_ncurses=no
 	cf_libdir=""
 	echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:4241: checking for initscr" >&5
+echo "configure:4058: checking for initscr" >&5
 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4246 "configure"
+#line 4063 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -4265,7 +4082,7 @@ initscr();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -4285,17 +4102,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:4289: checking for initscr in -lncurses" >&5
+echo "configure:4106: checking for initscr in -lncurses" >&5
 		LIBS="-lncurses $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 4292 "configure"
+#line 4109 "configure"
 #include "confdefs.h"
 #include <$cf_cv_ncurses_header>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:4299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 cf_cv_have_lib_ncurses=yes
@@ -4322,17 +4139,17 @@ test "$prefix" != /usr           && cf_search="$cf_search /usr/lib /usr/lib/ncur
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -lncurses in $cf_libdir""... $ac_c" 1>&6
-echo "configure:4326: checking for -lncurses in $cf_libdir" >&5
+echo "configure:4143: checking for -lncurses in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -lncurses $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 4329 "configure"
+#line 4146 "configure"
 #include "confdefs.h"
 #include <$cf_cv_ncurses_header>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:4336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 cf_cv_have_lib_ncurses=yes
@@ -4359,7 +4176,7 @@ fi
 
 if test -n "$cf_ncurses_LIBS" ; then
 	echo $ac_n "checking if we can link ncurses without $cf_ncurses_LIBS""... $ac_c" 1>&6
-echo "configure:4363: checking if we can link ncurses without $cf_ncurses_LIBS" >&5
+echo "configure:4180: checking if we can link ncurses without $cf_ncurses_LIBS" >&5
 	cf_ncurses_SAVE="$LIBS"
 	for p in $cf_ncurses_LIBS ; do
 		q=`echo $LIBS | sed -e 's/'$p' //' -e 's/'$p'$//'`
@@ -4368,14 +4185,14 @@ echo "configure:4363: checking if we can link ncurses without $cf_ncurses_LIBS"
 		fi
 	done
 	cat > conftest.$ac_ext <<EOF
-#line 4372 "configure"
+#line 4189 "configure"
 #include "confdefs.h"
 #include <$cf_cv_ncurses_header>
 int main() {
 initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:4379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -4392,20 +4209,20 @@ fi
 slang)
 	
 echo $ac_n "checking for slang header file""... $ac_c" 1>&6
-echo "configure:4396: checking for slang header file" >&5
+echo "configure:4213: checking for slang header file" >&5
 if eval "test \"`echo '$''{'cf_cv_slang_header'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 4402 "configure"
+#line 4219 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 printf("%s\n", SLANG_VERSION)
 ; return 0; }
 EOF
-if { (eval echo configure:4409: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4226: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_slang_header=predefined
 else
@@ -4431,6 +4248,7 @@ test "$prefix" != /usr           && cf_search="$cf_search /usr/include /usr/incl
 		for cf_header in \
 			slang.h
 		do
+			echo trying $cf_incdir/$cf_header 1>&5
 			if egrep "SLANG_VERSION" $cf_incdir/$cf_header 1>&5 2>&1; then
 				cf_cv_slang_header=$cf_incdir/$cf_header 
 				break
@@ -4488,7 +4306,7 @@ cf_cv_lib_termcap=none
 # HP-UX 9.x terminfo has setupterm, but no tigetstr.
 if test "$termlib" = none; then
 	echo $ac_n "checking for tigetstr in -ltermlib""... $ac_c" 1>&6
-echo "configure:4492: checking for tigetstr in -ltermlib" >&5
+echo "configure:4310: checking for tigetstr in -ltermlib" >&5
 ac_lib_var=`echo termlib'_'tigetstr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4496,7 +4314,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermlib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4500 "configure"
+#line 4318 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4507,7 +4325,7 @@ int main() {
 tigetstr()
 ; return 0; }
 EOF
-if { (eval echo configure:4511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4530,7 +4348,7 @@ fi
 fi
 if test "$cf_cv_lib_termcap" = none; then
 	echo $ac_n "checking for tgoto in -ltermlib""... $ac_c" 1>&6
-echo "configure:4534: checking for tgoto in -ltermlib" >&5
+echo "configure:4352: checking for tgoto in -ltermlib" >&5
 ac_lib_var=`echo termlib'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4538,7 +4356,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermlib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4542 "configure"
+#line 4360 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4549,7 +4367,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:4553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4573,7 +4391,7 @@ fi
 if test "$cf_cv_lib_termcap" = none; then
 	# allow curses library for broken AIX system.
 	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:4577: checking for initscr in -lcurses" >&5
+echo "configure:4395: checking for initscr in -lcurses" >&5
 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4581,7 +4399,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4585 "configure"
+#line 4403 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4592,7 +4410,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:4596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4613,7 +4431,7 @@ else
 fi
 
 	echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:4617: checking for tgoto in -ltermcap" >&5
+echo "configure:4435: checking for tgoto in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4621,7 +4439,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4625 "configure"
+#line 4443 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4632,7 +4450,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:4636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4655,7 +4473,7 @@ fi
 fi
 if test "$cf_cv_lib_termcap" = none; then
 	echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:4659: checking for tgoto in -ltermcap" >&5
+echo "configure:4477: checking for tgoto in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4663,7 +4481,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4667 "configure"
+#line 4485 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4674,7 +4492,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:4678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4697,7 +4515,7 @@ fi
 fi
 if test "$cf_cv_lib_termcap" = none; then
 	echo $ac_n "checking for tgoto in -lncurses""... $ac_c" 1>&6
-echo "configure:4701: checking for tgoto in -lncurses" >&5
+echo "configure:4519: checking for tgoto in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4705,7 +4523,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4709 "configure"
+#line 4527 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4716,7 +4534,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:4720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4746,12 +4564,12 @@ fi
 
 cf_slang_LIBS2="$LIBS"
 echo $ac_n "checking for acos""... $ac_c" 1>&6
-echo "configure:4750: checking for acos" >&5
+echo "configure:4568: checking for acos" >&5
 if eval "test \"`echo '$''{'ac_cv_func_acos'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4755 "configure"
+#line 4573 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char acos(); below.  */
@@ -4774,7 +4592,7 @@ acos();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_acos=yes"
 else
@@ -4793,7 +4611,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for acos in -lm""... $ac_c" 1>&6
-echo "configure:4797: checking for acos in -lm" >&5
+echo "configure:4615: checking for acos in -lm" >&5
 ac_lib_var=`echo m'_'acos | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4801,7 +4619,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm $LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4805 "configure"
+#line 4623 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4812,7 +4630,7 @@ int main() {
 acos()
 ; return 0; }
 EOF
-if { (eval echo configure:4816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4852,12 +4670,12 @@ fi
 	cf_cv_have_lib_slang=no
 	cf_libdir=""
 	echo $ac_n "checking for SLtt_get_screen_size""... $ac_c" 1>&6
-echo "configure:4856: checking for SLtt_get_screen_size" >&5
+echo "configure:4674: checking for SLtt_get_screen_size" >&5
 if eval "test \"`echo '$''{'ac_cv_func_SLtt_get_screen_size'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4861 "configure"
+#line 4679 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char SLtt_get_screen_size(); below.  */
@@ -4880,7 +4698,7 @@ SLtt_get_screen_size();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_SLtt_get_screen_size=yes"
 else
@@ -4900,17 +4718,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for SLtt_get_screen_size in -lslang""... $ac_c" 1>&6
-echo "configure:4904: checking for SLtt_get_screen_size in -lslang" >&5
+echo "configure:4722: checking for SLtt_get_screen_size in -lslang" >&5
 		LIBS="-lslang $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 4907 "configure"
+#line 4725 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:4914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 cf_cv_have_lib_slang=yes
@@ -4937,17 +4755,17 @@ test "$prefix" != /usr           && cf_search="$cf_search /usr/lib /usr/lib/slan
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -lslang in $cf_libdir""... $ac_c" 1>&6
-echo "configure:4941: checking for -lslang in $cf_libdir" >&5
+echo "configure:4759: checking for -lslang in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -lslang $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 4944 "configure"
+#line 4762 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:4951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 cf_cv_have_lib_slang=yes
@@ -4973,22 +4791,22 @@ fi
 
 cf_slang_LIBS3="$LIBS"
 echo $ac_n "checking if we can link slang without termcap""... $ac_c" 1>&6
-echo "configure:4977: checking if we can link slang without termcap" >&5
-if test -n "$cf_slang_LIBS1" ; then
+echo "configure:4795: checking if we can link slang without termcap" >&5
+if test -n "`echo $cf_slang_LIBS1 | sed -e 's/ //g'`" ; then
 	cf_exclude=`echo ".$cf_slang_LIBS2" | sed -e "s@$cf_slang_LIBS1@@" -e 's@^.@@'`
 else
 	cf_exclude="$cf_slang_LIBS2"
 fi
 LIBS=`echo ".$cf_slang_LIBS3" | sed -e "s@$cf_exclude@@" -e 's@^.@@'`
 cat > conftest.$ac_ext <<EOF
-#line 4985 "configure"
+#line 4803 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:4992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -5008,7 +4826,7 @@ eval cf_libdir=$libdir
 cf_libdir=`echo $cf_libdir | sed -e s@'^NONE/'@$ac_default_prefix/@`
 
 echo $ac_n "checking for location of config-file""... $ac_c" 1>&6
-echo "configure:5012: checking for location of config-file" >&5
+echo "configure:4830: checking for location of config-file" >&5
 LYNX_CFG_FILE=$cf_libdir/lynx.cfg
 cat >> confdefs.h <<EOF
 #define LYNX_CFG_FILE "$LYNX_CFG_FILE"
@@ -5018,12 +4836,12 @@ echo "$ac_t""$LYNX_CFG_FILE" 1>&6
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:5022: checking for ANSI C header files" >&5
+echo "configure:4840: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5027 "configure"
+#line 4845 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -5031,7 +4849,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5048,7 +4866,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 5052 "configure"
+#line 4870 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -5066,7 +4884,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 5070 "configure"
+#line 4888 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -5087,7 +4905,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 5091 "configure"
+#line 4909 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -5098,7 +4916,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:5102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -5122,12 +4940,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:5126: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:4944: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5131 "configure"
+#line 4949 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -5136,7 +4954,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:5140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -5161,12 +4979,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:5165: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4983: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5170 "configure"
+#line 4988 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -5174,7 +4992,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:5178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -5199,7 +5017,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:5203: checking for opendir in -ldir" >&5
+echo "configure:5021: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5207,7 +5025,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5211 "configure"
+#line 5029 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5218,7 +5036,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:5222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5240,7 +5058,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:5244: checking for opendir in -lx" >&5
+echo "configure:5062: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5248,7 +5066,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5252 "configure"
+#line 5070 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5259,7 +5077,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:5263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5297,17 +5115,17 @@ for ac_hdr in \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5301: checking for $ac_hdr" >&5
+echo "configure:5119: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5306 "configure"
+#line 5124 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5311: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5129: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5335,13 +5153,13 @@ done
 
 
 echo $ac_n "checking termio.h and termios.h""... $ac_c" 1>&6
-echo "configure:5339: checking termio.h and termios.h" >&5
+echo "configure:5157: checking termio.h and termios.h" >&5
 if eval "test \"`echo '$''{'cf_cv_termio_and_termios'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 5345 "configure"
+#line 5163 "configure"
 #include "confdefs.h"
 
 #if HAVE_TERMIO_H
@@ -5354,7 +5172,7 @@ int main() {
 putchar (0x0a)
 ; return 0; }
 EOF
-if { (eval echo configure:5358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5176: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_termio_and_termios=yes
 else
@@ -5377,17 +5195,17 @@ for ac_hdr in sys/wait.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5381: checking for $ac_hdr" >&5
+echo "configure:5199: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5386 "configure"
+#line 5204 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5391: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5209: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5424,17 +5242,17 @@ for ac_hdr in wait.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5428: checking for $ac_hdr" >&5
+echo "configure:5246: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5433 "configure"
+#line 5251 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5438: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5256: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5464,17 +5282,17 @@ for ac_hdr in waitstatus.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5468: checking for $ac_hdr" >&5
+echo "configure:5286: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5473 "configure"
+#line 5291 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5478: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5296: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5515,13 +5333,13 @@ fi
 
 
 echo $ac_n "checking for union wait""... $ac_c" 1>&6
-echo "configure:5519: checking for union wait" >&5
+echo "configure:5337: checking for union wait" >&5
 if eval "test \"`echo '$''{'cf_cv_type_unionwait'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 5525 "configure"
+#line 5343 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
@@ -5532,7 +5350,7 @@ int x;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:5536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_type_unionwait=no
 	 echo compiles ok w/o union wait 1>&5
@@ -5543,7 +5361,7 @@ else
   rm -rf conftest*
   
 	cat > conftest.$ac_ext <<EOF
-#line 5547 "configure"
+#line 5365 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
@@ -5558,7 +5376,7 @@ union wait x;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:5562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_type_unionwait=yes
 	 echo compiles ok with union wait and possibly macros too 1>&5
@@ -5585,20 +5403,20 @@ EOF
 if test $cf_cv_type_unionwait = yes; then
 
 	echo $ac_n "checking if union wait can be used as wait-arg""... $ac_c" 1>&6
-echo "configure:5589: checking if union wait can be used as wait-arg" >&5
+echo "configure:5407: checking if union wait can be used as wait-arg" >&5
 	if eval "test \"`echo '$''{'cf_cv_arg_union_wait'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 		cat > conftest.$ac_ext <<EOF
-#line 5595 "configure"
+#line 5413 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
 union wait x; wait(&x)
 ; return 0; }
 EOF
-if { (eval echo configure:5602: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5420: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_arg_union_wait=yes
 else
@@ -5618,20 +5436,20 @@ EOF
 
 
 	echo $ac_n "checking if union wait can be used as waitpid-arg""... $ac_c" 1>&6
-echo "configure:5622: checking if union wait can be used as waitpid-arg" >&5
+echo "configure:5440: checking if union wait can be used as waitpid-arg" >&5
 	if eval "test \"`echo '$''{'cf_cv_arg_union_waitpid'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 		cat > conftest.$ac_ext <<EOF
-#line 5628 "configure"
+#line 5446 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
 union wait x; waitpid(0, &x, 0)
 ; return 0; }
 EOF
-if { (eval echo configure:5635: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_arg_union_waitpid=yes
 else
@@ -5653,12 +5471,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:5657: checking for mode_t" >&5
+echo "configure:5475: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5662 "configure"
+#line 5480 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5688,12 +5506,12 @@ fi
 
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:5692: checking for pid_t" >&5
+echo "configure:5510: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5697 "configure"
+#line 5515 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5722,17 +5540,17 @@ fi
 
 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:5726: checking for vfork.h" >&5
+echo "configure:5544: checking for vfork.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5731 "configure"
+#line 5549 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5757,18 +5575,18 @@ else
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:5761: checking for working vfork" >&5
+echo "configure:5579: checking for working vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
   echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:5767: checking for vfork" >&5
+echo "configure:5585: checking for vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5772 "configure"
+#line 5590 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vfork(); below.  */
@@ -5791,7 +5609,7 @@ vfork();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_vfork=yes"
 else
@@ -5812,7 +5630,7 @@ fi
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5816 "configure"
+#line 5634 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -5907,7 +5725,7 @@ main() {
   }
 }
 EOF
-if { (eval echo configure:5911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_vfork_works=yes
 else
@@ -5931,20 +5749,20 @@ fi
 
 
 echo $ac_n "checking for broken/missing definition of remove""... $ac_c" 1>&6
-echo "configure:5935: checking for broken/missing definition of remove" >&5
+echo "configure:5753: checking for broken/missing definition of remove" >&5
 if eval "test \"`echo '$''{'cf_cv_baddef_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 5941 "configure"
+#line 5759 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 remove("dummy")
 ; return 0; }
 EOF
-if { (eval echo configure:5948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_baddef_remove=no
 else
@@ -5952,7 +5770,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 5956 "configure"
+#line 5774 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 		int __unlink(name) { return unlink(name); } 
@@ -5960,7 +5778,7 @@ int main() {
 remove("dummy")
 ; return 0; }
 EOF
-if { (eval echo configure:5964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_baddef_remove=yes
 else
@@ -5993,12 +5811,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5997: checking for $ac_func" >&5
+echo "configure:5815: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6002 "configure"
+#line 5820 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6021,7 +5839,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6051,12 +5869,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6055: checking for $ac_func" >&5
+echo "configure:5873: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6060 "configure"
+#line 5878 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6079,7 +5897,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6108,13 +5926,27 @@ done
 
 for ac_func in strstr
 do
+
 echo $ac_n "checking for $ac_func declaration""... $ac_c" 1>&6
-echo "configure:6113: checking for $ac_func declaration" >&5
+echo "configure:5932: checking for $ac_func declaration" >&5
 if eval "test \"`echo '$''{'ac_cv_func_decl_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6118 "configure"
+#line 5937 "configure"
+#include "confdefs.h"
+#include <string.h>
+int main() {
+#ifndef ${ac_func}
+extern	int	${ac_func}();
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:5946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+cat > conftest.$ac_ext <<EOF
+#line 5950 "configure"
 #include "confdefs.h"
 #include <string.h>
 int main() {
@@ -6123,17 +5955,28 @@ int	(*p)() = ${ac_func};
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:6127: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+eval "ac_cv_func_decl_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_decl_$ac_func=yes"
+  
+eval "ac_cv_func_decl_$ac_func=no"
+fi
+rm -f conftest*
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_decl_$ac_func=no"
+  
+eval "ac_cv_func_decl_$ac_func=yes"
 fi
 rm -f conftest*
 fi
+
 if eval "test \"`echo '$ac_cv_func_'decl_$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   :
@@ -6152,14 +5995,32 @@ done
 
 for ac_func in getgrgid getgrnam
 do
+
 echo $ac_n "checking for $ac_func declaration""... $ac_c" 1>&6
-echo "configure:6157: checking for $ac_func declaration" >&5
+echo "configure:6001: checking for $ac_func declaration" >&5
 if eval "test \"`echo '$''{'ac_cv_func_decl_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6162 "configure"
+#line 6006 "configure"
 #include "confdefs.h"
+
+#include <stdio.h>
+#include <grp.h>
+int main() {
+#ifndef ${ac_func}
+extern	int	${ac_func}();
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:6017: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+cat > conftest.$ac_ext <<EOF
+#line 6021 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
 #include <grp.h>
 int main() {
 #ifndef ${ac_func}
@@ -6167,17 +6028,28 @@ int	(*p)() = ${ac_func};
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:6171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6032: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_func_decl_$ac_func=yes"
+  
+eval "ac_cv_func_decl_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+eval "ac_cv_func_decl_$ac_func=no"
+fi
+rm -f conftest*
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_decl_$ac_func=no"
+  
+eval "ac_cv_func_decl_$ac_func=yes"
 fi
 rm -f conftest*
 fi
+
 if eval "test \"`echo '$ac_cv_func_'decl_$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   :
@@ -6198,13 +6070,13 @@ done
 
 
 echo $ac_n "checking if TRUE/FALSE are defined""... $ac_c" 1>&6
-echo "configure:6202: checking if TRUE/FALSE are defined" >&5
+echo "configure:6074: checking if TRUE/FALSE are defined" >&5
 if eval "test \"`echo '$''{'cf_cv_bool_defs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 6208 "configure"
+#line 6080 "configure"
 #include "confdefs.h"
 
 #include <$cf_cv_ncurses_header>
@@ -6213,7 +6085,7 @@ int main() {
 int x = TRUE, y = FALSE
 ; return 0; }
 EOF
-if { (eval echo configure:6217: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_bool_defs=yes
 else
@@ -6240,13 +6112,13 @@ fi
 
 
 echo $ac_n "checking declaration of errno""... $ac_c" 1>&6
-echo "configure:6244: checking declaration of errno" >&5
+echo "configure:6116: checking declaration of errno" >&5
 if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 6250 "configure"
+#line 6122 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -6256,7 +6128,7 @@ int main() {
 long x = (long) errno
 ; return 0; }
 EOF
-if { (eval echo configure:6260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval 'cf_cv_dcl_'errno'=yes'
 else
@@ -6272,6 +6144,10 @@ eval 'cf_result=$cf_cv_dcl_'errno
 echo "$ac_t""$cf_result" 1>&6
 
 # It's possible (for near-UNIX clones) that the data doesn't exist
+if eval "test \"`echo '$''{'cf_cv_have_errno'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
 if test $cf_result = no ; then
     eval 'cf_result=DECL_'errno
     
@@ -6282,13 +6158,9 @@ cf_result=`echo $cf_result | tr '[a-z]' '[A-Z]'`
 EOF
 
     echo $ac_n "checking existence of errno""... $ac_c" 1>&6
-echo "configure:6286: checking existence of errno" >&5
-    if eval "test \"`echo '$''{'cf_cv_have_errno'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  
+echo "configure:6162: checking existence of errno" >&5
         cat > conftest.$ac_ext <<EOF
-#line 6292 "configure"
+#line 6164 "configure"
 #include "confdefs.h"
 
 #undef errno
@@ -6298,7 +6170,7 @@ int main() {
 errno = 2
 ; return 0; }
 EOF
-if { (eval echo configure:6302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval 'cf_cv_have_'errno'=yes'
 else
@@ -6308,29 +6180,40 @@ else
   eval 'cf_cv_have_'errno'=no'
 fi
 rm -f conftest*
+        eval 'cf_result=$cf_cv_have_'errno
+        echo "$ac_t""$cf_result" 1>&6
+else
+    eval 'cf_cv_have_'errno'=yes'
 fi
 
-    eval 'cf_result=$cf_cv_have_'errno
-    echo "$ac_t""$cf_result" 1>&6
 fi
 
+eval 'cf_result=HAVE_'errno
+
+cf_result=`echo $cf_result | tr '[a-z]' '[A-Z]'`
+
+eval 'test $cf_cv_have_'errno' = yes && cat >> confdefs.h <<EOF
+#define $cf_result 1
+EOF
+'
+
 
 
 echo $ac_n "checking for setlocale()""... $ac_c" 1>&6
-echo "configure:6321: checking for setlocale()" >&5
+echo "configure:6204: checking for setlocale()" >&5
 if eval "test \"`echo '$''{'cf_cv_locale'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 6327 "configure"
+#line 6210 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 setlocale(LC_ALL, "")
 ; return 0; }
 EOF
-if { (eval echo configure:6334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_locale=yes
 else
@@ -6351,13 +6234,13 @@ EOF
 
 
 echo $ac_n "checking if NGROUPS is defined""... $ac_c" 1>&6
-echo "configure:6355: checking if NGROUPS is defined" >&5
+echo "configure:6238: checking if NGROUPS is defined" >&5
 if eval "test \"`echo '$''{'cf_cv_ngroups'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 6361 "configure"
+#line 6244 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_PARAM_H
@@ -6371,7 +6254,7 @@ int main() {
 int x = NGROUPS
 ; return 0; }
 EOF
-if { (eval echo configure:6375: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ngroups=yes
 else
@@ -6379,7 +6262,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 6383 "configure"
+#line 6266 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_PARAM_H
@@ -6393,7 +6276,7 @@ int main() {
 int x = NGROUPS_MAX
 ; return 0; }
 EOF
-if { (eval echo configure:6397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6280: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ngroups=NGROUPS_MAX
 else
@@ -6427,13 +6310,13 @@ for cf_name in sys_nerr sys_errlist
 do
     
 echo $ac_n "checking declaration of $cf_name""... $ac_c" 1>&6
-echo "configure:6431: checking declaration of $cf_name" >&5
+echo "configure:6314: checking declaration of $cf_name" >&5
 if eval "test \"`echo '$''{'cf_cv_dcl_$cf_name'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 6437 "configure"
+#line 6320 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -6443,7 +6326,7 @@ int main() {
 long x = (long) $cf_name
 ; return 0; }
 EOF
-if { (eval echo configure:6447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval 'cf_cv_dcl_'$cf_name'=yes'
 else
@@ -6459,6 +6342,10 @@ eval 'cf_result=$cf_cv_dcl_'$cf_name
 echo "$ac_t""$cf_result" 1>&6
 
 # It's possible (for near-UNIX clones) that the data doesn't exist
+if eval "test \"`echo '$''{'cf_cv_have_$cf_name'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
 if test $cf_result = no ; then
     eval 'cf_result=DECL_'$cf_name
     
@@ -6469,13 +6356,9 @@ cf_result=`echo $cf_result | tr '[a-z]' '[A-Z]'`
 EOF
 
     echo $ac_n "checking existence of $cf_name""... $ac_c" 1>&6
-echo "configure:6473: checking existence of $cf_name" >&5
-    if eval "test \"`echo '$''{'cf_cv_have_$cf_name'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  
+echo "configure:6360: checking existence of $cf_name" >&5
         cat > conftest.$ac_ext <<EOF
-#line 6479 "configure"
+#line 6362 "configure"
 #include "confdefs.h"
 
 #undef $cf_name
@@ -6485,7 +6368,7 @@ int main() {
 $cf_name = 2
 ; return 0; }
 EOF
-if { (eval echo configure:6489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval 'cf_cv_have_'$cf_name'=yes'
 else
@@ -6495,23 +6378,34 @@ else
   eval 'cf_cv_have_'$cf_name'=no'
 fi
 rm -f conftest*
+        eval 'cf_result=$cf_cv_have_'$cf_name
+        echo "$ac_t""$cf_result" 1>&6
+else
+    eval 'cf_cv_have_'$cf_name'=yes'
 fi
 
-    eval 'cf_result=$cf_cv_have_'$cf_name
-    echo "$ac_t""$cf_result" 1>&6
 fi
 
+eval 'cf_result=HAVE_'$cf_name
+
+cf_result=`echo $cf_result | tr '[a-z]' '[A-Z]'`
+
+eval 'test $cf_cv_have_'$cf_name' = yes && cat >> confdefs.h <<EOF
+#define $cf_result 1
+EOF
+'
+
 done
 
 
 echo $ac_n "checking if struct utmp is declared""... $ac_c" 1>&6
-echo "configure:6509: checking if struct utmp is declared" >&5
+echo "configure:6403: checking if struct utmp is declared" >&5
 if eval "test \"`echo '$''{'cf_cv_have_utmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 6515 "configure"
+#line 6409 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -6520,7 +6414,7 @@ int main() {
 struct utmp x; char *y = &x.ut_host[0]
 ; return 0; }
 EOF
-if { (eval echo configure:6524: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6418: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp=yes
 else
@@ -6528,14 +6422,14 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 6532 "configure"
+#line 6426 "configure"
 #include "confdefs.h"
 #include <utmpx.h>
 int main() {
 struct utmpx x; char *y = &x.ut_host[0]
 ; return 0; }
 EOF
-if { (eval echo configure:6539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6433: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp=utmpx
 else
@@ -6566,13 +6460,13 @@ EOF
 if test $cf_cv_screen != slang ; then
 	
 echo $ac_n "checking if curses supports alternate-character set""... $ac_c" 1>&6
-echo "configure:6570: checking if curses supports alternate-character set" >&5
+echo "configure:6464: checking if curses supports alternate-character set" >&5
 if eval "test \"`echo '$''{'cf_cv_alt_char_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 6576 "configure"
+#line 6470 "configure"
 #include "confdefs.h"
 
 #include <$cf_cv_ncurses_header>
@@ -6581,7 +6475,7 @@ int main() {
 chtype x = acs_map['l']; acs_map['m'] = 0
 ; return 0; }
 EOF
-if { (eval echo configure:6585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_alt_char_set=yes
 else
@@ -6601,13 +6495,13 @@ EOF
 
 	
 echo $ac_n "checking if curses supports fancy attributes""... $ac_c" 1>&6
-echo "configure:6605: checking if curses supports fancy attributes" >&5
+echo "configure:6499: checking if curses supports fancy attributes" >&5
 if eval "test \"`echo '$''{'cf_cv_fancy_curses'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 6611 "configure"
+#line 6505 "configure"
 #include "confdefs.h"
 
 #include <$cf_cv_ncurses_header>
@@ -6620,7 +6514,7 @@ attrset(A_UNDERLINE|A_BOLD|A_REVERSE);
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_fancy_curses=yes
 else
@@ -6640,7 +6534,7 @@ EOF
 
 
 	echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
-echo "configure:6644: checking for ncurses version" >&5
+echo "configure:6538: checking for ncurses version" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6665,7 +6559,7 @@ Autoconf "old"
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo configure:6669: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	{ (eval echo configure:6563: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's@^Autoconf @@' -e 's@^[^"]*"@@' -e 's@".*@@'`
 		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
@@ -6674,7 +6568,7 @@ EOF
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 6678 "configure"
+#line 6572 "configure"
 #include "confdefs.h"
 
 #include <$cf_cv_ncurses_header>
@@ -6697,7 +6591,7 @@ int main()
 	exit(0);
 }
 EOF
-if { (eval echo configure:6701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -6717,13 +6611,13 @@ echo "$ac_t""$cf_cv_ncurses_version" 1>&6
 
 if test "$cf_cv_ncurses_version" != no ; then
 echo $ac_n "checking for obsolete/broken version of ncurses""... $ac_c" 1>&6
-echo "configure:6721: checking for obsolete/broken version of ncurses" >&5
+echo "configure:6615: checking for obsolete/broken version of ncurses" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 6727 "configure"
+#line 6621 "configure"
 #include "confdefs.h"
 
 #include <$cf_cv_ncurses_header>
@@ -6737,7 +6631,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:6741: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6635: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ncurses_broken=no
 else
@@ -6762,13 +6656,13 @@ fi
 
 	
 echo $ac_n "checking if curses supports color attributes""... $ac_c" 1>&6
-echo "configure:6766: checking if curses supports color attributes" >&5
+echo "configure:6660: checking if curses supports color attributes" >&5
 if eval "test \"`echo '$''{'cf_cv_color_curses'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 6772 "configure"
+#line 6666 "configure"
 #include "confdefs.h"
 
 #include <$cf_cv_ncurses_header>
@@ -6783,7 +6677,7 @@ chtype x = COLOR_BLUE;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_color_curses=yes
 else
@@ -6810,7 +6704,7 @@ fi
 
 	
 echo $ac_n "checking declaration of size-change""... $ac_c" 1>&6
-echo "configure:6814: checking declaration of size-change" >&5
+echo "configure:6708: checking declaration of size-change" >&5
 if eval "test \"`echo '$''{'cf_cv_sizechange'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6824,11 +6718,15 @@ do
     CFLAGS="$cf_save_CFLAGS"
     test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts"
     cat > conftest.$ac_ext <<EOF
-#line 6828 "configure"
+#line 6722 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if HAVE_TERMIOS_H
 #include <termios.h>
+#else
+#if HAVE_TERMIO_H
+#include <termio.h>
+#endif
 #endif
 #if NEED_PTEM_H
 /* This is a workaround for SCO:  they neglected to define struct winsize in
@@ -6859,7 +6757,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_sizechange=yes
 else
@@ -6891,20 +6789,20 @@ EOF
 
 	
 echo $ac_n "checking if ttytype is declared in curses library""... $ac_c" 1>&6
-echo "configure:6895: checking if ttytype is declared in curses library" >&5
+echo "configure:6793: checking if ttytype is declared in curses library" >&5
 if eval "test \"`echo '$''{'cf_cv_have_ttytype'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 6901 "configure"
+#line 6799 "configure"
 #include "confdefs.h"
 #include <$cf_cv_ncurses_header>
 int main() {
 char *x = &ttytype[1]; *x = 1
 ; return 0; }
 EOF
-if { (eval echo configure:6908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_have_ttytype=yes
 else
@@ -6931,12 +6829,12 @@ EOF
 	
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6935: checking for $ac_func" >&5
+echo "configure:6833: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6940 "configure"
+#line 6838 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6959,7 +6857,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -7001,7 +6899,8 @@ EOF
 	EXTRA_DEPS="$EXTRA_DEPS do_chartrans_stuff"
 
 echo $ac_n "checking if color-style code should be used""... $ac_c" 1>&6
-echo "configure:7005: checking if color-style code should be used" >&5
+echo "configure:6903: checking if color-style code should be used" >&5
+
 # Check whether --enable-color-style or --disable-color-style was given.
 if test "${enable_color_style+set}" = set; then
   enableval="$enable_color_style"
@@ -7038,6 +6937,7 @@ fi
 case $use_color_style in
 no)
 	echo "$ac_t""no" 1>&6
+	INSTALL_LSS=
 	;;
 *)
 	cat >> confdefs.h <<\EOF
@@ -7047,18 +6947,21 @@ EOF
 	echo "$ac_t""curses-style" 1>&6
 
 	echo $ac_n "checking for location of style-sheet file""... $ac_c" 1>&6
-echo "configure:7051: checking for location of style-sheet file" >&5
+echo "configure:6951: checking for location of style-sheet file" >&5
 	LYNX_LSS_FILE=$cf_libdir/lynx.lss
 	cat >> confdefs.h <<EOF
 #define LYNX_LSS_FILE "$LYNX_LSS_FILE"
 EOF
 
 	echo "$ac_t""$LYNX_LSS_FILE" 1>&6
+	INSTALL_LSS=install-lss
 	;;
 esac
 
+
 echo $ac_n "checking if you want to use external commands""... $ac_c" 1>&6
-echo "configure:7062: checking if you want to use external commands" >&5
+echo "configure:6964: checking if you want to use external commands" >&5
+
 # Check whether --enable-externs or --disable-externs was given.
 if test "${enable_externs+set}" = set; then
   enableval="$enable_externs"
@@ -7076,12 +6979,85 @@ fi
 
 echo "$ac_t""$use_externs" 1>&6
 test $use_externs != ".no" && cat >> confdefs.h <<\EOF
-#define USE_EXTERNS 1
+#define USE_EXTERNALS 1
+EOF
+
+
+echo $ac_n "checking if you want to use setfont support""... $ac_c" 1>&6
+echo "configure:6988: checking if you want to use setfont support" >&5
+
+# Check whether --enable-font-switch or --disable-font-switch was given.
+if test "${enable_font_switch+set}" = set; then
+  enableval="$enable_font_switch"
+  test "$enableval" != yes && enableval=no
+  if test "$enableval" != "no" ; then
+    use_setfont=yes 
+  else
+    use_setfont=no
+  fi
+else
+  enableval=no 
+  use_setfont=no
+  
+fi
+
+echo "$ac_t""$use_setfont" 1>&6
+test $use_setfont = yes && cat >> confdefs.h <<\EOF
+#define EXP_CHARTRANS_AUTOSWITCH 1
+EOF
+
+
+echo $ac_n "checking if you want to fork NSL requests""... $ac_c" 1>&6
+echo "configure:7012: checking if you want to fork NSL requests" >&5
+
+# Check whether --enable-nsl-fork or --disable-nsl-fork was given.
+if test "${enable_nsl_fork+set}" = set; then
+  enableval="$enable_nsl_fork"
+  test "$enableval" != yes && enableval=no
+  if test "$enableval" != "no" ; then
+    use_nsl_fork=yes 
+  else
+    use_nsl_fork=no
+  fi
+else
+  enableval=no 
+  use_nsl_fork=no
+  
+fi
+
+echo "$ac_t""$use_nsl_fork" 1>&6
+test $use_nsl_fork = yes && cat >> confdefs.h <<\EOF
+#define NSL_FORK 1
+EOF
+
+
+echo $ac_n "checking if you want to underline links""... $ac_c" 1>&6
+echo "configure:7036: checking if you want to underline links" >&5
+
+# Check whether --enable-underlines or --disable-underlines was given.
+if test "${enable_underlines+set}" = set; then
+  enableval="$enable_underlines"
+  test "$enableval" != yes && enableval=no
+  if test "$enableval" != "no" ; then
+    use_underline=yes 
+  else
+    use_underline=no
+  fi
+else
+  enableval=no 
+  use_underline=no
+  
+fi
+
+echo "$ac_t""$use_underline" 1>&6
+test $use_underline = yes && cat >> confdefs.h <<\EOF
+#define UNDERLINE_LINKS 1
 EOF
 
 
 echo $ac_n "checking if you want to use zlib for decompression of some gzip files""... $ac_c" 1>&6
-echo "configure:7085: checking if you want to use zlib for decompression of some gzip files" >&5
+echo "configure:7060: checking if you want to use zlib for decompression of some gzip files" >&5
+
 # Check whether --with-zlib or --without-zlib was given.
 if test "${with_zlib+set}" = set; then
   withval="$with_zlib"
@@ -7097,12 +7073,12 @@ if test ".$use_zlib" != ".no" ; then
 	cf_cv_have_lib_z=no
 	cf_libdir=""
 	echo $ac_n "checking for gzopen""... $ac_c" 1>&6
-echo "configure:7101: checking for gzopen" >&5
+echo "configure:7077: checking for gzopen" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gzopen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7106 "configure"
+#line 7082 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gzopen(); below.  */
@@ -7125,7 +7101,7 @@ gzopen();
 
 ; return 0; }
 EOF
-if { (eval echo configure:7129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gzopen=yes"
 else
@@ -7145,17 +7121,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for gzopen in -lz""... $ac_c" 1>&6
-echo "configure:7149: checking for gzopen in -lz" >&5
+echo "configure:7125: checking for gzopen in -lz" >&5
 		LIBS="-lz $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 7152 "configure"
+#line 7128 "configure"
 #include "confdefs.h"
 #include <zlib.h>
 int main() {
 gzopen("name","mode")
 ; return 0; }
 EOF
-if { (eval echo configure:7159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 cf_cv_have_lib_z=yes
@@ -7182,17 +7158,17 @@ test "$prefix" != /usr           && cf_search="$cf_search /usr/lib /usr/lib/z"
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -lz in $cf_libdir""... $ac_c" 1>&6
-echo "configure:7186: checking for -lz in $cf_libdir" >&5
+echo "configure:7162: checking for -lz in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -lz $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 7189 "configure"
+#line 7165 "configure"
 #include "confdefs.h"
 #include <zlib.h>
 int main() {
 gzopen("name","mode")
 ; return 0; }
 EOF
-if { (eval echo configure:7196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 cf_cv_have_lib_z=yes
@@ -7228,7 +7204,8 @@ fi
 # All DirEd functions that were enabled on compilation can be disabled
 # or modified at run time via DIRED_MENU symbols in lynx.cfg.
 echo $ac_n "checking if directory-editor code should be used""... $ac_c" 1>&6
-echo "configure:7232: checking if directory-editor code should be used" >&5
+echo "configure:7208: checking if directory-editor code should be used" >&5
+
 # Check whether --enable-dired or --disable-dired was given.
 if test "${enable_dired+set}" = set; then
   enableval="$enable_dired"
@@ -7253,8 +7230,9 @@ EOF
 
 
 	echo $ac_n "checking if you wish to allow extracting from archives via DirEd""... $ac_c" 1>&6
-echo "configure:7257: checking if you wish to allow extracting from archives via DirEd" >&5
-	# Check whether --enable-dired-archive or --disable-dired-archive was given.
+echo "configure:7234: checking if you wish to allow extracting from archives via DirEd" >&5
+	
+# Check whether --enable-dired-archive or --disable-dired-archive was given.
 if test "${enable_dired_archive+set}" = set; then
   enableval="$enable_dired_archive"
   test "$enableval" != no && enableval=yes
@@ -7271,8 +7249,9 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow users to redefine DirEd keys""... $ac_c" 1>&6
-echo "configure:7275: checking if you wish to allow users to redefine DirEd keys" >&5
-	# Check whether --enable-dired-override or --disable-dired-override was given.
+echo "configure:7253: checking if you wish to allow users to redefine DirEd keys" >&5
+	
+# Check whether --enable-dired-override or --disable-dired-override was given.
 if test "${enable_dired_override+set}" = set; then
   enableval="$enable_dired_override"
   test "$enableval" != no && enableval=yes
@@ -7296,8 +7275,9 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow permissions commands via DirEd""... $ac_c" 1>&6
-echo "configure:7300: checking if you wish to allow permissions commands via DirEd" >&5
-	# Check whether --enable-dired-permit or --disable-dired-permit was given.
+echo "configure:7279: checking if you wish to allow permissions commands via DirEd" >&5
+	
+# Check whether --enable-dired-permit or --disable-dired-permit was given.
 if test "${enable_dired_permit+set}" = set; then
   enableval="$enable_dired_permit"
   test "$enableval" != no && enableval=yes
@@ -7321,8 +7301,9 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow executable-permission commands via DirEd""... $ac_c" 1>&6
-echo "configure:7325: checking if you wish to allow executable-permission commands via DirEd" >&5
-	# Check whether --enable-dired-xpermit or --disable-dired-xpermit was given.
+echo "configure:7305: checking if you wish to allow executable-permission commands via DirEd" >&5
+	
+# Check whether --enable-dired-xpermit or --disable-dired-xpermit was given.
 if test "${enable_dired_xpermit+set}" = set; then
   enableval="$enable_dired_xpermit"
   test "$enableval" != no && enableval=yes
@@ -7339,8 +7320,9 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow \"tar\" commands from DirEd""... $ac_c" 1>&6
-echo "configure:7343: checking if you wish to allow \"tar\" commands from DirEd" >&5
-	# Check whether --enable-dired-tar or --disable-dired-tar was given.
+echo "configure:7324: checking if you wish to allow \"tar\" commands from DirEd" >&5
+	
+# Check whether --enable-dired-tar or --disable-dired-tar was given.
 if test "${enable_dired_tar+set}" = set; then
   enableval="$enable_dired_tar"
   test "$enableval" != no && enableval=yes
@@ -7364,8 +7346,9 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow \"uudecode\" commands from DirEd""... $ac_c" 1>&6
-echo "configure:7368: checking if you wish to allow \"uudecode\" commands from DirEd" >&5
-	# Check whether --enable-dired-uudecode or --disable-dired-uudecode was given.
+echo "configure:7350: checking if you wish to allow \"uudecode\" commands from DirEd" >&5
+	
+# Check whether --enable-dired-uudecode or --disable-dired-uudecode was given.
 if test "${enable_dired_uudecode+set}" = set; then
   enableval="$enable_dired_uudecode"
   test "$enableval" != no && enableval=yes
@@ -7389,8 +7372,9 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow \"zip\" and \"unzip\" commands from DirEd""... $ac_c" 1>&6
-echo "configure:7393: checking if you wish to allow \"zip\" and \"unzip\" commands from DirEd" >&5
-	# Check whether --enable-dired-zip or --disable-dired-zip was given.
+echo "configure:7376: checking if you wish to allow \"zip\" and \"unzip\" commands from DirEd" >&5
+	
+# Check whether --enable-dired-zip or --disable-dired-zip was given.
 if test "${enable_dired_zip+set}" = set; then
   enableval="$enable_dired_zip"
   test "$enableval" != no && enableval=yes
@@ -7414,8 +7398,9 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow \"gzip\" and \"gunzip\" commands from DirEd""... $ac_c" 1>&6
-echo "configure:7418: checking if you wish to allow \"gzip\" and \"gunzip\" commands from DirEd" >&5
-	# Check whether --enable-dired-gzip or --disable-dired-gzip was given.
+echo "configure:7402: checking if you wish to allow \"gzip\" and \"gunzip\" commands from DirEd" >&5
+	
+# Check whether --enable-dired-gzip or --disable-dired-gzip was given.
 if test "${enable_dired_gzip+set}" = set; then
   enableval="$enable_dired_gzip"
   test "$enableval" != no && enableval=yes
@@ -7440,7 +7425,8 @@ fi
 fi
 
 echo $ac_n "checking if you want long-directory listings""... $ac_c" 1>&6
-echo "configure:7444: checking if you want long-directory listings" >&5
+echo "configure:7429: checking if you want long-directory listings" >&5
+
 # Check whether --enable-long-list or --disable-long-list was given.
 if test "${enable_long_list+set}" = set; then
   enableval="$enable_long_list"
@@ -7465,7 +7451,8 @@ fi
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking if parent-directory references are permitted""... $ac_c" 1>&6
-echo "configure:7469: checking if parent-directory references are permitted" >&5
+echo "configure:7455: checking if parent-directory references are permitted" >&5
+
 # Check whether --enable-parent-dir-refs or --disable-parent-dir-refs was given.
 if test "${enable_parent_dir_refs+set}" = set; then
   enableval="$enable_parent_dir_refs"
@@ -7584,7 +7571,7 @@ do
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.12.970309"
+    echo "$CONFIG_STATUS generated by autoconf version 2.12.971230"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -7652,7 +7639,6 @@ s%@CHMOD@%$CHMOD%g
 s%@COMPRESS@%$COMPRESS%g
 s%@COPY@%$COPY%g
 s%@GZIP@%$GZIP%g
-s%@INSTALL@%$INSTALL%g
 s%@MKDIR@%$MKDIR%g
 s%@MV@%$MV%g
 s%@RM@%$RM%g
@@ -7666,6 +7652,7 @@ s%@ZIP@%$ZIP%g
 s%@LIBOBJS@%$LIBOBJS%g
 s%@EXTRA_OBJS@%$EXTRA_OBJS%g
 s%@EXTRA_DEPS@%$EXTRA_DEPS%g
+s%@INSTALL_LSS@%$INSTALL_LSS%g
 s%@SRCDIR_CLEAN@%$SRCDIR_CLEAN%g
 
 CEOF
@@ -7813,6 +7800,7 @@ for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
 
 EOF
 
+
 # Transform confdefs.h into a sed script conftest.vals that substitutes
 # the proper values into config.h.in to produce config.h.  And first:
 # Protect against being on the right side of a sed subst in config.status.
@@ -7858,6 +7846,7 @@ do
 done
 rm -f conftest.vals
 
+
 cat >> $CONFIG_STATUS <<\EOF
   rm -f conftest.frag conftest.h
   echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
@@ -7880,9 +7869,11 @@ fi; done
 
 EOF
 cat >> $CONFIG_STATUS <<EOF
+# Extra initialization commands, if any
 
 EOF
 cat >> $CONFIG_STATUS <<\EOF
+# Extra commands, if any
 
 exit 0
 EOF
diff --git a/configure.in b/configure.in
index d0962e02..dfef6c10 100644
--- a/configure.in
+++ b/configure.in
@@ -105,7 +105,6 @@ CF_PATH_PROG(CHMOD,	chmod)
 CF_PATH_PROG(COMPRESS,	compress)
 CF_PATH_PROG(COPY,	cp)
 CF_PATH_PROG(GZIP,	gzip)
-CF_PATH_PROG(INSTALL,	install)
 CF_PATH_PROG(MKDIR,	mkdir)
 CF_PATH_PROG(MV,	mv)
 CF_PATH_PROG(RM,	rm)
@@ -117,6 +116,17 @@ CF_PATH_PROG(UUDECODE,	uudecode)
 CF_PATH_PROG(ZCAT,	zcat)
 CF_PATH_PROG(ZIP,	zip)
 
+dnl 'INSTALL' is a special case, since the configure script has to find a
+dnl BSD-compatible one so the build/install works properly.
+case "$INSTALL" in
+$srcdir*) # (vi
+	AC_DEFINE_UNQUOTED(INSTALL_PATH,"install")
+	;;
+*) # (vi
+	AC_DEFINE_UNQUOTED(INSTALL_PATH,"$INSTALL")
+	;;
+esac
+
 dnl --------------------------------------------------------------------------
 dnl Checks for compiler & standard-library characteristics
 dnl --------------------------------------------------------------------------
@@ -326,7 +336,9 @@ AC_REPLACE_FUNCS( \
 )
 
 CF_CHECK_FUNCDECLS([#include <string.h>], strstr)
-CF_CHECK_FUNCDECLS([#include <grp.h>], getgrgid getgrnam)
+CF_CHECK_FUNCDECLS([
+#include <stdio.h>
+#include <grp.h>], getgrgid getgrnam)
 
 dnl --------------------------------------------------------------------------
 dnl Checks for external-data
@@ -400,6 +412,7 @@ fi
 case $use_color_style in
 no)
 	AC_MSG_RESULT(no)
+	INSTALL_LSS=
 	;;
 *)
 	AC_DEFINE(USE_COLOR_STYLE)
@@ -409,8 +422,10 @@ no)
 	LYNX_LSS_FILE=$cf_libdir/lynx.lss
 	AC_DEFINE_UNQUOTED(LYNX_LSS_FILE,"$LYNX_LSS_FILE")
 	AC_MSG_RESULT($LYNX_LSS_FILE)
+	INSTALL_LSS=install-lss
 	;;
 esac
+AC_SUBST(INSTALL_LSS)
 
 AC_MSG_CHECKING(if you want to use external commands)
 CF_ARG_ENABLE(externs,
@@ -418,7 +433,31 @@ CF_ARG_ENABLE(externs,
 	[use_externs=yes],
 	[use_externs=no])
 AC_MSG_RESULT($use_externs)
-test $use_externs != ".no" && AC_DEFINE(USE_EXTERNS)
+test $use_externs != ".no" && AC_DEFINE(USE_EXTERNALS)
+
+AC_MSG_CHECKING(if you want to use setfont support)
+CF_ARG_ENABLE(font-switch,
+[  --enable-font-switch    use Linux setfont for character-translation],
+	[use_setfont=yes],
+	[use_setfont=no])
+AC_MSG_RESULT($use_setfont)
+test $use_setfont = yes && AC_DEFINE(EXP_CHARTRANS_AUTOSWITCH)
+
+AC_MSG_CHECKING(if you want to fork NSL requests)
+CF_ARG_ENABLE(nsl-fork,
+[  --enable-nsl-fork       fork NSL requests, allowing them to be aborted],
+	[use_nsl_fork=yes],
+	[use_nsl_fork=no])
+AC_MSG_RESULT($use_nsl_fork)
+test $use_nsl_fork = yes && AC_DEFINE(NSL_FORK)
+
+AC_MSG_CHECKING(if you want to underline links)
+CF_ARG_ENABLE(underlines,
+[  --enable-underlines     underline links rather than using boldface],
+	[use_underline=yes],
+	[use_underline=no])
+AC_MSG_RESULT($use_underline)
+test $use_underline = yes && AC_DEFINE(UNDERLINE_LINKS)
 
 AC_MSG_CHECKING(if you want to use zlib for decompression of some gzip files)
 AC_ARG_WITH(zlib,
diff --git a/docs/CHANGES2-3 b/docs/CHANGES2.3
index f9653d4e..f9653d4e 100644
--- a/docs/CHANGES2-3
+++ b/docs/CHANGES2.3
diff --git a/docs/CHANGES2-4 b/docs/CHANGES2.4
index 2d242e2e..2d242e2e 100644
--- a/docs/CHANGES2-4
+++ b/docs/CHANGES2.4
diff --git a/docs/CHANGES2-5 b/docs/CHANGES2.5
index 38621df6..38621df6 100644
--- a/docs/CHANGES2-5
+++ b/docs/CHANGES2.5
diff --git a/docs/CHANGES2-6 b/docs/CHANGES2.6
index 73c158ab..73c158ab 100644
--- a/docs/CHANGES2-6
+++ b/docs/CHANGES2.6
diff --git a/docs/CHANGES2-7 b/docs/CHANGES2.7
index 559ebd25..559ebd25 100644
--- a/docs/CHANGES2-7
+++ b/docs/CHANGES2.7
diff --git a/lynx.cfg b/lynx.cfg
index 80a7af5c..186f9b2a 100644
--- a/lynx.cfg
+++ b/lynx.cfg
@@ -187,46 +187,50 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html
 # The default character sets include:
 #    Display Character Set name		MIME name
 #    ==========================		=========
-#    ISO Latin 1			iso-8859-1
-#    ISO Latin 2			iso-8859-2
-#    Other ISO Latin			x-iso-8859-other
-#    WinLatin1 (cp1252)			iso-8859-1-windows-3.1-latin-1
-#    DEC Multinational			dec-mcs
-#    Macintosh (8 bit)			macintosh
-#    NeXT character set			x-next
-#    KOI8-R Cyrillic     		koi8-r
-#    Chinese				euc-cn
-#    Japanese (EUC)			euc-jp
-#    Japanese (SJIS)			shift_jis
-#    Korean				euc-kr
-#    Taipei (Big5)			big5
-#    Vietnamese (VISCII)		viscii
 #    7 bit approximations		us-ascii
-#    Transparent			x-transparent
-#    IBM PC character set		cp437
-#    IBM PC codepage 850		cp850
-#    PC Latin2 CP 852			cp852
+#    Chinese				euc-cn
+#    DEC Multinational			dec-mcs
+#    DosArabic (cp864)			cp864
+#    DosBaltRim (cp775)			cp775
 #    DosCyrillic (cp866)		cp866
 #    DosGreek (cp737)			cp737
 #    DosGreek2 (cp869)			cp869
-#    DosArabic (cp864)			cp864
 #    DosHebrew (cp862)			cp862
-#    WinLatin2 (cp1250)			windows-1250
-#    WinCyrillic (cp1251)		windows-1251
-#    WinGreek (cp1253)			windows-1253
-#    WinHebrew (cp1255)			windows-1255
-#    WinArabic (cp1256)			windows-1256
-#    ISO Latin 3			iso-8859-3
-#    ISO Latin 4			iso-8859-4
+#    DosLatin1 (cp850)			cp850
+#    DosLatinUS (cp437)			cp437
+#    IBM PC character set		cp437
+#    IBM PC codepage 850		cp850
+#    ISO 8859-10			iso-8859-10
 #    ISO 8859-5 Cyrillic		iso-8859-5
 #    ISO 8859-6 Arabic			iso-8859-6
 #    ISO 8859-7 Greek			iso-8859-7
 #    ISO 8859-8 Hebrew			iso-8859-8
 #    ISO 8859-9 (Latin 5)		iso-8859-9
-#    ISO 8859-10			iso-8859-10
-#    UNICODE UTF 8			unicode-1-1-utf-8
-#    RFC 1345 w/o Intro			mnemonic+ascii+0
+#    ISO Latin 1			iso-8859-1
+#    ISO Latin 2			iso-8859-2
+#    ISO Latin 3			iso-8859-3
+#    ISO Latin 4			iso-8859-4
+#    Japanese (EUC)			euc-jp
+#    Japanese (SJIS)			shift_jis
+#    KOI8-R Cyrillic			koi8-r
+#    Korean				euc-kr
+#    Macintosh (8 bit)			macintosh
+#    NeXT character set			x-next
+#    Other ISO Latin			x-iso-8859-other
+#    PC Latin2 CP 852			cp852
 #    RFC 1345 Mnemonic			mnemonic
+#    RFC 1345 w/o Intro			mnemonic+ascii+0
+#    Taipei (Big5)			big5
+#    Transparent			x-transparent
+#    UNICODE UTF 8			utf-8
+#    Vietnamese (VISCII)		viscii
+#    WinArabic (cp1256)			cp1256
+#    WinBaltRim (cp1257)		cp1257
+#    WinCyrillic (cp1251)		cp1251
+#    WinGreek (cp1253)			cp1253
+#    WinHebrew (cp1255)			cp1255
+#    WinLatin1 (cp1252)			cp1252
+#    WinLatin2 (cp1250)			cp1250
 #
 #CHARACTER_SET:ISO Latin 1
 
@@ -712,25 +716,38 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html
 
 # VMS:
 #=====
-# The mail command is defined in userdefs.h.  It will be spawned as a
-# subprocess of lynx and used to send replies and error messages.
-# It can be re-defined here.  Your mailer must be able to accept a
-# subject line through the use of the /subject="SUBJECT" option.
-# If your mailer uses another syntax, some hacking of the mailmsg()
-# and reply_by_mail() functions in LYMail.c may be required.
-#
-#SYSTEM_MAIL:mail
+# The mail command and qualifiers are defined in userdefs.h.  Lynx
+# will spawn a subprocess to send replies and error messages.  The
+# command, and qualifiers (if any), can be re-defined here.  If
+# you use PMDF then headers will we passed via a header file.
+# If you use "generic" VMS MAIL, the subject will be passed on the
+# command line via a /subject="SUBJECT" qualifier, and inclusion
+# of other relevant headers may not be possible.
+# If your mailer uses another syntax, some hacking of the mailform()
+# mailmsg() and reply_by_mail() functions in LYMail.c, and printfile()
+# function in LYPrint.c, may be required.
+#
+#SYSTEM_MAIL:PMDF SEND
+#SYSERM_MAIL_FLAGS:/headers
+#
+#SYSTEM_MAIL:MAIL
+#SYSTEM_MAIL_FLAGS:
 
 # Unix:
 #======
-# The mail path normally is defined for sendmail (or submit with MMDF)
-# in userdefs.h.  You can change it here, but should first read the
-# zillions of CERT advisories about security problems with Unix mailers.
-# You may need some hacking of the mailmsg() and reply_by_mail() functions
-# in LYMail.c, or interposition of a script, for other mailers.
+# The mail path and flags normally are defined for sendmail (or submit
+# with MMDF) in userdefs.h.  You can change them here, but should first
+# read the zillions of CERT advisories about security problems with Unix
+# mailers.
 #
 #SYSTEM_MAIL:/usr/mmdf/bin/submit
+#SYSTEM_MAIL_FLAGS:-mlruxto,cc\*
+#
+#SYSTEM_MAIL:/usr/sbin/sendmail
+#SYSTEM_MAIL_FLAGS:-t -oi
+#
 #SYSTEM_MAIL:/usr/lib/sendmail
+#SYSTEM_MAIL_FLAGS:-t -oi
 
 # VMS ONLY:
 #==========
@@ -1177,6 +1194,16 @@ MINIMAL_COMMENTS:TRUE
 #
 #SCAN_FOR_BURIED_NEWS_REFS:TRUE
 
+# If PREPEND_BASE_TO_SOURCE is set to FALSE, Lynx will not prepend a
+# Request URL comment and BASE element to text/html source files when
+# they are retrieved for 'd'ownloading or passed to 'p'rint functions.
+# The compilation default is TRUE.  Note that this prepending is not
+# done for -source dumps, unless the -base switch also was included on
+# the command line, and the latter switch overrides the setting of the
+# PREPEND_BASE_TO_SOURCE configuration variable.
+#
+#PREPEND_BASE_TO_SOURCE:TRUE
+
 # MIME types and viewers!
 #
 # file extensions may be assigned to MIME types using
@@ -1409,6 +1436,7 @@ MINIMAL_COMMENTS:TRUE
 #KEYMAP:n:NEXT		# Find next occurence of string within document
 #KEYMAP:c:COMMENT	# Comment to the author of the current document
 #KEYMAP:e:EDIT		# Edit current document
+#KEYMAP:E:ELGOTO	# Edit the current link's URL or ACTION and go to it
 #KEYMAP:=:INFO		# Show info about current document
 #KEYMAP:p:PRINT		# Show print options
 #KEYMAP:a:ADD_BOOKMARK	# Add current document to bookmark list
diff --git a/lynx_help/Lynx_users_guide.html b/lynx_help/Lynx_users_guide.html
index 1843e1d8..cd0c36d0 100644
--- a/lynx_help/Lynx_users_guide.html
+++ b/lynx_help/Lynx_users_guide.html
@@ -597,10 +597,10 @@ return to Lynx or the '<em>&gt;</em>' command to save the options to a
    <dt>Display Character set
 	<dd>This option allows you to set up the default character set for
 	    your specific terminal.  The display character set provides a
-            mapping from the character encodings of viewed documents and 
-            from HTML entities into viewable characters.  It should be set
+	    mapping from the character encodings of viewed documents and 
+	    from HTML entities into viewable characters.  It should be set
 	    according to your terminal's character set so that characters
-            other than 7-bit ASCII can be displayed correctly, using
+	    other than 7-bit ASCII can be displayed correctly, using
 	    approximations if necessary.  You must have the selected
 	    character set installed on your terminal.
 
@@ -630,7 +630,7 @@ return to Lynx or the '<em>&gt;</em>' command to save the options to a
 	    NEVER are not offered in anonymous accounts.  If saved to a
 	    <em>.lynxrc</em> file in non-anonymous accounts, ALWAYS will
 	    cause Lynx to set color mode on at startup if supported.
-            If Lynx is built with the slang library, this is equivalent to
+	    If Lynx is built with the slang library, this is equivalent to
 	    having included the <em>-color</em> command line switch or having the
 	    <em>COLORTERM</em> environment variable set. If color support is
 	    provided by curses or ncurses, this is equivalent to the default
@@ -648,7 +648,7 @@ return to Lynx or the '<em>&gt;</em>' command to save the options to a
 	    the default startup behavior is retained, such that color mode
 	    will be turned on at startup only if the terminal info indicates
 	    that you have a color-capable terminal, or (when the
-            slang library is used) if forced on via the
+	    slang library is used) if forced on via the
 	    <em>-color</em> switch or <em>COLORTERM</em> variable.  This
 	    default behavior always is used in anonymous accounts, or if
 	    the <em>option_save</em> restriction is set explicitly.  If
@@ -1058,6 +1058,18 @@ commands.
 	    buffer for goto URLs, and can be accessed for further
 	    modification via the '<em>g</em>' command.
 
+   <dt><em>E</em>
+  	<dd>The '<em>E</em>' command allows you to edit the URL (or ACTION)
+	    of the current link and then use that as a goto URL.  Pressing
+  	    the '<em>E</em>' command will bring up a prompt asking you
+	    to edit the current link's URL.  If you do not modify it, or
+	    completely delete it, or enter Control-G, the command will be
+	    cancelled.  Otherwise, the request for the 'E'dited URL will be
+	    sent with method GET, and will be entered into the circular
+	    buffer for goto URLs so that it can be accessed for further
+	    modification via the '<em>g</em>' command.  Note that lower
+	    case 'e' invokes the editor for the current document.
+
    <dt><em>=</em>
   	<dd>The '<em>=</em>' command shows information about the current
 	    document and the currently selected link if there is one.  The
@@ -1877,7 +1889,7 @@ where
              <dt><code>-child</code>
     		<dd>exit on left-arrow in startfile, and disable save to disk.
              <dt><code>-color</code>
-    		<dd>forces color mode on, if available.  Default color control sequences
+		<dd>forces color mode on, if available.  Default color control sequences
 		       which work for many terminal types are assumed if the terminal
 		       capability description does not specify how to handle color.
 		       Lynx needs to be compiled with the slang library for this flag.
@@ -2234,8 +2246,8 @@ of Academic Computing Services at The University of Kansas.  Lynx was
 implemented by Lou Montulli and maintained by Garrett Arch Blythe and
 Craig Lavender.
 
-<p><em>Foteos Macrides</em> and members of the <a href="lynx-dev.html">
-lynx-dev</a> list have developed and supported Lynx since release of v2.3
+<p><em>Foteos Macrides</em> and members of the
+<a href="lynx-dev.html">lynx-dev</a> list have developed and supported Lynx since release of v2.3
 in May 1994. The Lynx2-3FM code set was released as v2.4 in June 1995.
 The Lynx2-4FM code set was released as v2.5 in May 1996. The Lynx2-5FM
 code set was released as v2.6 in September 1996. The Lynx2-6FM code set
diff --git a/lynx_help/keystrokes/keystroke_help.html b/lynx_help/keystrokes/keystroke_help.html
index e41a7a9e..f3a57bc3 100644
--- a/lynx_help/keystrokes/keystroke_help.html
+++ b/lynx_help/keystrokes/keystroke_help.html
@@ -32,7 +32,9 @@
   <A HREF="dired_help.html">DIRED</A>:       c	      -	Create a new file
 	       d	      -	Download selected file
 	       e	      - Edit selected file
-               f              - Show a full menu of options for current file
+	       E	      - Edit the current link's URL (or ACTION) and
+                                use that as a goto URL.
+	       f	      - Show a full menu of options for current file
 	       m	      - Modify the name or location of selected file
 	       r              - Remove selected file
 	       t              - Tag highlighted file
diff --git a/lynx_help/keystrokes/other_help.html b/lynx_help/keystrokes/other_help.html
index b43f8326..511ddaac 100644
--- a/lynx_help/keystrokes/other_help.html
+++ b/lynx_help/keystrokes/other_help.html
@@ -21,6 +21,12 @@
 		Can also be used when positioned on a form SUBMIT
 		button to download the reply to a form submission.
 
+       e      - Allows you to edit the current document if it is a
+		local file.
+
+       E      - Allows you to edit the current link's URL (or ACTION) and
+		use that as a <em>goto</em> URL.
+
        g      -	Allows you to enter any <a href="http://www.ncsa.uiuc.edu/demoweb/url-primer.html">URL</a> or filename that
 		you wish to view, and then <em>goto</em> it.
                         
diff --git a/lynx_help/lynx_url_support.html b/lynx_help/lynx_url_support.html
index 0237733d..154371e1 100644
--- a/lynx_help/lynx_url_support.html
+++ b/lynx_help/lynx_url_support.html
@@ -397,17 +397,17 @@ ENCTYPE="text/plain"<BR>
 <tab indent="14">...<BR>
 <tab indent="12">&lt;/FORM&gt;</em>
 
-<p>Note that a TITLE attribute for FORM has been proposed but not included
-in any HTML specifications or drafts, and should be considered a Lynxism
-until/unless it is.  Some clients use a SUBJECT attribute for this purpose
+<p>Note that a TITLE attribute for FORM is now included in the HTML
+specifications.  Some clients use a SUBJECT attribute for this purpose
 in FORM tags, and Lynx recognizes that as a synonym for TITLE.
 
-<p>Lynx also will process any <em>cc=someone@host</em> and/or
-<em>body=Blah</em> fields in <em>?searchpart</em> tack-ons to mailto
-URLs.  The <em>cc</em> values can be single addresses, or comma- or
-semi-colon-separated lists of addresses.  All addresses, and any
-<em>body</em> values, will be offered for approval by the user before
-proceeding with a mailing, and any other name=value pairs in the
+<p>Lynx also will process any <em>to=address(es)</em>,
+<em>cc=address(es)</em>, <em>keywords=word_list</em> and/or
+<em>body=message</em> fields in <em>?searchpart</em> tack-ons to mailto
+URLs.  The <em>to</em> and/or <em>cc</em> values can be single addresses,
+or comma- or semi-colon-separated lists of addresses.  All addresses,
+and any <em>body</em> values, will be offered for approval by the user
+before proceeding with a mailing.   Any other name=value pairs in the
 <em>?searchpart</em> will be ignored.  Also, if the mailto URL is the
 ACTION for a FORM, any <em>body</em> in a <em>?searchpart</em> tack-on
 will be ignored, because the body of the mailing must be constructed
@@ -415,9 +415,12 @@ solely from the the FORM's content.  Lynx expects multiple name=value
 pairs in a <em>?searchpart</em> tack-on to be separated by ampersands,
 as in the original Netscape implementation, and in an equally ill-advised
 IETF draft of that implementation (<a
-href="ftp://ftp.isi.edu/internet-drafts/draft-hoffman-mailto-url-00.txt"
->draft-hoffman-mailto-url-00.txt</a>).  These should be represented as
-entities (<em>&amp;amp;</em>) in the HTML markup.
+href="ftp://ftp.isi.edu/internet-drafts/draft-hoffman-mailto-url-03.txt"
+>draft-hoffman-mailto-url-03.txt</a>).  These should be represented as
+entities (<em>&amp;amp;</em>) in the HTML markup.  This functionality
+is generally desired, but the IETF backward compatibility principal
+normally would lead to a new scheme being used (e.g., <em>mail:</em>, or
+<em>smtp:</em>), rather than breaking <em>mailto:</em> implementations.
 
 <p>If <em>ENCTYPE="text/plain"</em> is specified for a FORM with a mailto
 ACTION, Lynx will not hex escape the name=value pairs of the FORM's content,
@@ -500,6 +503,19 @@ to the server.   Any strings in the reports returned for these requests
 converted into a link for accessing that URL.
 <HR WIDTH="100%">
 
+<H2><a name="chargen">The <em>chargen</em> URL:</a></H2>
+
+The chargen URL is intended to provide a gateway to the chargen service.
+The requests are made on port 19 (<em>:19</em>).  You can omit the port,
+and no other value is allowed.  The format is:<BR>
+<tab indent="12"><em>chargen://host</em><BR>
+
+<p>Lynx will accept approximately 55 lines of characters in the stream
+returned by the server, then close the connection and display the lines
+as PRE formatted text.  Note that if port 19 is used for a URL with a
+scheme other than chargen, the URL will be rejected by Lynx.
+<HR WIDTH="100%">
+
 <H2><a name="exec">The <em>lynxexec</em> and <em>lynxprog</em> URLs:</a></H2>
 
 If execution of spawned commands has been enabled in your Lynx image, the
diff --git a/makefile.in b/makefile.in
index c6576614..240a9bca 100644
--- a/makefile.in
+++ b/makefile.in
@@ -22,9 +22,6 @@ INSTALL_DATA	= @INSTALL_DATA@
 ##this is the name of the directory the lynx source code is in.
 ##(e.g. lynx2-7-1, not the full path)
 lynxdir= lynx2-7-1
-
-##this is the name of the directory the lynx source code is in.
-##(e.g. lynx2-7, not the full path)
 lynxname= lynx2-7-1
 
 ## Where you want lynx installed
@@ -89,7 +86,7 @@ WWWINC= WWW/Library/Implementation
 # If you need ncurses, the latest version can always be found
 # in ftp://ftp.clark.net/pub/dickey/ncurses/  (4.1)
 # or ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses/ (1.9.9g)
-#
+
 # Also be sure to check out the compilation symbols in userdefs.h
 # before building Lynx!
 
@@ -103,38 +100,15 @@ SITE_LYDEFS = # Your defines here
 # Set SITE_DEFS to one or more of the defines for lynx below:
 SITE_DEFS = # Your defines here
 
-# defines include:
-# -DARCHIVE_ONLY   (see README.configure)
-# -DDIRED_SUPPORT  (see README.configure)
+# defines for which there are no configure options:
 # -DDONT_TRACK_INTERNAL_LINKS - Handle following links to same doc differently.
-# -DEXP_CHARTRANS  (see README.configure - needs to be set)
-# -DEXP_CHARTRANS_AUTOSWITCH also let lynx switch term mode(Linux console only)
 # -DHP_TERMINAL    For DIM workaround to REVERSE problems on HP terminals.
 # -DIGNORE_CTRL_C  Define if Control-C shouldn't exit lynx.
-# -DLINKEDSTYLES   (see README.configure)
-# -DLONG_LIST      (see README.configure)
-# -DLY_FIND_LEAKS  (see README.configure)
-# -DNCURSES        (see README.configure)
 # -DNOPORT         if you must use PASV instead of PORT for FTP
-# -DNO_CHANGE_EXECUTE_PERMS (see README.configure)
 # -DNO_CPU_LIMIT   Disables Max CPU timeout (includes CLOCKS_PER_SECOND)
-# -DNO_PARENT_DIR_REFERENCE (see README.configure)
-# -DNSL_FORK       For fork-based name server lookups that can be 'z'apped.
-# -DOK_GZIP        (see README.configure)
-# -DOK_OVERRIDE    (see README.configure)
-# -DOK_PERMIT      (see README.configure)
-# -DOK_TAR         (see README.configure)
-# -DOK_UUDECODE    (see README.configure)
-# -DOK_ZIP         (see README.configure)
 # -DSHORTENED_RBIND  For a SOCKSified lynx with the short version of Rbind.
 # -DSLANG_MBCS_HACK prevent cutoff lines when using UTF8 console (slang only)
 # -DSOCKS          For making a SOCKSified lynx.
-# -DUNDERLINE_LINKS  Define if you want links underlined instead of bold.
-# -DUSE_COLOR_STYLE (see README.configure)
-# -DUSE_EXTERNS    (see README.configure)
-# -DUSE_HASH       (see README.configure)
-# -DUSE_SLANG      (see README.configure)
-# -DUSE_ZLIB       To use some functions from zlib library if you have it.
 #
 # if you are linking to freeWAIS-0.202 or older, you should define this
 # in SITE_DEFS
@@ -160,9 +134,33 @@ SITE_DEFS = # Your defines here
 # define this in SITE_DEFS
 #
 # -DSYSLOG_REQUESTED_URLS
+
+# defines which have configure options   (see INSTALLATION, Section II-1c.):
+# -DARCHIVE_ONLY
+# -DDIRED_SUPPORT
+# -DEXP_CHARTRANS  (must be set by default; eventually will be removed)
+# -DEXP_CHARTRANS_AUTOSWITCH
+# -DLINKEDSTYLES
+# -DLONG_LIST
+# -DLY_FIND_LEAKS
+# -DNCURSES
+# -DNO_CHANGE_EXECUTE_PERMS
+# -DNO_PARENT_DIR_REFERENCE
+# -DNSL_FORK
+# -DOK_GZIP
+# -DOK_OVERRIDE
+# -DOK_PERMIT
+# -DOK_TAR
+# -DOK_UUDECODE
+# -DOK_ZIP
+# -DUNDERLINE_LINKS
+# -DUSE_COLOR_STYLE
+# -DUSE_HASH
+# -DUSE_SLANG
+# -DUSE_ZLIB
 #
 # for installation of local execution links, please see the file userdefs.h
-#
+
 # TESTED: Linux FreeBSD SunOS Solaris IRIX CLIX HP-UX AIX SCO
 all lynx:
 	cd WWW/Library/unix && $(MAKE) CC="$(CC)" \
@@ -241,19 +239,20 @@ save:
 compress: tar
 	cd ..; rm -f $(lynxname).tar.Z; compress -f -v $(lynxname).tar
 
-install: lynx install-bin install-man install-help install-cfg
+install: lynx install-bin install-man install-cfg @INSTALL_LSS@
+	@echo Use $(MAKE) install-help to install the help-files
 
 install-bin: $(bindir)
 	-mv -f $(bindir)/lynx $(bindir)/lynx.old
-	$(installbin) lynx $(bindir)/lynx
+	$(installbin) lynx $(bindir)/
 
 install-man : $(mandir) 
-	$(installdoc) lynx.man $(mandir)/lynx.1
+	$(installdoc) $(srcdir)/lynx.man $(mandir)/lynx.1
 
 install-help : $(helpdir)
 	(cd $(helpdir) && rm -rf *)
 	(cd $(srcdir)/lynx_help && tar cf - . ) | ( cd $(helpdir) && tar xf - )
-	(cd $(srcdir) && tar cf - CHANGES* PROBLEMS README samples test ) | \
+	(cd $(srcdir) && tar cf - C[HO]* PROBLEMS README samples test ) | \
 			       ( cd $(helpdir) && tar xf - )
 
 install-cfg :
@@ -261,13 +260,18 @@ install-cfg :
 	sed	-e '/^HELPFILE:http/s@^@#@' \
 		-e '/^#HELPFILE:file/s@#@@' \
 		-e '/^HELPFILE:file/s@/PATH_TO/lynx_help@$(helpdir)@' \
-		lynx.cfg >$(libdir)/lynx.cfg
+		$(srcdir)/lynx.cfg >$(libdir)/lynx.cfg
 	chmod 0644 $(libdir)/lynx.cfg
 
+install-lss :
+	-mv -f $(libdir)/lynx.lss $(libdir)/lynx.oldlss
+	$(INSTALL_DATA) $(srcdir)/samples/lynx.lss $(libdir)/lynx.lss
+
 uninstall:
 	-rm -f $(bindir)/lynx
 	-rm -f $(mandir)/lynx.1
 	-rm -f $(libdir)/lynx.cfg
+	-rm -f $(libdir)/lynx.lss
 	-rm -rf $(libdir)/lynx_help
 
 $(bindir) $(mandir) $(libdir) $(helpdir) :
diff --git a/samples/lynx.cfg b/samples/lynx.cfg
index 1ec062a7..186f9b2a 100644
--- a/samples/lynx.cfg
+++ b/samples/lynx.cfg
@@ -187,46 +187,50 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html
 # The default character sets include:
 #    Display Character Set name		MIME name
 #    ==========================		=========
-#    ISO Latin 1			iso-8859-1
-#    ISO Latin 2			iso-8859-2
-#    Other ISO Latin			x-iso-8859-other
-#    WinLatin1 (cp1252)			iso-8859-1-windows-3.1-latin-1
-#    DEC Multinational			dec-mcs
-#    Macintosh (8 bit)			macintosh
-#    NeXT character set			x-next
-#    KOI8-R Cyrillic     		koi8-r
-#    Chinese				euc-cn
-#    Japanese (EUC)			euc-jp
-#    Japanese (SJIS)			shift_jis
-#    Korean				euc-kr
-#    Taipei (Big5)			big5
-#    Vietnamese (VISCII)		viscii
 #    7 bit approximations		us-ascii
-#    Transparent			x-transparent
-#    IBM PC character set		cp437
-#    IBM PC codepage 850		cp850
-#    PC Latin2 CP 852			cp852
+#    Chinese				euc-cn
+#    DEC Multinational			dec-mcs
+#    DosArabic (cp864)			cp864
+#    DosBaltRim (cp775)			cp775
 #    DosCyrillic (cp866)		cp866
 #    DosGreek (cp737)			cp737
 #    DosGreek2 (cp869)			cp869
-#    DosArabic (cp864)			cp864
 #    DosHebrew (cp862)			cp862
-#    WinLatin2 (cp1250)			windows-1250
-#    WinCyrillic (cp1251)		windows-1251
-#    WinGreek (cp1253)			windows-1253
-#    WinHebrew (cp1255)			windows-1255
-#    WinArabic (cp1256)			windows-1256
-#    ISO Latin 3			iso-8859-3
-#    ISO Latin 4			iso-8859-4
+#    DosLatin1 (cp850)			cp850
+#    DosLatinUS (cp437)			cp437
+#    IBM PC character set		cp437
+#    IBM PC codepage 850		cp850
+#    ISO 8859-10			iso-8859-10
 #    ISO 8859-5 Cyrillic		iso-8859-5
 #    ISO 8859-6 Arabic			iso-8859-6
 #    ISO 8859-7 Greek			iso-8859-7
 #    ISO 8859-8 Hebrew			iso-8859-8
 #    ISO 8859-9 (Latin 5)		iso-8859-9
-#    ISO 8859-10			iso-8859-10
-#    UNICODE UTF 8			unicode-1-1-utf-8
-#    RFC 1345 w/o Intro			mnemonic+ascii+0
+#    ISO Latin 1			iso-8859-1
+#    ISO Latin 2			iso-8859-2
+#    ISO Latin 3			iso-8859-3
+#    ISO Latin 4			iso-8859-4
+#    Japanese (EUC)			euc-jp
+#    Japanese (SJIS)			shift_jis
+#    KOI8-R Cyrillic			koi8-r
+#    Korean				euc-kr
+#    Macintosh (8 bit)			macintosh
+#    NeXT character set			x-next
+#    Other ISO Latin			x-iso-8859-other
+#    PC Latin2 CP 852			cp852
 #    RFC 1345 Mnemonic			mnemonic
+#    RFC 1345 w/o Intro			mnemonic+ascii+0
+#    Taipei (Big5)			big5
+#    Transparent			x-transparent
+#    UNICODE UTF 8			utf-8
+#    Vietnamese (VISCII)		viscii
+#    WinArabic (cp1256)			cp1256
+#    WinBaltRim (cp1257)		cp1257
+#    WinCyrillic (cp1251)		cp1251
+#    WinGreek (cp1253)			cp1253
+#    WinHebrew (cp1255)			cp1255
+#    WinLatin1 (cp1252)			cp1252
+#    WinLatin2 (cp1250)			cp1250
 #
 #CHARACTER_SET:ISO Latin 1
 
@@ -271,17 +275,23 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html
 # as the preferred language.  If available, the document will be
 # transmitted in that language.  Users can override this setting via
 # the 'o'ptions menu and save that preference in their RC file.
+# This may be a comma-separated list of languages in decreasing preference.
 #
 #PREFERRED_LANGUAGE:en
 
 # PREFERRED_CHARSET specifies the character set in MIME notation (e.g.,
 # "ISO-8859-2", "ISO-8859-5") which Lynx will indicate you prefer in
-# requests to http servers using an Accept-Charsets header.  The value
-# should NOT include "ISO-8859-1" or "US-ASCII", since those values are
-# always assumed by default.  If a file in that character set is available,
-# the server will send it.  Otherwise, the server will send the file in
-# ISO-8859-1 or US-ASCII.  Users can change or eliminate this definition
-# via the 'o'ptions menu and save that preference in their RC file.
+# requests to http servers using an Accept-Charsets header. Users can
+# change it via the 'o'ptions menu and save that preference in their RC file.
+# The value should NOT include "ISO-8859-1" or "US-ASCII",
+# since those values are always assumed by default.
+# If a file in that character set is available, the server will send it.
+# If no Accept-Charset header is present, the default is that any
+# character set is acceptable. If an Accept-Charset header is present,
+# and if the server cannot send a response which is acceptable
+# according to the Accept-Charset header, then the server SHOULD send
+# an error response with the 406 (not acceptable) status code, though
+# the sending of an unacceptable response is also allowed. (RFC2068)
 #
 #PREFERRED_CHARSET:
 
@@ -706,25 +716,38 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html
 
 # VMS:
 #=====
-# The mail command is defined in userdefs.h.  It will be spawned as a
-# subprocess of lynx and used to send replies and error messages.
-# It can be re-defined here.  Your mailer must be able to accept a
-# subject line through the use of the /subject="SUBJECT" option.
-# If your mailer uses another syntax, some hacking of the mailmsg()
-# and reply_by_mail() functions in LYMail.c may be required.
-#
-#SYSTEM_MAIL:mail
+# The mail command and qualifiers are defined in userdefs.h.  Lynx
+# will spawn a subprocess to send replies and error messages.  The
+# command, and qualifiers (if any), can be re-defined here.  If
+# you use PMDF then headers will we passed via a header file.
+# If you use "generic" VMS MAIL, the subject will be passed on the
+# command line via a /subject="SUBJECT" qualifier, and inclusion
+# of other relevant headers may not be possible.
+# If your mailer uses another syntax, some hacking of the mailform()
+# mailmsg() and reply_by_mail() functions in LYMail.c, and printfile()
+# function in LYPrint.c, may be required.
+#
+#SYSTEM_MAIL:PMDF SEND
+#SYSERM_MAIL_FLAGS:/headers
+#
+#SYSTEM_MAIL:MAIL
+#SYSTEM_MAIL_FLAGS:
 
 # Unix:
 #======
-# The mail path normally is defined for sendmail (or submit with MMDF)
-# in userdefs.h.  You can change it here, but should first read the
-# zillions of CERT advisories about security problems with Unix mailers.
-# You may need some hacking of the mailmsg() and reply_by_mail() functions
-# in LYMail.c, or interposition of a script, for other mailers.
+# The mail path and flags normally are defined for sendmail (or submit
+# with MMDF) in userdefs.h.  You can change them here, but should first
+# read the zillions of CERT advisories about security problems with Unix
+# mailers.
 #
 #SYSTEM_MAIL:/usr/mmdf/bin/submit
+#SYSTEM_MAIL_FLAGS:-mlruxto,cc\*
+#
+#SYSTEM_MAIL:/usr/sbin/sendmail
+#SYSTEM_MAIL_FLAGS:-t -oi
+#
 #SYSTEM_MAIL:/usr/lib/sendmail
+#SYSTEM_MAIL_FLAGS:-t -oi
 
 # VMS ONLY:
 #==========
@@ -1171,6 +1194,16 @@ MINIMAL_COMMENTS:TRUE
 #
 #SCAN_FOR_BURIED_NEWS_REFS:TRUE
 
+# If PREPEND_BASE_TO_SOURCE is set to FALSE, Lynx will not prepend a
+# Request URL comment and BASE element to text/html source files when
+# they are retrieved for 'd'ownloading or passed to 'p'rint functions.
+# The compilation default is TRUE.  Note that this prepending is not
+# done for -source dumps, unless the -base switch also was included on
+# the command line, and the latter switch overrides the setting of the
+# PREPEND_BASE_TO_SOURCE configuration variable.
+#
+#PREPEND_BASE_TO_SOURCE:TRUE
+
 # MIME types and viewers!
 #
 # file extensions may be assigned to MIME types using
@@ -1403,6 +1436,7 @@ MINIMAL_COMMENTS:TRUE
 #KEYMAP:n:NEXT		# Find next occurence of string within document
 #KEYMAP:c:COMMENT	# Comment to the author of the current document
 #KEYMAP:e:EDIT		# Edit current document
+#KEYMAP:E:ELGOTO	# Edit the current link's URL or ACTION and go to it
 #KEYMAP:=:INFO		# Show info about current document
 #KEYMAP:p:PRINT		# Show print options
 #KEYMAP:a:ADD_BOOKMARK	# Add current document to bookmark list
@@ -1618,14 +1652,14 @@ MINIMAL_COMMENTS:TRUE
 # COLOR:Integer:Foreground:Background
 #
 # The Integer value is interpreted as follows:
-#     0 - normal			(normal text)
-#     1 - bold				(non-current links within normal)
-#     2 - reverse			(statusline)
+#     0 - normal               - normal text 
+#     1 - bold                 - hyperlinks, see also BOLD_* options above
+#     2 - reverse              - statusline
 #     3 - bold + reverse		(not used)
-#     4 - underline			(emphasized text)
-#     5 - bold + underline		(non-current links within emphasis)
-#     6 - reverse + underline		(current link)
-#     7 - reverse + underline + bold	(WHEREIS search hits)
+#     4 - underline                   - text emphasis (EM, I, B tags etc.)
+#     5 - bold + underline            - hyperlinks within text emphasis
+#     6 - reverse + underline         - currently selected hyperlink
+#     7 - reverse + underline + bold  - WHEREIS search hits
 #
 # Each Foreground and Background value must be one of:
 #      black              red            green            brown
@@ -1679,3 +1713,21 @@ MINIMAL_COMMENTS:TRUE
 #
 # EXTERNAL:ftp:wget %s &:TRUE
 
+# Raw DOS Key hack
+# This will bypass the DOS key hack if is compiled in.
+# The hack is as follows:
+# if (c == 0) c = '/';
+# if (c > 255) {      /* handle raw dos keys */
+#		switch (c)
+#		{
+#			case 464: c = '-'; break;  /* keypad minus*/
+#			case 465: c = '+'; break;  /* keypad plus*/
+#			case 459: c = 13; break;  /* keypad enter*/
+#			case 463: c = '*'; break;  /* keypad * */
+#			case 440: c = 'Q'; break;  /* alt x */
+#			default: break;
+#		}
+#	}
+#
+# RAW_DOS_KEY_HACK = TRUE
+
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/
 
diff --git a/userdefs.h b/userdefs.h
index b2519a1a..dcedf8dd 100644
--- a/userdefs.h
+++ b/userdefs.h
@@ -126,19 +126,27 @@
 #define XLOADIMAGE_COMMAND "xv %s"
 
 /**************************
- * The full path and name of the standard VMS "mail" command.
+ * SYSTEM_MAIL must be defined here to your mail sending command,
+ * and SYSTEM_MAIL_FLAGS to approrpriate qualifiers.  They can be
+ * changed in lynx.cfg.
  *
  * The mail command will be spawned as a subprocess of lynx
- * and used to send replies and error messages.  It must be
- * defined here, and can be changed in lynx.cfg.
- * SYSTEM_MAIL must be able to accept a subject line through
- * the use of the /subject="SUBJECT" option.
+ * and used to send the email, with headers specified in a
+ * temporary file for PMDF.  If you define SYSTEM_MAIL to the
+ * "generic" MAIL utility for VMS, headers cannot be specified
+ * via a header file (and thus may not be included), and the
+ * subject line will be specified by use of the /subject="SUBJECT"
+ * qualifier.
+ *
  * If your mailer uses another syntax, some hacking of the
- * mailmsg() and reply_by_mail() functions in LYMail.c may
- * be required.
+ * mailform(), mailmsg() and reply_by_mail() functions in
+ * LYMail.c, and printfile() function in LYPrint.c, may be
+ * required.
  */
-#define SYSTEM_MAIL "mail"
-#define SYSTEM_MAIL_FLAGS ""
+#define SYSTEM_MAIL "PMDF SEND"
+#define SYSTEM_MAIL_FLAGS "/headers"
+/* #define SYSTEM_MAIL "MAIL"   */
+/* #define SYSTEM_MAIL_FLAGS "" */
 
 /*************************
  * Below is the argument for an sprintf command that will add
@@ -318,18 +326,20 @@
  *
  * SYSTEM_MAIL must be defined here.  You can change it in lynx.cfg.
  *
- * If you do not use the recommended mailers, some hacking of
- * the mailmsg() and reply_by_mail() functions in LYMail.c, or
- * interposition of a script, may be required.
+ * SYSTEM_MAIL_FLAGS must be defined here appropriately for your
+ * SYSTEM_MAIL definition.  You can change it in lynx.cfg.
  */
 #ifndef HAVE_CONFIG_H
 #ifdef MMDF
 #define SYSTEM_MAIL "/usr/mmdf/bin/submit" 
+#define SYSTEM_MAIL_FLAGS "-mlruxto,cc\\*"
 #else
 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
 #define SYSTEM_MAIL "/usr/sbin/sendmail"
+#define SYSTEM_MAIL_FLAGS "-t -oi"
 #else /* everything else: */
 #define SYSTEM_MAIL "/usr/lib/sendmail" 
+#define SYSTEM_MAIL_FLAGS "-t -oi"
 #endif /* __FreeBSD || __NetBSD__ || __bsdi__ */
 #endif /* MMDF */
 #define SYSTEM_MAIL_FLAGS ""
@@ -615,49 +625,53 @@
  * the user's RC file whenever those settings are saved, and thereafter
  * will be used as the default.  Also see lynx.cfg for information about
  * the -raw switch and LYE_RAW_TOGGLE command.
+ *
  * The default character sets include:
+ *
  *   Display Character Set name		MIME name
  *   ==========================		=========
- *   ISO Latin 1			iso-8859-1
- *   ISO Latin 2			iso-8859-2
- *   Other ISO Latin			x-iso-8859-other
- *   WinLatin1 (cp1252)			iso-8859-1-windows-3.1-latin-1
- *   DEC Multinational			dec-mcs
- *   Macintosh (8 bit)			macintosh
- *   NeXT character set			x-next
- *   KOI8-R character set		koi8-r
- *   Chinese				euc-cn
- *   Japanese (EUC)			euc-jp
- *   Japanese (SJIS)			shift_jis
- *   Korean				euc-kr
- *   Taipei (Big5)			big5
- *   Vietnamese (VISCII)		viscii
  *   7 bit approximations		us-ascii
- *   Transparent			x-transparent
- *   IBM PC character set		cp437
- *   IBM PC codepage 850		cp850
- *   PC Latin2 CP 852			cp852
+ *   Chinese				euc-cn
+ *   DEC Multinational			dec-mcs
+ *   DosArabic (cp864)			cp864
+ *   DosBaltRim (cp775)			cp775
  *   DosCyrillic (cp866)		cp866
  *   DosGreek (cp737)			cp737
  *   DosGreek2 (cp869)			cp869
- *   DosArabic (cp864)			cp864
  *   DosHebrew (cp862)			cp862
- *   WinLatin2 (cp1250)			windows-1250
- *   WinCyrillic (cp1251)		windows-1251
- *   WinGreek (cp1253)			windows-1253
- *   WinHebrew (cp1255)			windows-1255
- *   WinArabic (cp1256)			windows-1256
- *   ISO Latin 3			iso-8859-3
- *   ISO Latin 4			iso-8859-4
+ *   IBM PC character set		cp437
+ *   IBM PC codepage 850		cp850
+ *   ISO 8859-10			iso-8859-10
  *   ISO 8859-5 Cyrillic		iso-8859-5
  *   ISO 8859-6 Arabic			iso-8859-6
  *   ISO 8859-7 Greek			iso-8859-7
  *   ISO 8859-8 Hebrew			iso-8859-8
  *   ISO 8859-9 (Latin 5)		iso-8859-9
- *   ISO 8859-10			iso-8859-10
- *   UNICODE UTF 8			unicode-1-1-utf-8
- *   RFC 1345 w/o Intro			mnemonic+ascii+0
+ *   ISO Latin 1			iso-8859-1
+ *   ISO Latin 2			iso-8859-2
+ *   ISO Latin 3			iso-8859-3
+ *   ISO Latin 4			iso-8859-4
+ *   Japanese (EUC)			euc-jp
+ *   Japanese (SJIS)			shift_jis
+ *   KOI8-R character set		koi8-r
+ *   Korean				euc-kr
+ *   Macintosh (8 bit)			macintosh
+ *   NeXT character set			x-next
+ *   Other ISO Latin			x-iso-8859-other
+ *   PC Latin2 CP 852			cp852
  *   RFC 1345 Mnemonic			mnemonic
+ *   RFC 1345 w/o Intro			mnemonic+ascii+0
+ *   Taipei (Big5)			big5
+ *   Transparent			x-transparent
+ *   UNICODE UTF 8			utf-8
+ *   Vietnamese (VISCII)		viscii
+ *   WinArabic (cp1256)			windows-1256
+ *   WinBaltRim (cp1257)		cp1257
+ *   WinCyrillic (cp1251)		cp1251
+ *   WinGreek (cp1253)			windows-1253
+ *   WinHebrew (cp1255)			windows-1255
+ *   WinLatin1 (cp1252)			cp1252
+ *   WinLatin2 (cp1250)			cp1250
  */
 #define CHARACTER_SET "ISO Latin 1"
 
@@ -1095,7 +1109,7 @@
  *	LINKS_ARE_NUMBERED  or
  *	LINKS_AND_FORM_FIELDS_ARE_NUMBERED
  */
-#define DEFAULT_KEYPAD_MODE	       NUMBERS_AS_ARROWS
+#define DEFAULT_KEYPAD_MODE	NUMBERS_AS_ARROWS
 
 /********************************
  * The default search.
@@ -1194,7 +1208,7 @@
  * the version definition with the Project Version on checkout. Just
  * ignore it. - kw */
 /* $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$ */
-#define LYNX_VERSION "2.7.1ac-0.102"
+#define LYNX_VERSION "2.7.1ac-0.105"
 
 #ifndef MAXINT
 #define MAXINT 2147483647	/* max integer */