about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CHANGES288
-rw-r--r--WWW/Library/Implementation/HTDOS.c2
-rw-r--r--WWW/Library/Implementation/HTFile.c12
-rw-r--r--WWW/Library/Implementation/HTMLDTD.c31
-rw-r--r--WWW/Library/Implementation/HTMLDTD.h16
-rw-r--r--WWW/Library/Implementation/HTNews.c2
-rw-r--r--WWW/Library/Implementation/HTParse.c3
-rw-r--r--WWW/Library/Implementation/HTString.c74
-rw-r--r--WWW/Library/Implementation/HTString.h8
-rw-r--r--WWW/Library/Implementation/HTTelnet.c4
-rw-r--r--WWW/Library/Implementation/LYLeaks.h53
-rw-r--r--WWW/Library/Implementation/SGML.c293
-rw-r--r--WWW/Library/Implementation/SGML.h3
-rw-r--r--WWW/Library/djgpp/makefile14
-rw-r--r--aclocal.m439
-rw-r--r--config.hin1
-rwxr-xr-xconfigure888
-rw-r--r--configure.in3
-rw-r--r--docs/README.defines4
-rw-r--r--lynx.cfg34
-rw-r--r--lynx.hlp3
-rw-r--r--lynx.man3
-rw-r--r--makefile.bcb9
-rw-r--r--makefile.in8
-rw-r--r--makelynx.bat179
-rw-r--r--po/lynx.pot260
-rw-r--r--src/GridText.c630
-rw-r--r--src/GridText.h5
-rw-r--r--src/HTAlert.c37
-rw-r--r--src/HTML.c175
-rw-r--r--src/HTML.h3
-rw-r--r--src/HTNestedList.h2
-rw-r--r--src/LYCharUtils.c29
-rw-r--r--src/LYCurses.c13
-rw-r--r--src/LYForms.c2
-rw-r--r--src/LYGlobalDefs.h2
-rw-r--r--src/LYHistory.c6
-rw-r--r--src/LYKeymap.c10
-rw-r--r--src/LYKeymap.h4
-rw-r--r--src/LYLeaks.c348
-rw-r--r--src/LYLocal.c20
-rw-r--r--src/LYMain.c27
-rw-r--r--src/LYMainLoop.c164
-rw-r--r--src/LYMap.c2
-rw-r--r--src/LYOptions.c2
-rw-r--r--src/LYPrettySrc.c112
-rw-r--r--src/LYPrettySrc.h21
-rw-r--r--src/LYPrint.c7
-rw-r--r--src/LYReadCFG.c27
-rw-r--r--src/LYStrings.c154
-rw-r--r--src/LYStrings.h5
-rw-r--r--src/LYUtils.c100
-rw-r--r--src/TRSTable.c229
-rw-r--r--src/TRSTable.h10
-rw-r--r--src/UCAuto.c8
-rw-r--r--src/UCdomap.c2
-rw-r--r--src/chrtrans/cp1253_uni.tbl4
-rw-r--r--src/chrtrans/cp869_uni.tbl4
-rw-r--r--src/chrtrans/iso07_uni.tbl13
-rw-r--r--src/makefile.dos16
-rw-r--r--src/makefile.in5
-rw-r--r--userdefs.h4
62 files changed, 3256 insertions, 1180 deletions
diff --git a/CHANGES b/CHANGES
index 7053b216..e5a70f1a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,266 @@
 Changes since Lynx 2.8 release
 ===============================================================================
 
+1999-11-03 (2.8.3dev.14)
+* modify no_color_video check for A_UNDERLINE so it is active for any
+  combination that uses underlining (reported by KW) -TD
+* modified HTML.c so configure --enable-internal-links builds -TD
+* improved 'lynx.patch' rule in makefile.in -PG
+* add rough version of makelynx.bat for use with Khan's MingW32 (from Victor
+  Schneider <vtailor@gte.net>)
+* update dependencies in makefile.bcb for src/TRSTable.c -HS
+* fix PDCurses ifdef's in LYCurses.c to work with WATT-32 -DK
+* correct ifdef's in LYPrint.c so that send_file_to_mail() works with DJGPP -DK
+* modify DOS makefiles for PDCURSES for watt-32 and some of the other recent
+  changes to lynx.  Included some of the EXP_ defines that DOS users may want.
+  Changed the -O3 back to -O2, since -O3 has no advantage under djgpp -DK
+* remove a useless ';', use FREE() instead of free() - JB
+* correct spelling lexem/lexeme (reported by KW) -TD
+* split-out function check_history() in LYMainLoop.c -TD
+* add configure check for vasprintf -TD
+* add configure check for _GNU_SOURCE -TD
+* minor fixes for configure script macros CF_TERMCAP_LIBS, CF_DISABLE_ECHO,
+  CF_GCC_ATTRIBUTES, CF_GCC_WARNINGS -TD
+* fixed bug in psrcmode code.  Now htmlsrc_tag encloses only tagname, not
+  everything in generalized brackets <,>,</,/> (reported by KW) -VH
+* fixed a bug with 'g' command (reported by KW) -VH
+* default value for 'OPT' in SGML.c made '1', removed alternatives to code
+  surrounded by #if OPT1
+* notes (VH):
+  + Seems that 'OPT' stuff doesn't contain errors. Let's enable it for several
+    releases, and then remove alternative code.
+  + Added comments about pools.
+  + Docs updated to reflect new functionality of -dont-wrap-pre
+* old psrcview bug fixed  - markup was unbalanced in some situations -VH
+* content of SAMP tag made justifiable -VH
+* implemented HTStyleChange pooling - sizeof(HTStyleChange) is 4 times smaller
+  than before, and only necessary number of stylechanges is allocated now,
+  instead of some constant (1024 by default) -VH
+* functionality of dont-wrap-pre improved and extended. Now it's possible to
+  avoid wrapping the document being dumped completely (size of the non-wrapped
+  line before the patch was limited by MAX_LINE = 1024 by default). Specifying
+  -dont-wrap-pre with interactive session enables wrapped lines (in PRE) to
+  be marked as in source view - with '+' in normal view -VH
+* functionality of -force-empty-hrefless-a was cleaned up,
+  #ifndefs NO_EMPTY_HREFLESS_A and endif's were removed -VH
+* colorstyle changes are not emitted in HTML_end_element if me->skip_stack was
+  >0 on entry to this function. This caused some glitches if
+  -force-empty-hrefless-a was enabled -VH
+* LYPrettySrc.c was slightly cleaned up, added support for lynx.cfg reloading,
+  memory deallocation -VH
+* possible bug in print_wwwfile_to_fd fixed - when quoting the page, seems that
+  several '>'s could be emitted on the long line formed by concatenating ilnes
+  with LY_SOFT_NEWLINEs at the begining of them -VH
+* general notes -VH:
+  + users of lss-enabled lynx should consider on upgrading the lynx - at least
+    those who use lynx for viewing huge files.  By default, each line on the
+    screen took 1K for colorstyles (on x86).  With new approach colorstyle
+    changes take 24 bytes (on x86) per line in average document.  Old lynx with
+    900K html file loaded as startfile occupied 30M of virtual memory, lynx
+    with patch applied occupied 5 Mb on the same file.  Old code is still
+    accessible by defining OLD_STYLECHANGE.
+  + I spent 4 hours debugging attempting to write/fix code that cleans up the
+    memory allocated in LYPrettySrc.c, but Lynx.leaks shows that I didn't
+    succeeded.  I fear that leak detection stuff is broken - I checked/traced
+    the code very carefully several times.
+> the remainder (most) of this patch from KW:
+* for confirmation prompts (HTConfirm), also accept English letters 'Y', 'y',
+  'N', 'n' as responses.  If characters different from those are derived from
+  the first letters of the translation of "yes" and "no" in a localized lynx,
+  the latter will still be the ones that appear in the prompt text and will
+  have precedence.  Message translations using multibyte character sets should
+  continue to *not* translate "yes" and "no".  Added a note to that effect. 
+* small update for some chartrans tables, minor comment changes.
+* for Unix, use LYSystem instead of system for invoking telnet, rlogin,
+  rtn3270 commands.
+  [ For some non-Unix systems, LYSystem messes around with the passed command
+    string in various ways, and does some other stuff for DJGPP.  So no change
+    for those, since I assume it worked before.  For Unix the change prevents
+    the following occuring with ncurses (at least if USE_SIGACTION is defined):
+     - access some (valid) telnet://some.host URL.
+     - within telnet client, escape to command level (usually '^]')
+     - suspend (usually 'z' or ^Z)
+     - resume (fg).  Lynx process gets woken up, redraws lynx screen,
+       screen & tty state get messed up. ]
+* another tweak for display refreshing when text previously displayed
+  had UTF-8 (for ncurses) - a check in display_page was missing.
+* corrected stupid problem in LYGetFileInfo - invalid memory access.
+* corrected and extended handling for textarea INSERTFILE and EDITTEXTAREA
+  (or DWIMEDIT), the previous patch wasn't quite right:
+  - now really truncate very long lines as intended for INSERTFILE, instead of
+    wrapping with loss of one character.
+  - for EDITTEXTAREA (DWIMEDIT), implement wrapping instead of truncation
+    (Rationale for the difference:  user's editing work shouldn't be lost if we
+    can avoid it; it is only temporarily stored in a file which may be
+    unrecoverable, different from the typical INSERTFILE case.) If, upon
+    returning from the external editor, lines are encountered that don't fit in
+    the displayed width of the textarea fields, the user may be given the
+    option to wrap to that width.  (This prompt may not be given when the first
+    such line has no suitable spaces for breaking - the file may be binary
+    garbage after all, not worth fixing up too much.) Line breaking is
+    attempted at spaces if possible (using isspace() for checking), but not if
+    the only available spaces are close to the beginning of a line.  An attempt
+    is made to join the wrapped part of a line (if not too long) with the next
+    line if it is not indented, by suppressing the next line break (if not too
+    far away).  Some other heuristics are used that work reasonably well for
+    normal text paragraphs.
+    If the above mechanisms fail, or the user did not confirm wrapping when
+    prompted, very long lines will still be wrapped to fit into the buffer size
+    (around 1024 chars).
+  [ The wrapping works quite nicely in "normal" cases - please try it! ]
+* mouse action in popups would lead to call of fancy_mouse() with wrong row
+  number, which could lead to messed-up display as well as invalid memory
+  access.
+* The previous changes in link redrawing made things worse instead of better
+  for UTF-8 display with ncurses (without color style).  This time (using
+  wredrawln, not touchline) it should really get better... 
+  [ The UTF-8 related changes would need testing with non-ncurses curses libs,
+    if anyone has one of those AND a working UTF-8 environment - late xterm
+    betas(?) from Tom's site should do.  If the functions used for ncurses are
+    available in other curses libs, the code should probably look the same as
+    for ncurses.  ]
+* SGML.c to compile without --enable-prettysrc (reported by HN) -KW
+* fixes an invalid memory problem from previous patch 
+* adds alignment inheritance from COLGROUP / COL / THEAD / TFOOT / TBODY. 
+* remove some logic from LYmbcsstrlen() that gave an incorrect count for
+  the number of cells displaying multibyte characters, resulting in too-few
+  cells being highlighted (reported by HN, HS) -KW
+* added support for ROWSPAN attribute of TD and TH to TRST.  This only
+  reserves the appropriate amount of space in subsequent lines.
+  [ Pages that show off ROWSPAN nicely:
+    <http://www.iro.umontreal.ca/contrib/po/HTML/domain-hello.html>
+    and related ones for other "domain"s.  (Verify that there really
+    is a ROWSPAN= in the current version.)  View with a screen width
+    of 100.  With 80 there is some kind of problem, compare both
+    ^V settings... ]
+* some corrections in TRST code.
+* change initialization order of key escape sequence mappings for slang, so
+  that terminfo/termcap information always overrides defaults that may
+  conflict.
+* minimal memory cleanup / leak prevention for EXP_FILE_UPLOAD error
+  cases in GridText.c.
+* in HText_SubmitForm, don't change the post_content_type of the
+  passed in newdoc structure unless that is really wanted.
+* tweaked UTF-8 prevention of display library wrapping/truncation to make
+  better use of available width for centered text, and to not apply if dumping
+  to stdout.
+* for UTF-8 output with ncurses, do a clearok in display_page also if the page
+  that was *previously* displayed had UTF-8 characters.  Without this there
+  were still display glitches.
+* made previous changes to SGML.c and HTMLDTD for handling OBJECT more generic.
+* minor tweaks, cleanups, glitch removal in previous changes.
+* better tracking of HTSprintf0/HTSprintf with --enable-find-leaks
+  (-DLY_FIND_LEAKS).  This can be disabled in LYLeaks.h by removing the
+  definition of LY_FIND_LEAKS_EXTENDED.
+* added variant behavior in StrAllocVsprintf to make HTSprintf0/HTSprintf use
+  less memory allocation calls and keep its temporary string buffers across
+  calls.  The buffers then only grow and never get cleaned up.  This is enabled
+  by defining SAVE_TIME_NOT_SPACE in HTString.c, disable the definition there
+  in case of problems.
+* added code so HTSprintf0/HTSprintf can use vasprintf() in some situations,
+  which should be more efficient.  It also works with --enable-find-leaks
+  (EXTENDED or not).  This only comes into play if USE_VASPRINTF is defined
+  (not defined automatically anywhere).
+  [ For me (some Debian glibc version), the prototype for this function
+    is in stdio.h but only gets included with an explicit -D_GNU_SOURCE. ]
+  [ Which of the four combinations with/without vasprintf, with/without
+    SAVE_TIME_NOT_SPACE is better (if any) remains to be tested.  I have seen
+    drastic differences under leak tracking, but that's just too much
+    different from a normal situation to count for anything. ]
+* Some minor leaks fixed. (LYMainLoop.c)
+
+[ Had to make owner_address and ownerS_address file-wide PRIVATE's
+ instead of auto to unleak them.  Could be taken out of more
+ argument lists now. ]
+
+* HTFile.c: correction in FormatNum (could duplicate fields for some
+  LIST_FORMAT settings), avoid some HTSprintf0 calls in FormatStr.
+* replaced calls to HTSprintf with calls to HTSprintf0 in various files.
+* added missing include of LYLeaks.h in LYPrettySrc.c.  But disabled memory
+  tracking there, too many allocations show up as leaks.
+* allow digits in tagspec for -prettysrc.
+* the 'fixit' change of 1999-05-16 didn't really let LYConvertToURL() revert to
+  the right old behavior in the non-'g' use.  Now return a file URL for the
+  nonexisting file in the relevant situation again, as before 1998-03-25,
+  instead of an erroneous "file://localhost" which (on Unix-like systems at
+  least) would result in access to the root directory.  This change (like the
+  changes of 1999-05-16 and 1998-03-25) only matters for strings that aren't
+  already in absolute URL form, don't start with a slash (or, for DOSPATH
+  systems, other path separator) either, and don't get turned into remote URLs
+  by successful 'guessing' and DNS lookup.  None of the changes affect VMS.
+* protect INSERTFILE and EDITTEXTAREA from generating memory access violations
+  if the inserted file has lines that are too long for the buffer used.  An
+  alert message is issued and the long lines are truncated.  Also don't exit if
+  memory allocation fails for the buffer to hold the whole file, since the only
+  reason for the failure may be that the file is too huge when otherwise lynx
+  has enough memory.
+* improved handling of some invalid constructs in SGML, especially
+  '<' followed by various characters; don't lose those characters from
+  what gets displayed for -prettysrc.
+* a pre-filled TEXTAREA text that needed charset translation could cause
+  use of an invalid pointer when building the page, resulting in garbage
+  data being displayed (or worse).  The problem was in HTML.c, not related
+  to TEXTAREA editing or other related new functions.
+  [ preceding three were partially already in previous patch ]
+* recognize '<?' as introducing an SGML PI.  Within most elements' content (or
+  outside of any elements) this makes no effective difference except for TRACE
+  messages and -prettysrc, the input is still junked up to the next '>' as for
+  a completely invalid tag.  Within PCDATA elements the PI is now also ignored
+  instead of being treated as character data, this makes a difference for
+  example in a TEXTAREA in SortaSGML mode.  (PI's aren't really expected to
+  occur in the middle of HTML, but are used at the beginning of XHTML documents
+  and other XML documents.)
+* the earlier change of TEXTAREA handling (treating as SGML_PCDATA, SortaSGML
+  only) created a problem, some lynx special characters were passed on as data
+  characters in the field contents and would mess up line editing and possibly
+  the submitted form data.  Actually the problem also existed before, but only
+  for non break space, soft hyphen etc.  encoded directly as character data
+  (not NCRs or entities).  Resolved by telling SGML.c not to generate lynx
+  special chars for some element contents (currently only TEXTAREA), with new
+  flag Tgf_nolyspcl.
+* corrected some logic errors in LYUCFullyTranslateString.  Special attribute
+  characters are now more often translated to real characters when 'Back' flag
+  is set, and should now be translated to the *right* characters for the target
+  charset.  (They were sometimes converted to ISO-8859-1 values when the 'to'
+  charset was different.)
+* added a missing significant cast in UCReverseTransChar.
+* for scrollbar mouse clicking, use codes that work independent of current
+  line-editor key bindings.
+* better calculation of "subjective distance" from next anchor for mouse. 
+  Change of 1999-07-30 had various problems, it wasn't quite intuitive.  Use
+  scaled numbers for finer granularity.  Don't make "basin of attraction" too
+  wide, or it becomes hard to find a "background" spot to click on that doesn't
+  affect a link if a page has a high density of links.
+  [ For example with a pair of fields:
+         Submit Reset
+                xxx
+  clicking in any of the positions marked 'x' on the next line would
+  select the first field, not the second. That was not an improvement. ]
+* functions LYmbcsstrlen, LYno_attr_mbcs_case_strstr, and LYno_attr_mbcs_strstr
+  in LYStrings.c where unclear about the concept of 'printable' or 'physical'
+  used for some returned values in the CJK case.  Callers expected number of
+  display cells, implemented was number of 'characters' counting full-width
+  characters as 1 instead of 2.  Now these functions take an additional
+  argument 'count_gcells' that tells them how to count.
+  This removes some long-standing, somewhat obscure problems with search target
+  highlighting under CJK display character sets, as well as new (and less
+  obscure) CJK problems introduces by the latest changes for highlighting. 
+  Also fixed some details in the *strstr functions.  The positioning of the
+  highlighting in CJK mode should now be correct and work as expected (as for
+  other display character sets) for anchors, search targets, and combinations
+  of both.
+* reorganized LYOpenTempRewrite.  It should finally make sense for systems
+  without HAVE_TRUNCATE defined.
+* corrected SNACat (was unused).
+* changes for SUP and SUB:  Render SUP visibly as a '^' character if it needs
+  to be separated from a preceding character in order to prevent
+  misinterpretation.  The test currently used is isxdigit for the the preceding
+  character.  Render <SUB> and </SUB> always as brackets '[' and ']'
+  respectively.  SUB is mostly used in technical material while SUP occurs
+  frequently in pages of general nature where it is not essential, therefore
+  the different treatment.
 1999-10-21 (2.8.3dev.13)
-* revert a change from dev.4 which disabled getbkgd support in PDCurses -DK 
+* revert a change from dev.4 which disabled getbkgd support in PDCurses -DK
 * modify ifdef for USE_QUOTED_PARAMETER to include __CYGWIN__, else names such
   as "telnet.sh" are translated to "telnet" -DK
 * improve/simplify scrollbar support (Ilya Zakharevich)
@@ -77,13 +335,11 @@ Changes since Lynx 2.8 release
   to show what is returned.
 * SGML.c:  some cleanup of ugly ifdefs, and of unnecessary abuse of global
   variables.  (still a lot left!)
-* more consistent and correct recognition of element names.  The characters
-  "_-.:" don't end the name.
 * handle INCLUDE and CDDATA marked sections: output the contents.
 * parse various elements differently that had/have special requirements or
-  hacks.  Extend meaning of Tgf_strict for litteral-like content modes.  Use
+  hacks.  Extend meaning of Tgf_strict for literal-like content modes.  Use
   SGML_CDATA in some cases (and treat it similar to SGML_LITTERAL), use
-  SGML_PCDATA for litteral-like parsing (but if modified by Tgf_strict it's
+  SGML_PCDATA for literal-like parsing (but if modified by Tgf_strict it's
   more like regular SGML_MIXED).  A '<' that would start a tag gets displayed
   (since not element content is allowed that's just error recovery).  Comments
   now work in TEXTAREA instead of getting displayed as text (SortaSGML mode
@@ -123,9 +379,9 @@ Changes since Lynx 2.8 release
   - in HTML 4, an OBJECT with USEMAP attribute can refer to a MAP within the
     OBJECT's content, possibly within nested inner OBJECTs.  Lynx would fail to
     find the MAP in that case, now it doesn't.
-  - in HTML 4, MAP can contain arbitray block elements in addition to AREA. 
+  - in HTML 4, MAP can contain arbitray block elements in addition to AREA.
     Lynx now shows such block content, even if it occurs within (possibly
-    nested) OBJECTs with USEMAP whose contents we would otherwise skip. 
+    nested) OBJECTs with USEMAP whose contents we would otherwise skip.
     Sometimes we may show too much now, by generating a LYNXIMGMAP link as well
     as showing block content or by showing more of the OBJECT content than what
     is within a MAP, but that is preferable to losing data.
@@ -145,7 +401,7 @@ Changes since Lynx 2.8 release
   containing line is now scanned from the beginning, using the same logic as in
   display_line to make sure that lynx and the display library have the same
   idea of where in the line the link starts.  In UTF-8 output mode, parts of
-  the line preceding the link are also repainted if this is necessary. 
+  the line preceding the link are also repainted if this is necessary.
   Refreshing of the physical line is forced if necessary in UTF-8 mode.  For
   anchors split across lines, the new approach is currently only used for the
   first line.
@@ -196,7 +452,7 @@ Changes since Lynx 2.8 release
 * extended SUFFIX option, added SUFFIX_ORDER option, see documentation in
   lynx.cfg.  The long list of built-in file suffix rules in HTInit.c can now be
   disabled, either at compile time - see userdefs.h - or at run time.  The
-  equivalent functionality is now available in lynx.cfg for those who want it. 
+  equivalent functionality is now available in lynx.cfg for those who want it.
   Added somments, see HTFileInit in HTInit.c.
 * various tweaks of built-in file suffix rules.
 * allow XLOADIMAGE_COMMAND to be empty (in lynx.cfg) or NULL (in userdefs.h),
@@ -221,7 +477,7 @@ Changes since Lynx 2.8 release
   handle (a "UChndl", which is different from a "LYhndl" or "UCLYhndl" etc.,
   and shouldn't be directly accessed by arbitrary bits of lynx code - it should
   be regarded as private to the chartrans mechanism).
-* protect various printf-like calls against crashes from strings with '%': 
+* protect various printf-like calls against crashes from strings with '%':
   LYSyslog.
 * LYDownload.c: made parsing of LYNXDOWNLOAD: URL slightly more robust.
 * disabled some broken pieces.
@@ -505,7 +761,7 @@ Changes since Lynx 2.8 release
   for use in LYUtils.c on DOS -LP
 * correct several minor problems with integration of HS's changes in
   GridText.h, HTAlert.c and LYPrint.c (reported by LP) -TD
-+ restore dev.3 interface to LYLowerCase and LYUpperCase and do casts
+* restore dev.3 interface to LYLowerCase and LYUpperCase and do casts
   internally to work on unsigned chars -PG
 * corrected typos in some messages (reported by Dmitry Sivachenko
   <demon@gpad.ac.ru>).
@@ -523,7 +779,7 @@ Changes since Lynx 2.8 release
 * corrected definitions in HTTP.c and HTDOS.h to build with old TCP library -LP
 * When keypad_mode was changed from forms options menu
   set_numbers_as_arrows()/reset_numbers_as_arrows() was not reinitialized
-  (reported by KED). - LP
+  (reported by KED) - LP
 * SOURCE_CACHE: add one more parse setting member (keypad_mode)
   to HText structure -LP
 * SOURCE_CACHE:  fix updating the document when "display charset" was changed
@@ -1492,7 +1748,7 @@ Changes since Lynx 2.8 release
 * ifdef'd print_local_dir in HTFile.c since this function does not compile on
   VMS (report by Andy Harper, Tony Bolton) -TD
 * fix reload_read_cfg() to avoid persistent cookies mode changing at run time;
-  reload printers list, downloaders list, environments - as expected. - LP
+  reload printers list, downloaders list, environments - as expected - LP
 * fixes for SOURCE_CACHE!=NONE mode, trying to accommodate HTreparse_document()
   for mainloop() events:
   - add/use flag "from_source_cache" for better mainloop maintenance
@@ -1623,7 +1879,7 @@ Changes since Lynx 2.8 release
   (ie different commandline options make source view logic different) -VH
 * HTChunkPutc was inlined in SGML.c for better performance -VH
 * keeping of Style_className was omitted in HTML.c to increase performance of
-  lynx compiled with lss support. -VH
+  lynx compiled with lss support -VH
 * performance of lynx compiled with lss support is increased ~ by 15-20% for
   normal documents, and by up to 50% for documents with a lot of tags VH
 * fixed bug in lynx compiled with lss support  that caused it to load local CSS
@@ -1787,7 +2043,7 @@ Changes since Lynx 2.8 release
   (possible large) document over the net.  - LP
 * &mdash; (&#x2014) now display as "--" (popular requests) - LP
 * &emsp; are now displayed as two &ensp; (popular requests),
-  previous definition of HT_EM_SPACE now renamed to HT_EN_SPACE. - LP
+  previous definition of HT_EM_SPACE now renamed to HT_EN_SPACE - LP
 * minor tweaks in postoptions(), new flag added - LP
 * minor changes to make this build with SunOS K&R cc - TD
 * entities.h:  clean HTML4.0 entities table added, it is #ifdef'ed with
@@ -2013,7 +2269,7 @@ Changes since Lynx 2.8 release
 * function expand_substring used with NCURSES for user-defined mapping keysyms
   to byte sequences was parsing the "^(...)" construct wrong - KW
 * other small tweaks in key handling code - KW
-* changes to lynx.cfg to better reflect reality. - KW
+* changes to lynx.cfg to better reflect reality - KW
 * terminology note:  lynxkeycode = what's between the colons in lynx.cfg
   KEYMAP:...:..., lynxactioncode = LYK_* code for what's right of the second
   colon, lynxeditactioncode = what's assigned in LYEditmap.c (and which may
diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c
index fffd3a29..c90702d4 100644
--- a/WWW/Library/Implementation/HTDOS.c
+++ b/WWW/Library/Implementation/HTDOS.c
@@ -48,7 +48,7 @@ char * HTDOS_wwwName ARGS1(char *, dosname)
 	    break;
       default:
 	    *cp_url++ = ch;
-	    break;;
+	    break;
       }
       dosname++;
     }
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index cd8bcdab..b5ad32af 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -161,8 +161,10 @@ PRIVATE char *FormatStr ARGS3(
     if (*start) {
 	sprintf(fmt, "%%%.*ss", (int) sizeof(fmt) - 3, start);
 	HTSprintf0(bufp, fmt, entry);
-    } else {
-	HTSprintf0(bufp, "%s", entry);
+    } else if (*bufp && !(entry && *entry)) {
+	**bufp = '\0';
+    } else if (entry) {
+	StrAllocCopy(*bufp, entry);
     }
     return *bufp;
 }
@@ -178,7 +180,7 @@ PRIVATE char *FormatNum ARGS3(
 	HTSprintf0(bufp, fmt, entry);
     } else {
 	sprintf(fmt, "%d", entry);
-	StrAllocCat(*bufp, fmt);
+	StrAllocCopy(*bufp, fmt);
     }
     return *bufp;
 }
@@ -1127,7 +1129,7 @@ PUBLIC void LYGetFileInfo ARGS7(
 	HTFormat format;
 	HTAtom * myEnc = NULL;
 	HTParentAnchor *file_anchor;
-	CONST char *file_csname = file_anchor->charset;
+	CONST char *file_csname;
 	int file_cs;
 
 	/*
@@ -1815,7 +1817,7 @@ PRIVATE int print_local_dir ARGS5(
 #ifndef DISP_PARTIAL
 		if (num_of_entries_output % HTMAX(display_lines,10) == 0) {
 		    if (HTCheckForInterrupt()) {
-			_HTProgress ("Data transfer interrupted.");
+			_HTProgress (TRANSFER_INTERRUPTED);
 			status = HT_PARTIAL_CONTENT;
 			break;
 		    }
diff --git a/WWW/Library/Implementation/HTMLDTD.c b/WWW/Library/Implementation/HTMLDTD.c
index 7f8c37ed..9c00e64d 100644
--- a/WWW/Library/Implementation/HTMLDTD.c
+++ b/WWW/Library/Implementation/HTMLDTD.c
@@ -1325,7 +1325,7 @@ static attr ulist_attr[] = {			/* UL attributes */
  /* { "TD"	, td_attr,	HTML_TD_ATTRIBUTES,	SGML_EMPTY }, */
 #define T_TD		0x0400, 0x0FBCF,0x8FFFF,0x00020,0xB7FB7,0x8C75F,0x00001
  /* { "TEXTAREA", textarea_attr,HTML_TEXTAREA_ATTRIBUTES, SGML_LITTERAL }, */
-#define T_TEXTAREA	0x0040, 0x00000,0x00000,0x07F8F,0x33FBF,0x80F5F,0x00000
+#define T_TEXTAREA	0x0040, 0x00000,0x00000,0x07F8F,0x33FBF,0x80F5F,0x00040
  /* { "TEXTFLOW", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED }, */
 #define T_TEXTFLOW	0x20000,0x8FBFF,0x9FFFF,0x977B0,0xB7FB7,0x9B00F,0x00003
  /* { "TFOOT"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY }, */
@@ -1383,7 +1383,7 @@ static attr ulist_attr[] = {			/* UL attributes */
 #define NULL_HTTag NULL_HTTag_
 #endif
 
-static CONST HTTag tags_old[HTML_ELEMENTS] = {
+static CONST HTTag tags_old[HTML_ALL_ELEMENTS] = {
  { P("A")	, a_attr,	HTML_A_ATTRIBUTES,	SGML_EMPTY,T_A},
  { P("ABBREV")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_ABBREV},
  { P("ACRONYM") , gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_ACRONYM},
@@ -1473,7 +1473,7 @@ static CONST HTTag tags_old[HTML_ELEMENTS] = {
  { P0("PRE")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_PRE},
  { P("Q")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_Q},
  { P("S")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_S},
- { P0("SAMP")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SAMP},
+ { P("SAMP")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SAMP},
  { P("SCRIPT")	, script_attr,	HTML_SCRIPT_ATTRIBUTES, SGML_LITTERAL,T_SCRIPT},
  { P("SELECT")	, select_attr,	HTML_SELECT_ATTRIBUTES, SGML_MIXED,T_SELECT},
  { P("SHY")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_SHY},
@@ -1502,9 +1502,13 @@ static CONST HTTag tags_old[HTML_ELEMENTS] = {
  { P("VAR")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_VAR},
  { P("WBR")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_WBR},
  { P0("XMP")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL,T_XMP},
+ /*  additional (alternative variants), not counted in HTML_ELEMENTS: */
+/* This one will be used as a temporary substitute within the parser when
+   it has been signalled to parse OBJECT content as MIXED. - kw */
+ { P("OBJECT")	, object_attr,	HTML_OBJECT_ATTRIBUTES, SGML_MIXED,T_OBJECT_PCDATA},
 };
 
-static CONST HTTag tags_new[HTML_ELEMENTS] = {
+static CONST HTTag tags_new[HTML_ALL_ELEMENTS] = {
  { P("A")	, a_attr,	HTML_A_ATTRIBUTES,	SGML_MIXED,T_A},
  { P("ABBREV")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_ABBREV},
  { P("ACRONYM") , gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_ACRONYM},
@@ -1594,7 +1598,7 @@ static CONST HTTag tags_new[HTML_ELEMENTS] = {
  { P0("PRE")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_PRE},
  { P("Q")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_Q},
  { P("S")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_S},
- { P0("SAMP")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SAMP},
+ { P("SAMP")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SAMP},
  { P("SCRIPT")	, script_attr,	HTML_SCRIPT_ATTRIBUTES, SGML_CDATA,T_SCRIPT},
  { P("SELECT")	, select_attr,	HTML_SELECT_ATTRIBUTES, SGML_ELEMENT,T_SELECT},
  { P("SHY")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_SHY},
@@ -1623,12 +1627,11 @@ static CONST HTTag tags_new[HTML_ELEMENTS] = {
  { P("VAR")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_VAR},
  { P("WBR")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_WBR},
  { P0("XMP")	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL,T_XMP},
-};
-
+ /*  additional (alternative variants), not counted in HTML_ELEMENTS: */
 /* This one will be used as a temporary substitute within the parser when
-   it has been signalled to parse OBJECT content (again) as MIXED. - kw */
-PUBLIC HTTag HTTag_mixedObject =
- { P("OBJECT")	, object_attr,	HTML_OBJECT_ATTRIBUTES, SGML_MIXED,T_OBJECT_PCDATA};
+   it has been signalled to parse OBJECT content as MIXED. - kw */
+ { P("OBJECT")	, object_attr,	HTML_OBJECT_ATTRIBUTES, SGML_MIXED,T_OBJECT_PCDATA},
+};
 
 #undef P
 #undef P0
@@ -1637,7 +1640,7 @@ PUBLIC HTTag HTTag_mixedObject =
 /* Dummy space, will be filled with the contents of either tags_new
    or tags_old on calling HTSwitchDTD - kw */
 
-static HTTag tags[HTML_ELEMENTS];
+static HTTag tags[HTML_ALL_ELEMENTS];
 
 PUBLIC CONST SGML_dtd HTML_dtd = {
 	tags,
@@ -1659,12 +1662,12 @@ PUBLIC void HTSwitchDTD ARGS1(
     if (TRACE)
 	CTRACE((tfp,"HTMLDTD: Copying DTD element info of size %d, %d * %d\n",
 		(int) (new ? sizeof(tags_new) : sizeof(tags_old)),
-		HTML_ELEMENTS,
+		HTML_ALL_ELEMENTS,
 		(int) sizeof(HTTag)));
     if (new)
-	memcpy(tags, tags_new, HTML_ELEMENTS * sizeof(HTTag));
+	memcpy(tags, tags_new, HTML_ALL_ELEMENTS * sizeof(HTTag));
     else
-	memcpy(tags, tags_old, HTML_ELEMENTS * sizeof(HTTag));
+	memcpy(tags, tags_old, HTML_ALL_ELEMENTS * sizeof(HTTag));
 }
 
 PUBLIC HTTag HTTag_unrecognized =
diff --git a/WWW/Library/Implementation/HTMLDTD.h b/WWW/Library/Implementation/HTMLDTD.h
index 9c81774a..5ef77f6a 100644
--- a/WWW/Library/Implementation/HTMLDTD.h
+++ b/WWW/Library/Implementation/HTMLDTD.h
@@ -170,10 +170,22 @@ typedef enum _HTMLElement {
 	HTML_UL,
 	HTML_VAR,
 	HTML_WBR,
-	HTML_XMP } HTMLElement;
-
+	HTML_XMP,
+	HTML_ALT_OBJECT } HTMLElement;
+
+/* Notes: HTML.c uses a different extension of the HTML_ELEMENTS space
+          privately, see HTNestedList.h. */
+/*        Don't replace HTML_ELEMENTS with TABLESIZE(mumble_dtd.tags). */
+/* Keep the following defines in synch with the above enum! */
+
+/* HTML_ELEMENTS:     number of elements visible to Lynx code in general,
+                      alphabetic (ASCII) order. */
+/* HTML_ALL_ELEMENTS: number of elements visible to SGML parser,
+                      additional variant(s) at end. */
+#define HTML_ALL_ELEMENTS 119
 #define HTML_ELEMENTS 118
 
+
 /*
 
 Attribute numbers
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index c98d8329..c37f07e0 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -2738,7 +2738,7 @@ Send_NNTP_command:
 	 *  to occur in normal use, break from the loop without retrying
 	 *  and without closing the connection.  It is unlikely that
 	 *  these are leftovers from a timed-out connection (but we do
-	 *  some checks to see whether the response rorresponds to the
+	 *  some checks to see whether the response corresponds to the
 	 *  last command), or that they will give anything else when
 	 *  automatically retried.  - kw
 	 */
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index 32ae6fa5..afbf2910 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -322,8 +322,7 @@ PUBLIC char * HTParse ARGS3(
 		    }
 		} else if (p2 != result) {
 		    h = p2;
-		    if (h != result)
-			h--;		/* End of hostname */
+		    h--;		/* End of hostname */
 		    if (*h == '.') {
 			/*
 			**  Slide p2 over h.
diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c
index 824ab937..85f9123f 100644
--- a/WWW/Library/Implementation/HTString.c
+++ b/WWW/Library/Implementation/HTString.c
@@ -496,6 +496,16 @@ PRIVATE char *HTAlloc ARGS2(char *, ptr, size_t, length)
 }
 
 /*
+ * If SAVE_TIME_NOT_SPACE is defined, StrAllocVsprintf will hang on to
+ * its temporary string buffers instead of allocating and freeing them
+ * in each invocation.  They only grow and never shrink, and won't be
+ * cleaned up on exit. - kw
+ */
+#if !(defined(_REENTRANT) || defined(_THREAD_SAFE))
+#define SAVE_TIME_NOT_SPACE
+#endif
+
+/*
  * Replacement for sprintf, allocates buffer on the fly according to what's needed
  * for its arguments.  Unlike sprintf, this always concatenates to the destination
  * buffer, so we do not have to provide both flavors.
@@ -513,27 +523,65 @@ typedef enum { Flags, Width, Prec, Type, Format } PRINTF;
 #define GROW_EXPR(n) (((n) * 3) / 2)
 #define GROW_SIZE 256
 
-PRIVATE char * StrAllocVsprintf ARGS4(
+PUBLIC_IF_FIND_LEAKS char * StrAllocVsprintf ARGS4(
 	char **,	pstr,
 	size_t,		dst_len,
 	CONST char *,	fmt,
 	va_list *,	ap)
 {
+#ifdef SAVE_TIME_NOT_SPACE
+    static size_t tmp_len = 0;
+    static size_t fmt_len = 0;
+    static char *tmp_ptr = NULL;
+    static char *fmt_ptr = NULL;
+#else
     size_t tmp_len = GROW_SIZE;
-    size_t have, need;
     char *tmp_ptr = 0;
     char *fmt_ptr;
+#endif /* SAVE_TIME_NOT_SPACE */
+    size_t have, need;
     char *dst_ptr = *pstr;
     CONST char *format = fmt;
 
     if (fmt == 0 || *fmt == '\0')
 	return 0;
 
+#ifdef USE_VASPRINTF
+    if (pstr && !dst_len) {
+	if (*pstr)
+	    FREE(*pstr);
+	if (vasprintf(pstr, fmt, *ap) >= 0) {
+	    mark_malloced(*pstr, strlen(*pstr)+1);
+	    return(*pstr);
+	}
+    }
+#endif /* USE_VASPRINTF */
+
     need = strlen(fmt) + 1;
+#ifdef SAVE_TIME_NOT_SPACE
+    /* the following assumes that 0 as first arg to realloc works
+       portably like malloc; if that isn't the case, change to use
+       HTAlloc. - kw */
+    if (!fmt_ptr || fmt_len < need*NUM_WIDTH) {
+	if ((fmt_ptr = realloc(fmt_ptr, need*NUM_WIDTH)) == 0) {
+	    outofmem(__FILE__, "StrAllocVsprintf (fmt_ptr)");
+	} else {
+	    fmt_len = need*NUM_WIDTH;
+	}
+    }
+    if (!tmp_ptr || tmp_len < GROW_SIZE) {
+	if ((tmp_ptr = realloc(tmp_ptr, GROW_SIZE)) == 0) {
+	    outofmem(__FILE__, "StrAllocVsprintf (tmp_ptr)");
+	} else {
+	    tmp_len = GROW_SIZE;
+	}
+    }
+#else
     if ((fmt_ptr = malloc(need*NUM_WIDTH)) == 0
      || (tmp_ptr = malloc(tmp_len)) == 0) {
 	outofmem(__FILE__, "StrAllocVsprintf");
     }
+#endif /* SAVE_TIME_NOT_SPACE */
 
     if (dst_ptr == 0) {
 	dst_ptr = HTAlloc(dst_ptr, have = GROW_SIZE + need);
@@ -703,19 +751,27 @@ PRIVATE char * StrAllocVsprintf ARGS4(
 	}
     }
 
+#ifndef SAVE_TIME_NOT_SPACE
     FREE(tmp_ptr);
     FREE(fmt_ptr);
+#endif
     dst_ptr[dst_len] = '\0';
     if (pstr)
 	*pstr = dst_ptr;
     return (dst_ptr);
 }
+#undef SAVE_TIME_NOT_SPACE
 
 /*
  * Replacement for sprintf, allocates buffer on the fly according to what's needed
  * for its arguments.  Unlike sprintf, this always concatenates to the destination
  * buffer.
  */
+/* Note: if making changes, also check the memory tracking version
+ * LYLeakHTSprintf in LYLeaks.c. - kw */
+#ifdef HTSprintf		/* if hidden by LYLeaks stuff */
+#undef HTSprintf
+#endif
 #if ANSI_VARARGS
 PUBLIC char * HTSprintf (char ** pstr, CONST char * fmt, ...)
 #else
@@ -747,6 +803,11 @@ PUBLIC char * HTSprintf (va_alist)
  * needed for its arguments.  Like sprintf, this always resets the destination
  * buffer.
  */
+/* Note: if making changes, also check the memory tracking version
+ * LYLeakHTSprintf0 in LYLeaks.c. - kw */
+#ifdef HTSprintf0		/* if hidden by LYLeaks stuff */
+#undef HTSprintf0
+#endif
 #if ANSI_VARARGS
 PUBLIC char * HTSprintf0 (char ** pstr, CONST char * fmt, ...)
 #else
@@ -763,6 +824,15 @@ PUBLIC char * HTSprintf0 (va_alist)
 	char **		pstr = va_arg(ap, char **);
 	CONST char *	fmt  = va_arg(ap, CONST char *);
 #endif
+#ifdef USE_VASPRINTF
+	if (pstr) {
+	    if (*pstr)
+		FREE(*pstr);
+	    if (vasprintf(pstr, fmt, ap) >= 0) /* else call outofmem?? */
+		mark_malloced(*pstr, strlen(*pstr)+1);
+	    result = *pstr;
+	} else
+#endif /* USE_VASPRINTF */
 	result = StrAllocVsprintf(pstr, 0, fmt, &ap);
     }
     va_end(ap);
diff --git a/WWW/Library/Implementation/HTString.h b/WWW/Library/Implementation/HTString.h
index e3a83660..2b167a8c 100644
--- a/WWW/Library/Implementation/HTString.h
+++ b/WWW/Library/Implementation/HTString.h
@@ -81,6 +81,14 @@ extern char * HTSprintf () GCC_PRINTFLIKE(2,3);
 extern char * HTSprintf0 () GCC_PRINTFLIKE(2,3);
 #endif
 
+#if defined(LY_FIND_LEAKS)	/* private otherwise */
+extern char * StrAllocVsprintf PARAMS((
+        char **		pstr,
+        size_t		len,
+        CONST char *	fmt,
+        va_list *	ap));
+#endif
+
 #if (defined(VMS) || defined(DOSPATH) || defined(__EMX__)) && !defined(__CYGWIN__)
 #define USE_QUOTED_PARAMETER 0
 #else
diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c
index 77f9ec69..025ede23 100644
--- a/WWW/Library/Implementation/HTTelnet.c
+++ b/WWW/Library/Implementation/HTTelnet.c
@@ -37,7 +37,11 @@
 PRIVATE void do_system ARGS1(char *, command)
 {
     CTRACE((tfp, "HTTelnet: Command is: %s\n\n", command));
+#ifdef UNIX	/* want LYSystem's signal sanitizing - kw */
+    LYSystem(command);
+#else		/* Non-UNIX should use LYSystem too? - left for now - kw */
     system(command);
+#endif
     FREE(command);
 }
 
diff --git a/WWW/Library/Implementation/LYLeaks.h b/WWW/Library/Implementation/LYLeaks.h
index 5ecf8e67..fc2a0dc0 100644
--- a/WWW/Library/Implementation/LYLeaks.h
+++ b/WWW/Library/Implementation/LYLeaks.h
@@ -32,12 +32,23 @@
 **		string created by __FILE__ to not be dynamic in
 **		nature (don't free it and assume will exist at all
 **		times during execution).
+**	If you are using LY_FIND_LEAKS and LY_FIND_LEAKS_EXTENDED and
+**		want only normal memory tracking (not extended for
+**		HTSprintf/HTSprintf0) to be used in a certain file,
+**		define NO_EXTENDED_MEMORY_TRACKING and don't define
+**		NO_MEMORY_TRACKING before including this file.
 **  Revision History:
 **	05-26-94	created for Lynx 2-3-1, Garrett Arch Blythe
 **	10-30-97	modified to handle StrAllocCopy() and
 **			StrAllocCat(). - KW & FM
+**	1999-10-17	modified to handle HTSprintf0 and HTSprintf(),
+**			and to provide mark_malloced, if
+**			LY_FIND_LEAKS_EXTENDED is defined. - kw
 */
 
+/* Undefine this to get no inproved HTSprintf0/HTSprintf tracking: */
+#define LY_FIND_LEAKS_EXTENDED
+
 /*
 **  Required includes
 */
@@ -146,13 +157,42 @@ typedef struct AllocationList_tag	{
 #endif /* StrAllocCat */
 #define StrAllocCat(dest, src)  LYLeakSACat(&(dest), src, __FILE__, __LINE__)
 
+#define mark_malloced(a,size) LYLeak_mark_malloced(a,size, __FILE__, __LINE__)
+
+#if defined(LY_FIND_LEAKS_EXTENDED) && !defined(NO_EXTENDED_MEMORY_TRACKING)
+#ifdef HTSprintf0
+#undef HTSprintf0
+#endif /* HTSprintf0 */
+#define HTSprintf0 (Get_htsprintf0_fn(__FILE__,__LINE__))
+#ifdef HTSprintf
+#undef HTSprintf
+#endif /* HTSprintf */
+#define HTSprintf (Get_htsprintf_fn(__FILE__,__LINE__))
+#endif /* LY_FIND_LEAKS_EXTENDED and not NO_EXTENDED_MEMORY_TRACKING */
+
+#else /* LY_FIND_LEAKS && !NO_MEMORY_TRACKING */
+
+#define mark_malloced(a,size)	/* no-op */
+
 #endif /* LY_FIND_LEAKS && !NO_MEMORY_TRACKING */
 
+#if defined(LY_FIND_LEAKS)
+#define PUBLIC_IF_FIND_LEAKS PUBLIC
+#else
+#define PUBLIC_IF_FIND_LEAKS PRIVATE
+#endif
 /*
 **	Function declarations
 **	See the appropriate source file for usage.
 */
 extern void LYLeaks NOPARAMS;
+#ifdef LY_FIND_LEAKS_EXTENDED
+extern AllocationList *LYLeak_mark_malloced PARAMS((
+	void *		vp_alloced,
+	size_t		st_bytes,
+	CONST char *	cp_File,
+	CONST short	ssi_Line));
+#endif /* LY_FIND_LEAKS_EXTENDED */
 extern void *LYLeakMalloc PARAMS((
 	size_t		st_bytes,
 	CONST char *	cp_File,
@@ -182,4 +222,17 @@ extern char * LYLeakSACat PARAMS((
 	CONST char *	cp_File,
 	CONST short	ssi_Line));
 
+#ifdef LY_FIND_LEAKS_EXTENDED
+/* Trick to get tracking of var arg functions without relying
+   on var arg preprocessor macros: */
+
+typedef char * HTSprintflike PARAMS((char **, CONST char *, ...));
+extern HTSprintflike *Get_htsprintf_fn PARAMS((
+			   CONST char *	cp_File,
+			   CONST short	ssi_Line));
+extern HTSprintflike *Get_htsprintf0_fn PARAMS((
+			   CONST char *	cp_File,
+			   CONST short	ssi_Line));
+#endif /* LY_FIND_LEAKS_EXTENDED */
+
 #endif /* __LYLEAKS_H */
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index 9b018177..3e2f3389 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -90,9 +90,8 @@ PRIVATE void fake_put_character ARGS2(
 #define PUTS(str) ((*context->actions->put_string)(context->target, str))
 
 
-#define OPT 0 /* don't make it 1 otherwise something wrong will be with
- TagSoup parser mode - I was unable to undestand why it works incorrectly -HV*/
-#define OPT1 1 /* set to 1 for several optimizations */
+#define OPT 1
+
 
 /*the following macros are used for pretty source view. */
 #define IS_C(attr) (attr.type == HTMLA_CLASS)
@@ -138,9 +137,10 @@ struct _HTStream {
     HTStructured		*target;	/* target object */
 
     HTTag			*current_tag;
-    HTTag			*slashtag;
+    HTTag			*slashedtag;
     CONST HTTag			*unknown_tag;
     BOOL			inSELECT;
+    BOOL			no_lynx_specialcodes;
     int				current_attribute_number;
     HTChunk			*string;
     HTElement			*element_stack;
@@ -156,7 +156,7 @@ struct _HTStream {
 		S_dollar_paren_sq,
 		S_esc_dq, S_dollar_dq, S_paren_dq, S_nonascii_text_dq,
 		S_dollar_paren_dq,
-		S_in_kanji, S_junk_tag} state;
+		S_in_kanji, S_junk_tag, S_junk_pi} state;
 #ifdef CALLERDATA
     void *			callerData;
 #endif /* CALLERDATA */
@@ -202,10 +202,10 @@ struct _HTStream {
 
 PRIVATE void HTMLSRC_apply_markup ARGS3(
 	    HTStream *,	      context,
-	    HTlexem,	      lexem,
+	    HTlexeme,	      lexeme,
 	    BOOL,	      start)
 {
-    HT_tagspec* ts = *( ( start ? lexem_start : lexem_end ) + lexem);
+    HT_tagspec* ts = *( ( start ? lexeme_start : lexeme_end ) + lexeme);
 
     while (ts) {
 #ifdef USE_COLOR_STYLE
@@ -216,7 +216,7 @@ PRIVATE void HTMLSRC_apply_markup ARGS3(
 	    force_classname = TRUE;
 	}
 #endif
-	CTRACE((tfp,ts->start ? "SRCSTART %d\n" : "SRCSTOP %d\n",(int)lexem));
+	CTRACE((tfp,ts->start ? "SRCSTART %d\n" : "SRCSTOP %d\n",(int)lexeme));
 	if (ts->start)
 	    (*context->actions->start_element)(
 		context->target,
@@ -409,11 +409,7 @@ PRIVATE void handle_attribute_name ARGS2(
 	    FREE(context->value[i]);
 #ifdef USE_COLOR_STYLE
 #  ifdef USE_PSRC
-#	if !OPT1
-	    current_is_class = (!strcasecomp("class", s));
-#	else
 	    current_is_class = IS_C(attributes[i]);
-#	endif
 #   else
 	    current_is_class = (!strcasecomp("class", s));
 #   endif
@@ -478,6 +474,14 @@ PRIVATE BOOL put_special_unicodes ARGS2(
 	HTStream *,	context,
 	UCode_t,	code)
 {
+    /* (Tgf_nolyspcl) */
+    if (context->no_lynx_specialcodes) {
+	/*
+	**  We were asked by a "DTD" flag to not generate lynx specials. - kw
+	*/
+	return NO;
+    }
+
     if (code == CH_NBSP) {  /* S/390 -- gil -- 0657 */
 	/*
 	**  Use Lynx special character for nbsp.
@@ -505,7 +509,8 @@ PRIVATE BOOL put_special_unicodes ARGS2(
 	**  in the context of line wrapping.  Unfortunately, if we use
 	**  HT_EN_SPACE we override the chartrans tables for those spaces
 	**  with a single '32' for all (but do line wrapping more fancy).
-	**  Assume emsp as two ensp (below).
+	**
+	**  We may treat emsp as one or two ensp (below).
 	*/
 #ifdef USE_PSRC
 	if (!psrc_view)
@@ -854,6 +859,36 @@ PRIVATE void handle_sgmlatt ARGS1(
     return;
 }
 
+/*
+ *  Convenience macros - tags (elements) are identified sometimes
+ *  by an int or enum value ('TAGNUM'), sometimes
+ *  by a pointer to HTTag ('TAGP'). - kw
+ */
+#define TAGNUM_OF_TAGP(t) (t - context->dtd->tags)
+#define TAGP_OF_TAGNUM(e) (context->dtd->tags + e)
+
+/*
+ *  The following implement special knowledge about OBJECT.
+ *  As long as HTML_OBJECT is the only tag for which an alternative
+ *  variant exist, they can be simple macros. - kw
+ */
+/* does 'TAGNUM' e have an alternative (variant) parsing mode? */
+#define HAS_ALT_TAGNUM(e) (e == HTML_OBJECT)
+
+/* return 'TAGNUM' of the alternative mode for 'TAGNUM' e, if any. */
+#define ALT_TAGNUM(e) ((e == HTML_OBJECT) ? HTML_ALT_OBJECT : e)
+
+/* return 'TAGNUM' of the normal mode for 'TAGNUM' e which may be alt. */
+#define NORMAL_TAGNUM(e) ((e >= HTML_ELEMENTS) ? HTML_OBJECT : e)
+
+/* More convenience stuff. - kw */
+#define ALT_TAGP_OF_TAGNUM(e) TAGP_OF_TAGNUM(ALT_TAGNUM(e))
+#define NORMAL_TAGP_OF_TAGNUM(e) TAGP_OF_TAGNUM(NORMAL_TAGNUM(e))
+
+#define ALT_TAGP(t) ALT_TAGP_OF_TAGNUM(TAGNUM_OF_TAGP(t))
+#define NORMAL_TAGP(t) NORMAL_TAGP_OF_TAGNUM(TAGNUM_OF_TAGP(t))
+
+
 #ifdef EXTENDED_HTMLDTD
 
 PRIVATE BOOL element_valid_within ARGS3(
@@ -907,8 +942,7 @@ PRIVATE void do_close_stacked ARGS1(
     if (context->inSELECT && !strcasecomp(stacked->tag->name, "SELECT")) {
 	context->inSELECT = FALSE;
     }
-    e = (stacked->tag == &HTTag_mixedObject) ?
-	HTML_OBJECT : stacked->tag - context->dtd->tags;
+    e = NORMAL_TAGNUM(TAGNUM_OF_TAGP(stacked->tag));
 #ifdef USE_PSRC
     if (!psrc_view) /* Don't actually pass call on if viewing psrc - kw */
 #endif
@@ -918,6 +952,8 @@ PRIVATE void do_close_stacked ARGS1(
 	(char **)&context->include);
     context->element_stack = stacked->next;
     FREE(stacked);
+    context->no_lynx_specialcodes = context->element_stack ?
+	(context->element_stack->tag->flags & Tgf_nolyspcl) : NO;
 }
 
 PRIVATE int is_on_stack ARGS2(
@@ -928,8 +964,7 @@ PRIVATE int is_on_stack ARGS2(
     int i = 1;
     for (; stacked; stacked = stacked->next, i++) {
 	if (stacked->tag == old_tag ||
-	    (stacked->tag == &HTTag_mixedObject &&
-		old_tag - context->dtd->tags == HTML_OBJECT))
+	    stacked->tag == ALT_TAGP(old_tag))
 	    return i;
     }
     return 0;
@@ -1034,8 +1069,7 @@ PRIVATE void end_element ARGS2(
 	int status = HT_OK;
 	HTMLElement e;
 	HTElement * N = context->element_stack;
-	HTTag * t = (N->tag == &HTTag_mixedObject && N->tag != old_tag) ?
-	    context->dtd->tags + HTML_OBJECT : N->tag;
+	HTTag * t = (N->tag != old_tag) ? NORMAL_TAGP(N->tag) : N->tag;
 
 	if (old_tag != t) {		/* Mismatch: syntax error */
 	    if (context->element_stack->next) { /* This is not the last level */
@@ -1048,8 +1082,7 @@ PRIVATE void end_element ARGS2(
 	    }
 	}
 
-	e = (t == &HTTag_mixedObject) ?
-	    HTML_OBJECT : t - context->dtd->tags;
+	e = NORMAL_TAGNUM(TAGNUM_OF_TAGP(t));
 #ifdef USE_PSRC
 	if (!psrc_view) /* Don't actually pass call on if viewing psrc - kw */
 #endif
@@ -1066,11 +1099,13 @@ PRIVATE void end_element ARGS2(
 		(char **)&context->include);
 	} else if (status == HT_PARSER_OTHER_CONTENT) {
 	    CTRACE((tfp, "SGML: Continue with other content model for <%s>\n", t->name));
-	    context->element_stack->tag = &HTTag_mixedObject;
+	    context->element_stack->tag = ALT_TAGP_OF_TAGNUM(e);
 	} else {
 	    context->element_stack = N->next;		/* Remove from stack */
 	    FREE(N);
 	}
+	context->no_lynx_specialcodes = context->element_stack ?
+	    (context->element_stack->tag->flags & Tgf_nolyspcl) : NO;
 #ifdef WIND_DOWN_STACK
 	if (old_tag == t)
 	    return;  /* Correct sequence */
@@ -1093,10 +1128,8 @@ PRIVATE void start_element ARGS1(
 {
     int status;
     HTTag * new_tag = context->current_tag;
-#if OPT1
-    HTMLElement e = new_tag - context->dtd->tags;
+    HTMLElement e = TAGNUM_OF_TAGP(new_tag);
     BOOL ok = FALSE;
-#endif
 
 #ifdef EXTENDED_HTMLDTD
 
@@ -1194,16 +1227,6 @@ PRIVATE void start_element ARGS1(
 	    /*
 	    **	Ugh, it is not an OPTION. - FM
 	    */
-#if !OPT1
-	    if (!strcasecomp(new_tag->name, "INPUT") ||
-		!strcasecomp(new_tag->name, "TEXTAREA") ||
-		!strcasecomp(new_tag->name, "SELECT") ||
-		!strcasecomp(new_tag->name, "BUTTON") ||
-		!strcasecomp(new_tag->name, "FIELDSET") ||
-		!strcasecomp(new_tag->name, "LABEL") ||
-		!strcasecomp(new_tag->name, "LEGEND") ||
-		!strcasecomp(new_tag->name, "FORM"))
-#else
 	    switch (e) {
 		case HTML_INPUT:  case HTML_TEXTAREA: case HTML_SELECT:
 		case HTML_BUTTON: case HTML_FIELDSET: case HTML_LABEL:
@@ -1214,7 +1237,6 @@ PRIVATE void start_element ARGS1(
 		    break;
 	    }
 	    if (ok)
-#endif
 	    {
 		/*
 		**  It is another form-related start tag, so terminate
@@ -1239,13 +1261,13 @@ PRIVATE void start_element ARGS1(
     CTRACE((tfp, "SGML: Start <%s>\n", new_tag->name));
     status = (*context->actions->start_element)(
 	context->target,
-	new_tag - context->dtd->tags,
+	TAGNUM_OF_TAGP(new_tag),
 	context->present,
 	(CONST char**) context->value,	/* coerce type for think c */
 	context->current_tag_charset,
 	(char **)&context->include);
     if (status == HT_PARSER_OTHER_CONTENT)
-	new_tag = &HTTag_mixedObject;	/* this is only returned for OBJECT */
+	new_tag = ALT_TAGP(new_tag);	/* this is only returned for OBJECT */
     if (new_tag->contents != SGML_EMPTY) {		/* i.e., tag not empty */
 	HTElement * N = (HTElement *)malloc(sizeof(HTElement));
 	if (N == NULL)
@@ -1253,11 +1275,9 @@ PRIVATE void start_element ARGS1(
 	N->next = context->element_stack;
 	N->tag = new_tag;
 	context->element_stack = N;
-#if OPT
+	context->no_lynx_specialcodes = (new_tag->flags & Tgf_nolyspcl);
+
     } else if (e == HTML_META ) {
-#else
-    } else if (!strcasecomp(new_tag->name, "META")) {
-#endif
 	/*
 	**  Check for result of META tag. - KW & FM
 	*/
@@ -1338,8 +1358,7 @@ PRIVATE void SGML_free ARGS1(
 	if (!psrc_view) /* Don't actually call on target if viewing psrc - kw */
 #endif
 	    (*context->actions->end_element)(context->target,
-		    (t == &HTTag_mixedObject) ?
-				HTML_OBJECT : t - context->dtd->tags,
+		    NORMAL_TAGNUM(TAGNUM_OF_TAGP(t)),
 		    (char **)&context->include);
 	FREE(context->include);
     }
@@ -1729,9 +1748,16 @@ top1:
 	break;
 
     case S_tagname_slash:
-	if (!(c == '>' && context->slashtag && TOASCII(unsign_c) < 127)) {
+	/*
+	 *  We had something link "<name/" so far, set state to S_text
+	 *  but keep context->slashedtag as as a flag; except if we get
+	 *  '>' directly after the "<name/", and really have a tag for
+	 *  that name in context->slashedtag, in which case keep state as
+	 *  is and let code below deal with it. - kw
+	 */
+	if (!(c == '>' && context->slashedtag && TOASCII(unsign_c) < 127)) {
 	    context->state = S_text;
-	}
+	} /* fall through in any case! */
 
     case S_text:
 	if (HTCJK != NOCJK && (TOASCII(c) & 0200) != 0) {  /* S/390 -- gil -- 0864 */
@@ -1794,13 +1820,16 @@ top1:
 		context->state = S_litteral;
 	    else
 		context->state = S_tag;
-	    context->slashtag = NULL;
-	} else if (context->slashtag &&
+	    context->slashedtag = NULL;
+	} else if (context->slashedtag &&
 		   (c == '/' ||
 		    (c == '>' && context->state == S_tagname_slash)) &&
 		   TOASCII(unsign_c) < 127) {
 	    /*
-	    **	Pending tag close from shortref tag. - kw
+	    **	We got either the second slash of a pending "<NAME/blah blah/"
+	    **  shortref construct, or the '>' of a mere "<NAME/>".  In both
+	    **  cases generate a "</NAME>" end tag in the recover buffer for
+	    **  reparsing unless NAME is really an empty element. - kw
 	    */
 #ifdef USE_PSRC
 	    if (psrc_view) {
@@ -1809,18 +1838,18 @@ top1:
 		PSRCSTOP(abracket);
 	    } else
 #endif
-	    if (context->slashtag != context->unknown_tag &&
-		!ReallyEmptyTag(context->slashtag)) {
+	    if (context->slashedtag != context->unknown_tag &&
+		!ReallyEmptyTag(context->slashedtag)) {
 		if (context->recover == NULL) {
 		    StrAllocCopy(context->recover, "</");
 		    context->recover_index = 0;
 		} else {
 		    StrAllocCat(context->recover, "</");
 		}
-		StrAllocCat(context->recover, context->slashtag->name);
+		StrAllocCat(context->recover, context->slashedtag->name);
 		StrAllocCat(context->recover, ">");
 	    }
-	    context->slashtag = NULL;
+	    context->slashedtag = NULL;
 
 	} else if (context->element_stack &&
 		   (context->element_stack->tag->flags & Tgf_frecyc)) {
@@ -1862,6 +1891,7 @@ top1:
 	**  neither HTPassHighCtrlRaw nor HTCJK is set. - FM
 	*/
 	} else if (unsign_c == CH_NBSP &&  /* S/390 -- gil -- 0932 */
+		   !context->no_lynx_specialcodes &&
 		   !(PASS8859SPECL || HTCJK != NOCJK)) {
 	    PUTC(HT_NON_BREAK_SPACE);
 	/*
@@ -1869,6 +1899,7 @@ top1:
 	**  neither HTPassHighCtrlRaw nor HTCJK is set. - FM
 	*/
 	} else if (unsign_c == CH_SHY &&  /* S/390 -- gil -- 0949 */
+		   !context->no_lynx_specialcodes &&
 		   !(PASS8859SPECL || HTCJK != NOCJK)) {
 	    PUTC(LY_SOFT_HYPHEN);
 	/*
@@ -2051,21 +2082,35 @@ top1:
 
     /*
     **	Found '<' in SGML_PCDATA content; treat this mode nearly like
-    **  S_litteral, but recognize '<!' to filter out comments etc. - kw
+    **  S_litteral, but recognize '<!' and '<?' to filter out comments
+    **  and processing instructions. - kw
     */
     case S_pcdata:
-	if (c == '!' && !string->size) { /* <! */
-	    /*
-	    **	Terminate and set up for possible comment,
-	    **	identifier, declaration, or marked section
-	    **  as under S_tag. - kw
-	    */
-	    context->state = S_exclamation;
-	    context->lead_exclamation = TRUE;
-	    context->doctype_bracket = FALSE;
-	    context->first_bracket = FALSE;
-	    HTChunkPutc(string, c);
-	    break;
+	if (!string->size && TOASCII(unsign_c) < 127) { /* first after '<' */
+	    if (c == '!') { /* <! */
+		/*
+		**	Terminate and set up for possible comment,
+		**	identifier, declaration, or marked section
+		**  as under S_tag. - kw
+		*/
+		context->state = S_exclamation;
+		context->lead_exclamation = TRUE;
+		context->doctype_bracket = FALSE;
+		context->first_bracket = FALSE;
+		HTChunkPutc(string, c);
+		break;
+	    } else if (c == '?') { /* <? - ignore as a PI until '>' - kw */
+		CTRACE((tfp,
+			"SGML: Found PI in PCDATA, junking it until '>'\n"));
+#ifdef USE_PSRC
+		if (psrc_view) {
+		    PSRCSTART(abracket);PUTS("<?");PSRCSTOP(abracket);
+		    context->seen_nonwhite_in_junk_tag = TRUE; /* show all */
+		}
+#endif
+		context->state = S_junk_pi;
+		break;
+	    }
 	}
 	/* Fall through to S_litteral - kw */
 
@@ -2172,7 +2217,10 @@ top1:
     */
     case S_entity:
 	if (TOASCII(unsign_c) < 127 && (string->size ?	/* S/390 -- gil -- 1029 */
-		  IsNmChar(c) : isalpha((unsigned char)c))) {
+		  isalnum((unsigned char)c) : isalpha((unsigned char)c))) {
+	    /* Should probably use IsNmStart/IsNmChar above (is that right?),
+	       but the world is not ready for that - there's &nbsp: (note
+	       colon!) and stuff around. */
 	    /*
 	    **	Accept valid ASCII character. - FM
 	    */
@@ -2900,13 +2948,24 @@ top1:
 	    if (c == '/' && t) {
 		/*
 		 *  Element name was ended by '/'.  Remember the tag that
-		 *  ended thusly, we'll interpret as either an indication
+		 *  ended thusly, we'll interpret this as either an indication
 		 *  of an empty element (if '>' follows directly) or do
 		 *  some SGMLshortref-ish treatment. - kw
 		 */
-		context->slashtag = t;
+		context->slashedtag = t;
 	    }
 	    if (!t) {
+		if (c == '?' && string->size <= 1) {
+		    CTRACE((tfp, "SGML: Found PI, junking it until '>'\n"));
+#ifdef USE_PSRC
+		    if (psrc_view) {
+			PSRCSTART(abracket);PUTS("<?");PSRCSTOP(abracket);
+			context->seen_nonwhite_in_junk_tag = TRUE; /*show all*/
+		    }
+#endif
+		    context->state = S_junk_pi;
+		    break;
+		}
 		CTRACE((tfp, "SGML: *** Invalid element %s\n",
 			    string->data));
 
@@ -2921,10 +2980,11 @@ top1:
 			    LYUpperCase(string->data);
 		    }
 		    PUTS(string->data);
-
 		    if (c == '>' ) {
 			PSRCSTOP(badtag);
 			PSRCSTART(abracket);PUTC('>');PSRCSTOP(abracket);
+		    } else {
+			PUTC(c);
 		    }
 		}
 #endif
@@ -2941,9 +3001,6 @@ top1:
 	    }
 	    context->current_tag = t;
 
-	    /*
-	    **	Clear out attributes.
-	    */
 #ifdef USE_PSRC
 	    if (psrc_view) {
 		PSRCSTART(abracket);PUTC('<');PSRCSTOP(abracket);
@@ -2958,29 +3015,26 @@ top1:
 			LYUpperCase(string->data);
 		}
 		PUTS(string->data);
+		if (t != context->unknown_tag)
+		    PSRCSTOP(tag);
+		else
+		    PSRCSTOP(badtag);
 	    }
 	    if (!psrc_view) /*don't waste time */
 #endif
 	    {
-#if !OPT1
-		int i;
-		for (i = 0; i < context->current_tag->number_of_attributes; i++)
-		    context->present[i] = NO;
-#else
+	    /*
+	    **	Clear out attributes.
+	    */
 		memset( (void*)context->present, 0 , sizeof(BOOL)*
 				context->current_tag->number_of_attributes);
-#endif
 	    }
 
 	    string->size = 0;
 	    context->current_attribute_number = INVALID;
 #ifdef USE_PSRC
 	    if (psrc_view) {
-		if (c == '>' || c == '<' || (c == '/' && context->slashtag)) {
-		    if (t != context->unknown_tag)
-			PSRCSTOP(tag);
-		    else
-			PSRCSTOP(badtag);
+		if (c == '>' || c == '<' || (c == '/' && context->slashedtag)) {
 		    if (c != '<') {
 			PSRCSTART(abracket);
 			PUTC(c);
@@ -2995,7 +3049,7 @@ top1:
 		}
 	    } else
 #endif
-	    if (c == '>' || c == '<' || (c == '/' && context->slashtag)) {
+	    if (c == '>' || c == '<' || (c == '/' && context->slashedtag)) {
 		if (context->current_tag->name)
 		    start_element(context);
 		context->state = (c == '>') ? S_text :
@@ -3363,10 +3417,6 @@ top1:
 		start_element(context);
 #ifdef USE_PSRC
 	    if (psrc_view) {
-		if (context->current_tag != context->unknown_tag)
-		    PSRCSTOP(tag);
-		else
-		    PSRCSTOP(badtag);
 		PSRCSTART(abracket);
 		PUTC('>');
 		PSRCSTOP(abracket);
@@ -3408,18 +3458,12 @@ top1:
 			LYUpperCase(string->data);
 		}
 		PUTS(string->data);
-		if (c == '=' || c == '>') {
-		    if (c == '=' ) PUTC('=');
-		    if (context->current_attribute_number == INVALID)
-			PSRCSTOP(badattr);
-		    else
-			PSRCSTOP(attrib);
-		}
+		if (c == '=' ) PUTC('=');
+		if (context->current_attribute_number == INVALID)
+		    PSRCSTOP(badattr);
+		else
+		    PSRCSTOP(attrib);
 		if (c == '>') {
-		    if (context->current_tag != context->unknown_tag)
-			PSRCSTOP(tag);
-		    else
-			PSRCSTOP(badtag);
 		    PSRCSTART(abracket);
 		    PUTC('>');
 		    PSRCSTOP(abracket);
@@ -3445,10 +3489,6 @@ top1:
 		    PSRCSTOP(badattr);
 		else
 		    PSRCSTOP(attrib);
-		if (context->current_tag != context->unknown_tag)
-		    PSRCSTOP(tag);
-		else
-		    PSRCSTOP(badtag);
 		PSRCSTART(abracket);
 		PUTC('>');
 		PSRCSTOP(abracket);
@@ -3489,10 +3529,6 @@ top1:
 	    CTRACE((tfp, "SGML: found = but no value\n"));
 #ifdef USE_PSRC
 	    if (psrc_view) {
-		if (context->current_tag != context->unknown_tag)
-		    PSRCSTOP(tag);
-		else
-		    PSRCSTOP(badtag);
 		PSRCSTART(abracket);
 		PUTC('>');
 		PSRCSTOP(abracket);
@@ -3573,10 +3609,6 @@ top1:
 	    if (c == '>') {		/* End of tag */
 #ifdef USE_PSRC
 		if (psrc_view) {
-		    if (context->current_tag != context->unknown_tag)
-			PSRCSTOP(tag);
-		    else
-			PSRCSTOP(badtag);
 		    PSRCSTART(abracket);
 		    PUTC('>');
 		    PSRCSTOP(abracket);
@@ -3773,8 +3805,13 @@ top1:
 			else
 			    LYUpperCase(string->data);
 		    }
-		    PUTS(string->data); PSRCSTOP(badtag);
-		    PSRCSTART(abracket); PUTC('>'); PSRCSTOP(abracket);
+		    PUTS(string->data);
+		    if (c != '>') {
+			PUTC(c);
+		    } else {
+			PSRCSTOP(badtag);
+			PSRCSTART(abracket); PUTC('>'); PSRCSTOP(abracket);
+		    }
 		    psrc_tagname_processed=TRUE;
 		}
 	    } else if (psrc_view) {
@@ -3782,14 +3819,14 @@ top1:
 	    } else {
 		BOOL tag_OK = (BOOL) (c == '>' || WHITE(c));
 #if OPT
-		HTMLElement e = t - context->dtd->tags;
+		HTMLElement e = TAGNUM_OF_TAGP(t);
 		int branch = 2; /* it can be 0,1,2*/
 #endif
 		context->current_tag = t;
-		if (t - context->dtd->tags == HTML_OBJECT &&
+		if (HAS_ALT_TAGNUM(TAGNUM_OF_TAGP(t)) &&
 		    context->element_stack &&
-		    context->element_stack->tag == &HTTag_mixedObject)
-		    context->element_stack->tag = t;
+		    ALT_TAGP(t) == context->element_stack->tag)
+		    context->element_stack->tag = NORMAL_TAGP(context->element_stack->tag);
 #if OPT
 		if (tag_OK
 #ifdef EXTENDED_HTMLDTD
@@ -3808,6 +3845,8 @@ top1:
 		     case HTML_P:  case HTML_STRONG: case HTML_TT: case HTML_U:
 			branch = 1;
 			break;
+		    default:
+			break;
 		    }
 		}
 #endif
@@ -3904,7 +3943,7 @@ top1:
 #endif
 			    (*context->actions->end_element)
 				(context->target,
-				 (context->current_tag - context->dtd->tags),
+				 TAGNUM_OF_TAGP(context->current_tag),
 				 (char **)&context->include);
 			}
 		    } else if (!strcasecomp(string->data, "P")) {
@@ -3932,7 +3971,7 @@ top1:
 #endif
 			(*context->actions->end_element)
 			    (context->target,
-			     (context->current_tag - context->dtd->tags),
+			     TAGNUM_OF_TAGP(context->current_tag),
 			     (char **)&context->include);
 		    }
 		    string->size = 0;
@@ -3966,9 +4005,10 @@ top1:
 			LYUpperCase(string->data);
 		}
 		PUTS(string->data); PSRCSTOP(tag);
-		if ( c != '>' )
+		if ( c != '>' ) {
 		    PSRCSTART(badtag);
-		else {
+		    PUTC(c);
+		} else {
 		    PSRCSTART(abracket);
 		    PUTC('>');
 		    PSRCSTOP(abracket);
@@ -4132,10 +4172,13 @@ top1:
 	break;
 
     case S_junk_tag:
+    case S_junk_pi:
 	if (c == '>') {
 #ifdef USE_PSRC
 	    if (psrc_view) {
-		PSRCSTOP(badtag);
+		if (context->state == S_junk_tag) {
+		    PSRCSTOP(badtag);
+		}
 		PSRCSTART(abracket);
 		PUTC('>');
 		PSRCSTOP(abracket);
@@ -4315,10 +4358,12 @@ PUBLIC HTStream* SGML_new  ARGS3(
     context->actions = (CONST HTStructuredClass*)(((HTStream*)target)->isa);
 					/* Ugh: no OO */
     context->unknown_tag = &HTTag_unrecognized;
-    context->current_tag = context->slashtag = NULL;
+/*    context->extra_tags = dtd->tags + dtd->number_of_tags; */
+    context->current_tag = context->slashedtag = NULL;
     context->state = S_text;
     context->element_stack = 0;			/* empty */
     context->inSELECT = FALSE;
+    context->no_lynx_specialcodes = NO;	/* special codes normally generated */
 #ifdef CALLERDATA
     context->callerData = (void*) callerData;
 #endif /* CALLERDATA */
diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h
index 85278f44..b15cec36 100644
--- a/WWW/Library/Implementation/SGML.h
+++ b/WWW/Library/Implementation/SGML.h
@@ -104,6 +104,9 @@ typedef int TagFlags;
 				   allows recycling, i.e. don't translate to
 				   output (display) character set yet (treat
 				   content similar to attribute values) */
+#define Tgf_nolyspcl	0x00040 /* Don't generate lynx special characters
+				   for soft hyphen and various spaces (nbsp,
+				   ensp,..) */
 
 /*		A tag structure describes an SGML element.
 **		-----------------------------------------
diff --git a/WWW/Library/djgpp/makefile b/WWW/Library/djgpp/makefile
index b91e2c52..ec874bfc 100644
--- a/WWW/Library/djgpp/makefile
+++ b/WWW/Library/djgpp/makefile
@@ -7,16 +7,18 @@ WWW_MACH = djgpp
 # The ASIS repository's name for the machine we are on
 #ASIS_MACH = hardware/os
 
-CFLAGS = -O3 -DUSE_ZLIB -DDOSPATH -DNOUSERS -DDISP_PARTIAL \
--DSOURCE_CACHE -DUSE_PSRC -DNOPORT \
+CFLAGS = -O2 -DUSE_ZLIB -DDOSPATH -DNOUSERS -DDISP_PARTIAL \
+-DDIRED_SUPPORT -DSOURCE_CACHE -DUSE_PSRC \
+-DEXP_FILE_UPLOAD \
+-DWATT32 \
 -I../Implementation \
--I../../../djgpp/tcplib/include \
--I../../../djgpp/tcplib/include/tcp \
--I../../../curses \
+-I../../../djgpp/watt32/inc -I../../../djgpp/watt32/inc/sys \
 -I../../../src \
--I../../..
+-I../../../curses \
+-I../../.. $(INTLFLAGS)
 LFLAGS =
 CC = gcc
+#INTLFLAGS = -DHAVE_GETTEXT -DHAVE_LIBINTL_H
 
 # Directory for installed binary:
 !BINDIR = /usr/local/bin
diff --git a/aclocal.m4 b/aclocal.m4
index 9144f671..0bcb0d10 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -859,7 +859,7 @@ dnl
 AC_DEFUN([CF_DISABLE_ECHO],[
 AC_MSG_CHECKING(if you want to see long compiling messages)
 CF_ARG_DISABLE(echo,
-	[  --disable-echo          test: display "compiling" commands],
+	[  --disable-echo          display "compiling" commands],
 	[
     ECHO_LD='@echo linking [$]@;'
     RULE_CC='	@echo compiling [$]<'
@@ -1106,7 +1106,7 @@ cat > conftest.i <<EOF
 EOF
 if test -n "$GCC"
 then
-	AC_CHECKING([for gcc __attribute__ directives])
+	AC_CHECKING([for $CC __attribute__ directives])
 	changequote(,)dnl
 cat > conftest.$ac_ext <<EOF
 #line __oline__ "configure"
@@ -1133,7 +1133,7 @@ EOF
 	do
 		CF_UPPER(CF_ATTRIBUTE,$cf_attribute)
 		cf_directive="__attribute__(($cf_attribute))"
-		echo "checking for gcc $cf_directive" 1>&AC_FD_CC
+		echo "checking for $CC $cf_directive" 1>&AC_FD_CC
 		case $cf_attribute in
 		scanf|printf)
 		cat >conftest.h <<EOF
@@ -1179,7 +1179,7 @@ then
 int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
 EOF
 	changequote([,])dnl
-	AC_CHECKING([for gcc warning options])
+	AC_CHECKING([for $CC warning options])
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS="-W -Wall"
 	cf_warn_CONST=""
@@ -1209,6 +1209,34 @@ fi
 AC_SUBST(EXTRA_CFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl Check if we must define _GNU_SOURCE to get a reasonable value for
+dnl _XOPEN_SOURCE, upon which many POSIX definitions depend.  This is a defect
+dnl (or misfeature) of glibc2, which breaks portability of many applications,
+dnl since it is interwoven with GNU extensions.
+dnl
+dnl Well, yes we could work around it...
+AC_DEFUN([CF_GNU_SOURCE],
+[
+AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
+AC_TRY_COMPILE([#include <sys/types.h>],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_cv_gnu_source=no],
+	[cf_save="$CFLAGS"
+	 CFLAGS="$CFLAGS -D_GNU_SOURCE"
+	 AC_TRY_COMPILE([#include <sys/types.h>],[
+#ifdef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_cv_gnu_source=no],
+	[cf_cv_gnu_source=yes])
+	CFLAGS="$cf_save"
+	])
+])
+test "$cf_cv_gnu_source" = yes && CFLAGS="$CFLAGS -D_GNU_SOURCE"
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl Construct a search-list for a nonstandard header-file
 AC_DEFUN([CF_HEADER_PATH],
 [$1=""
@@ -1991,6 +2019,9 @@ if test "$1" = ncurses; then
 	cf_cv_termlib=terminfo
 fi
 ])
+if test "$cf_cv_termlib" = none; then
+	AC_CHECK_LIB(curses, tgetstr, [LIBS="$LIBS -lcurses" cf_cv_termlib=terminfo])
+fi
 # HP-UX 9.x terminfo has setupterm, but no tigetstr.
 if test "$cf_cv_termlib" = none; then
 	AC_CHECK_LIB(termlib, tigetstr, [LIBS="$LIBS -ltermlib" cf_cv_termlib=terminfo])
diff --git a/config.hin b/config.hin
index 86fe5561..f6538b7d 100644
--- a/config.hin
+++ b/config.hin
@@ -112,6 +112,7 @@
 #undef HAVE_UTMP
 #undef HAVE_VALUES_H		/* defined by AM_GNU_GETTEXT */
 #undef HAVE_VARARGS_H		/* CF_VARARGS */
+#undef HAVE_VASPRINTF
 #undef HAVE_WAITPID
 #undef HAVE_WBORDER
 #undef HAVE___ARGZ_COUNT	/* defined by AM_GNU_GETTEXT */
diff --git a/configure b/configure
index 01b2b5ae..3093902e 100755
--- a/configure
+++ b/configure
@@ -185,7 +185,7 @@ EOF
 cat <<EOF
 --enable and --with options recognized:
 Development Options:
-  --disable-echo          test: display "compiling" commands
+  --disable-echo          display "compiling" commands
   --enable-find-leaks     logic for testing memory leaks
   --enable-debug          logic for object code debugging
   --disable-trace         disable logic for trace code
@@ -1392,8 +1392,8 @@ cat > conftest.i <<EOF
 EOF
 if test -n "$GCC"
 then
-	echo "checking for gcc __attribute__ directives" 1>&6
-echo "configure:1397: checking for gcc __attribute__ directives" >&5
+	echo "checking for $CC __attribute__ directives" 1>&6
+echo "configure:1397: checking for $CC __attribute__ directives" >&5
 	cat > conftest.$ac_ext <<EOF
 #line 1399 "configure"
 #include "confdefs.h"
@@ -1420,7 +1420,7 @@ EOF
 CF_ATTRIBUTE=`echo $cf_attribute | tr '[a-z]' '[A-Z]'`
 
 		cf_directive="__attribute__(($cf_attribute))"
-		echo "checking for gcc $cf_directive" 1>&5
+		echo "checking for $CC $cf_directive" 1>&5
 		case $cf_attribute in
 		scanf|printf)
 		cat >conftest.h <<EOF
@@ -1453,8 +1453,8 @@ then
 #line 1454 "configure"
 int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
 EOF
-		echo "checking for gcc warning options" 1>&6
-echo "configure:1458: checking for gcc warning options" >&5
+		echo "checking for $CC warning options" 1>&6
+echo "configure:1458: checking for $CC warning options" >&5
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS="-W -Wall"
 	cf_warn_CONST=""
@@ -5507,20 +5507,79 @@ done
 esac
 
 
+
+echo $ac_n "checking if we must define _GNU_SOURCE""... $ac_c" 1>&6
+echo "configure:5513: checking if we must define _GNU_SOURCE" >&5
+if eval "test \"`echo '$''{'cf_cv_gnu_source'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+cat > conftest.$ac_ext <<EOF
+#line 5519 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int main() {
+
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:5529: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cf_cv_gnu_source=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cf_save="$CFLAGS"
+	 CFLAGS="$CFLAGS -D_GNU_SOURCE"
+	 cat > conftest.$ac_ext <<EOF
+#line 5539 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int main() {
+
+#ifdef _XOPEN_SOURCE
+make an error
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:5549: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cf_cv_gnu_source=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cf_cv_gnu_source=yes
+fi
+rm -f conftest*
+	CFLAGS="$cf_save"
+	
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$cf_cv_gnu_source" 1>&6
+test "$cf_cv_gnu_source" = yes && CFLAGS="$CFLAGS -D_GNU_SOURCE"
+
+
 if test -n "$TRY_CFLAGS" ; then
 	cf_save_CFLAGS="$CFLAGS"
 	CFLAGS="$CFLAGS $TRY_CFLAGS"
 	echo $ac_n "checking if we should use compile options $TRY_CFLAGS""... $ac_c" 1>&6
-echo "configure:5515: checking if we should use compile options $TRY_CFLAGS" >&5
+echo "configure:5574: checking if we should use compile options $TRY_CFLAGS" >&5
 	cat > conftest.$ac_ext <<EOF
-#line 5517 "configure"
+#line 5576 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 FILE *fp = stdin
 ; return 0; }
 EOF
-if { (eval echo configure:5524: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -5538,7 +5597,7 @@ fi
 ### Look for network libraries first, since some functions (such as gethostname)
 ### are used in a lot of places.
 echo $ac_n "checking if you want socks library""... $ac_c" 1>&6
-echo "configure:5542: checking if you want socks library" >&5
+echo "configure:5601: checking if you want socks library" >&5
 if eval "test \"`echo '$''{'cf_cv_use_libsocks'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5558,7 +5617,7 @@ fi
 echo "$ac_t""$cf_cv_use_libsocks" 1>&6
 
 echo $ac_n "checking if you want socks5 library""... $ac_c" 1>&6
-echo "configure:5562: checking if you want socks5 library" >&5
+echo "configure:5621: checking if you want socks5 library" >&5
 if eval "test \"`echo '$''{'cf_cv_use_libsocks5'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5624,7 +5683,7 @@ cat >> confdefs.h <<\EOF
 EOF
 
 cat > conftest.$ac_ext <<EOF
-#line 5628 "configure"
+#line 5687 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5633,7 +5692,7 @@ int main() {
 	accept((char *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:5637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -5663,9 +5722,9 @@ cat >> confdefs.h <<\EOF
 EOF
 
 echo $ac_n "checking if the socks library uses socks4 prefix""... $ac_c" 1>&6
-echo "configure:5667: checking if the socks library uses socks4 prefix" >&5
+echo "configure:5726: checking if the socks library uses socks4 prefix" >&5
 cat > conftest.$ac_ext <<EOF
-#line 5669 "configure"
+#line 5728 "configure"
 #include "confdefs.h"
 
 #include <socks.h>
@@ -5674,7 +5733,7 @@ int main() {
 	Rinit((char *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:5678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define USE_SOCKS4_PREFIX 1
@@ -5686,14 +5745,14 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 5690 "configure"
+#line 5749 "configure"
 #include "confdefs.h"
 #include <socks.h>
 int main() {
 SOCKSinit((char *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:5697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_use_socks4=no
 else
@@ -5762,7 +5821,7 @@ else
 	
 cf_test_netlibs=no
 echo $ac_n "checking for network libraries""... $ac_c" 1>&6
-echo "configure:5766: checking for network libraries" >&5
+echo "configure:5825: checking for network libraries" >&5
 if eval "test \"`echo '$''{'cf_cv_netlibs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5773,12 +5832,12 @@ cf_test_netlibs=yes
 for ac_func in gethostname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5777: checking for $ac_func" >&5
+echo "configure:5836: 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 5782 "configure"
+#line 5841 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5801,7 +5860,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5824,7 +5883,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6
-echo "configure:5828: checking for gethostname in -lnsl" >&5
+echo "configure:5887: 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
@@ -5832,7 +5891,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5836 "configure"
+#line 5895 "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
@@ -5843,7 +5902,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:5847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5876,7 +5935,7 @@ else
 	
 		
 echo $ac_n "checking for gethostname in -lsocket""... $ac_c" 1>&6
-echo "configure:5880: checking for gethostname in -lsocket" >&5
+echo "configure:5939: 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
@@ -5884,7 +5943,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5888 "configure"
+#line 5947 "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
@@ -5895,7 +5954,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:5899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5939,21 +5998,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:5943: checking for -linet" >&5
+echo "configure:6002: 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 5950 "configure"
+#line 6009 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_lib_inet=yes
 else
@@ -5976,12 +6035,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:5980: checking for $ac_func" >&5
+echo "configure:6039: 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 5985 "configure"
+#line 6044 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6004,7 +6063,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6027,7 +6086,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:6031: checking for socket in -lsocket" >&5
+echo "configure:6090: 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
@@ -6035,7 +6094,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6039 "configure"
+#line 6098 "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
@@ -6046,7 +6105,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:6050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6079,7 +6138,7 @@ else
 	
 		
 echo $ac_n "checking for socket in -lbsd""... $ac_c" 1>&6
-echo "configure:6083: checking for socket in -lbsd" >&5
+echo "configure:6142: 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
@@ -6087,7 +6146,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6091 "configure"
+#line 6150 "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
@@ -6098,7 +6157,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:6102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6143,12 +6202,12 @@ fi
 for ac_func in gethostbyname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6147: checking for $ac_func" >&5
+echo "configure:6206: 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 6152 "configure"
+#line 6211 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6171,7 +6230,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6194,7 +6253,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:6198: checking for gethostbyname in -lnsl" >&5
+echo "configure:6257: 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
@@ -6202,7 +6261,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6206 "configure"
+#line 6265 "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
@@ -6213,7 +6272,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:6217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6254,12 +6313,12 @@ done
 for ac_func in strcasecmp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6258: checking for $ac_func" >&5
+echo "configure:6317: 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 6263 "configure"
+#line 6322 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6282,7 +6341,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6305,7 +6364,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for strcasecmp in -lresolv""... $ac_c" 1>&6
-echo "configure:6309: checking for strcasecmp in -lresolv" >&5
+echo "configure:6368: 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
@@ -6313,7 +6372,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6317 "configure"
+#line 6376 "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
@@ -6324,7 +6383,7 @@ int main() {
 strcasecmp()
 ; return 0; }
 EOF
-if { (eval echo configure:6328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6370,13 +6429,13 @@ test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&6
 fi
 
 echo $ac_n "checking for inet_aton function""... $ac_c" 1>&6
-echo "configure:6374: checking for inet_aton function" >&5
+echo "configure:6433: checking for inet_aton function" >&5
 if eval "test \"`echo '$''{'cf_cv_have_inet_aton'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 6380 "configure"
+#line 6439 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -6387,7 +6446,7 @@ int main() {
 inet_aton(0, (struct in_addr *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:6391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_have_inet_aton=yes
 else
@@ -6407,13 +6466,13 @@ EOF
 
 else
     echo $ac_n "checking for inet_addr function""... $ac_c" 1>&6
-echo "configure:6411: checking for inet_addr function" >&5
+echo "configure:6470: checking for inet_addr function" >&5
 if eval "test \"`echo '$''{'cf_cv_have_inet_addr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 6417 "configure"
+#line 6476 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -6424,7 +6483,7 @@ int main() {
 inet_addr(0)
 ; return 0; }
 EOF
-if { (eval echo configure:6428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_have_inet_addr=yes
 else
@@ -6439,7 +6498,7 @@ fi
 echo "$ac_t""$cf_cv_have_inet_addr" 1>&6
     if test "$cf_cv_have_inet_addr" = no ; then
 	echo $ac_n "checking for library with inet_addr""... $ac_c" 1>&6
-echo "configure:6443: checking for library with inet_addr" >&5
+echo "configure:6502: checking for library with inet_addr" >&5
 if eval "test \"`echo '$''{'cf_cv_lib_inet_addr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6449,7 +6508,7 @@ else
 	    do
 		LIBS="$cf_save_LIBS $cf_inetlib"
 		cat > conftest.$ac_ext <<EOF
-#line 6453 "configure"
+#line 6512 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -6460,7 +6519,7 @@ int main() {
 inet_addr(0)
 ; return 0; }
 EOF
-if { (eval echo configure:6464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_lib_inet_addr=$cf_inetlib
 else
@@ -6487,7 +6546,7 @@ fi
 
 
 echo $ac_n "checking for screen type""... $ac_c" 1>&6
-echo "configure:6491: checking for screen type" >&5
+echo "configure:6550: checking for screen type" >&5
 if eval "test \"`echo '$''{'cf_cv_screen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6522,12 +6581,12 @@ case $cf_cv_screen in
 curses)
 	
 echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:6526: checking for initscr" >&5
+echo "configure:6585: 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 6531 "configure"
+#line 6590 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -6550,7 +6609,7 @@ initscr();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -6571,7 +6630,7 @@ else
 case $host_os in #(vi
 freebsd*) #(vi
 	echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
-echo "configure:6575: checking for tgoto in -lmytinfo" >&5
+echo "configure:6634: 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
@@ -6579,7 +6638,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmytinfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6583 "configure"
+#line 6642 "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
@@ -6590,7 +6649,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:6594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6613,7 +6672,7 @@ fi
 	;;
 hpux10.*)
 	echo $ac_n "checking for initscr in -lcur_colr""... $ac_c" 1>&6
-echo "configure:6617: checking for initscr in -lcur_colr" >&5
+echo "configure:6676: checking for initscr in -lcur_colr" >&5
 ac_lib_var=`echo cur_colr'_'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
@@ -6621,7 +6680,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcur_colr  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6625 "configure"
+#line 6684 "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
@@ -6632,7 +6691,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:6636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6656,7 +6715,7 @@ else
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for initscr in -lHcurses""... $ac_c" 1>&6
-echo "configure:6660: checking for initscr in -lHcurses" >&5
+echo "configure:6719: 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
@@ -6664,7 +6723,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lHcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6668 "configure"
+#line 6727 "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
@@ -6675,7 +6734,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:6679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6724,12 +6783,12 @@ if test ".$ac_cv_func_initscr" != .yes ; then
 	# Check for library containing tgoto.  Do this before curses library
 	# because it may be needed to link the test-case for initscr.
 	echo $ac_n "checking for tgoto""... $ac_c" 1>&6
-echo "configure:6728: checking for tgoto" >&5
+echo "configure:6787: 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 6733 "configure"
+#line 6792 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char tgoto(); below.  */
@@ -6752,7 +6811,7 @@ tgoto();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_tgoto=yes"
 else
@@ -6773,7 +6832,7 @@ else
 		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:6777: checking for tgoto in -l$cf_term_lib" >&5
+echo "configure:6836: 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
@@ -6781,7 +6840,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l$cf_term_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6785 "configure"
+#line 6844 "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
@@ -6792,7 +6851,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:6796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6822,7 +6881,7 @@ fi
 	for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown
 	do
 		echo $ac_n "checking for initscr in -l$cf_curs_lib""... $ac_c" 1>&6
-echo "configure:6826: checking for initscr in -l$cf_curs_lib" >&5
+echo "configure:6885: 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
@@ -6830,7 +6889,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l$cf_curs_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6834 "configure"
+#line 6893 "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
@@ -6841,7 +6900,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:6845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6867,16 +6926,16 @@ fi
 	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:6871: checking if we can link with $cf_curs_lib library" >&5
+echo "configure:6930: checking if we can link with $cf_curs_lib library" >&5
 		cat > conftest.$ac_ext <<EOF
-#line 6873 "configure"
+#line 6932 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:6880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -6890,16 +6949,16 @@ rm -f conftest*
 		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:6894: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5
+echo "configure:6953: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5
 		cat > conftest.$ac_ext <<EOF
-#line 6896 "configure"
+#line 6955 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr(); tgoto((char *)0, 0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:6903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=no
 else
@@ -6909,14 +6968,14 @@ else
   
 			LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
 			cat > conftest.$ac_ext <<EOF
-#line 6913 "configure"
+#line 6972 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:6920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -6938,14 +6997,14 @@ fi
 
 	
 echo $ac_n "checking for curses performance tradeoff""... $ac_c" 1>&6
-echo "configure:6942: checking for curses performance tradeoff" >&5
+echo "configure:7001: 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 6949 "configure"
+#line 7008 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -6959,11 +7018,11 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6963: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 	cat > conftest.$ac_ext <<EOF
-#line 6967 "configure"
+#line 7026 "configure"
 #include "confdefs.h"
 
 #define CURS_PERFORMANCE
@@ -6978,7 +7037,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6982: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_curs_performance=yes
 else
@@ -7003,13 +7062,13 @@ EOF
 ncurses)
 	
 echo $ac_n "checking for ncurses header file""... $ac_c" 1>&6
-echo "configure:7007: checking for ncurses header file" >&5
+echo "configure:7066: 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 7013 "configure"
+#line 7072 "configure"
 #include "confdefs.h"
 #include <curses.h>
 int main() {
@@ -7026,7 +7085,7 @@ make an error
 	
 ; return 0; }
 EOF
-if { (eval echo configure:7030: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ncurses_header=predefined
 else
@@ -7113,7 +7172,7 @@ done
 	;;
 esac
 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
-echo "configure:7117: checking for ncurses version" >&5
+echo "configure:7176: 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
@@ -7138,7 +7197,7 @@ Autoconf "old"
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo configure:7142: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	{ (eval echo configure:7201: \"$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"
@@ -7147,7 +7206,7 @@ EOF
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 7151 "configure"
+#line 7210 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -7170,7 +7229,7 @@ int main()
 	exit(0);
 }
 EOF
-if { (eval echo configure:7174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -7195,7 +7254,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:7199: checking for Gpm_Open in -lgpm" >&5
+echo "configure:7258: 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
@@ -7203,7 +7262,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7207 "configure"
+#line 7266 "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
@@ -7214,7 +7273,7 @@ int main() {
 Gpm_Open()
 ; return 0; }
 EOF
-if { (eval echo configure:7218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7230,7 +7289,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:7234: checking for initscr in -lgpm" >&5
+echo "configure:7293: 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
@@ -7238,7 +7297,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7242 "configure"
+#line 7301 "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
@@ -7249,7 +7308,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:7253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7280,7 +7339,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:7284: checking for tgoto in -lmytinfo" >&5
+echo "configure:7343: 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
@@ -7288,7 +7347,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmytinfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7292 "configure"
+#line 7351 "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
@@ -7299,7 +7358,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:7303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7327,12 +7386,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:7331: checking for initscr" >&5
+echo "configure:7390: 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 7336 "configure"
+#line 7395 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -7355,7 +7414,7 @@ initscr();
 
 ; return 0; }
 EOF
-if { (eval echo configure:7359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -7375,17 +7434,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:7379: checking for initscr in -lncurses" >&5
+echo "configure:7438: checking for initscr in -lncurses" >&5
 		LIBS="-lncurses $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 7382 "configure"
+#line 7441 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:7389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 cf_cv_have_lib_ncurses=yes
@@ -7413,17 +7472,17 @@ test "$prefix" != /opt           && cf_search="$cf_search /opt/lib /opt/lib/ncur
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -lncurses in $cf_libdir""... $ac_c" 1>&6
-echo "configure:7417: checking for -lncurses in $cf_libdir" >&5
+echo "configure:7476: checking for -lncurses in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -lncurses $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 7420 "configure"
+#line 7479 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:7427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 cf_cv_have_lib_ncurses=yes
@@ -7455,7 +7514,7 @@ esac
 
 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:7459: checking if we can link ncurses without $cf_ncurses_LIBS" >&5
+echo "configure:7518: 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'$//'`
@@ -7464,14 +7523,14 @@ echo "configure:7459: checking if we can link ncurses without $cf_ncurses_LIBS"
 		fi
 	done
 	cat > conftest.$ac_ext <<EOF
-#line 7468 "configure"
+#line 7527 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:7475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -7488,20 +7547,20 @@ fi
 slang)
 	
 echo $ac_n "checking for slang header file""... $ac_c" 1>&6
-echo "configure:7492: checking for slang header file" >&5
+echo "configure:7551: 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 7498 "configure"
+#line 7557 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 printf("%s\n", SLANG_VERSION)
 ; return 0; }
 EOF
-if { (eval echo configure:7505: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7564: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_slang_header=predefined
 else
@@ -7584,24 +7643,24 @@ else
   
 cf_cv_termlib=none
 cat > conftest.$ac_ext <<EOF
-#line 7588 "configure"
+#line 7647 "configure"
 #include "confdefs.h"
 
 int main() {
 char *x=(char*)tgoto("",0,0)
 ; return 0; }
 EOF
-if { (eval echo configure:7595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 7598 "configure"
+#line 7657 "configure"
 #include "confdefs.h"
 
 int main() {
 int x=tigetstr("")
 ; return 0; }
 EOF
-if { (eval echo configure:7605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_termlib=terminfo
 else
@@ -7620,10 +7679,52 @@ else
   rm -rf conftest*
   
 
+if test "$cf_cv_termlib" = none; then
+	echo $ac_n "checking for tgetstr in -lcurses""... $ac_c" 1>&6
+echo "configure:7685: checking for tgetstr in -lcurses" >&5
+ac_lib_var=`echo curses'_'tgetstr | 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 7693 "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 tgetstr();
+
+int main() {
+tgetstr()
+; return 0; }
+EOF
+if { (eval echo configure:7704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+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
+  LIBS="$LIBS -lcurses" cf_cv_termlib=terminfo
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
 # HP-UX 9.x terminfo has setupterm, but no tigetstr.
 if test "$cf_cv_termlib" = none; then
 	echo $ac_n "checking for tigetstr in -ltermlib""... $ac_c" 1>&6
-echo "configure:7627: checking for tigetstr in -ltermlib" >&5
+echo "configure:7728: 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
@@ -7631,7 +7732,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermlib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7635 "configure"
+#line 7736 "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
@@ -7642,7 +7743,7 @@ int main() {
 tigetstr()
 ; return 0; }
 EOF
-if { (eval echo configure:7646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7665,7 +7766,7 @@ fi
 fi
 if test "$cf_cv_termlib" = none; then
 	echo $ac_n "checking for tgoto in -ltermlib""... $ac_c" 1>&6
-echo "configure:7669: checking for tgoto in -ltermlib" >&5
+echo "configure:7770: 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
@@ -7673,7 +7774,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermlib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7677 "configure"
+#line 7778 "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
@@ -7684,7 +7785,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:7688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7708,7 +7809,7 @@ fi
 if test "$cf_cv_termlib" = none; then
 	# allow curses library for broken AIX system.
 	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:7712: checking for initscr in -lcurses" >&5
+echo "configure:7813: 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
@@ -7716,7 +7817,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7720 "configure"
+#line 7821 "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
@@ -7727,7 +7828,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:7731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7748,7 +7849,7 @@ else
 fi
 
 	echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:7752: checking for tgoto in -ltermcap" >&5
+echo "configure:7853: 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
@@ -7756,7 +7857,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7760 "configure"
+#line 7861 "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
@@ -7767,7 +7868,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:7771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7790,7 +7891,7 @@ fi
 fi
 if test "$cf_cv_termlib" = none; then
 	echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:7794: checking for tgoto in -ltermcap" >&5
+echo "configure:7895: 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
@@ -7798,7 +7899,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7802 "configure"
+#line 7903 "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
@@ -7809,7 +7910,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:7813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7832,7 +7933,7 @@ fi
 fi
 if test "$cf_cv_termlib" = none; then
 	echo $ac_n "checking for tgoto in -lncurses""... $ac_c" 1>&6
-echo "configure:7836: checking for tgoto in -lncurses" >&5
+echo "configure:7937: 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
@@ -7840,7 +7941,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7844 "configure"
+#line 7945 "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
@@ -7851,7 +7952,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:7855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7883,12 +7984,12 @@ fi
 
 cf_slang_LIBS2="$LIBS"
 echo $ac_n "checking for acos""... $ac_c" 1>&6
-echo "configure:7887: checking for acos" >&5
+echo "configure:7988: 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 7892 "configure"
+#line 7993 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char acos(); below.  */
@@ -7911,7 +8012,7 @@ acos();
 
 ; return 0; }
 EOF
-if { (eval echo configure:7915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_acos=yes"
 else
@@ -7930,7 +8031,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for acos in -lm""... $ac_c" 1>&6
-echo "configure:7934: checking for acos in -lm" >&5
+echo "configure:8035: 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
@@ -7938,7 +8039,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm $LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7942 "configure"
+#line 8043 "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
@@ -7949,7 +8050,7 @@ int main() {
 acos()
 ; return 0; }
 EOF
-if { (eval echo configure:7953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7989,12 +8090,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:7993: checking for SLtt_get_screen_size" >&5
+echo "configure:8094: 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 7998 "configure"
+#line 8099 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char SLtt_get_screen_size(); below.  */
@@ -8017,7 +8118,7 @@ SLtt_get_screen_size();
 
 ; return 0; }
 EOF
-if { (eval echo configure:8021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_SLtt_get_screen_size=yes"
 else
@@ -8037,17 +8138,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for SLtt_get_screen_size in -lslang""... $ac_c" 1>&6
-echo "configure:8041: checking for SLtt_get_screen_size in -lslang" >&5
+echo "configure:8142: checking for SLtt_get_screen_size in -lslang" >&5
 		LIBS="-lslang $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 8044 "configure"
+#line 8145 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:8051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 cf_cv_have_lib_slang=yes
@@ -8075,17 +8176,17 @@ test "$prefix" != /opt           && cf_search="$cf_search /opt/lib /opt/lib/slan
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -lslang in $cf_libdir""... $ac_c" 1>&6
-echo "configure:8079: checking for -lslang in $cf_libdir" >&5
+echo "configure:8180: checking for -lslang in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -lslang $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 8082 "configure"
+#line 8183 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:8089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 cf_cv_have_lib_slang=yes
@@ -8116,7 +8217,7 @@ esac
 
 cf_slang_LIBS3="$LIBS"
 echo $ac_n "checking if we can link slang without termcap""... $ac_c" 1>&6
-echo "configure:8120: checking if we can link slang without termcap" >&5
+echo "configure:8221: 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
@@ -8124,14 +8225,14 @@ else
 fi
 LIBS=`echo ".$cf_slang_LIBS3" | sed -e "s@$cf_exclude@@" -e 's@^.@@'`
 cat > conftest.$ac_ext <<EOF
-#line 8128 "configure"
+#line 8229 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:8135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -8151,7 +8252,7 @@ eval cf_libdir=$libdir
 cf_libdir=`echo $cf_libdir | sed -e s@'^NONE/'@$prefix/@ -e s@'^NONE/'@$ac_default_prefix/@`
 
 echo $ac_n "checking for location of config-file""... $ac_c" 1>&6
-echo "configure:8155: checking for location of config-file" >&5
+echo "configure:8256: 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"
@@ -8163,7 +8264,7 @@ CHARSET_DEFS=
 
 
 echo $ac_n "checking if you want only a few charsets""... $ac_c" 1>&6
-echo "configure:8167: checking if you want only a few charsets" >&5
+echo "configure:8268: checking if you want only a few charsets" >&5
 
 # Check whether --with-charsets or --without-charsets was given.
 if test "${with_charsets+set}" = set; then
@@ -8185,7 +8286,7 @@ EOF
 		cf_charsets=minimal
 	fi
 	if test "$cf_charsets" = "minimal" ; then
-		test -n "$verbose" && echo "	using minimal list of charsets: $cf_charsets" 1>&6
+		test -n "$verbose" && echo "	using minimal list of charsets: $cf_min_charsets" 1>&6
 
 	fi
 	cf_charsets=`echo $cf_charsets | sed -e "s/minimal/$cf_min_charsets/g" -e 's/,/ /g'`
@@ -8208,12 +8309,12 @@ fi
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:8212: checking for ANSI C header files" >&5
+echo "configure:8313: 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 8217 "configure"
+#line 8318 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -8221,7 +8322,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8225: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8326: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8238,7 +8339,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 8242 "configure"
+#line 8343 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -8256,7 +8357,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 8260 "configure"
+#line 8361 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -8277,7 +8378,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 8281 "configure"
+#line 8382 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -8288,7 +8389,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:8292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -8312,12 +8413,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:8316: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:8417: 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 8321 "configure"
+#line 8422 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -8326,7 +8427,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:8330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8431: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -8351,12 +8452,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:8355: checking for $ac_hdr that defines DIR" >&5
+echo "configure:8456: 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 8360 "configure"
+#line 8461 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -8364,7 +8465,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:8368: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -8389,7 +8490,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:8393: checking for opendir in -ldir" >&5
+echo "configure:8494: 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
@@ -8397,7 +8498,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8401 "configure"
+#line 8502 "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
@@ -8408,7 +8509,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:8412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -8430,7 +8531,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:8434: checking for opendir in -lx" >&5
+echo "configure:8535: 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
@@ -8438,7 +8539,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8442 "configure"
+#line 8543 "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
@@ -8449,7 +8550,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:8453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -8489,17 +8590,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:8493: checking for $ac_hdr" >&5
+echo "configure:8594: 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 8498 "configure"
+#line 8599 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8503: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8527,13 +8628,13 @@ done
 
 
 echo $ac_n "checking termio.h and termios.h""... $ac_c" 1>&6
-echo "configure:8531: checking termio.h and termios.h" >&5
+echo "configure:8632: 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 8537 "configure"
+#line 8638 "configure"
 #include "confdefs.h"
 
 #if HAVE_TERMIO_H
@@ -8546,7 +8647,7 @@ int main() {
 putchar (0x0a)
 ; return 0; }
 EOF
-if { (eval echo configure:8550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8651: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_termio_and_termios=yes
 else
@@ -8566,13 +8667,13 @@ EOF
 
 
 echo $ac_n "checking for sigaction and structs""... $ac_c" 1>&6
-echo "configure:8570: checking for sigaction and structs" >&5
+echo "configure:8671: checking for sigaction and structs" >&5
 if eval "test \"`echo '$''{'cf_cv_func_sigaction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 8576 "configure"
+#line 8677 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -8587,7 +8688,7 @@ struct sigaction act;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:8591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_func_sigaction=yes
 else
@@ -8611,17 +8712,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:8615: checking for $ac_hdr" >&5
+echo "configure:8716: 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 8620 "configure"
+#line 8721 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8625: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8658,17 +8759,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:8662: checking for $ac_hdr" >&5
+echo "configure:8763: 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 8667 "configure"
+#line 8768 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8672: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8773: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8698,17 +8799,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:8702: checking for $ac_hdr" >&5
+echo "configure:8803: 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 8707 "configure"
+#line 8808 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8749,13 +8850,13 @@ fi
 
 
 echo $ac_n "checking for union wait""... $ac_c" 1>&6
-echo "configure:8753: checking for union wait" >&5
+echo "configure:8854: 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 8759 "configure"
+#line 8860 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
@@ -8766,7 +8867,7 @@ int x;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:8770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_type_unionwait=no
 	 echo compiles ok w/o union wait 1>&5
@@ -8777,7 +8878,7 @@ else
   rm -rf conftest*
   
 	cat > conftest.$ac_ext <<EOF
-#line 8781 "configure"
+#line 8882 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
@@ -8792,7 +8893,7 @@ union wait x;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:8796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_type_unionwait=yes
 	 echo compiles ok with union wait and possibly macros too 1>&5
@@ -8819,20 +8920,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:8823: checking if union wait can be used as wait-arg" >&5
+echo "configure:8924: 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 8829 "configure"
+#line 8930 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
 union wait x; wait(&x)
 ; return 0; }
 EOF
-if { (eval echo configure:8836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8937: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_arg_union_wait=yes
 else
@@ -8852,20 +8953,20 @@ EOF
 
 
 	echo $ac_n "checking if union wait can be used as waitpid-arg""... $ac_c" 1>&6
-echo "configure:8856: checking if union wait can be used as waitpid-arg" >&5
+echo "configure:8957: 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 8862 "configure"
+#line 8963 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
 union wait x; waitpid(0, &x, 0)
 ; return 0; }
 EOF
-if { (eval echo configure:8869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_arg_union_waitpid=yes
 else
@@ -8891,17 +8992,17 @@ for ac_hdr in stdarg.h varargs.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8895: checking for $ac_hdr" >&5
+echo "configure:8996: 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 8900 "configure"
+#line 9001 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8905: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9006: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8928,13 +9029,13 @@ fi
 done
 
 echo $ac_n "checking for standard varargs""... $ac_c" 1>&6
-echo "configure:8932: checking for standard varargs" >&5
+echo "configure:9033: checking for standard varargs" >&5
 if eval "test \"`echo '$''{'cf_cv_ansi_varargs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 8938 "configure"
+#line 9039 "configure"
 #include "confdefs.h"
 
 #if HAVE_STDARG_H
@@ -8949,7 +9050,7 @@ int main() {
 return 0;} int foo(char *fmt,...){va_list args;va_start(args,fmt);va_end(args)
 ; return 0; }
 EOF
-if { (eval echo configure:8953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ansi_varargs=yes
 else
@@ -8969,12 +9070,12 @@ EOF
 
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:8973: checking for uid_t in sys/types.h" >&5
+echo "configure:9074: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8978 "configure"
+#line 9079 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -9003,7 +9104,7 @@ EOF
 fi
 
 echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:9007: checking type of array argument to getgroups" >&5
+echo "configure:9108: checking type of array argument to getgroups" >&5
 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9011,7 +9112,7 @@ else
   ac_cv_type_getgroups=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 9015 "configure"
+#line 9116 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Rendell for this test.  */
@@ -9036,7 +9137,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:9040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
     ac_cv_type_getgroups=gid_t
 else
@@ -9050,7 +9151,7 @@ fi
 
 if test $ac_cv_type_getgroups = cross; then
         cat > conftest.$ac_ext <<EOF
-#line 9054 "configure"
+#line 9155 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -9074,12 +9175,12 @@ EOF
 
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:9078: checking for pid_t" >&5
+echo "configure:9179: 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 9083 "configure"
+#line 9184 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -9107,12 +9208,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:9111: checking for uid_t in sys/types.h" >&5
+echo "configure:9212: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9116 "configure"
+#line 9217 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -9141,12 +9242,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:9145: checking for mode_t" >&5
+echo "configure:9246: 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 9150 "configure"
+#line 9251 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -9177,17 +9278,17 @@ fi
 
 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:9181: checking for vfork.h" >&5
+echo "configure:9282: 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 9186 "configure"
+#line 9287 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9191: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9212,18 +9313,18 @@ else
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:9216: checking for working vfork" >&5
+echo "configure:9317: 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:9222: checking for vfork" >&5
+echo "configure:9323: 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 9227 "configure"
+#line 9328 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vfork(); below.  */
@@ -9246,7 +9347,7 @@ vfork();
 
 ; return 0; }
 EOF
-if { (eval echo configure:9250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_vfork=yes"
 else
@@ -9268,7 +9369,7 @@ fi
 ac_cv_func_vfork_works=$ac_cv_func_vfork
 else
   cat > conftest.$ac_ext <<EOF
-#line 9272 "configure"
+#line 9373 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -9363,7 +9464,7 @@ main() {
   }
 }
 EOF
-if { (eval echo configure:9367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_vfork_works=yes
 else
@@ -9387,13 +9488,13 @@ fi
 
 
 echo $ac_n "checking if we should use fcntl or ioctl""... $ac_c" 1>&6
-echo "configure:9391: checking if we should use fcntl or ioctl" >&5
+echo "configure:9492: checking if we should use fcntl or ioctl" >&5
 if eval "test \"`echo '$''{'cf_cv_fionbio'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 9397 "configure"
+#line 9498 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -9405,7 +9506,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:9409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_fionbio=ioctl
 else
@@ -9414,7 +9515,7 @@ else
   rm -rf conftest*
   
 cat > conftest.$ac_ext <<EOF
-#line 9418 "configure"
+#line 9519 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -9431,7 +9532,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:9435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_fionbio=fcntl
 else
@@ -9454,20 +9555,20 @@ EOF
 
 
 echo $ac_n "checking for broken/missing definition of remove""... $ac_c" 1>&6
-echo "configure:9458: checking for broken/missing definition of remove" >&5
+echo "configure:9559: 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 9464 "configure"
+#line 9565 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 remove("dummy")
 ; return 0; }
 EOF
-if { (eval echo configure:9471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9572: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_baddef_remove=no
 else
@@ -9475,7 +9576,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 9479 "configure"
+#line 9580 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 		int __unlink(name) { return unlink(name); } 
@@ -9483,7 +9584,7 @@ int main() {
 remove("dummy")
 ; return 0; }
 EOF
-if { (eval echo configure:9487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_baddef_remove=yes
 else
@@ -9507,13 +9608,13 @@ EOF
 
 
 echo $ac_n "checking for lstat""... $ac_c" 1>&6
-echo "configure:9511: checking for lstat" >&5
+echo "configure:9612: checking for lstat" >&5
 if eval "test \"`echo '$''{'ac_cv_func_lstat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 9517 "configure"
+#line 9618 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -9522,7 +9623,7 @@ int main() {
 lstat(".", (struct stat *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:9526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_lstat=yes
 else
@@ -9553,17 +9654,18 @@ for ac_func in \
 	readdir \
 	strerror \
 	truncate \
+	vasprintf \
 	unsetenv \
 	waitpid \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9562: checking for $ac_func" >&5
+echo "configure:9664: 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 9567 "configure"
+#line 9669 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -9586,7 +9688,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:9590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -9616,12 +9718,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9620: checking for $ac_func" >&5
+echo "configure:9722: 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 9625 "configure"
+#line 9727 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -9644,7 +9746,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:9648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -9675,12 +9777,12 @@ for ac_func in strstr
 do
 
 echo $ac_n "checking for $ac_func declaration""... $ac_c" 1>&6
-echo "configure:9679: checking for $ac_func declaration" >&5
+echo "configure:9781: 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 9684 "configure"
+#line 9786 "configure"
 #include "confdefs.h"
 #include <string.h>
 int main() {
@@ -9689,11 +9791,11 @@ extern	int	${ac_func}();
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:9693: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 cat > conftest.$ac_ext <<EOF
-#line 9697 "configure"
+#line 9799 "configure"
 #include "confdefs.h"
 #include <string.h>
 int main() {
@@ -9702,7 +9804,7 @@ int	(*p)() = ${ac_func};
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:9706: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 eval "ac_cv_func_decl_$ac_func=yes"
@@ -9744,12 +9846,12 @@ for ac_func in getgrgid getgrnam
 do
 
 echo $ac_n "checking for $ac_func declaration""... $ac_c" 1>&6
-echo "configure:9748: checking for $ac_func declaration" >&5
+echo "configure:9850: 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 9753 "configure"
+#line 9855 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -9760,11 +9862,11 @@ extern	int	${ac_func}();
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:9764: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9866: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 cat > conftest.$ac_ext <<EOF
-#line 9768 "configure"
+#line 9870 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -9775,7 +9877,7 @@ int	(*p)() = ${ac_func};
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:9779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9881: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 eval "ac_cv_func_decl_$ac_func=yes"
@@ -9817,13 +9919,13 @@ done
 
 
 echo $ac_n "checking if TRUE/FALSE are defined""... $ac_c" 1>&6
-echo "configure:9821: checking if TRUE/FALSE are defined" >&5
+echo "configure:9923: 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 9827 "configure"
+#line 9929 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -9832,7 +9934,7 @@ int main() {
 int x = TRUE, y = FALSE
 ; return 0; }
 EOF
-if { (eval echo configure:9836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9938: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_bool_defs=yes
 else
@@ -9859,13 +9961,13 @@ fi
 
 
 echo $ac_n "checking if external errno is declared""... $ac_c" 1>&6
-echo "configure:9863: checking if external errno is declared" >&5
+echo "configure:9965: checking if external errno is declared" >&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 9869 "configure"
+#line 9971 "configure"
 #include "confdefs.h"
 
 #if HAVE_STDLIB_H
@@ -9878,7 +9980,7 @@ int main() {
 long x = (long) errno
 ; return 0; }
 EOF
-if { (eval echo configure:9882: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9984: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval 'cf_cv_dcl_'errno'=yes'
 else
@@ -9909,13 +10011,13 @@ fi
 # It's possible (for near-UNIX clones) that the data doesn't exist
 
 echo $ac_n "checking if external errno exists""... $ac_c" 1>&6
-echo "configure:9913: checking if external errno exists" >&5
+echo "configure:10015: checking if external errno exists" >&5
 if eval "test \"`echo '$''{'cf_cv_have_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 9919 "configure"
+#line 10021 "configure"
 #include "confdefs.h"
 
 #undef errno
@@ -9925,7 +10027,7 @@ int main() {
 errno = 2
 ; return 0; }
 EOF
-if { (eval echo configure:9929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval 'cf_cv_have_'errno'=yes'
 else
@@ -9957,20 +10059,20 @@ fi
 
 
 echo $ac_n "checking for setlocale()""... $ac_c" 1>&6
-echo "configure:9961: checking for setlocale()" >&5
+echo "configure:10063: 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 9967 "configure"
+#line 10069 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 setlocale(LC_ALL, "")
 ; return 0; }
 EOF
-if { (eval echo configure:9974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_locale=yes
 else
@@ -9991,13 +10093,13 @@ EOF
 
 
 echo $ac_n "checking if NGROUPS is defined""... $ac_c" 1>&6
-echo "configure:9995: checking if NGROUPS is defined" >&5
+echo "configure:10097: 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 10001 "configure"
+#line 10103 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_PARAM_H
@@ -10011,7 +10113,7 @@ int main() {
 int x = NGROUPS
 ; return 0; }
 EOF
-if { (eval echo configure:10015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ngroups=yes
 else
@@ -10019,7 +10121,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 10023 "configure"
+#line 10125 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_PARAM_H
@@ -10033,7 +10135,7 @@ int main() {
 int x = NGROUPS_MAX
 ; return 0; }
 EOF
-if { (eval echo configure:10037: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ngroups=NGROUPS_MAX
 else
@@ -10067,13 +10169,13 @@ for cf_name in sys_nerr sys_errlist
 do
     
 echo $ac_n "checking if external $cf_name is declared""... $ac_c" 1>&6
-echo "configure:10071: checking if external $cf_name is declared" >&5
+echo "configure:10173: checking if external $cf_name is declared" >&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 10077 "configure"
+#line 10179 "configure"
 #include "confdefs.h"
 
 #if HAVE_STDLIB_H
@@ -10086,7 +10188,7 @@ int main() {
 long x = (long) $cf_name
 ; return 0; }
 EOF
-if { (eval echo configure:10090: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10192: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval 'cf_cv_dcl_'$cf_name'=yes'
 else
@@ -10117,13 +10219,13 @@ fi
 # It's possible (for near-UNIX clones) that the data doesn't exist
 
 echo $ac_n "checking if external $cf_name exists""... $ac_c" 1>&6
-echo "configure:10121: checking if external $cf_name exists" >&5
+echo "configure:10223: checking if external $cf_name exists" >&5
 if eval "test \"`echo '$''{'cf_cv_have_$cf_name'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 10127 "configure"
+#line 10229 "configure"
 #include "confdefs.h"
 
 #undef $cf_name
@@ -10133,7 +10235,7 @@ int main() {
 $cf_name = 2
 ; return 0; }
 EOF
-if { (eval echo configure:10137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval 'cf_cv_have_'$cf_name'=yes'
 else
@@ -10166,13 +10268,13 @@ done
 
 
 echo $ac_n "checking if struct utmp is declared""... $ac_c" 1>&6
-echo "configure:10170: checking if struct utmp is declared" >&5
+echo "configure:10272: 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 10176 "configure"
+#line 10278 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -10181,7 +10283,7 @@ int main() {
 struct utmp x; char *y = &x.ut_host[0]
 ; return 0; }
 EOF
-if { (eval echo configure:10185: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp=yes
 else
@@ -10189,14 +10291,14 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 10193 "configure"
+#line 10295 "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:10200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10302: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp=utmpx
 else
@@ -10224,13 +10326,13 @@ EOF
 
 
 echo $ac_n "checking if external h_errno exists""... $ac_c" 1>&6
-echo "configure:10228: checking if external h_errno exists" >&5
+echo "configure:10330: checking if external h_errno exists" >&5
 if eval "test \"`echo '$''{'cf_cv_have_h_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 10234 "configure"
+#line 10336 "configure"
 #include "confdefs.h"
 
 #undef h_errno
@@ -10240,7 +10342,7 @@ int main() {
 h_errno = 2
 ; return 0; }
 EOF
-if { (eval echo configure:10244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval 'cf_cv_have_'h_errno'=yes'
 else
@@ -10271,13 +10373,13 @@ fi
 
 
 echo $ac_n "checking if character set is EBCDIC""... $ac_c" 1>&6
-echo "configure:10275: checking if character set is EBCDIC" >&5
+echo "configure:10377: checking if character set is EBCDIC" >&5
 if eval "test \"`echo '$''{'cf_cv_ebcdic'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 10281 "configure"
+#line 10383 "configure"
 #include "confdefs.h"
  
 int main() {
@@ -10290,7 +10392,7 @@ make an error "Character set is not EBCDIC"
 #endif 
 ; return 0; }
 EOF
-if { (eval echo configure:10294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
    # TryCompile action if true
 cf_cv_ebcdic=yes 
@@ -10324,7 +10426,7 @@ esac
 if test $cf_cv_screen != slang ; then
 	
 echo $ac_n "checking if curses supports alternate-character set""... $ac_c" 1>&6
-echo "configure:10328: checking if curses supports alternate-character set" >&5
+echo "configure:10430: 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
@@ -10332,7 +10434,7 @@ else
 for mapname in acs_map _acs_map
 do
 	cat > conftest.$ac_ext <<EOF
-#line 10336 "configure"
+#line 10438 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -10341,7 +10443,7 @@ int main() {
 chtype x = $mapname['l']; $mapname['m'] = 0
 ; return 0; }
 EOF
-if { (eval echo configure:10345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_alt_char_set=$mapname
 	 break
@@ -10364,13 +10466,13 @@ EOF
 
 	
 echo $ac_n "checking if curses supports fancy attributes""... $ac_c" 1>&6
-echo "configure:10368: checking if curses supports fancy attributes" >&5
+echo "configure:10470: 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 10374 "configure"
+#line 10476 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -10383,7 +10485,7 @@ attrset(A_UNDERLINE|A_BOLD|A_REVERSE);
 	
 ; return 0; }
 EOF
-if { (eval echo configure:10387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_fancy_curses=yes
 else
@@ -10403,7 +10505,7 @@ EOF
 
 
 	echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
-echo "configure:10407: checking for ncurses version" >&5
+echo "configure:10509: 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
@@ -10428,7 +10530,7 @@ Autoconf "old"
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo configure:10432: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	{ (eval echo configure:10534: \"$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"
@@ -10437,7 +10539,7 @@ EOF
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 10441 "configure"
+#line 10543 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -10460,7 +10562,7 @@ int main()
 	exit(0);
 }
 EOF
-if { (eval echo configure:10464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -10480,13 +10582,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:10484: checking for obsolete/broken version of ncurses" >&5
+echo "configure:10586: 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 10490 "configure"
+#line 10592 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -10500,7 +10602,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:10504: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ncurses_broken=no
 else
@@ -10525,13 +10627,13 @@ fi
 
 	
 echo $ac_n "checking if curses supports color attributes""... $ac_c" 1>&6
-echo "configure:10529: checking if curses supports color attributes" >&5
+echo "configure:10631: 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 10535 "configure"
+#line 10637 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -10546,7 +10648,7 @@ chtype x = COLOR_BLUE;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:10550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_color_curses=yes
 else
@@ -10573,7 +10675,7 @@ fi
 
 	
 echo $ac_n "checking declaration of size-change""... $ac_c" 1>&6
-echo "configure:10577: checking declaration of size-change" >&5
+echo "configure:10679: 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
@@ -10587,7 +10689,7 @@ do
     CFLAGS="$cf_save_CFLAGS"
     test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts"
     cat > conftest.$ac_ext <<EOF
-#line 10591 "configure"
+#line 10693 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if HAVE_TERMIOS_H
@@ -10626,7 +10728,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:10630: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10732: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_sizechange=yes
 else
@@ -10658,20 +10760,20 @@ EOF
 
 	
 echo $ac_n "checking if ttytype is declared in curses library""... $ac_c" 1>&6
-echo "configure:10662: checking if ttytype is declared in curses library" >&5
+echo "configure:10764: 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 10668 "configure"
+#line 10770 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 char *x = &ttytype[1]; *x = 1
 ; return 0; }
 EOF
-if { (eval echo configure:10675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_have_ttytype=yes
 else
@@ -10699,12 +10801,12 @@ EOF
 		wborder 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:10703: checking for $ac_func" >&5
+echo "configure:10805: 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 10708 "configure"
+#line 10810 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -10727,7 +10829,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:10731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -10757,7 +10859,7 @@ fi
 
 
 echo $ac_n "checking if configuration info should be browsable""... $ac_c" 1>&6
-echo "configure:10761: checking if configuration info should be browsable" >&5
+echo "configure:10863: checking if configuration info should be browsable" >&5
 
 # Check whether --enable-config-info or --disable-config-info was given.
 if test "${enable_config_info+set}" = set; then
@@ -10781,7 +10883,7 @@ EOF
 
 
 echo $ac_n "checking if new-style forms-based options screen should be used""... $ac_c" 1>&6
-echo "configure:10785: checking if new-style forms-based options screen should be used" >&5
+echo "configure:10887: checking if new-style forms-based options screen should be used" >&5
 
 # Check whether --enable-forms-options or --disable-forms-options was given.
 if test "${enable_forms_options+set}" = set; then
@@ -10805,7 +10907,7 @@ EOF
 
 
 echo $ac_n "checking if old-style options menu should be used""... $ac_c" 1>&6
-echo "configure:10809: checking if old-style options menu should be used" >&5
+echo "configure:10911: checking if old-style options menu should be used" >&5
 
 # Check whether --enable-menu-options or --disable-menu-options was given.
 if test "${enable_menu_options+set}" = set; then
@@ -10829,7 +10931,7 @@ EOF
 
 
 echo $ac_n "checking if experimental address-list page should be used""... $ac_c" 1>&6
-echo "configure:10833: checking if experimental address-list page should be used" >&5
+echo "configure:10935: checking if experimental address-list page should be used" >&5
 
 # Check whether --enable-addrlist-page or --disable-addrlist-page was given.
 if test "${enable_addrlist_page+set}" = set; then
@@ -10853,7 +10955,7 @@ EOF
 
 
 echo $ac_n "checking if experimental charset-selection logic should be used""... $ac_c" 1>&6
-echo "configure:10857: checking if experimental charset-selection logic should be used" >&5
+echo "configure:10959: checking if experimental charset-selection logic should be used" >&5
 
 # Check whether --enable-charset-choice or --disable-charset-choice was given.
 if test "${enable_charset_choice+set}" = set; then
@@ -10877,7 +10979,7 @@ EOF
 
 
 echo $ac_n "checking if experimental CJK logic should be used""... $ac_c" 1>&6
-echo "configure:10881: checking if experimental CJK logic should be used" >&5
+echo "configure:10983: checking if experimental CJK logic should be used" >&5
 
 # Check whether --enable-cjk or --disable-cjk was given.
 if test "${enable_cjk+set}" = set; then
@@ -10901,7 +11003,7 @@ EOF
 
 
 echo $ac_n "checking if color-style code should be used""... $ac_c" 1>&6
-echo "configure:10905: checking if color-style code should be used" >&5
+echo "configure:11007: 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
@@ -10949,7 +11051,7 @@ EOF
 	echo "$ac_t""yes" 1>&6
 
 	echo $ac_n "checking for location of style-sheet file""... $ac_c" 1>&6
-echo "configure:10953: checking for location of style-sheet file" >&5
+echo "configure:11055: 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"
@@ -10967,7 +11069,7 @@ test ".$ac_cv_func_use_default_colors" = ".yes" && use_dft_colors=maybe
 
 if test "$use_dft_colors" != no ; then
 echo $ac_n "checking if you want to use default-colors""... $ac_c" 1>&6
-echo "configure:10971: checking if you want to use default-colors" >&5
+echo "configure:11073: checking if you want to use default-colors" >&5
 
 # Check whether --enable-default-colors or --disable-default-colors was given.
 if test "${enable_default_colors+set}" = set; then
@@ -10992,7 +11094,7 @@ EOF
 fi
 
 echo $ac_n "checking if experimental file-upload logic should be used""... $ac_c" 1>&6
-echo "configure:10996: checking if experimental file-upload logic should be used" >&5
+echo "configure:11098: checking if experimental file-upload logic should be used" >&5
 
 # Check whether --enable-file-upload or --disable-file-upload was given.
 if test "${enable_file_upload+set}" = set; then
@@ -11016,7 +11118,7 @@ EOF
 
 
 echo $ac_n "checking if experimental element-justification logic should be used""... $ac_c" 1>&6
-echo "configure:11020: checking if experimental element-justification logic should be used" >&5
+echo "configure:11122: checking if experimental element-justification logic should be used" >&5
 
 # Check whether --enable-justify-elts or --disable-justify-elts was given.
 if test "${enable_justify_elts+set}" = set; then
@@ -11040,7 +11142,7 @@ EOF
 
 
 echo $ac_n "checking if experimental keyboard-layout logic should be used""... $ac_c" 1>&6
-echo "configure:11044: checking if experimental keyboard-layout logic should be used" >&5
+echo "configure:11146: checking if experimental keyboard-layout logic should be used" >&5
 
 # Check whether --enable-kbd-layout or --disable-kbd-layout was given.
 if test "${enable_kbd_layout+set}" = set; then
@@ -11064,7 +11166,7 @@ EOF
 
 
 echo $ac_n "checking if experimental JavaScript support should be used""... $ac_c" 1>&6
-echo "configure:11068: checking if experimental JavaScript support should be used" >&5
+echo "configure:11170: checking if experimental JavaScript support should be used" >&5
 
 # Check whether --enable-libjs or --disable-libjs was given.
 if test "${enable_libjs+set}" = set; then
@@ -11088,7 +11190,7 @@ EOF
 
 
 echo $ac_n "checking if html source should be colorized""... $ac_c" 1>&6
-echo "configure:11092: checking if html source should be colorized" >&5
+echo "configure:11194: checking if html source should be colorized" >&5
 
 # Check whether --enable-prettysrc or --disable-prettysrc was given.
 if test "${enable_prettysrc+set}" = set; then
@@ -11112,7 +11214,7 @@ EOF
 
 
 echo $ac_n "checking if read-progress message should show ETA""... $ac_c" 1>&6
-echo "configure:11116: checking if read-progress message should show ETA" >&5
+echo "configure:11218: checking if read-progress message should show ETA" >&5
 
 # Check whether --enable-read-eta or --disable-read-eta was given.
 if test "${enable_read_eta+set}" = set; then
@@ -11136,7 +11238,7 @@ EOF
 
 
 echo $ac_n "checking if scrollbar code should be used""... $ac_c" 1>&6
-echo "configure:11140: checking if scrollbar code should be used" >&5
+echo "configure:11242: checking if scrollbar code should be used" >&5
 
 # Check whether --enable-scrollbar or --disable-scrollbar was given.
 if test "${enable_scrollbar+set}" = set; then
@@ -11167,7 +11269,7 @@ EOF
 fi
 
 echo $ac_n "checking if source caching should be used""... $ac_c" 1>&6
-echo "configure:11171: checking if source caching should be used" >&5
+echo "configure:11273: checking if source caching should be used" >&5
 
 # Check whether --enable-source-cache or --disable-source-cache was given.
 if test "${enable_source_cache+set}" = set; then
@@ -11194,7 +11296,7 @@ EOF
 
 
 echo $ac_n "checking if alternative line-edit bindings should be used""... $ac_c" 1>&6
-echo "configure:11198: checking if alternative line-edit bindings should be used" >&5
+echo "configure:11300: checking if alternative line-edit bindings should be used" >&5
 
 # Check whether --enable-alt-bindings or --disable-alt-bindings was given.
 if test "${enable_alt_bindings+set}" = set; then
@@ -11218,7 +11320,7 @@ EOF
 
 
 echo $ac_n "checking if you want to use extended HTML DTD logic""... $ac_c" 1>&6
-echo "configure:11222: checking if you want to use extended HTML DTD logic" >&5
+echo "configure:11324: checking if you want to use extended HTML DTD logic" >&5
 
 # Check whether --enable-extended-dtd or --disable-extended-dtd was given.
 if test "${enable_extended_dtd+set}" = set; then
@@ -11242,7 +11344,7 @@ EOF
 
 
 echo $ac_n "checking if partial-display should be used""... $ac_c" 1>&6
-echo "configure:11246: checking if partial-display should be used" >&5
+echo "configure:11348: checking if partial-display should be used" >&5
 
 # Check whether --enable-partial or --disable-partial was given.
 if test "${enable_partial+set}" = set; then
@@ -11266,7 +11368,7 @@ EOF
 
 
 echo $ac_n "checking if you want to use external commands""... $ac_c" 1>&6
-echo "configure:11270: checking if you want to use external commands" >&5
+echo "configure:11372: 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
@@ -11290,7 +11392,7 @@ EOF
 
 
 echo $ac_n "checking if you want to use setfont support""... $ac_c" 1>&6
-echo "configure:11294: checking if you want to use setfont support" >&5
+echo "configure:11396: 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
@@ -11314,7 +11416,7 @@ EOF
 
 
 echo $ac_n "checking if you want cgi-link support""... $ac_c" 1>&6
-echo "configure:11318: checking if you want cgi-link support" >&5
+echo "configure:11420: checking if you want cgi-link support" >&5
 
 # Check whether --enable-cgi-links or --disable-cgi-links was given.
 if test "${enable_cgi_links+set}" = set; then
@@ -11333,7 +11435,7 @@ fi
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking if you want change-exec support""... $ac_c" 1>&6
-echo "configure:11337: checking if you want change-exec support" >&5
+echo "configure:11439: checking if you want change-exec support" >&5
 
 # Check whether --enable-change-exec or --disable-change-exec was given.
 if test "${enable_change_exec+set}" = set; then
@@ -11357,7 +11459,7 @@ EOF
 
 
 echo $ac_n "checking if you want exec-links support""... $ac_c" 1>&6
-echo "configure:11361: checking if you want exec-links support" >&5
+echo "configure:11463: checking if you want exec-links support" >&5
 
 # Check whether --enable-exec-links or --disable-exec-links was given.
 if test "${enable_exec_links+set}" = set; then
@@ -11381,7 +11483,7 @@ EOF
 
 
 echo $ac_n "checking if you want exec-scripts support""... $ac_c" 1>&6
-echo "configure:11385: checking if you want exec-scripts support" >&5
+echo "configure:11487: checking if you want exec-scripts support" >&5
 
 # Check whether --enable-exec-scripts or --disable-exec-scripts was given.
 if test "${enable_exec_scripts+set}" = set; then
@@ -11405,7 +11507,7 @@ EOF
 
 
 echo $ac_n "checking if you want internal-links feature""... $ac_c" 1>&6
-echo "configure:11409: checking if you want internal-links feature" >&5
+echo "configure:11511: checking if you want internal-links feature" >&5
 
 # Check whether --enable-internal-links or --disable-internal-links was given.
 if test "${enable_internal_links+set}" = set; then
@@ -11429,7 +11531,7 @@ EOF
 
 
 echo $ac_n "checking if you want to fork NSL requests""... $ac_c" 1>&6
-echo "configure:11433: checking if you want to fork NSL requests" >&5
+echo "configure:11535: 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
@@ -11453,7 +11555,7 @@ EOF
 
 
 echo $ac_n "checking if you want to log URL requests via syslog""... $ac_c" 1>&6
-echo "configure:11457: checking if you want to log URL requests via syslog" >&5
+echo "configure:11559: checking if you want to log URL requests via syslog" >&5
 
 # Check whether --enable-syslog or --disable-syslog was given.
 if test "${enable_syslog+set}" = set; then
@@ -11477,7 +11579,7 @@ EOF
 
 
 echo $ac_n "checking if persistent-cookie logic should be used""... $ac_c" 1>&6
-echo "configure:11481: checking if persistent-cookie logic should be used" >&5
+echo "configure:11583: checking if persistent-cookie logic should be used" >&5
 
 # Check whether --enable-persistent-cookies or --disable-persistent-cookies was given.
 if test "${enable_persistent_cookies+set}" = set; then
@@ -11501,7 +11603,7 @@ EOF
 
 
 echo $ac_n "checking if you want to underline links""... $ac_c" 1>&6
-echo "configure:11505: checking if you want to underline links" >&5
+echo "configure:11607: checking if you want to underline links" >&5
 
 # Check whether --enable-underlines or --disable-underlines was given.
 if test "${enable_underlines+set}" = set; then
@@ -11525,7 +11627,7 @@ EOF
 
 
 echo $ac_n "checking if help files should be gzip'ed""... $ac_c" 1>&6
-echo "configure:11529: checking if help files should be gzip'ed" >&5
+echo "configure:11631: checking if help files should be gzip'ed" >&5
 
 # Check whether --enable-gzip-help or --disable-gzip-help was given.
 if test "${enable_gzip_help+set}" = set; then
@@ -11554,7 +11656,7 @@ fi
 
 
 echo $ac_n "checking if you want to use zlib for decompression of some gzip files""... $ac_c" 1>&6
-echo "configure:11558: checking if you want to use zlib for decompression of some gzip files" >&5
+echo "configure:11660: 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
@@ -11571,12 +11673,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:11575: checking for gzopen" >&5
+echo "configure:11677: 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 11580 "configure"
+#line 11682 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gzopen(); below.  */
@@ -11599,7 +11701,7 @@ gzopen();
 
 ; return 0; }
 EOF
-if { (eval echo configure:11603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gzopen=yes"
 else
@@ -11619,17 +11721,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for gzopen in -lz""... $ac_c" 1>&6
-echo "configure:11623: checking for gzopen in -lz" >&5
+echo "configure:11725: checking for gzopen in -lz" >&5
 		LIBS="-lz $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 11626 "configure"
+#line 11728 "configure"
 #include "confdefs.h"
 #include <zlib.h>
 int main() {
 gzopen("name","mode")
 ; return 0; }
 EOF
-if { (eval echo configure:11633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 cf_cv_have_lib_z=yes
@@ -11657,17 +11759,17 @@ test "$prefix" != /opt           && cf_search="$cf_search /opt/lib /opt/lib/z"
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -lz in $cf_libdir""... $ac_c" 1>&6
-echo "configure:11661: checking for -lz in $cf_libdir" >&5
+echo "configure:11763: checking for -lz in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -lz $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 11664 "configure"
+#line 11766 "configure"
 #include "confdefs.h"
 #include <zlib.h>
 int main() {
 gzopen("name","mode")
 ; return 0; }
 EOF
-if { (eval echo configure:11671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 cf_cv_have_lib_z=yes
@@ -11703,7 +11805,7 @@ EOF
 fi
 
 echo $ac_n "checking if you want to exclude FINGER code""... $ac_c" 1>&6
-echo "configure:11707: checking if you want to exclude FINGER code" >&5
+echo "configure:11809: checking if you want to exclude FINGER code" >&5
 
 # Check whether --enable-finger or --disable-finger was given.
 if test "${enable_finger+set}" = set; then
@@ -11727,7 +11829,7 @@ EOF
 
 
 echo $ac_n "checking if you want to exclude GOPHER code""... $ac_c" 1>&6
-echo "configure:11731: checking if you want to exclude GOPHER code" >&5
+echo "configure:11833: checking if you want to exclude GOPHER code" >&5
 
 # Check whether --enable-gopher or --disable-gopher was given.
 if test "${enable_gopher+set}" = set; then
@@ -11751,7 +11853,7 @@ EOF
 
 
 echo $ac_n "checking if you want to exclude NEWS code""... $ac_c" 1>&6
-echo "configure:11755: checking if you want to exclude NEWS code" >&5
+echo "configure:11857: checking if you want to exclude NEWS code" >&5
 
 # Check whether --enable-news or --disable-news was given.
 if test "${enable_news+set}" = set; then
@@ -11775,7 +11877,7 @@ EOF
 
 
 echo $ac_n "checking if you want to exclude FTP code""... $ac_c" 1>&6
-echo "configure:11779: checking if you want to exclude FTP code" >&5
+echo "configure:11881: checking if you want to exclude FTP code" >&5
 
 # Check whether --enable-ftp or --disable-ftp was given.
 if test "${enable_ftp+set}" = set; then
@@ -11804,7 +11906,7 @@ EOF
 # 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:11808: checking if directory-editor code should be used" >&5
+echo "configure:11910: 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
@@ -11830,7 +11932,7 @@ EOF
 
 
 	echo $ac_n "checking if you wish to allow extracting from archives via DirEd""... $ac_c" 1>&6
-echo "configure:11834: checking if you wish to allow extracting from archives via DirEd" >&5
+echo "configure:11936: 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
@@ -11849,7 +11951,7 @@ 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:11853: checking if you wish to allow users to redefine DirEd keys" >&5
+echo "configure:11955: 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
@@ -11875,7 +11977,7 @@ 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:11879: checking if you wish to allow permissions commands via DirEd" >&5
+echo "configure:11981: 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
@@ -11901,7 +12003,7 @@ 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:11905: checking if you wish to allow executable-permission commands via DirEd" >&5
+echo "configure:12007: 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
@@ -11920,7 +12022,7 @@ 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:11924: checking if you wish to allow "tar" commands from DirEd" >&5
+echo "configure:12026: 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
@@ -11946,7 +12048,7 @@ 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:11950: checking if you wish to allow "uudecode" commands from DirEd" >&5
+echo "configure:12052: 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
@@ -11972,7 +12074,7 @@ 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:11976: checking if you wish to allow "zip" and "unzip" commands from DirEd" >&5
+echo "configure:12078: 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
@@ -11998,7 +12100,7 @@ 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:12002: checking if you wish to allow "gzip" and "gunzip" commands from DirEd" >&5
+echo "configure:12104: 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
@@ -12025,7 +12127,7 @@ fi
 fi
 
 echo $ac_n "checking if you want long-directory listings""... $ac_c" 1>&6
-echo "configure:12029: checking if you want long-directory listings" >&5
+echo "configure:12131: 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
@@ -12051,7 +12153,7 @@ fi
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking if parent-directory references are permitted""... $ac_c" 1>&6
-echo "configure:12055: checking if parent-directory references are permitted" >&5
+echo "configure:12157: 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
@@ -12071,7 +12173,7 @@ echo "$ac_t""$enableval" 1>&6
 
 
 echo $ac_n "checking if we can include termio.h with curses""... $ac_c" 1>&6
-echo "configure:12075: checking if we can include termio.h with curses" >&5
+echo "configure:12177: checking if we can include termio.h with curses" >&5
 if eval "test \"`echo '$''{'cf_cv_termio_and_curses'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -12080,7 +12182,7 @@ else
     CFLAGS="$CFLAGS -DHAVE_CONFIG_H -I. -I${srcdir-.} -I${srcdir-.}/src -I${srcdir-.}/WWW/Library/Implementation"
     touch lynx_cfg.h
     cat > conftest.$ac_ext <<EOF
-#line 12084 "configure"
+#line 12186 "configure"
 #include "confdefs.h"
 
 #include <LYCurses.h>
@@ -12089,7 +12191,7 @@ int main() {
 putchar(0x0a)
 ; return 0; }
 EOF
-if { (eval echo configure:12093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_termio_and_curses=yes
 else
diff --git a/configure.in b/configure.in
index 464ea268..92a6ee47 100644
--- a/configure.in
+++ b/configure.in
@@ -356,6 +356,8 @@ ultrix*)
 esac
 AC_SUBST(PROG_EXT)
 
+CF_GNU_SOURCE
+
 dnl Collect tests for compiler options into one place
 if test -n "$TRY_CFLAGS" ; then
 	cf_save_CFLAGS="$CFLAGS"
@@ -529,6 +531,7 @@ AC_CHECK_FUNCS( \
 	readdir \
 	strerror \
 	truncate \
+	vasprintf \
 	unsetenv \
 	waitpid \
 )
diff --git a/docs/README.defines b/docs/README.defines
index 9736a926..286c5b71 100644
--- a/docs/README.defines
+++ b/docs/README.defines
@@ -121,6 +121,7 @@ Other general
 # -DNSL_FORK       For fork-based name server lookups that can be 'z'apped.
 # -DSYSLOG_REQUESTED_URLS
 # 	if you would like logging of client requests via syslog()
+# -DUSE_VASPRINT   Use vasprintf() function
 # -DUSE_ZLIB       (see INSTALLATION)
 # -DDECLARE_WAIS_LOGFILES   see comments in makefile.in
 # -DNO_RULES	   Disables code for CERN-style rules files
@@ -141,6 +142,7 @@ They may directly affect several source files.  Filenames show where
 they are set.  Normally installers shouldn't have to care about these
 symbols.
 
+SAVE_TIME_NOT_SPACE	HTString.c	minmize number of some malloc calls
 SHOW_WHEREIS_TARGETS	LYCurses.h	whereis search highlighting
 USE_KEYMAPS		LYCurses.h	use of .lynx-keymaps files
 
@@ -161,9 +163,11 @@ DUPLICATE_ANCHOR_NAME_WORKAROUND	HTAnchor.c
 EXTENDED_OPTION_LOGIC			LYMain.c
 EXTENDED_STARTFILE_RECALL		LYMain.c
 OPTNAME_ALLOW_DASHES			LYMain.c
+OVERLAP					HTNews.c
 RESTRICT_NM_ALLOW_DASHES		LYUtils.c
 SOCKET_DEBUG_TRACE			HTTCP.c
 TRADITIONAL_SUFFIXES			HTInit.c
+USE_XHDR				HTNews.c
 max_cookies_buffer			LYCookie.c
 max_cookies_domain			LYCookie.c
 max_cookies_global			LYCookie.c
diff --git a/lynx.cfg b/lynx.cfg
index 0542435c..c321d26a 100644
--- a/lynx.cfg
+++ b/lynx.cfg
@@ -2238,15 +2238,15 @@ MINIMAL_COMMENTS:TRUE
 
 
 # Pretty source view settings. These settings are in effect when -prettysrc
-# was specified.
-# The following lexical elements (lexems) are recognised:
+# is specified.
+# The following lexical elements (lexemes) are recognized:
 # comment, tag, attribute, attribute value, generalized angle brackets (
-# '<' '>' '</' ), entity, hyperlink destination , entire file,bad sequence,
+# '<' '>' '</' ), entity, hyperlink destination, entire file, bad sequence,
 # bad tag, bad attribute, sgml special.
 #  The following group of option tells which styles will surround each
-# lexem. The syntax of option in this group is:
-#HTMLSRC_<LEXEMNAME>:<TAGSPEC>:<TAGSPEC>
-# The first <TAGSPEC> specifies what tags will precede lexems of that class
+# lexeme. The syntax of option in this group is:
+#HTMLSRC_<LEXEMENAME>:<TAGSPEC>:<TAGSPEC>
+# The first <TAGSPEC> specifies what tags will precede lexemes of that class
 # in the internal html markup. The second - what will be placed (internally)
 # after it.
 # TAGSPEC has the following syntax:
@@ -2254,11 +2254,11 @@ MINIMAL_COMMENTS:TRUE
 # <TAGOPEN>:= tagname[.classname]
 # <TAGCLOSE>:= !tagname
 #
-# The following table gives correspondence between lexem and lexem name
-#  Lexem                     LEXEMNAME FURTHER EXPLANATION
+# The following table gives correspondence between lexeme and lexeme name
+#  Lexeme                    LEXEMENAME FURTHER EXPLANATION
 # ------------------------------------
 # comment                    COMM
-# tag                        TAG       everything in gen. brackets
+# tag                        TAG       recognized tag name only
 # attribute                  ATTRIB
 # attribute value            ATTRVAL
 # generalized brackets       ABRACKET  <  >  </
@@ -2270,7 +2270,7 @@ MINIMAL_COMMENTS:TRUE
 # bad tag                    BADTAG    Unrecognized contruct in generalized
 #                                      brackets.
 # bad attribute              BADATTR   The name of the attribute unknown to lynx
-#                                      of the tag known to lynx. (ie
+#                                      of the tag known to lynx. (i.e.,
 #                                      attributes of unknown tags will have
 #                                      markup of  ATTRIB)
 # sgml special               SGMLSPECIAL doctype, sgmlelt, sgmlele,
@@ -2278,13 +2278,13 @@ MINIMAL_COMMENTS:TRUE
 #
 #                 Notes:
 # 1) The markup for HTML_ENTIRE will be emitted only once - it will surround
-# entire file source.
-# 2) The tagnames specified by TAGPEC should be valid html tag names.
+#    entire file source.
+# 2) The tagnames specified by TAGSPEC should be valid html tag names.
 # 3) If the tag/class combination given by TAGOPEN is not assigned a color
 #    style in lss file (for lynx compiled with lss support), that tag/class
-#    combination will be anyway emitted during internal html markup. Such
+#    combination will be emitted anyway during internal html markup. Such
 #    combinations will be also reported to the trace log.
-# 4) Lexeme 'tag' means everything contained in generalized angle brackets
+# 4) Lexeme 'tag' means tag name only
 # 5) Angle brackets of html specials won't be surrounded by markup for ABRACKET
 #
 #         Examples:
@@ -2316,15 +2316,15 @@ MINIMAL_COMMENTS:TRUE
 # For lynx compiled without lss support, the following settings are the default:
 #HTMLSRC_COMM:b:!b
 #HTMLSRC_TAG:b:!b
-#HTMLSRC_ATTRIB::
-#HTMLSRC_ATTRVAL:!b:b
+#HTMLSRC_ATTRIB:b:!b
+#HTMLSRC_ATTRVAL::
 #HTMLSRC_ABRACKET:b:!b
 #HTMLSRC_ENTITY:b:!b
 #HTMLSRC_HREF::
 #HTMLSRC_ENTIRE::
 #HTMLSRC_BADSEQ:b:!b
 #HTMLSRC_BADTAG::
-#HTMLSRC_BADATTR:!b:b
+#HTMLSRC_BADATTR::
 #HTMLSRC_SGMLSPECIAL:b:!b
 #
 # Other source-view related options:
diff --git a/lynx.hlp b/lynx.hlp
index 67b7d0d3..7fe29a7d 100644
--- a/lynx.hlp
+++ b/lynx.hlp
@@ -140,7 +140,8 @@
 
        -dont_wrap_pre
               inhibit wrapping of text in  <pre>  when  -dump'ing
-              and -crawl'ing.
+              and  -crawl'ing,  mark wrapped lines in interactive
+              session.
 
        -dump  dumps  the formatted output of the default document
               or one specified on the command  line  to  standard
diff --git a/lynx.man b/lynx.man
index a7f28b40..6f33ee3b 100644
--- a/lynx.man
+++ b/lynx.man
@@ -158,7 +158,8 @@ incremental display stages with MessageSecs delay
 set the display variable for X rexec-ed programs.
 .TP
 .B -dont_wrap_pre
-inhibit wrapping of text in <pre> when -dump'ing and -crawl'ing.
+inhibit wrapping of text in <pre> when -dump'ing and -crawl'ing, mark
+wrapped lines in interactive session.
 .TP
 .B -dump
 dumps the formatted output of the default document or one
diff --git a/makefile.bcb b/makefile.bcb
index c55fcab0..fae302b9 100644
--- a/makefile.bcb
+++ b/makefile.bcb
@@ -577,9 +577,14 @@ $(OBJ)/LYUpload.obj :  src/LYUpload.c
  $(CEAT_lynxdexe) $(CC_FLAGS) -o$@ src/LYUpload.c
 |
 
-$(OBJ)/lyutils.obj :  src/lyutils.c
+$(OBJ)/LYUtils.obj :  src/LYUtils.c
   $(BCC32) -P- -c @&&|
- $(CEAT_lynxdexe) $(CC_FLAGS) -o$@ src/lyutils.c
+ $(CEAT_lynxdexe) $(CC_FLAGS) -o$@ src/LYUtils.c
+|
+
+$(OBJ)/TRSTable.obj :  src/TRSTable.c
+  $(BCC32) -P- -c @&&|
+ $(CEAT_lynxdexe) $(CC_FLAGS) -o$@ src/TRSTable.c
 |
 
 $(OBJ)/xsystem.obj :  src/xsystem.c
diff --git a/makefile.in b/makefile.in
index e7ae7ff4..9088261d 100644
--- a/makefile.in
+++ b/makefile.in
@@ -288,7 +288,7 @@ compress: tar
 REFDIR=orig/$(lynxdir)
 
 lynx.patch: $(top_srcdir) $(top_srcdir)/CHANGES
-	cd  $(top_srcdir)/.. && cd $(REFDIR) && { rm -f \
+	- cd $(top_srcdir)/.. && cd $(REFDIR) && { rm -f \
 		config.log \
 		config.status \
 		lynx_cfg.h \
@@ -297,10 +297,12 @@ lynx.patch: $(top_srcdir) $(top_srcdir)/CHANGES
 			( set -x; cd $$I && rm -f *.orig *.rej makefile ); : ); \
 		done; }
 	( cd $(top_srcdir)/..; echo "%%% Created `date` by target $@. %%%"; \
-			diff -brc $(REFDIR) $(lynxdir) ) \
+	   if diff -bru /dev/null /dev/null;		     \
+		   then diff -bru $(REFDIR) $(lynxdir);	     \
+		   else diff -brc $(REFDIR) $(lynxdir); fi ) \
 		| grep -v '^Common' \
 		| grep -v '^Binary files ' \
-		| grep -v '^Only ' | tee $@ | grep '^--- $(lynxdir)'
+		| grep -v '^Only ' | tee $@ | egrep '^\-\-\- .*$(lynxdir)'
 
 install: install-bin install-man install-cfg @INSTALL_LSS@
 	@echo
diff --git a/makelynx.bat b/makelynx.bat
new file mode 100644
index 00000000..6d47b75f
--- /dev/null
+++ b/makelynx.bat
@@ -0,0 +1,179 @@
+REM Rough version of Dos batch makefile for MingW32 and lynx.exe 

+Rem Remember to precede this by "command /E:32000" and set the 

+Rem MingW32 paths 

+ 

+SET DEFINES=-DNO_UNISTD_H 

+SET DEFINES=%DEFINES% -D_WINDOWS 

+SET DEFINES=%DEFINES% -DXMOSAIC_HACK 

+SET DEFINES=%DEFINES% -DACCESS_AUTH 

+SET DEFINES=%DEFINES% -DNO_UTMP 

+SET DEFINES=%DEFINES% -DNO_CUSERID 

+SET DEFINES=%DEFINES% -DNO_TTYTYPE 

+SET DEFINES=%DEFINES% -DNOSIGHUP 

+SET DEFINES=%DEFINES% -DDOSPATH 

+SET DEFINES=%DEFINES% -DNOUSERS 

+SET DEFINES=%DEFINES% -DHAVE_KEYPAD 

+SET DEFINES=%DEFINES% -DVC="2.14FM" 

+SET DEFINES=%DEFINES% -DUSE_SLANG 

+SET DEFINES=%DEFINES% -DWIN32 

+ 

+SET INCLUDES=-I. -I..\..\..\ -I..\..\..\SRC 

+ 

+SET CFLAGS=-O %INCLUDES% %DEFINES% 

+SET COMPILE_CMD=gcc -c %CFLAGS% 

+ 

+ 

+cd WWW\Library\Implementation 

+ 

+SET FILES=crypt.c 

+SET FILES=%FILES% crypt_util.c 

+SET FILES=%FILES% getline.c 

+SET FILES=%FILES% getpass.c 

+SET FILES=%FILES% HTAABrow.c 

+SET FILES=%FILES% HTAAProt.c 

+SET FILES=%FILES% HTAAUtil.c 

+SET FILES=%FILES% HTAccess.c 

+SET FILES=%FILES% HTAnchor.c 

+SET FILES=%FILES% HTAssoc.c 

+ 

+PAUSE 

+for %%f in ( %FILES% ) do %COMPILE_CMD% %%f 

+PAUSE 

+ 

+SET FILES=HTAtom.c 

+SET FILES=%FILES% HTBTree.c 

+SET FILES=%FILES% HTChunk.c 

+SET FILES=%FILES% HTDOS.c 

+SET FILES=%FILES% HTFile.c 

+SET FILES=%FILES% HTFinger.c 

+SET FILES=%FILES% HTFormat.c 

+SET FILES=%FILES% HTFTP.c 

+SET FILES=%FILES% HTFWriter.c 

+SET FILES=%FILES% HTGopher.c 

+SET FILES=%FILES% HTGroup.c 

+ 

+PAUSE 

+for %%f in ( %FILES% ) do %COMPILE_CMD% %%f 

+PAUSE 

+ 

+SET FILES=HTLex.c 

+SET FILES=%FILES% HTList.c 

+SET FILES=%FILES% HTMIME.c 

+SET FILES=%FILES% HTMLDTD.c 

+SET FILES=%FILES% HTMLGen.c 

+SET FILES=%FILES% HTNews.c 

+SET FILES=%FILES% HTParse.c 

+SET FILES=%FILES% HTPlain.c 

+SET FILES=%FILES% HTRules.c 

+SET FILES=%FILES% HTString.c 

+ 

+PAUSE 

+for %%f in ( %FILES% ) do %COMPILE_CMD% %%f 

+PAUSE 

+ 

+SET FILES=HTStyle.c 

+SET FILES=%FILES% HTTCP.c 

+SET FILES=%FILES% HTTelnet.c 

+SET FILES=%FILES% HTTP.c 

+SET FILES=%FILES% HTUU.c 

+SET FILES=%FILES% HTVMS_WaisUI.c 

+SET FILES=%FILES% HTVMS_WaisProt.c 

+SET FILES=%FILES% HTWAIS.c 

+SET FILES=%FILES% HTWSRC.c 

+SET FILES=%FILES% SGML.c 

+ 

+PAUSE 

+for %%f in ( %FILES% ) do %COMPILE_CMD% %%f 

+PAUSE 

+ 

+ar crv *.o libwww.a 

+ 

+PAUSE 

+ 

+cd ..\..\..\src\chrtrans 

+ 

+SET INCLUDES=-I. -I.. -I..\.. -I..\..\WWW\Library\Implementation 

+SET CFLAGS=-O %INCLUDES% %DEFINES% 

+SET COMPILE_CMD=gcc -c %CFLAGS% 

+ 

+%COMPILE_CMD% makeuctb.c 

+ 

+PAUSE 

+gcc -o makeuctb.exe makeuctb.o 

+PAUSE 

+call make32.bat 

+PAUSE 

+cd ..\ 

+ 

+SET INCLUDES=-I. -I.. -I.\chrtrans -I..\WWW\Library\Implementation 

+SET LIBS=-lslang -L..\WWW\Library\Implementation -lwww 

+SET CFLAGS=-O %INCLUDES% %DEFINES% 

+SET COMPILE_CMD=gcc -c %CFLAGS% 

+ 

+SET FILES=%FILES% DefaultStyle.c 

+SET FILES=%FILES% GridText.c 

+SET FILES=%FILES% HTAlert.c 

+SET FILES=%FILES% HTFWriter.c 

+SET FILES=%FILES% HTInit.c 

+SET FILES=%FILES% HTML.c 

+SET FILES=%FILES% LYBookmark.c 

+SET FILES=%FILES% LYCgi.c 

+SET FILES=%FILES% LYCharSets.c 

+SET FILES=%FILES% LYCharUtils.c 

+SET FILES=%FILES% LYClean.c 

+SET FILES=%FILES% LYCookie.c 

+SET FILES=%FILES% LYCurses.c 

+SET FILES=%FILES% LYDownload.c 

+ 

+PAUSE 

+for %%f in ( %FILES% ) do %COMPILE_CMD% %%f 

+PAUSE 

+ 

+SET FILES=LYEdit.c 

+SET FILES=%FILES% LYEditmap.c 

+SET FILES=%FILES% LYexit.c 

+SET FILES=%FILES% LYExtern.c 

+SET FILES=%FILES% LYForms.c 

+SET FILES=%FILES% LYGetFile.c 

+SET FILES=%FILES% LYHash.c 

+SET FILES=%FILES% LYHistory.c 

+SET FILES=%FILES% LYJump.c 

+SET FILES=%FILES% LYKeymap.c 

+SET FILES=%FILES% LYLeaks.c 

+SET FILES=%FILES% LYList.c 

+SET FILES=%FILES% LYLocal.c 

+SET FILES=%FILES% LYMail.c 

+SET FILES=%FILES% LYMain.c 

+SET FILES=%FILES% LYMainLoop.c 

+ 

+PAUSE 

+for %%f in ( %FILES% ) do %COMPILE_CMD% %%f 

+PAUSE 

+ 

+SET FILES=LYMap.c 

+SET FILES=%FILES% LYNews.c 

+SET FILES=%FILES% LYOptions.c 

+SET FILES=%FILES% LYPrettySrc.c 

+SET FILES=%FILES% LYPrint.c 

+SET FILES=%FILES% LYrcFile.c 

+SET FILES=%FILES% LYReadCFG.c 

+SET FILES=%FILES% LYSearch.c 

+SET FILES=%FILES% LYShowInfo.c 

+SET FILES=%FILES% LYStrings.c 

+SET FILES=%FILES% LYStyle.c 

+SET FILES=%FILES% LYTraversal.c 

+SET FILES=%FILES% LYUpload.c 

+SET FILES=%FILES% LYUtils.c 

+SET FILES=%FILES% mktime.c 

+SET FILES=%FILES% strstr.c 

+SET FILES=%FILES% UCAuto.c 

+SET FILES=%FILES% UCAux.c 

+SET FILES=%FILES% UCdomap.c 

+ 

+PAUSE 

+for %%f in ( %FILES% ) do %COMPILE_CMD% %%f 

+PAUSE 

+ 

+gcc -o lynx.exe %LIBS% 

+strip lynx.exe 

+ECHO "Welcome to lynx!" 

diff --git a/po/lynx.pot b/po/lynx.pot
index bbace9bd..67e9abc4 100644
--- a/po/lynx.pot
+++ b/po/lynx.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-10-19 21:50-0400\n"
+"POT-Creation-Date: 1999-11-02 21:18-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -2770,7 +2770,7 @@ msgstr ""
 #. * hack: if we fail in HTAccess.c
 #. * avoid duplicating URL, oh.
 #.
-#: WWW/Library/Implementation/HTAccess.c:1062 src/LYMainLoop.c:7399
+#: WWW/Library/Implementation/HTAccess.c:1062 src/LYMainLoop.c:7392
 msgid "Can't Access"
 msgstr ""
 
@@ -2823,11 +2823,11 @@ msgid "Receiving FTP file."
 msgstr ""
 
 #. lines counter
-#: WWW/Library/Implementation/HTFile.c:1707
+#: WWW/Library/Implementation/HTFile.c:1709
 msgid "Reading directory..."
 msgstr ""
 
-#: WWW/Library/Implementation/HTFile.c:1789
+#: WWW/Library/Implementation/HTFile.c:1791
 msgid "OK"
 msgstr ""
 
@@ -2993,7 +2993,7 @@ msgstr ""
 #. *  there will be other alerts from the callers. - kw
 #.
 #: WWW/Library/Implementation/HTTCP.c:1501
-#: WWW/Library/Implementation/HTTelnet.c:99
+#: WWW/Library/Implementation/HTTelnet.c:103
 #, c-format
 msgid "Invalid hostname %s"
 msgstr ""
@@ -3125,7 +3125,7 @@ msgstr ""
 msgid "Unknown status reply from server!"
 msgstr ""
 
-#: WWW/Library/Implementation/HTTelnet.c:97
+#: WWW/Library/Implementation/HTTelnet.c:101
 #, c-format
 msgid "remote %s session:"
 msgstr ""
@@ -3299,100 +3299,113 @@ msgstr ""
 msgid "Host"
 msgstr ""
 
-#: src/GridText.c:476
+#: src/GridText.c:613
 msgid "Memory exhausted, display interrupted!"
 msgstr ""
 
-#: src/GridText.c:481
+#: src/GridText.c:618
 msgid "Memory exhausted, will interrupt transfer!"
 msgstr ""
 
-#: src/GridText.c:3289
+#: src/GridText.c:3480
 msgid " *** MEMORY EXHAUSTED ***"
 msgstr ""
 
-#: src/GridText.c:5499 src/GridText.c:5506 src/LYList.c:260
+#: src/GridText.c:5741 src/GridText.c:5748 src/LYList.c:260
 msgid "unknown field or link"
 msgstr ""
 
-#: src/GridText.c:5515
+#: src/GridText.c:5757
 msgid "text entry field"
 msgstr ""
 
-#: src/GridText.c:5518
+#: src/GridText.c:5760
 msgid "password entry field"
 msgstr ""
 
-#: src/GridText.c:5521
+#: src/GridText.c:5763
 msgid "checkbox"
 msgstr ""
 
-#: src/GridText.c:5524
+#: src/GridText.c:5766
 msgid "radio button"
 msgstr ""
 
-#: src/GridText.c:5527
+#: src/GridText.c:5769
 msgid "submit button"
 msgstr ""
 
-#: src/GridText.c:5530
+#: src/GridText.c:5772
 msgid "reset button"
 msgstr ""
 
-#: src/GridText.c:5533
+#: src/GridText.c:5775
 msgid "popup menu"
 msgstr ""
 
-#: src/GridText.c:5536
+#: src/GridText.c:5778
 msgid "hidden form field"
 msgstr ""
 
-#: src/GridText.c:5539
+#: src/GridText.c:5781
 msgid "text entry area"
 msgstr ""
 
-#: src/GridText.c:5542
+#: src/GridText.c:5784
 msgid "range entry field"
 msgstr ""
 
-#: src/GridText.c:5545
+#: src/GridText.c:5787
 msgid "file entry field"
 msgstr ""
 
-#: src/GridText.c:5548
+#: src/GridText.c:5790
 msgid "text-submit field"
 msgstr ""
 
-#: src/GridText.c:5551
+#: src/GridText.c:5793
 msgid "image-submit button"
 msgstr ""
 
-#: src/GridText.c:5554
+#: src/GridText.c:5796
 msgid "keygen field"
 msgstr ""
 
-#: src/GridText.c:5557
+#: src/GridText.c:5799
 msgid "unknown form field"
 msgstr ""
 
-#: src/GridText.c:10490
+#: src/GridText.c:10748
 #, c-format
 msgid "Submitting %s"
 msgstr ""
 
-#: src/GridText.c:11772
+#: src/GridText.c:12047
 msgid "Editor killed by signal"
 msgstr ""
 
-#: src/GridText.c:11774
+#: src/GridText.c:12049
 #, c-format
 msgid "Editor returned with error status, %s"
 msgstr ""
 
-#: src/GridText.c:11775
+#: src/GridText.c:12050
 msgid "reason unknown."
 msgstr ""
 
+#. don't show previous state
+#: src/GridText.c:12146
+msgid "Wrap lines to fit displayed area?"
+msgstr ""
+
+#: src/GridText.c:12198
+msgid "Very long lines have been wrapped!"
+msgstr ""
+
+#: src/GridText.c:12647
+msgid "Very long lines have been truncated!"
+msgstr ""
+
 #: src/HTAlert.c:189 src/HTAlert.c:391 src/LYShowInfo.c:297
 msgid "bytes"
 msgstr ""
@@ -3445,31 +3458,56 @@ msgstr ""
 msgid ", %ld %s/sec."
 msgstr ""
 
-#: src/HTAlert.c:443
+#. Meta-note: don't move the following note from its place right
+#. in front of the first gettext().  As it is now, it should
+#. automatically appear in generated lynx.pot files. - kw
+#.
+#. NOTE TO TRANSLATORS:  If you provide a translation for "yes", lynx
+#. *  will take the first byte of the translation as a positive response
+#. *  to Yes/No questions.  If you provide a translation for "no", lynx
+#. *  will take the first byte of the translation as a negative response
+#. *  to Yes/No questions.  For both, lynx will also try to show the
+#. *  first byte in the prompt as a character, instead of (y) or (n),
+#. *  respectively.  This will not work right for multibyte charsets!
+#. *  Don't translate "yes" and "no" for CJK character sets (or translate
+#. *  them to "yes" and "no").  For a translation using UTF-8, don't
+#. *  translate if the translation would begin with anything but a 7-bit
+#. *  (US_ASCII) character.  That also means do not translate if the
+#. *  translation would begin with anything but a 7-bit character, if
+#. *  you use a single-byte character encoding (a charset like ISO-8859-n)
+#. *  but anticipate that the message catalog may be used re-encoded in
+#. *  UTF-8 form.
+#. *  For translations using other character sets, you may also wish to
+#. *  leave "yes" and "no" untranslated, if using (y) and (n) is the
+#. *  preferred behavior.
+#. *  Lynx will also accept y Y n N as responses unless there is a conflict
+#. *  with the first letter of the "yes" or "no" translation.
+#.
+#: src/HTAlert.c:469
 msgid "yes"
 msgstr ""
 
-#: src/HTAlert.c:444
+#: src/HTAlert.c:470
 msgid "no"
 msgstr ""
 
-#: src/HTML.c:6379
+#: src/HTML.c:6421
 msgid "Description:"
 msgstr ""
 
-#: src/HTML.c:6384
+#: src/HTML.c:6426
 msgid "(none)"
 msgstr ""
 
-#: src/HTML.c:6388
+#: src/HTML.c:6430
 msgid "Filepath:"
 msgstr ""
 
-#: src/HTML.c:6393
+#: src/HTML.c:6435
 msgid "(unknown)"
 msgstr ""
 
-#: src/HTML.c:7829
+#: src/HTML.c:7893
 msgid "Document has only hidden links.  Use the 'l'ist command."
 msgstr ""
 
@@ -3561,34 +3599,34 @@ msgstr ""
 msgid "Terminal initialisation failed - unknown terminal type?"
 msgstr ""
 
-#: src/LYCurses.c:1056
+#: src/LYCurses.c:1060
 msgid "Terminal ="
 msgstr ""
 
-#: src/LYCurses.c:1061
+#: src/LYCurses.c:1065
 msgid "You must use a vt100, 200, etc. terminal with this program."
 msgstr ""
 
-#: src/LYCurses.c:1139
+#: src/LYCurses.c:1143
 msgid "Your Terminal type is unknown!"
 msgstr ""
 
-#: src/LYCurses.c:1140
+#: src/LYCurses.c:1144
 msgid "Enter a terminal type:"
 msgstr ""
 
-#: src/LYCurses.c:1153
+#: src/LYCurses.c:1157
 msgid "TERMINAL TYPE IS SET TO"
 msgstr ""
 
-#: src/LYCurses.c:1433
+#: src/LYCurses.c:1437
 #, c-format
 msgid ""
 "\n"
 "A Fatal error has occurred in %s Ver. %s\n"
 msgstr ""
 
-#: src/LYCurses.c:1435
+#: src/LYCurses.c:1439
 msgid ""
 "\n"
 "Please notify your system administrator to confirm a bug, and if\n"
@@ -3622,7 +3660,7 @@ msgstr ""
 msgid "Save to disk disabled."
 msgstr ""
 
-#: src/LYDownload.c:558 src/LYPrint.c:1345
+#: src/LYDownload.c:558 src/LYPrint.c:1346
 msgid "Local additions:"
 msgstr ""
 
@@ -3630,27 +3668,27 @@ msgstr ""
 msgid "No Name Given"
 msgstr ""
 
-#: src/LYHistory.c:426
+#: src/LYHistory.c:430
 msgid "You selected:"
 msgstr ""
 
-#: src/LYHistory.c:450 src/LYHistory.c:632
+#: src/LYHistory.c:454 src/LYHistory.c:636
 msgid "(no address)"
 msgstr ""
 
-#: src/LYHistory.c:454
+#: src/LYHistory.c:458
 msgid " (internal)"
 msgstr ""
 
-#: src/LYHistory.c:456
+#: src/LYHistory.c:460
 msgid " (was internal)"
 msgstr ""
 
-#: src/LYHistory.c:554
+#: src/LYHistory.c:558
 msgid " (From History)"
 msgstr ""
 
-#: src/LYHistory.c:596
+#: src/LYHistory.c:600
 msgid "You visited (POSTs, bookmark, menu and list files excluded):"
 msgstr ""
 
@@ -4031,15 +4069,15 @@ msgstr ""
 msgid "Personal Name: "
 msgstr ""
 
-#: src/LYMain.c:803
+#: src/LYMain.c:796
 msgid "No Winsock found, sorry."
 msgstr ""
 
-#: src/LYMain.c:988
+#: src/LYMain.c:981
 msgid "You MUST define a valid TMP or TEMP area!\n"
 msgstr ""
 
-#: src/LYMain.c:1395
+#: src/LYMain.c:1388
 #, c-format
 msgid ""
 "\n"
@@ -4047,21 +4085,21 @@ msgid ""
 "\n"
 msgstr ""
 
-#: src/LYMain.c:1411
+#: src/LYMain.c:1404
 msgid ""
 "\n"
 "Lynx character sets not declared.\n"
 "\n"
 msgstr ""
 
-#: src/LYMain.c:1435
+#: src/LYMain.c:1428
 msgid ""
 "\n"
 "Lynx edit map not declared.\n"
 "\n"
 msgstr ""
 
-#: src/LYMain.c:1478
+#: src/LYMain.c:1471
 #, c-format
 msgid ""
 "\n"
@@ -4069,61 +4107,61 @@ msgid ""
 "\n"
 msgstr ""
 
-#: src/LYMain.c:1679
+#: src/LYMain.c:1672
 msgid "Warning:"
 msgstr ""
 
-#: src/LYMain.c:2170
+#: src/LYMain.c:2171
 msgid "persistent cookies state will be changed in next session only."
 msgstr ""
 
-#: src/LYMain.c:2442
+#: src/LYMain.c:2443
 #, c-format
 msgid "Lynx: ignoring unrecognized charset=%s\n"
 msgstr ""
 
-#: src/LYMain.c:2912
+#: src/LYMain.c:2914
 #, c-format
 msgid ""
 "\n"
 "%s Version %s (%.*s)\n"
 msgstr ""
 
-#: src/LYMain.c:2924
+#: src/LYMain.c:2926
 #, c-format
 msgid "Built on %s %s %s\n"
 msgstr ""
 
-#: src/LYMain.c:2928
+#: src/LYMain.c:2930
 msgid ""
 "Copyrights held by the University of Kansas, CERN, and other contributors.\n"
 msgstr ""
 
-#: src/LYMain.c:2930
+#: src/LYMain.c:2932
 msgid "Distributed under the GNU General Public License.\n"
 msgstr ""
 
-#: src/LYMain.c:2932
+#: src/LYMain.c:2934
 msgid ""
 "See http://lynx.browser.org/ and the online help for more information.\n"
 "\n"
 msgstr ""
 
-#: src/LYMain.c:3590
+#: src/LYMain.c:3591
 #, c-format
 msgid "USAGE: %s [options] [file]\n"
 msgstr ""
 
-#: src/LYMain.c:3591
+#: src/LYMain.c:3592
 msgid "Options are:\n"
 msgstr ""
 
-#: src/LYMain.c:3824
+#: src/LYMain.c:3825
 #, c-format
 msgid "%s: Invalid Option: %s\n"
 msgstr ""
 
-#: src/LYMainLoop.c:368
+#: src/LYMainLoop.c:372
 #, c-format
 msgid "Internal error: Invalid mouse link %d!"
 msgstr ""
@@ -4131,63 +4169,63 @@ msgstr ""
 #.
 #. * Make a name for this new URL.
 #.
-#: src/LYMainLoop.c:515
+#: src/LYMainLoop.c:519
 msgid "A URL specified by the user"
 msgstr ""
 
-#: src/LYMainLoop.c:961
+#: src/LYMainLoop.c:1011
 msgid "Enctype multipart/form-data not yet supported!  Cannot submit."
 msgstr ""
 
 #.
 #. *  Make a name for this help file.
 #.
-#: src/LYMainLoop.c:2940
+#: src/LYMainLoop.c:2963
 msgid "Help Screen"
 msgstr ""
 
-#: src/LYMainLoop.c:3079
+#: src/LYMainLoop.c:3102
 msgid "System Index"
 msgstr ""
 
-#: src/LYMainLoop.c:3457 src/LYMainLoop.c:5050
+#: src/LYMainLoop.c:3478 src/LYMainLoop.c:5042
 msgid "Entry into main screen"
 msgstr ""
 
-#: src/LYMainLoop.c:4031
+#: src/LYMainLoop.c:4052
 msgid "charset for this document specified explicitely, sorry..."
 msgstr ""
 
-#: src/LYMainLoop.c:5997
+#: src/LYMainLoop.c:5989
 msgid "Reparsing document under current settings..."
 msgstr ""
 
-#: src/LYMainLoop.c:6260 src/LYMainLoop.c:6264
+#: src/LYMainLoop.c:6253 src/LYMainLoop.c:6257
 #, c-format
 msgid "Fatal error - could not open output file %s\n"
 msgstr ""
 
-#: src/LYMainLoop.c:7318 src/LYMainLoop.c:7451
+#: src/LYMainLoop.c:7311 src/LYMainLoop.c:7444
 msgid "-index-"
 msgstr ""
 
-#: src/LYMainLoop.c:7359
+#: src/LYMainLoop.c:7352
 msgid "Inactive text input, activate to edit (e.g., press ENTER)"
 msgstr ""
 
-#: src/LYMainLoop.c:7394
+#: src/LYMainLoop.c:7387
 msgid "lynx: Can't access startfile"
 msgstr ""
 
-#: src/LYMainLoop.c:7407
+#: src/LYMainLoop.c:7400
 msgid "lynx: Start file could not be found or is not text/html or text/plain"
 msgstr ""
 
-#: src/LYMainLoop.c:7408
+#: src/LYMainLoop.c:7401
 msgid "      Exiting..."
 msgstr ""
 
-#: src/LYMainLoop.c:7449
+#: src/LYMainLoop.c:7442
 msgid "-more-"
 msgstr ""
 
@@ -4423,67 +4461,67 @@ msgstr ""
 msgid "User-Agent header"
 msgstr ""
 
-#: src/LYPrint.c:785
+#: src/LYPrint.c:786
 msgid "Sending"
 msgstr ""
 
-#: src/LYPrint.c:966
+#: src/LYPrint.c:967
 msgid " Print job complete.\n"
 msgstr ""
 
-#: src/LYPrint.c:1303
+#: src/LYPrint.c:1304
 msgid "Document:"
 msgstr ""
 
-#: src/LYPrint.c:1304
+#: src/LYPrint.c:1305
 msgid "Number of lines:"
 msgstr ""
 
-#: src/LYPrint.c:1305
+#: src/LYPrint.c:1306
 msgid "Number of pages:"
 msgstr ""
 
-#: src/LYPrint.c:1306
+#: src/LYPrint.c:1307
 msgid "pages"
 msgstr ""
 
-#: src/LYPrint.c:1306
+#: src/LYPrint.c:1307
 msgid "page"
 msgstr ""
 
-#: src/LYPrint.c:1307
+#: src/LYPrint.c:1308
 msgid "(approximately)"
 msgstr ""
 
-#: src/LYPrint.c:1312
+#: src/LYPrint.c:1313
 msgid "Some print functions have been disabled!"
 msgstr ""
 
-#: src/LYPrint.c:1316
+#: src/LYPrint.c:1317
 msgid "Standard print options:"
 msgstr ""
 
-#: src/LYPrint.c:1317
+#: src/LYPrint.c:1318
 msgid "Print options:"
 msgstr ""
 
-#: src/LYPrint.c:1323
+#: src/LYPrint.c:1324
 msgid "Save to a local file"
 msgstr ""
 
-#: src/LYPrint.c:1325
+#: src/LYPrint.c:1326
 msgid "Save to disk disabled"
 msgstr ""
 
-#: src/LYPrint.c:1331
+#: src/LYPrint.c:1332
 msgid "Mail the file"
 msgstr ""
 
-#: src/LYPrint.c:1337
+#: src/LYPrint.c:1338
 msgid "Print to the screen"
 msgstr ""
 
-#: src/LYPrint.c:1341
+#: src/LYPrint.c:1342
 msgid "Print out on a printer attached to your vt100 terminal"
 msgstr ""
 
@@ -4506,58 +4544,58 @@ msgstr ""
 msgid "key remapping of %s to %s failed\n"
 msgstr ""
 
-#: src/LYReadCFG.c:670 src/LYReadCFG.c:683
+#: src/LYReadCFG.c:684 src/LYReadCFG.c:697
 #, c-format
 msgid ""
 "setting of line-editor binding for key %s (0x%x) to 0x%x for %s failed\n"
 msgstr ""
 
-#: src/LYReadCFG.c:688
+#: src/LYReadCFG.c:702
 #, c-format
 msgid "setting of line-editor binding for key %s (0x%x) for %s failed\n"
 msgstr ""
 
-#: src/LYReadCFG.c:793
+#: src/LYReadCFG.c:807
 #, c-format
 msgid "Lynx: cannot start, CERN rules file %s is not available\n"
 msgstr ""
 
-#: src/LYReadCFG.c:795
+#: src/LYReadCFG.c:809
 msgid "(no name)"
 msgstr ""
 
-#: src/LYReadCFG.c:1550
+#: src/LYReadCFG.c:1563
 #, c-format
 msgid "More than %d nested lynx.cfg includes -- perhaps there is a loop?!?\n"
 msgstr ""
 
-#: src/LYReadCFG.c:1552
+#: src/LYReadCFG.c:1565
 #, c-format
 msgid "Last attempted include was '%s',\n"
 msgstr ""
 
-#: src/LYReadCFG.c:1553
+#: src/LYReadCFG.c:1566
 #, c-format
 msgid "included from '%s'.\n"
 msgstr ""
 
-#: src/LYReadCFG.c:2013 src/LYReadCFG.c:2026 src/LYReadCFG.c:2054
+#: src/LYReadCFG.c:2026 src/LYReadCFG.c:2039 src/LYReadCFG.c:2067
 msgid "The following is read from your lynx.cfg file."
 msgstr ""
 
-#: src/LYReadCFG.c:2014 src/LYReadCFG.c:2027
+#: src/LYReadCFG.c:2027 src/LYReadCFG.c:2040
 msgid "Please read the distribution"
 msgstr ""
 
-#: src/LYReadCFG.c:2020 src/LYReadCFG.c:2030
+#: src/LYReadCFG.c:2033 src/LYReadCFG.c:2043
 msgid "for more comments."
 msgstr ""
 
-#: src/LYReadCFG.c:2036
+#: src/LYReadCFG.c:2049
 msgid "RELOAD THE CHANGES"
 msgstr ""
 
-#: src/LYReadCFG.c:2045
+#: src/LYReadCFG.c:2058
 msgid "Your primary configuration"
 msgstr ""
 
@@ -4800,7 +4838,7 @@ msgstr ""
 msgid "Restrictions set:\n"
 msgstr ""
 
-#: src/LYUtils.c:5428
+#: src/LYUtils.c:5431
 msgid "Ignoring invalid HOME"
 msgstr ""
 
diff --git a/src/GridText.c b/src/GridText.c
index 6b89dc21..8aae54af 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -92,6 +92,7 @@ struct _HTStream {			/* only know it as object */
 #define TITLE_LINES  1
 #define IS_UTF_EXTRA(ch) (text->T.output_utf8 && \
 			  ((unsigned char)(ch)&0xc0) == 0x80)
+/* a test in compact form: how many extra UTF-8 chars after initial? - kw */
 #define UTF8_XNEGLEN(c) (c&0xC0? 0 :c&32? 1 :c&16? 2 :c&8? 3 :c&4? 4 :c&2? 5:0)
 #define UTF_XLEN(c) UTF8_XNEGLEN(((char)~(c)))
 
@@ -144,12 +145,22 @@ PUBLIC int LYsb_end = -1;
 #if defined(USE_COLOR_STYLE)
 #define MAX_STYLES_ON_LINE 64
 
+#ifdef OLD_HTSTYLECHANGE
 typedef struct _stylechange {
 	int	horizpos;	/* horizontal position of this change */
 	int	style;		/* which style to change to */
 	int	direction;	/* on or off */
 	int	previous;	/* previous style */
 } HTStyleChange;
+#else
+    /*try to fit in 2 shorts*/
+typedef struct _stylechange {
+	unsigned int	direction:2;	/* on or off */
+	unsigned int	horizpos: (sizeof(short)*CHAR_BIT-2);
+	    /* horizontal position of this change */
+	unsigned short	style;		/* which style to change to */
+} HTStyleChange;
+#endif
 #endif
 
 typedef struct _line {
@@ -161,12 +172,134 @@ typedef struct _line {
 	BOOL	bullet;			/* Do we bullet? */
 	BOOL	expansion_line;		/* TEXTAREA edit new line flag */
 #if defined(USE_COLOR_STYLE)
+#ifdef OLD_HTSTYLECHANGE
 	HTStyleChange	styles[MAX_STYLES_ON_LINE];
+#else
+	HTStyleChange* styles;
+#endif
 	int	numstyles;
 #endif
 	char	data[1];		/* Space for terminator at least! */
 } HTLine;
 
+#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE)
+typedef struct _HTStyleChangePool {
+	HTStyleChange	data[4092];
+	struct _HTStyleChangePool* next;
+	int free_items;
+} HTStyleChangePool;
+
+/*these are used when current line is being aggregated. */
+HTStyleChange stylechanges_buffers[2][MAX_STYLES_ON_LINE];
+int stylechanges_buffers_free;/*this is an index of the free buffer.
+    Can be 0 or 1*/
+
+/* These are generic macors for any pools (provided those structures have the
+same members as HTStyleChangePool).  Pools are used for allocation of groups of
+objects of the same type T.  Pools are represented as a list of structures of
+type P (called pool chunks here).  Structure P has an array of N objects of
+type T named 'data' (the number N in the array can be chosen arbitrary),
+pointer to the next pool chunk named 'pool', and the number of free items in
+that pool chunk named 'free_items'.  Here is a definition of the structure P:
+	struct P
+	{
+	    T data[N];
+	    struct P* next;
+	    int free_items;
+	};
+ It's recommended that sizeof(P) be memory page size minus 32 in order malloc'd
+chunks to fit in machine page size.
+ Allocation of 'n' items in the pool is implemented by decrementing member
+'free_items' by 'n' if 'free_items' >= 'n', or allocating a new pool chunk and
+allocating 'n' items in that new chunk.  It's the task of the programmer to
+assert that 'n' is <= N.  Only entire pool may be freed - this limitation makes
+allocation algorithms trivial and fast - so the use of pools is limited to
+objects that are freed in batch, that are not deallocated not in the batch, and
+not reallocated.
+ Pools greatly reduce memory fragmentation and memory allocation/deallocation
+speed due to the simple algorithms used.  Due to the fact that memory is
+'allocated' in array, alignment overhead is minimal.  Allocating strings in a
+pool provided their length will never exceed N and is much smaller than N seems
+to be very efficient.
+
+ Pool are referenced by pointer to the chunk that contains free slots. Macros
+that allocate memory in pools update that pointer if needed.
+ There are 3 macros that deal with pools - POOL_NEW, POOL_FREE and
+ALLOC_IN_POOL.
+ Here is a description of those macros as C++ functions (with names mentioned
+above and with use of C++ references)
+
+void ALLOC_IN_POOL( P*& pool, pool_type, int toalloc, T*& ptr)
+    - allocates 'toalloc' items in the pool of type 'pool_type' pointed by
+    'pool', sets the pointer 'ptr' to the "allocated" memory and updates 'pool'
+    if necessary. Sets 'ptr' to NULL if fails.
+
+void POOL_NEW( pool_type  , P*& ptr)
+    Initializes a pool of type 'pool_type' pointed by 'ptr', updating 'ptr'.
+    Sets 'ptr' to NULL if fails.
+
+void POOL_FREE( pool_type , P* ptr)
+    Frees a pool of type 'pool_type' pointed by ptr.
+
+      - VH */
+
+/*
+void ALLOC_IN_POOL( P*& pool, pool_type, int toalloc, T*& ptr)
+    - allocates 'toalloc' items in the pool of type 'pool_type' pointed by
+    'pool', sets the pointer 'ptr' to the "allocated" memory and updates 'pool'
+    if necessary. Sets 'ptr' to NULL if fails.
+*/
+#define ALLOC_IN_POOL(pool,pool_type,toalloc,ptr)     \
+if (!pool)  \
+    ptr = NULL; \
+else { \
+    if ((pool)->free_items > toalloc) { \
+	(pool)->free_items -= toalloc; \
+	ptr = (pool)->data + (pool)->free_items; \
+    } else { \
+	pool_type* newpool = (pool_type*)malloc(sizeof(pool_type)); \
+	if (!newpool) { \
+	    ptr = NULL; \
+	} else { \
+	    newpool->next = pool; \
+	    newpool->free_items = sizeof newpool->data/ \
+		    sizeof newpool->data[0] - toalloc; \
+	    pool = newpool; \
+	    ptr = newpool->data + sizeof newpool->data/sizeof newpool->data[0] - toalloc; \
+	} \
+    } \
+}
+/*
+void POOL_NEW( pool_type  , P*& ptr)
+    Initializes a pool of type 'pool_type' pointed by 'ptr', updating 'ptr'.
+    Sets 'ptr' to NULL if fails.
+*/
+#define POOL_NEW(pool_type,ptr) \
+    { \
+	pool_type* newpool = (pool_type*)malloc(sizeof(pool_type)); \
+	if (!newpool) { \
+	    ptr = NULL; \
+	} else { \
+	    newpool->next = NULL; \
+	    newpool->free_items = sizeof newpool->data/sizeof newpool->data[0]; \
+	    ptr = newpool; \
+	} \
+    }
+/*
+void POOL_FREE( pool_type , P* ptr)
+    Frees a pool of type 'pool_type' pointed by ptr.
+*/
+#define POOL_FREE(pool_type,xptr) \
+    { \
+	pool_type* ptr = xptr; \
+	do { \
+	    pool_type* prevpool = ptr; \
+	    ptr = ptr->next; \
+	    FREE(prevpool); \
+	} while (ptr); \
+    }
+#endif
+
 #define LINE_SIZE(l) (sizeof(HTLine)+(l))	/* Allow for terminator */
 
 typedef struct _TextAnchor {
@@ -245,6 +378,7 @@ struct _HText {
 	BOOL			stale;			/* Must refresh */
 	BOOL			page_has_target; /* has target on screen */
 	BOOL			has_utf8; /* has utf-8 on screen or line */
+	BOOL			had_utf8; /* had utf-8 when last displayed */
 #ifdef DISP_PARTIAL
 	int			first_lineno_last_disp_partial;
 	int			last_lineno_last_disp_partial;
@@ -267,6 +401,9 @@ struct _HText {
 
 	HTStream *		target;			/* Output stream */
 	HTStreamClass		targetClass;		/* Output routines */
+#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE)
+	HTStyleChangePool*	styles_pool;
+#endif
 };
 
 PRIVATE void HText_AddHiddenLink PARAMS((HText *text, TextAnchor *textanchor));
@@ -552,6 +689,22 @@ PUBLIC HText *	HText_new ARGS1(
     CTRACE((tfp, "GridText: VMTotal = %d\n", VMTotal));
 #endif /* VMS && VAXC && !__DECC */
 
+    /*
+     *  If the previously shown text had UTF-8 characters on screen,
+     *  remember this in the newly created object.  Do this now, before
+     *  the previous object may become invalid. - kw
+     */
+    if (HTMainText) {
+	if (HText_hasUTF8OutputSet(HTMainText) &&
+	    HTLoadedDocumentEightbit() &&
+	    LYCharSet_UC[current_char_set].enc == UCT_ENC_UTF8) {
+	    self->had_utf8 = HTMainText->has_utf8;
+	} else {
+	    self->had_utf8 = HTMainText->has_utf8;
+	}
+	HTMainText->has_utf8 = NO;
+    }
+
     if (!loaded_texts)	{
 	loaded_texts = HTList_new();
 #ifdef LY_FIND_LEAKS
@@ -597,6 +750,13 @@ PUBLIC HText *	HText_new ARGS1(
     line->offset = line->size = 0;
 #ifdef USE_COLOR_STYLE
     line->numstyles = 0;
+#ifndef  OLD_HTSTYLECHANGE
+    POOL_NEW(HTStyleChangePool,self->styles_pool);
+    if (!self->styles_pool)
+	outofmem(__FILE__, "HText_New");
+    stylechanges_buffers_free = 0;
+    line->styles = stylechanges_buffers[0];
+#endif
 #endif
     self->Lines = self->chars = 0;
     self->first_anchor = self->last_anchor = NULL;
@@ -757,7 +917,9 @@ PUBLIC void HText_free ARGS1(
 	return;
 
     HTAnchor_setDocument(self->node_anchor, (HyperDoc *)0);
-
+#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE)
+    POOL_FREE(HTStyleChangePool,self->styles_pool);
+#endif
     while (YES) {	/* Free off line array */
 	HTLine * l = self->last_line;
 	if (l) {
@@ -967,13 +1129,13 @@ PRIVATE int display_line ARGS4(
 	if (case_sensitive)
 	    cp_tgt = LYno_attr_mbcs_strstr(data,
 					   target,
-					   text->T.output_utf8,
+					   text->T.output_utf8, YES,
 					   &HitOffset,
 					   &LenNeeded);
 	else
 	    cp_tgt = LYno_attr_mbcs_case_strstr(data,
 						target,
-						text->T.output_utf8,
+						text->T.output_utf8, YES,
 						&HitOffset,
 						&LenNeeded);
 	if (cp_tgt) {
@@ -1001,13 +1163,13 @@ PRIVATE int display_line ARGS4(
 		if (case_sensitive)
 		    cp_tgt = LYno_attr_mbcs_strstr(data,
 						target,
-						text->T.output_utf8,
+						text->T.output_utf8, YES,
 						&HitOffset,
 						&LenNeeded);
 		else
 		    cp_tgt = LYno_attr_mbcs_case_strstr(data,
 						     target,
-						text->T.output_utf8,
+						text->T.output_utf8, YES,
 						&HitOffset,
 						&LenNeeded);
 		if (cp_tgt) {
@@ -1135,7 +1297,7 @@ PRIVATE int display_line ARGS4(
 #endif /* SHOW_WHEREIS_TARGETS */
 #endif /* USE_COLOR_STYLE */
 		i++;
-		if (text->T.output_utf8 && !isascii(buffer[0])) {
+		if (text->T.output_utf8 && !isascii((unsigned char)buffer[0])) {
 		    text->has_utf8 = YES;
 		    if ((*buffer & 0xe0) == 0xc0) {
 			utf_extra = 1;
@@ -1168,7 +1330,7 @@ PRIVATE int display_line ARGS4(
 		    buffer[1] = '\0';
 		    data += utf_extra;
 		    utf_extra = 0;
-		} else if (HTCJK != NOCJK && !isascii(buffer[0])) {
+		} else if (HTCJK != NOCJK && !isascii((unsigned char)buffer[0])) {
 		    /*
 		     *  For CJK strings, by Masanobu Kimura.
 		     */
@@ -1677,7 +1839,14 @@ PRIVATE void display_page ARGS3(
     if (line) {
 #if defined(USE_COLOR_STYLE) && defined(SHOW_WHEREIS_TARGETS)
 	char *data;
-	int offset, HitOffset, LenNeeded;
+	int offset, LenNeeded;
+#endif
+#ifdef DISP_PARTIAL
+	if (display_partial ||
+	    line_number != text->first_lineno_last_disp_partial)
+	    text->has_utf8 = NO;
+#else
+	text->has_utf8 = NO;
 #endif
 	for (i = 0; i < (display_lines); i++)  {
 	    /*
@@ -1722,13 +1891,13 @@ PRIVATE void display_page ARGS3(
 		   (case_sensitive ?
 		    (cp = LYno_attr_mbcs_strstr(data,
 						target,
-						text->T.output_utf8,
-						&HitOffset,
+						text->T.output_utf8, YES,
+						NULL,
 						&LenNeeded)) != NULL :
 		    (cp = LYno_attr_mbcs_case_strstr(data,
 						     target,
-						text->T.output_utf8,
-						&HitOffset,
+						text->T.output_utf8, YES,
+						NULL,
 						&LenNeeded)) != NULL) &&
 		   ((int)line->offset + LenNeeded) < LYcols) {
 		int itmp = 0;
@@ -1767,7 +1936,7 @@ PRIVATE void display_page ARGS3(
 			/*
 			 *  Output all the printable target chars.
 			 */
-			if (text->T.output_utf8 && !isascii(tmp[0])) {
+			if (text->T.output_utf8 && !isascii((unsigned char)tmp[0])) {
 			    if ((*tmp & 0xe0) == 0xc0) {
 				utf_extra = 1;
 			    } else if ((*tmp & 0xf0) == 0xe0) {
@@ -1799,7 +1968,7 @@ PRIVATE void display_page ARGS3(
 			    tmp[1] = '\0';
 			    written += (utf_extra + 1);
 			    utf_extra = 0;
-			} else if (HTCJK != NOCJK && !isascii(tmp[0])) {
+			} else if (HTCJK != NOCJK && !isascii((unsigned char)tmp[0])) {
 			    /*
 			     *  For CJK strings, by Masanobu Kimura.
 			     */
@@ -2072,11 +2241,12 @@ PRIVATE void display_page ARGS3(
     }
 #endif /* DISP_PARTIAL */
 
-    if (text->has_utf8) {
+    if (text->has_utf8 || text->had_utf8) {
 	/*
 	 *  For other than ncurses, repainting is taken care of
 	 *  by touching lines in display_line and highlight. - kw 1999-10-07
 	 */
+	text->had_utf8 = text->has_utf8;
 	clearok(curscr, TRUE);
     } else if (HTCJK != NOCJK) {
 	/*
@@ -2087,7 +2257,6 @@ PRIVATE void display_page ARGS3(
 	/*clearok(curscr, TRUE);*/
     }
     refresh();
-
 }
 
 
@@ -2107,13 +2276,18 @@ PUBLIC void HText_beginAppend ARGS1(
 
 /* LYcols_cu is the notion that the display library has of the screen
    width.  Normally it is the same as LYcols, but there may be a
-   difference via SLANG_MBCS_HACK.  LYcols_cu is used to try to prevent
-   that the display library wraps or truncates a line with UTF-8 chars
-   when it shouldn't. - kw */
+   difference via SLANG_MBCS_HACK.  Checks of the line length (as the
+   non-UTF-8-aware display library would see it) against LYcols_cu are
+   is used to try to prevent that lines with UTF-8 chars get wrapped
+   by the library when they shouldn't.
+   If there is no display library involved, i.e. dump_output_immediately,
+   no such limit should be imposed.  LYcols*6 should be just as good
+   as any other large value.  (But don't use INT_MAX or something close
+   to it to, avoid over/underflow.) - kw */
 #ifdef USE_SLANG
-#define LYcols_cu SLtt_Screen_Cols
+#define LYcols_cu (dump_output_immediately ? LYcols*6 : SLtt_Screen_Cols)
 #else
-#define LYcols_cu LYcols
+#define LYcols_cu (dump_output_immediately ? LYcols*6 : LYcols)
 #endif
 
 /*	Add a new line of text
@@ -2147,6 +2321,7 @@ PRIVATE void split_line ARGS2(
 #endif
     int indent = text->in_line_1 ?
 	  text->style->indent1st : text->style->leftIndent;
+    short alignment;
     TextAnchor * a;
     int CurLine = text->Lines;
     int HeadTrim = 0;
@@ -2166,7 +2341,9 @@ PRIVATE void split_line ARGS2(
     HTLine * line = (HTLine *)LY_CALLOC(1, LINE_SIZE(MAX_LINE)+2);
     if (line == NULL)
 	outofmem(__FILE__, "split_line_1");
-
+#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE)
+    line->styles = stylechanges_buffers[stylechanges_buffers_free = (stylechanges_buffers_free + 1) &1];
+#endif
     ctrl_chars_on_this_line = 0; /*reset since we are going to a new line*/
     utfxtra_on_this_line = 0;	/*reset too, we'll count them*/
     text->LastChar = ' ';
@@ -2219,6 +2396,7 @@ PRIVATE void split_line ARGS2(
 	ctrl_chars_on_this_line++;
     }
 
+    alignment = style->alignment;
     /*
      *  Split at required point
      */
@@ -2251,9 +2429,9 @@ PRIVATE void split_line ARGS2(
 
 		(HeadTrim || text->first_anchor ||
 		 underline_on || bold_on ||
-		 text->style->alignment != HT_LEFT ||
-		 text->style->wordWrap || text->style->freeFormat ||
-		 text->style->spaceBefore || text->style->spaceAfter)) ||
+		 alignment != HT_LEFT ||
+		 style->wordWrap || style->freeFormat ||
+		 style->spaceBefore || style->spaceAfter)) ||
 	       *p == LY_SOFT_HYPHEN) {
 	    p++;
 	    HeadTrim++;
@@ -2383,9 +2561,9 @@ PRIVATE void split_line ARGS2(
 #endif
 	   (ctrl_chars_on_this_line || HeadTrim || text->first_anchor ||
 	    underline_on || bold_on ||
-	    text->style->alignment != HT_LEFT ||
-	    text->style->wordWrap || text->style->freeFormat ||
-	    text->style->spaceBefore || text->style->spaceAfter)) {
+	    alignment != HT_LEFT ||
+	    style->wordWrap || style->freeFormat ||
+	    style->spaceBefore || style->spaceAfter)) {
 	/*
 	 *  Strip trailers.
 	 */
@@ -2562,6 +2740,12 @@ PRIVATE void split_line ARGS2(
     if (temp == NULL)
 	outofmem(__FILE__, "split_line_2");
     memcpy(temp, previous, LINE_SIZE(previous->size));
+#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE)
+    ALLOC_IN_POOL((text->styles_pool),HTStyleChangePool,previous->numstyles,temp->styles);
+    memcpy(temp->styles, previous->styles, sizeof(HTStyleChange)*previous->numstyles);
+    if (!temp->styles)
+	outofmem(__FILE__, "split_line_2");
+#endif
     FREE(previous);
     previous = temp;
 
@@ -2581,8 +2765,8 @@ PRIVATE void split_line ARGS2(
 #ifdef EXP_JUSTIFY_ELTS
 	this_line_was_splitted ||
 #endif
-	(style->alignment == HT_CENTER ||
-	 style->alignment == HT_RIGHT) || text->stbl) {
+	(alignment == HT_CENTER ||
+	 alignment == HT_RIGHT) || text->stbl) {
 	/* Calculate spare character positions if needed */
 	for (cp = previous->data; *cp; cp++) {
 	    if (*cp == LY_UNDERLINE_START_CHAR ||
@@ -2600,7 +2784,9 @@ PRIVATE void split_line ARGS2(
 	spare =  (LYcols-1) -
 	    (int)style->rightIndent - indent +
 	    ctrl_chars_on_previous_line - previous->size;
-	if (spare > 0 && text->T.output_utf8 && ctrl_chars_on_previous_line) {
+
+	if (spare > 0 && !dump_output_immediately &&
+	    text->T.output_utf8 && ctrl_chars_on_previous_line) {
 	    utfxtra_on_previous_line -= utfxtra_on_this_line;
 	    if (utfxtra_on_previous_line) {
 		int spare_cu = (LYcols_cu-1) -
@@ -2611,13 +2797,30 @@ PRIVATE void split_line ARGS2(
 		     *  mishandled by the display library towards the left
 		     *  if this would make them fit.  The resulting display
 		     *  will not be as intended, but this is better than
-		     *  having them split by curses.  (But that may still
-		     *  happen anyway by curses space movement optimization).
+		     *  having them split by curses.  (Curses cursor movement
+		     *  optimization may still cause wrong positioning within
+		     *  the line, in particular after a sequence of spaces).
 		     * - kw
 		     */
 		if (spare_cu < spare) {
 		    if (spare_cu >= 0) {
-			spare = spare_cu;
+			if (alignment == HT_CENTER &&
+			    (int)(previous->offset + indent + spare/2 +
+				  previous->size)
+			    - ctrl_chars_on_previous_line
+			    + utfxtra_on_previous_line <= (LYcols_cu - 1))
+			    /* do nothing - it still fits - kw */;
+			else {
+			    spare = spare_cu;
+			    if (alignment == HT_CENTER) {
+				/*
+				 *  Can't move towars center all the way,
+				 *  but at least make line contents appear
+				 *  as far right as possible. - kw
+				 */
+				alignment = HT_RIGHT;
+			    }
+			}
 		    } else if (indent + (int)previous->offset + spare_cu >= 0)
 		    { /* subtract overdraft from effective indentation */
 			indent += (int)previous->offset + spare_cu;
@@ -2636,7 +2839,10 @@ PRIVATE void split_line ARGS2(
 	 *  its row should really end here, or on one of the following
 	 *  lines with no more characters added after the break.
 	 *  We don't know whether a cell has been started, so ignore
-	 *  errors here. - kw
+	 *  errors here.
+	 *  This call is down here because we need the
+	 *  ctrl_chars_on_previous_line, which have just been re-
+	 *  counted above. - kw
 	 */
 	Stbl_lineBreak(text->stbl,
 		       text->Lines - 1,
@@ -2848,7 +3054,7 @@ PRIVATE void split_line ARGS2(
 		*jp = ' ';	/* substitute it */
 		continue;
 	    }
-	    if (text->T.output_utf8 && !isascii(c)) {
+	    if (text->T.output_utf8 && !isascii((unsigned char)c)) {
 		int utf_extra = 0;
 		if ((c & 0xe0) == 0xc0) {
 		    utf_extra = 1;
@@ -2877,7 +3083,9 @@ PRIVATE void split_line ARGS2(
 	    jline = (HTLine *)LY_CALLOC(1, LINE_SIZE(previous->size+spare));
 	    if (jline == NULL)
 		outofmem(__FILE__, "split_line_1");
-
+#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE)
+	    jline->styles = previous->styles;
+#endif
 	    jdata = jline->data;
 
 	    /*
@@ -2943,8 +3151,9 @@ PRIVATE void split_line ARGS2(
 
 		jline->styles[i].style = previous->styles[i].style;
 		jline->styles[i].direction = previous->styles[i].direction;
+#ifdef OLD_HTSTYLECHANGE
 		jline->styles[i].previous = previous->styles[i].previous;
-
+#endif
 		/*there are stylechanges with hpos > line length */
 		jline->styles[i].horizpos = (hpos > previous->size)
 			? previous->size + spare
@@ -3539,10 +3748,15 @@ PUBLIC void HText_appendCharacter ARGS2(
     }
 
     if (text->T.output_utf8) {
+	/*
+	 *  Some extra checks for UTF-8 output here to make sure
+	 *  memory is not overrun.  For a non-first char, append
+	 *  to the line here and return. - kw
+	 */
 	if (IS_UTF_EXTRA(ch)) {
 	    if ((line->size > (MAX_LINE-1))
 		|| (indent + (int)(line->offset + line->size) +
-		    utfx - ctrl_chars_on_this_line +
+		    utfxtra_on_this_line - ctrl_chars_on_this_line +
 		    ((line->size > 0) &&
 		     (int)(line->data[line->size-1] ==
 				LY_SOFT_HYPHEN ?
@@ -3570,11 +3784,11 @@ PUBLIC void HText_appendCharacter ARGS2(
 	    utfxtra_on_this_line++;
 	    ctrl_chars_on_this_line++;
 	    return;
-	} else if (ch & 0x80) {
+	} else if (ch & 0x80) {	/* a first char of UTF-8 sequence - kw */
 	    if ((line->size > (MAX_LINE-7))
-#if 0	/* the equivalent should already happen below */
+#if 0	/* the equivalent check should already happen below */
 		|| (indent + (int)(line->offset + line->size) +
-		    utfx - ctrl_chars_on_this_line +
+		    utfxtra_on_this_line - ctrl_chars_on_this_line +
 		    ((line->size > 0) &&
 		     (int)(line->data[line->size-1] ==
 				LY_SOFT_HYPHEN ?
@@ -3722,7 +3936,7 @@ PUBLIC void HText_appendCharacter ARGS2(
 	}
 	return;
     } /* if tab */
-    else if (text->source && text == HTMainText) {
+    else if ( (text->source || dont_wrap_pre) && text == HTMainText) {
 	/*
 	 * If we're displaying document source, wrap long lines to keep all of
 	 * the source visible.
@@ -4440,6 +4654,7 @@ PUBLIC void HText_cancelStbl ARGS1(
     Stbl_free(me->stbl);
     me->stbl = NULL;
 }
+
 /*	Start simple table handling
 */
 PUBLIC void HText_startStblTABLE ARGS2(
@@ -4458,6 +4673,7 @@ PUBLIC void HText_startStblTABLE ARGS2(
 	CTRACE((tfp, "startStblTABLE: failed.\n"));
     }
 }
+
 /*	Finish simple table handling
 */
 PUBLIC void HText_endStblTABLE ARGS1(
@@ -4478,6 +4694,7 @@ PUBLIC void HText_endStblTABLE ARGS1(
     Stbl_free(me->stbl);
     me->stbl = NULL;
 }
+
 /*	Start simple table row
 */
 PUBLIC void HText_startStblTR ARGS2(
@@ -4489,6 +4706,7 @@ PUBLIC void HText_startStblTR ARGS2(
     if (Stbl_addRowToTable(me->stbl, alignment, me->Lines) < 0)
 	HText_cancelStbl(me);	/* give up */
 }
+
 /*	Finish simple table row
 */
 PUBLIC void HText_endStblTR ARGS1(
@@ -4498,11 +4716,13 @@ PUBLIC void HText_endStblTR ARGS1(
 	return;
     /* should this do something?? */
 }
-/*	Finish simple table cell
+
+/*	Start simple table cell
 */
-PUBLIC void HText_startStblTD ARGS4(
+PUBLIC void HText_startStblTD ARGS5(
 	HText *,	me,
 	int,		colspan,
+	int,		rowspan,
 	short,		alignment,
 	BOOL,		isheader)
 {
@@ -4510,10 +4730,11 @@ PUBLIC void HText_startStblTD ARGS4(
 	return;
     if (colspan <= 0)
 	colspan = 1;
-    if (Stbl_addCellToTable(me->stbl, colspan, alignment, isheader,
+    if (Stbl_addCellToTable(me->stbl, colspan, rowspan, alignment, isheader,
 			    me->Lines, HText_LastLineSize(me,FALSE)) < 0)
 	HText_cancelStbl(me);	/* give up */
 }
+
 /*	Finish simple table cell
 */
 PUBLIC void HText_endStblTD ARGS1(
@@ -4526,6 +4747,45 @@ PUBLIC void HText_endStblTD ARGS1(
 	HText_cancelStbl(me);	/* give up */
 }
 
+/*	Remember COL info / Start a COLGROUP and remember info
+*/
+PUBLIC void HText_startStblCOL ARGS4(
+	HText *,	me,
+	int,		span,
+	short,		alignment,
+	BOOL,		isgroup)
+{
+    if (!me || !me->stbl)
+	return;
+    if (span <= 0)
+	span = 1;
+    if (Stbl_addColInfo(me->stbl, span, alignment, isgroup) < 0)
+	HText_cancelStbl(me);	/* give up */
+}
+
+/*	Finish a COLGROUP
+*/
+PUBLIC void HText_endStblCOLGROUP ARGS1(
+	HText *,	me)
+{
+    if (!me || !me->stbl)
+	return;
+    if (Stbl_finishColGroup(me->stbl) < 0)
+	HText_cancelStbl(me);	/* give up */
+}
+
+/*	Start a THEAD / TFOOT / TBODY - remember its alignment info
+*/
+PUBLIC void HText_startStblRowGroup ARGS2(
+	HText *,	me,
+	short,		alignment)
+{
+    if (!me || !me->stbl)
+	return;
+    if (Stbl_addRowGroup(me->stbl, alignment) < 0)
+	HText_cancelStbl(me);	/* give up */
+}
+
 /*		Anchor handling
 **		---------------
 */
@@ -6091,12 +6351,12 @@ PUBLIC BOOL HText_getFirstTargetInLine ARGS7(
     if ((case_sensitive ?
 	 (cp = LYno_attr_mbcs_strstr(LineData,
 				     target,
-				     utf_flag,
+				     utf_flag, YES,
 				     &HitOffset,
 				     &LenNeeded)) != NULL :
 	 (cp = LYno_attr_mbcs_case_strstr(LineData,
 				     target,
-				     utf_flag,
+				     utf_flag, YES,
 				     &HitOffset,
 				     &LenNeeded)) != NULL) &&
 	(LineOffset + LenNeeded) < LYcols) {
@@ -6560,9 +6820,6 @@ PUBLIC BOOL HText_select ARGS1(
 	HText *,	text)
 {
     if (text != HTMainText) {
-	HTMainText = text;
-	HTMainAnchor = text->node_anchor;
-
 	/*
 	 *  Reset flag for whereis search string - cannot be true here
 	 *  since text is not our HTMainText. - kw
@@ -6580,6 +6837,21 @@ PUBLIC BOOL HText_select ARGS1(
 	}
 #endif /* DISP_PARTIAL */
 
+	if (HTMainText) {
+	    if (HText_hasUTF8OutputSet(HTMainText) &&
+		HTLoadedDocumentEightbit() &&
+		LYCharSet_UC[current_char_set].enc == UCT_ENC_UTF8) {
+		text->had_utf8 = HTMainText->has_utf8;
+	    } else {
+		text->had_utf8 = NO;
+	    }
+	    HTMainText->has_utf8 = NO;
+	    text->has_utf8 = NO;
+	}
+
+	HTMainText = text;
+	HTMainAnchor = text->node_anchor;
+
 	/*
 	 *  Make this text the most current in the loaded texts list. - FM
 	 */
@@ -7094,17 +7366,18 @@ PUBLIC void print_wwwfile_to_fd ARGS2(
     line = HTMainText->last_line->next;
     for (;; line = line->next) {
 	if (!first
-	 && line->data[0] != LY_SOFT_NEWLINE)
+	 && line->data[0] != LY_SOFT_NEWLINE && line->data[1] != LY_SOFT_NEWLINE) {
+	    /* data[0] can be LY_*START_CHAR, so LY_SOFT_NEWLINE can be in [1] - VH */
 	    fputc('\n',fp);
-	first = FALSE;
-
-	/*
-	 *  Add news-style quotation if requested. - FM
-	 */
-	if (is_reply) {
-	    fputc('>',fp);
+	    /*
+	     *  Add news-style quotation if requested. - FM
+	     */
+	    if (is_reply) {
+		fputc('>',fp);
+	    }
 	}
 
+	first = FALSE;
 	/*
 	 *  Add offset.
 	 */
@@ -7218,7 +7491,8 @@ PUBLIC void print_crawl_to_fd ARGS3(
 
     for (;; line = line->next) {
 	if (!first
-	 && line->data[0] != LY_SOFT_NEWLINE)
+	 && line->data[0] != LY_SOFT_NEWLINE && line->data[1] != LY_SOFT_NEWLINE)
+	    /* data[0] can be LY_*START_CHAR, so LY_SOFT_NEWLINE can be in [1] - VH */
 	    fputc('\n',fp);
 	first = FALSE;
 	/*
@@ -7611,7 +7885,7 @@ PUBLIC void user_message ARGS2(
 	return;
     }
 
-    HTSprintf(&temp, message, (argument == 0) ? "" : argument);
+    HTSprintf0(&temp, message, (argument == 0) ? "" : argument);
 
     statusline(temp);
 
@@ -9492,6 +9766,7 @@ PUBLIC int HText_SubmitForm ARGS4(
     BOOLEAN SemiColon = FALSE;
     char *Boundary = NULL;
     char *MultipartContentType = NULL;
+    char *content_type_out = NULL;
     int target_cs = -1;
     CONST char *out_csname;
     CONST char *target_csname = NULL;
@@ -9731,20 +10006,21 @@ PUBLIC int HText_SubmitForm ARGS4(
     } else {
 	/*
 	 *  We are submitting POST content to a server,
-	 *  so load the post_content_type element. - FM
+	 *  so load content_type_out.  This will be put in
+	 *  the post_content_type element if all goes well. - FM, kw
 	 */
 	if (SemiColon == TRUE) {
-	    StrAllocCopy(doc->post_content_type,
+	    StrAllocCopy(content_type_out,
 			 "application/sgml-form-urlencoded");
 	} else if (PlainText == TRUE) {
-	    StrAllocCopy(doc->post_content_type,
+	    StrAllocCopy(content_type_out,
 			 "text/plain");
 	} else if (Boundary != NULL) {
-	    StrAllocCopy(doc->post_content_type,
+	    StrAllocCopy(content_type_out,
 			 "multipart/form-data; boundary=");
-	    StrAllocCat(doc->post_content_type, Boundary);
+	    StrAllocCat(content_type_out, Boundary);
 	} else {
-	    StrAllocCopy(doc->post_content_type,
+	    StrAllocCopy(content_type_out,
 			 "application/x-www-form-urlencoded");
 	}
 
@@ -9775,8 +10051,8 @@ PUBLIC int HText_SubmitForm ARGS4(
 			  strcmp(target_csname, "iso-8859-1"))) ||
 			(!HTMainText->node_anchor->charset &&
 			 target_cs != UCLYhndl_for_unspec)) {
-			StrAllocCat(doc->post_content_type, "; charset=");
-			StrAllocCat(doc->post_content_type, target_csname);
+			StrAllocCat(content_type_out, "; charset=");
+			StrAllocCat(content_type_out, target_csname);
 		    }
 		}
 	    } else {
@@ -10097,7 +10373,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 		    if ((fd = fopen(val_used, "rb")) == 0) {
 			/* We can't open the file, what do we do? */
 			HTAlert("Can't open file for uploading");
-			return 0;
+			goto exit_disgracefully;
 		    }
 		    StrAllocCopy(escaped2, "");
 		    while ((bytes = fread(buffer, sizeof(char), 45, fd)) != 0) {
@@ -10109,12 +10385,12 @@ PUBLIC int HText_SubmitForm ARGS4(
 			/* We got an error reading the file, what do we do? */
 			HTAlert("Short read from file, problem?");
 			fclose(fd);
-			return 0;
+			goto exit_disgracefully;
 		    }
 		    fclose(fd);
-		    /* we need to modify the mime-type here */
-		    /* could use LYGetFileInfo for that and for other
-		       headers that should be transmitted - kw */
+		    /* we need to modify the mime-type here - rp */
+		    /* Note: could use LYGetFileInfo for that and for
+		       other headers that should be transmitted - kw */
 
 		    HTSprintf(&query,
 				   "%s%s%s%s%s",
@@ -10486,9 +10762,9 @@ PUBLIC int HText_SubmitForm ARGS4(
 			     (HText_getTitle() ?
 			      HText_getTitle() : "")),
 		 query,
-		 doc->post_content_type);
+		 content_type_out);
 	FREE(query);
-	FREE(doc->post_content_type);
+	FREE(content_type_out);
 	return 0;
     } else {
 	_statusline(SUBMITTING_FORM);
@@ -10496,6 +10772,8 @@ PUBLIC int HText_SubmitForm ARGS4(
 
     if (submit_item->submit_method == URL_POST_METHOD || Boundary) {
 	StrAllocCopy(doc->post_data, query);
+	FREE(doc->post_content_type);
+	doc->post_content_type = content_type_out; /* don't free c_t_out */
 	CTRACE((tfp,"GridText - post_data: %s\n",doc->post_data));
 	StrAllocCopy(doc->address, submit_item->submit_action);
 	FREE(query);
@@ -10504,9 +10782,22 @@ PUBLIC int HText_SubmitForm ARGS4(
 	StrAllocCopy(doc->address, query);
 	FREE(doc->post_data);
 	FREE(doc->post_content_type);
+	FREE(content_type_out);
 	FREE(query);
 	return 1;
     }
+#ifdef EXP_FILE_UPLOAD
+exit_disgracefully:
+    FREE(escaped1);
+    FREE(escaped2);
+    FREE(previous_blanks);
+    FREE(copied_name_used);
+    FREE(copied_val_used);
+    FREE(MultipartContentType);
+    FREE(query);
+    FREE(content_type_out);
+    return 0;
+#endif
 }
 
 PUBLIC void HText_DisableCurrentForm NOARGS
@@ -11640,6 +11931,7 @@ PUBLIC int HText_ExtEditForm ARGS1(
     TextAnchor *start_anchor  = NULL;
     TextAnchor *end_anchor    = NULL;
     BOOLEAN	firstanchor   = TRUE;
+    BOOLEAN wrapalert = FALSE;
 
     char	ed_offset[10];
     int		start_line    = 0;
@@ -11661,7 +11953,10 @@ PUBLIC int HText_ExtEditForm ARGS1(
     char       *cp;
     int         match_tag = 0;
     int		newlines  = 0;
-    int		len;
+    int		len, len0, len_in;
+    int		wanted_fieldlen_wrap = -1; /* not yet asked; 0 means don't. */
+    char       *skip_at = NULL;
+    int		skip_num = 0, i;
 
     CTRACE((tfp, "GridText: entered HText_ExtEditForm()\n"));
 
@@ -11780,15 +12075,27 @@ PUBLIC int HText_ExtEditForm ARGS1(
 	((size = stat_info.st_size) == 0)) {
 	size = 0;
 	ebuf = (char *) calloc (1, 1);
+	if (!ebuf)
+	    outofmem(__FILE__, "HText_ExtEditForm");
     } else {
 	ebuf = (char *) calloc (size + 1, (sizeof(char)));
+	if (!ebuf) {
+	    /*
+	     *  This could be huge - don't exit if we don't have enough
+	     *  memory for it.  With some luck, the user may be even able
+	     *  to recover the file manually from the temp space while
+	     *  the lynx session is not over. - kw
+	     */
+	    free(ed_temp);
+	    HTAlwaysAlert(NULL, MEMORY_EXHAUSTED_FILE);
+	    return 0;
+	}
 
 	fp = fopen (ed_temp, "r");
 	size = fread (ebuf, 1, size, fp);
 	fclose (fp);
+	ebuf[size] = '\0';	/* Terminate! - kw */
     }
-    if (ebuf == 0)
-	outofmem(__FILE__, "HText_ExtEditForm");
 
     /*
      *	Nuke any blank lines from the end of the edited data.
@@ -11805,24 +12112,111 @@ PUBLIC int HText_ExtEditForm ARGS1(
 	outofmem(__FILE__, "HText_ExtEditForm");
 
     anchor_ptr = start_anchor;
+    if (anchor_ptr->input_field->size <= 4 ||
+	anchor_ptr->input_field->size >= MAX_LINE)
+	wanted_fieldlen_wrap = 0;
 
-    len = 0;
+    len = len_in = 0;
     lp  = ebuf;
 
     while ((line_cnt <= orig_cnt) || (*lp) || ((len != 0) && (*lp == '\0'))) {
 
+	if (skip_at) {
+	    len0 = skip_at - lp;
+	    strncpy(line, lp, len0);
+	    line[len0] = '\0';
+	    lp = skip_at + skip_num;
+	    skip_at = NULL;
+	    skip_num = 0;
+	} else {
+	    len0 = 0;
+	}
+	line[len0] = '\0';
+
 	if ((cp = strchr (lp, '\n')) != 0)
-	   len = cp - lp;
+	   len = len_in = cp - lp;
 	else
-	   len = strlen (lp);
+	   len = len_in = strlen (lp);
+
+
+	if (wanted_fieldlen_wrap < 0 && !wrapalert &&
+	    len0+len >= anchor_ptr->input_field->size &&
+	    (cp = strchr(lp, ' ')) != NULL &&
+	    (cp-lp) < anchor_ptr->input_field->size - 1) {
+	    LYFixCursesOn("ask for confirmation:");
+	    erase();		/* don't show previous state */
+	    if (HTConfirmDefault(gettext("Wrap lines to fit displayed area?"),
+				 NO)) {
+		wanted_fieldlen_wrap = anchor_ptr->input_field->size - 1;
+	    } else {
+		wanted_fieldlen_wrap = 0;
+	    }
+	}
+	if (wanted_fieldlen_wrap > 0 && len0+len > wanted_fieldlen_wrap) {
+	    for (i = wanted_fieldlen_wrap-len0;
+		 i+len0 >= wanted_fieldlen_wrap/4; i--) {
+		if (isspace((unsigned char)lp[i])) {
+		    len = i + 1;
+		    cp = lp + i;
+		    if (cp[1] != '\n' &&
+			isspace((unsigned char)cp[1]) &&
+			!isspace((unsigned char)cp[2])) {
+			len++;
+			cp++;
+		    }
+		    if (!isspace((unsigned char)cp[1])) {
+			while (*cp && *cp != '\r' && *cp != '\n' &&
+			       (cp - lp) <= len + (3 * wanted_fieldlen_wrap/4))
+			    cp++;	/* search for next line break */
+			if (*cp == '\r' && cp[1] == '\n')
+			    cp++;
+			if (*cp == '\n' &&
+			    (cp[1] == '\r' || cp[1] == '\n' ||
+			     !isspace((unsigned char)cp[1]))) {
+			    *cp = ' ';
+			    while (isspace((unsigned char)*(cp-1))) {
+				skip_num++;
+				cp--;
+			    }
+			    skip_at = cp;
+			}
+		    }
+		    break;
+		}
+	    }
+	}
+	if (wanted_fieldlen_wrap > 0 && len0+len > wanted_fieldlen_wrap) {
+	    i = len-1;
+	    while (len0+i+1 > wanted_fieldlen_wrap &&
+		   isspace((unsigned char)lp[i]))
+		i--;
+	    if (len0+i+1 > wanted_fieldlen_wrap)
+		len = wanted_fieldlen_wrap - len0;
+	}
 
-	if (len >= MAX_LINE - 1)
-	    len = MAX_LINE - 1;
+	if (len0+len >= MAX_LINE) {
+	    if (!wrapalert) {
+		LYFixCursesOn("show alert:");
+		HTAlert(gettext("Very long lines have been wrapped!"));
+		wrapalert = TRUE;
+	    }
+	    /*
+	     *  First try to find a space character for wrapping - kw
+	     */
+	    for (i = MAX_LINE - len0 - 1; i > 0; i--) {
+		if (isspace((unsigned char)lp[i])) {
+		    len = i;
+		    break;
+		}
+	    }
+	    if (len0+len >= MAX_LINE)
+		len = MAX_LINE - len0 - 1;
+	}
 
-	strncpy (line, lp, len);
-	*(line + len) = '\0';
+	strncat (line, lp, len);
+	*(line + len0+len) = '\0';
 
-	cleanup_line_for_textarea (line, len);
+	cleanup_line_for_textarea (line, len0+len);
 
 	/*
 	 *  If there are more lines in the edit buffer than were in the
@@ -11844,7 +12238,7 @@ PUBLIC int HText_ExtEditForm ARGS1(
 	 *  Keep track of 1st blank line in any trailing blank lines, for
 	 *  later cursor repositioning.
 	 */
-	if (len > 0)
+	if (len0+len > 0)
 	    exit_line = 0;
 	else if (exit_line == 0)
 	    exit_line = anchor_ptr->line_num;
@@ -11853,7 +12247,7 @@ PUBLIC int HText_ExtEditForm ARGS1(
 	 *  And do the next line of edited text, for the next anchor ...
 	 */
 	lp += len;
-	if (*lp) lp++;
+	if (*lp && isspace((unsigned char)*lp)) lp++;
 
 	end_anchor = anchor_ptr;
 	anchor_ptr = anchor_ptr->next;
@@ -12013,6 +12407,7 @@ PUBLIC int HText_InsertFile ARGS1(
     TextAnchor *prev_anchor = NULL;
     TextAnchor *end_anchor  = NULL;
     BOOLEAN	firstanchor = TRUE;
+    BOOLEAN truncalert = FALSE;
 
     FormInfo   *form	 = form_link->form;
     char       *areaname = form->name;
@@ -12096,6 +12491,7 @@ PUBLIC int HText_InsertFile ARGS1(
 	size = fread (fbuf, 1, size, fp);
 	fclose (fp);
 	FREE(fn);
+	fbuf[size] = '\0';	/* Terminate! - kw */
     }
 
 
@@ -12248,6 +12644,15 @@ PUBLIC int HText_InsertFile ARGS1(
 	else
 	   len = strlen (lp);
 
+	if (len >= MAX_LINE) {
+	    if (!truncalert) {
+		HTAlert(gettext("Very long lines have been truncated!"));
+		truncalert = TRUE;
+	    }
+	    len = MAX_LINE - 1;
+	    if (lp[len])
+		lp[len+1] = '\0'; /* prevent next iteration */
+	}
 	strncpy (line, lp, len);
 	*(line + len) = '\0';
 
@@ -12422,7 +12827,7 @@ PRIVATE void redraw_part_of_line ARGS4(
 
 	    default:
 		i++;
-		if (text->T.output_utf8 && !isascii(buffer[0])) {
+		if (text->T.output_utf8 && !isascii((unsigned char)buffer[0])) {
 		    if ((*buffer & 0xe0) == 0xc0) {
 			utf_extra = 1;
 		    } else if ((*buffer & 0xf0) == 0xe0) {
@@ -12454,7 +12859,7 @@ PRIVATE void redraw_part_of_line ARGS4(
 		    buffer[1] = '\0';
 		    data += utf_extra;
 		    utf_extra = 0;
-		} else if (HTCJK != NOCJK && !isascii(buffer[0])) {
+		} else if (HTCJK != NOCJK && !isascii((unsigned char)buffer[0])) {
 		    /*
 		     *  For CJK strings, by Masanobu Kimura.
 		     */
@@ -12574,7 +12979,7 @@ PRIVATE void move_to_glyph ARGS10(
     if (i > (int)LYcols - 1)
 	i = (int)LYcols - 1;
 
-    linkvlen = hightext ? LYmbcsstrlen(hightext, utf_flag) : 0;
+    linkvlen = hightext ? LYmbcsstrlen(hightext, utf_flag, YES) : 0;
 
     /*
      *  Scan through the data, making sure that we do not
@@ -12593,13 +12998,13 @@ PRIVATE void move_to_glyph ARGS10(
 	if (case_sensitive)
 	    cp_tgt = LYno_attr_mbcs_strstr(sdata,
 					   target,
-					   utf_flag,
+					   utf_flag, YES,
 					   &HitOffset,
 					   &LenNeeded);
 	else
 	    cp_tgt = LYno_attr_mbcs_case_strstr(sdata,
 						target,
-						utf_flag,
+						utf_flag, YES,
 						&HitOffset,
 						&LenNeeded);
 	if (cp_tgt) {
@@ -12629,9 +13034,9 @@ PRIVATE void move_to_glyph ARGS10(
 	if (data && hightext && i >= XP && !incurlink) {
 
 	/*
-	 *  We reached the position of link itself, and highlight is
+	 *  We reached the position of link itself, and hightext is
 	 *  non-NULL.  We switch data from being a pointer into the HTLine
-	 *  to be a pointer into hightext.  Normally (as long as this
+	 *  to being a pointer into hightext.  Normally (as long as this
 	 *  routine is applied to normal hyperlink anchors) the text in
 	 *  hightext will be identical to that part of the HTLine that
 	 *  data was already pointing to, except that special attribute
@@ -12648,7 +13053,7 @@ PRIVATE void move_to_glyph ARGS10(
 	    data = hightext;
 	    len = strlen(hightext);
 	    end_of_data = hightext + len;
-	    XP += linkvlen;
+	    XP += linkvlen;	/* from now on XP includes hightext chars */
 	    incurlink = YES;
 	    if (cp_tgt) {
 		if (flag && i_after_tgt >= XP)
@@ -12725,13 +13130,13 @@ PRIVATE void move_to_glyph ARGS10(
 		else if (case_sensitive)
 		    cp_tgt = LYno_attr_mbcs_strstr(sdata,
 						   target,
-						   utf_flag,
+						   utf_flag, YES,
 						   &HitOffset,
 						   &LenNeeded);
 		else
 		    cp_tgt = LYno_attr_mbcs_case_strstr(sdata,
 							target,
-							utf_flag,
+							utf_flag, YES,
 							&HitOffset,
 							&LenNeeded);
 		if (cp_tgt) {
@@ -12852,10 +13257,21 @@ PRIVATE void move_to_glyph ARGS10(
 		 *  drawing needs to be turned on now. - kw
 		 */
 #if defined(SHOW_WHEREIS_TARGETS)
-		if (incurlink) {
-		    if (intarget && flag && i == XP - 1 &&
-			i_after_tgt > i)
+		if (incurlink && intarget && flag && i_after_tgt > i) {
+		    if (i == XP - 1) {
+			i_after_tgt = i;
+		    } else if (i == XP - 2 && HTCJK != NOCJK &&
+			       !isascii((unsigned char)buffer[0])) {
 			i_after_tgt = i;
+			cp_tgt = NULL;
+			if (drawing) {
+			    if (drawingtarget) {
+				LYstopTargetEmphasis();
+				drawingtarget = NO;
+				lynx_start_link_color (flag, inU);
+			    }
+			}
+		    }
 		}
 		if (cp_tgt && i >= i_start_tgt && sdata > cp_tgt) {
 		    if (!intarget ||
@@ -12952,7 +13368,7 @@ PRIVATE void move_to_glyph ARGS10(
 		    buffer[1] = '\0';
 		    sdata += utf_extra; data += utf_extra;
 		    utf_extra = 0;
-		} else if (HTCJK != NOCJK && !isascii(buffer[0])) {
+		} else if (HTCJK != NOCJK && !isascii((unsigned char)buffer[0])) {
 		    /*
 		     *  For CJK strings, by Masanobu Kimura.
 		     */
@@ -13006,10 +13422,12 @@ PRIVATE void move_to_glyph ARGS10(
 	if (hadutf8) {
 #ifdef USE_SLANG
 	    SLsmg_touch_lines(YP, 1);
-#elif defined(NCURSES_VERSION)
-	    touchline(stdscr, YP, 1);
 #else
-	    touchwin(stdscr);
+#if defined(NCURSES_VERSION)
+	    wredrawln(stdscr, YP, 1);
+#else
+	    touchline(stdscr, YP, 1); /* or something else? */
+#endif
 #endif
 	}
     }
diff --git a/src/GridText.h b/src/GridText.h
index 190d97fa..1f82ec73 100644
--- a/src/GridText.h
+++ b/src/GridText.h
@@ -202,8 +202,11 @@ extern void HText_startStblTABLE PARAMS((HText *, short));
 extern void HText_endStblTABLE PARAMS((HText *));
 extern void HText_startStblTR PARAMS((HText *, short));
 extern void HText_endStblTR PARAMS((HText *));
-extern void HText_startStblTD PARAMS((HText *, int, short, BOOL));
+extern void HText_startStblTD PARAMS((HText *, int, int, short, BOOL));
 extern void HText_endStblTD PARAMS((HText *));
+extern void HText_startStblCOL PARAMS((HText *, int, short, BOOL));
+extern void HText_endStblCOLGROUP PARAMS((HText *));
+extern void HText_startStblRowGroup PARAMS((HText *, short));
 
 /* forms stuff */
 extern void HText_beginForm PARAMS((
diff --git a/src/HTAlert.c b/src/HTAlert.c
index 5a86f666..99d8ad43 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -440,6 +440,32 @@ PUBLIC BOOL HTLastConfirmCancelled NOARGS
 */
 PUBLIC int HTConfirmDefault ARGS2(CONST char *, Msg, int, Dft)
 {
+/* Meta-note: don't move the following note from its place right
+   in front of the first gettext().  As it is now, it should
+   automatically appear in generated lynx.pot files. - kw
+ */
+
+/*  NOTE TO TRANSLATORS:  If you provide a translation for "yes", lynx
+ *  will take the first byte of the translation as a positive response
+ *  to Yes/No questions.  If you provide a translation for "no", lynx
+ *  will take the first byte of the translation as a negative response
+ *  to Yes/No questions.  For both, lynx will also try to show the
+ *  first byte in the prompt as a character, instead of (y) or (n),
+ *  respectively.  This will not work right for multibyte charsets!
+ *  Don't translate "yes" and "no" for CJK character sets (or translate
+ *  them to "yes" and "no").  For a translation using UTF-8, don't
+ *  translate if the translation would begin with anything but a 7-bit
+ *  (US_ASCII) character.  That also means do not translate if the
+ *  translation would begin with anything but a 7-bit character, if
+ *  you use a single-byte character encoding (a charset like ISO-8859-n)
+ *  but anticipate that the message catalog may be used re-encoded in
+ *  UTF-8 form.
+ *  For translations using other character sets, you may also wish to
+ *  leave "yes" and "no" untranslated, if using (y) and (n) is the
+ *  preferred behavior.
+ *  Lynx will also accept y Y n N as responses unless there is a conflict
+ *  with the first letter of the "yes" or "no" translation.
+ */
     char *msg_yes = gettext("yes");
     char *msg_no  = gettext("no");
     int result = -1;
@@ -455,6 +481,13 @@ PUBLIC int HTConfirmDefault ARGS2(CONST char *, Msg, int, Dft)
 	result = NO;
     } else {
 	char *msg = NULL;
+	char fallback_y = 'y';	/* English letter response as fallback */
+	char fallback_n = 'n';	/* English letter response as fallback */
+
+	if (fallback_y == *msg_yes || fallback_y == *msg_no)
+	    fallback_y = '\0';	/* conflict or duplication, don't use */
+	if (fallback_n == *msg_yes || fallback_n == *msg_no)
+	    fallback_n = '\0';	/* conflict or duplication, don't use */
 
 	if (Dft == DFT_CONFIRM)
 	    HTSprintf0(&msg, "%s (%c/%c) ", Msg, *msg_yes, *msg_no);
@@ -481,6 +514,10 @@ PUBLIC int HTConfirmDefault ARGS2(CONST char *, Msg, int, Dft)
 		result = YES;
 	    } else if (TOUPPER(c) == TOUPPER(*msg_no)) {
 		result = NO;
+	    } else if (fallback_y && TOLOWER(c) == fallback_y) {
+		result = YES;
+	    } else if (fallback_n && TOLOWER(c) == fallback_n) {
+		result = NO;
 	    } else if (Dft != DFT_CONFIRM) {
 		result = Dft;
 		break;
diff --git a/src/HTML.c b/src/HTML.c
index 464a05b1..f9374c96 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -109,7 +109,7 @@ PRIVATE HTStyleSheet * styleSheet = NULL;	/* Application-wide */
 
 /*	Module-wide style cache
 */
-PRIVATE HTStyle *styles[HTML_ELEMENTS+HTML_EXTRA_ELEMENTS];
+PRIVATE HTStyle *styles[HTML_ELEMENTS+LYNX_HTML_EXTRA_ELEMENTS];
 					   /* adding 24 nested list styles  */
 					   /* and 3 header alignment styles */
 					   /* and 3 div alignment styles    */
@@ -682,7 +682,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
    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(flag,s) flag = (s && (*s=='#' || *s=='\0')) ? TRUE : FALSE
 
 /* Last argument to pass to HTAnchor_findChildAndLink() calls,
    just an abbreviation. - kw */
@@ -690,7 +690,7 @@ PUBLIC void HTML_write ARGS3(HTStructured *, me, CONST char*, s, int, l)
 
 #else  /* !DONT_TRACK_INTERNAL_LINKS */
 
-#define CHECK_FOR_INTERN(s)  /* do nothing */ ;
+#define CHECK_FOR_INTERN(flag,s)  /* do nothing */ ;
 #define INTERN_LT (HTLinkType *)NULL
 
 #endif /* DONT_TRACK_INTERNAL_LINKS */
@@ -712,11 +712,11 @@ static int hcode;
 
 PRIVATE void HTMLSRC_apply_markup ARGS4(
 	    HTStructured *,   context,
-	    HTlexem,	      lexem,
+	    HTlexeme,	      lexeme,
 	    BOOL,	      start,
 	    int,	      tag_charset)
 {
-    HT_tagspec* ts = *( ( start ? lexem_start : lexem_end ) + lexem);
+    HT_tagspec* ts = *( ( start ? lexeme_start : lexeme_end ) + lexeme);
 
     while (ts) {
 #ifdef USE_COLOR_STYLE
@@ -727,7 +727,7 @@ PRIVATE void HTMLSRC_apply_markup ARGS4(
 	    force_classname = TRUE;
 	}
 #endif
-	CTRACE((tfp,ts->start ? "SRCSTART %d\n" : "SRCSTOP %d\n",(int)lexem));
+	CTRACE((tfp,ts->start ? "SRCSTART %d\n" : "SRCSTOP %d\n",(int)lexeme));
 	if (ts->start)
 	    HTML_start_element(
 		context,
@@ -791,7 +791,7 @@ PRIVATE void LYStartArea ARGS5(
 			       tag_charset, 0);
 }
 
-PRIVATE void LYHandleFIG ARGS9(
+PRIVATE void LYHandleFIG ARGS10(
 	HTStructured *,		me,
 	CONST BOOL*,		present,
 	CONST char **,		value,
@@ -800,7 +800,8 @@ PRIVATE void LYHandleFIG ARGS9(
 	CONST char *,		id,
 	CONST char *,		src,
 	BOOL,			convert,
-	BOOL,			start)
+	BOOL,			start,
+	BOOL *,			intern_flag GCC_UNUSED)
 {
     if (start == TRUE) {
 	me->inFIG = TRUE;
@@ -828,7 +829,7 @@ PRIVATE void LYHandleFIG ARGS9(
 	if (clickable_images && src && src != '\0') {
 	    char *href = NULL;
 	    StrAllocCopy(href, src);
-	    CHECK_FOR_INTERN(href);
+	    CHECK_FOR_INTERN(*intern_flag,href);
 	    LYLegitimizeHREF(me, &href, TRUE, TRUE);
 	    if (*href) {
 		char *temp = NULL;
@@ -933,7 +934,7 @@ PRIVATE int HTML_start_element ARGS6(
     int dest_char_set = UCLYhndl_for_unrec;
     HTParentAnchor *dest = NULL;	     /* An anchor's destination */
     BOOL dest_ismap = FALSE;		     /* Is dest an image map script? */
-    BOOL UseBASE = TRUE;		     /* Resoved vs. BASE if present? */
+    BOOL UseBASE = TRUE;		     /* Resolved vs. BASE if present? */
     HTChildAnchor *ID_A = NULL;		     /* HTML_foo_ID anchor */
     int url_type = 0, i = 0;
     char *cp = NULL;
@@ -1310,7 +1311,7 @@ PRIVATE int HTML_start_element ARGS6(
 	intern_flag = FALSE;
 #endif
 	if (present && present[HTML_LINK_HREF]) {
-	    CHECK_FOR_INTERN(value[HTML_LINK_HREF]);
+	    CHECK_FOR_INTERN(intern_flag,value[HTML_LINK_HREF]);
 	    /*
 	     *	Prepare to do housekeeping on the reference. - FM
 	     */
@@ -1762,7 +1763,7 @@ PRIVATE int HTML_start_element ARGS6(
 	if (present && present[HTML_FRAME_SRC] &&
 	    value[HTML_FRAME_SRC] && *value[HTML_FRAME_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_FRAME_SRC]);
-	    CHECK_FOR_INTERN(href);
+	    CHECK_FOR_INTERN(intern_flag,href);
 	    url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
 
 	    /*
@@ -1837,7 +1838,7 @@ PRIVATE int HTML_start_element ARGS6(
 	if (present && present[HTML_IFRAME_SRC] &&
 	    value[HTML_IFRAME_SRC] && *value[HTML_IFRAME_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_IFRAME_SRC]);
-	    CHECK_FOR_INTERN(href);
+	    CHECK_FOR_INTERN(intern_flag,href);
 	    url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
 
 	    /*
@@ -3031,7 +3032,7 @@ PRIVATE int HTML_start_element ARGS6(
 	    if (present[HTML_A_ISMAP])
 		intern_flag = FALSE;
 	    else
-		CHECK_FOR_INTERN(value[HTML_A_HREF]);
+		CHECK_FOR_INTERN(intern_flag,value[HTML_A_HREF]);
 #endif
 	    /*
 	     *	Prepare to do housekeeping on the reference. - FM
@@ -3175,20 +3176,24 @@ PRIVATE int HTML_start_element ARGS6(
 					    me->inUnderline, me->CurrentA);
 	if (me->inBoldA == TRUE && me->inBoldH == FALSE)
 	    HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
-#if defined(NOTUSED_FOTEMODS) || !defined(NO_EMPTY_HREFLESS_A)
+#if defined(NOTUSED_FOTEMODS)
 	/*
 	 *  Close an HREF-less NAMED-ed now if we aren't making their
 	 *  content bold, and let the check in HTML_end_element() deal
 	 *  with any dangling end tag this creates. - FM
 	 */
-# ifndef NO_EMPTY_HREFLESS_A
-	if (force_empty_hrefless_a)
-# endif
-	    if (href == NULL && me->inBoldA == FALSE) {
-		SET_SKIP_STACK(HTML_A);
-		HTML_end_element(me, HTML_A, include);
-	    }
-#endif /* NOTUSED_FOTEMODS || !defined(NO_EMPTY_HREFLESS_A)*/
+	if (href == NULL && me->inBoldA == FALSE) {
+	    SET_SKIP_STACK(HTML_A);
+	    HTML_end_element(me, HTML_A, include);
+	}
+#else
+	/*Close an HREF-less NAMED-ed now if force_empty_hrefless_a was
+	    requested - VH*/
+	if (href == NULL) {
+	    SET_SKIP_STACK(HTML_A);
+	    HTML_end_element(me, HTML_A, include);
+	}
+#endif
 	FREE(href);
 	break;
 
@@ -3225,7 +3230,7 @@ PRIVATE int HTML_start_element ARGS6(
 	if (present && present[HTML_IMG_USEMAP] &&
 	    value[HTML_IMG_USEMAP] && *value[HTML_IMG_USEMAP]) {
 	    StrAllocCopy(map_href, value[HTML_IMG_USEMAP]);
-	    CHECK_FOR_INTERN(map_href);
+	    CHECK_FOR_INTERN(intern_flag,map_href);
 	    url_type = LYLegitimizeHREF(me, &map_href, TRUE, TRUE);
 	    /*
 	     *	If map_href ended up zero-length or otherwise doesn't
@@ -3778,7 +3783,7 @@ PRIVATE int HTML_start_element ARGS6(
 	     *	Resolve the HREF. - FM
 	     */
 	    StrAllocCopy(href, value[HTML_AREA_HREF]);
-	    CHECK_FOR_INTERN(href);
+	    CHECK_FOR_INTERN(intern_flag,href);
 	    url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
 
 	    /*
@@ -3888,13 +3893,13 @@ PRIVATE int HTML_start_element ARGS6(
 			present[HTML_FIG_IMAGEMAP],
 			present[HTML_FIG_ID] ? value[HTML_FIG_ID] : NULL,
 			present[HTML_FIG_SRC] ? value[HTML_FIG_SRC] : NULL,
-			YES, TRUE);
+			YES, TRUE, &intern_flag);
 	else
 	    LYHandleFIG(me, NULL, NULL,
 			0,
 			0,
 			NULL,
-			NULL, YES, TRUE);
+			NULL, YES, TRUE, &intern_flag);
 #if 0
 	me->inFIG = TRUE;
 	if (me->inA) {
@@ -3917,7 +3922,7 @@ PRIVATE int HTML_start_element ARGS6(
 	if (clickable_images && present && present[HTML_FIG_SRC] &&
 	    value[HTML_FIG_SRC] && *value[HTML_FIG_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_FIG_SRC]);
-	    CHECK_FOR_INTERN(href);
+	    CHECK_FOR_INTERN(intern_flag,href);
 	    url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
 	    if (*href) {
 		/*
@@ -4130,7 +4135,7 @@ PRIVATE int HTML_start_element ARGS6(
 		    1 || me->object_ismap,
 		    me->object_id,
 		    (me->object_data && !me->object_classid) ? value[HTML_OBJECT_DATA] : NULL,
-		    NO, TRUE);
+		    NO, TRUE, &intern_flag);
 		clear_objectdata(me);
 		status = HT_PARSER_OTHER_CONTENT;
 		me->objects_figged_open++;
@@ -4150,7 +4155,7 @@ PRIVATE int HTML_start_element ARGS6(
 	    present && present[HTML_OVERLAY_SRC] &&
 	    value[HTML_OVERLAY_SRC] && *value[HTML_OVERLAY_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_OVERLAY_SRC]);
-	    CHECK_FOR_INTERN(href);
+	    CHECK_FOR_INTERN(intern_flag,href);
 	    url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
 	    if (*href) {
 		/*
@@ -4355,7 +4360,7 @@ PRIVATE int HTML_start_element ARGS6(
 	if (clickable_images && present && present[HTML_BGSOUND_SRC] &&
 	    value[HTML_BGSOUND_SRC] && *value[HTML_BGSOUND_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_BGSOUND_SRC]);
-	    CHECK_FOR_INTERN(href);
+	    CHECK_FOR_INTERN(intern_flag,href);
 	    url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
 	    if (*href == '\0') {
 		FREE(href);
@@ -4469,7 +4474,7 @@ PRIVATE int HTML_start_element ARGS6(
 	if (clickable_images && present && present[HTML_EMBED_SRC] &&
 	    value[HTML_EMBED_SRC] && *value[HTML_EMBED_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_EMBED_SRC]);
-	    CHECK_FOR_INTERN(href);
+	    CHECK_FOR_INTERN(intern_flag,href);
 	    url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
 	    if (*href != '\0') {
 		/*
@@ -5928,7 +5933,7 @@ PRIVATE int HTML_start_element ARGS6(
     case HTML_TBODY:
 	HText_endStblTR(me->text);
 	/*
-	 *  Not yet implemented.  Just check for an ID link. - FM
+	 *  Not fully implemented.  Just check for an ID link. - FM
 	 */
 	if (me->inA) {
 	    SET_SKIP_STACK(HTML_A);
@@ -5939,13 +5944,26 @@ PRIVATE int HTML_start_element ARGS6(
 	    HTML_end_element(me, HTML_U, include);
 	}
 	UPDATE_STYLE;
+	if (me->inTABLE) {
+	    if (present && present[HTML_TR_ALIGN] && value[HTML_TR_ALIGN]) {
+		if (!strcasecomp(value[HTML_TR_ALIGN], "center")) {
+		    stbl_align = HT_CENTER;
+		} else if (!strcasecomp(value[HTML_TR_ALIGN], "right")) {
+		    stbl_align = HT_RIGHT;
+		} else if (!strcasecomp(value[HTML_TR_ALIGN], "left") ||
+			   !strcasecomp(value[HTML_TR_ALIGN], "justify")) {
+		    stbl_align = HT_LEFT;
+		}
+	    }
+	    HText_startStblRowGroup(me->text, stbl_align);
+	}
 	CHECK_ID(HTML_TR_ID);
 	break;
 
     case HTML_COL:
     case HTML_COLGROUP:
 	/*
-	 *  Not yet implemented.  Just check for an ID link. - FM
+	 *  Not fully implemented.  Just check for an ID link. - FM
 	 */
 	if (me->inA) {
 	    SET_SKIP_STACK(HTML_A);
@@ -5955,8 +5973,26 @@ PRIVATE int HTML_start_element ARGS6(
 	    SET_SKIP_STACK(HTML_U);
 	    HTML_end_element(me, HTML_U, include);
 	}
-/*	HText_cancelStbl(me->text);  we ingnore it instead - kw */
 	UPDATE_STYLE;
+	if (me->inTABLE) {
+	    int span = 1;
+	    if (present && present[HTML_COL_SPAN] &&
+		value[HTML_COL_SPAN] &&
+		isdigit((unsigned char)*value[HTML_COL_SPAN]))
+		span = atoi(value[HTML_COL_SPAN]);
+	    if (present && present[HTML_COL_ALIGN] && value[HTML_COL_ALIGN]) {
+		if (!strcasecomp(value[HTML_COL_ALIGN], "center")) {
+		    stbl_align = HT_CENTER;
+		} else if (!strcasecomp(value[HTML_COL_ALIGN], "right")) {
+		    stbl_align = HT_RIGHT;
+		} else if (!strcasecomp(value[HTML_COL_ALIGN], "left") ||
+			   !strcasecomp(value[HTML_COL_ALIGN], "justify")) {
+		    stbl_align = HT_LEFT;
+		}
+	    }
+	    HText_startStblCOL(me->text, span, stbl_align,
+			       (ElementNumber == HTML_COLGROUP));
+	}
 	CHECK_ID(HTML_COL_ID);
 	break;
 
@@ -5978,11 +6014,15 @@ PRIVATE int HTML_start_element ARGS6(
 	 */
 	HTML_put_character(me, ' ');
 	{
-	    int colspan = 1;
+	    int colspan = 1, rowspan = 1;
 	    if (present && present[HTML_TD_COLSPAN] &&
 		value[HTML_TD_COLSPAN] &&
 		isdigit((unsigned char)*value[HTML_TD_COLSPAN]))
 		colspan = atoi(value[HTML_TD_COLSPAN]);
+	    if (present && present[HTML_TD_ROWSPAN] &&
+		value[HTML_TD_ROWSPAN] &&
+		isdigit((unsigned char)*value[HTML_TD_ROWSPAN]))
+		rowspan = atoi(value[HTML_TD_ROWSPAN]);
 	    if (present && present[HTML_TD_ALIGN] && value[HTML_TD_ALIGN]) {
 		if (!strcasecomp(value[HTML_TD_ALIGN], "center")) {
 		    stbl_align = HT_CENTER;
@@ -5993,7 +6033,7 @@ PRIVATE int HTML_start_element ARGS6(
 		    stbl_align = HT_LEFT;
 		}
 	    }
-	    HText_startStblTD(me->text, colspan, stbl_align,
+	    HText_startStblTD(me->text, colspan, rowspan, stbl_align,
 			      (ElementNumber == HTML_TH));
 	}
 	me->in_word = NO;
@@ -6108,6 +6148,8 @@ PRIVATE int HTML_end_element ARGS3(
     int status = HT_OK;
     char *temp = NULL, *cp = NULL;
     BOOL BreakFlag = FALSE;
+    BOOL intern_flag = FALSE;
+    BOOL skip_stack_requested = FALSE;
     EMIT_IFDEF_EXP_JUSTIFY_ELTS(BOOL reached_awaited_stacked_elt=FALSE;)
 
 #ifdef USE_PSRC
@@ -6167,6 +6209,7 @@ PRIVATE int HTML_end_element ARGS3(
      *	SGML_EMPTY in HTMLDTD.c. - FM & KW
      */
     if (HTML_dtd.tags[element_number].contents != SGML_EMPTY) {
+	skip_stack_requested = me->skip_stack > 0;
 	if ((element_number != me->sp[0].tag_number) &&
 	    me->skip_stack <= 0 &&
 	    HTML_dtd.tags[HTML_LH].contents != SGML_EMPTY &&
@@ -6737,7 +6780,7 @@ PRIVATE int HTML_end_element ARGS3(
 		    0,
 		    0,
 		    NULL,
-		    NULL, NO, FALSE);
+		    NULL, NO, FALSE, &intern_flag);
 	break;
 
     case HTML_OBJECT:
@@ -7329,15 +7372,33 @@ End_Object:
 	    me->UsePlainSpace = TRUE;
 
 	    if (HTML_dtd.tags[element_number].contents == SGML_LITTERAL) {
-		TRANSLATE_AND_UNESCAPE_ENTITIES5(&me->textarea.data,
-						    me->UCLYhndl,
-						    current_char_set,
-						    me->UsePlainSpace, me->HiddenValue);
+		TRANSLATE_AND_UNESCAPE_ENTITIES6(&me->textarea.data,
+						 me->UCLYhndl,
+						 current_char_set,
+						 NO,
+						 me->UsePlainSpace, me->HiddenValue);
 	    } else {
-		TRANSLATE_HTML5(&me->textarea.data,
+		/*
+		 *  This shouldn't have anything to do, normally, but
+		 *  just in case...
+		 *  There shouldn't be lynx special character codes in
+		 *  the chunk ("DTD" flag Tgf_nolyspcl tells SGML.c not
+		 *  to generate them).  If there were, we could set the
+		 *  last parameter ('Back') below to YES, which would
+		 *  take them out of the data.
+		 *  The data may however contain non break space, soft
+		 *  hyphen, or en space etc., in the me->UCLYhndl character
+		 *  encoding.  If that's a problem, perhaps for the (line
+		 *  or other) editor, setting 'Back' to YES should also
+		 *  help to always convert them to plain spaces (or drop
+		 *  them). - kw
+		 */
+		TRANSLATE_HTML7(&me->textarea.data,
 						    me->UCLYhndl,
 						    current_char_set,
-						    me->UsePlainSpace, me->HiddenValue);
+						    NO,
+						    me->UsePlainSpace, me->HiddenValue,
+						    NO);
 	    }
 	    data = me->textarea.data;
 
@@ -7600,6 +7661,8 @@ End_Object:
 	break;
 
     case HTML_COLGROUP:
+	if (me->inTABLE)
+	    HText_endStblCOLGROUP(me->text);
 	break;
 
     case HTML_TH:
@@ -7657,26 +7720,28 @@ End_Object:
     }
 
 #ifdef USE_COLOR_STYLE
+    if (!skip_stack_requested) { /*don't emit stylechanges if skipped stack element - VH*/
 #if !OPT_SCN
-    TrimColorClass(HTML_dtd.tags[element_number].name,
-		   Style_className, &hcode);
+	TrimColorClass(HTML_dtd.tags[element_number].name,
+		       Style_className, &hcode);
 #else
 # if !OMIT_SCN_KEEPING
-    FastTrimColorClass(HTML_dtd.tags[element_number].name,
-		       HTML_dtd.tags[element_number].name_len,
-		       Style_className,
-		       &Style_className_end, &hcode);
+	FastTrimColorClass(HTML_dtd.tags[element_number].name,
+			   HTML_dtd.tags[element_number].name_len,
+			   Style_className,
+			   &Style_className_end, &hcode);
 #  endif
 #endif
 
-    if (!ReallyEmptyTagNum(element_number))
-    {
-	CTRACE((tfp, "STYLE:end_element: ending non-EMPTY style\n"));
+	if (!ReallyEmptyTagNum(element_number))
+	{
+	    CTRACE((tfp, "STYLE:end_element: ending non-EMPTY style\n"));
 #if !defined(USE_HASH)
-	HText_characterStyle(me->text, element_number+STARTAT, STACK_OFF);
+	    HText_characterStyle(me->text, element_number+STARTAT, STACK_OFF);
 #else
-	HText_characterStyle(me->text, HCODE_TO_STACK_OFF(hcode), STACK_OFF);
+	    HText_characterStyle(me->text, HCODE_TO_STACK_OFF(hcode), STACK_OFF);
 #endif /* USE_HASH */
+	}
     }
 #endif /* USE_COLOR_STYLE */
     return status;
diff --git a/src/HTML.h b/src/HTML.h
index 04ea3f32..95bd74f1 100644
--- a/src/HTML.h
+++ b/src/HTML.h
@@ -34,6 +34,9 @@
 #define TRANSLATE_HTML5(s,cs_from,cs_to,p,h) \
 	LYUCFullyTranslateString(s, cs_from, cs_to, NO, YES, p, h, NO, st_HTML)
 
+#define TRANSLATE_HTML7(s,cs_from,cs_to,spcls,p,h,Back) \
+	LYUCFullyTranslateString(s, cs_from, cs_to, NO, spcls, p, h, Back, st_HTML)
+
 /*
  *  Strings from attributes which should be converted to some kind
  *  of "standard" representation (character encoding), was Latin-1,
diff --git a/src/HTNestedList.h b/src/HTNestedList.h
index f7c0411d..75d83a70 100644
--- a/src/HTNestedList.h
+++ b/src/HTNestedList.h
@@ -40,6 +40,6 @@
 
 #define HTML_OBJECT_M HTML_ELEMENTS+31
 
-#define HTML_EXTRA_ELEMENTS 31
+#define LYNX_HTML_EXTRA_ELEMENTS 31
 
 #endif /* HTNESTEDLIST_H */
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index b4b54422..e48aaf8b 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -1678,17 +1678,18 @@ PUBLIC char ** LYUCFullyTranslateString ARGS9(
     /*
     **	Don't do byte translation
     **	if original AND target character sets
-    **	are both iso-8859-1,
+    **	are both iso-8859-1 (and we are not called to back-translate),
     **	or if we are in CJK mode.
     */
-    no_bytetrans = (BOOL) ((cs_to <= 0 && cs_from == cs_to) ||
-		    HTCJK != NOCJK);
-
+    if (HTCJK != NOCJK) {
+	no_bytetrans = TRUE;
+    } else if (cs_to <= 0 && cs_from == cs_to && (!Back || cs_to < 0)) {
+	no_bytetrans = TRUE;
+    } else {
     /* No need to translate or examine the string any further */
-    if (!no_bytetrans)
 	no_bytetrans = (BOOL) (!use_lynx_specials && !Back &&
-			UCNeedNotTranslate(cs_from, cs_to));
-
+			       UCNeedNotTranslate(cs_from, cs_to));
+    }
     /*
     **	Save malloc/calloc overhead in simple case - kw
     */
@@ -1898,21 +1899,31 @@ PUBLIC char ** LYUCFullyTranslateString ARGS9(
 			state = S_got_outchar;
 			break;
 		    } else {
-			*(unsigned char *)p = (unsigned char)160;
 			code = 160;
 			if (LYCharSet_UC[cs_to].enc == UCT_ENC_8859 ||
 			    (LYCharSet_UC[cs_to].like8859 & UCT_R_8859SPECL)) {
 			    state = S_got_outchar;
 			    break;
+			} else if (!(LYCharSet_UC[cs_from].enc == UCT_ENC_8859
+			||(LYCharSet_UC[cs_from].like8859 & UCT_R_8859SPECL))) {
+			    state = S_check_uni;
+			    break;
+			} else {
+			    *(unsigned char *)p = (unsigned char)160;
 			}
 		    }
 		} else if ((*p) == LY_SOFT_HYPHEN) {
-		    *(unsigned char *)p = (unsigned char)173;
 		    code = 173;
 		    if (LYCharSet_UC[cs_to].enc == UCT_ENC_8859 ||
 			(LYCharSet_UC[cs_to].like8859 & UCT_R_8859SPECL)) {
 			state = S_got_outchar;
 			break;
+		    } else if (!(LYCharSet_UC[cs_from].enc == UCT_ENC_8859
+			||(LYCharSet_UC[cs_from].like8859 & UCT_R_8859SPECL))) {
+			state = S_check_uni;
+			break;
+		    } else {
+			*(unsigned char *)p = (unsigned char)173;
 		    }
 		} else if (code < 127 || T.transp) {
 		    state = S_got_outchar;
diff --git a/src/LYCurses.c b/src/LYCurses.c
index 07b2d8d9..e804da1e 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -520,14 +520,17 @@ PRIVATE void LYsetWAttr ARGS1(WINDOW *, win)
 	attr = lynx_color_cfg[code].attr;
 
 	/*
-	 * no_color_video isn't implemented (97/4/14) in ncurses 4.1, but may
-	 * be in SVr4 (which would make this redundant for the latter).
+	 * no_color_video is implemented in ncurses 4.2, but not in other
+	 * flavors of curses.  So we check before adding video attributes that
+	 * might conflict with colors.  For A_BOLD, check for both the bold and
+	 * standout mask items because standout often uses bold in conjunction
+	 * with another attribute.  -TD
 	 */
 	if ((Current_Attr & A_BOLD) && !(NoColorVideo & 33)) {
 		attr |= A_BOLD;
 	}
 
-	if ((Current_Attr == A_UNDERLINE) && !(NoColorVideo & 2)) {
+	if ((Current_Attr & A_UNDERLINE) && !(NoColorVideo & 2)) {
 		attr |= A_UNDERLINE;
 	}
 
@@ -837,7 +840,11 @@ PUBLIC void start_curses NOARGS
 #endif /* USE_COLOR_TABLE */
     }
 #ifdef __DJGPP__
+#ifdef WATT32
+    _eth_init();
+#else
     else sock_init();
+#endif /* WATT32 */
 #endif /* __DJGPP__ */
 #endif /* not VMS */
 
diff --git a/src/LYForms.c b/src/LYForms.c
index 70f7486d..6e10025b 100644
--- a/src/LYForms.c
+++ b/src/LYForms.c
@@ -1134,7 +1134,7 @@ redraw:
 	    cmd = LYK_QUIT;
 #ifndef USE_SLANG
 	} else if (c == MOUSE_KEY) {
-	    if ((cmd = fancy_mouse(form_window, i + 1 + window_offset, &cur_selection)) < 0)
+	    if ((cmd = fancy_mouse(form_window, i + 1 - window_offset, &cur_selection)) < 0)
 		goto redraw;
 	    if  (cmd == LYK_ACTIVATE)
 		break;
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index d0f8efbf..dc41af94 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -396,9 +396,7 @@ extern BOOL ok_justify;
 extern BOOLEAN with_backspaces;
 #endif
 
-#ifndef NO_EMPTY_HREFLESS_A
 extern BOOL force_empty_hrefless_a;
-#endif
 
 #ifndef NO_NONSTICKY_INPUTS
 extern BOOL sticky_inputs;
diff --git a/src/LYHistory.c b/src/LYHistory.c
index de190ef1..9f7a8cca 100644
--- a/src/LYHistory.c
+++ b/src/LYHistory.c
@@ -148,6 +148,10 @@ PUBLIC BOOLEAN LYwouldPush ARGS2(
 	if (strncmp(docurl, "file://localhost/", 17) != 0 ||
 	    (ulen = strlen(docurl)) <= strlen(HTML_SUFFIX) ||
 	    strcmp(docurl + ulen - strlen(HTML_SUFFIX), HTML_SUFFIX) != 0)
+	    /*
+	     *  If it is not a local HTML file, it may be a Web page that
+	     *  accidentally has the same title.  So return TRUE now. - kw
+	     */
 	    return TRUE;
     }
 
@@ -726,7 +730,7 @@ PUBLIC void LYstore_message2 ARGS2(
 
     if (message != NULL) {
 	char *temp = NULL;
-	HTSprintf(&temp, message, (argument == 0) ? "" : argument);
+	HTSprintf0(&temp, message, (argument == 0) ? "" : argument);
 	to_stack(temp);
     }
 }
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index 148479f7..bd5783b5 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -1167,18 +1167,18 @@ PUBLIC char *key_for_func ARGS1 (
 
 /*
  *  This function returns TRUE if the ch is non-alphanumeric
- *  and maps to key_name (LYK_foo in the keymap[] array). - FM
+ *  and maps to KeyName (LYK_foo in the keymap[] array). - FM
  */
 PUBLIC BOOL LYisNonAlnumKeyname ARGS2(
 	int,	ch,
-	int,	key_name)
+	int,	KeyName)
 {
     if ((ch >= '0' && ch <= '9') ||
         (ch >= 'A' && ch <= 'z') ||
 	ch < 0 || ch >= KEYMAP_SIZE)
 	return (FALSE);
 
-    return (BOOL) (keymap[ch+1] == key_name);
+    return (BOOL) (keymap[ch+1] == KeyName);
 }
 
 /*
@@ -1186,12 +1186,12 @@ PUBLIC BOOL LYisNonAlnumKeyname ARGS2(
  *  LYK_foo value passed to it as an argument. - FM
  */
 PUBLIC int LYReverseKeymap ARGS1(
-	int,	key_name)
+	int,	KeyName)
 {
     int i;
 
     for (i = 1; i < KEYMAP_SIZE; i++) {
-	if (keymap[i] == key_name) {
+	if (keymap[i] == KeyName) {
 	    return(i - 1);
 	}
     }
diff --git a/src/LYKeymap.h b/src/LYKeymap.h
index 518864fe..85ffb087 100644
--- a/src/LYKeymap.h
+++ b/src/LYKeymap.h
@@ -5,9 +5,9 @@
 #include <HTUtils.h>
 #endif
 
-extern BOOLEAN LYisNonAlnumKeyname PARAMS((int ch, int key_name));
+extern BOOLEAN LYisNonAlnumKeyname PARAMS((int ch, int KeyName));
 extern char *key_for_func PARAMS((int func));
-extern int LYReverseKeymap PARAMS((int key_name));
+extern int LYReverseKeymap PARAMS((int KeyName));
 extern int lookup_keymap PARAMS((int code));
 extern int lacname_to_lac PARAMS((CONST char *func));
 extern int lkcstring_to_lkc PARAMS((CONST char *src));
diff --git a/src/LYLeaks.c b/src/LYLeaks.c
index f4a5954c..d0f7acab 100644
--- a/src/LYLeaks.c
+++ b/src/LYLeaks.c
@@ -235,6 +235,75 @@ PUBLIC void *LYLeakMalloc ARGS3(
 }
 
 /*
+**  Purpose:	Add information about new allocation to the list,
+**		after a call to malloc or calloc or an equivalent
+**		function which may or may not have already created
+**		a list entry.
+**  Arguments:	vp_malloc	The pointer to newly allocate memory.
+**  Arguments:	st_bytes	The size of the allocation requested
+**				in bytes.
+**		cp_File 	The file from which the request for
+**				allocation came from.
+**		ssi_Line	The line number in cp_File where the
+**				allocation request came from.
+**  Return Value:	void *	A pointer to the allocated memory or NULL on
+**				failure.
+**  Remarks/Portability/Dependencies/Restrictions:
+**		If no memory is allocated, then no entry is added to the
+**		allocation list.
+**  Revision History:
+**	1999-02-08	created, modelled after LYLeakMalloc - kw
+*/
+PUBLIC AllocationList *LYLeak_mark_malloced ARGS4(
+	void *,		vp_malloced,
+	size_t, 	st_bytes,
+	CONST char *,	cp_File,
+	CONST short,	ssi_Line)
+{
+    AllocationList *ALp_new = NULL;
+    /*
+     *	The actual allocation has already been done!
+     *
+     *	Only on successful allocation do we track any information.
+     */
+    if (vp_malloced != NULL) {
+	/*
+	 *  See if there is already an entry.  If so, just
+	 *  update the source location info.
+	 */
+	ALp_new = FindInList(vp_malloced);
+	if (ALp_new) {
+	    ALp_new->SL_memory.cp_FileName = cp_File;
+	    ALp_new->SL_memory.ssi_LineNumber = ssi_Line;
+	    return(ALp_new);
+	}	    
+	/*
+	 *  Further allocate memory to store the information.
+	 *  Just return on failure to allocate more.
+	 */
+	ALp_new = (AllocationList *)calloc(1, sizeof(AllocationList));
+
+	if (ALp_new == NULL) {
+	    return(NULL);
+	}
+	/*
+	 *  Copy over the relevant information.
+	 */
+	ALp_new->vp_Alloced = vp_malloced;
+	ALp_new->st_Bytes = st_bytes;
+	ALp_new->SL_memory.cp_FileName = cp_File;
+	ALp_new->SL_memory.ssi_LineNumber = ssi_Line;
+
+	/*
+	 *  Add the new item to the allocation list.
+	 */
+	AddToList(ALp_new);
+    }
+
+    return(ALp_new);
+}
+
+/*
 **  Purpose:	Capture allocations by calloc (stdlib.h) and
 **		save relevant information in a list.
 **  Arguments:	st_number	The number of items to allocate.
@@ -390,6 +459,61 @@ PUBLIC void *LYLeakRealloc ARGS4(
 }
 
 /*
+**  Purpose:	Add information about reallocated memory to the list,
+**		after a call to realloc or an equivalent
+**		function which has not already created or updated
+**		a list entry.
+**  Arguments:	ALp_old   	List entry for previously allocated
+**				block of memory to resize.  If NULL,
+**				mark_realloced works just like
+**				mark_malloced.
+**		vp_realloced	The new pointer, after resizing.
+**		st_newBytes	The new size of the chunk of memory.
+**		cp_File 	The file to record.
+**		ssi_Line	The line to record.
+**  Return Value:	      	Pointer to new or updated list entry
+**				for this memory block.
+**				NULL on allocation error.
+**  Revision History:
+**	1999-02-11	created kw
+*/
+#if defined(LY_FIND_LEAKS) && defined(LY_FIND_LEAKS_EXTENDED)
+PRIVATE AllocationList *mark_realloced ARGS5(
+	AllocationList *, ALp_old,
+	void *, 	vp_realloced,
+	size_t, 	st_newBytes,
+	CONST char *,	cp_File,
+	CONST short,	ssi_Line)
+{
+    /*
+     *	If there is no list entry for the old allocation, treat this
+     *	as if a new allocation had happened.
+     */
+    if (ALp_old == NULL) {
+	return(LYLeak_mark_malloced(
+	    vp_realloced, st_newBytes, cp_File, ssi_Line));
+    }
+
+    /*
+     *	ALp_old represents the memory block before reallocation.
+     *  Assume that if we get here, there isn't yet a list entry
+     *  for the new, possibly different, address after realloc,
+     *  that is our list hasn't been updated - so we're going to
+     *  do that now.
+     */
+
+    if (vp_realloced != NULL) {
+	ALp_old->vp_Alloced = vp_realloced;
+	ALp_old->st_Bytes = st_newBytes;
+	ALp_old->SL_realloc.cp_FileName = cp_File;
+	ALp_old->SL_realloc.ssi_LineNumber = ssi_Line;
+    }
+
+    return(ALp_old);
+}
+#endif /* not LY_FIND_LEAKS and LY_FIND_LEAKS_EXTENDED */
+
+/*
 **  Purpose:	Capture all requests to free information and also
 **		remove items from the allocation list.
 **  Arguments:	vp_Alloced	The memory to free.
@@ -524,6 +648,230 @@ PUBLIC char * LYLeakSACat ARGS4(
     return *dest;
 }
 
+#if defined(LY_FIND_LEAKS) && defined(LY_FIND_LEAKS_EXTENDED)
+PUBLIC CONST char * leak_cp_File_hack = __FILE__;
+PUBLIC short leak_ssi_Line_hack = __LINE__;
+
+/*
+** Purpose:	A wrapper around StrAllocVsprintf (the workhorse of
+**		HTSprintf/HTSprintf0, implemented in HTString.c) that
+**		tries to make sure that our allocation list is always
+**		properly updated, whether StrAllocVsprintf itself was
+**		compiled with memory tracking or not (or even a mixture,
+**		like tracking the freeing but not the new allocation).
+**		Some source files can be compiled with LY_FIND_LEAKS_EXTENDED
+**		in effect while others only have LY_FIND_LEAKS in effect,
+**		and as long as HTString.c is complied with memory tracking
+**		(of either kind) string objects allocated by HTSprintf/
+**		HTSprintf0 (or otherwise) can be passed around among them and
+**		manipulated both ways.
+**  Arguments:	dest		As for StrAllocVsprintf.
+**		cp_File		The source file of the caller (i.e. the
+**				caller of HTSprintf/HTSprintf0, hopefully).
+**		ssi_Line	The line of cp_File calling.
+**		inuse,fmt,ap	As for StrAllocVsprintf.
+**  Return Value:	The char pointer to resulting string, as set
+**			by StrAllocVsprintf, or
+**			NULL if dest==0 (wrong use!).
+**  Remarks/Portability/Dependencies/Restrictions:
+**		The price for generality is severe inefficiency: several
+**		list lookups are done to be on the safe side.
+**		We don't get he real allocation size, only a minimum based
+**		on the string length of the result.  So the amount of memory
+**		leakage may get underestimated.
+**		If *dest is an invalid pointer value on entry (i.e. was not
+**		tracked), the program will exit after one last entry is added
+**		to the allocation list.
+**		If StrAllocVsprintf fails to return a valid string via the
+**		indirect string pointer (its first parameter), invalid memory
+**		access will result and the program will probably terminate
+**		with a signal.  This can happen if, on entry, *dest is NULL
+**		and fmt is empty or NULL, so just Don't Do That.
+**  Revision History:
+**	1999-02-11	created kw
+**	1999-10-15	added comments kw
+*/
+PRIVATE char * LYLeakSAVsprintf ARGS6(
+	char **,	dest,
+	CONST char *,	cp_File,
+	CONST short,	ssi_Line,
+	size_t,		inuse,
+	CONST char *,	fmt,
+	va_list,	ap)
+{
+    AllocationList *ALp_old;
+    void *vp_oldAlloced;
+    
+    CONST char * old_cp_File = __FILE__;
+    short old_ssi_Line = __LINE__;
+
+    if (!dest)
+	return NULL;
+
+    vp_oldAlloced = *dest;
+    if (!vp_oldAlloced) {
+	StrAllocVsprintf(dest, inuse, fmt, ap);
+	LYLeak_mark_malloced(*dest, strlen(*dest) + 1, cp_File, ssi_Line);
+	return(*dest);
+    } else {
+	void * vp_realloced;
+	ALp_old = FindInList(vp_oldAlloced);
+	if (ALp_old == NULL) {
+	    /*
+	     *  Track the invalid pointer value and then exit.
+	     *  If unable to allocate, just exit.
+	     */
+	    auto AllocationList *ALp_new =
+		(AllocationList *)calloc(1,
+					 sizeof(AllocationList));
+
+	    if (ALp_new == NULL) {
+		exit(-1);
+	    }
+
+	    /*
+	     *  Set the information up; no need to allocate file name
+	     *  since it is a static string.
+	     */
+	    ALp_new->vp_Alloced = NULL;
+	    ALp_new->vp_BadRequest = vp_oldAlloced;
+	    ALp_new->SL_realloc.cp_FileName = cp_File;
+	    ALp_new->SL_realloc.ssi_LineNumber = ssi_Line;
+
+	    /*
+	     *  Add the item to the list.
+	     *  Exit.
+	     */
+	    AddToList(ALp_new);
+	    exit(-1);
+	}
+
+	old_cp_File = ALp_old->SL_memory.cp_FileName;
+	old_ssi_Line = ALp_old->SL_memory.ssi_LineNumber;
+	/*
+	 *	DO THE REAL WORK, by calling StrAllocVsprintf.
+	 *	If result is not NULL, record the information.
+	 */
+	StrAllocVsprintf(dest, inuse, fmt, ap);
+	vp_realloced = (void *)*dest;
+	if (vp_realloced != NULL) {
+	    AllocationList *ALp_new = FindInList(vp_realloced);
+	    if (!ALp_new) {
+		/* Look up again, list may have changed! - kw */
+		ALp_old = FindInList(vp_oldAlloced);
+		if (ALp_old == NULL) {
+		    LYLeak_mark_malloced(*dest, strlen(*dest) + 1, cp_File, ssi_Line);
+		    return(*dest);
+		}
+		mark_realloced(ALp_old, *dest, strlen(*dest) + 1, cp_File, ssi_Line);
+		return(*dest);
+	    }
+	    if (vp_realloced == vp_oldAlloced) {
+		ALp_new->SL_memory.cp_FileName = old_cp_File;
+		ALp_new->SL_memory.ssi_LineNumber = old_ssi_Line;
+		ALp_new->SL_realloc.cp_FileName = cp_File;
+		ALp_new->SL_realloc.ssi_LineNumber = ssi_Line;
+		return(*dest);
+	    }
+	    /* Look up again, list may have changed! - kw */
+	    ALp_old = FindInList(vp_oldAlloced);
+	    if (ALp_old == NULL) {
+		ALp_new->SL_memory.cp_FileName = old_cp_File;
+		ALp_new->SL_memory.ssi_LineNumber = old_ssi_Line;
+		ALp_new->SL_realloc.cp_FileName = cp_File;
+		ALp_new->SL_realloc.ssi_LineNumber = ssi_Line;
+	    } else {
+		ALp_new->SL_memory.cp_FileName = old_cp_File;
+		ALp_new->SL_memory.ssi_LineNumber = old_ssi_Line;
+		ALp_new->SL_realloc.cp_FileName = cp_File;
+		ALp_new->SL_realloc.ssi_LineNumber = ssi_Line;
+	    }
+	}
+	return(*dest);
+    }
+}
+
+/* Note: the following may need updating if HTSprintf in HTString.c
+ * is changed. - kw */
+#if ANSI_VARARGS
+PRIVATE char * LYLeakHTSprintf (char **pstr, CONST char *fmt, ...)
+#else
+PRIVATE char * LYLeakHTSprintf (va_alist)
+    va_dcl
+#endif
+{
+    char *str;
+    size_t inuse = 0;
+    va_list ap;
+    LYva_start(ap,fmt);
+    {
+#if !ANSI_VARARGS
+	char **		pstr = va_arg(ap, char **);
+	CONST char *	fmt  = va_arg(ap, CONST char *);
+#endif
+	if (pstr != 0 && *pstr != 0)
+	    inuse = strlen(*pstr);
+	str = LYLeakSAVsprintf(pstr, leak_cp_File_hack, leak_ssi_Line_hack,
+			       inuse, fmt, &ap);
+    }
+    va_end(ap);
+    return str;
+}
+
+/* Note: the following may need updating if HTSprintf0 in HTString.c
+ * is changed. - kw */
+#if ANSI_VARARGS
+PRIVATE char * LYLeakHTSprintf0 (char **pstr, CONST char *fmt, ...)
+#else
+PRIVATE char * LYLeakHTSprintf0 (va_alist)
+    va_dcl
+#endif
+{
+    char *str;
+    va_list ap;
+    LYva_start(ap,fmt);
+    {
+#if !ANSI_VARARGS
+	char **		pstr = va_arg(ap, char **);
+	CONST char *	fmt  = va_arg(ap, CONST char *);
+#endif
+	str = LYLeakSAVsprintf(pstr, leak_cp_File_hack, leak_ssi_Line_hack,
+			       0, fmt, &ap);
+    }
+    va_end(ap);
+    return str;
+}
+
+/*
+ *  HTSprintf and HTSprintf0 will be defined such that they effectively
+ *  call one of the following two functions that store away a copy to
+ *  the File & Line info in temporary hack variables, and then call
+ *  the real function (which is returned here as a function pointer)
+ *  to the regular HTSprintf/HTSprintf0 arguments.
+ *  It's probably a bit inefficient, but that shouldn't be noticeable
+ *  compared to all the time that memory tracking takes up for list
+ *  traversal. - kw
+ */
+PUBLIC HTSprintflike *Get_htsprintf_fn ARGS2(
+	CONST char *,	cp_File,
+	CONST short,	ssi_Line)
+{
+    leak_cp_File_hack = cp_File;
+    leak_ssi_Line_hack = ssi_Line;
+    return &LYLeakHTSprintf;
+}
+
+PUBLIC HTSprintflike *Get_htsprintf0_fn ARGS2(
+	CONST char *,	cp_File,
+	CONST short,	ssi_Line)
+{
+    leak_cp_File_hack = cp_File;
+    leak_ssi_Line_hack = ssi_Line;
+    return &LYLeakHTSprintf0;
+}
+
+#endif /* not LY_FIND_LEAKS and LY_FIND_LEAKS_EXTENDED */
+
 /*
 **  Purpose:	Add a new allocation item to the list.
 **  Arguments:		ALp_new The new item to add.
diff --git a/src/LYLocal.c b/src/LYLocal.c
index 735fccdc..25ce7699 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -287,7 +287,7 @@ struct dired_menu {
 PRIVATE BOOLEAN cannot_stat ARGS1(CONST char *, name)
 {
     char *tmpbuf = 0;
-    HTSprintf(&tmpbuf, gettext("Unable to get status of '%s'."), name);
+    HTSprintf0(&tmpbuf, gettext("Unable to get status of '%s'."), name);
     HTAlert(tmpbuf);
     FREE(tmpbuf);
     return FALSE;
@@ -356,7 +356,7 @@ PRIVATE int move_file ARGS2(char *, source, char *, target)
     char *msg = 0;
     char *args[5];
 
-    HTSprintf(&msg, gettext("move %s to %s"), source, target);
+    HTSprintf0(&msg, gettext("move %s to %s"), source, target);
     args[0] = "mv";
     args[1] = source;
     args[2] = target;
@@ -869,7 +869,7 @@ PRIVATE BOOLEAN create_file ARGS1(
 	 */
 	if (not_already_exists(testpath)) {
 	    char *msg = 0;
-	    HTSprintf(&msg,gettext("create %s"),testpath);
+	    HTSprintf0(&msg,gettext("create %s"),testpath);
 	    args[0] = "touch";
 	    args[1] = testpath;
 	    args[2] = (char *) 0;
@@ -914,7 +914,7 @@ PRIVATE BOOLEAN create_directory ARGS1(
 	 */
 	if (not_already_exists(testpath)) {
 	    char *msg = 0;
-	    HTSprintf(&msg,"make directory %s",testpath);
+	    HTSprintf0(&msg,"make directory %s",testpath);
 	    args[0] = "mkdir";
 	    args[1] = testpath;
 	    args[2] = (char *) 0;
@@ -1322,7 +1322,7 @@ PRIVATE BOOLEAN permit_location ARGS3(
 	/*
 	 *  Call chmod().
 	 */
-	HTSprintf(&tmpbuf, "chmod %.4o %s", (unsigned int)new_mode, destpath);
+	HTSprintf0(&tmpbuf, "chmod %.4o %s", (unsigned int)new_mode, destpath);
 	sprintf(amode, "%.4o", (unsigned int)new_mode);
 	args[0] = "chmod";
 	args[1] = amode;
@@ -2090,7 +2090,7 @@ PUBLIC BOOLEAN local_install ARGS3(
 	    return 0;		/* don't do it */
 	}
 	args[src] = savepath;
-	HTSprintf(&tmpbuf, "install %s in %s", savepath, destpath);
+	HTSprintf0(&tmpbuf, "install %s in %s", savepath, destpath);
 	if (LYExecv(INSTALL_PATH, args, tmpbuf) <= 0) {
 	    FREE(tmpbuf);
 	    FREE(tmpdest);
@@ -2099,7 +2099,7 @@ PUBLIC BOOLEAN local_install ARGS3(
 	count++;
     } else {
 	char *name;
-	HTSprintf(&tmpbuf, "install in %s", destpath);
+	HTSprintf0(&tmpbuf, "install in %s", destpath);
 	while ((name = (char *)HTList_nextObject(tag))) {
 	    int err;
 	    args[src] = HTfullURL_toFile(name);
@@ -2333,7 +2333,7 @@ PRIVATE int LYExecv ARGS3(
     char *tmpbuf = 0;
 #ifdef __DJGPP__
     stop_curses();
-    HTSprintf(&tmpbuf, "%s", path);
+    HTSprintf0(&tmpbuf, "%s", path);
     for (n = 1; argv[n] != 0; n++)
 	HTSprintf(&tmpbuf, " %s", argv[n]);
     HTSprintf(&tmpbuf, "\n");
@@ -2357,7 +2357,7 @@ PRIVATE int LYExecv ARGS3(
     pid = fork();	/* fork and execute command */
     switch (pid) {
 	case -1:
-	    HTSprintf(&tmpbuf, gettext("Unable to %s due to system error!"), msg);
+	    HTSprintf0(&tmpbuf, gettext("Unable to %s due to system error!"), msg);
 	    rc = 0;
 	    break;	/* don't fall thru! - KW */
 	case 0:  /* child */
@@ -2386,7 +2386,7 @@ PRIVATE int LYExecv ARGS3(
 #endif /* !HAVE_WAITPID */
 	    if (WEXITSTATUS(wstatus) != 0 ||
 		WTERMSIG(wstatus) > 0)	{ /* error return */
-		HTSprintf(&tmpbuf, gettext("Probable failure to %s due to system error!"),
+		HTSprintf0(&tmpbuf, gettext("Probable failure to %s due to system error!"),
 				   msg);
 		rc = 0;
 	    }
diff --git a/src/LYMain.c b/src/LYMain.c
index baeb89b8..8c06d910 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -86,11 +86,6 @@ PUBLIC char *syslog_txt = NULL;		/* syslog arb text for session */
 PUBLIC char *LYCSwingPath = NULL;
 #endif /* VMS */
 
-#if HAVE_CUSERID && !defined(_XOPEN_SOURCE)
-/*extern char *cuserid();*/		/* workaround for Redhat 6.0 */
-		/* for the price of screwing up legitimate systems? Nah. */
-#endif
-
 #ifdef DIRED_SUPPORT
 PUBLIC BOOLEAN lynx_edit_mode = FALSE;
 PUBLIC BOOLEAN no_dired_support = FALSE;
@@ -444,15 +439,13 @@ PUBLIC BOOL ok_justify = TRUE;
 PUBLIC BOOLEAN with_backspaces = FALSE;
 #endif
 
-#ifndef NO_EMPTY_HREFLESS_A
 PUBLIC BOOL force_empty_hrefless_a = FALSE;
-#endif
 
 #ifndef NO_NONSTICKY_INPUTS
 PUBLIC BOOL sticky_inputs = TRUE;
+PUBLIC BOOL textfield_stop_at_left_edge=FALSE;
 #endif
 
-PUBLIC BOOL textfield_stop_at_left_edge=TRUE;
 
 #ifdef DISP_PARTIAL
 PUBLIC BOOLEAN display_partial_flag = TRUE; /* Display document during download */
@@ -1872,8 +1865,12 @@ PUBLIC int main ARGS2(
      *  interruptible (terminal is in raw mode, select() works).  -BL
      */
 #ifdef USE_PSRC
-    if (!dump_output_immediately)
-	HTMLSRC_init_caches(); /* do it before terminal is initialized*/
+    if (!dump_output_immediately) {
+	HTMLSRC_init_caches(FALSE); /* do it before terminal is initialized*/
+#ifdef LY_FIND_LEAKS
+	atexit(html_src_clean_data);
+#endif
+    }
 #endif
 
     if (!dump_output_immediately) {
@@ -2127,6 +2124,10 @@ PUBLIC void reload_read_cfg NOARGS
 	custom_display_charset = FALSE;
 	memset((char*)charset_subsets, 0, sizeof(charset_subset_t)*MAXCHARSETS);
 #endif
+
+#ifdef USE_PSRC
+	html_src_on_lynxcfg_reload();
+#endif
 	free_lynx_cfg(); /* free downloaders, printers, environments */
 	/*
 	 *  Process the configuration file.
@@ -2447,6 +2448,7 @@ static int convert_to_fun ARGS1(
 	    }
 	}
 	HTOutputFormat = HTAtom_for(outformat);
+	FREE(outformat);
     } else {
 	HTOutputFormat = NULL;
     }
@@ -3090,7 +3092,8 @@ with -dump, format output as with -traversal, but to stdout"
    ),
    PARSE_SET(
       "dont_wrap_pre",	SET_ARG,		&dont_wrap_pre,
-      "inhibit wrapping of text in <pre> when -dump'ing and -crawl'ing"
+      "inhibit wrapping of text in <pre> when -dump'ing and \n"
+      "-crawl'ing, mark wrapped lines in interactive session"
    ),
    PARSE_FUN(
       "dump",		FUNCTION_ARG,		dump_output_fun,
@@ -3147,12 +3150,10 @@ keys (may be incompatible with some curses packages)"
       "from",		TOGGLE_ARG,		&LYNoFromHeader,
       "toggle transmissions of From headers"
    ),
-#ifndef NO_EMPTY_HREFLESS_A
    PARSE_SET(
       "force_empty_hrefless_a",	SET_ARG,	&force_empty_hrefless_a,
       "force HREF-less 'A' elements to be empy (close them as soon as they are seen)"
    ),
-#endif
 #if !defined(NO_OPTION_FORMS) && !defined(NO_OPTION_MENU)
    PARSE_SET(
       "forms_options",	TOGGLE_ARG,		&LYUseFormsOptions,
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 1c8f18d8..157fe2a7 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -209,6 +209,8 @@ PRIVATE document newdoc;
 PRIVATE document curdoc;
 PRIVATE char *traversal_host = NULL;
 PRIVATE char *traversal_link_to_add = NULL;
+PRIVATE char *owner_address = NULL;  /* Holds the responsible owner's address     */
+PRIVATE char *ownerS_address = NULL; /* Holds owner's address during source fetch */
 
 #ifndef NO_NONSTICKY_INPUTS
 PRIVATE BOOL textinput_activated = FALSE;
@@ -238,6 +240,8 @@ PRIVATE void free_mainloop_variables NOARGS
 #endif
     FREE(traversal_host);
     FREE(traversal_link_to_add);
+    FREE(owner_address);
+    FREE(ownerS_address);
 #ifdef DIRED_SUPPORT
     clear_tags();
 #endif /* DIRED_SUPPORT */
@@ -530,7 +534,8 @@ PRIVATE void do_check_goto_URL ARGS3(
     }
 }
 
-PRIVATE void do_check_recall ARGS7(
+/* returns FALSE if user cancelled input or URL was invalid, TRUE otherwise */
+PRIVATE BOOL do_check_recall ARGS7(
     int,	ch,
     char *,	user_input_buffer,
     char **,	old_user_input,
@@ -540,6 +545,7 @@ PRIVATE void do_check_recall ARGS7(
     BOOLEAN *,	FirstURLRecall)
 {
     char *cp;
+    BOOL ret = FALSE;
 
     if (*old_user_input == 0)
 	StrAllocCopy(*old_user_input, "");
@@ -565,6 +571,7 @@ PRIVATE void do_check_recall ARGS7(
 		HTUserMsg2(WWW_ILLEGAL_URL_MESSAGE, user_input_buffer);
 		strcpy(user_input_buffer, *old_user_input);
 		FREE(*old_user_input);
+		ret = FALSE;
 		break;
 	    }
 	}
@@ -580,6 +587,7 @@ PRIVATE void do_check_recall ARGS7(
 	    strcpy(user_input_buffer, *old_user_input);
 	    FREE(*old_user_input);
 	    HTInfoMsg(CANCELLED);
+	    ret = FALSE;
 	    break;
 	}
 	if (recall && ch == UPARROW) {
@@ -623,6 +631,7 @@ PRIVATE void do_check_recall ARGS7(
 		    strcpy(user_input_buffer, *old_user_input);
 		    FREE(*old_user_input);
 		    HTInfoMsg(CANCELLED);
+		    ret = FALSE;
 		    break;
 		}
 		continue;
@@ -666,14 +675,17 @@ PRIVATE void do_check_recall ARGS7(
 		    strcpy(user_input_buffer, *old_user_input);
 		    FREE(*old_user_input);
 		    HTInfoMsg(CANCELLED);
+		    ret = FALSE;
 		    break;
 		}
 		continue;
 	    }
 	} else {
+	    ret = TRUE;
 	    break;
 	}
     }
+    return ret;
 }
 
 PRIVATE void do_cleanup_after_delete NOARGS
@@ -809,6 +821,44 @@ PRIVATE int DoTraversal ARGS2(
     return c;
 }
 
+#ifndef DONT_TRACK_INTERNAL_LINKS
+PRIVATE BOOLEAN check_history NOARGS
+{
+    CONST char *base;
+
+    if (!curdoc.post_data)
+	/*
+	 *  Normal case - List Page is not associated
+	 *  with post data. - kw
+	 */
+	return TRUE;
+
+    if (nhist > 0
+     && !LYresubmit_posts
+     && curdoc.post_data
+     && history[nhist - 1].post_data
+     && !strcmp(curdoc.post_data, history[nhist - 1].post_data)
+     && (base = HText_getContentBase()) != 0) {
+	 char *text = strncmp(history[nhist - 1].address, "LYNXIMGMAP:", 11)
+		     ? history[nhist - 1].address
+		     : history[nhist - 1].address + 11;
+	if (!strncmp(base, text, strlen(base))) {
+	    /*
+	     * Normal case - as best as we can check, the document at the top
+	     * of the history stack seems to be the document the List Page is
+	     * about (or a LYNXIMGMAP derived from it), and LYresubmit_posts is
+	     * not set, so don't prompt here.  If we actually have to repeat a
+	     * POST because, against expectations, the underlying document
+	     * isn't cached any more, HTAccess will prompt for confirmation,
+	     * unless we had LYK_NOCACHE -kw
+	     */
+	    return TRUE;
+	}
+    }
+    return FALSE;
+}
+#endif
+
 PRIVATE int handle_LYK_ACTIVATE ARGS7(
     int *,	c,
     int,	cmd GCC_UNUSED,
@@ -1173,34 +1223,7 @@ gettext("Enctype multipart/form-data not yet supported!  Cannot submit."));
 		 */
 		if ( 0==strcmp(curdoc.address, LYlist_temp_url()) &&
 		    (LYIsListpageTitle(curdoc.title ? curdoc.title : ""))) {
-		    if (!curdoc.post_data ||
-			/*
-			 *  Normal case - List Page is not associated
-			 *  with post data. - kw
-			 */
-			(!LYresubmit_posts && curdoc.post_data &&
-			history[nhist - 1].post_data &&
-			!strcmp(curdoc.post_data,
-				 history[nhist - 1].post_data) &&
-			HText_getContentBase() &&
-			!strncmp(HText_getContentBase(),
-				 strncmp(history[nhist - 1].address,
-					 "LYNXIMGMAP:", 11) ?
-				 history[nhist - 1].address :
-				 history[nhist - 1].address + 11,
-				 strlen(HText_getContentBase())))) {
-			/*
-			 *  Normal case - as best as we can check, the
-			 *  document at the top of the history stack
-			 *  seems to be the document the List Page is
-			 *  about (or a LYNXIMGMAP derived from it),
-			 *  and LYresubmit_posts is not set, so don't
-			 *  prompt here.  If we actually have to repeat
-			 *  a POST because, against expectations, the
-			 *  underlying document isn't cached any more,
-			 *  HTAccess will prompt for confirmation,
-			 *  unless we had LYK_NOCACHE. - kw
-			 */
+		    if (check_history()) {
 			LYinternal_flag = TRUE;
 		    } else {
 			HTLastConfirmCancelled(); /* reset flag */
@@ -1532,13 +1555,13 @@ PRIVATE void handle_LYK_CLEAR_AUTH ARGS2(
 
 PRIVATE void handle_LYK_COMMENT ARGS4(
     BOOLEAN *,	refresh_screen,
-    char *,	owner_address,
+    char **,	owner_address_p,
     int *,	old_c,
     int,	real_c)
 {
     int	c;
 
-    if (!owner_address &&
+    if (!*owner_address_p &&
 	strncasecomp(curdoc.address, "http", 4)) {
 	if (*old_c != real_c)	{
 	    *old_c = real_c;
@@ -1551,7 +1574,7 @@ PRIVATE void handle_LYK_COMMENT ARGS4(
 	}
     } else {
 	if (HTConfirmDefault(CONFIRM_COMMENT, NO)) {
-	    if (!owner_address) {
+	    if (!*owner_address_p) {
 		/*
 		 *  No owner defined, so make a guess and
 		 *  and offer it to the user. - FM
@@ -1585,18 +1608,18 @@ PRIVATE void handle_LYK_COMMENT ARGS4(
 		c = HTConfirmDefault(temp, NO);
 		FREE(temp);
 		if (c == YES) {
-		    StrAllocCopy(owner_address, address);
+		    StrAllocCopy(*owner_address_p, address);
 		    FREE(address);
 		} else {
 		    FREE(address);
 		    return;
 		}
 	    }
-	    if (is_url(owner_address) != MAILTO_URL_TYPE) {
+	    if (is_url(*owner_address_p) != MAILTO_URL_TYPE) {
 		/*
 		 *  The address is a URL.  Just follow the link.
 		 */
-		StrAllocCopy(newdoc.address, owner_address);
+		StrAllocCopy(newdoc.address, *owner_address_p);
 		newdoc.internal_link = FALSE;
 	    } else {
 		/*
@@ -1616,15 +1639,15 @@ PRIVATE void handle_LYK_COMMENT ARGS4(
 		    }
 		}
 
-		if (strchr(owner_address,':')!=NULL)
+		if (strchr(*owner_address_p,':')!=NULL)
 		     /*
 		      *  Send a reply.	The address is after the colon.
 		      */
-		     reply_by_mail(strchr(owner_address,':')+1,
+		     reply_by_mail(strchr(*owner_address_p,':')+1,
 				   curdoc.address,
 				   (kp ? kp : ""), id);
 		else
-		    reply_by_mail(owner_address, curdoc.address,
+		    reply_by_mail(*owner_address_p, curdoc.address,
 				  (kp ? kp : ""), id);
 
 		FREE(tmptitle);
@@ -2368,7 +2391,7 @@ PRIVATE void handle_LYK_DWIMHELP ARGS1(
     CONST char **,	cshelpfile)
 {
     /*
-     *  Currently a different help file form the main
+     *  Currently a help file different from the main
      *  'helpfile' is shown only if current link is a
      *  text input form field. - kw
      */
@@ -3166,9 +3189,8 @@ PRIVATE void handle_LYK_INDEX_SEARCH ARGS4(
     }
 }
 
-PRIVATE BOOLEAN handle_LYK_INFO ARGS3(
+PRIVATE BOOLEAN handle_LYK_INFO ARGS2(
     char *,	prev_target,
-    char *,	owner_address,
     int *,	cmd)
 {
     /*
@@ -4194,7 +4216,7 @@ PRIVATE void handle_LYK_SOFT_DQUOTES NOARGS
  * seek confirmation if the safe element is not set.  - FM
  */
 PRIVATE void handle_LYK_SOURCE ARGS1(
-    char **,	ownerS_address)
+    char **,	ownerS_address_p)
 {
     if ((curdoc.post_data != NULL &&
 	 curdoc.safe != TRUE) &&
@@ -4211,7 +4233,7 @@ PRIVATE void handle_LYK_SOURCE ARGS1(
 #endif
     } else {
 	if (HText_getOwner())
-	    StrAllocCopy(*ownerS_address, HText_getOwner());
+	    StrAllocCopy(*ownerS_address_p, HText_getOwner());
 	LYUCPushAssumed(HTMainAnchor);
 #ifdef USE_PSRC
 	if (LYpsrc)
@@ -4236,7 +4258,7 @@ PRIVATE void handle_LYK_SOURCE ARGS1(
 	    HTMark_asSource();
 	psrc_view = FALSE;
 #endif
-	FREE(*ownerS_address);  /* not used with source_cache */
+	FREE(*ownerS_address_p);  /* not used with source_cache */
 	LYUCPopAssumed();	/* probably a right place here */
 	HTMLSetCharacterHandling(current_char_set);  /* restore now */
 
@@ -4716,7 +4738,7 @@ PRIVATE void handle_LYK_WHEREIS ARGS3(
     /*
      *	Force a redraw to ensure highlighting of hits
      *	even when found on the same page, or clearing
-     *	of highlighting is the default search string
+     *	of highlighting if the default search string
      *	was erased without replacement. - FM
      */
     /*
@@ -4783,34 +4805,7 @@ PRIVATE void handle_LYK_digit ARGS7(
 	    newdoc.internal_link = TRUE;
 	    if (LYIsListpageTitle(curdoc.title ? curdoc.title : "") &&
 		0==strcmp(HTLoadedDocumentURL(), LYlist_temp_url())) {
-		if (!curdoc.post_data ||
-		    /*
-		     *	Normal case - List Page is not associated
-		     *	with post data. - kw
-		     */
-		    (!LYresubmit_posts && curdoc.post_data &&
-		     history[nhist - 1].post_data &&
-		     !strcmp(curdoc.post_data,
-			     history[nhist - 1].post_data) &&
-		     HText_getContentBase() &&
-		     !strncmp(HText_getContentBase(),
-			      strncmp(history[nhist - 1].address,
-				      "LYNXIMGMAP:", 11) ?
-			      history[nhist - 1].address :
-			      history[nhist - 1].address + 11,
-			      strlen(HText_getContentBase())))) {
-		    /*
-		     *	Normal case - as best as we can check, the
-		     *	document at the top of the history stack
-		     *	seems to be the document the List Page is
-		     *	about (or a LYNXIMGMAP derived from it),
-		     *	and LYresubmit_posts is not set, so don't
-		     *	prompt here.  If we actually have to repeat
-		     *	a POST because, against expectations, the
-		     *	underlying document isn't cached any more,
-		     *	HTAccess will prompt for confirmation,
-		     *	unless we had LYK_NOCACHE. - kw
-		     */
+		if (check_history()) {
 		    LYinternal_flag = TRUE;
 		} else {
 		    HTLastConfirmCancelled(); /* reset flag */
@@ -4984,8 +4979,6 @@ int mainloop NOARGS
     int arrowup = FALSE, show_help = FALSE;
     char prev_target[512];
     char user_input_buffer[MAX_LINE];
-    char *owner_address = NULL;  /* Holds the responsible owner's address     */
-    char *ownerS_address = NULL; /* Holds owner's address during source fetch */
     CONST char *cshelpfile = NULL;
     BOOLEAN first_file = TRUE;
     BOOLEAN popped_doc = FALSE;
@@ -6037,6 +6030,7 @@ try_again:
 #ifndef NO_NONSTICKY_INPUTS
 	    textinput_drawn = FALSE;
 #endif
+
 	    refresh_screen = FALSE;
 
 	    HText_pageDisplay(Newline, prev_target);
@@ -6621,7 +6615,7 @@ new_cmd:  /*
 	case LYK_TO_CLIPBOARD:	/* ^S */
 	    {
 		if (put_clip(links[curdoc.link].lname) == 0) {
-		    HTInfoMsg("URL to Clip Borad.");
+		    HTInfoMsg("URL to Clip Board.");
 		} else {
 		    HTInfoMsg("Current URL is empty.");
 		}
@@ -6765,9 +6759,9 @@ new_cmd:  /*
 	    if (handle_LYK_GOTO(&ch, user_input_buffer, &temp, &recall,
 				&URLTotal, &URLNum, &FirstURLRecall, &old_c,
 				real_c)) {
-		do_check_recall (ch, user_input_buffer, &temp, URLTotal,
-				 &URLNum, recall, &FirstURLRecall);
-		do_check_goto_URL(user_input_buffer, &temp, &force_load);
+		if (do_check_recall (ch, user_input_buffer, &temp, URLTotal,
+				 &URLNum, recall, &FirstURLRecall))
+		    do_check_goto_URL(user_input_buffer, &temp, &force_load);
 	    }
 	    break;
 
@@ -6801,8 +6795,8 @@ new_cmd:  /*
 	    handle_LYK_WHEREIS(cmd, prev_target, &refresh_screen);
 	    break;
 
-	case LYK_COMMENT:	/* reply by mail */
-	    handle_LYK_COMMENT(&refresh_screen, owner_address, &old_c, real_c);
+	case LYK_COMMENT: 	/* reply by mail */
+	    handle_LYK_COMMENT(&refresh_screen, &owner_address, &old_c, real_c);
 	    break;
 
 #ifdef DIRED_SUPPORT
@@ -6849,7 +6843,7 @@ new_cmd:  /*
 #endif /* DIRED_SUPPORT && OK_INSTALL */
 
 	case LYK_INFO:		/* show document info */
-	    if (handle_LYK_INFO(prev_target, owner_address, &cmd))
+	    if (handle_LYK_INFO(prev_target, &cmd))
 		goto new_cmd;
 	    break;
 
@@ -6969,9 +6963,9 @@ new_cmd:  /*
 	    if (handle_LYK_JUMP(c, user_input_buffer, &temp, &recall,
 				    &FirstURLRecall, &URLNum, &URLTotal, &ch,
 				    &old_c, real_c)) {
-		do_check_recall (ch, user_input_buffer, &temp, URLTotal,
-				 &URLNum, recall, &FirstURLRecall);
-		do_check_goto_URL(user_input_buffer, &temp, &force_load);
+		if (do_check_recall (ch, user_input_buffer, &temp, URLTotal,
+				 &URLNum, recall, &FirstURLRecall))
+		    do_check_goto_URL(user_input_buffer, &temp, &force_load);
 	    }
 	    break;
 
diff --git a/src/LYMap.c b/src/LYMap.c
index b74c743d..04cc663e 100644
--- a/src/LYMap.c
+++ b/src/LYMap.c
@@ -533,7 +533,7 @@ PRIVATE int LYLoadIMGmap ARGS4 (
 			   sink, anAnchor);
 
     if (!target || target == NULL) {
-	HTSprintf(&buf, CANNOT_CONVERT_I_TO_O,
+	HTSprintf0(&buf, CANNOT_CONVERT_I_TO_O,
 		HTAtom_name(format_in), HTAtom_name(format_out));
 	HTAlert(buf);
 	FREE(buf);
diff --git a/src/LYOptions.c b/src/LYOptions.c
index ba1e2973..ab88556a 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -2592,7 +2592,7 @@ redraw:
 	    cmd = LYK_QUIT;
 #ifndef USE_SLANG
 	} else if (c == MOUSE_KEY) {
-	    if ((cmd = fancy_mouse(form_window, i + 1 + window_offset, &cur_choice)) < 0)
+	    if ((cmd = fancy_mouse(form_window, i + 1 - window_offset, &cur_choice)) < 0)
 		goto redraw;
 	    if  (cmd == LYK_ACTIVATE)
 		break;
diff --git a/src/LYPrettySrc.c b/src/LYPrettySrc.c
index f7e5538c..3b279c8b 100644
--- a/src/LYPrettySrc.c
+++ b/src/LYPrettySrc.c
@@ -6,6 +6,10 @@
 #include <LYHash.h>
 #include <LYPrettySrc.h>
 
+ /* This file creates too many "leak detected" entries in Lynx.leaks. */
+#define NO_MEMORY_TRACKING
+#include <LYLeaks.h>
+
 #ifdef USE_PSRC
 BOOL psrc_convert_string = FALSE;
 PUBLIC BOOL psrc_view = FALSE;/* this is read by SGML_put_character - TRUE
@@ -21,7 +25,7 @@ PUBLIC BOOL mark_htext_as_source=FALSE;
      support), the style cache and markup are created before entering the
      mainloop. */
 PUBLIC BOOL psrcview_no_anchor_numbering = FALSE;
-PUBLIC char* HTL_tagspecs[HTL_num_lexems] = {
+PRIVATE char* HTL_tagspecs_defaults[HTL_num_lexemes] = {
  /* these values are defaults. They are also listed in comments of distibution's
      lynx.cfg.*/
 #ifdef USE_COLOR_STYLE
@@ -38,26 +42,27 @@ PUBLIC char* HTL_tagspecs[HTL_num_lexems] = {
     "span.htmlsrc_badattr:!span",
     "span.htmlsrc_sgmlspecial:!span"
 #else
-    "b:!b",
-    "b:!b",
-    ":",
-    "!b:b",
-    "b:!b",
-    "b:!b",
-    ":",
-    ":",
-    "b:!b",
-    ":",
-    "!b:b",
-    "b:!b"
+    "b:!b",	/*	comment	*/
+    "b:!b",	/*	tag	*/
+    "b:!b",	/*	attrib	*/
+    ":",	/*	attrval	*/
+    "b:!b",	/*	abracket*/
+    "b:!b",	/*	entity	*/
+    ":",	/*	href	*/
+    ":",	/*	entire	*/
+    "b:!b",	/*	badseq	*/
+    ":",	/*	badtag	*/
+    ":",	/*	badattr	*/
+    "b:!b"	/*	sgmlspec*/
 #endif
 };
 
+PUBLIC char* HTL_tagspecs[HTL_num_lexemes];
 
  /* these are pointers since tagspec can be empty (the pointer will be NULL
     in that case) */
-PUBLIC HT_tagspec* lexem_start[HTL_num_lexems];
-PUBLIC HT_tagspec* lexem_end[HTL_num_lexems];
+PUBLIC HT_tagspec* lexeme_start[HTL_num_lexemes];
+PUBLIC HT_tagspec* lexeme_end[HTL_num_lexemes];
 
 PUBLIC int tagname_transform = 2;
 PUBLIC int attrname_transform = 2;
@@ -102,6 +107,9 @@ PRIVATE void append_close_tag ARGS3(
     subj->present = (BOOL*)calloc( nattr*sizeof (BOOL), 1);
     subj->value = (char**)calloc( nattr*sizeof (char*), 1);
     subj->start = FALSE;
+#ifdef USE_COLOR_STYLE
+    subj->class_name = NULL;
+#endif
 
     if (!*head) {
 	*head = subj; *tail = subj;
@@ -150,17 +158,16 @@ PRIVATE void append_open_tag ARGS4(
 	hcode = hash_code_aggregate_lower_str(classname, hcode);
 	StrAllocCopy(subj->class_name, classname);
     } else {
-	subj->class_name = "";
+	StrAllocCopy(subj->class_name,"");
     }
     subj->style = hcode;
 #endif
 }
 
-
 /* returns 1 if incorrect */
 PUBLIC int html_src_parse_tagspec ARGS4(
 	char*,		ts,
-	HTlexem,	lexem,
+	HTlexeme,	lexeme,
 	BOOL,		checkonly,
 	BOOL,		isstart)
 {
@@ -172,7 +179,7 @@ PUBLIC int html_src_parse_tagspec ARGS4(
     char stop = FALSE, after_excl = FALSE;
     html_src_check_state state = HTSRC_CK_normal;
     HT_tagspec* head = NULL, *tail = NULL;
-    HT_tagspec** slot = ( isstart ? lexem_start : lexem_end ) +lexem;
+    HT_tagspec** slot = ( isstart ? lexeme_start : lexeme_end ) +lexeme;
 
     while (!stop) {
 	switch (state) {
@@ -190,7 +197,7 @@ PUBLIC int html_src_parse_tagspec ARGS4(
 		    default:
 			if (isalpha(*p) || *p == '_') {
 			    tagstart = p;
-			    while (*p && ( isalpha(*p) || *p == '_') )
+			    while (*p && ( isalnum(*p) || *p == '_') )
 				 ++p;
 			    tagend = p;
 			    state = HTSRC_CK_after_tagname;
@@ -243,7 +250,7 @@ PUBLIC int html_src_parse_tagspec ARGS4(
 			char save, save1;
 			if ( isalpha(*p) || *p == '_' ) {
 			    classstart = p;
-			    while (*p && ( isalpha(*p) || *p == '_') ) ++p;
+			    while (*p && ( isalnum(*p) || *p == '_') ) ++p;
 			    classend = p;
 			    save = *classend;
 			    *classend = '\0';
@@ -274,26 +281,67 @@ PUBLIC int html_src_parse_tagspec ARGS4(
     return 0;
 }
 
-/*it shouldn't fail anyway - since everything is checked before it's called. */
-PUBLIC void HTMLSRC_init_caches NOARGS
+/*this will clean the data associated with lexeme 'l' */
+PUBLIC void html_src_clean_item ARGS1(
+	HTlexeme, l)
+{
+    int i;
+    if (HTL_tagspecs[l])
+	FREE(HTL_tagspecs[l]);
+    for(i = 0; i < 2; ++i) {
+	HT_tagspec* cur,** pts = ( i ? lexeme_start : lexeme_end)+l,*ts = *pts;
+	*pts = NULL;
+	while (ts) {
+	    FREE(ts->present);
+	    FREE(ts->value);
+#ifdef USE_COLOR_STYLE
+	    if (ts->start) {
+		FREE(ts->class_name);
+	    }
+#endif
+	    cur = ts;
+	    ts = ts->next;
+	    FREE(cur);
+	}
+    }
+}
+
+/*this will be registered with atexit*/
+PUBLIC void html_src_clean_data NOARGS
+{
+    int i;
+    for (i = 0; i < HTL_num_lexemes; ++i)
+	html_src_clean_item(i);
+}
+
+PUBLIC void html_src_on_lynxcfg_reload NOARGS
+{
+    html_src_clean_data();
+    HTMLSRC_init_caches(TRUE);
+}
+
+PUBLIC void HTMLSRC_init_caches ARGS1(
+	BOOL,	dont_exit)
 {
     int i;
     char* p;
     char buf[1000];
 
-    for (i = 0; i < HTL_num_lexems; ++i) {
-	if (HTL_tagspecs[i])
-	    strcpy(buf, HTL_tagspecs[i]);
-	else
-	    buf[0] = '\0';
+    for (i = 0; i < HTL_num_lexemes; ++i) {
+
+	strcpy(buf, HTL_tagspecs_defaults[i]);
+	p = HTL_tagspecs_defaults[i];
+	HTL_tagspecs[i] = NULL;
+	StrAllocCopy(HTL_tagspecs[i],p);
+
 	if ((p = strchr(buf, ':')) != 0)
 	    *p = '\0';
-	if (html_src_parse_tagspec(buf, i, FALSE, TRUE) ) {
-	    fprintf(stderr, "internal error while caching 1st tagspec of %d lexem", i);
+	if (html_src_parse_tagspec(buf, i, FALSE, TRUE) && !dont_exit ) {
+	    fprintf(stderr, "internal error while caching 1st tagspec of %d lexeme", i);
 	    exit_immediately(-1);
 	}
-	if (html_src_parse_tagspec( p ? p+1 : NULL , i, FALSE, FALSE) )	 {
-	    fprintf(stderr, "internal error while caching 2nd tagspec of %d lexem", i);
+	if (html_src_parse_tagspec( p ? p+1 : NULL , i, FALSE, FALSE) && !dont_exit) {
+	    fprintf(stderr, "internal error while caching 2nd tagspec of %d lexeme", i);
 	    exit_immediately(-1);
 	}
     }
diff --git a/src/LYPrettySrc.h b/src/LYPrettySrc.h
index e49b3fd8..02a8f75f 100644
--- a/src/LYPrettySrc.h
+++ b/src/LYPrettySrc.h
@@ -23,8 +23,8 @@ extern BOOL psrc_first_tag; /* this is also used in HTML.c to trigger the
 
 extern BOOL mark_htext_as_source;
 
-/* here is a list of lexem codes. */
-typedef enum _HTlexem {
+/* here is a list of lexeme codes. */
+typedef enum _HTlexeme {
   HTL_comm=0,
   HTL_tag,
   HTL_attrib,
@@ -37,8 +37,8 @@ typedef enum _HTlexem {
   HTL_badtag,
   HTL_badattr,
   HTL_sgmlspecial,
-  HTL_num_lexems
-} HTlexem;
+  HTL_num_lexemes
+} HTlexeme;
 
 typedef struct _HT_tagspec
 {
@@ -55,13 +55,16 @@ typedef struct _HT_tagspec
     BOOL start; /* if true, then this starts element, otherwise - ends */    
 } HT_tagspec;
 
-extern char* HTL_tagspecs[HTL_num_lexems];
-extern HT_tagspec* lexem_start[HTL_num_lexems];
-extern HT_tagspec* lexem_end[HTL_num_lexems];
+extern char* HTL_tagspecs[HTL_num_lexemes];
+extern HT_tagspec* lexeme_start[HTL_num_lexemes];
+extern HT_tagspec* lexeme_end[HTL_num_lexemes];
 
-extern int html_src_parse_tagspec PARAMS((char* ts, HTlexem lexem,
+extern int html_src_parse_tagspec PARAMS((char* ts, HTlexeme lexeme,
                      BOOL checkonly,BOOL isstart));
-extern void HTMLSRC_init_caches NOPARAMS;
+extern void HTMLSRC_init_caches PARAMS((BOOL dont_exit));
+extern void html_src_clean_item PARAMS((HTlexeme l));
+extern void html_src_clean_data NOPARAMS;
+extern void html_src_on_lynxcfg_reload NOPARAMS;
 
 /* these 2 vars tell what kind of transform should be appiled to tag names
   and attribute names. 0 - lowercase, 1 - as is, 2 uppercase. */
diff --git a/src/LYPrint.c b/src/LYPrint.c
index 03ea1b04..6f660812 100644
--- a/src/LYPrint.c
+++ b/src/LYPrint.c
@@ -770,12 +770,13 @@ PRIVATE void send_file_to_mail ARGS3(
     if (keypad_mode)
 	printlist(outfile_fp, FALSE);
 
+#if defined(WIN_EX) || defined(__DJGPP__)
 #if defined(WIN_EX)	/* 1998/08/17 (Mon) 16:29:49 */
-    buffer = NULL;
     if (mail_is_blat)
 	HTSprintf0(&buffer, "%s %s -t \"%s\"",
 		system_mail, my_temp, user_response);
     else
+#endif /* WIN_EX */
 	HTSprintf0(&buffer, "%s -t \"%s\" -F %s",
 			system_mail, user_response, my_temp);
     LYCloseTempFP(outfile_fp);	/* Close the tmpfile. */
@@ -789,9 +790,9 @@ PRIVATE void send_file_to_mail ARGS3(
     SetOutputMode( O_BINARY );
 
     LYRemoveTemp(my_temp); /* Delete the tmpfile. */
-#else /* !WIN_EX */
+#else /* !WIN_EX && !__DJGPP__ */
     pclose(outfile_fp);
-#endif
+#endif /* WIN_EX || __DJGPP__ */
 #endif /* VMS */
 
 done:	/* send_file_to_mail() */
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index 2d47628e..e3adb938 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -659,6 +659,20 @@ static int keymap_fun ARGS1(
 		BOOLEAN success = FALSE;
 		int lkc = lkcstring_to_lkc(key);
 		int lec = -1;
+		/*
+		 *  PASS! tries to enter the key into the LYLineEditors
+		 *  bindings in a different way from PASS, namely as
+		 *  binding that maps to the specific lynx actioncode
+		 *  (rather than to LYE_FORM_PASS).  That only works
+		 *  for lynx keycodes with modifier bit set, and we
+		 *  have no documented/official way to specify this
+		 *  in the KEYMAP directive, although it can be made
+		 *  to work e.g. by specifying a hex value that has the
+		 *  modifier bit set.  But knowledge about the bit
+		 *  pattern of modifiers should remain in internal
+		 *  matter subject to change...  At any rate, if
+		 *  PASS! fails try it the same way as for PASS. - kw
+		 */
 		if (strcasecomp(efunc, "PASS!") == 0) {
 		    if (func) {
 			lec = LYE_FORM_LAC|lacname_to_lac(func);
@@ -1090,7 +1104,7 @@ static void html_src_bad_syntax ARGS2(
 
 
 static int parse_html_src_spec ARGS3(
-	    HTlexem, lexem_code,
+	    HTlexeme, lexeme_code,
 	    char*, value,
 	    char*, option_name)
 {
@@ -1109,16 +1123,17 @@ static int parse_html_src_spec ARGS3(
 	BS();
     *ts2 = '\0';
 
-    if ( html_src_parse_tagspec(value, lexem_code, TRUE, TRUE)
-	|| html_src_parse_tagspec(ts2, lexem_code, TRUE, TRUE) )
+    CTRACE((tfp,"ReadCFG - parsing tagspec '%s:%s' for option '%s'\n",value,ts2,option_name));
+    html_src_clean_item(lexeme_code);
+    if ( html_src_parse_tagspec(value, lexeme_code, FALSE, TRUE)
+	|| html_src_parse_tagspec(ts2, lexeme_code, FALSE, FALSE) )
     {
 	*ts2 = ':';
 	BS();
     }
 
     *ts2 = ':';
-    HTL_tagspecs[lexem_code] = NULL;
-    StrAllocCopy(HTL_tagspecs[lexem_code],value);
+    StrAllocCopy(HTL_tagspecs[lexeme_code],value);
 #undef BS
     return 0;
 }
@@ -1253,9 +1268,7 @@ static Config_Type Config_Table [] =
      PARSE_SET("focus_window", CONF_BOOL, &focus_window),
 #endif
      PARSE_SET("force_8bit_toupper", CONF_BOOL, &UCForce8bitTOUPPER),
-#ifndef NO_EMPTY_HREFLESS_A
      PARSE_SET("force_empty_hrefless_a", CONF_BOOL, &force_empty_hrefless_a),
-#endif
      PARSE_SET("force_ssl_cookies_secure", CONF_BOOL, &LYForceSSLCookiesSecure),
 #if !defined(NO_OPTION_FORMS) && !defined(NO_OPTION_MENU)
      PARSE_SET("forms_options", CONF_BOOL, &LYUseFormsOptions),
diff --git a/src/LYStrings.c b/src/LYStrings.c
index a4a7fe29..dd55c262 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -263,17 +263,32 @@ PRIVATE int XYdist ARGS5(
     int,	y2,
     int,	dx2)
 {
-    int xerr = x2 - x1, yerr = y2 - y1;
+    int xerr = 3 * (x2 - x1), yerr = 9 * (y2 - y1);
 
     if (xerr < 0)
-	xerr = x1 - x2 - dx2;
+	xerr = 3 * (x1 - x2 - dx2) + 1;	/* pos after string not really in it */
     if (xerr < 0)
 	xerr = 0;
     if (yerr < 0)
 	yerr = -yerr;
-    if (xerr < 3 && yerr)	/* x-distance of 3 better than y-dist of 1 */
-	return yerr + 1;
-    return (xerr + 2)/3 + yerr;	/* Subjective factor of distance */
+    if (!yerr)			/* same line is good */
+	return (xerr > 0) ? (xerr*2 - 1) : 0;
+    if (xerr < 9 && yerr)   /* x-dist of 3 cell better than y-dist of 1 cell */
+	yerr += (9 - xerr);
+    return 2 * xerr + yerr; /* Subjective factor; ratio -> approx. 6 / 9 */
+/*
+old: (IZ 1999-07-30)
+ 3  2  2  2  1  1  1 XX XX XX XX XX  0  1  1  1  2  2  2  3  3
+ 4\ 3  3  3  2  2  2  2  2  2  2  2  2  2  2  2  3  3  3/ 4  4
+ 5  4  4  4\ 3  3  3  3  3  3  3  3  3  3  3  3/ 4  4  4  5  5
+ 6  5  5  5  4  4  4  4  4  4  4  4  4  4  4  4  5  5  5  6  5
+now: (kw 1999-10-23)
+41 35 29|23 17 11  5 XX XX XX XX XX  1  7 13 19 25|31 37 43 49
+   45 39 33\27 24 21 18 18 18 18 18 19 22 25 28/34 40 46 50
+      48 42 36 33 30\27 27 27 27 27 28/31 34 37 43 49
+         51 45 42 39 36 36 36 36 36 37 40 43 46 49
+               51 48 45 45 45 45 45 46 49 52
+*/
 }
 
 /* Given X and Y coordinates of a mouse event, set mouse_link to the
@@ -312,9 +327,9 @@ PRIVATE int set_clicked_link ARGS4(
 	mouse_link = -2;
 	y -= 1 + (LYsb_arrow != 0);
 	if (y < 0)
-	    return INSERT_KEY;
+	    return LAC_TO_LKC0(LYK_UP_TWO);
 	if (y >= h)
-	    return REMOVE_KEY;
+	    return LAC_TO_LKC0(LYK_DOWN_TWO);
 #ifdef DISP_PARTIAL			/* Newline is not defined otherwise */
 	if (clicks >= 2) {
 	    double frac = (1. * y)/(h - 1);
@@ -327,13 +342,13 @@ PRIVATE int set_clicked_link ARGS4(
 	}
 #endif
 	if (y < LYsb_begin)
-	    return PGUP;
+	    return LAC_TO_LKC0(LYK_PREV_PAGE);
 	if (y >= LYsb_end)
-	    return PGDOWN;
+	    return LAC_TO_LKC0(LYK_NEXT_PAGE);
 	mouse_link = -1;		/* No action in edit fields */
 #endif
     } else {
-	int mouse_err = 4, /* subjctv-dist better than this for approx stuff */
+	int mouse_err = 29, /* subjctv-dist better than this for approx stuff */
 	    cur_err;
 
 	/* Loop over the links and see if we can get a match */
@@ -355,6 +370,18 @@ PRIVATE int set_clicked_link ARGS4(
 	    /* Check the first line of the link */
 	    if ( links[i].hightext != NULL) {
 		cur_err = XYdist(x, y, links[i].lx, links[i].ly, len);
+		/* Check the second line */
+		if (cur_err > 0 && links[i].hightext2 != NULL) {
+		    /* Note that there is never hightext2 if is_text */
+		    int cur_err_2 = XYdist(x, y,
+					   links[i].hightext2_offset,
+					   links[i].ly+1,
+					   strlen(links[i].hightext2));
+		    cur_err = HTMIN(cur_err, cur_err_2);
+		}
+		if (cur_err > 0 && is_text)
+		    cur_err--;	/* a bit of preference for text fields,
+				   enter field if hit exactly at end - kw */
 		if (cur_err == 0) {
 		    int cury, curx;
 
@@ -390,6 +417,7 @@ PRIVATE int set_clicked_link ARGS4(
 		    mouse_link = i;
 		}
 	    }
+#if 0	/* should not have second line if no first - kw */
 	    /* Check the second line */
 	    if (links[i].hightext2 != NULL) {
 		cur_err = XYdist(x, y,
@@ -405,6 +433,7 @@ PRIVATE int set_clicked_link ARGS4(
 		    mouse_link = i;
 		}
 	    }
+#endif
 	}
 	/*
 	 * If a link was hit, we must look for a key which will activate
@@ -525,10 +554,13 @@ PUBLIC char * LYmbcs_skip_glyphs ARGS3(
  *  LYmbcsstrlen() returns the printable length of a string
  *  that might contain IsSpecial or multibyte (CJK or UTF8)
  *  characters. - FM
+ *  Counts glyph cells if count_gcells is set. (Full-width
+ *  characters in CJK mode count as two.)
  */
-PUBLIC int LYmbcsstrlen ARGS2(
-	char *,		str,
-	BOOL,		utf_flag)
+PUBLIC int LYmbcsstrlen ARGS3(
+	char *, 	str,
+	BOOL,		utf_flag,
+	BOOL,		count_gcells)
 {
     int i, j, len = 0;
 
@@ -550,10 +582,6 @@ PUBLIC int LYmbcsstrlen ARGS2(
 		i++;
 		j++;
 	    }
-	} else if (!utf_flag && HTCJK != NOCJK && !isascii(str[i]) &&
-		    str[(i + 1)] != '\0' &&
-		    !IsSpecialAttrChar(str[(i + 1)])) {
-	    i++;
 	}
     }
 
@@ -1129,26 +1157,43 @@ PRIVATE int read_keymap_file NOARGS
 PRIVATE void setup_vtXXX_keymap NOARGS
 {
     static Keysym_String_List table[] = {
-	EXTERN_KEY( "\033[A",	"^(ku)", UPARROW,	KEY_UP ),
-	EXTERN_KEY( "\033OA",	"^(ku)", UPARROW,	KEY_UP ),
-	EXTERN_KEY( "\033[B",	"^(kd)", DNARROW,	KEY_DOWN ),
-	EXTERN_KEY( "\033OB",	"^(kd)", DNARROW,	KEY_DOWN ),
-	EXTERN_KEY( "\033[C",	"^(kr)", RTARROW,	KEY_RIGHT ),
-	EXTERN_KEY( "\033OC",	"^(kr)", RTARROW,	KEY_RIGHT ),
-	EXTERN_KEY( "\033[D",	"^(kl)", LTARROW,	KEY_LEFT ),
-	EXTERN_KEY( "\033OD",	"^(kl)", LTARROW,	KEY_LEFT ),
-	EXTERN_KEY( "\033[1~",	"^(@0)", FIND_KEY,	KEY_FIND ),
-	EXTERN_KEY( "\033[2~",	"^(kI)", INSERT_KEY,	KEY_IC ),
-	EXTERN_KEY( "\033[3~",	"^(kD)", REMOVE_KEY,	KEY_DC ),
-	EXTERN_KEY( "\033[4~",	"^(*6)", SELECT_KEY,	KEY_SELECT ),
-	EXTERN_KEY( "\033[5~",	"^(kP)", PGUP,		KEY_PPAGE ),
-	EXTERN_KEY( "\033[6~",	"^(kN)", PGDOWN,	KEY_NPAGE ),
-	EXTERN_KEY( "\033[8~",	"^(@7)", END_KEY,	KEY_END ),
-	EXTERN_KEY( "\033[7~",	"^(kh)", HOME,		KEY_HOME),
-	EXTERN_KEY( "\033[28~",	"^(k1)", F1,		KEY_F(1) ),
-	EXTERN_KEY( "\033OP",	"^(k1)", F1,		KEY_F(1) ),
-	EXTERN_KEY( "\033[OP",	"^(k1)", F1,		KEY_F(1) ),
-	EXTERN_KEY( "\033[29~",	"^(F6)", DO_KEY,	KEY_F(16) ),
+	INTERN_KEY( "\033[A",	UPARROW,	KEY_UP ),
+	INTERN_KEY( "\033OA",	UPARROW,	KEY_UP ),
+	INTERN_KEY( "\033[B",	DNARROW,	KEY_DOWN ),
+	INTERN_KEY( "\033OB",	DNARROW,	KEY_DOWN ),
+	INTERN_KEY( "\033[C",	RTARROW,	KEY_RIGHT ),
+	INTERN_KEY( "\033OC",	RTARROW,	KEY_RIGHT ),
+	INTERN_KEY( "\033[D",	LTARROW,	KEY_LEFT ),
+	INTERN_KEY( "\033OD",	LTARROW,	KEY_LEFT ),
+	INTERN_KEY( "\033[1~",	FIND_KEY,	KEY_FIND ),
+	INTERN_KEY( "\033[2~",	INSERT_KEY,	KEY_IC ),
+	INTERN_KEY( "\033[3~",	REMOVE_KEY,	KEY_DC ),
+	INTERN_KEY( "\033[4~",	SELECT_KEY,	KEY_SELECT ),
+	INTERN_KEY( "\033[5~",	PGUP,		KEY_PPAGE ),
+	INTERN_KEY( "\033[6~",	PGDOWN,		KEY_NPAGE ),
+	INTERN_KEY( "\033[7~",	HOME,		KEY_HOME),
+	INTERN_KEY( "\033[8~",	END_KEY,	KEY_END ),
+	INTERN_KEY( "\033[11~",	F1,		KEY_F(1) ),
+	INTERN_KEY( "\033[28~",	F1,		KEY_F(1) ),
+	INTERN_KEY( "\033OP",	F1,		KEY_F(1) ),
+	INTERN_KEY( "\033[OP",	F1,		KEY_F(1) ),
+	INTERN_KEY( "\033[29~",	DO_KEY,		KEY_F(16) ),
+#if defined(USE_SLANG) && !defined(VMS)
+	INTERN_KEY(	"^(ku)", UPARROW,	KEY_UP ),
+	INTERN_KEY(	"^(kd)", DNARROW,	KEY_DOWN ),
+	INTERN_KEY(	"^(kr)", RTARROW,	KEY_RIGHT ),
+	INTERN_KEY(	"^(kl)", LTARROW,	KEY_LEFT ),
+	INTERN_KEY(	"^(@0)", FIND_KEY,	KEY_FIND ),
+	INTERN_KEY(	"^(kI)", INSERT_KEY,	KEY_IC ),
+	INTERN_KEY(	"^(kD)", REMOVE_KEY,	KEY_DC ),
+	INTERN_KEY(	"^(*6)", SELECT_KEY,	KEY_SELECT ),
+	INTERN_KEY(	"^(kP)", PGUP,		KEY_PPAGE ),
+	INTERN_KEY(	"^(kN)", PGDOWN,	KEY_NPAGE ),
+	INTERN_KEY(	"^(@7)", END_KEY,	KEY_END ),
+	INTERN_KEY(	"^(kh)", HOME,		KEY_HOME),
+	INTERN_KEY(	"^(k1)", F1,		KEY_F(1) ),
+	INTERN_KEY(	"^(F6)", DO_KEY,	KEY_F(16) ),
+#endif /* SLANG && !VMS */
     };
     size_t n;
     for (n = 0; n < TABLESIZE(table); n++)
@@ -3475,8 +3520,13 @@ PUBLIC char * LYno_attr_char_strstr ARGS2(
  * LYno_attr_mbcs_case_strstr will find the first occurrence of the string
  * pointed to by tarptr in the string pointed to by chptr.
  * It takes account of MultiByte Character Sequences (UTF8).
- * The physical length of the displayed string up to the end of the target
- * string is returned in *nendp if the search is successful.
+ * The physical lengths of the displayed string up to the start and
+ * end (= next position after) of the target string are returned in *nstartp
+ * and *nendp if the search is successful.
+ *   These lengths count glyph cells if count_gcells is set. (Full-width
+ *   characters in CJK mode count as two.)  Normally that's what we want.
+ *   They count actual glyphs if count_gcells is unset. (Full-width
+ *   characters in CJK mode count as one.)
  * It ignores the characters: LY_UNDERLINE_START_CHAR and
  *			      LY_UNDERLINE_END_CHAR
  *			      LY_BOLD_START_CHAR
@@ -3486,10 +3536,11 @@ PUBLIC char * LYno_attr_char_strstr ARGS2(
  * It assumes UTF8 if utf_flag is set.
  *  It is a case insensitive search. - KW & FM
  */
-PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
+PUBLIC char * LYno_attr_mbcs_case_strstr ARGS6(
 	char *,		chptr,
 	CONST char *,	tarptr,
 	BOOL,		utf_flag,
+	BOOL,		count_gcells,
 	int *,		nstartp,
 	int *,		nendp)
 {
@@ -3547,6 +3598,7 @@ PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
 		     */
 		    tmpchptr++;
 		    tmptarptr++;
+		    if (count_gcells) tarlen++;
 		    if (*tmptarptr == '\0') {
 			/*
 			 *  One character match. - FM
@@ -3555,13 +3607,13 @@ PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
 			if (nendp)	*nendp = len + tarlen;
 			return(chptr);
 		    }
-		    tarlen++;
 		} else {
 		    /*
 		     *	It's not a match, so go back to
 		     *	seeking a first target match. - FM
 		     */
 		    chptr++;
+		    if (count_gcells) len++;
 		    continue;
 		}
 	    }
@@ -3576,6 +3628,7 @@ PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
 			    !IsSpecialAttrChar(*(tmpchptr + 1))) {
 			    tmpchptr++;
 			    tmptarptr++;
+			    if (count_gcells) tarlen++;
 			} else {
 			    break;
 			}
@@ -3607,6 +3660,7 @@ PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
 		*(chptr + 1) != '\0' &&
 		!IsSpecialAttrChar(*(chptr + 1))) {
 		chptr++;
+		if (count_gcells) len++;
 	    }
 	    len++;
 	}
@@ -3620,8 +3674,12 @@ PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
  * pointed to by tarptr in the string pointed to by chptr.
  *  It takes account of CJK and MultiByte Character Sequences (UTF8).
  *  The physical lengths of the displayed string up to the start and
- *  end of the target string are returned in *nstartp and *nendp if
- *  the search is successful.
+ *  end (= next position after) the target string are returned in *nstartp
+ *  and *nendp if the search is successful.
+ *    These lengths count glyph cells if count_gcells is set. (Full-width
+ *    characters in CJK mode count as two.)  Normally that's what we want.
+ *    They count actual glyphs if count_gcells is unset. (Full-width
+ *    characters in CJK mode count as one.)
  * It ignores the characters: LY_UNDERLINE_START_CHAR and
  *			      LY_UNDERLINE_END_CHAR
  *			      LY_BOLD_START_CHAR
@@ -3631,10 +3689,11 @@ PUBLIC char * LYno_attr_mbcs_case_strstr ARGS5(
  * It assumes UTF8 if utf_flag is set.
  *  It is a case sensitive search. - KW & FM
  */
-PUBLIC char * LYno_attr_mbcs_strstr ARGS5(
+PUBLIC char * LYno_attr_mbcs_strstr ARGS6(
 	char *,		chptr,
 	CONST char *,	tarptr,
 	BOOL,		utf_flag,
+	BOOL,		count_gcells,
 	int *,		nstartp,
 	int *,		nendp)
 {
@@ -3672,7 +3731,7 @@ PUBLIC char * LYno_attr_mbcs_strstr ARGS5(
 		 *  One char target.
 		 */
 		if (nstartp)	*nstartp = offset;
-		if (nendp)	*nendp = len + 1;
+		if (nendp)	*nendp = len;
 		return(chptr);
 	    }
 	    if (!utf_flag && HTCJK != NOCJK && !isascii(*chptr) &&
@@ -3687,6 +3746,7 @@ PUBLIC char * LYno_attr_mbcs_strstr ARGS5(
 		     */
 		    tmpchptr++;
 		    tmptarptr++;
+		    if (count_gcells) tarlen++;
 		    if (*tmptarptr == '\0') {
 			/*
 			 *  One character match. - FM
@@ -3695,13 +3755,13 @@ PUBLIC char * LYno_attr_mbcs_strstr ARGS5(
 			if (nendp)	*nendp = len + tarlen;
 			return(chptr);
 		    }
-		    tarlen++;
 		} else {
 		    /*
 		     *	It's not a match, so go back to
 		     *	seeking a first target match. - FM
 		     */
 		    chptr++;
+		    if (count_gcells) len++;
 		    continue;
 		}
 	    }
@@ -3716,6 +3776,7 @@ PUBLIC char * LYno_attr_mbcs_strstr ARGS5(
 			    !IsSpecialAttrChar(*(tmpchptr + 1))) {
 			    tmpchptr++;
 			    tmptarptr++;
+			    if (count_gcells) tarlen++;
 			} else {
 			    break;
 			}
@@ -3746,6 +3807,7 @@ PUBLIC char * LYno_attr_mbcs_strstr ARGS5(
 		*(chptr + 1) != '\0' &&
 		!IsSpecialAttrChar(*(chptr + 1))) {
 		chptr++;
+		if (count_gcells) len++;
 	    }
 	    len++;
 	}
diff --git a/src/LYStrings.h b/src/LYStrings.h
index e836c6a4..ac85f315 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -44,17 +44,20 @@ extern char * LYmbcs_skip_glyphs PARAMS((
 	BOOL		utf_flag));
 extern int LYmbcsstrlen PARAMS((
 	char *		str,
-	BOOL		utf_flag));
+	BOOL		utf_flag,
+	BOOL		count_gcells));
 extern char * LYno_attr_mbcs_strstr PARAMS((
 	char *		chptr,
 	CONST char *	tarptr,
 	BOOL		utf_flag,
+	BOOL		count_gcells,
 	int *		nstartp,
 	int *		nendp));
 extern char * LYno_attr_mbcs_case_strstr PARAMS((
 	char *		chptr,
 	CONST char *	tarptr,
 	BOOL		utf_flag,
+	BOOL		count_gcells,
 	int *		nstartp,
 	int *		nendp));
 extern char * LYno_attr_char_strstr PARAMS((
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 4d30777d..de1c7112 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -337,7 +337,7 @@ PUBLIC void highlight ARGS3(
 			  utf_flag);
 	    hlen = strlen(buffer);
 	    hLen = ((HTCJK != NOCJK || utf_flag) ?
-		  LYmbcsstrlen(buffer, utf_flag) : hlen);
+		  LYmbcsstrlen(buffer, utf_flag, YES) : hlen);
 
 	    /*
 	     *	Break out if the first hit in the line
@@ -359,12 +359,12 @@ PUBLIC void highlight ARGS3(
 		if ((case_sensitive ?
 		     (cp = LYno_attr_mbcs_strstr(data,
 						 target,
-						 utf_flag,
+						 utf_flag, YES,
 						 &HitOffset,
 						 &LenNeeded)) != NULL :
 		     (cp = LYno_attr_mbcs_case_strstr(data,
 						 target,
-						 utf_flag,
+						 utf_flag, YES,
 						 &HitOffset,
 						 &LenNeeded)) != NULL) &&
 		    (offset + LenNeeded) < LYcols) {
@@ -607,12 +607,12 @@ PUBLIC void highlight ARGS3(
 		if ((case_sensitive ?
 		     (cp = LYno_attr_mbcs_strstr(data,
 						 target,
-						 utf_flag,
+						 utf_flag, YES,
 						 &HitOffset,
 						 &LenNeeded)) != NULL :
 		     (cp = LYno_attr_mbcs_case_strstr(data,
 						 target,
-						 utf_flag,
+						 utf_flag, YES,
 						 &HitOffset,
 						 &LenNeeded)) != NULL) &&
 		    (offset + LenNeeded) < LYcols) {
@@ -886,12 +886,12 @@ highlight_hit_within_hightext:
 	    if ((case_sensitive ?
 		 (cp = LYno_attr_mbcs_strstr(data,
 					     target,
-					     utf_flag,
+					     utf_flag, YES,
 					     &HitOffset,
 					     &LenNeeded)) != NULL :
 		 (cp = LYno_attr_mbcs_case_strstr(data,
 					     target,
-					     utf_flag,
+					     utf_flag, YES,
 					     &HitOffset,
 					     &LenNeeded)) != NULL) &&
 		(offset + LenNeeded) < LYcols) {
@@ -1067,7 +1067,7 @@ highlight_search_hightext2:
 			  utf_flag);
 	    hlen = strlen(buffer);
 	    hLen = ((HTCJK != NOCJK || utf_flag) ?
-		  LYmbcsstrlen(buffer, utf_flag) : hlen);
+		  LYmbcsstrlen(buffer, utf_flag, YES) : hlen);
 
 	    /*
 	     *	Break out if the first hit in the line
@@ -1089,12 +1089,12 @@ highlight_search_hightext2:
 		if ((case_sensitive ?
 		     (cp = LYno_attr_mbcs_strstr(data,
 						 target,
-						 utf_flag,
+						 utf_flag, YES,
 						 &HitOffset,
 						 &LenNeeded)) != NULL :
 		     (cp = LYno_attr_mbcs_case_strstr(data,
 						 target,
-						 utf_flag,
+						 utf_flag, YES,
 						 &HitOffset,
 						 &LenNeeded)) != NULL) &&
 		    (offset + LenNeeded) < LYcols) {
@@ -1336,12 +1336,12 @@ highlight_search_hightext2:
 		if ((case_sensitive ?
 		     (cp = LYno_attr_mbcs_strstr(data,
 						 target,
-						 utf_flag,
+						 utf_flag, YES,
 						 &HitOffset,
 						 &LenNeeded)) != NULL :
 		     (cp = LYno_attr_mbcs_case_strstr(data,
 						 target,
-						 utf_flag,
+						 utf_flag, YES,
 						 &HitOffset,
 						 &LenNeeded)) != NULL) &&
 		    (offset + LenNeeded) < LYcols) {
@@ -1615,12 +1615,12 @@ highlight_hit_within_hightext2:
 	    if ((case_sensitive ?
 		 (cp = LYno_attr_mbcs_strstr(data,
 					     target,
-					     utf_flag,
+					     utf_flag, YES,
 					     &HitOffset,
 					     &LenNeeded)) != NULL :
 		 (cp = LYno_attr_mbcs_case_strstr(data,
 					     target,
-					     utf_flag,
+					     utf_flag, YES,
 					     &HitOffset,
 					     &LenNeeded)) != NULL) &&
 		(offset + LenNeeded) < LYcols) {
@@ -4665,6 +4665,9 @@ have_VMS_URL:
 		} else if (fixit) {
 		  /* RW 1998Mar16  Restore AllocatedString to 'old_string' */
 		    StrAllocCopy(*AllocatedString, old_string);
+		} else {
+		    /* Return file URL for the file that does not exist */
+		    StrAllocCat(*AllocatedString, temp);
 		}
 #ifdef WIN_EX
 	Retry:
@@ -6478,10 +6481,10 @@ PUBLIC FILE *LYOpenTempRewrite ARGS3(
     if (registered) {
 #ifndef NO_GROUPS
 	writable_exists = HTEditable(fname); /* existing, can write */
-#define CTRACE_EXISTS "exists and is writable"
+#define CTRACE_EXISTS "exists and is writable, "
 #else
 	writable_exists = (BOOL) (stat(fname, &stat_buf) == 0); /* existing, assume can write */
-#define CTRACE_EXISTS "exists"
+#define CTRACE_EXISTS "exists, "
 #endif
 
 	if (writable_exists) {
@@ -6508,46 +6511,25 @@ PUBLIC FILE *LYOpenTempRewrite ARGS3(
 	 * This should probably not happen.  Make a new one.
 	 */
 	return (LYOpenTemp(fname, suffix, mode));
-    } else if (is_ours) {
+    } else if (!registered) {
 	/*
-	 *  Yes, it exists, is writable if we checked, and everything
-	 *  looks ok so far.  This should be the most regular case.
-	 *  We truncate and then append, this avoids having a small
-	 *  window in which the file doesn't exist. - kw
+	 *  Not registered.  It should have been registered at one point
+	 *  though, otherwise we wouldn't be called like this.
 	 */
-#if HAVE_TRUNCATE
-	if (truncate(fname, 0) != 0) {
-	    CTRACE((tfp, "... truncate(%s,0) failed: %s\n",
-		   fname, LYStrerror(errno)));
-	    return (LYOpenTemp(fname, suffix, mode));
-	}
-#endif
-	return (LYReopenTemp(fname));
-    } else if (writable_exists) {
+	return (LYOpenTemp(fname, suffix, mode));
+    } else if (writable_exists && !is_ours) {
 	/*
 	 *  File exists, writable if we checked, but something is wrong
 	 *  with it.
 	 */
 	return (LYOpenTemp(fname, suffix, mode));
 #ifndef NO_GROUPS
-    } else if (registered && (lstat(fname, &stat_buf) == 0)) {
+    } else if (!is_ours && (lstat(fname, &stat_buf) == 0)) {
 	/*
 	 *  Exists but not writable, and something is wrong with it.
 	 */
 	return (LYOpenTemp(fname, suffix, mode));
 #endif
-    } else if (!registered) {
-	/*
-	 *  Not registered.  It should have been registered at one point
-	 *  though, otherwise we wouldn't be called like this.
-	 */
-	return (LYOpenTemp(fname, suffix, mode));
-    } else {
-	/*
-	 *  File does not exist, but is registered as a temp file.
-	 *  It must have been removed by some means other than
-	 *  LYRemoveTemp.  Reuse the name!
-	 */
     }
 
     while (*mode != '\0') {
@@ -6561,6 +6543,38 @@ PUBLIC FILE *LYOpenTempRewrite ARGS3(
 	}
     }
 
+    if (is_ours) {
+	/*
+	 *  Yes, it exists, is writable if we checked, and everything
+	 *  looks ok so far.  This should be the most regular case. - kw
+	 */
+#if HAVE_TRUNCATE
+	if (txt == TRUE) {	/* limitation of LYReopenTemp.  shrug */
+	    /*
+	     *  We truncate and then append, this avoids having a small
+	     *  window in which the file doesn't exist. - kw
+	     */
+	    if (truncate(fname, 0) != 0) {
+		CTRACE((tfp, "... truncate(%s,0) failed: %s\n",
+			fname, LYStrerror(errno)));
+		return (LYOpenTemp(fname, suffix, mode));
+	    } else {
+		return (LYReopenTemp(fname));
+	    }
+	}
+#endif
+	remove(fname);
+
+    }
+
+	/*  We come here in two cases: either the file existed and was
+	 *  ours and we just got rid of it.
+	 *  Or the file did and does not exist, but is registered as a
+	 *  temp file.  It must have been removed by some means other than
+	 *  LYRemoveTemp.
+	 *  In both cases, reuse the name! - kw
+	 */
+
     if (txt) {
 	switch (wrt) {
 	case 'w':
diff --git a/src/TRSTable.c b/src/TRSTable.c
index 3545fdb8..7e65fc2f 100644
--- a/src/TRSTable.c
+++ b/src/TRSTable.c
@@ -17,6 +17,9 @@
 #define ROWS_GROWBY 2
 #define MAX_STBL_POS (LYcols-1)
 
+/* must be different from HT_ALIGN_NONE and HT_LEFT, HT_CENTER etc.: */
+#define RESERVEDCELL (-2)  /* cell's alignment field is overloaded, this
+			      value means cell was reserved by ROWSPAN */
 typedef enum {
     CS_invalid = -1,
     CS_new     =  0,
@@ -48,7 +51,8 @@ typedef struct _STable_cellinfo {
 	int	pos;		/* column where cell starts */
 	int	len;		/* number of character positions */
 	int	colspan;	/* number of columns to span */
-	short	alignment;	/* one of HT_LEFT, HT_CENTER, HT_RIGHT */
+	short	alignment;	/* one of HT_LEFT, HT_CENTER, HT_RIGHT,
+				   or RESERVEDCELL */
 } STable_cellinfo;
 
 typedef struct _STable_rowinfo {
@@ -69,9 +73,13 @@ struct _STable_info {
 	int	maxpos;		/* max. of max. cell pos's of any row */
 	int	allocated_rows; /* number of rows allocated */
 	int	allocated_sumcols;	/* number of sumcols allocated */
+	int	ncolinfo;		/* number of COL info collected */
 	STable_cellinfo * sumcols; /* for summary (max len/pos) col info */
 	STable_rowinfo * rows;
 	short	alignment;	/* global align attribute for this table */
+	short	rowgroup_align;	/* align default for current group of rows */
+	short	pending_colgroup_align;
+	int	pending_colgroup_next;
 	STable_states s;
 };
 
@@ -103,14 +111,14 @@ struct _STable_info {
 **    ("justify" is treated as "left")
 **  - Inheritance of horizontal alignment according to HTML 4.0 (with the
 **    exception of COLGROUP/COL)
-**  - COLSPAN >1 (nearly untested)
+**  - COLSPAN >1 (may work incorrectly for some tables?)
+**  - ROWSPAN >1 (reserving cells in following rows)
 **  - Line breaks at start of first cell or at end of last cell are treated
 **    as if they were not part of the cell and row.  This allows us to
 **    cooperate with one way in which tables have been made friendly to
 **    browsers without any table support.
 **  Missing, but can be added:
 **  - Support for COLGROUP/COL
-**  - ROWSPAN >1 (reserving cells in following rows)
 **  - Tables wider than display.  The limitation is not here but in GridText.c
 **    etc.  If horizontal scrolling were implemented there, the mechanisms
 **    here coudl deal with wide tables (just change MAX_STBL_POS code).
@@ -140,6 +148,8 @@ PUBLIC struct _STable_info * Stbl_startTABLE ARGS1(
     STable_info *me = (STable_info *) calloc(1, sizeof(STable_info));
     if (me) {
 	me->alignment = alignment;
+	me->rowgroup_align = HT_ALIGN_NONE;
+	me->pending_colgroup_align = HT_ALIGN_NONE;
 	me->s.x_td = -1;
 	me->s.icell_core = -1;
     }
@@ -159,9 +169,9 @@ PUBLIC void Stbl_free ARGS1(
 {
     if (me && me->allocated_rows && me->rows) {
 	int i;
-	for (i = 0; i <= me->nrows; i++)
+	for (i = 0; i < me->allocated_rows; i++)
 	    free_rowinfo(me->rows + i);
-	free(me->rows);
+	FREE(me->rows);
     }
     if (me)
 	FREE(me->sumcols);
@@ -171,8 +181,10 @@ PUBLIC void Stbl_free ARGS1(
 /*
  * Returns -1 on error, otherwise index of just-added table cell.
  */
-PRIVATE int Stbl_addCellToRow ARGS7(
+PRIVATE int Stbl_addCellToRow ARGS9(
     STable_rowinfo *,	me,
+    STable_cellinfo *,	colinfo,
+    int,		ncolinfo,
     STable_states *,	s,
     int,		colspan,
     short,		alignment,
@@ -386,6 +398,10 @@ PRIVATE int Stbl_addCellToRow ARGS7(
     if (me->ncells > 0 && me->cells[me->ncells - 1].colspan > 1) {
 	me->ncells += me->cells[me->ncells-1].colspan - 1;
     }
+    while (me->ncells < me->allocated &&
+	   me->cells[me->ncells].alignment == RESERVEDCELL) {
+	me->ncells++;
+    }
     {
 	int growby = 0;
 	while (me->ncells + colspan + 1 > me->allocated + growby)
@@ -413,8 +429,17 @@ PRIVATE int Stbl_addCellToRow ARGS7(
     me->cells[me->ncells].colspan = colspan;
     me->cells[me->ncells].alignment =
 	(alignment==HT_ALIGN_NONE) ? me->alignment : alignment;
-    if (me->cells[me->ncells].alignment==HT_ALIGN_NONE)
-	me->cells[me->ncells].alignment = isheader ? HT_CENTER : HT_LEFT;
+
+    if (alignment != HT_ALIGN_NONE)
+	    me->cells[me->ncells].alignment = alignment;
+    else {
+	if (ncolinfo >= me->ncells + 1) 
+	    me->cells[me->ncells].alignment = colinfo[me->ncells].alignment;
+	if (me->cells[me->ncells].alignment==HT_ALIGN_NONE)
+	    me->cells[me->ncells].alignment = me->alignment;
+	if (me->cells[me->ncells].alignment==HT_ALIGN_NONE)
+	    me->cells[me->ncells].alignment = isheader ? HT_CENTER : HT_LEFT;
+    }
     for (i = me->ncells + 1; i < me->ncells + colspan; i++) {
 	me->cells[i].Line = lineno;
 	me->cells[i].pos = *ppos;
@@ -427,6 +452,38 @@ PRIVATE int Stbl_addCellToRow ARGS7(
     return (me->ncells - 1);
 }
 
+/* returns -1 on error, 0 otherwise */
+/* assumes cells have already been allocated (but may need more) */
+PRIVATE int Stbl_reserveCellsInRow ARGS3(
+    STable_rowinfo *,	me,
+    int,		icell,
+    int,		colspan)
+{
+    STable_cellinfo *cells;
+    int i;
+    int growby = icell + colspan - me->allocated;
+    if (growby > 0) {
+	cells = realloc(me->cells,
+			(me->allocated + growby)
+			* sizeof(STable_cellinfo));
+	if (cells) {
+	    me->allocated += growby;
+	    me->cells = cells;
+	} else {
+	    return -1;
+	}
+    }
+    for (i = icell; i < icell + colspan; i++) {
+	me->cells[i].Line = -1;
+	me->cells[i].pos = -1;
+	me->cells[i].len = -1;
+	me->cells[i].colspan = 0;
+	me->cells[i].alignment = RESERVEDCELL;
+    }
+    me->cells[icell].colspan = colspan;
+    return 0;
+}
+
 PRIVATE int Stbl_finishCellInRow ARGS5(
     STable_rowinfo *,	me,
     STable_states *,	s,
@@ -827,6 +884,52 @@ PRIVATE int Stbl_finishCellInRow ARGS5(
 }
 
 /*
+ *  Reserve cells, of colspan=spolspan each, in (rowspan-1) rows after
+ *  the current row.
+ */
+PRIVATE int Stbl_reserveCellsInTable ARGS4(
+    STable_info *,	me,
+    int,		icell,
+    int,		colspan,
+    int,		rowspan)
+{
+    STable_rowinfo *rows, *row;
+    int growby;
+    int i;
+    if (me->nrows <= 0)
+	return -1;		/* must already have at least one row */
+    growby = me->nrows + rowspan - 1 - me->allocated_rows;
+    if (growby > 0) {
+	rows = realloc(me->rows,
+		       (me->allocated_rows + growby)
+		       * sizeof(STable_rowinfo));
+	if (!rows)
+	    return 0; /* ignore silently, maybe someone said ROWSPAN=9999999 */
+	for (i = 0; i < growby; i++) {
+	    row = rows + me->allocated_rows + i;
+	    row->allocated = 0;
+	    row->ncells = 0;
+	    row->fixed_line = NO;
+	    row->cells = NULL;
+	    row->alignment = HT_ALIGN_NONE;
+	}
+	me->allocated_rows += growby;
+	me->rows = rows;
+    }
+    for (i = me->nrows; i < me->nrows + rowspan - 1; i++) {
+	if (!me->rows[i].allocated) {
+	    me->rows[i].cells = calloc(icell + colspan, sizeof(STable_cellinfo));
+	    if (!me->rows[i].cells)
+		return 0;	/* fail silently */
+	    else
+		me->rows[i].allocated = icell + colspan;
+	}
+	Stbl_reserveCellsInRow(me->rows + i, icell, colspan);
+    }
+    return 0;
+}
+
+/*
  * Returns -1 on error, otherwise index of just-added table row.
  */
 PUBLIC int Stbl_addRowToTable ARGS3(
@@ -891,9 +994,17 @@ PUBLIC int Stbl_addRowToTable ARGS3(
     me->rows[me->nrows].Line = lineno;
     if (me->nrows == 0)
 	me->startline = lineno;
-    me->rows[me->nrows].alignment =
-	(alignment==HT_ALIGN_NONE) ? me->alignment : alignment;
+    if (alignment != HT_ALIGN_NONE)
+	me->rows[me->nrows].alignment = alignment;
+    else
+	me->rows[me->nrows].alignment =
+	    (me->rowgroup_align==HT_ALIGN_NONE) ?
+				  me->alignment : me->rowgroup_align;
     me->nrows++;
+    if (me->pending_colgroup_next > me->ncolinfo) {
+	me->ncolinfo = me->pending_colgroup_next;
+	me->pending_colgroup_next = 0;
+    }
     me->rows[me->nrows].Line = -1; /* not yet used */
     return (me->nrows - 1);
 }
@@ -977,9 +1088,10 @@ PRIVATE void update_sumcols0 ARGS7(
 /*
  * Returns -1 on error, otherwise 0.
  */
-PUBLIC int Stbl_addCellToTable ARGS6(
+PUBLIC int Stbl_addCellToTable ARGS7(
     STable_info *,	me,
     int,		colspan,
+    int,		rowspan,
     short,		alignment,
     BOOL,		isheader,
     int,		lineno,
@@ -1000,7 +1112,7 @@ PUBLIC int Stbl_addCellToTable ARGS6(
 			   lineno, pos);
     lastrow = me->rows + (me->nrows - 1);
     ncells = lastrow->ncells;	/* remember what it was before adding cell. */
-    icell = Stbl_addCellToRow(lastrow, s,
+    icell = Stbl_addCellToRow(lastrow, me->sumcols, me->ncolinfo, s,
 			      colspan, alignment, isheader,
 			      lineno, &pos);
     if (icell < 0)
@@ -1008,6 +1120,12 @@ PUBLIC int Stbl_addCellToTable ARGS6(
     if (me->nrows == 1 && me->startline < lastrow->Line)
 	me->startline = lastrow->Line;
 
+    if (rowspan > 1) {
+	Stbl_reserveCellsInTable(me, icell, colspan, rowspan);
+	/* me->rows may now have been realloc'd, make lastrow valid pointer */
+	lastrow = me->rows + (me->nrows - 1);
+    }
+
     {
 	int growby = 0;
 	while (icell + colspan + 1 > me->allocated_sumcols + growby)
@@ -1209,6 +1327,89 @@ PUBLIC int Stbl_finishCellInTable ARGS4(
     return 0;
 }
 
+/*
+ * Returns -1 on error, otherwise 0.
+ */
+PUBLIC int Stbl_addColInfo ARGS4(
+    STable_info *,	me,
+    int,		colspan,
+    short,		alignment,
+    BOOL,		isgroup)
+{
+    STable_cellinfo *sumcols, *sumcol;
+    int i, icolinfo;
+
+    if (isgroup) {
+	if (me->pending_colgroup_next > me->ncolinfo)
+	    me->ncolinfo = me->pending_colgroup_next;
+	me->pending_colgroup_next = me->ncolinfo + colspan;
+	me->pending_colgroup_align = alignment;
+    } else {
+	for (i = me->pending_colgroup_next - 1;
+	     i >= me->ncolinfo + colspan; i--)
+	    me->sumcols[i].alignment = HT_ALIGN_NONE;
+	me->pending_colgroup_next = me->ncolinfo + colspan;
+    }
+    icolinfo = me->ncolinfo;
+    if (!isgroup)
+	me->ncolinfo += colspan;
+
+    {
+	int growby = 0;
+	while (icolinfo + colspan + 1 > me->allocated_sumcols + growby)
+	    growby += CELLS_GROWBY;
+	if (growby) {
+	    if (me->allocated_sumcols == 0) {
+		sumcols = calloc(growby, sizeof(STable_cellinfo));
+	    } else {
+		sumcols = realloc(me->sumcols,
+				  (me->allocated_sumcols + growby)
+				  * sizeof(STable_cellinfo));
+		for (i = 0; sumcols && i < growby; i++) {
+		    sumcol = sumcols + me->allocated_sumcols + i;
+		    sumcol->pos = sumcols[me->allocated_sumcols-1].pos;
+		    sumcol->len = 0;
+		    sumcol->colspan = 0;
+		}
+	    }
+	    if (sumcols) {
+		me->allocated_sumcols += growby;
+		me->sumcols = sumcols;
+	    } else {
+		return -1;
+	    }
+	}
+    }
+
+    if (alignment==HT_ALIGN_NONE)
+	alignment = me->pending_colgroup_align;
+    for (i = icolinfo; i < icolinfo + colspan; i++) {
+	me->sumcols[i].alignment = alignment;
+    }
+    return 0;
+}
+
+/*
+ * Returns -1 on error, otherwise 0.
+ */
+PUBLIC int Stbl_finishColGroup ARGS1(
+    STable_info *,	me)
+{
+    if (me->pending_colgroup_next > me->ncolinfo)
+	me->ncolinfo = me->pending_colgroup_next;
+    me->pending_colgroup_next = 0;
+    me->pending_colgroup_align = HT_ALIGN_NONE;
+    return 0;
+}
+
+PUBLIC int Stbl_addRowGroup ARGS2(
+    STable_info *,	me,
+    short,		alignment)
+{
+    me->rowgroup_align = alignment;
+    return 0;			/* that's all! */
+}
+
 PUBLIC int Stbl_finishTABLE ARGS1(
     STable_info *,	me)
 {
@@ -1285,9 +1486,9 @@ PRIVATE int get_fixup_positions ARGS4(
 	    newlen = HTMAX(newlen, sumcols[i].len);
 	    if (me->cells[i].len < newlen) {
 		if (me->cells[i].alignment == HT_RIGHT) {
-		    newpos[i] += newlen - me->cells[i].len;
+		    newpos[ip] += newlen - me->cells[i].len;
 		} else {
-		    newpos[i] += (newlen - me->cells[i].len) / 2;
+		    newpos[ip] += (newlen - me->cells[i].len) / 2;
 		}
 	    }
 	}
diff --git a/src/TRSTable.h b/src/TRSTable.h
index 7ef88b45..a1791151 100644
--- a/src/TRSTable.h
+++ b/src/TRSTable.h
@@ -1,10 +1,16 @@
+#ifndef TRSTABLE_H
+#define TRSTABLE_H
+
 typedef struct _STable_info STable_info;
 extern STable_info * Stbl_startTABLE PARAMS((short));
 extern int Stbl_finishTABLE PARAMS((STable_info *));
 extern void Stbl_free PARAMS((STable_info *));
 extern int Stbl_addRowToTable PARAMS((STable_info *, short, int));
-extern int Stbl_addCellToTable PARAMS((STable_info *, int, short, BOOL, int, int));
+extern int Stbl_addCellToTable PARAMS((STable_info *, int, int, short, BOOL, int, int));
 extern int Stbl_finishCellInTable PARAMS((STable_info *, BOOL, int, int));
+extern int Stbl_addColInfo PARAMS((STable_info *, int, short, BOOL));
+extern int Stbl_finishColGroup PARAMS((STable_info *));
+extern int Stbl_addRowGroup PARAMS((STable_info *, short));
 #define Stbl_lineBreak(stbl,l,pos) Stbl_finishCellInTable(stbl, NO, l, pos)
 extern int Stbl_getStartLine PARAMS((STable_info *));
 extern int Stbl_getFixupPositions PARAMS((
@@ -13,3 +19,5 @@ extern int Stbl_getFixupPositions PARAMS((
     int *		oldpos,
     int *		newpos));
 extern short Stbl_getAlignment PARAMS((STable_info *));
+
+#endif /* TRSTABLE_H */
diff --git a/src/UCAuto.c b/src/UCAuto.c
index 87bbd3c7..86e48f22 100644
--- a/src/UCAuto.c
+++ b/src/UCAuto.c
@@ -374,14 +374,6 @@ PUBLIC void UCChangeTerminalCodepage ARGS2(
 	name = "unknown-8bit";
     }
 
-    if (status == 1)
-	HasUmap = Is_Unset;
-    else if (status < 0) {
-	if (HasUmap == Is_Set)
-	    HasUmap = Dunno;
-	name = "unknown-8bit";
-    }
-
     if (TransT != lastTransT) {
 	if (TransT == GN_Blat1) {
 	    /*
diff --git a/src/UCdomap.c b/src/UCdomap.c
index d451b167..2fd0d885 100644
--- a/src/UCdomap.c
+++ b/src/UCdomap.c
@@ -1332,7 +1332,7 @@ PUBLIC int UCReverseTransChar ARGS3(
 
 #ifndef UC_NO_SHORTCUTS
     if (charset_in == charset_out)
-	return ch_out;
+	return (unsigned char)ch_out;
 #endif /* UC_NO_SHORTCUTS */
     if (charset_in < 0)
 	return -11;
diff --git a/src/chrtrans/cp1253_uni.tbl b/src/chrtrans/cp1253_uni.tbl
index 6a08baef..8d3116d8 100644
--- a/src/chrtrans/cp1253_uni.tbl
+++ b/src/chrtrans/cp1253_uni.tbl
@@ -46,8 +46,8 @@ C1253
 0x8E		#UNDEFINED
 0x8F		#UNDEFINED
 0x90		#UNDEFINED
-0x91	U+2018	#LEFT SINGLE QUOTATION MARK
-0x92	U+2019	#RIGHT SINGLE QUOTATION MARK
+0x91	U+2018	U+02bd	#LEFT SINGLE QUOTATION MARK
+0x92	U+2019	U+02bc	#RIGHT SINGLE QUOTATION MARK
 0x93	U+201C	#LEFT DOUBLE QUOTATION MARK
 0x94	U+201D	#RIGHT DOUBLE QUOTATION MARK
 0x95	U+2022	#BULLET
diff --git a/src/chrtrans/cp869_uni.tbl b/src/chrtrans/cp869_uni.tbl
index a706d2a8..e8941b41 100644
--- a/src/chrtrans/cp869_uni.tbl
+++ b/src/chrtrans/cp869_uni.tbl
@@ -38,8 +38,8 @@ C869
 0x88	U+00b7	#MIDDLE DOT
 0x89	U+00ac	#NOT SIGN
 0x8a	U+00a6	#BROKEN BAR
-0x8b	U+2018	#LEFT SINGLE QUOTATION MARK
-0x8c	U+2019	#RIGHT SINGLE QUOTATION MARK
+0x8b	U+2018	U+02bd	#LEFT SINGLE QUOTATION MARK
+0x8c	U+2019	U+02bc	#RIGHT SINGLE QUOTATION MARK
 0x8d	U+0388	#GREEK CAPITAL LETTER EPSILON WITH TONOS
 0x8e	U+2015	#HORIZONTAL BAR
 0x8f	U+0389	#GREEK CAPITAL LETTER ETA WITH TONOS
diff --git a/src/chrtrans/iso07_uni.tbl b/src/chrtrans/iso07_uni.tbl
index 458c2389..3eb3aeb7 100644
--- a/src/chrtrans/iso07_uni.tbl
+++ b/src/chrtrans/iso07_uni.tbl
@@ -147,8 +147,17 @@ C813
 #0x7D	U+007D	#	RIGHT CURLY BRACKET
 #0x7E	U+007E	#	TILDE
 0xA0	U+00A0	#	NO-BREAK SPACE
-0xA1	U+02BD	#	MODIFIER LETTER REVERSED COMMA
-0xA2	U+02BC	#	MODIFIER LETTER APOSTROPHE
+#
+# The following two changed in ISO 8859:1999
+#
+#   Remap 0xA1 to U+2018 (instead of U+02BD)
+#   Remap 0xA2 to U+2019 (instead of U+02BC)
+#
+# Keep the old ones as primary for now.  Also added old U+037[12]
+# found in existing linux kbd files and in RFC 1345 for compatibility.
+# - kw 1999-10-29
+0xA1	U+02BD	U+2018	U+0371	#	MODIFIER LETTER REVERSED COMMA
+0xA2	U+02BC	U+2019	U+0372	#	MODIFIER LETTER APOSTROPHE
 0xA3	U+00A3	#	POUND SIGN
 0xA6	U+00A6	#	BROKEN BAR
 0xA7	U+00A7	#	SECTION SIGN
diff --git a/src/makefile.dos b/src/makefile.dos
index 98b57662..6c715a54 100644
--- a/src/makefile.dos
+++ b/src/makefile.dos
@@ -11,15 +11,23 @@ LYStyle.o LYHash.o LYPrettySrc.o TRSTable.o
 
 CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)
 
+# comment this line to suppress DIRED support
+DIRED_DEFS = -DDIRED_SUPPORT -DOK_UUDECODE -DOK_TAR -DOK_GZIP -DOK_ZIP
+
 CC = gcc
 MCFLAGS = -O2 -DHAVE_GETBKGD -DDISP_PARTIAL -DUSE_ZLIB \
  -DSOURCE_CACHE -DUSE_PSRC \
  -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES \
  -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP \
- -Ichrtrans -I../WWW/library/implementation \
- -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
+ -DEXP_PERSISTENT_COOKIES -DEXP_ADDRLIST_PAGE -DEXP_ALT_BINDINGS \
+ -DEXP_FILE_UPLOAD \
+ -DWATT32 \
+ $(DIRED_DEFS) \
+ -I./chrtrans -I../WWW/Library/Implementation \
+ -I../curses -I../djgpp/watt32/inc -I../djgpp/watt32/inc/sys
+WWWLIB = ../WWW/Library/djgpp/libwww.a ../curses/pdcurses.a ../djgpp/watt32/lib/libwatt.a
+LIBS= -lz # -lintl
+#INTLFLAGS = -DHAVE_GETTEXT -DHAVE_LIBINTL_H
 
 all: lynx
 
diff --git a/src/makefile.in b/src/makefile.in
index 89e8ef71..d655a462 100644
--- a/src/makefile.in
+++ b/src/makefile.in
@@ -110,6 +110,8 @@ clean:
 
 distclean: clean
 
+CMN=$(top_srcdir)/WWW/Library/Implementation/
+
 HTFWriter.o:	$(top_srcdir)/userdefs.h
 HTInit.o:	$(top_srcdir)/userdefs.h
 LYCharSets.o:	$(top_srcdir)/userdefs.h
@@ -124,6 +126,7 @@ LYShowInfo.o:	$(top_builddir)/cfg_defs.h
 LYTraversal.o:	$(top_srcdir)/userdefs.h
 LYUtils.o:	$(top_srcdir)/userdefs.h
 LYrcFile.o:	$(top_srcdir)/userdefs.h
+LYLeaks.o:	$(CMN)LYLeaks.h $(CMN)HTString.h
 
 CHRTR= chrtrans/
 
@@ -167,8 +170,6 @@ TABLES= \
  $(CHRTR)utf8_uni.h \
  $(CHRTR)viscii_uni.h
 
-CMN=$(top_srcdir)/WWW/Library/Implementation/
-
 $(TABLES):
 	-cd chrtrans && $(MAKE) tables
 
diff --git a/userdefs.h b/userdefs.h
index 98f9582f..a4a4b3a4 100644
--- a/userdefs.h
+++ b/userdefs.h
@@ -1279,12 +1279,12 @@
  * the version definition with the Project Version on checkout.  Just
  * ignore it. - kw */
 /* $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$ */
-#define LYNX_VERSION "2.8.3dev.13"
+#define LYNX_VERSION "2.8.3dev.14"
 #define LYNX_WWW_HOME "http://lynx.browser.org/"
 #define LYNX_WWW_DIST "http://www.slcc.edu/lynx/current/"
 #define LYNX_RELEASE FALSE
 /* $Format: "#define LYNX_DATE \"$ProjectDate$\""$ */
-#define LYNX_DATE "Thu, 21 Oct 1999 08:56:48 -0600"
+#define LYNX_DATE "Wed, 03 Nov 1999 19:41:39 -0700"
 #define LYNX_DATE_OFF 5		/* truncate the automatically-generated date */
 #define LYNX_DATE_LEN 11	/* truncate the automatically-generated date */
 #define LYNX_RELEASE_DATE "1999"