about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1997-05-25 00:16:10 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1997-05-25 00:16:10 -0400
commit945e8eb6bb07f64aaca42207af3311220ff2e4ba (patch)
tree6afb50262b844dd069bd4f7234da68008c48677c
parente4409c408eedf320b8845cafdd62b664bec1afd8 (diff)
downloadlynx-snapshots-945e8eb6bb07f64aaca42207af3311220ff2e4ba.tar.gz
snapshot of project "lynx", label v2-7-1ac_0-28
-rw-r--r--.Lynx.prcs_aux385
-rw-r--r--CHANGES.chartrans57
-rw-r--r--CHANGES.configure9
-rw-r--r--CHANGES.new763
-rw-r--r--LYMessages_en.h22
-rw-r--r--Lynx.prj218
-rw-r--r--MAKEFILE.W3228
-rw-r--r--Makefile67
-rw-r--r--PROBLEMS6
-rw-r--r--README.chartrans52
-rw-r--r--WWW/Library/Implementation/HTAABrow.c340
-rw-r--r--WWW/Library/Implementation/HTAccess.c15
-rw-r--r--WWW/Library/Implementation/HTAnchor.c41
-rw-r--r--WWW/Library/Implementation/HTAnchor.h24
-rw-r--r--WWW/Library/Implementation/HTFTP.c2
-rw-r--r--WWW/Library/Implementation/HTFile.c4
-rw-r--r--WWW/Library/Implementation/HTML.h5
-rw-r--r--WWW/Library/Implementation/HTMLDTD.c663
-rw-r--r--WWW/Library/Implementation/HTMLDTD.h8
-rw-r--r--WWW/Library/Implementation/HTNews.c24
-rw-r--r--WWW/Library/Implementation/HTTCP.c33
-rw-r--r--WWW/Library/Implementation/HTTP.c186
-rw-r--r--WWW/Library/Implementation/HTTelnet.c4
-rw-r--r--WWW/Library/Implementation/HTUtils.h9
-rw-r--r--WWW/Library/Implementation/HTWAIS.c3
-rw-r--r--WWW/Library/Implementation/HTWSRC.c8
-rw-r--r--WWW/Library/Implementation/SGML.c303
-rw-r--r--WWW/Library/Implementation/SGML.h55
-rw-r--r--WWW/Library/Implementation/tcp.h24
-rw-r--r--aclocal.m4128
-rwxr-xr-xconfig.guess3
-rw-r--r--config.hin13
-rwxr-xr-xconfigure862
-rw-r--r--configure.in87
-rw-r--r--lynx.cfg143
-rw-r--r--lynx.hlp13
-rw-r--r--lynx.man19
-rw-r--r--lynx_help/Lynx_users_guide.html105
-rw-r--r--lynx_help/keystroke_commands/follow_help.html85
-rw-r--r--lynx_help/keystroke_commands/keystroke_help.html5
-rw-r--r--lynx_help/keystroke_commands/other_help.html2
-rw-r--r--lynx_help/lynx_url_support.html27
-rw-r--r--makefile.in335
-rw-r--r--samples/lynx.cfg52
-rw-r--r--src/AttrList.h65
-rw-r--r--src/DefaultStyle.c2
-rw-r--r--src/GridText.c1477
-rw-r--r--src/GridText.h59
-rw-r--r--src/HTFWriter.c39
-rw-r--r--src/HTForms.h4
-rw-r--r--src/HTInit.c6
-rw-r--r--src/HTML.c1158
-rw-r--r--src/HTML.h7
-rw-r--r--src/LYBookmark.c28
-rw-r--r--src/LYCgi.c7
-rw-r--r--src/LYCharSets.c41
-rw-r--r--src/LYCharUtils.c155
-rw-r--r--src/LYCharUtils.h13
-rw-r--r--src/LYClean.c15
-rw-r--r--src/LYCookie.c44
-rw-r--r--src/LYCurses.c427
-rw-r--r--src/LYCurses.h58
-rw-r--r--src/LYExtern.c87
-rw-r--r--src/LYExtern.h10
-rw-r--r--src/LYForms.c71
-rw-r--r--src/LYGetFile.c86
-rw-r--r--src/LYGetFile.h16
-rw-r--r--src/LYGlobalDefs.h17
-rw-r--r--src/LYHash.c33
-rw-r--r--src/LYHash.h33
-rw-r--r--src/LYHistory.c161
-rw-r--r--src/LYJump.c2
-rw-r--r--src/LYKeymap.c121
-rw-r--r--src/LYKeymap.h63
-rw-r--r--src/LYLeaks.c2
-rw-r--r--src/LYList.c127
-rw-r--r--src/LYList.h1
-rw-r--r--src/LYMail.c26
-rw-r--r--src/LYMain.c364
-rw-r--r--src/LYMainLoop.c786
-rw-r--r--src/LYMap.c130
-rw-r--r--src/LYMap.h2
-rw-r--r--src/LYOptions.c44
-rw-r--r--src/LYPrint.c84
-rw-r--r--src/LYReadCFG.c72
-rw-r--r--src/LYSearch.c271
-rw-r--r--src/LYSearch.h2
-rw-r--r--src/LYShowInfo.c21
-rw-r--r--src/LYStrings.c112
-rw-r--r--src/LYStructs.h15
-rw-r--r--src/LYStyle.c396
-rw-r--r--src/LYStyle.h32
-rw-r--r--src/LYUtils.c257
-rw-r--r--src/LYexit.c2
-rw-r--r--src/Makefile4
-rw-r--r--src/UCAuto.c6
-rw-r--r--src/chrtrans/MAKEW32.BAT1
-rw-r--r--src/chrtrans/Makefile2
-rw-r--r--src/chrtrans/README.tables8
-rw-r--r--src/chrtrans/def7_uni.tbl2
-rw-r--r--src/chrtrans/makefile.in2
-rw-r--r--src/chrtrans/makeuctb.c5
-rw-r--r--src/makefile.dos5
-rw-r--r--src/makefile.in4
-rw-r--r--styles/lynx.lss60
-rw-r--r--userdefs.h45
106 files changed, 10204 insertions, 2228 deletions
diff --git a/.Lynx.prcs_aux b/.Lynx.prcs_aux
index 72567de3..3e2fb24c 100644
--- a/.Lynx.prcs_aux
+++ b/.Lynx.prcs_aux
@@ -1,23 +1,23 @@
 ;; This file is automatically generated, editing may cause PRCS to do
 ;; REALLY bad things.
 (Created-By-Prcs-Version 1 2 0)
+(WWW/Library/djgpp/makefile 857 861154810 0_makefile 1.4)
 (WWW/Library/Implementation/HTList.c 6153 856833014 h/4_HTList.c 1.1)
-(src/tcpwareolb.opt 24 856833014 d/8_tcpwareolb 1.1)
-(WWW/Library/djgpp/makefile 857 861154413 0_makefile 1.4)
 (WWW/Library/Implementation/HTGroup.h 5641 856833014 f/49_HTGroup.h 1.1)
-(src/LYGlobalDefs.h 10510 861154416 d/25_LYGlobalDe 1.1.2.3)
+(src/tcpwareolb.opt 24 856833014 d/8_tcpwareolb 1.1)
+(src/LYGlobalDefs.h 11115 864194647 d/25_LYGlobalDe 1.1.3.1.2.1.1.4)
 (CHANGES2-3 18114 856833014 h/46_CHANGES2-3 1.1)
-(WWW/Library/freebsd/Makefile 600 856833014 f/10_Makefile 1.1)
-(lynx_help/Lynx_users_guide.html 105776 860475643 e/14_Lynx_users 1.2.1.1)
 (CHANGES2-4 48390 856833014 h/45_CHANGES2-4 1.1)
+(WWW/Library/freebsd/Makefile 600 856833014 f/10_Makefile 1.1)
+(lynx_help/Lynx_users_guide.html 110021 863550907 e/14_Lynx_users 1.9)
+(CHANGES2-5 93256 856833014 h/44_CHANGES2-5 1.1)
 (src/LYMail.h 475 860064663 c/43_LYMail.h 1.2)
 (lynx_help/keystroke_commands/cookie_help.html 2652 856833014 e/15_cookie_hel 1.1)
 (lynx_help/keystroke_commands/xterm_help.html 1162 856833014 e/19_xterm_help 1.1)
-(CHANGES2-5 93256 856833014 h/44_CHANGES2-5 1.1)
 (CHANGES2-6 41847 856833014 b/0_CHANGES2-6 1.1)
 (WWW/Library/Implementation/HTList.h 3636 856833014 g/17_HTList.h 1.1)
+(WWW/Library/Implementation/HTUtils.h 10154 862707105 g/7_HTUtils.h 1.6)
 (docs/README.txt 580 856833014 e/35_README.txt 1.1)
-(WWW/Library/Implementation/HTUtils.h 10114 861154413 g/7_HTUtils.h 1.5)
 (src/LYSystem.h 211 856833014 c/38_LYSystem.h 1.1)
 (WWW/Library/sco/Makefile 793 856833014 f/4_Makefile 1.1)
 (utils/inews/version.c 100 856833014 c/0_version.c 1.1)
@@ -29,352 +29,361 @@
 (WWW/Library/Implementation/HTCJK.h 2933 860064663 f/30_HTCJK.h 1.2)
 (src/LYDownload.c 14873 860588360 c/47_LYDownload 1.3)
 (WWW/Library/apollo_m68k/Makefile 723 856833014 f/19_Makefile 1.1)
+(src/chrtrans/cp852_uni.tbl 11362 860516309 i/6_cp852_uni. 1.2)
 (test/ISO_LATIN1_test.html 3608 856833014 c/14_ISO_LATIN1 1.1)
 (build.com 7376 856833014 e/38_build.com 1.1)
-(src/chrtrans/cp852_uni.tbl 11362 860516309 i/6_cp852_uni. 1.2)
-(lynx_help/lynx_url_support.html 27493 856833014 e/13_lynx_url_s 1.1)
-(configure.in 5943 861154415 10_configure. 1.5)
+(lynx_help/lynx_url_support.html 28106 862290745 e/13_lynx_url_s 1.2)
+(lynx_help/keystroke_commands/follow_help.html 4805 863550907 43_follow_hel 1.1.1.2)
+(configure.in 7551 864148507 10_configure. 1.7)
+(makefile.in 15252 864148507 8_makefile.i 1.1.1.6)
 (src/LYDownload.h 315 856833014 c/46_LYDownload 1.1)
-(makefile.in 26415 861154415 8_makefile.i 1.1.1.4)
 (src/chrtrans/cp1252_uni.tbl 10789 856856948 h/51_cp1252_uni 1.1)
 (utils/inews/config.h-dist 13461 856833014 b/51_config.h-d 1.1)
-(src/GridText.c 129950 860064663 e/5_GridText.c 1.1.1.3)
-(WWW/Library/Implementation/HTFTP.c 90317 858077955 h/14_HTFTP.c 1.4)
-(src/LYMain.c 73136 861154416 d/44_LYMain.c 1.1.2.1.1.5)
+(WWW/Library/Implementation/HTFTP.c 90359 864519259 h/14_HTFTP.c 1.5)
+(src/GridText.c 167033 864519259 e/5_GridText.c 1.1.3.1.1.1.1.1.1.2.2.2.1.2.1.6)
+(src/LYMain.c 79973 864519259 d/44_LYMain.c 1.1.2.1.1.1.1.1.1.2.2.1.1.1.1.5)
 (src/tcpwareshr.opt 30 856833014 d/6_tcpwareshr 1.1)
-(src/LYGetFile.c 30319 860589397 d/48_LYGetFile. 1.6)
-(src/chrtrans/mnem_suni.tbl 24067 856856948 h/50_mnem_suni. 1.1)
+(src/LYGetFile.c 32149 863772691 d/48_LYGetFile. 1.5.2.3.2.4)
 (src/chrtrans/iso05_uni.tbl 1865 856925688 i/8_iso05_uni. 1.2)
+(src/chrtrans/mnem_suni.tbl 24067 856856948 h/50_mnem_suni. 1.1)
+(README.configure 1047 861154810 14_README.con 1.3)
+(src/UCAuto.c 6334 861850956 h/0_UCAuto.c 1.2)
 (src/LYTraversal.c 4377 860064663 c/25_LYTraversa 1.1.1.2)
-(src/UCAuto.c 6135 856856948 h/0_UCAuto.c 1.1)
 (WWW/Makefile 203 856833014 e/44_Makefile 1.1)
-(README.configure 1047 861154413 14_README.con 1.3)
-(WWW/Library/Implementation/HTAAProt.c 16206 857148169 g/40_HTAAProt.c 1.2)
-(WWW/Library/Implementation/crypt.c 3468 856833014 f/38_crypt.c 1.1)
-(src/GridText.h 5770 856833014 d/33_GridText.h 1.1)
 (README 4344 856833014 h/34_README 1.1)
-(WWW/Library/Implementation/HTFTP.h 1458 856833014 g/31_HTFTP.h 1.1)
 (WWW/Library/Implementation/HTVMSUtils.c 32547 856833014 h/23_HTVMSUtils 1.1)
-(src/LYGetFile.h 597 860064663 d/18_LYGetFile. 1.2)
+(WWW/Library/Implementation/HTAAProt.c 16206 857148169 g/40_HTAAProt.c 1.2)
+(WWW/Library/Implementation/HTFTP.h 1458 856833014 g/31_HTFTP.h 1.1)
+(WWW/Library/Implementation/crypt.c 3468 856833014 f/38_crypt.c 1.1)
+(src/GridText.h 6174 864148507 d/33_GridText.h 1.1.1.1.1.3.1.3.1.1)
+(src/LYGetFile.h 687 863136190 d/18_LYGetFile. 1.1.2.2.1.2)
 (utils/inews/config.h 13461 856833014 b/50_config.h 1.1)
 (docs/RFC-MAILCAP.txt 31538 856833014 e/34_RFC-MAILCA 1.1)
 (src/UCAuto.h 75 856856948 g/0_UCAuto.h 1.1)
-(WWW/Library/unix/Makefile 713 861154414 f/9_Makefile 1.2)
+(WWW/Library/unix/Makefile 713 861154810 f/9_Makefile 1.2)
 (test/README.txt 377 856833014 c/15_README.txt 1.1)
 (fixed512.com 1726 856833014 e/33_fixed512.c 1.1)
 (src/LYTraversal.h 497 856833014 c/24_LYTraversa 1.1)
-(lynx_help/keystroke_commands/gopher_types_help.html 1091 856833014 e/26_gopher_typ 1.1)
-(WWW/Library/Implementation/HTVMSUtils.h 2354 856833014 f/39_HTVMSUtils 1.1)
 (WWW/Library/Implementation/HTAAProt.h 7708 856833014 f/46_HTAAProt.h 1.1)
-(LYMessages_en.h 29525 858840837 h/37_LYMessages 1.3)
-(lynx_help/keystroke_commands/keystroke_help.html 4640 856833014 e/28_keystroke_ 1.1)
+(WWW/Library/Implementation/HTVMSUtils.h 2354 856833014 f/39_HTVMSUtils 1.1)
+(lynx_help/keystroke_commands/gopher_types_help.html 1091 856833014 e/26_gopher_typ 1.1)
+(src/LYExtern.c 1988 862452602 39_LYExtern.c 1.5)
+(LYMessages_en.h 30309 864183229 h/37_LYMessages 1.4.1.4.1.2.1.3)
+(lynx_help/keystroke_commands/keystroke_help.html 4873 863550907 e/28_keystroke_ 1.4)
 (WWW/Library/umaxv-m88k/Makefile 678 856833014 e/48_Makefile 1.1)
 (WWW/Library/Implementation/HTBTree.c 26907 856833014 h/15_HTBTree.c 1.1)
-(src/LYCookie.c 37402 860064663 c/18_LYCookie.c 1.3)
-(src/DefaultStyle.c 9514 856833014 c/51_DefaultSty 1.1)
+(src/LYCookie.c 38201 864519259 c/18_LYCookie.c 1.2.3.3)
+(src/LYExtern.h 169 862109152 38_LYExtern.h 1.1)
+(src/DefaultStyle.c 9513 862857695 c/51_DefaultSty 1.1.1.1)
 (VMSWAIS.announce 1549 856833014 h/29_VMSWAIS.an 1.1)
 (WWW/Copyright.txt 944 856833014 e/46_Copyright. 1.1)
-(src/chrtrans/Makefile 1873 860516309 i/3_Makefile 1.6)
+(src/chrtrans/Makefile 1943 863760678 i/3_Makefile 1.7)
 (WWW/Library/Implementation/HTBTree.h 2196 856833014 g/32_HTBTree.h 1.1)
-(src/LYKeymap.c 26251 856833014 d/31_LYKeymap.c 1.1)
+(src/LYKeymap.c 26856 864148507 d/31_LYKeymap.c 1.1.2.6.1.1)
 (src/LYCookie.h 508 856833014 c/17_LYCookie.h 1.1)
 (utils/lpansi/vmsbuild.com 1582 856833014 b/45_vmsbuild.c 1.1)
 (CMU.announce 1178 856833014 h/43_CMU.announ 1.1)
 (WWW/Library/convex/Makefile 723 856833014 f/2_Makefile 1.1)
-(config.sub 19236 861154414 30_config.sub 1.1)
-(src/LYKeymap.h 3384 860064663 d/30_LYKeymap.h 1.2)
+(config.sub 19236 861154810 30_config.sub 1.1)
+(src/AttrList.h 1306 864519259 33_AttrList.h 1.3)
+(src/LYKeymap.h 3808 863772691 d/30_LYKeymap.h 1.1.2.4)
 (src/gnuc.opt 84 856833014 d/12_gnuc.opt 1.1)
-(WWW/Library/Implementation/HTML.h 5588 856856948 g/28_HTML.h 1.2)
-(src/LYSearch.c 6841 860064663 d/38_LYSearch.c 1.3)
+(WWW/Library/Implementation/HTML.h 5807 863559602 g/28_HTML.h 1.1.2.2.1.1.1.1.1.2)
+(src/LYSearch.c 10579 862707105 d/38_LYSearch.c 1.2.2.3)
 (WWW/Library/Implementation/ufc-crypt.h 2491 856833014 f/33_ufc-crypt. 1.1)
 (src/socketshr_tcp.opt 16 856833014 d/9_socketshr_ 1.1)
 (src/HTAlert.c 10814 860064663 e/4_HTAlert.c 1.2)
-(src/LYSearch.h 326 856833014 d/28_LYSearch.h 1.1)
-(src/LYUtils.c 91060 860590375 d/27_LYUtils.c 1.12)
-(PROBLEMS 6522 856833014 h/35_PROBLEMS 1.1)
-(src/LYCharUtils.c 59125 860590375 c/22_LYCharUtil 1.2.1.4)
+(PROBLEMS 6635 863357417 h/35_PROBLEMS 1.2)
+(src/LYSearch.h 326 861212923 d/28_LYSearch.h 1.2)
+(src/LYUtils.c 94453 864519259 d/27_LYUtils.c 1.1.4.1.2.2.1.1.1.5)
+(src/LYCharUtils.c 62944 864194647 c/22_LYCharUtil 1.2.1.1.2.1.2.2.1.2.1.1.1.5)
 (WWW/Library/next/Makefile 992 856833014 f/16_Makefile 1.1)
-(src/LYCgi.c 11218 860064663 c/28_LYCgi.c 1.2)
+(src/LYCgi.c 11405 863772691 c/28_LYCgi.c 1.1.1.2)
 (utils/lpansi/lpansi.c 4570 856833014 b/49_lpansi.c 1.1)
-(src/HTAlert.h 3198 856833014 d/1_HTAlert.h 1.1)
 (src/chrtrans/iso09_uni.tbl 857 856925688 i/11_iso09_uni. 1.2)
+(src/HTAlert.h 3198 856833014 d/1_HTAlert.h 1.1)
 (lynx_help/lynx_help_main.html 2668 857014209 e/29_lynx_help_ 1.2)
 (src/LYUtils.h 3987 860064663 d/34_LYUtils.h 1.1.1.3)
-(src/LYCharUtils.h 2043 856856948 c/19_LYCharUtil 1.2)
+(src/LYCharUtils.h 2215 864519259 c/19_LYCharUtil 1.1.3.4)
 (WWW/Library/decstation/Makefile 409 856833014 f/18_Makefile 1.1)
 (src/LYCgi.h 133 856833014 c/27_LYCgi.h 1.1)
 (WWW/Library/Implementation/HTChunk.c 2033 856833014 h/8_HTChunk.c 1.1)
 (WWW/Library/clix/Makefile 683 856833014 e/49_Makefile 1.1)
 (RELEASE_STATEMENT 1212 860264978 h/33_RELEASE_ST 1.2)
 (utils/inews/README 2391 856833014 c/7_README 1.1)
-(src/LYHistory.c 13985 860064663 d/21_LYHistory. 1.1.1.2)
+(src/LYHistory.c 18742 863760678 d/21_LYHistory. 1.1.2.1.4.3)
+(src/chrtrans/makeuctb.c 13460 863760678 i/1_makeuctb.c 1.8)
 (utils/inews/Makefile 1484 857398594 c/9_Makefile 1.1.1.1)
-(src/chrtrans/makeuctb.c 13310 860516309 i/1_makeuctb.c 1.7)
 (WWW/Library/Implementation/HTChunk.h 3543 856833014 g/26_HTChunk.h 1.1)
 (src/ucxolb.opt 28 856833014 c/36_ucxolb.opt 1.1)
 (lynx_help/keystroke_commands/option_help.html 11623 860264978 e/23_option_hel 1.2)
 (lynx_help/keystroke_commands/bookmark_help.html 891 856833014 e/27_bookmark_h 1.1)
-(src/LYList.c 4220 857148169 d/3_LYList.c 1.2)
+(src/LYList.c 6477 863772691 d/3_LYList.c 1.1.3.4.1.2)
 (src/LYHistory.h 623 856833014 d/11_LYHistory. 1.1)
-(src/chrtrans/README.tables 2315 856856948 i/4_README.tab 1.1)
-(samples/jumpsUnix.html 3328 856833014 e/8_jumpsUnix. 1.1)
-(WWW/Library/Implementation/HTStyle.c 8994 860475643 h/5_HTStyle.c 1.3)
 (src/chrtrans/cp850_uni.tbl 10229 860516309 i/19_cp850_uni. 1.2)
+(src/chrtrans/README.tables 2442 862707105 i/4_README.tab 1.3)
+(WWW/Library/Implementation/HTStyle.c 8994 860475643 h/5_HTStyle.c 1.3)
+(samples/jumpsUnix.html 3328 856833014 e/8_jumpsUnix. 1.1)
 (WWW/Library/Implementation/HTMLGen.c 9582 856856948 h/9_HTMLGen.c 1.2)
 (WWW/Library/Implementation/HTStream.h 1802 856833014 g/21_HTStream.h 1.1)
-(WWW/Library/Implementation/HTFormat.c 21592 856833014 h/0_HTFormat.c 1.1)
-(WWW/Library/vms/libmake.com 6288 856833014 f/21_libmake.co 1.1)
 (src/chrtrans/iso04_uni.tbl 1858 856925688 i/15_iso04_uni. 1.2)
+(WWW/Library/Implementation/HTFormat.c 21592 856833014 h/0_HTFormat.c 1.1)
 (WWW/Library/Implementation/HTUU.c 7512 860064663 g/37_HTUU.c 1.2)
+(WWW/Library/vms/libmake.com 6288 856833014 f/21_libmake.co 1.1)
 (src/chrtrans/koi8r_uni.tbl 4570 860516880 24_koi8r_uni. 1.1)
-(WWW/Library/Implementation/CommonMakefile 12712 861154413 f/41_CommonMake 1.3)
 (DESC 664 856833014 h/41_DESC 1.1)
+(WWW/Library/Implementation/CommonMakefile 12712 861154810 f/41_CommonMake 1.3)
 (src/LYVMSdef.h 562 856833014 c/16_LYVMSdef.h 1.1)
-(src/LYList.h 222 856833014 c/26_LYList.h 1.1)
-(src/decc.opt 58 856833014 d/13_decc.opt 1.1)
+(src/LYList.h 262 861212923 c/26_LYList.h 1.2)
 (src/chrtrans/cp1250_uni.tbl 10813 856856948 h/48_cp1250_uni 1.1)
+(src/decc.opt 58 856833014 d/13_decc.opt 1.1)
 (WWW/Library/Implementation/HTStyle.h 6741 856833014 g/18_HTStyle.h 1.1)
+(CHANGES.new 65994 864519259 6_CHANGES.ne 1.18.1.4.1.1.2.1.1.2.2.2.1.2.1.1.1.1.1.4.2.4)
 (WWW/Library/Implementation/HTMLGen.h 753 856833014 g/22_HTMLGen.h 1.1)
-(CHANGES.new 19874 861154493 6_CHANGES.ne 1.22)
 (WWW/Library/Implementation/HTFormat.h 10966 856833014 g/13_HTFormat.h 1.1)
 (WWW/Library/Implementation/HTUU.h 964 856833014 f/43_HTUU.h 1.1)
-(WWW/Library/Implementation/HTWSRC.c 10851 856833014 h/20_HTWSRC.c 1.1)
+(WWW/Library/Implementation/HTWSRC.c 11119 862857695 h/20_HTWSRC.c 1.1.1.1)
 (src/chrtrans/UCkd.h 1317 856856948 i/2_UCkd.h 1.1)
-(WWW/Library/Implementation/HTFile.c 56600 860590375 h/27_HTFile.c 1.1.2.3)
+(WWW/Library/Implementation/HTFile.c 56747 864194647 h/27_HTFile.c 1.1.3.3)
 (src/chrtrans/mnemonic_suni.tbl 22264 856856948 h/49_mnemonic_s 1.1)
 (WWW/Library/vms/COPYING.LIB 25265 856833014 f/20_COPYING.LI 1.1)
+(src/chrtrans/MAKEW32.BAT 830 862109152 3_MAKEW32.BA 1.3)
 (WWW/Library/Implementation/HTWSRC.h 1320 856833014 g/3_HTWSRC.h 1.1)
-(src/chrtrans/MAKEW32.BAT 831 860899928 3_MAKEW32.BA 1.2)
 (WWW/Library/sgi/Makefile 683 856833014 f/14_Makefile 1.1)
 (WWW/Library/Implementation/HTFile.h 4772 856856948 g/33_HTFile.h 1.2)
 (WWW/Library/isc/Makefile 679 856833014 e/50_Makefile 1.1)
-(src/LYMap.c 9053 860064663 c/21_LYMap.c 1.2)
-(src/LYPrint.c 27053 861154416 d/40_LYPrint.c 1.5)
-(WWW/Library/Implementation/HTTelnet.c 15473 860899928 h/24_HTTelnet.c 1.3)
+(src/LYMap.c 10529 864519259 c/21_LYMap.c 1.1.2.1.1.2.1.3)
+(src/LYPrint.c 29227 864194647 d/40_LYPrint.c 1.1.1.1.1.1.1.3)
+(WWW/Library/Implementation/HTTelnet.c 15458 862109152 h/24_HTTelnet.c 1.4)
 (about_lynx/about_lynx.html 4135 856833014 e/43_about_lynx 1.1)
 (samples/mime.types 1057 856833014 e/9_mime.types 1.1)
 (src/HTNestedList.h 1188 856833014 c/30_HTNestedLi 1.1)
-(src/LYMap.h 222 856833014 c/20_LYMap.h 1.1)
+(src/chrtrans/iso10_uni.tbl 1565 856925688 i/10_iso10_uni. 1.2)
+(src/LYMap.h 240 861212923 c/20_LYMap.h 1.2)
 (samples/jumpsVMS.html 1417 856833014 e/7_jumpsVMS.h 1.1)
-(src/LYReadCFG.c 31182 861154416 d/39_LYReadCFG. 1.1.1.1.1.5)
+(src/LYReadCFG.c 32783 864519259 d/39_LYReadCFG. 1.1.1.1.3.2.2.6)
 (WWW/Library/vms/descrip.mms 9051 856833014 f/22_descrip.mm 1.1)
 (src/LYPrint.h 304 856833014 d/7_LYPrint.h 1.1)
-(src/chrtrans/iso10_uni.tbl 1565 856925688 i/10_iso10_uni. 1.2)
-(WWW/Library/Implementation/HTAccess.c 35510 856836688 h/17_HTAccess.c 1.2)
+(WWW/Library/Implementation/HTAccess.c 36081 861698732 h/17_HTAccess.c 1.5)
 (WWW/Library/Implementation/HTTelnet.h 582 856833014 g/5_HTTelnet.h 1.1)
-(WWW/Library/Implementation/HTAnchor.c 32223 860064663 h/6_HTAnchor.c 1.1.1.2)
+(WWW/Library/Implementation/HTAnchor.c 33025 864519259 h/6_HTAnchor.c 1.1.2.5)
 (utils/inews/inews.c 7996 856833014 c/2_inews.c 1.1)
 (src/LYReadCFG.h 219 856833014 c/41_LYReadCFG. 1.1)
 (docs/README.html 686 856833014 e/36_README.htm 1.1)
 (src/LYrcFile.c 25393 860590375 d/15_LYrcFile.c 1.3)
-(WWW/Library/Implementation/HTAccess.h 7620 860064663 g/35_HTAccess.h 1.3)
 (src/UCAux.c 6244 860064663 f/0_UCAux.c 1.3)
-(WWW/Library/Implementation/HTPasswd.c 7766 856833014 g/43_HTPasswd.c 1.1)
+(WWW/Library/Implementation/HTAccess.h 7620 860064663 g/35_HTAccess.h 1.3)
+(WWW/Library/Implementation/HTAtom.c 3868 856833014 h/7_HTAtom.c 1.1)
 (WWW/Library/Implementation/HTAAFile.c 5620 856833014 g/44_HTAAFile.c 1.1)
+(WWW/Library/Implementation/HTPasswd.c 7766 856833014 g/43_HTPasswd.c 1.1)
 (samples/mailcap 4771 856833014 e/11_mailcap 1.1)
-(WWW/Library/Implementation/HTAtom.c 3868 856833014 h/7_HTAtom.c 1.1)
-(WWW/Library/Implementation/HTAnchor.h 13255 856856948 g/19_HTAnchor.h 1.2)
+(WWW/Library/Implementation/HTAnchor.h 13861 864519259 g/19_HTAnchor.h 1.1.2.5)
 (src/chrtrans/iso06_uni.tbl 1204 856856948 i/14_iso06_uni. 1.1)
-(Makefile 42942 860475643 h/36_Makefile 1.1.1.1.1.4)
+(Makefile 45861 864148507 h/36_Makefile 1.1.1.1.1.5)
 (src/LYrcFile.h 194 856833014 d/5_LYrcFile.h 1.1)
 (src/LYUpload.c 7538 857148169 d/35_LYUpload.c 1.2)
-(src/HTForms.h 3106 856833014 d/32_HTForms.h 1.1)
+(src/HTForms.h 3316 861212923 d/32_HTForms.h 1.2)
+(WWW/Library/Implementation/HTAtom.h 1210 856833014 g/20_HTAtom.h 1.1)
 (WWW/Library/Implementation/HTAAFile.h 4408 856833014 f/51_HTAAFile.h 1.1)
+(WWW/Library/Implementation/HTPasswd.h 4717 856833014 f/50_HTPasswd.h 1.1)
 (src/descrip.mms 4835 856833014 e/6_descrip.mm 1.1)
 (src/LYSignal.h 300 856833014 d/23_LYSignal.h 1.1)
-(WWW/Library/Implementation/HTAtom.h 1210 856833014 g/20_HTAtom.h 1.1)
-(lynx_help/keystroke_commands/other_help.html 6088 856833014 e/22_other_help 1.1)
-(WWW/Library/Implementation/HTPasswd.h 4717 856833014 f/50_HTPasswd.h 1.1)
+(lynx_help/keystroke_commands/other_help.html 6155 863280018 e/22_other_help 1.2)
+(aclocal.m4 25832 864519259 12_aclocal.m4 1.9)
 (WWW/Library/Implementation/patchlevel.h 959 856833014 f/34_patchlevel 1.1)
-(aclocal.m4 22941 861154414 12_aclocal.m4 1.5)
-(userdefs.h 52108 861154417 c/10_userdefs.h 1.1.2.1.1.1.1.5)
-(WWW/Library/Implementation/HTAssoc.c 1736 856833014 g/39_HTAssoc.c 1.1)
+(userdefs.h 53602 864194647 c/10_userdefs.h 1.1.2.1.1.1.1.1.1.1.2.6)
 (TCPWARE.announce 1352 856833014 h/31_TCPWARE.an 1.1)
+(WWW/Library/Implementation/HTMLDTD.c 61298 862857695 h/26_HTMLDTD.c 1.8.1.1)
+(WWW/Library/Implementation/HTAssoc.c 1736 856833014 g/39_HTAssoc.c 1.1)
 (WWW/Library/sun4/Makefile 578 856833014 f/11_Makefile 1.1)
-(WWW/Library/Implementation/HTMLDTD.c 33276 860516309 h/26_HTMLDTD.c 1.4)
 (WWW/Library/vax_ultrix/Makefile 678 856833014 f/8_Makefile 1.1)
 (src/LYUpload.h 300 856833014 c/49_LYUpload.h 1.1)
 (lynx_help/keystroke_commands/edit_help.html 1409 856833014 e/17_edit_help. 1.1)
-(src/LYLeaks.c 14684 856833014 c/31_LYLeaks.c 1.1)
-(src/LYMainLoop.c 120193 860590375 d/43_LYMainLoop 1.2.3.6)
+(src/LYLeaks.c 14687 864519259 c/31_LYLeaks.c 1.2)
+(src/LYMainLoop.c 140126 864519259 d/43_LYMainLoop 1.2.4.2.2.1.2.6.1.2.1.1.1.1.1.5)
 (about_lynx/about_lynx-dev.html 2500 856833014 e/42_about_lynx 1.1)
 (VMSPrint.com 616 856833014 h/30_VMSPrint.c 1.1)
 (WWW/Library/netbsd/Makefile 613 856833014 f/0_Makefile 1.1)
 (WWW/Library/Implementation/UCAux.h 947 856856948 i/23_UCAux.h 1.1)
-(WWW/Library/Implementation/HTMLDTD.h 25833 856856948 g/27_HTMLDTD.h 1.2)
-(src/Makefile 2321 860520828 d/29_Makefile 1.2.2.2)
+(WWW/Library/Implementation/HTMLDTD.h 25922 861703691 g/27_HTMLDTD.h 1.4)
 (WWW/Library/Implementation/HTAssoc.h 1096 856833014 f/45_HTAssoc.h 1.1)
-(build-slang.com 8432 856833014 e/39_build-slan 1.1)
-(src/LYMainLoop.h 101 860064663 d/19_LYMainLoop 1.2)
-(WWW/Library/osf/Makefile 388 856833014 f/7_Makefile 1.1)
-(lynx.man 12866 860264978 e/30_lynx.man 1.3)
+(src/Makefile 2349 864148507 d/29_Makefile 1.2.2.4)
 (WWW/Library/Implementation/HTAAUtil.c 15696 856833014 g/47_HTAAUtil.c 1.1)
+(lynx.man 13019 863280018 e/30_lynx.man 1.5.2.2)
+(WWW/Library/osf/Makefile 388 856833014 f/7_Makefile 1.1)
+(src/LYMainLoop.h 101 860064663 d/19_LYMainLoop 1.2)
+(build-slang.com 8432 856833014 e/39_build-slan 1.1)
+(WWW/Library/unix/makefile.in 1188 861154810 16_makefile.i 1.3)
 (samples/lynx.com 2192 856833014 e/10_lynx.com 1.1)
-(WWW/Library/unix/makefile.in 1188 861154414 16_makefile.i 1.3)
-(src/LYCharSets.c 109559 860516309 c/45_LYCharSets 1.3)
-(src/LYStrings.c 28885 861154417 d/36_LYStrings. 1.8)
-(src/HTFont.h 438 856833014 d/0_HTFont.h 1.1)
-(WWW/Library/Implementation/Makefile 15116 856833014 f/40_Makefile 1.1)
 (src/chrtrans/README.format 3551 860516309 i/5_README.for 1.2)
+(WWW/Library/Implementation/Makefile 15116 856833014 f/40_Makefile 1.1)
+(src/HTFont.h 438 856833014 d/0_HTFont.h 1.1)
+(src/LYStrings.c 31823 864519259 d/36_LYStrings. 1.1.3.3.2.3)
+(src/LYCharSets.c 110597 863760678 c/45_LYCharSets 1.4)
 (WWW/Library/Implementation/HTDOS.c 1855 860588360 28_HTDOS.C 1.1)
-(src/LYShowInfo.c 10635 857398594 d/37_LYShowInfo 1.4)
 (utils/inews/README.NN 3051 856833014 c/6_README.NN 1.1)
-(lynx_help/keystroke_commands/movement_help.html 1795 856833014 e/24_movement_h 1.1)
-(src/HTML.c 168962 860520828 e/2_HTML.c 1.1.2.4)
-(utils/inews/clientlib.c 11163 856833014 c/5_clientlib. 1.1)
-(src/LYEdit.c 3448 860588360 d/50_LYEdit.c 1.2)
-(WWW/Library/Implementation/HTAAUtil.h 12046 856833014 g/2_HTAAUtil.h 1.1)
+(src/LYShowInfo.c 10840 863760678 d/37_LYShowInfo 1.1.2.1.2.4)
 (src/chrtrans/iso01_uni.tbl 5204 860516309 i/18_iso01_uni. 1.2)
-(src/LYCharSets.h 1071 856856948 c/44_LYCharSets 1.2)
-(WWW/Library/sun3/Makefile 636 856833014 f/12_Makefile 1.1)
+(WWW/Library/Implementation/HTAAUtil.h 12046 856833014 g/2_HTAAUtil.h 1.1)
+(src/LYEdit.c 3448 860588360 d/50_LYEdit.c 1.2)
+(utils/inews/clientlib.c 11163 856833014 c/5_clientlib. 1.1)
+(src/HTML.c 194233 864519259 e/2_HTML.c 1.1.4.1.1.1.1.2.1.4.1.2.1.7)
+(lynx_help/keystroke_commands/movement_help.html 1795 856833014 e/24_movement_h 1.1)
 (src/LYStrings.h 4742 860064663 d/20_LYStrings. 1.1.1.2)
-(WWW/Library/Implementation/HTWAIS.c 29606 856833014 h/22_HTWAIS.c 1.1)
-(CHANGES 58482 860264978 h/47_CHANGES 1.2)
+(WWW/Library/sun3/Makefile 636 856833014 f/12_Makefile 1.1)
+(src/LYCharSets.h 1071 856856948 c/44_LYCharSets 1.2)
 (WWW/Library/Implementation/HTDOS.h 771 860588360 27_HTDOS.H 1.1)
-(src/LYShowInfo.h 316 856833014 c/39_LYShowInfo 1.1)
-(WWW/Library/Implementation/HTRules.c 11040 856833014 h/1_HTRules.c 1.1)
-(WWW/Library/Implementation/SGML.c 66677 860423030 h/12_SGML.c 1.1.1.1.1.1.1.1)
+(CHANGES 58482 860264978 h/47_CHANGES 1.2)
+(WWW/Library/Implementation/HTWAIS.c 29769 862857695 h/22_HTWAIS.c 1.1.1.1)
 (install.sh 4771 858077955 9_install.sh 1.1)
-(src/HTML.h 5588 856856948 c/48_HTML.h 1.2)
-(utils/inews/clientlib.h 230 856833014 c/4_clientlib. 1.1)
+(WWW/Library/Implementation/SGML.c 72357 864519259 h/12_SGML.c 1.1.1.1.1.1.2.8)
+(WWW/Library/Implementation/HTRules.c 11040 856833014 h/1_HTRules.c 1.1)
+(src/LYShowInfo.h 316 856833014 c/39_LYShowInfo 1.1)
 (src/LYEdit.h 134 856833014 d/16_LYEdit.h 1.1)
+(utils/inews/clientlib.h 230 856833014 c/4_clientlib. 1.1)
+(src/HTML.h 5850 864148507 c/48_HTML.h 1.1.2.2.2.1.1.2.1.1)
+(src/LYStyle.c 9090 864519259 36_LYStyle.c 1.6)
 (newfiles.chartrans 1286 860620937 b/0_newfiles.chartrans 1.4)
-(src/HTFWriter.c 31210 860590375 d/2_HTFWriter. 1.1.2.4)
 (WWW/Library/Implementation/HTParse.c 20852 860064663 h/18_HTParse.c 1.3)
-(WWW/Library/unix_x/Makefile 15482 856833014 f/1_Makefile 1.1)
+(src/HTFWriter.c 31990 864194647 d/2_HTFWriter. 1.1.3.1.3.3)
 (WWW/Library/Implementation/HTWAIS.h 1554 856833014 g/4_HTWAIS.h 1.1)
-(lynx.cfg 66857 861154415 e/32_lynx.cfg 1.2.1.5)
+(WWW/Library/unix_x/Makefile 15482 856833014 f/1_Makefile 1.1)
+(WWW/Library/Implementation/SGML.h 8830 862326975 g/29_SGML.h 1.4)
 (WWW/Library/Implementation/HTRules.h 4105 856833014 g/14_HTRules.h 1.1)
-(WWW/Library/Implementation/SGML.h 6221 856856948 g/29_SGML.h 1.2)
+(lynx.cfg 73794 863772691 e/32_lynx.cfg 1.2.1.2.1.1.1.4)
+(src/HTInit.c 30678 864519259 e/3_HTInit.c 1.2.1.2)
 (WWW/Library/snake/Makefile 649 856833014 f/13_Makefile 1.1)
-(src/HTInit.c 30657 857148169 e/3_HTInit.c 1.2)
-(test/tabtest.html 1412 856833014 c/11_tabtest.ht 1.1)
+(src/LYStyle.h 676 864519259 b/5_LYStyle.h 1.2)
 (WWW/Library/Implementation/UCDefs.h 2623 856856948 i/21_UCDefs.h 1.1)
-(WWW/Library/Implementation/HTParse.h 4930 856833014 g/36_HTParse.h 1.1)
+(test/tabtest.html 1412 856833014 c/11_tabtest.ht 1.1)
 (SOCKETSHR.announce 1704 856833014 h/32_SOCKETSHR. 1.1)
-(lynx_help/keystroke_commands/print_help.html 1235 856833014 e/21_print_help 1.1)
-(WWW/Library/Implementation/HTAAServ.c 18320 856833014 g/46_HTAAServ.c 1.1)
+(WWW/Library/Implementation/HTParse.h 4930 856833014 g/36_HTParse.h 1.1)
 (WWW/Library/Implementation/HTInit.c 9452 856833014 g/51_HTInit.c 1.1)
-(src/LYStructs.h 2650 856833014 d/26_LYStructs. 1.1)
+(WWW/Library/Implementation/HTAAServ.c 18320 856833014 g/46_HTAAServ.c 1.1)
+(lynx_help/keystroke_commands/print_help.html 1235 856833014 e/21_print_help 1.1)
+(src/LYStructs.h 3132 864148507 d/26_LYStructs. 1.4)
 (utils/lpansi/lpansi.1 3039 856833014 b/47_lpansi.1 1.1)
-(WWW/Library/ptx/Makefile 626 856833014 e/51_Makefile 1.1)
-(src/cmu_tcp.opt 34 856833014 d/14_cmu_tcp.op 1.1)
-(WWW/Library/Implementation/HTVMS_WaisProt.c 70622 856833014 f/32_HTVMS_Wais 1.1)
 (WWW/Library/Implementation/HTMIME.c 60906 856856948 g/50_HTMIME.c 1.2)
-(src/HTSaveToFile.h 554 856833014 c/50_HTSaveToFi 1.1)
-(lynx.hlp 13216 860264978 e/31_lynx.hlp 1.3)
+(WWW/Library/Implementation/HTVMS_WaisProt.c 70622 856833014 f/32_HTVMS_Wais 1.1)
+(src/cmu_tcp.opt 34 856833014 d/14_cmu_tcp.op 1.1)
+(WWW/Library/ptx/Makefile 626 856833014 e/51_Makefile 1.1)
+(src/chrtrans/makefile.in 2349 863772691 18_makefile.i 1.3)
 (WWW/Library/Implementation/HTAuth.c 5776 856833014 h/28_HTAuth.c 1.1)
-(src/chrtrans/makefile.in 2279 860520828 18_makefile.i 1.2)
-(src/LYCurses.c 29281 861154644 d/51_LYCurses.c 1.1.2.6)
-(test/iso8859-1.html 12169 856833014 c/12_iso8859-1. 1.1)
-(WWW/Library/mips/Makefile 663 856833014 f/3_Makefile 1.1)
-(WWW/Library/Implementation/HTAAServ.h 4950 856833014 g/1_HTAAServ.h 1.1)
+(lynx.hlp 13380 863280018 e/31_lynx.hlp 1.6)
+(src/HTSaveToFile.h 554 856833014 c/50_HTSaveToFi 1.1)
 (WWW/Library/Implementation/HTInit.h 613 856833014 g/12_HTInit.h 1.1)
-(WWW/Library/Implementation/HTTP.c 43811 859500450 h/16_HTTP.c 1.2)
-(about_lynx/COPYING 17982 856833014 e/41_COPYING 1.1)
+(WWW/Library/Implementation/HTAAServ.h 4950 856833014 g/1_HTAAServ.h 1.1)
+(WWW/Library/mips/Makefile 663 856833014 f/3_Makefile 1.1)
+(test/iso8859-1.html 12169 856833014 c/12_iso8859-1. 1.1)
+(src/LYCurses.c 36715 864519259 d/51_LYCurses.c 1.1.5.1.1.4)
+(WWW/Library/Implementation/HTTP.c 47596 864194647 h/16_HTTP.c 1.1.1.1.1.2.1.1)
 (WWW/Library/Implementation/UCMap.h 838 858077955 i/22_UCMap.h 1.2)
-(WWW/Library/Implementation/HTVMS_WaisProt.h 13173 856833014 f/28_HTVMS_Wais 1.1)
-(WWW/Library/Implementation/LYLeaks.h 4165 856833014 f/29_LYLeaks.h 1.1)
-(WWW/Library/Implementation/HTMIME.h 2004 856833014 g/11_HTMIME.h 1.1)
-(WWW/Library/Implementation/HTString.c 3364 856833014 h/3_HTString.c 1.1)
+(about_lynx/COPYING 17982 856833014 e/41_COPYING 1.1)
+(styles/lynx.lss 1490 862005876 37_lynx.lss 1.1)
 (README.win-386 1477 857398594 2_386-WIN.TX 1.2)
+(WWW/Library/Implementation/HTString.c 3364 856833014 h/3_HTString.c 1.1)
+(WWW/Library/Implementation/HTMIME.h 2004 856833014 g/11_HTMIME.h 1.1)
+(WWW/Library/Implementation/LYLeaks.h 4165 856833014 f/29_LYLeaks.h 1.1)
+(WWW/Library/Implementation/HTVMS_WaisProt.h 13173 856833014 f/28_HTVMS_Wais 1.1)
 (WWW/Library/Implementation/HTAuth.h 1791 856833014 f/47_HTAuth.h 1.1)
-(descrip.mms 3640 856833014 e/37_descrip.mm 1.1)
-(src/LYCurses.h 6747 860064663 d/22_LYCurses.h 1.4.1.2)
-(WWW/Library/Implementation/HTTCP.c 28080 860590375 h/13_HTTCP.c 1.2.2.3)
 (src/chrtrans/utf8_uni.tbl 936 856856948 i/7_utf8_uni.t 1.1)
-(test/TestComment.html 2032 856833014 c/13_TestCommen 1.1)
+(WWW/Library/Implementation/HTTCP.c 28464 863772691 h/13_HTTCP.c 1.2.3.3)
+(src/LYCurses.h 8657 864519259 d/22_LYCurses.h 1.1.4.5)
+(descrip.mms 3640 856833014 e/37_descrip.mm 1.1)
 (WWW/Library/Implementation/HTTP.h 598 856833014 g/34_HTTP.h 1.1)
-(WWW/Library/Implementation/Version.make 10 856833014 f/42_Version.ma 1.1)
+(test/TestComment.html 2032 856833014 c/13_TestCommen 1.1)
+(src/makefile.dos 2119 864148507 1_makefile.d 1.5)
 (WWW/Library/Implementation/HTString.h 1153 856833014 g/16_HTString.h 1.1)
-(src/makefile.dos 2178 860588360 1_makefile.d 1.3)
-(MAKEFILE.W32 17274 857398594 5_MAKEFILE.W 1.1)
-(src/win_tcp.opt 36 856833014 c/33_win_tcp.op 1.1)
-(WWW/Library/Implementation/HTTCP.h 3160 860899928 g/30_HTTCP.h 1.3)
-(src/chrtrans/iso03_uni.tbl 1872 856925688 i/16_iso03_uni. 1.2)
+(WWW/Library/Implementation/Version.make 10 856833014 f/42_Version.ma 1.1)
+(MAKEFILE.W32 17568 862109152 5_MAKEFILE.W 1.2)
 (WWW/Library/djgpp/CommonMakefile 13489 860588360 26_CommonMake 1.1)
-(config.guess 20370 861154414 31_config.gue 1.1)
-(config.hin 3817 861154414 11_config.hin 1.5)
+(src/chrtrans/iso03_uni.tbl 1872 856925688 i/16_iso03_uni. 1.2)
+(WWW/Library/Implementation/HTTCP.h 3160 860899928 g/30_HTTCP.h 1.3)
+(src/win_tcp.opt 36 856833014 c/33_win_tcp.op 1.1)
+(config.guess 20446 862326975 31_config.gue 1.2)
+(src/LYHash.c 625 864519259 35_LYHash.c 1.2)
+(config.hin 4229 864148507 11_config.hin 1.7)
 (FM.announce 3655 856833014 h/40_FM.announc 1.1)
-(src/LYGCurses.h 6123 856833014 c/32_LYGCurses. 1.1)
-(WWW/Library/svr4/Makefile 590 856833014 f/5_Makefile 1.1)
+(src/LYHash.h 784 864519259 34_LYHash.h 1.3)
 (WWW/Library/Implementation/HTPlain.c 15394 858077955 h/11_HTPlain.c 1.4)
-(src/vaxc.opt 54 856833014 c/34_vaxc.opt 1.1)
+(WWW/Library/svr4/Makefile 590 856833014 f/5_Makefile 1.1)
+(src/LYGCurses.h 6123 856833014 c/32_LYGCurses. 1.1)
 (WWW/Library/Implementation/HTAlert.c 3039 856833014 h/2_HTAlert.c 1.1)
+(src/vaxc.opt 54 856833014 c/34_vaxc.opt 1.1)
 (src/chrtrans/MAKEFILE.W32 1857 857398594 4_MAKEFILE.W 1.1)
+(configure 157077 864519259 13_configure 1.9)
 (WWW/Library/Implementation/HTPlain.h 460 856833014 g/25_HTPlain.h 1.1)
-(configure 150613 861154415 13_configure 1.5)
-(src/ucxshr.opt 28 856833014 c/35_ucxshr.opt 1.1)
-(utils/inews/Manifest 649 856833014 c/8_Manifest 1.1)
 (WWW/Library/Implementation/HTLex.c 3090 856833014 g/38_HTLex.c 1.1)
+(utils/inews/Manifest 649 856833014 c/8_Manifest 1.1)
+(src/ucxshr.opt 28 856833014 c/35_ucxshr.opt 1.1)
 (WWW/Library/Implementation/HTAlert.h 3198 856833014 g/15_HTAlert.h 1.1)
 (WWW/Library/Implementation/HText.h 6841 856833014 g/6_HText.h 1.1)
-(WWW/Library/Implementation/getpass.c 1649 856833014 f/35_getpass.c 1.1)
 (lynx_help/keystroke_commands/dired_help.html 1683 856833014 e/18_dired_help 1.1)
-(src/LYJump.c 11334 860064663 d/47_LYJump.c 1.2)
+(WWW/Library/Implementation/getpass.c 1649 856833014 f/35_getpass.c 1.1)
 (WWW/Library/Implementation/HTLex.h 1293 856833014 f/44_HTLex.h 1.1)
+(src/LYJump.c 11339 864519259 d/47_LYJump.c 1.3)
 (WWW/Library/Implementation/HTWriter.c 3883 856833014 h/21_HTWriter.c 1.1)
 (lynx_help/keystroke_commands/visited_help.html 1401 856833014 e/16_visited_he 1.1)
 (WWW/Library/Implementation/crypt_util.c 25993 856833014 f/37_crypt_util 1.1)
-(src/LYJump.h 553 860064663 c/29_LYJump.h 1.2)
 (src/LYLocal.c 55563 859825979 d/46_LYLocal.c 1.5)
+(src/LYJump.h 553 860064663 c/29_LYJump.h 1.2)
 (WWW/Library/Implementation/HTWriter.h 632 856833014 g/24_HTWriter.h 1.1)
-(CHANGES.configure 3061 861154413 15_CHANGES.co 1.1.1.3)
+(CHANGES.configure 3467 861765369 15_CHANGES.co 1.1.1.4)
 (INSTALLATION 18767 856833014 h/38_INSTALLATI 1.1)
-(src/LYLocal.h 2561 856833014 c/37_LYLocal.h 1.1)
-(utils/inews/nntp.h 2530 856833014 c/1_nntp.h 1.1)
 (WWW/Library/Implementation/HTVMS_WaisUI.c 60814 856833014 f/27_HTVMS_Wais 1.1)
+(utils/inews/nntp.h 2530 856833014 c/1_nntp.h 1.1)
+(src/LYLocal.h 2561 856833014 c/37_LYLocal.h 1.1)
 (src/chrtrans/iso07_uni.tbl 1791 856925688 i/13_iso07_uni. 1.2)
-(src/LYOptions.c 36155 859167360 d/41_LYOptions. 1.1.1.2)
-(utils/lpansi/README 3202 856833014 b/48_README 1.1)
-(WWW/Library/rs6000/Makefile 610 856833014 f/15_Makefile 1.1)
-(src/LYNews.c 9613 860064663 d/42_LYNews.c 1.3)
+(src/LYOptions.c 36303 864519259 d/41_LYOptions. 1.1.2.4)
+(WWW/Library/Implementation/HTNews.c 62151 864519259 h/25_HTNews.c 1.1.1.4)
 (WWW/Library/Implementation/HTVMS_WaisUI.h 21281 856833014 f/26_HTVMS_Wais 1.1)
-(WWW/Library/Implementation/HTNews.c 61601 860064663 h/25_HTNews.c 1.2)
-(WWW/BUILD 1376 856833014 e/45_BUILD 1.1)
+(src/LYNews.c 9613 860064663 d/42_LYNews.c 1.3)
+(WWW/Library/rs6000/Makefile 610 856833014 f/15_Makefile 1.1)
+(utils/lpansi/README 3202 856833014 b/48_README 1.1)
 (WWW/Library/Implementation/BSDI_Makefile 13904 859167360 f/31_BSDI_Makef 1.2)
-(WWW/Library/Implementation/HTACL.c 6107 856833014 g/41_HTACL.c 1.1)
+(WWW/BUILD 1376 856833014 e/45_BUILD 1.1)
 (CRAWL.announce 5978 856833014 h/42_CRAWL.anno 1.1)
+(WWW/Library/Implementation/HTACL.c 6107 856833014 g/41_HTACL.c 1.1)
 (src/LYOptions.h 908 860064663 d/17_LYOptions. 1.2)
-(src/LYNews.h 212 856833014 c/42_LYNews.h 1.1)
 (WWW/Library/Implementation/HTNews.h 1150 856833014 g/9_HTNews.h 1.1)
-(CHANGES.chartrans 4727 860520828 c/0_CHANGES.chartrans 1.9.1.5)
-(WWW/Library/Implementation/HTACL.h 3535 856833014 f/48_HTACL.h 1.1)
+(src/LYNews.h 212 856833014 c/42_LYNews.h 1.1)
+(CHANGES.chartrans 7531 863772691 c/0_CHANGES.chartrans 1.9.1.4.1.1.1.1.1.2)
 (src/UCdomap.c 41762 860516309 i/20_UCdomap.c 1.4)
+(WWW/Library/Implementation/HTACL.h 3535 856833014 f/48_HTACL.h 1.1)
 (IBMPC-charsets.announce 7674 856833014 h/39_IBMPC-char 1.1)
 (WWW/Library/Implementation/HTFinger.c 11475 856833014 f/24_HTFinger.c 1.1)
 (src/chrtrans/iso08_uni.tbl 1048 856856948 i/12_iso08_uni. 1.1)
+(src/makefile.in 2755 864148507 17_makefile.i 1.5)
 (src/UCdomap.h 1414 858077955 e/0_UCdomap.h 1.2)
-(src/makefile.in 2726 860520828 17_makefile.i 1.3)
-(WWW/Library/Implementation/HTAABrow.c 30644 856833014 g/45_HTAABrow.c 1.1)
 (src/chrtrans/cp437_uni.tbl 10794 860516309 i/9_cp437_uni. 1.2)
+(WWW/Library/Implementation/HTAABrow.c 34557 863810353 g/45_HTAABrow.c 1.3)
 (src/chrtrans/iso02_uni.tbl 2035 860516309 i/17_iso02_uni. 1.3)
-(src/LYBookmark.c 23031 860590375 e/1_LYBookmark 1.1.1.3)
 (WWW/Library/Implementation/HTFinger.h 476 856833014 f/23_HTFinger.h 1.1)
-(src/LYClean.c 3537 857148169 e/0_LYClean.c 1.2)
+(src/LYBookmark.c 23023 864519259 e/1_LYBookmark 1.1.2.1.1.4)
 (lynx_help/keystroke_commands/scrolling_help.html 2366 856833014 e/20_scrolling_ 1.1)
-(WWW/Library/Implementation/HTAABrow.h 5511 856833014 g/0_HTAABrow.h 1.1)
+(src/LYClean.c 3604 864519259 e/0_LYClean.c 1.1.4.1.1.3)
 (WWW/Library/Implementation/HTHistory.c 3973 856833014 g/49_HTHistory. 1.1)
-(WWW/Library/Implementation/getline.c 1882 856833014 f/36_getline.c 1.1)
+(WWW/Library/Implementation/HTAABrow.h 5511 856833014 g/0_HTAABrow.h 1.1)
+(src/chrtrans/def7_uni.tbl 24891 864183229 25_def7_uni.t 1.2)
 (src/LYBookmark.h 534 857148169 c/40_LYBookmark 1.2)
-(src/chrtrans/def7_uni.tbl 24891 860516880 25_def7_uni.t 1.1)
-(src/LYForms.c 27593 861154416 d/49_LYForms.c 1.5)
-(src/LYEditmap.c 5899 856833014 c/23_LYEditmap. 1.1)
+(WWW/Library/Implementation/getline.c 1882 856833014 f/36_getline.c 1.1)
+(newfiles.configure 272 861154810 7_newfiles.c 1.4)
 (WWW/Library/Implementation/HTFWriter.c 7487 856833014 h/10_HTFWriter. 1.1)
-(newfiles.configure 272 861154567 7_newfiles.c 1.4)
-(src/LYClean.h 340 856833014 d/24_LYClean.h 1.1)
+(src/LYEditmap.c 5899 856833014 c/23_LYEditmap. 1.1)
+(src/LYForms.c 29009 864519259 d/49_LYForms.c 1.1.4.1.2.6)
 (WWW/Library/Implementation/HTGopher.c 53261 860064663 g/48_HTGopher.c 1.3)
-(src/multinet.opt 39 856833014 d/10_multinet.o 1.1)
-(lynx_help/keystroke_commands/history_help.html 1801 856833014 e/25_history_he 1.1)
-(WWW/Library/Implementation/HTHistory.h 2830 856833014 g/10_HTHistory. 1.1)
+(src/LYClean.h 340 856833014 d/24_LYClean.h 1.1)
 (WWW/Library/Implementation/HTGroup.c 18502 856833014 g/42_HTGroup.c 1.1)
+(WWW/Library/Implementation/HTHistory.h 2830 856833014 g/10_HTHistory. 1.1)
+(lynx_help/keystroke_commands/history_help.html 1801 856833014 e/25_history_he 1.1)
+(src/multinet.opt 39 856833014 d/10_multinet.o 1.1)
 (utils/lpansi/Makefile 447 856833014 b/46_Makefile 1.1)
-(WWW/Library/solaris2/Makefile 655 856833014 f/6_Makefile 1.1)
-(src/LYMail.c 29276 861154416 d/45_LYMail.c 1.1.1.5)
-(src/LYexit.c 3587 860064663 d/4_LYexit.c 1.1.1.2)
+(README.chartrans 8305 863760678 d/0_README.chartrans 1.6)
+(WWW/Library/Implementation/tcp.h 16708 863772691 h/19_tcp.h 1.7)
 (WWW/Library/Implementation/HTFWriter.h 998 856833014 g/23_HTFWriter. 1.1)
-(WWW/Library/Implementation/tcp.h 16331 858971640 h/19_tcp.h 1.5)
-(README.chartrans 7938 858212819 d/0_README.chartrans 1.4)
-(WWW/Library/duns/Makefile 15116 856833014 f/17_Makefile 1.1)
-(samples/lynx.cfg 66857 861154415 e/12_lynx.cfg 1.2.1.4)
+(src/LYexit.c 3587 862343362 d/4_LYexit.c 1.5)
+(src/LYMail.c 30231 861853637 d/45_LYMail.c 1.1.1.1.1.4)
+(WWW/Library/solaris2/Makefile 655 856833014 f/6_Makefile 1.1)
 (WWW/Library/Implementation/HTGopher.h 562 856833014 g/8_HTGopher.h 1.1)
+(samples/lynx.cfg 69181 864148507 e/12_lynx.cfg 1.2.1.2.1.3)
+(WWW/Library/duns/Makefile 15116 856833014 f/17_Makefile 1.1)
diff --git a/CHANGES.chartrans b/CHANGES.chartrans
index c213ec77..4f2b98d3 100644
--- a/CHANGES.chartrans
+++ b/CHANGES.chartrans
@@ -1,5 +1,58 @@
-$Id: CHANGES.chartrans,v 1.1 1997/04/08 17:33:48 tom Exp $
-$ProjectHeader: Lynx 2.7.1ac-0.5 Sat, 12 Apr 1997 20:52:08 -0600 buttles $
+$Id: CHANGES.chartrans,v 1.2 1997/05/16 08:51:31 tom Exp $
+$ProjectHeader: Lynx 2.7.1ac-0.28 Sat, 24 May 1997 18:14:19 -0600 dickey $
+
+1997-05-15
+ Lynx 2.7.1wb+ct-0.26
+* Mods in LYMainLoop.c to not force a cache refresh on a proxy any more
+  when INLINE_TOGGLE, IMAGE_TOGGLE, RAW_TOGGLE are used.  On the other
+  hand, do force a proxy cache refresh after one of the variables relevant
+  for content negotiation `language' or `pref_charset' has been changed
+  from the Options screen, if the current document is from a http, https, or
+  lynxcgi resource.
+* Set HTTP_ACCEPT_CHARSET environment variable for the child process in
+  LYCgi.c if pref_charset is not NULL.
+* Write a META tag with the current display character sets to
+  the files generated for Bookmarks, List, Info, History, and Visited Links
+  pages, so title strings contained in those files will (hopefully) not
+  get erroneously translated again.  Use new function add_META_charset_to_fd()
+  in LUCharUtils for this purpose.
+* makeuctb now sets RawUni to UCT_ENC_8BIT if not otherwise set
+  and if there are char values above 127.
+* Change in HTuncache_current_document() to prevent caching of
+  UCStages info which should be discarded.  Still allow caching for this
+  in the node_anchor for source display, so that a META tag in the parsed
+  HTML can influence the display after using the SOURCE '\' key. - KW
+* Changed display_title() in GridText.c to not rely on sprintf() to get
+  the number of blanks right.  There were problems with C1 characters.
+* Added new lynx.cfg symbols ASSUME_CHARSET, 
+  ASSUME_LOCAL_CHARSET, and ASSUME_UNREC_CHARSET.  They are only
+  recognized if compiled with -DEXP_CHARTRANS.  They correspond to the
+  command line options -assume_charset, -assume_local_charset, and
+  -assume_unrec_charset.
+  The default for ASSUME_CHARSET is iso-8859-1 (corresponding to display
+  character set "ISO Latin 1").  If no ASSUME_LOCAL_CHARSET is set,
+  the explicit or default value for ASSUME_CHARSET will also be used for
+  local files.  ASSUME_UNREC_CHARSET has no default.  See added text
+  in lynx.cfg.
+* Changes in LYCharSets.c to HTMLSetCharacterHandling() and
+  HTMLSetUseDefaultRawMode() to support (hopefully) more consistent
+  and user-friendly handling of raw mode and its default.
+  
+1997-05-03
+ Lynx 2.7.1wb+ct-0.20
+  Now always check for LYlowest_eightbit[current_char_set]
+  near the top of HText_appendCharacter(), to prevent writing C1 control 
+  chars to the terminal if they are not valid as displayabable characters 
+  according to the selected "display character set" Option.
+  All this should be handled earlier in processing, and this check may
+  disappear again for testing, but somebody asked for it...
+  Slightly updated some doc files.
+
+1997-04-12
+ Lynx 2.7.1wb+ct-0.11
+  Added TRACE output to UCAuto.c
+  Changes in LYMail.c and LYPrint.c to send Content-Transfer-Encoding
+  header and/or charset parameter in mail
 
 1997-04-08
  Lynx 2.7.1wb+ct-0.3
diff --git a/CHANGES.configure b/CHANGES.configure
index 7e501966..25c92c2e 100644
--- a/CHANGES.configure
+++ b/CHANGES.configure
@@ -1,3 +1,12 @@
+1997-04-22
+----------
+* refined check for slang libraries/headers by checking if $CFLAGS has been
+  set so that slang.h is in the search path - TD
+* add check to allow use of broken ncurses 1.9.9e's color - TD
+* add check for NGROUPS, TRUE, FALSE macro definitions - TD
+* remove top-level makefile.in targets that can be combined with the generic
+  target (more work required on the remaining ones) - TD.
+
 1997-04-15
 ----------
 * refined logic of SVr4 curses color support to test the no_color_video
diff --git a/CHANGES.new b/CHANGES.new
index bed0e341..59e3d0f6 100644
--- a/CHANGES.new
+++ b/CHANGES.new
@@ -10,8 +10,684 @@ README.configure), and miscellaneous other changes.  Note that the 2.7 ->
 2.7.1 changes (which are listed at the beginning of the current CHANGES
 file) are duplicated here. - KW]
 
+1997-05-24
+* integrate patch JED's mods which support mouse for slang as well as add
+  new functions to encapsulate differences between slang/curses. - TD
+1997-05-20
+* correct 2 occurrences of "me->inFONT == TRUE;" in HTML.c - TD
+* add configure --with-color-style option to merge RP's alpha changes for
+  color styles (this works only with ncurses, since it does not initialize
+  the window background, leaving it null, thereby exploiting a bug in
+  ncurses which sets null backgrounds to a space).  Also some whitespace
+  (and renamed CS to make this build w/o ncurses) - TD
+* test-built with ncurses 1.8.7, 1.9.4, 1.9.9e and 4.0, as well as bsd 4.4
+  curses and slang - TD
+* Tweak of HTFWriter.c so that it does the anti-spoof tests normally
+  done by tempname() (see the 1997-05-19 mods) in all cases for which
+  it changes the temporary file suffix from any of those checked by
+  tempname() itself.  At this point, every way I've thought of for
+  trying to spoof Lynx via links for temporary files is blocked, but
+  people should beat on today's code to see if there's any spoofing
+  strategy I haven't yet blocked. - FM
+* Modified the Lynx Trace Log handling so that it doesn't use actual
+  redirection of stderr via freopen() calls, and restores the original
+  value of stderr during any escape to shell.  This avoids the problem
+  on Unix that sh and ksh send their prompt strings to stderr, and that
+  bash sends both its prompt and command line echo to stderr, so they
+  end up in the log instead of being visible.  I had tested the initial
+  design on VMS and with csh on Unix, and thus didn't notice this
+  foolishness for the other Unix shells.  Anyway, it's OK for all of
+  them now. - FM
+* Tweaked SIGTSTP interrupt handler in the USE_SLANG for-unix code, so
+  that it gets set to SIG_DFL when stop_curses() is called, to prevent
+  strange interferences experienced when ^Z is used while a helper 
+  process is in the foreground. - KW
+* Change in LYForms.c to prevent forced screen refresh after selection
+  from a popup box. - KW
+1997-05-19
+* Recognize linux console F1 key in LYgetch() (applies if -DNO_KEYPAD
+  is in effect, as for all binaries built with slang). - KW
+* Protect LYgetch() against returning raw values of keypad() symbols
+  which are invalid when used later as an index into keymap[],
+  override[], etc. - KW
+* in the USE_SLANG for-unix start_curses(), honor the no_suspend flag
+  if set.  Note that the no_suspend flag cannot be suspected to have
+  the desired effect if lynx is executed from a shell script, unless
+  the shell process forked for the script also ignores the SIGTSTP
+  signal generated (usually) by the ^Z key.  Also if the user is 
+  allowed to execute any helper process (VIEWER, PRINTER, etc.) which
+  does allow suspending while no_suspend is in effect for the Lynx
+  parent process (by overriding the SIG_IGN setting done by Lynx or by 
+  other means), then suspending may still be possible, in addition to
+  strange effects either immediately or when the process or process group
+  is continued (wrong tty and screen state, zombie processes, total
+  hang of the session without any way to interrupt - you get the idea...).
+  Trying to use the suspend restriction in order to prevent users from
+  getting a shell prompt doesn't make much sense anyway when they are
+  allowed access to execute commands which may be interrupted or allow
+  escaping to a shell... - KW
+* Tweak of HTFile.c so that we no longer lose an LYforce_HTML_mode
+  directive if the file is gzipped or compressed and the uncompressed
+  suffix is not mapped to text/html. - FM
+* Modified tempname() in LYUtils.c so that it checks whether files
+  with the current PID and target count already exist, and if so,
+  increments the count until a name for a non-existing file has been
+  created. - FM 
+1997-05-18
+* Mods in LYMainLoop.c and LYClean.c so that Control-G is treated as
+  a synonym for 'n'o in quit confirmation prompts. - FM
+* Mods in LYPrint.c to strip any gzip or compress suffix from the
+  suggested filename, on the assumption that we're deal with a text/html
+  or text/plain file that had a corresponding Content-Encoding and no
+  Content-Disposition: file; filename=name.suffix  header indicating
+  the appropriate filename after uncompression.  This assumption does
+  apply for our current ftp gateway, and for most present-day http
+  servers.  This mod in turn ensures that text/html files which are
+  not being printed as source will have their uncompressed suffixes
+  converted to .txt, indicated that they are rendered. - FM
+1997-05-17
+* Fixed long-standing bug in display_page() of GridText.c.  When it
+  was updating the links structures, it wasn't re-initializing the
+  form element if the links structure is not for a form field. - FM
+1997-05-16
+* Changed the line where a WHEREIS search target should preferably be
+  displayed to the 4th line (not counting the title line).  This can
+  be changed by redefining SEARCH_GOAL_LINE in userdefs.h.
+  SEARCH_GOAL_LINE can also be a simple expression in terms of the
+  variable display_lines, e.g. `#define SEARCH_GOAL_LINE (display_lines/3)',
+  this should then automatically adapt to screen size changes (provided the
+  display system can deal with that...)
+  Note that this this goal line will normally not be used if the next 
+  target, according to the algorithm Lynx uses, is already on the displayed
+  screen.  Also, when the displayed page changes to show a search result,
+  there is no guarantee that it will end up on the line set by 
+  SEARCH_GOAL_LINE.  It should rather be regarded as a maximum.
+  For example the presence of anchors on the line with the target or on
+  the preceding lines will change the positioning. - KW
+* The SEARCH_GOAL_LINE line will also be used for "going to" a link with
+  'g' suffix at the "Follow link ..." prompt, although the algorithm is
+  quite different.  As for a search target, this only applies when Lynx
+  has to position to a different page of the document, and then is only
+  a maximum. - KW
+* Enabled the no-cache setting for the pseudo document Lynx creates for
+  a client-side image map in LYMap.c, for now. - KW
+* Minor typo fix for the proxy authentication mods. - FM
+* Tweak of PRE block handling in HTML.c to ensure an implied paragraph
+  after the block if it is in a list and not followed by an LI. - FM
+* Tweaks of SGML.c and LYCharUtils.c to allow any non-digit to terminate
+  a numeric character reference once at least one digit has been found in
+  the reference. - FM
+* Change in LYUnEscapeToLatinOne() to use isdigit() instead of isalnum()
+  for recognizing numeric character references like LYUnEscapeEntities()
+  does. - KW
+1997-05-15
+* Worked in JED's mods for taking a suspend into account during select()
+  calls. - FM
+* Mods in LYMainLoop.c to not force a cache refresh on a proxy any more
+  when INLINE_TOGGLE, IMAGE_TOGGLE, RAW_TOGGLE are used.  On the other
+  hand, do force a proxy cache refresh after one of the variables relevant
+  for content negotiation `language' or `pref_charset' has been changed
+  from the Options screen, if the current document is from a http, https, or
+  lynxcgi resource. - KW
+* Set HTTP_ACCEPT_CHARSET environment variable for the child process in
+  LYCgi.c if pref_charset is not NULL. - KW
+* (chartrans) Write a META tag with the current display character sets to
+  the files generated for Bookmarks, List, Info, History, and Visited Links
+  pages, so title strings contained in those files will (hopefully) not
+  get erroneously translated again.  Use new function add_META_charset_to_fd()
+  in LUCharUtils for this purpose. - KW
+* (chartrans) makeuctb now sets RawUni to UCT_ENC_8BIT if not otherwise set
+  and if there are char values above 127. - KW
+* (chartrans) Change in HTuncache_current_document() to prevent caching of
+  UCStages info which should be discarded.  Still allow caching for this
+  in the node_anchor for source display, so that a META tag in the parsed
+  HTML can influence the display after using the SOURCE '\' key. - KW
+1997-05-14
+* Don't use title in showlist() if it is empty, to prevent "hidden links"
+  on the List Page itself caused by documents with <TITLE></TITLE>. - KW
+* Changed display_title() in GridText.c to not rely on sprintf() to get
+  the number of blanks right. - KW
+* (chartrans) Added new lynx.cfg symbols ASSUME_CHARSET, 
+  ASSUME_LOCAL_CHARSET, and ASSUME_UNREC_CHARSET.  They are only
+  recognized if compiled with -DEXP_CHARTRANS.  They correspond to the
+  command line options -assume_charset, -assume_local_charset, and
+  -assume_unrec_charset.
+  The default for ASSUME_CHARSET is iso-8859-1 (corresponding to display
+  character set "ISO Latin 1").  If no ASSUME_LOCAL_CHARSET is set,
+  the explicit or default value for ASSUME_CHARSET will also be used for
+  local files.  ASSUME_UNREC_CHARSET has no default.  See added text
+  in lynx.cfg. - KW
+* (chartrans) Changes in LYCharSets.c to HTMLSetCharacterHandling() and
+  HTMLSetUseDefaultRawMode() to support (hopefully) more consistent
+  and user-friendly handling of raw mode and its default.
+  Note that the following description does not apply if the display
+  character set is one of the CJK settings.  In that case, -raw and
+  the corresponding Options setting is used as a CJK toggle as before.
+  Note that the -raw flag is a toggle.  It changes the "raw mode"
+  setting from the default.  The current setting of "raw mode" can be
+  seen on the Options screen, and is also shown in a statusline message
+  when the RAW_TOGGLE key (normally '@') is used.
+  The default depends on the display character set (as previously)
+  but now also on the ASSUME_CHARSET setting (as determined by a setting
+  in lynx.cfg, possibly overridden by -assume_charset on the command 
+  line, or the default iso-8859-1).  When the display character set
+  corresponds to the ASSUME_CHARSET, the default for "raw mode" is ON,
+  otherwise it is OFF.
+  The effect of "raw mode" on the interpretation of documents which have
+  no explicit charset label (from HTTP headers, a META tag, or otherwise)
+  is as follows.  There is an internal "assume charset" which may differ
+  from the user-specified ASSUME_CHARSET value.  When "raw mode" is set 
+  ON, the internal variable is set to correspond to the display character
+  set.  When "raw mode" is set OFF, the internal variable changes to
+  the user-specified ASSUME_CHARSET or, if that also corresponds to the
+  display character set (so that otherwise there would be no change),
+  reverts back to the iso-8859-1 Web default.
+  Raw mode doesn't imply total rawness.  HTML character entities may
+  be expanded and translated with either setting, 8-bit characters which
+  are inappropriate for the display character set will not be sent to
+  the terminal.  For a "more raw" setting, try the "Transparent" pseudo
+  display character set. - KW
+1997-05-13
+* Changed the compilation default in userdefs.h for USE_TRACE_LOG
+  to FALSE, for now. - KW
+* Code for "fixing" of relative http and https URLs which start with a 
+  ../ segment from FM added, but it has to be enabled with the new
+  lynx.cfg symbol STRIP_DOTDOT_URLS (default currently set to FALSE).
+  See FM's description under 1997-04-23. - KW
+* Changed the test for dot segment fixing in LYLegitimizeHREF() so
+  that now (if enabled) it also applies when the http or https base URL
+  in effect does have a non-empty path but without any slashes in it
+  (beyond the initial one between host and path).  The test was too narrow
+  before and did not recognize this case, so that an unmodified URL with
+  ../ in it would still be sent to the server and without generating a
+  statusline message. - KW
+* Tweak of case LYK_REFRESH: in LYMainLoop.c so that the REFRESH command
+  still invokes an obligatory, complete refresh of the screen for slang
+  on Unix with the new LY_SLclear() function (see 1997-05-09 mods),
+  by using scrollok() if USE_SLANG is defined. - FM
+* Changed the local variable name, lines, in follow_link_number() of
+  LYGetFile.c to nlines, to deal with the AIX 4.2 bug of treating lines
+  as a macro.  Also changed the variable name, pages, to npages for
+  logical complementarity (they both refer to the total number). - FM
+* Tweaks of the Lynx Trace Log handling to deal with reloads when the
+  HText structure for the log has been dumped.  Made the first letter
+  of the filename uppercase (Lynx.trace), complementary to Lynx.leaks.
+  Eliminated the log from the Visited Links Page so it can't be sought
+  there as a forward link.  Use the History Page if you want to 'd'ownload
+  the log, or use the 'p'rint option while viewing the log.  Note that
+  suffix maps do tail matching, and thus the so-called suffixes need not
+  begin with a dot.  If you want to use an external viewer for the log,
+  you can put:
+  	SUFFIX:Lynx.trace:application/x-LynxTrace
+  	VIEWER:application/x-LynxTrace:most +s %s
+  in your lynx.cfg, or their equivalents in your mime.types and mailcap
+  files. - FM
+* Tweaks in LYMainLoop.c to set newdoc.title for various special pages
+  generated by Lynx (History Page, Info Page, etc.) and when following
+  a link. - FM
+* Small change to the heuristics for New_DTD in start_element() 
+  in SGML.c (try a bit more to close containing element if it's the
+  same tag) - KW
+1997-05-12
+* Added support for proxy authentication. - AJL & FM
+* Updated follow_help.html to indicate that 0 is the universal
+  F_LINK_NUM mapping for invoking the "Follow link (or ...) number:"
+  prompt. - FM
+1997-05-11
+* Tweaks in LYMainLoop.c to ensure that the LYforce_HTML_mode flag is
+  reset reliably, so it doesn't carry over to requests for text/plain
+  documents, as it was doing under some circumstances in the vanilla
+  code, e.g., when a bookmark file was used as the startfile via a
+  file://localhost/path URL rather than via the -book switch. - FM
+* Very minor change in Lynx_users_guide.html, added two words - KW
+1997-05-10
+* Fixed a typo in statusline() of LYUtils.c.  The check for whether
+  the string is zero length before bothering to convert CJK multi-bytes
+  was checking a holding buffer instead of the string. - FM
+* Fixed a bug in LYHandleMETA() of LYCharUtils.c.  The check for a
+  URL following the SECONDS value in REFRESH directives was not
+  taking into account that an EOL might follow the digits for the
+  SECONDS value. - FM
+* Changed the behavior of boolean_choice() in LYOptions.c so that the
+  cursor is positioned immediately at the option display line instead
+  of staying at the statusline instructions until an initial entry is
+  made, and modified the statusline instructions accordingly. - LE & FM
+* Added a check for a NULL pointer in the LYCookie.c code for blocking
+  sharing of SSL encrypted cookies with http servers, based on a patch
+  from RT, and added a comment on why code for a block based on the
+  scheme is there, despite its being redundant with the current blanket
+  restriction based of the ports. - FM
+* Mapped 0 to F_LINK_NUM (as suggested by KW), so that 0 invokes the 
+  "Follow link (or goto link or page) number:" prompt under all 
+  circumstances (but with the 0 not treated as the first digit of 
+  the number entry).  That's a better way
+  to do it, because then the F_LINK_NUM command and explanation always
+  appears in the "Current Key Map" display, and only the mappings of
+  numbers to functions drop out when going from NUMBERS_AS_ARROWS to
+  LINKS_ARE_NUMBERS mode (as they should, 'cuz the numbers no longer
+  are mapped to functions; though maybe they should stay mapped to
+  functions now that we have an explicit command key for invoking the
+  prompt; something to think about...). - FM
+* Updated the PROBLEMS file to indicate that you should try changing
+  -lresolve to -lbind if you have upgraded to the bind-8.1 or later
+  library on a Sun system and keep getting the message "Alert!:  Unable
+  to connect to remote host". - FM
+1997-05-09
+* Typo fix in follow_help.html. - FM
+* Added an LY_SLclear() function in LYCurses.c as a more efficient
+  substitute for slang of the curses clear(), based on a patch from
+  JED. - FM
+* Added a USE_TRACE_LOG compilation (userdefs.h) symbol and -tlog command
+  line toggle of the compilation default (normally TRUE), for directing
+  syserr messages to a lynx.trace file in the user's home directory when
+  TRACE mode has been turned on (either via the -trace command line switch,
+  or the TOGGLE_TRACE (Control-T) command.  Also added a TRACE_LOG command
+  (normally ';') for viewing the "Lynx Trace Log" (lynx.trace) at any time,
+  if one has been initiated during the current session.  The trace log
+  feature is disabled automatically in anonymous or validation accounts,
+  and should not be used in any account which could have different users
+  simultaneously.  The mods work well to the extent I've exercised them
+  thus far on VMS and for the solaris2 target, but possibly need more
+  refinements, depending on the behavior for other Unix flavors of
+  freopen(), which is used for redirecting stderr to the log.  Updated
+  lynx.man, lynx.hlp, and the online 'h'elp to describe these new
+  features. - FM
+1997-05-08
+* Made the handling of hidden links dependent on a new command line
+  option.  With -hiddenlinks=listonly hidden links are only shown on
+  'l'ist screens and listings generated by -dump or from the 'p'rint
+  menu, but appear separately at the end of those lists.
+  With -hiddenlinks=ignore they don't appear even in listings.
+  With -hiddenlinks=merge hidden links are treated as before,
+  i.e. they show up as bracketed numbers if LINKS_ARE_NUMBERED is on,
+  and are numbered together with other links in the sequence of their
+  occurence in the document.  The default is -hiddenlinks=listonly.
+  Changed the new follow_help.html file accordingly.
+  This may help obviate an apparent need to call something a bug which
+  others regard as a feature... - KW
+* Function HText_AreDifferent() updated as in FM's code, but still 
+  unused. - KW
+1997-05-07
+* Added another argument in follow_link_number() of LYGetFile.c for
+  returning the number entered at the "Follow link (or page) number:"
+  prompt to the mainloop(), and modified the statusline error messages
+  that may be issued from the mainloop() in conjunction the with 'g' or
+  'p' suffixes so that they report that number when appropriate. - FM
+* Changed the prompt to "Follow link (or goto link or page) number:" - KW
+* Tweaked case HTML_DD: in HTML.c so that it checks whether a wrap
+  has just occurred naturally before imposing a newline for DD start
+  tags.  Without that check, seemingly random, extra newlines could
+  occur in the DL/DT/DD blocks. - FM
+* Created a follow_help.html for the keystroke_commands subdirectory
+  of the online 'h'elp, describing the "Follow link (or page) number:"
+  features, and added links to it in Lynx_users_guide.html and
+  keystroke_help.html. - FM
+* Changed the help description according to what is implemented here - KW
+1997-05-06
+* Further tweaked KW's mainloop() tweak (see yesterday's entry), so that
+  newdoc.link is reinitialized properly when we're going to, but not
+  ACTIVATE-ing, a link in the current page due to a 'g' suffix for a
+  "Follow link (or page) number:" entry.  Otherwise, if the number with
+  a 'g' suffix was used to make the last link on the current page the
+  current link, and then a NEXT_LINK command was used, one could end
+  up on a link beyond the first one in the next page.  Also added a
+  statusline message if the 'g' suffix is used with a number which
+  corresponds to a link that already is current. - FM
+* Tweaked yesterday's LYList.c mods so that an OL with the CONTINUE
+  attribute is used when a "Hidden links:" list is appended to a
+  "Visible links:" list and NUMBERS_AS_ARROWS mode is on.  This allows
+  you to see the number to enter at "Follow link (or page) number:"
+  prompts, as when LINKS_ARE_NUMBERED mode is on. - FM
+* Mods in HTML.c for LI and LH handling so that a pointless wrap will not
+  occur at the spacer following the bullet in UL blocks or the Arabic
+  number, Roman numeral, or upper- or lowercase letter in OL blocks if
+  the subsequent text has no spaces, itself, up to the right margin.
+  In such cases, that text now stays on the initial LI or LH line, and
+  wraps at the right margin to the left indentation for a second or
+  greater line in the LI or LH. - FM
+* Changes to avoid memory leaks in LYCookie.c - KW
+* Escape '<' and '>' characters (using the LYEntify functions) in URL
+  strings written to the temporary files for LIST and INFO screens, to
+  avoid invalid HTML and corrupted display as a result of URLs which
+  contain these characters (although they shouldn't) and have not been
+  escaped earlier. - KW
+* Changed the label for the currently selected link from "Filename:"
+  to "URL:", and fixed an alignment glitch for the 9th item on the
+  History and Visited Links pages. - KW
+* Changed an "8-bit" occurring in HtInit.c to "8bit", tweaked LYKeymap.c
+  comments. - KW
+1997-05-05
+* Added HText_AddHiddenLink(), HText_HiddenLinkCount(), and
+  HText_HiddenLinkAt() functions in GridText.c for keeping track of the
+  addresses (URL, plus fragment if present) for links that were converted
+  to hidden by HText_endAnchor() due to their having no visible link name,
+  and modified showlist() and printlist() in LYList.c so that if any hidden
+  links were create during the rendition, the "References in this document:"
+  menu for the 'l'ist command or appendix on dumps segregates and clearly
+  labels the visible versus hidden links. - FM
+* Plugged a memory leak in LYEntify() of LYCharUtils.c. - FM
+* Modified experimental DTD info to not close anchors when an invalid 
+  P, H1-H6, or ADDRESS start tag is encountered, and to change error
+  recovery for P and MAP. - KW
+* Modified experimental DTD info and HTML.c to not close PRE when
+  an invalid FORM start tag is encountered, and to use the appropriate
+  handling for preformatted text if PRE is in effect but is not the top 
+  element on HTML.c's stack.  The HTStyle structure's freeFormat (which 
+  wasn't used anywhere before) is now used as one test whether we are 
+  within preformatted text, also corrected the style setting of freeFormat
+  for PRE in DefaultStyle.c. - KW
+* Changed internal gateways (in HTNews.c, HTFile.c, HTWAIS.c, HTWSRC.c)
+  to end LI, DT, and DD elements if they are not declared SGML_EMPTY,
+  so that HTML.c's stack won't get overloaded in this case. - KW
+* Tweaks in mainloop() handling of DO_GOTOLINK_STUFF and DO_GOTOPAGE_STUFF.
+  Going to a link with the 'g' suffix and then immediately ACTIVATing that
+  link could previously show the wrong page of the new document, since
+  newdoc.line was not being reset. - KW
+1997-05-03
+* (chartrans) Now always check for LYlowest_eightbit[current_char_set]
+  near the top of HText_appendCharacter(), to prevent writing C1 control 
+  chars to the terminal if they are not valid as displayabable characters 
+  according to the selected "display character set" Option.
+  All this should be handled earlier in processing, and this check may
+  disappear again for testing, but somebody asked for it... - KW
+* (chartrans) Small changes to README files. - KW
+* In the section of HTUtils.h for non-autoconf builds, don't set 
+  HAVE_KEYPAD or HAVE_TTYTYPE if USE_SLANG is defined. - KW
+* Modified HText_LinksInLines() to not count hidden form fields. - KW 
+1997-05-02
+* Fixed a bug in LYAddImageMap() of LYMap.c which could cause multiple
+  insertions of the same MAP into the LynxMaps structure, and crashes
+  on some systems due to the consequent multiple FREE()'s at exit. - FM
+1997-05-01
+* More mods in HTML.c, LYCharUtils.c and GridText.c for rational handling
+  of potentially wrapped form fields in PRE blocks.  We now artificially
+  wrap the line if the form field would start within 6 columns from the
+  right margin.  This makes sure that editing windows and the highlighted
+  segments of submit or reset buttons will not ever be ridiculously short,
+  and is homologous to our use of a collapsible space before input fields
+  and buttons when not in PRE blocks to promote a wrap there instead of
+  within the fields or buttons. - FM
+* Expanded the WHEREIS query support so that it also locates the values
+  of form fields within the current document and repositions or pages
+  accordingly, as for normal (Anchor) links and for text strings.  Note
+  that if the hit was for an OPTION value in a retracted SELECT popup,
+  you are positioned on the retracted window, and must pop it up and
+  search again to be positioned on the OPTION value with the hit, unless
+  it already is the selected OPTION.  The mods are hairy enough without
+  trying to do the latter automatically, at least for now. - FM
+1997-04-30
+* Quote the URL for external command (not for VMS or DOS or Windows)
+  to avoid dangerous chars and shell spoofing. - KW
+* Escape characters properly when constructing URLs from filenames
+  in LYConvertToURL.  If a string given for startfile, home page, or
+  a goto command which does not already have the form of an absolute 
+  URL starting with an URL scheme and which does not start with '~' 
+  (but may start with '/') specifies an existing file or directory in 
+  valid Unix-like format for the native filesystem, i.e. without using
+  escaping, it gets URL-escaped, otherwise it is assumed to already
+  be URL-escaped. - KW
+1997-04-29
+* Updated RP Styles 0.2 code, don't allow comma as separator between
+  fg and bg colors after all, fix the LYNX_VERSION string generation
+  in userdefs.h to have `-Styles' appended *within* the quoted string. - KW
+* Added support for a 'p' suffix, like the 'g' suffix for making a link
+  number the current link rather than ACTIVATE-ing it,
+  but for displaying the page indicated by the number preceding the
+  'p' suffix entered at the "follow link (or goto link or page) number:" 
+  prompt.  [...]  If the number
+  entered at the prompt is '1' or less followed by the 'p' suffix, or only
+  'p' is entered, you get the same behavior as for the HOME command.  If
+  the number is equal to or greater than the number of pages, you get the
+  last page displayed as you would if you had used successive PAGE_DOWN
+  commands from the HOME position to reach it.  This differs from the END
+  command, which fills the screen with lines from the end of the document
+  if you are not already displaying the end of the document.  Note that if
+  you enter a number without a suffix (to ACTIVATE the link with that number)
+  or with the 'g' suffix (to make the link with that number the current link)
+  it must correspond to a valid link number or an error statusline message
+  will be issued, in contrast to the 'p' suffix for which an out of range
+  number is treated as a request to display the first or last actual page in
+  the current document. - FM
+* Fixed some typos in lynx.man. - LWV
+* More modifications of the anchor counting code for HTGetLinkInfo() in
+  GridText.c so that it properly skips hidden form fields and anchors
+  without selectable text. - KW
+* More modifications in GridText.c and HTML.c so that it deals rationally
+  with submit or reset button values, and the underscore placeholders for
+  other form fields, when in versus not in PRE blocks.  The entire submit
+  or reset button values are now always displayed, whether or not a portion
+  of it was wrapped, but we still can only highlight the portion before the
+  wrap to indicate a link for submission of the form or for resetting the
+  form field values. - FM
+* Undid some mysterious changes in SIGHUP setting (SIG_IGN vs. SIG_DFL)
+  which had sneaked in in connection with adding the NOSIGHUP
+  conditional. - KW
+* Tweaks to New DTD's extra info for CENTER and H1..H6 - KW
+* New function HText_AreDifferent() from FM added to GridText.c, but
+  not used yet. - KW
+* Tweaks to WB's additions for external command: use strncasecomp, add
+  LYExtern.o to src/makefile.in, changed test for empty command. - KW
+* Changed LYKeymap.h and LYKeymap.c so they agree about the symbols
+  assigned to the new keys (SWITCH_DTD, EXTERN). - KW
+* correct minor syntax err that caused SCO 3.x to fail make-include
+  autoconf test.  also, eliminate whitespace before '#' that causes
+  compile-fail on K&R compilers. - TD
+1997-04-28
+* Updated lynx_url_support.html so as to make clear that the offer to
+  include the currently displayed document with right-angle-bracket
+  prefixing for mailto, newsreply, and snewsreply URLs is made only if
+  the user has defined an external editor via the Options Menu, and that
+  the user is expected to edit this inclusion so that it retains only
+  those passages relevant to the email or followup message which the
+  user will add. - FM
+* Tweak of INPUT handling in HTML.c so that we use nbsp instead of any
+  spaces when loading a submit or reset button's actual value instead
+  of a series of underscores into the HText structure, so that we
+  still promote a wrap, if needed, at the space we ensured would be
+  present before each INPUT. - FM
+* Made first_option a structure member rather than a static variable 
+  in HTML.c - KW
+1997-04-27
+* Tweak of Control-C and Control-G handling for popup_options() in
+  LYForms.c.  They were being sought improperly as command keys rather
+  than as raw keyboard entries.  Note that only Control-G should be
+  used as "cancel" within popup windows on Unix, because Control-C
+  is not being trapped to a handler as on VMS. - LE & FM 
+* Tweak of the anchor counting code for HTGetLinkInfo() in GridText.c
+  so that it takes form fields into account when making a link current
+  based on a "Follow link number" entry with the 'g' suffix.
+  Also added comments to that code. - KW
+1997-04-25
+* Added information in the "Lynx bookmarks" section of the Users Guide
+  about appropriate versus unsupported modifications when editing the
+  bookmark files. - FM
+* RP Styles 0.2 fixed a bit and brought up to current experimental code 
+  level (no autoconfig or simple-curses, only older version of Wayne's 
+  mods, maybe something else is missing, too).  No documentation, no
+  detailed checking, no real cleanup.  Makefile slightly adapted,
+  but still needs changing for new systems - see comments there. - KW
+1997-04-24
+* Tweaks for enhanced mouse support in Win32 and hooks for 386 which
+  doesn't have mouse support yet. - WB
+* External command added.  See LYExtern.* in src and lynx.cfg.
+  You need to define USE_EXTERNALS to compile this in. - WB
+1997-04-23
+* Modified LYCharUtils.c, HTML.c and LYMessages_en.h so that if a
+  partial reference (HREF or SRC value) would be resolved to an http
+  or https URL which has only two dots as the first symbolic element in
+  the path (e.g., http://host/../foo.html), such that the server would
+  reject the request, that element is excluded from the resultant URL,
+  but a statusline message is issued (once per document) about a bad
+  partial reference, as immediate feedback which might lead to the
+  document provider correcting the bad partial reference(s).  We still
+  retain that first symbolic element, in compliance with the IETF RFCs
+  and IDs for resolving URLs, with other URL schemes (e.g., ftp). - FM
+* Added a skip_stack int to the HTML.h struct _HTStructured, to use
+  for flagging that the next call to HTML_start_element or 
+  HTML_end_element is an internal shortcut and should skip pushing
+  or popping the HTML.c paragraph style stack even for elements
+  that are not declared SGML_EMPTY.  Added a SET_SKIP_STACK macro
+  to HTML.c to set the flag, use it. - KW
+* Changes to HTML.c to better deal with a number of elements which may
+  or may not have been declared SGML_EMPTY in HTMLDTD.c:
+  if the last stacked element is HTML_OPTION, treat text as for
+  HTML_SELECT in HTML_put_character and HTML_put_character and 
+  HTML_put_string.  Added handling code for </P> to HTML_end_element
+  (similar but not identical to that for P in HTML_start_element).
+  Added check whether a SELECT is still open to FORM handling in
+  HTML_end_element.  Added check whether a FORM is open to SELECT
+  handling in HTML_end_element.  Added cases for end tags of
+  TABLE-related elements (TR, THEAD, TFOOT, TBODY, COLGROUP, TH, TD)
+  and of DT, DD, LH, LI, FONT, OVERLAY to the switch in
+  HTML_end_element, currently just break from the switch. - KW
+  Some tweaks and corrections to the additional element info and
+  to the content types used with New_DTD, in HTMLDTD.c.  Made
+  OPTION non-empty. - KW
+* Now changed the tags_old[] in HTMLDTD.c, which is used with the
+  switchable "old" SGML parsing, to follow the changes for A, B, 
+  BLINK, CITE, EM, FONT, I, STRONG, and U mentioned in the entry
+  of 1997-04-15.  These, together with FORM and P, are all declared
+  as SGML_EMPTY now when the "old" SGML parsing is in effect, but
+  not with new parsing. - KW
+* Changes to LYMail.c and LYPrint.c to send Content-Transfer-Encoding
+  headers and/or a charset parameter when mailing, based on idea from
+  Hynek Med.  Don't use charset if we only have 7-bit characters
+  anyway.  If compiled with EXP_CHARTRANS, use MIME name corresponding
+  to display character set if it looks valid (not "x-"), otherwise
+  only an explicitly given document charset.  In the chartrans case,
+  don't send charset parameter for CJK since it may be wrong... - KW
+* Added TRACE output to UCAuto.c - HM
+1997-04-22
+* refined check for slang libraries/headers by checking if $CFLAGS has been
+  set so that slang.h is in the search path - TD
+* add check to allow use of broken ncurses 1.9.9e's color - TD
+* add check for NGROUPS, TRUE, FALSE macro definitions - TD
+* remove top-level makefile.in targets that can be combined with the generic
+  target (more work required on the remaining ones) - TD.
+* Plugged memory leak in deleteLinks() of HTAnchor.c. - KW
+* When dumping or outputting a rendered document via the 'p'rint menu,
+  Lynx would use the underscore placeholders for submit/image/reset
+  buttons as for other INPUT fields.  We now load the values of
+  submit/image/reset buttons instead of placeholders into the HText
+  structure, so the values will be seen when dumping or outputting
+  via the 'p'rint menu.  See the comments under case HTML_INPUT: in
+  HTML.c for the still less than optimal things that happen if a
+  wrap occurs within the INPUT value or placeholder strings, as might
+  happen in PRE blocks, or for strings wider than the screen. - LE & FM
+* SGML_abort() did not free memory used by the SGML.c parser stack.
+  Now it does, but still doesn't call HTML_end_element() for the
+  stacked elements (it's an abort after all...) - KW
+1997-04-21
+* Tweaks of the 1997-04-11 and 1997-04-09 mods in HText_endAnchor() of
+  GridText.c so as to take possible wrapping of Anchor content into
+  account when deciding whether or not to implement the Anchor as an
+  ACTIVATE-able link. - FM
+* New SGML.c parser, and new HTMLDTD.c with additional element info.
+  Extra content information for each tag is now included in the
+  HTTag structure, and given in an extended tags_new[] table in
+  HTMLDTD.c.  Modified start_element() and end_element() in SGML.c
+  to perform some heuristic wind-downs of the parsing stack, based
+  on the extra element info. - KW
+* Revert treatment of some tags which were treated as SGML_EMPTY
+  before to their "natural" content model.  No changes made to
+  HTML.c to accomodate this change, so results may differ where
+  HTML.c relies on previous hacks or has now handling code for
+  end tags of elements which were previously SGML_EMPTY. - KW
+* Made SGML parsing switchable between old and new HTMLDTD info
+  and SGML.c code, controlled by a New_DTD global variable and
+  LYK_SWITCH_DTD toggle key.  Use (temporarily?) ^V for the toggle key.
+  This is not yet changable via command line, lynx.cfg, etc., and the 
+  default is New_DTD==YES (so that it gets tested :-) ). - KW
+* Made some of the error messages before exit in LYMainLoop.c and 
+  LYMain.c go to stderr instead of stdout, but only for UNIX and,
+  in the case of the LYMainLoop.c messages, only if
+  dump_output_immediately was in effect. - KW
+1997-04-20
+* Tweaks in LYCharUtils.c to bind META CONTENT to a header value only
+  via an HTTP-EQUIV attribute (i.e., not via a NAME attribute). - FM
+* Mod in HTAccess.c to ignore the anchor's no_cache element if we're
+  seeking a position in the currently loaded document. - FM
+* Commented out the above change in HTAccess.c.  There's a more complete
+  mechanism for it already in this code... - KW
+* Fixed a typo in the bookmark file lead text. - DK
+1997-04-19
+* Changed the inappropriate StrAllocCat() to StrAllocCopy() for
+  loading the XLOADIMAGE_COMMAND in LYReadCFG.c. - PC
+1997-04-18
+* Based on recent discussions in www-html@w3.org, added HY and SHY
+  to the DTD (treated as synonyms; one or the other is most likely
+  to be used in future HTML specs, so for now, we support both), as
+  markup equivalent to the named entity &shy; and numeric character
+  reference &#173; (soft hyphen).  Note that Lynx implements soft
+  hyphens as specified in IETF RFC 2070 (link "HTML i18n" in the
+  Users Guide).  Use of a tag instead of entity is preferable for
+  a soft hyphen because browsers which do not support soft hyphen
+  will ignore it as an "unknown tag" instead of inappropriately
+  inserting a hyphen or displaying the raw entity.  Also added WBR,
+  which is handled like soft hyphen (indicating a permissible wrap
+  point), but does not insert a hyphen at the wrap. - FM
+1997-04-17
+* Mods in HTML.c, HTML.h, and LYMessages_en.h to issue an HTML stack
+  overrun message only once per document, and as a statusline message
+  if not in TRACE mode, and to check in HTML_end_element() for
+  correspondence between the SGML and HTML stacks if an overrun should
+  occur. - FM
+* Corrections in HTML.c for the bounds checks associated with DIV and
+  CENTER nesting levels, and for an HTML stack underrun. - KW
+* Plugged a memory leak under case HTML_IMG: of HTML_start_element() in
+  HTML.c, and removed an inappropriate if(){} in HText_endAnchor() of
+  GridText.c. - FM & KW
+* Modified the lead text created for bookmark files in LYBoomark.c so
+  that it indicates that an editor can be used to delete or reorder
+  the links, but that the format within lines should not be changed,
+  nor other HTML markup added.  Note that the new lead text will be
+  used only when new bookmark files are created via the 'a'dd bookmark
+  link command.  A new bookmark file is not created if the one being
+  sought already exists, so existing ones will still have the old
+  lead text. - FM
+1997-04-16
+* Extensive changes to try to keep track of whether a document (or 
+  a location within it) was reached by an internal (fragment-only)
+  URL reference or not.  The basic idea is to be serious about I-D
+  (currently) draft-fielding-url-syntax-04.txt.  
+  URL references starting with '#' are always to the current
+  document (from which the reference is made). This leads to a
+  lot of hackery in HTML.c, LYMainLoop.c, LYHistory.c, etc. etc...
+  to distinguish a doc that was reached by an "internal" reference
+  from others.  But it seems necessary to keep track of how the
+  reference to a fragment was specified, whether with a non-empty
+  "real" URL (possibly relative) preceding the '#' or without it, 
+  all the way way from the HTML parsing to the mainloop.  Only then
+  can the mainloop decide to not start a new retrieval for an internal
+  reference without skipping a new retrieval if a full URL reference
+  with fragment is made to a location in the same document (which
+  may be non-cachable or the result of a POST)...
+  This code prevents unnecessary/inappropriate POST form resubmissions
+  on following an internal link in a POST response, as they are
+  present for example in WebTechs validation results. - KW
+* A "Goto numbered link" feature.  The user interface could be improved...
+  Start typing the link number, then add 'g' before hitting enter.
+* Some improvements to WHEREIS search.  Will not always position
+  found string on first line (details depend on whether anchors are
+  present, usually will position in top third of screen), and avoid
+  some unnecessary screen updates. - KW
 1997-04-15
-----------
+* Miscellanous additional tweaks in HTML.c for more robust error recovery
+  from bad HTML involving emphasis or style elements (B, BLINK, CITE, EM,
+  FONT, I, STRONG, and U), or HREF-less NAME-ed Anchors without matching
+  end tags. - FM
+* Modified the declarations in HTMLDTD.c and code in SGML.C, HTML.c, and
+  GridText.c to handle A, B, BLINK, CITE, EM, FONT, I, STRONG, and U
+  container elements homologously to the modified handling of FORM (see
+  1997-04-05 mods) so that if they are invalidly interdigitated or have
+  spurious end tags in the markup, substitutions of the "expected" end
+  tags by the SGML.c stack-based parser will not be made, and without
+  messing up the HTML.c stack-based parser.  Appears to work reliably
+  for all of the elements, and to be reasonably crash safe (hopefully
+  as safe as the vanilla v2.7.1), but there are no guarantees. - FM
+* Only *some* (most?) of the changes described in the above two
+  entries are used, as far as they change HTML.c.  Not yet using the
+  changes to HTMLDTD.c and SGML.c. - KW
 * refined logic of SVr4 curses color support to test the no_color_video
   attribute - TD
 * ifdef'd NCURSES_MOUSE_VERSION logic to allow build with ncurses 1.9.4 - TD
@@ -29,15 +705,95 @@ file) are duplicated here. - KW]
 * add config.guess & config.sub to allow specialized host-type checks - TD
 * guard against redefinition of NO_FILIO_H - TD
 * use new autoconf macro CF_SYSTEM_MAIL_FLAGS /jes
-
+1997-04-14
+* Tweaked LYAddImageMap() in LYMap.c so that it removes all pre-existing
+  AREA element entries when updating MAP element content, and set the
+  no_cache anchor element in LYLoadIMGmap() so that the updated MAPs
+  always will be used when rendering. - FM
+* Not using the no_cache change from last entry, until further 
+  investigation. - KW
+* Removed two spurious lines under case LYK_PRINT: in LYMainLoop.c
+  (from an old cut and paste from case LYK_HISTORY: done too late
+  at night 8-). - FM
+1997-04-13
+* Modified the handling of BASE for resolving HREFs in relation to MAP
+  and AREA elements, and USEMAPs in IMG and OBJECT elements.  The
+  formally released code was treating such links equivalently to the
+  handling of fragments for positioning the display to ID-ed elements
+  or NAME-ed Anchors, and assuming they're in the same document if the
+  associated HREF value begins with a '#', rather than resolving versus
+  the BASE, and was always resolving versus the BASE for MAP ID or NAME
+  attributes, and for the AREA HREFs in MAP content.  We now always
+  resolve the MAP ID or NAME attributes versus the current stream's
+  address (since the MAP must be in it or we wouldn't be handling it)
+  [...] According to the
+  original draft and the current HTML 3.2 Proposed Standard,
+  MAPs need not be in the same document as the IMG or OBJECT elements
+  which specify links to the MAPs.  Because MAPs are "deferred objects",
+  they logically should be placed above any IMG or OBJECT elements which
+  reference them in the same document (as is done for SCRIPTs), but this
+  isn't stated in the specs, nor always done in practice.  [...]
+  ([A]uthors who place the MAPs further down in the same document should be
+  informed about "deferred objects" and encouraged to move them up 8-). - FM
+* Use logical extension of the rules for HREF references also for
+  USEMAP references to MAPs: relative URL references are resolved with
+  respect to a BASE element if one is present in the document where they
+  occur, unless they are URL references without a URL, i.e. only a
+  fragment starting with '#'.  In the latter case they are taken as
+  internal references referring to a MAP in the same ocument where
+  the USEMAP occurs, whether the MAP occurs before the USEMAP (as it
+  should, according to previous entry) or after the USEMAP. 
+  HREF's in AREA elements follow the same rules. - KW
+* Fixed bug in HTML_free() for the case when LYMapsOnly is set.  We
+  didn't create an HText structure for the stream (just scanned it for
+  MAPs and processed them into LYMap.c's LynxMaps structure), nor do
+  we want to create a blank one (as was being done) since we didn't
+  render the stream, nor would we have a me->target set.  So we just
+  free any me elements that might still be allocated (though they
+  should have been freed already), and return rather than continuing
+  through the rest of the HTML_free() code. - FM
+1997-04-11
+* Fixed bugs in Gridtext.c and HTML.c which could cause mishandling
+  of anchors in LINKS_ARE_NUMBERS mode if a line wrap occurred in
+  the numbered bracket or the anchor content following the bracket,
+  and failures to suppress the numbered bracket if the anchor content
+  was empty due to ALT="" in an IMG tag, or if Lynx was configured or
+  toggled to suppress the link for the server-side image map if both
+  ISMAP and USEMAP attibutes were present in the IMG tag. - FM
+* Only using the number-removing code under additional conditions:
+  ISMAPs which appear together with USEMAPs and which are suppressed
+  with LYNoISMAPifUSEMAP in LINKS_ARE_NUMBERS mode. - KW
+* Extended the disk_save restriction to the print menu as well as
+  the download menu, and accordingly updated lynx.hlp, lynx.man, and
+  Lynx_users_guide.html. -  NHE & FM
 1997-04-09
 * Many changes to further the Win32 and 386 ports.  An emulation of
   the HTVMS_ calls was used to try and cover all the DOS'izms.
   A specialized ifdef for pdcurses color mapping added.  Some keypad
   tweaks.  More generalized process spawing.  .lynrc is lynx.rc for 386.
   - WB
+* Tweak to ensure that a newline isn't inserted by virtue of a
+  FORM start tag if it's in the first line of a list element and
+  no text precedes it other than a UL's bullet or OL's number
+  on that line. -  FM
+* Added pauses for the "Bad HTML" statusline messages under cases
+  HTML_HTML and HTML_BODY in HTML_end_element(), and eliminated
+  their checks for an unclosed FORM because we no longer expect
+  that to cause a serious problem. - LE & FM
+* Added a NO_ISMAP_IF_USEMAP configuration symbol and -ismap
+  command line toggle for suppressing inclusion of a link for the
+  server-side-image-map if an IMG or OBJECT element has both ISMAP
+  and USEMAP attributes such that a client-side-image-map link is
+  created.  Updated lynx.man, lynx.hlp and Lynx_users_guide.html
+  accordingly. - FM
+* Fixed a glitch in HText_endAnchor() of Gridtext.c which could
+  cause dangling Anchors in LINKS_ARE_NUMBERED mode if the Anchor's
+  content was handled in a manner which caused it to become zero
+  length. - FM
 * Moved handling for NEWS_POSTING in LYReadCFG.c to the right place,
   so that it can actually have an effect. - LWV
+* Typo fixes for the comment concerning NO_ANONYMOUS_EMAIL in
+  userdefs.h - NHE & FM
 1997-04-08
 * New translation table koi8r_uni for KOI8-R charset.  Lynx can now
   translate between iso-8859-5 and KOI8-R, at least for the cyrillic
@@ -83,6 +839,7 @@ file) are duplicated here. - KW]
   submit buttons, have been processed.  Should be reasonably crash
   safe (hopefully as safe as the vanilla v2.7.1), but there are no
   guarantees. - FM
+1997-04-04
 =======================================================================
 ---  Release of Lynx2-7 + BUGFIXES as Lynx v2.7.1 (April 4, 1997)   ---
 -----------------------------------------------------------------------
@@ -140,7 +897,7 @@ file) are duplicated here. - KW]
   the startfile URL always to be added to the goto buffer, even if
   it had POST content such that it could be resent inappropriately
   as a GET request via the goto buffer. - FM
-* Added a bsdi-slang target to the Makefile. - LE
+* Added a bsdi-slang target to the Makefile. - Laura Eaves
 1997-03-26
 * Changed highlighting of strings found by a WHEREIS ('/') search.
   Now uses Christmas tree attribute combination ("all bits are on"),
diff --git a/LYMessages_en.h b/LYMessages_en.h
index 1bcdbf4c..67f40808 100644
--- a/LYMessages_en.h
+++ b/LYMessages_en.h
@@ -248,6 +248,8 @@
 #define SOFT_DOUBLE_QUOTE_OFF "Soft double-quote parsing OFF!"
 #define ALREADY_AT_END "You are already at the end of this document."
 #define ALREADY_AT_BEGIN "You are already at the beginning of this document."
+#define ALREADY_AT_PAGE "You are already at page %d of this document."
+#define LINK_ALREADY_CURRENT "Link number %d already is current."
 #define ALREADY_AT_FIRST "You are already at the first document"
 #define NO_LINKS_ABOVE "There are no links above this line of the document."
 #define NO_LINKS_BELOW "There are no links below this line of the document."
@@ -323,7 +325,7 @@
 #define PRINT_DISABLED "The 'p'rint command is currently disabled."
 #define NO_TOOLBAR "Document has no Toolbar links or Banner."
 #define NOOPEN_TRAV_ERR_FILE "Unable to open traversal errors output file"
-#define FOLLOW_LINK_NUMBER "Follow link number: "
+#define FOLLOW_LINK_NUMBER "Follow link (or goto link or page) number: "
 #define BAD_HTML_USE_TRACE "** Bad HTML!!  Use -trace to diagnose. **"
 #define CANNOT_OPEN_TEMP "Can't open temporary file!"
 #define CANNOT_OPEN_OUTPUT "Can't open output file!  Cancelling!"
@@ -387,6 +389,7 @@
 #define RLOGIN_DISABLED "Rlogin access is disabled!"
 #define FTP_DISABLED "Ftp access is disabled!"
 #define NO_REFS_FROM_DOC "There are no references from this document."
+#define NO_VISIBLE_REFS_FROM_DOC "There are only hidden links from this document."
 #ifdef VMS
 #define CANNOT_OPEN_COMFILE "Unable to open command file."
 #endif /* VMS */
@@ -436,9 +439,9 @@
 #define TO_SAVE_SEGMENT " to save,"
 #define OR_SEGMENT " or "
 #define TO_RETURN_SEGMENT " to return to Lynx."
-#define ACCEPT_DATA "Hit return to accept entered data."
+#define ACCEPT_DATA "Hit RETURN to accept entered data."
 #define ACCEPT_DATA_OR_DEFAULT \
-"Hit return to accept entered data.  Delete data to invoke the default."
+"Hit RETURN to accept entered data.  Delete data to invoke the default."
 #define VALUE_ACCEPTED "Value accepted!"
 #define VALUE_ACCEPTED_WARNING_X \
  "Value accepted! -- WARNING: Lynx is configured for XWINDOWS!"
@@ -460,7 +463,7 @@
 #define R_TO_RETURN_TO_LYNX " 'r' to return to Lynx "
 #define SAVE_OR_R_TO_RETURN_TO_LYNX " '>' to save, or 'r' to return to Lynx "
 #define ANY_KEY_CHANGE_RET_ACCEPT \
- "Hit any key to change value; RETURN to accept: "
+ "Hit any key to change value; RETURN to accept."
 #define ERROR_UNCOMPRESSING_TEMP "Error uncompressing temporary file!"
 #define UNSUPPORTED_URL_SCHEME "Unsupported URL scheme!"
 #define UNSUPPORTED_DATA_URL "Unsupported data: URL!  Use SHOWINFO, for now."
@@ -560,6 +563,13 @@
 #define ALL_COOKIES_EATEN "All of the cookies in the jar have been eaten!"
 #define PORT_NINETEEN_INVALID "Port 19 not permitted in URLs."
 #define PORT_TWENTYFIVE_INVALID "Port 25 not permitted in URLs."
+#define HTML_STACK_OVERRUN "Maximum nesting of HTML elements exceeded."
+#define BAD_PARTIAL_REFERENCE "Bad partial reference! Stripping lead dots."
+#define TRACELOG_OPEN_FAILED "Trace Log open failed.  Trace off!."
+#define LYNX_TRACELOG_TITLE "Lynx Trace Log"
+#define NO_TRACELOG_STARTED "No trace log has been started for this session."
+#define MAX_TEMPCOUNT_REACHED \
+ "The maximum temporary file count has been reached!"
 
 #ifdef DIRED_SUPPORT
 #define DIRED_NOVICELINE \
@@ -567,4 +577,8 @@
 #define CURRENT_LINK_STATUS_FAILED "Failed to obtain status of current link!"
 #endif /* DIRED_SUPPORT */
 
+#ifdef USE_EXTERNALS
+#define EXTERNALS_DISABLED "External support is currently disabled."
+#endif /* USE_EXTERNALS */
+
 #endif /* LYMESSAGES_EN_H */
diff --git a/Lynx.prj b/Lynx.prj
index 34c70df0..b63a3b01 100644
--- a/Lynx.prj
+++ b/Lynx.prj
@@ -1,14 +1,16 @@
 ;; -*- Lisp -*-
 (Created-By-Prcs-Version 1 2 0)
 (Project-Description "PRCS Project for The Lynx browser")
-(Project-Version Lynx 2.7.1ac-0 6)
-(Parent-Version Lynx 2.7.1ac-0 5)
+(Project-Version Lynx 2.7.1ac-0 28)
+(Parent-Version Lynx 2.7.1ac-0 27)
 
-(Version-Log "fixes for ncurses+slang autoconfigure when $LIBS is defined, making library
-search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
+(Version-Log "integrated JED's patch for mouse support in slang.  He also included some
+new functions for encapsulating curses vs slang.  I also fixed most of the
+new compiler warnings (mostly from RP's code), and tested on Linux with
+the ncurses, slang and color-style configurations.
 ")
 (New-Version-Log "")
-(Checkin-Time "Tue, 15 Apr 1997 19:40:10 -0600")
+(Checkin-Time "Sat, 24 May 1997 18:14:19 -0600")
 (Checkin-Login dickey)
 (Populate-Ignore ("\\.o$" "\\.a$" "~$" "^a.out$" "^core$"
                   "\\.dvi$" "\\.aux$" "^\\..*_aux$" "\\.log"
@@ -41,7 +43,7 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (utils/inews/README (Lynx/c/7_README 1.1 644))
   (utils/inews/Manifest (Lynx/c/8_Manifest 1.1 644))
   (utils/inews/Makefile (Lynx/c/9_Makefile 1.1.1.1 644) :no-keywords)
-  (userdefs.h (Lynx/c/10_userdefs.h 1.1.2.1.1.1.1.5 644))
+  (userdefs.h (Lynx/c/10_userdefs.h 1.1.2.1.1.1.1.1.1.1.2.6 644))
   (test/tabtest.html (Lynx/c/11_tabtest.ht 1.1 644))
   (test/iso8859-1.html (Lynx/c/12_iso8859-1. 1.1 644))
   (test/TestComment.html (Lynx/c/13_TestCommen 1.1 644))
@@ -49,20 +51,20 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (test/README.txt (Lynx/c/15_README.txt 1.1 644))
   (src/LYVMSdef.h (Lynx/c/16_LYVMSdef.h 1.1 644))
   (src/LYCookie.h (Lynx/c/17_LYCookie.h 1.1 644))
-  (src/LYCookie.c (Lynx/c/18_LYCookie.c 1.3 644))
-  (src/LYCharUtils.h (Lynx/c/19_LYCharUtil 1.2 644))
-  (src/LYMap.h (Lynx/c/20_LYMap.h 1.1 644))
-  (src/LYMap.c (Lynx/c/21_LYMap.c 1.2 644))
-  (src/LYCharUtils.c (Lynx/c/22_LYCharUtil 1.2.1.4 644))
+  (src/LYCookie.c (Lynx/c/18_LYCookie.c 1.2.3.3 644))
+  (src/LYCharUtils.h (Lynx/c/19_LYCharUtil 1.1.3.4 644))
+  (src/LYMap.h (Lynx/c/20_LYMap.h 1.2 644))
+  (src/LYMap.c (Lynx/c/21_LYMap.c 1.1.2.1.1.2.1.3 644))
+  (src/LYCharUtils.c (Lynx/c/22_LYCharUtil 1.2.1.1.2.1.2.2.1.2.1.1.1.5 644))
   (src/LYEditmap.c (Lynx/c/23_LYEditmap. 1.1 644))
   (src/LYTraversal.h (Lynx/c/24_LYTraversa 1.1 644))
   (src/LYTraversal.c (Lynx/c/25_LYTraversa 1.1.1.2 644))
-  (src/LYList.h (Lynx/c/26_LYList.h 1.1 644))
+  (src/LYList.h (Lynx/c/26_LYList.h 1.2 644))
   (src/LYCgi.h (Lynx/c/27_LYCgi.h 1.1 644))
-  (src/LYCgi.c (Lynx/c/28_LYCgi.c 1.2 644))
+  (src/LYCgi.c (Lynx/c/28_LYCgi.c 1.1.1.2 644))
   (src/LYJump.h (Lynx/c/29_LYJump.h 1.2 644))
   (src/HTNestedList.h (Lynx/c/30_HTNestedLi 1.1 644))
-  (src/LYLeaks.c (Lynx/c/31_LYLeaks.c 1.1 644))
+  (src/LYLeaks.c (Lynx/c/31_LYLeaks.c 1.2 644))
   (src/LYGCurses.h (Lynx/c/32_LYGCurses. 1.1 644))
   (src/win_tcp.opt (Lynx/c/33_win_tcp.op 1.1 644))
   (src/vaxc.opt (Lynx/c/34_vaxc.opt 1.1 644))
@@ -76,18 +78,18 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (src/LYNews.h (Lynx/c/42_LYNews.h 1.1 644))
   (src/LYMail.h (Lynx/c/43_LYMail.h 1.2 644))
   (src/LYCharSets.h (Lynx/c/44_LYCharSets 1.2 644))
-  (src/LYCharSets.c (Lynx/c/45_LYCharSets 1.3 644))
+  (src/LYCharSets.c (Lynx/c/45_LYCharSets 1.4 644))
   (src/LYDownload.h (Lynx/c/46_LYDownload 1.1 644))
   (src/LYDownload.c (Lynx/c/47_LYDownload 1.3 644))
-  (src/HTML.h (Lynx/c/48_HTML.h 1.2 644))
+  (src/HTML.h (Lynx/c/48_HTML.h 1.1.2.2.2.1.1.2.1.1 644))
   (src/LYUpload.h (Lynx/c/49_LYUpload.h 1.1 644))
   (src/HTSaveToFile.h (Lynx/c/50_HTSaveToFi 1.1 644))
-  (src/DefaultStyle.c (Lynx/c/51_DefaultSty 1.1 644))
+  (src/DefaultStyle.c (Lynx/c/51_DefaultSty 1.1.1.1 644))
   (src/HTFont.h (Lynx/d/0_HTFont.h 1.1 644))
   (src/HTAlert.h (Lynx/d/1_HTAlert.h 1.1 644))
-  (src/HTFWriter.c (Lynx/d/2_HTFWriter. 1.1.2.4 644))
-  (src/LYList.c (Lynx/d/3_LYList.c 1.2 644))
-  (src/LYexit.c (Lynx/d/4_LYexit.c 1.1.1.2 644))
+  (src/HTFWriter.c (Lynx/d/2_HTFWriter. 1.1.3.1.3.3 644))
+  (src/LYList.c (Lynx/d/3_LYList.c 1.1.3.4.1.2 644))
+  (src/LYexit.c (Lynx/d/4_LYexit.c 1.5 644))
   (src/LYrcFile.h (Lynx/d/5_LYrcFile.h 1.1 644))
   (src/tcpwareshr.opt (Lynx/d/6_tcpwareshr 1.1 644))
   (src/LYPrint.h (Lynx/d/7_LYPrint.h 1.1 644))
@@ -101,55 +103,55 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (src/LYrcFile.c (Lynx/d/15_LYrcFile.c 1.3 644))
   (src/LYEdit.h (Lynx/d/16_LYEdit.h 1.1 644))
   (src/LYOptions.h (Lynx/d/17_LYOptions. 1.2 644))
-  (src/LYGetFile.h (Lynx/d/18_LYGetFile. 1.2 644))
+  (src/LYGetFile.h (Lynx/d/18_LYGetFile. 1.1.2.2.1.2 644))
   (src/LYMainLoop.h (Lynx/d/19_LYMainLoop 1.2 644))
   (src/LYStrings.h (Lynx/d/20_LYStrings. 1.1.1.2 644))
-  (src/LYHistory.c (Lynx/d/21_LYHistory. 1.1.1.2 644))
-  (src/LYCurses.h (Lynx/d/22_LYCurses.h 1.4.1.2 644))
+  (src/LYHistory.c (Lynx/d/21_LYHistory. 1.1.2.1.4.3 644))
+  (src/LYCurses.h (Lynx/d/22_LYCurses.h 1.1.4.5 644))
   (src/LYSignal.h (Lynx/d/23_LYSignal.h 1.1 644))
   (src/LYClean.h (Lynx/d/24_LYClean.h 1.1 644))
-  (src/LYGlobalDefs.h (Lynx/d/25_LYGlobalDe 1.1.2.3 644))
-  (src/LYStructs.h (Lynx/d/26_LYStructs. 1.1 644))
-  (src/LYUtils.c (Lynx/d/27_LYUtils.c 1.12 644))
-  (src/LYSearch.h (Lynx/d/28_LYSearch.h 1.1 644))
-  (src/Makefile (Lynx/d/29_Makefile 1.2.2.2 644))
-  (src/LYKeymap.h (Lynx/d/30_LYKeymap.h 1.2 644))
-  (src/LYKeymap.c (Lynx/d/31_LYKeymap.c 1.1 644))
-  (src/HTForms.h (Lynx/d/32_HTForms.h 1.1 644))
-  (src/GridText.h (Lynx/d/33_GridText.h 1.1 644))
+  (src/LYGlobalDefs.h (Lynx/d/25_LYGlobalDe 1.1.3.1.2.1.1.4 644))
+  (src/LYStructs.h (Lynx/d/26_LYStructs. 1.4 644))
+  (src/LYUtils.c (Lynx/d/27_LYUtils.c 1.1.4.1.2.2.1.1.1.5 644))
+  (src/LYSearch.h (Lynx/d/28_LYSearch.h 1.2 644))
+  (src/Makefile (Lynx/d/29_Makefile 1.2.2.4 644))
+  (src/LYKeymap.h (Lynx/d/30_LYKeymap.h 1.1.2.4 644))
+  (src/LYKeymap.c (Lynx/d/31_LYKeymap.c 1.1.2.6.1.1 644))
+  (src/HTForms.h (Lynx/d/32_HTForms.h 1.2 644))
+  (src/GridText.h (Lynx/d/33_GridText.h 1.1.1.1.1.3.1.3.1.1 644))
   (src/LYUtils.h (Lynx/d/34_LYUtils.h 1.1.1.3 644))
   (src/LYUpload.c (Lynx/d/35_LYUpload.c 1.2 644))
-  (src/LYStrings.c (Lynx/d/36_LYStrings. 1.8 644))
-  (src/LYShowInfo.c (Lynx/d/37_LYShowInfo 1.4 644))
-  (src/LYSearch.c (Lynx/d/38_LYSearch.c 1.3 644))
-  (src/LYReadCFG.c (Lynx/d/39_LYReadCFG. 1.1.1.1.1.5 644))
-  (src/LYPrint.c (Lynx/d/40_LYPrint.c 1.5 644))
-  (src/LYOptions.c (Lynx/d/41_LYOptions. 1.1.1.2 644))
+  (src/LYStrings.c (Lynx/d/36_LYStrings. 1.1.3.3.2.3 644))
+  (src/LYShowInfo.c (Lynx/d/37_LYShowInfo 1.1.2.1.2.4 644))
+  (src/LYSearch.c (Lynx/d/38_LYSearch.c 1.2.2.3 644))
+  (src/LYReadCFG.c (Lynx/d/39_LYReadCFG. 1.1.1.1.3.2.2.6 644))
+  (src/LYPrint.c (Lynx/d/40_LYPrint.c 1.1.1.1.1.1.1.3 644))
+  (src/LYOptions.c (Lynx/d/41_LYOptions. 1.1.2.4 644))
   (src/LYNews.c (Lynx/d/42_LYNews.c 1.3 644))
-  (src/LYMainLoop.c (Lynx/d/43_LYMainLoop 1.2.3.6 644))
-  (src/LYMain.c (Lynx/d/44_LYMain.c 1.1.2.1.1.5 644))
-  (src/LYMail.c (Lynx/d/45_LYMail.c 1.1.1.5 644))
+  (src/LYMainLoop.c (Lynx/d/43_LYMainLoop 1.2.4.2.2.1.2.6.1.2.1.1.1.1.1.5 644))
+  (src/LYMain.c (Lynx/d/44_LYMain.c 1.1.2.1.1.1.1.1.1.2.2.1.1.1.1.5 644))
+  (src/LYMail.c (Lynx/d/45_LYMail.c 1.1.1.1.1.4 644))
   (src/LYLocal.c (Lynx/d/46_LYLocal.c 1.5 644))
-  (src/LYJump.c (Lynx/d/47_LYJump.c 1.2 644))
-  (src/LYGetFile.c (Lynx/d/48_LYGetFile. 1.6 644))
-  (src/LYForms.c (Lynx/d/49_LYForms.c 1.5 644))
+  (src/LYJump.c (Lynx/d/47_LYJump.c 1.3 644))
+  (src/LYGetFile.c (Lynx/d/48_LYGetFile. 1.5.2.3.2.4 644))
+  (src/LYForms.c (Lynx/d/49_LYForms.c 1.1.4.1.2.6 644))
   (src/LYEdit.c (Lynx/d/50_LYEdit.c 1.2 644))
-  (src/LYCurses.c (Lynx/d/51_LYCurses.c 1.1.2.6 644))
-  (src/LYClean.c (Lynx/e/0_LYClean.c 1.2 644))
-  (src/LYBookmark.c (Lynx/e/1_LYBookmark 1.1.1.3 644))
-  (src/HTML.c (Lynx/e/2_HTML.c 1.1.2.4 644))
-  (src/HTInit.c (Lynx/e/3_HTInit.c 1.2 644))
+  (src/LYCurses.c (Lynx/d/51_LYCurses.c 1.1.5.1.1.4 644))
+  (src/LYClean.c (Lynx/e/0_LYClean.c 1.1.4.1.1.3 644))
+  (src/LYBookmark.c (Lynx/e/1_LYBookmark 1.1.2.1.1.4 644))
+  (src/HTML.c (Lynx/e/2_HTML.c 1.1.4.1.1.1.1.2.1.4.1.2.1.7 644))
+  (src/HTInit.c (Lynx/e/3_HTInit.c 1.2.1.2 644))
   (src/HTAlert.c (Lynx/e/4_HTAlert.c 1.2 644))
-  (src/GridText.c (Lynx/e/5_GridText.c 1.1.1.3 644))
+  (src/GridText.c (Lynx/e/5_GridText.c 1.1.3.1.1.1.1.1.1.2.2.2.1.2.1.6 644))
   (src/descrip.mms (Lynx/e/6_descrip.mm 1.1 644))
   (samples/jumpsVMS.html (Lynx/e/7_jumpsVMS.h 1.1 644))
   (samples/jumpsUnix.html (Lynx/e/8_jumpsUnix. 1.1 644))
   (samples/mime.types (Lynx/e/9_mime.types 1.1 644))
   (samples/lynx.com (Lynx/e/10_lynx.com 1.1 644))
   (samples/mailcap (Lynx/e/11_mailcap 1.1 644))
-  (samples/lynx.cfg (Lynx/e/12_lynx.cfg 1.2.1.4 644))
-  (lynx_help/lynx_url_support.html (Lynx/e/13_lynx_url_s 1.1 644))
-  (lynx_help/Lynx_users_guide.html (Lynx/e/14_Lynx_users 1.2.1.1 644))
+  (samples/lynx.cfg (Lynx/e/12_lynx.cfg 1.2.1.2.1.3 644))
+  (lynx_help/lynx_url_support.html (Lynx/e/13_lynx_url_s 1.2 644))
+  (lynx_help/Lynx_users_guide.html (Lynx/e/14_Lynx_users 1.9 644))
   (lynx_help/keystroke_commands/cookie_help.html (Lynx/e/15_cookie_hel 1.1 644))
   (lynx_help/keystroke_commands/visited_help.html (Lynx/e/16_visited_he 1.1 644))
   (lynx_help/keystroke_commands/edit_help.html (Lynx/e/17_edit_help. 1.1 644))
@@ -157,17 +159,17 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (lynx_help/keystroke_commands/xterm_help.html (Lynx/e/19_xterm_help 1.1 644))
   (lynx_help/keystroke_commands/scrolling_help.html (Lynx/e/20_scrolling_ 1.1 644))
   (lynx_help/keystroke_commands/print_help.html (Lynx/e/21_print_help 1.1 644))
-  (lynx_help/keystroke_commands/other_help.html (Lynx/e/22_other_help 1.1 644))
+  (lynx_help/keystroke_commands/other_help.html (Lynx/e/22_other_help 1.2 644))
   (lynx_help/keystroke_commands/option_help.html (Lynx/e/23_option_hel 1.2 644))
   (lynx_help/keystroke_commands/movement_help.html (Lynx/e/24_movement_h 1.1 644))
   (lynx_help/keystroke_commands/history_help.html (Lynx/e/25_history_he 1.1 644))
   (lynx_help/keystroke_commands/gopher_types_help.html (Lynx/e/26_gopher_typ 1.1 644))
   (lynx_help/keystroke_commands/bookmark_help.html (Lynx/e/27_bookmark_h 1.1 644))
-  (lynx_help/keystroke_commands/keystroke_help.html (Lynx/e/28_keystroke_ 1.1 644))
+  (lynx_help/keystroke_commands/keystroke_help.html (Lynx/e/28_keystroke_ 1.4 644))
   (lynx_help/lynx_help_main.html (Lynx/e/29_lynx_help_ 1.2 644))
-  (lynx.man (Lynx/e/30_lynx.man 1.3 644))
-  (lynx.hlp (Lynx/e/31_lynx.hlp 1.3 644))
-  (lynx.cfg (Lynx/e/32_lynx.cfg 1.2.1.5 644))
+  (lynx.man (Lynx/e/30_lynx.man 1.5.2.2 644))
+  (lynx.hlp (Lynx/e/31_lynx.hlp 1.6 644))
+  (lynx.cfg (Lynx/e/32_lynx.cfg 1.2.1.2.1.1.1.4 644))
   (fixed512.com (Lynx/e/33_fixed512.c 1.1 644))
   (docs/RFC-MAILCAP.txt (Lynx/e/34_RFC-MAILCA 1.1 644))
   (docs/README.txt (Lynx/e/35_README.txt 1.1 644))
@@ -246,7 +248,7 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (WWW/Library/Implementation/HTWAIS.h (Lynx/g/4_HTWAIS.h 1.1 644))
   (WWW/Library/Implementation/HTTelnet.h (Lynx/g/5_HTTelnet.h 1.1 644))
   (WWW/Library/Implementation/HText.h (Lynx/g/6_HText.h 1.1 644))
-  (WWW/Library/Implementation/HTUtils.h (Lynx/g/7_HTUtils.h 1.5 644))
+  (WWW/Library/Implementation/HTUtils.h (Lynx/g/7_HTUtils.h 1.6 644))
   (WWW/Library/Implementation/HTGopher.h (Lynx/g/8_HTGopher.h 1.1 644))
   (WWW/Library/Implementation/HTNews.h (Lynx/g/9_HTNews.h 1.1 644))
   (WWW/Library/Implementation/HTHistory.h (Lynx/g/10_HTHistory. 1.1 644))
@@ -258,7 +260,7 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (WWW/Library/Implementation/HTString.h (Lynx/g/16_HTString.h 1.1 644))
   (WWW/Library/Implementation/HTList.h (Lynx/g/17_HTList.h 1.1 644))
   (WWW/Library/Implementation/HTStyle.h (Lynx/g/18_HTStyle.h 1.1 644))
-  (WWW/Library/Implementation/HTAnchor.h (Lynx/g/19_HTAnchor.h 1.2 644))
+  (WWW/Library/Implementation/HTAnchor.h (Lynx/g/19_HTAnchor.h 1.1.2.5 644))
   (WWW/Library/Implementation/HTAtom.h (Lynx/g/20_HTAtom.h 1.1 644))
   (WWW/Library/Implementation/HTStream.h (Lynx/g/21_HTStream.h 1.1 644))
   (WWW/Library/Implementation/HTMLGen.h (Lynx/g/22_HTMLGen.h 1.1 644))
@@ -266,9 +268,9 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (WWW/Library/Implementation/HTWriter.h (Lynx/g/24_HTWriter.h 1.1 644))
   (WWW/Library/Implementation/HTPlain.h (Lynx/g/25_HTPlain.h 1.1 644))
   (WWW/Library/Implementation/HTChunk.h (Lynx/g/26_HTChunk.h 1.1 644))
-  (WWW/Library/Implementation/HTMLDTD.h (Lynx/g/27_HTMLDTD.h 1.2 644))
-  (WWW/Library/Implementation/HTML.h (Lynx/g/28_HTML.h 1.2 644))
-  (WWW/Library/Implementation/SGML.h (Lynx/g/29_SGML.h 1.2 644))
+  (WWW/Library/Implementation/HTMLDTD.h (Lynx/g/27_HTMLDTD.h 1.4 644))
+  (WWW/Library/Implementation/HTML.h (Lynx/g/28_HTML.h 1.1.2.2.1.1.1.1.1.2 644))
+  (WWW/Library/Implementation/SGML.h (Lynx/g/29_SGML.h 1.4 644))
   (WWW/Library/Implementation/HTTCP.h (Lynx/g/30_HTTCP.h 1.3 644))
   (WWW/Library/Implementation/HTFTP.h (Lynx/g/31_HTFTP.h 1.1 644))
   (WWW/Library/Implementation/HTBTree.h (Lynx/g/32_HTBTree.h 1.1 644))
@@ -284,7 +286,7 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (WWW/Library/Implementation/HTGroup.c (Lynx/g/42_HTGroup.c 1.1 644))
   (WWW/Library/Implementation/HTPasswd.c (Lynx/g/43_HTPasswd.c 1.1 644))
   (WWW/Library/Implementation/HTAAFile.c (Lynx/g/44_HTAAFile.c 1.1 644))
-  (WWW/Library/Implementation/HTAABrow.c (Lynx/g/45_HTAABrow.c 1.1 644))
+  (WWW/Library/Implementation/HTAABrow.c (Lynx/g/45_HTAABrow.c 1.3 644))
   (WWW/Library/Implementation/HTAAServ.c (Lynx/g/46_HTAAServ.c 1.1 644))
   (WWW/Library/Implementation/HTAAUtil.c (Lynx/g/47_HTAAUtil.c 1.1 644))
   (WWW/Library/Implementation/HTGopher.c (Lynx/g/48_HTGopher.c 1.3 644))
@@ -297,28 +299,28 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (WWW/Library/Implementation/HTString.c (Lynx/h/3_HTString.c 1.1 644))
   (WWW/Library/Implementation/HTList.c (Lynx/h/4_HTList.c 1.1 644))
   (WWW/Library/Implementation/HTStyle.c (Lynx/h/5_HTStyle.c 1.3 644))
-  (WWW/Library/Implementation/HTAnchor.c (Lynx/h/6_HTAnchor.c 1.1.1.2 644))
+  (WWW/Library/Implementation/HTAnchor.c (Lynx/h/6_HTAnchor.c 1.1.2.5 644))
   (WWW/Library/Implementation/HTAtom.c (Lynx/h/7_HTAtom.c 1.1 644))
   (WWW/Library/Implementation/HTChunk.c (Lynx/h/8_HTChunk.c 1.1 644))
   (WWW/Library/Implementation/HTMLGen.c (Lynx/h/9_HTMLGen.c 1.2 644))
   (WWW/Library/Implementation/HTFWriter.c (Lynx/h/10_HTFWriter. 1.1 644))
   (WWW/Library/Implementation/HTPlain.c (Lynx/h/11_HTPlain.c 1.4 644))
-  (WWW/Library/Implementation/SGML.c (Lynx/h/12_SGML.c 1.1.1.1.1.1.1.1 644))
-  (WWW/Library/Implementation/HTTCP.c (Lynx/h/13_HTTCP.c 1.2.2.3 644))
-  (WWW/Library/Implementation/HTFTP.c (Lynx/h/14_HTFTP.c 1.4 644))
+  (WWW/Library/Implementation/SGML.c (Lynx/h/12_SGML.c 1.1.1.1.1.1.2.8 644))
+  (WWW/Library/Implementation/HTTCP.c (Lynx/h/13_HTTCP.c 1.2.3.3 644))
+  (WWW/Library/Implementation/HTFTP.c (Lynx/h/14_HTFTP.c 1.5 644))
   (WWW/Library/Implementation/HTBTree.c (Lynx/h/15_HTBTree.c 1.1 644))
-  (WWW/Library/Implementation/HTTP.c (Lynx/h/16_HTTP.c 1.2 644))
-  (WWW/Library/Implementation/HTAccess.c (Lynx/h/17_HTAccess.c 1.2 644))
+  (WWW/Library/Implementation/HTTP.c (Lynx/h/16_HTTP.c 1.1.1.1.1.2.1.1 644))
+  (WWW/Library/Implementation/HTAccess.c (Lynx/h/17_HTAccess.c 1.5 644))
   (WWW/Library/Implementation/HTParse.c (Lynx/h/18_HTParse.c 1.3 644))
-  (WWW/Library/Implementation/tcp.h (Lynx/h/19_tcp.h 1.5 644))
-  (WWW/Library/Implementation/HTWSRC.c (Lynx/h/20_HTWSRC.c 1.1 644))
+  (WWW/Library/Implementation/tcp.h (Lynx/h/19_tcp.h 1.7 644))
+  (WWW/Library/Implementation/HTWSRC.c (Lynx/h/20_HTWSRC.c 1.1.1.1 644))
   (WWW/Library/Implementation/HTWriter.c (Lynx/h/21_HTWriter.c 1.1 644))
-  (WWW/Library/Implementation/HTWAIS.c (Lynx/h/22_HTWAIS.c 1.1 644))
+  (WWW/Library/Implementation/HTWAIS.c (Lynx/h/22_HTWAIS.c 1.1.1.1 644))
   (WWW/Library/Implementation/HTVMSUtils.c (Lynx/h/23_HTVMSUtils 1.1 644))
-  (WWW/Library/Implementation/HTTelnet.c (Lynx/h/24_HTTelnet.c 1.3 644))
-  (WWW/Library/Implementation/HTNews.c (Lynx/h/25_HTNews.c 1.2 644))
-  (WWW/Library/Implementation/HTMLDTD.c (Lynx/h/26_HTMLDTD.c 1.4 644))
-  (WWW/Library/Implementation/HTFile.c (Lynx/h/27_HTFile.c 1.1.2.3 644))
+  (WWW/Library/Implementation/HTTelnet.c (Lynx/h/24_HTTelnet.c 1.4 644))
+  (WWW/Library/Implementation/HTNews.c (Lynx/h/25_HTNews.c 1.1.1.4 644))  
+  (WWW/Library/Implementation/HTMLDTD.c (Lynx/h/26_HTMLDTD.c 1.8.1.1 644))
+  (WWW/Library/Implementation/HTFile.c (Lynx/h/27_HTFile.c 1.1.3.3 644))
   (WWW/Library/Implementation/HTAuth.c (Lynx/h/28_HTAuth.c 1.1 644))
   (VMSWAIS.announce (Lynx/h/29_VMSWAIS.an 1.1 644))
   (VMSPrint.com (Lynx/h/30_VMSPrint.c 1.1 644))
@@ -326,9 +328,9 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (SOCKETSHR.announce (Lynx/h/32_SOCKETSHR. 1.1 644))
   (RELEASE_STATEMENT (Lynx/h/33_RELEASE_ST 1.2 644))
   (README (Lynx/h/34_README 1.1 644))
-  (PROBLEMS (Lynx/h/35_PROBLEMS 1.1 644))
-  (Makefile (Lynx/h/36_Makefile 1.1.1.1.1.4 644))
-  (LYMessages_en.h (Lynx/h/37_LYMessages 1.3 644))
+  (PROBLEMS (Lynx/h/35_PROBLEMS 1.2 644))
+  (Makefile (Lynx/h/36_Makefile 1.1.1.1.1.5 644))
+  (LYMessages_en.h (Lynx/h/37_LYMessages 1.4.1.4.1.2.1.3 644))
   (INSTALLATION (Lynx/h/38_INSTALLATI 1.1 644))
   (IBMPC-charsets.announce (Lynx/h/39_IBMPC-char 1.1 644))
   (FM.announce (Lynx/h/40_FM.announc 1.1 644))
@@ -346,21 +348,21 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
 
 
   (newfiles.chartrans (Lynx/b/0_newfiles.chartrans 1.4 644))
-  (CHANGES.chartrans (Lynx/c/0_CHANGES.chartrans 1.9.1.5 644))
-  (README.chartrans (Lynx/d/0_README.chartrans 1.4 644))
+  (CHANGES.chartrans (Lynx/c/0_CHANGES.chartrans 1.9.1.4.1.1.1.1.1.2 644))
+  (README.chartrans (Lynx/d/0_README.chartrans 1.6 644))
   (src/UCdomap.h (Lynx/e/0_UCdomap.h 1.2 644))
   (src/UCAux.c (Lynx/f/0_UCAux.c 1.3 644))
   (src/UCAuto.h (Lynx/g/0_UCAuto.h 1.1 644))
-  (src/UCAuto.c (Lynx/h/0_UCAuto.c 1.1 644))
+  (src/UCAuto.c (Lynx/h/0_UCAuto.c 1.2 644))
   (src/chrtrans/cp1250_uni.tbl (Lynx/h/48_cp1250_uni 1.1 644))
   (src/chrtrans/mnemonic_suni.tbl (Lynx/h/49_mnemonic_s 1.1 644))
   (src/chrtrans/mnem_suni.tbl (Lynx/h/50_mnem_suni. 1.1 644))
   (src/chrtrans/cp1252_uni.tbl (Lynx/h/51_cp1252_uni 1.1 644))
   (src/chrtrans/rfc_suni.tbl (Lynx/i/0_rfc_suni.tbl 1.2 644))
-  (src/chrtrans/makeuctb.c (Lynx/i/1_makeuctb.c 1.7 644))
+  (src/chrtrans/makeuctb.c (Lynx/i/1_makeuctb.c 1.8 644))
   (src/chrtrans/UCkd.h (Lynx/i/2_UCkd.h 1.1 644))
-  (src/chrtrans/Makefile (Lynx/i/3_Makefile 1.6 644))
-  (src/chrtrans/README.tables (Lynx/i/4_README.tab 1.1 644))
+  (src/chrtrans/Makefile (Lynx/i/3_Makefile 1.7 644))
+  (src/chrtrans/README.tables (Lynx/i/4_README.tab 1.3 644))
   (src/chrtrans/README.format (Lynx/i/5_README.for 1.2 644))
   (src/chrtrans/cp852_uni.tbl (Lynx/i/6_cp852_uni. 1.2 644))
   (src/chrtrans/utf8_uni.tbl (Lynx/i/7_utf8_uni.t 1.1 644))
@@ -382,29 +384,29 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
   (WWW/Library/Implementation/UCAux.h (Lynx/i/23_UCAux.h 1.1 644))
 
   (WWW/Library/djgpp/makefile (Lynx/0_makefile 1.4 644))
-  (src/makefile.dos (Lynx/1_makefile.d 1.3 644))
+  (src/makefile.dos (Lynx/1_makefile.d 1.5 644))
   (README.win-386 (Lynx/2_386-WIN.TX 1.2 644))
 ;; Files added by populate at Mon, 03 Mar 1997 04:38:33 -0600:
 
-  (src/chrtrans/MAKEW32.BAT (Lynx/3_MAKEW32.BA 1.2 644))
+  (src/chrtrans/MAKEW32.BAT (Lynx/3_MAKEW32.BA 1.3 644))
   (src/chrtrans/MAKEFILE.W32 (Lynx/4_MAKEFILE.W 1.1 644))
-  (MAKEFILE.W32 (Lynx/5_MAKEFILE.W 1.1 644))
+  (MAKEFILE.W32 (Lynx/5_MAKEFILE.W 1.2 644))
 
 ;; Files added by populate at Mon, 03 Mar 1997 06:05:56 -0600:
 
-  (CHANGES.new (Lynx/6_CHANGES.ne 1.22 644))
+  (CHANGES.new (Lynx/6_CHANGES.ne 1.18.1.4.1.1.2.1.1.2.2.2.1.2.1.1.1.1.1.4.2.4 644))
 
 ;; Files added by populate at Tue, 11 Mar 1997 04:22:39 -0600:
 
   (newfiles.configure (Lynx/7_newfiles.c 1.4 644))
-  (makefile.in (Lynx/8_makefile.i 1.1.1.4 644))
+  (makefile.in (Lynx/8_makefile.i 1.1.1.6 644))
   (install.sh (Lynx/9_install.sh 1.1 755))
-  (configure.in (Lynx/10_configure. 1.5 644))
-  (config.hin (Lynx/11_config.hin 1.5 644))
-  (aclocal.m4 (Lynx/12_aclocal.m4 1.5 644))
-  (configure (Lynx/13_configure 1.5 755))
+  (configure.in (Lynx/10_configure. 1.7 644))
+  (config.hin (Lynx/11_config.hin 1.7 644))
+  (aclocal.m4 (Lynx/12_aclocal.m4 1.9 644))
+  (configure (Lynx/13_configure 1.9 755))
   (README.configure (Lynx/14_README.con 1.3 644))
-  (CHANGES.configure (Lynx/15_CHANGES.co 1.1.1.3 644))
+  (CHANGES.configure (Lynx/15_CHANGES.co 1.1.1.4 644))
 
 ;; Files added by populate at Wed, 09 Apr 1997 06:18:01 -0600:
 
@@ -414,15 +416,27 @@ search redundant.  fixes for pre-1.9.9g ncurses, ultrix and bsdi.
 
 
   (WWW/Library/unix/makefile.in (Lynx/16_makefile.i 1.3 644))
-  (src/makefile.in (Lynx/17_makefile.i 1.3 644))
-  (src/chrtrans/makefile.in (Lynx/18_makefile.i 1.2 644))
+  (src/makefile.in (Lynx/17_makefile.i 1.5 644))
+  (src/chrtrans/makefile.in (Lynx/18_makefile.i 1.3 644))
 
   (src/chrtrans/koi8r_uni.tbl (Lynx/24_koi8r_uni. 1.1 644))
-  (src/chrtrans/def7_uni.tbl (Lynx/25_def7_uni.t 1.1 644))
-;; Files added by populate at Tue, 15 Apr 1997 19:38:35 -0600:
+  (src/chrtrans/def7_uni.tbl (Lynx/25_def7_uni.t 1.2 644))
+;; Files added by populate at Thu, 24 Apr 1997 21:51:47 -0600:
+
+  (src/LYExtern.h (Lynx/38_LYExtern.h 1.1 644))
+  (src/LYExtern.c (Lynx/39_LYExtern.c 1.5 644))
+
 
   (config.sub (Lynx/30_config.sub 1.1 755))
-  (config.guess (Lynx/31_config.gue 1.1 755))
-)
+  (config.guess (Lynx/31_config.gue 1.2 755))
+
+  (lynx_help/keystroke_commands/follow_help.html (Lynx/43_follow_hel 1.1.1.2 644))
+
+  (src/AttrList.h (Lynx/33_AttrList.h 1.3 644))
+  (src/LYHash.h (Lynx/34_LYHash.h 1.3 644))
+  (src/LYHash.c (Lynx/35_LYHash.c 1.2 644))
+  (src/LYStyle.c (Lynx/36_LYStyle.c 1.6 644))
+  (styles/lynx.lss (Lynx/37_lynx.lss 1.1 644))
+  (src/LYStyle.h (Lynx/b/5_LYStyle.h 1.2 644)))
 (Merge-Parents)
 (New-Merge-Parents)
diff --git a/MAKEFILE.W32 b/MAKEFILE.W32
index f3883538..b4e9486a 100644
--- a/MAKEFILE.W32
+++ b/MAKEFILE.W32
@@ -22,10 +22,10 @@ TASM32  = Tasm32
 # Options

 #

 IDE_LFLAGS32 =  -LD:\BC45\LIB

-LLATC32_lynxdexe =  -LCURSES;D:\BC45\LIB -Tpe -ap -c -wdpl -wdup

-RLATC32_lynxdexe =  -w32 -k

+LLATC32_lynxdexe =  -LCURSES;D:\BC45\LIB -wdpl -wdup -Tpe -ap -c

+RLATC32_lynxdexe =  -k -w32

 BLATC32_lynxdexe = 

-CNIEAT_lynxdexe = -I.\;CURSES;SRC;WWW\LIBRARY\IMPLEMENTATION;D:\BC45\INCLUDE;SRC\CHRTRANS -DNO_UNISTD_H;_WINDOWS;NCURSES;FANCY_CURSES;XMOSAIC_HACK;ACCESS_AUTH;NO_UTMP;NO_CUSERID;NO_TTYTYPE;NOSIGHUP;DOSPATH;NOUSERS;EXP_CHARTRANS

+CNIEAT_lynxdexe = -I.\;CURSES;SRC;WWW\LIBRARY\IMPLEMENTATION;D:\BC45\INCLUDE;SRC\CHRTRANS -DNO_UNISTD_H;_WINDOWS;XMOSAIC_HACK;ACCESS_AUTH;NO_UTMP;NO_CUSERID;NO_TTYTYPE;NOSIGHUP;DOSPATH;NOUSERS;EXP_CHARTRANS;NCURSES;FANCY_CURSES;COLOR_CURSES;HAVE_KEYPAD;VC="2.14FM";NCURSES_VERSION

 LNIEAT_lynxdexe = -x

 LEAT_lynxdexe = $(LLATC32_lynxdexe)

 REAT_lynxdexe = $(RLATC32_lynxdexe)

@@ -35,7 +35,7 @@ LLATW16_cursesbpdcursesdlib =
 RLATW16_cursesbpdcursesdlib = 

 BLATW16_cursesbpdcursesdlib = 

 CEAT_cursesbpdcursesdlib = $(CEAT_lynxdexe) $(CLATW16_cursesbpdcursesdlib)

-CNIEAT_cursesbpdcursesdlib = -I.\;CURSES;SRC;WWW\LIBRARY\IMPLEMENTATION;D:\BC45\INCLUDE;SRC\CHRTRANS -DNO_UNISTD_H;_WINDOWS;NCURSES;FANCY_CURSES;XMOSAIC_HACK;ACCESS_AUTH;NO_UTMP;NO_CUSERID;NO_TTYTYPE;NOSIGHUP;DOSPATH;NOUSERS;EXP_CHARTRANS

+CNIEAT_cursesbpdcursesdlib = -I.\;CURSES;SRC;WWW\LIBRARY\IMPLEMENTATION;D:\BC45\INCLUDE;SRC\CHRTRANS -DNO_UNISTD_H;_WINDOWS;XMOSAIC_HACK;ACCESS_AUTH;NO_UTMP;NO_CUSERID;NO_TTYTYPE;NOSIGHUP;DOSPATH;NOUSERS;EXP_CHARTRANS;NCURSES;FANCY_CURSES;COLOR_CURSES;HAVE_KEYPAD;VC="2.14FM";NCURSES_VERSION

 LNIEAT_cursesbpdcursesdlib = -x

 LEAT_cursesbpdcursesdlib = $(LEAT_lynxdexe) $(LLATW16_cursesbpdcursesdlib)

 REAT_cursesbpdcursesdlib = $(REAT_lynxdexe) $(RLATW16_cursesbpdcursesdlib)

@@ -51,6 +51,8 @@ lynx : BccW32.cfg $(Dep_lynx)
   echo MakeNode 

 

 Dep_lynxdexe = \

+   OBJ\htdos.obj\

+   curses\pdcurses.lib\

    OBJ\ucauto.obj\

    OBJ\ucaux.obj\

    OBJ\ucdomap.obj\

@@ -135,13 +137,13 @@ Dep_lynxdexe = \
    OBJ\lystring.obj\

    OBJ\lytraver.obj\

    OBJ\lyupload.obj\

-   OBJ\lyutils.obj\

-   curses\pdcurses.lib

+   OBJ\lyutils.obj

 

 lynx.exe : $(Dep_lynxdexe)

   $(TLINK32) @&&|

  /v $(IDE_LFLAGS32) $(LEAT_lynxdexe) $(LNIEAT_lynxdexe) +

 D:\BC45\LIB\c0x32.obj+

+OBJ\htdos.obj+

 OBJ\ucauto.obj+

 OBJ\ucaux.obj+

 OBJ\ucdomap.obj+

@@ -235,6 +237,11 @@ D:\BC45\LIB\cw32.lib
 

 |

 

+OBJ\htdos.obj :  www\library\implemen\htdos.c

+  $(BCC32) -P- -c @&&|

+ $(CEAT_lynxdexe) $(CNIEAT_lynxdexe) -o$@ www\library\implemen\htdos.c

+|

+

 OBJ\ucauto.obj :  src\ucauto.c

   $(BCC32) -P- -c @&&|

  $(CEAT_lynxdexe) $(CNIEAT_lynxdexe) -o$@ src\ucauto.c

@@ -697,12 +704,12 @@ BccW32.cfg :
 -w-inl

 -w-lin

 -w-lvc

--w-pia

+-wpia

 -w-def

 -w-nod

 -w-pro

 -w-rvl

--w-ccc

+-wccc

 -w-aus

 -w-par

 -w-rch

@@ -710,7 +717,6 @@ BccW32.cfg :
 -w-ill

 -w-ias

 -w-msg

--WC

 -Ot

 -d-

 -K

@@ -721,9 +727,11 @@ BccW32.cfg :
 -wcln

 -wsig

 -wucp

--g200

+-g255

 -H-

 -v-

+-WC

+-wamb

 | $@

 

 

diff --git a/Makefile b/Makefile
index 618eeea2..b2d53a77 100644
--- a/Makefile
+++ b/Makefile
@@ -78,6 +78,14 @@ WWWINC= WWW/Library/Implementation
 #SLANGLIB = -L../../slang/src/$(ARCH)objs#  location of libslang.a
 #SLANGRRLIB = -R../../slang/src/$(ARCH)objs# for solaris
 
+# !!!!!!!!!!! Support for Character Styles !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# Comment out the following lines if you do *not* want to activate
+# Rob Partington's Character Style color support code (which may currently
+# only work with ncurses, not other curses or the slang library).
+# Or modify and experiment...  -kw
+RP_LYDEFS = -I../../../src -DUSE_COLOR_STYLE -DUSEHASH
+RP_DEFS = -DUSE_COLOR_STYLE -DUNPAINT_CACHE -DTEST -DUSEHASH
+
 # !!!!!!!!!!! Lynx Local Directory Listing Formats !!!!!!!!!!!!!!!!!!!!!!!!!!!
 # Lynx supports "ls -l" format for local directory listings on Unix if the
 # LONG_LIST compilation symbol is defined, and includes links to the parent
@@ -269,10 +277,10 @@ DIR_DEFS = $(DIRED_SUPPORT) $(DIRED_ARCHIVE) $(DIRED_TAR) $(DIRED_ZIP) $(DIRED_G
 #SITE_LIBS= # Your libraries here (remove the "#")
 
 # Set SITE_LYDEFS to one or more of the defines for the WWW Library:
-SITE_LYDEFS = $(DIR_LYDEFS) -DEXP_CHARTRANS # Your defines here
+SITE_LYDEFS = $(DIR_LYDEFS) $(RP_LYDEFS) -DEXP_CHARTRANS # Your defines here
 
 # Set SITE_DEFS to one or more of the defines for lynx below:
-SITE_DEFS = $(DIR_DEFS) -DEXP_CHARTRANS # Your defines here
+SITE_DEFS = $(DIR_DEFS) $(RP_DEFS) -DEXP_CHARTRANS -DNSL_FORK -DLYNXCGI_LINKS -DUSE_EXTERNALS # Your defines here
 
 # if you are compiling on a previously unsupported system, modify
 # this generic entry!!
@@ -695,6 +703,41 @@ solaris2:
 		$(RESOLVLIB) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
 		WWWLIB="../WWW/Library/solaris2/libwww.a"
 
+solaris2-ncurses:
+	cd WWW/Library/solaris2; $(MAKE) CC="cc" LYFLAGS="$(SITE_LYDEFS) -g"
+	cd src; $(MAKE) all CC="gcc" MCFLAGS="-g -DFANCY_CURSES \
+		-DNCURSES -DUNIX -DSVR4 -DSOLARIS2 \
+		-DUTMPX_FOR_UTMP -DUSE_DIRENT -DLOCALE -DHAVE_TERMIOS_H \
+		-I../$(WWWINC) $(SITE_DEFS)" \
+		LIBS="-L/usr/ccs/lib -R/usr/ccs/lib -lncurses -lnsl -lsocket \
+		$(RESOLVLIB) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
+		WWWLIB="../WWW/Library/solaris2/libwww.a" \
+		STYLE=LYStyle
+
+solaris2-ncurses-develop:
+	cd WWW/Library/solaris2; $(MAKE) CC="gcc" LYFLAGS="$(SITE_LYDEFS) -g -I../../../src -DUSE_COLOR_STYLE -DUSEHASH"
+	cd src; $(MAKE) all CC="gcc" MCFLAGS="-g -DFANCY_CURSES \
+		-DUNPAINT_CACHE  -DTEST -DUSE_COLOR_STYLE \
+		-DUSEHASH" \
+		-DNCURSES -DUNIX -DSVR4 -DSOLARIS2 \
+		-DUTMPX_FOR_UTMP -DUSE_DIRENT -DLOCALE -DHAVE_TERMIOS_H \
+		-I../$(WWWINC) $(SITE_DEFS)" \
+		LIBS="-L/usr/ccs/lib -R/usr/ccs/lib -lncurses -lnsl -lsocket \
+		$(RESOLVLIB) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
+		WWWLIB="../WWW/Library/solaris2/libwww.a" \
+		STYLE=LYStyle
+
+solaris2-ncurses-NHE:
+	cd WWW/Library/solaris2; $(MAKE) CC="gcc" LYFLAGS="$(SITE_LYDEFS)"
+	cd src; $(MAKE) all CC="gcc" MCFLAGS="-O4 -s -DUSE_COLOR_STYLE -DFANCY_CURSES \
+		-DNCURSES -DUNIX -DSVR4 -DSOLARIS2 -DCURS_PERFORMANCE \
+		-DUTMPX_FOR_UTMP -DUSE_DIRENT -DLOCALE -DHAVE_TERMIOS_H \
+		-I../$(WWWINC) $(SITE_DEFS)" \
+		LIBS="-L/usr/ccs/lib -R/usr/ccs/lib -lncurses -lnsl -lsocket \
+		-lresolv" \
+		WWWLIB="../WWW/Library/solaris2/libwww.a" \
+		STYLE=NCStyle
+
 # Solaris 2 using Sun's unbundled C compiler
 # define RESOLVLIB (above) for the "LIBS" entry if needed
 # Solaris2 doesn't have or need ranlib. (ignore the error message about that :)
@@ -808,6 +851,26 @@ linux-slang:
 		WWWLIB="../WWW/Library/unix/libwww.a" \
 		SLANGLIB="$(SLANGLIB) -lslang -lm" SLANGINC="$(SLANGINC)"
 
+develop:
+	cd WWW/Library/unix; $(MAKE) LYFLAGS="-DLINUX $(SITE_LYDEFS) -I../../../src -DUSE_COLOR_STYLE -DUSEHASH"
+	cd src; $(MAKE) all CC="gcc" \
+		MCFLAGS="-O -DUNPAINT_CACHE -DUNIX -DLINUX -DNCURSES \
+		-DFANCY_CURSES -DNO_KEYPAD -DNO_TTYTYPE -DTEST -DUSE_COLOR_STYLE \
+		-I/usr/include/ncurses -I../$(WWWINC) $(SITE_DEFS) -DUSEHASH" \
+		LIBS="-lncurses $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
+		WWWLIB="../WWW/Library/unix/libwww.a" \
+		STYLE=LYStyle
+
+linux-style:
+	cd WWW/Library/unix; $(MAKE) LYFLAGS="-DLINUX $(SITE_LYDEFS) -I../../../src -DUSEHASH -DUSE_COLOR_STYLE"
+	cd src; $(MAKE) all CC="gcc" \
+		MCFLAGS="-O -DUNPAINT_CACHE -DUNIX -DLINUX -DNCURSES \
+		-DFANCY_CURSES -DNO_KEYPAD -DNO_TTYTYPE -DTEST -DUSE_COLOR_STYLE \
+		-I/usr/include/ncurses -I../$(WWWINC) $(SITE_DEFS) -DUSEHASH" \
+		LIBS="-lncurses $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
+		WWWLIB="../WWW/Library/unix/libwww.a" \
+		STYLE=LYStyle
+
 ##Various AIX environments
 aix:
 	@echo "Run make again and use \"make aix4\" or \"make aix32\""
diff --git a/PROBLEMS b/PROBLEMS
index e1a067ea..628dfc46 100644
--- a/PROBLEMS
+++ b/PROBLEMS
@@ -20,10 +20,12 @@ they will be outlined in this file.
     other than localhost if Lynx has been built without the resolv
     library and needed it, or with it and shouldn't have been.
     Unfortunately, there's no way to check in the Makefile whether
-    -lresolve should be included in the LIBS="" list.  What's necessary
+    -lresolv should be included in the LIBS="" list.  What's necessary
     depends on how that Sun is configured.  To get the build right for
     your SUN 3 or 4 OS, if you didn't have RESOLVLIB defined in the
-    Makefile define it and build Lynx again, or vice versa.
+    Makefile define it and build Lynx again, or vice versa.  Also, if
+    you have upgraded to the bind-8.1 or later library, you should try
+    changing -lresolv to -lbind.
 
     The Sun `shelltool' and `cmdtool' terminals are stupid by default.  
     In order to get bold text to appear differently than inverse video, 
diff --git a/README.chartrans b/README.chartrans
index 1c1e9187..0c0ebd9c 100644
--- a/README.chartrans
+++ b/README.chartrans
@@ -28,9 +28,7 @@ Lynx CHARTRANS
 
  - some minor changes: sometimes invalid characters are displayed in a hex
    notation Uxxxx (helps debugging, but I also regard it as at least not
-   worse than showing the wrong char without warning).  KOI8 -> other cs
-   will just strip high bit from cyrillic chars (gives somewhat readable
-   ASCII, KOI was constructed that way...)
+   worse than showing the wrong char without warning).
 
 Additions/changes to user interface:
 
@@ -42,11 +40,17 @@ Additions/changes to user interface:
                         specify a charset parameter in HTTP headers
    -assume_unknown_charset=...  in case a charset parameter is not recognized 
    -assume_local_charset=... assume this as charset of local file: docs 
+   also available as ASSUME_CHARSET etc. in lynx.cfg
 
  - The "Raw" toggle (from -raw flag, '@' key, or Options screen)
    o  should work as before for CJK charsets,
    o  otherwise toggles the assumption "Default remote charset is same 
       as Display Character Set" on or off.
+      Toggling of the assumed charset is between Display Character Set and
+      the specified ASSUME_CHARSET or, if they are the same, between the
+      specified ASSUME_CHARSET and ISO-8859-1.
+   o  The default for raw mode now depends on the Display Character Set as
+      well as on the specified ASSUME_CHARSET value.
    (Try the "Transparent" Display Character Set for more "rawness".)
 
 Requirements:  same as for Lynx in general :)
@@ -69,9 +73,11 @@ Other usual warnings about alpha software apply...
 HOW TO GET SOURCES:
 
 The location of files mentioned below is currently at
-         <URL: http://www.tezcat.com/~kweide/lynx-chartrans/> or
-(preferred location:)
-         <URL: http://sol.slcc.edu/lynx/klaus/merged/all/>.
+         <URL: http://sol.slcc.edu/lynx/klaus/merged/all/>
+but it is probably easier to get a full package of the development code
+from
+         <URL: http://sol.slcc.edu/lynx/current/>
+(different formats there, check it out.)
 Check both locations to find the newest version.
 
 There are three alternatives:
@@ -81,34 +87,34 @@ There are three alternatives:
    Provided as a full Lynx distribution (for now..) - in zip format.
    This contains the complete Lynx source package.
 
-   Just get lynx-2.7ac-*.zip.
+   Just get lynx-2.7.1ac-*.zip.
 
 (2.)
-   Provided as add-on over the Lynx 2.7 distribution, i.e. all files that
+   Provided as add-on over the Lynx 2.7.1 distribution, i.e. all files that
    are new or have changed - in zip format.
-   (a) Get the official Lynx 2.7 distribution - see list of download sites at
+   (a) Get the official Lynx 2.7.1 distribution - see list of download sites at
            <URL: http://www.crl.com/~subir/lynx/sources.html>.
-   (b) Get add-to-offi-2.7ac-*.zip.
-   (c) Unpack the official 2.7 package, then unzip add-to-offi-2.7ac-*.zip
+   (b) Get add-to-offi-2.7.1ac-*.zip.
+   (c) Unpack the official 2.7.1 package, then unzip add-to-offi-2.7.1ac-*.zip
        over that directory tree.
 
 (3.)
    Provided in two files (for minimal download time) to install over the
-   Lynx 2.7 distribution - needs gunzip, tar, and patch.
-   (a) Get the official Lynx 2.7 distribution - see list of download sites at
+   Lynx 2.7.1 distribution - needs gunzip, tar, and patch.
+   (a) Get the official Lynx 2.7.1 distribution - see list of download sites at
            <URL: http://www.crl.com/~subir/lynx/sources.html>.
-   (b) Get lynx-newfiles-2.7ac-*.tar.gz.
-   (c) Get lynx-patch-2.7ac-*.pch.gz.
-   (d) Unpack the official 2.7 package, then unpack lynx-newfiles-2.7ac-*.tar.gz
-       over that directory tree.
-   (d) Apply patches from lynx-patch-2.7ac-*.pch.
+   (b) Get lynx-newfiles-2.7.1ac-*.tar.gz.
+   (c) Get lynx-patch-2.7.1ac-*.pch.gz.
+   (d) Unpack the official 2.7.1 package, then unpack 
+       lynx-newfiles-2.7.1ac-*.tar.gz over that directory tree.
+   (d) Apply patches from lynx-patch-2.7.1ac-*.pch.
 
 
 HOW TO INSTALL:
 
 (4) before compiling:
 
-    Check top level Makefile and userdefs.h as usual.
+    Check top level makefile or Makefile and userdefs.h as usual.
 
     NOTE that there is a new "#define" in userdefs.h for MAX_CHARSETS
     near the end (in "Section 3.").
@@ -129,7 +135,7 @@ HOW TO INSTALL:
     more info.)
 
     If all goes well, just invoking make from the top-level Lynx dir
-    as usual should do everything automatically.  If not, the Makefiles
+    as usual should do everything automatically.  If not, the makefiles
     may need some tweaking... or:
 
 (6) Some things to look at if compilation fails:
@@ -140,8 +146,8 @@ HOW TO INSTALL:
 
     For recompiling Lynx, `make clean' should not be necessary if only
     files in src/chrtrans have been changed.  On the other hand 
-    `make clean' from the top directory doesn' currently propagate to
-    the src/chrtrans directory, so you have to cd to that directory 
+    may not propagate to the src/chrtrans directory (depending how things
+    are going with auto-config), you may have to cd to that directory 
     and `make clean' there to really clean up there.
 
 (7) To customize (add/change translation tables etc.):
@@ -188,4 +194,4 @@ HOW TO INSTALL:
     contributed translation tables (for stuff that is not available
     at ftp://dkuug.dk or ftp://unicode.org).
 
-KW  1996-03-12
+KW  1996-05-03
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c
index caf1cbd8..3be7d229 100644
--- a/WWW/Library/Implementation/HTAABrow.c
+++ b/WWW/Library/Implementation/HTAABrow.c
@@ -42,6 +42,9 @@
 **			otherwise HTUU_encode() reads uninitialized memory
 **			every now and then (not a real bug but not pretty).
 **			Corrected the formula for uuencode destination size.
+**
+** 28 Apr 1997	AJL	Do Proxy Authorisation.
+**
 ** BUGS:
 **
 **
@@ -61,6 +64,7 @@
 #include "LYLeaks.h"
 
 extern BOOL using_proxy;	/* Are we using an HTTP gateway? */
+extern BOOL auth_proxy;		/* Generate a proxy authorization - AJL */
 
 /*
 **  Local datatype definitions
@@ -124,6 +128,10 @@ PRIVATE char *current_docname	= NULL;	/* The document's name we are        */
                                         /* trying to access.		     */
 PRIVATE char *HTAAForwardAuth	= NULL;	/* Authorization: line to forward    */
                                         /* (used by gateway httpds)	     */
+PRIVATE HTAASetup *proxy_setup	= NULL;	/* Same as above, but for Proxy -AJL */
+PRIVATE char *proxy_hostname	= NULL;
+PRIVATE char *proxy_docname	= NULL;
+PRIVATE int proxy_portnumber	= 80;
 
 
 /*** HTAAForwardAuth for enabling gateway-httpds to forward Authorization ***/
@@ -583,7 +591,7 @@ PRIVATE char *compose_auth_string ARGS2(HTAAScheme,	scheme,
 	      	     setup->server->hostname : "??") + 40;
 	if (!(msg = (char*)calloc(1, sizeof(char) * len)))
 	    outofmem(__FILE__, "compose_auth_string");
-	if (using_proxy && setup->template) {
+	if ((!auth_proxy) && using_proxy && setup->template) {
 	    proxiedHost = HTParse(setup->template, "", PARSE_HOST);
 	    if (proxiedHost && *proxiedHost != '\0') {
 	        theHost = proxiedHost;
@@ -739,6 +747,8 @@ PRIVATE void free_HTAAGlobals NOARGS
     FREE(HTAA_composeAuthResult);
     FREE(current_hostname);
     FREE(current_docname);
+    FREE(proxy_hostname);
+    FREE(proxy_docname);
     FREE(compose_auth_stringResult);
     FREE(secret_key);
 }
@@ -799,79 +809,159 @@ PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
 
     FREE(HTAA_composeAuthResult);	/* From previous call */
 
-    if (TRACE)
-	fprintf(stderr, 
-		"Composing Authorization for %s:%d/%s\n",
-		hostname, portnumber, docname);
+    if (auth_proxy) {
+        /*
+	**  Proxy Authorization required. - AJL
+	*/
 
-    if (current_portnumber != portnumber ||
-	!current_hostname || !current_docname ||
-	!hostname         || !docname         ||
-	0 != strcmp(current_hostname, hostname) ||
-	0 != strcmp(current_docname, docname)) {
+	if (TRACE)
+	    fprintf(stderr, 
+		    "Composing Proxy Authorization for %s:%d/%s\n",
+		    hostname, portnumber, docname);
+
+	if (proxy_portnumber != portnumber ||
+	    !proxy_hostname || !proxy_docname ||
+	    !hostname         || !docname         ||
+	    0 != strcmp(proxy_hostname, hostname) ||
+	    0 != strcmp(proxy_docname, docname)) {
+
+	    retry = NO;
+
+	    proxy_portnumber = portnumber;
+
+	    if (hostname)
+		StrAllocCopy(proxy_hostname, hostname);
+	    else
+		FREE(proxy_hostname);
+
+	    if (docname)
+		StrAllocCopy(proxy_docname, docname);
+	    else
+		FREE(proxy_docname);
+	} else {
+	    retry = YES;
+	}
 
-	retry = NO;
+	if (!proxy_setup || !retry)
+	    proxy_setup = HTAASetup_lookup(hostname, portnumber, docname);
 
-	current_portnumber = portnumber;
-	
-	if (hostname)
-	    StrAllocCopy(current_hostname, hostname);
-	else
-	    FREE(current_hostname);
-
-	if (docname)
-	    StrAllocCopy(current_docname, docname);
-	else
-	    FREE(current_docname);
-    } else {
-        retry = YES;
-    }
-    
-    if (!current_setup || !retry)
-	current_setup = HTAASetup_lookup(hostname, portnumber, docname);
+	if (!proxy_setup)
+	    return NULL;
 
-    if (!current_setup)
-	return NULL;
+    	switch (scheme = HTAA_selectScheme(proxy_setup)) {
+	  case HTAA_BASIC:
+	  case HTAA_PUBKEY:
+	    auth_string = compose_auth_string(scheme, proxy_setup);
+	    break;
+	  case HTAA_KERBEROS_V4:
+	    /* OTHER AUTHENTICATION ROUTINES ARE CALLED HERE */
+	  default:
+	    {
+		char msg[100];
+		sprintf(msg, "%s %s `%s'",
+			"This client doesn't know how to compose proxy authentication",
+			"information for scheme", HTAAScheme_name(scheme));
+		HTAlert(msg);
+		auth_string = NULL;
+	    }
+	} /* switch scheme */
 
+	proxy_setup->retry = NO;
 
-    switch (scheme = HTAA_selectScheme(current_setup)) {
-      case HTAA_BASIC:
-      case HTAA_PUBKEY:
-	auth_string = compose_auth_string(scheme, current_setup);
-	break;
-      case HTAA_KERBEROS_V4:
-	/* OTHER AUTHENTICATION ROUTINES ARE CALLED HERE */
-      default:
-	{
-	    char msg[100];
-	    sprintf(msg, "%s %s `%s'",
-		    "This client doesn't know how to compose authentication",
-		    "information for scheme", HTAAScheme_name(scheme));
-	    HTAlert(msg);
-	    auth_string = NULL;
+	if (!auth_string)
+	    /*
+	    **  Signal a failure. - FM
+	    */
+	    return NULL;  /* Added by marca. */
+	if (*auth_string == '\0') {
+	    /*
+	    **  Signal an abort. - FM
+	    */
+	    StrAllocCopy(HTAA_composeAuthResult, "");
+	    return(HTAA_composeAuthResult);
 	}
-    } /* switch scheme */
+	len = strlen(auth_string) + strlen((char *)HTAAScheme_name(scheme)) + 26;
+	if (!(HTAA_composeAuthResult = (char*)calloc(1, sizeof(char) * len)))
+	    outofmem(__FILE__, "HTAA_composeAuth");
+	strcpy(HTAA_composeAuthResult, "Proxy-Authorization: ");
 
-    current_setup->retry = NO;
+    } else {
+	/*
+	**  Normal WWW authorization.
+	*/
+	if (TRACE)
+	    fprintf(stderr, 
+		    "Composing Authorization for %s:%d/%s\n",
+		    hostname, portnumber, docname);
+
+	if (current_portnumber != portnumber ||
+	    !current_hostname || !current_docname ||
+	    !hostname         || !docname         ||
+	    0 != strcmp(current_hostname, hostname) ||
+	    0 != strcmp(current_docname, docname)) {
+
+	    retry = NO;
+
+	    current_portnumber = portnumber;
+
+	    if (hostname)
+		StrAllocCopy(current_hostname, hostname);
+	    else
+		FREE(current_hostname);
+
+	    if (docname)
+		StrAllocCopy(current_docname, docname);
+	    else
+		FREE(current_docname);
+	} else {
+	    retry = YES;
+	}
 
-    if (!auth_string)
-        /*
-	 *  Signal a failure. - FM
-	 */
-	return NULL;  /* Added by marca. */
-    if (*auth_string == '\0') {
-        /*
-	 *  Signal an abort. - FM
-	 */
-        StrAllocCopy(HTAA_composeAuthResult, "");
-	return(HTAA_composeAuthResult);
+	if (!current_setup || !retry)
+	    current_setup = HTAASetup_lookup(hostname, portnumber, docname);
+
+	if (!current_setup)
+	    return NULL;
+
+	switch (scheme = HTAA_selectScheme(current_setup)) {
+	  case HTAA_BASIC:
+	  case HTAA_PUBKEY:
+	    auth_string = compose_auth_string(scheme, current_setup);
+	    break;
+	  case HTAA_KERBEROS_V4:
+	    /* OTHER AUTHENTICATION ROUTINES ARE CALLED HERE */
+	  default:
+	    {
+		char msg[100];
+		sprintf(msg, "%s %s `%s'",
+			"This client doesn't know how to compose authentication",
+			"information for scheme", HTAAScheme_name(scheme));
+		HTAlert(msg);
+		auth_string = NULL;
+	    }
+	} /* switch scheme */
+
+	current_setup->retry = NO;
+
+	if (!auth_string)
+	    /*
+	    **  Signal a failure. - FM
+	    */
+	    return NULL;  /* Added by marca. */
+	if (*auth_string == '\0') {
+	    /*
+	    **  Signal an abort. - FM
+	    */
+	    StrAllocCopy(HTAA_composeAuthResult, "");
+	    return(HTAA_composeAuthResult);
+	}
+
+	len = strlen(auth_string) + strlen((char *)HTAAScheme_name(scheme)) + 20;
+	if (!(HTAA_composeAuthResult = (char*)calloc(1, sizeof(char) * len)))
+	    outofmem(__FILE__, "HTAA_composeAuth");
+	strcpy(HTAA_composeAuthResult, "Authorization: ");
     }
-    
-    len = strlen(auth_string) + strlen((char *)HTAAScheme_name(scheme)) + 20;
-    if (!(HTAA_composeAuthResult =
-    		(char*)calloc(1, sizeof(char) * len)))
-	outofmem(__FILE__, "HTAA_composeAuth");
-    strcpy(HTAA_composeAuthResult, "Authorization: ");
+
     strcat(HTAA_composeAuthResult, HTAAScheme_name(scheme));
     strcat(HTAA_composeAuthResult, " ");
     strcat(HTAA_composeAuthResult, auth_string);
@@ -943,8 +1033,11 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
 	    char *fieldname = HTNextField(&p);
 	    char *arg1 = HTNextField(&p);
 	    char *args = p;
-	    
-	    if (0==strcasecomp(fieldname, "WWW-Authenticate:")) {
+
+	    if ((auth_proxy &&
+		 0==strcasecomp(fieldname, "Proxy-Authenticate:")) ||
+	        (!auth_proxy &&
+		 0==strcasecomp(fieldname, "WWW-Authenticate:"))) {
 	        if (!(arg1 && *arg1 && args && *args)) {
 		    temp = (char *)calloc(1, strlen(line) +
 		    			     (arg1 ? strlen(arg1) : 0) +
@@ -976,11 +1069,14 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
 		else if (TRACE) {
 		    fprintf(stderr, "Unknown scheme `%s' %s\n",
 			    (arg1 ? arg1 : "(null)"),
-			    "in WWW-Authenticate: field");
+			    (auth_proxy ?
+			     "in Proxy-Authenticate: field" :
+			     "in WWW-Authenticate: field"));
 		}
 	    }
 
-	    else if (0==strcasecomp(fieldname, "WWW-Protection-Template:")) {
+	    else if (!auth_proxy &&
+		     0==strcasecomp(fieldname, "WWW-Protection-Template:")) {
 		if (TRACE)
 		    fprintf(stderr, "Protection template set to `%s'\n", arg1);
 		StrAllocCopy(template, arg1);
@@ -997,37 +1093,104 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
 
 
     /*
-    **  So should we retry with authorization
+    **  So should we retry with authorization?
     */
-    if (num_schemes == 0) {		/* No authentication valid */
+    if (auth_proxy) {
+	if (num_schemes == 0) {
+	    /*
+	    **  No proxy authentication valid
+	    */
+	    proxy_setup = NULL;
+	    return NO;
+	}
+        /*
+	**  Doing it for proxy.  -AJL
+	*/
+	if (proxy_setup && proxy_setup->server) {
+	    /* 
+	    **  We have already tried with proxy authorization.
+	    **  Either we don't have access or username or
+	    **  password was misspelled.
+	    **
+	    **  Update scheme-specific parameters
+	    **  (in case they have expired by chance).
+	    */
+	    HTAASetup_updateSpecifics(proxy_setup, scheme_specifics);
+
+	    if (NO == HTConfirm("Authorization failed.  Retry?")) {
+		proxy_setup = NULL;
+		return NO;
+	    } else {
+	        /*
+		**  Re-ask username+password (if misspelled).
+		*/
+		proxy_setup->retry = YES;
+		return YES;
+	    }
+	} else {
+	    /*
+	    **  proxy_setup == NULL, i.e. we have a
+	    **  first connection to a protected server or
+	    **  the server serves a wider set of documents
+	    **  than we expected so far.
+	    */
+	    HTAAServer *server = HTAAServer_lookup(proxy_hostname,
+						   proxy_portnumber);
+	    if (!server) {
+		server = HTAAServer_new(proxy_hostname,
+					proxy_portnumber);
+	    }
+	    if (!template)	/* Proxy matches everything  -AJL */
+		StrAllocCopy(template, "*");
+	    proxy_setup = HTAASetup_new(server, 
+					  template,
+					  valid_schemes,
+					  scheme_specifics);
+	    FREE(template);
+
+	    HTAlert("Proxy authentication required -- retrying");
+	    return YES;
+	}
+	/* Never reached */
+    }
+    /*
+    **  Normal WWW authorization.
+    */
+    if (num_schemes == 0) {
+	/*
+	**  No authentication valid.
+	*/
 	current_setup = NULL;
 	return NO;
     }
-
     if (current_setup && current_setup->server) {
-	/* So we have already tried with authorization.	*/
-	/* Either we don't have access or username or	*/
-	/* password was misspelled.			*/
-	    
-	/* Update scheme-specific parameters	*/
-	/* (in case they have expired by chance).	*/
+	/*
+	**  So we have already tried with WWW authorization.
+	**  Either we don't have access or username or
+	**  password was misspelled.
+	**
+	**  Update scheme-specific parameters
+	**  (in case they have expired by chance).
+	*/
 	HTAASetup_updateSpecifics(current_setup, scheme_specifics);
 
 	if (NO == HTConfirm("Authorization failed.  Retry?")) {
 	    current_setup = NULL;
 	    return NO;
-	} /* HTConfirm(...) == NO */
-	else { /* re-ask username+password (if misspelled) */
+	} else {
+	    /*
+	    **  Re-ask username+password (if misspelled).
+	    */
 	    current_setup->retry = YES;
 	    return YES;
-	} /* HTConfirm(...) == YES */
-    } /* if current_setup != NULL */
-
-    else { /* current_setup == NULL, i.e. we have a	 */
-	   /* first connection to a protected server or  */
-	   /* the server serves a wider set of documents */
-	   /* than we expected so far.                   */
-
+	}
+    } else {
+        /*
+	**  current_setup == NULL, i.e. we have a
+	**  first connection to a protected server or
+	**  the server serves a wider set of documents
+	**  than we expected so far.
+	*/
 	HTAAServer *server = HTAAServer_lookup(current_hostname,
 					       current_portnumber);
 	if (!server) {
@@ -1044,8 +1207,7 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
 
         HTAlert("Access without authorization denied -- retrying");
 	return YES;
-    } /* else current_setup == NULL */
-
+    }
     /* Never reached */
 }
 
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index 1f00a089..440cb1b1 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -602,6 +602,7 @@ PRIVATE BOOL HTLoadDocument ARGS4(
     char * address_to_load =  (char *)full_address;
     extern char LYforce_no_cache;		       /* from   GridText.c */
     extern char LYoverride_no_cache;		       /* from LYMainLoop.c */
+    extern char * HTLoadedDocumentURL NOPARAMS;		   /* in GridText.c */
     extern BOOL HText_hasNoCacheSet PARAMS((HText *text)); /* in GridText.c */
     extern BOOL reloading;
     extern char *redirecting_url;
@@ -693,6 +694,20 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 	/*
 	**  Already loaded.  Check it it's OK to use it. - FM
 	*/
+#ifdef NOTUSED_FOTEMODS
+	/* not sure whether this is always the right thing to do,
+	 * and anyway, we have a far more complete (and complicated...)
+	 * way to prevent reloading on internal URL references now...
+	 * - kw
+	 */
+	if ((cp = strchr(address_to_load, '#')) != NULL) {
+	    *cp = '\0';
+	    if (!strcmp(address_to_load, HTLoadedDocumentURL()) &&
+	        strncasecomp(address_to_load, "LYNXIMGMAP:", 11))
+	        LYoverride_no_cache = TRUE;
+	    *cp = '#';
+	}
+#endif /* NOTUSED_FOTEMODS */
 	if (LYoverride_no_cache || !HText_hasNoCacheSet(text)) {
             if (TRACE)
 	        fprintf(stderr, "HTAccess: Document already in memory.\n");
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c
index 40032d8a..304e55c6 100644
--- a/WWW/Library/Implementation/HTAnchor.c
+++ b/WWW/Library/Implementation/HTAnchor.c
@@ -13,7 +13,7 @@
 **	(c) Copyright CERN 1991 - See Copyright.html
 */
 
-#define HASH_SIZE 101		/* Arbitrary prime. Memory/speed tradeoff */
+#define HASH_SIZE 8193		/* Arbitrary prime. Memory/speed tradeoff */
 
 #include "HTUtils.h"
 #include "tcp.h"
@@ -37,7 +37,7 @@
 /*
  *	This is the original function.  We'll use it again. - FM
  */ 
-PRIVATE int HASH_FUNCTION ARGS1(
+PUBLIC int HASH_FUNCTION ARGS1(
 	CONST char *,	cp_address)
 {
     int hash;
@@ -490,6 +490,11 @@ PRIVATE void deleteLinks ARGS1(
 	        me->parent != parent) {
 	        HTAnchor_delete(parent);
 	    }
+	    /* The link structure has to be deleted, too!
+	    ** That was missing, but this code probably never
+	    ** got exercised by Lynx.  - kw
+	    */
+	    FREE(target);
         }
 
         /*
@@ -647,6 +652,9 @@ PUBLIC BOOL HTAnchor_delete ARGS1(
     FREE(me->expires);
     FREE(me->last_modified);
     FREE(me->server);
+#ifdef USEHASH
+    FREE(me->style);
+#endif
  
     /*
      *  Remove ourselves from the hash table's list.
@@ -795,12 +803,41 @@ PUBLIC BOOL HTAnchor_isIndex ARGS1(
     return me ? me->isIndex : NO;
 }
 
+/*	Whether Anchor has been designated as an ISMAP link
+**	(normally by presence of an ISMAP attribute on A or IMG) - KW
+*/
+PUBLIC BOOL HTAnchor_isISMAPScript ARGS1(
+	HTAnchor *,	me)
+{
+    return me ? me->parent->isISMAPScript : NO;
+}
+
 PUBLIC BOOL HTAnchor_hasChildren ARGS1(
 	HTParentAnchor *,	me)
 {
     return me ? ! HTList_isEmpty(me->children) : NO;
 }
 
+#if defined(USEHASH)
+/*      Style handling.
+*/
+PUBLIC CONST char * HTAnchor_style ARGS1(
+        HTParentAnchor *,       me)
+{
+        return me ? me->style : NULL;
+}
+
+PUBLIC void HTAnchor_setStyle ARGS2(
+        HTParentAnchor *,       me,
+        CONST char *,           style)
+{
+    if (me) {
+        StrAllocCopy(me->style, style);
+    }
+}
+#endif
+
+
 /*	Title handling.
 */
 PUBLIC CONST char * HTAnchor_title ARGS1(
diff --git a/WWW/Library/Implementation/HTAnchor.h b/WWW/Library/Implementation/HTAnchor.h
index efa2a307..db875cac 100644
--- a/WWW/Library/Implementation/HTAnchor.h
+++ b/WWW/Library/Implementation/HTAnchor.h
@@ -98,6 +98,9 @@ struct _HTParentAnchor {
   char *        title;          /* Title of document */
   char *        owner;          /* Owner of document */
   char *        RevTitle;       /* TITLE in REV="made" or REV="owner" LINK */
+#ifdef USEHASH
+  char *	style;
+#endif
 
   HTList*       methods;        /* Methods available as HTAtoms */
   void *        protocol;       /* Protocol object */
@@ -150,6 +153,15 @@ typedef struct _DocAddress {
     BOOL   safe;
 } DocAddress;
 
+/* "internal" means "within the same document, with certainty".
+   It includes a space so it cannot conflict with any (valid) "TYPE"
+   attributes on A elements. [According to which DTD, anyway??] - kw */
+
+#define LINK_INTERNAL HTAtom_for("internal link")
+
+extern int HASH_FUNCTION PARAMS((
+	CONST char * 	cp_address));
+
 /*      Create new or find old sub-anchor
 **      ---------------------------------
 **
@@ -248,9 +260,21 @@ extern void HTAnchor_setPrompt PARAMS((
 extern BOOL HTAnchor_isIndex PARAMS((
 	HTParentAnchor *	me));
 
+extern BOOL HTAnchor_isISMAPScript PARAMS((
+	HTAnchor *		me));
+
 extern BOOL HTAnchor_hasChildren PARAMS((
 	HTParentAnchor *	me));
 
+#if defined(USEHASH)
+extern CONST char * HTAnchor_style PARAMS((
+	HTParentAnchor *	me));
+
+extern void HTAnchor_setStyle PARAMS((
+	HTParentAnchor *	me,
+	CONST char *		style));
+#endif
+
 /*      Title handling.
 */
 extern CONST char * HTAnchor_title PARAMS((
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index 8be44d44..dfca3a4f 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -1591,6 +1591,7 @@ PRIVATE void parse_ms_windows_dir_entry ARGS2(
  *      Format the name, date, and size from a WINDOWS_NT LIST line into
  *      the EntryInfo structure (assumes Chameleon NEWT format). - FM
  */
+#ifdef NOTDEFINED
 PRIVATE void parse_windows_nt_dir_entry ARGS2(
 	char *,		line,
 	EntryInfo *,	entry_info)
@@ -1708,6 +1709,7 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2(
 			entry_info->size);
     return;
 } /* parse_windows_nt_dir_entry */
+#endif /* NOTDEFINED */
 
 /*
  * parse_cms_dir_entry() --
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 40097a96..1565e629 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -100,6 +100,8 @@ typedef struct _HTSuffix {
 #define PUTS(s) (*target->isa->put_string)(target, s)
 #define START(e) (*target->isa->start_element)(target, e, 0, 0, 0)
 #define END(e) (*target->isa->end_element)(target, e, 0)
+#define MAYBE_END(e) if (HTML_dtd.tags[e].contents != SGML_EMPTY) \
+                        (*target->isa->end_element)(target, e, 0)
 #define FREE_TARGET (*target->isa->_free)(target)
 struct _HTStructured {
 	CONST HTStructuredClass *	isa;
@@ -684,7 +686,6 @@ PUBLIC HTFormat HTFileFormat ARGS2(
     extern char LYforce_HTML_mode;
 
     if (LYforce_HTML_mode) {
-        LYforce_HTML_mode = FALSE;
         return WWW_HTML;
     }
 
@@ -1987,6 +1988,7 @@ forget_multi:
 				PUTS(file_extra);
 				FREE(file_extra);
 			    }
+                            MAYBE_END(HTML_LI);
 #endif /* LONG_LIST */
 
 			    next_element = HTBTree_next(bt, next_element);
diff --git a/WWW/Library/Implementation/HTML.h b/WWW/Library/Implementation/HTML.h
index ed3aefee..6cdcc828 100644
--- a/WWW/Library/Implementation/HTML.h
+++ b/WWW/Library/Implementation/HTML.h
@@ -69,6 +69,7 @@ struct _HTStructured {
     char *			object_codetype;
     char *			object_name;
     HTChunk			option;		/* Grow by 128 */
+    BOOL			first_option;	/* First OPTION in SELECT? */
     char *			LastOptionValue;
     BOOL			LastOptionChecked;
     BOOL			select_disabled;
@@ -111,6 +112,8 @@ struct _HTStructured {
     BOOL			in_word;  /* Have just had a non-white char */
     stack_element 	stack[MAX_NESTING];
     stack_element 	*sp;		/* Style stack pointer */
+    BOOL		stack_overrun;	/* Was MAX_NESTING exceeded? */
+    int			skip_stack; /* flag to skip next style stack operation */
 
     /*
     **  Track if we are in an anchor, paragraph, address, base, etc.
@@ -119,6 +122,7 @@ struct _HTStructured {
     BOOL		inAPPLET;
     BOOL		inAPPLETwithP;
     BOOL		inBadBASE;
+    BOOL		inBadHREF;
     BOOL		inBadHTML;
     BOOL		inBASE;
     BOOL		inBoldA;
@@ -127,6 +131,7 @@ struct _HTStructured {
     BOOL		inCREDIT;
     BOOL		inFIG;
     BOOL		inFIGwithP;
+    BOOL		inFONT;
     BOOL		inFORM;
     BOOL		inLABEL;
     BOOL		inP;
diff --git a/WWW/Library/Implementation/HTMLDTD.c b/WWW/Library/Implementation/HTMLDTD.c
index 2639a461..54f14681 100644
--- a/WWW/Library/Implementation/HTMLDTD.c
+++ b/WWW/Library/Implementation/HTMLDTD.c
@@ -1101,129 +1101,545 @@ static attr ulist_attr[] = {			/* UL attributes */
 	{ 0 }	/* Terminate list */
 };
 
+/* From Peter Flynn's intro to the HTML Pro DTD:
+
+   %structure;
+
+   DIV, CENTER, H1 to H6, P, UL, OL, DL, DIR, MENU, PRE, XMP, LISTING, BLOCKQUOTE, BQ,
+   2    1       2     2   1  8   8   8   8    8     8    8    8        4           4
+   MULTICOL,?NOBR, FORM, TABLE, ADDRESS, FIG, BDO, NOTE, and FN; plus?WBR, LI, and LH
+   8 n      ?1 n   8     8      2        2    2    2         2      ?1 nE  4       4
+
+   %insertions;
+
+   Elements which usually contain special-purpose material, or no text material at all.
+
+   BASEFONT, APPLET, OBJECT, EMBED, SCRIPT, MAP, MARQUEE, HR, ISINDEX, BGSOUND, TAB,?IMG,
+   1 e?      2       2 l     1 e    2 l     8    4        4 E 1? E     1 E      ! E ?1 E
+   IMAGE, BR, plus NOEMBED, SERVER, SPACER, AUDIOSCOPE, and SIDEBAR; ?area
+   1 n    1 E        n        n       n       n               n       8 E
+
+   %text;
+
+   Elements within the %structure; which directly contain running text.
+
+   Descriptive or analytic markup: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, Q, LANG, AU,
+                                   2   2       2    2     2     2    2    2     2  2 n   2
+   AUTHOR, PERSON, ACRONYM, ABBREV, INS, DEL, and SPAN
+   2       2 n     2        2       2    2        2
+   Visual markup:S, STRIKE, I, B, TT, U,?NOBR,?WBR, BR, BIG, SMALL, FONT, STYLE, BLINK, TAB,
+                 1  1       1  1  1   1  ?1 n ?1nE? 1 E  1   1      1     1 l    1      1 E?
+   BLACKFACE, LIMITTEXT, NOSMARTQUOTES, and SHADOW
+   1 n        1 n        1 n                1 n
+   Hypertext and graphics: A and?IMG
+                           8    ?8 E
+   Mathematical: SUB, SUP, and MATH
+                 4    4        4 l
+   Documentary: COMMENT, ENTITY, ELEMENT, and ATTRIB
+                4        4 n     4 n          4 n
+   %formula;
+ */
+
+/*	Extra element info
+**	------------------
+**
+**	Order and number of tags should match the tags_* tables
+**	further below and definitions in HTMLDTD.html.
+**
+**	The interspersed comments give the original Lynx tags[] entries
+**	for orientation, so they do not necessarily reflect what will
+**	be used with the T_* info (which is in tags_new[]).
+**
+**	An important design goal was that info for each tag should fit on
+**	one 80 character screen line :).  The price to pay is that it's
+**	a bit cryptic, to say the least...  - kw
+*/
+/*       1         2         3         4         5         6         7         8 */
+/*345678901234567890123456789012345678901234567890123456789012345678901234567890 */
+
+/*			self	contain	icont'n	contn'd	icont'd	canclos	omit */
+ /* { "A"	, a_attr,	HTML_A_ATTRIBUTES,	SGML_MIXED }, */
+#define T_A		0x0008,	0x0B007,0x0FF17,0x37787,0x77BA7,0x8604F,0x00004
+ /* { "ABBREV"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_ABBREV	0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000
+ /* { "ACRONYM"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_ACRONYM	0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000
+ /* { "ADDRESS"	, address_attr,	HTML_ADDRESS_ATTRIBUTES, SGML_MIXED }, */
+#define T_ADDRESS	0x0200,	0x0F14F,0x8FFFF,0x36680,0xB6FAF,0x80317,0x00000
+ /* { "APPLET"	, applet_attr,	HTML_APPLET_ATTRIBUTES, SGML_MIXED }, */
+#define T_APPLET	0x2000,	0x0B0CF,0x8FFFF,0x37F9F,0xB7FBF,0x8300F,0x00000
+ /* { "AREA"	, area_attr,	HTML_AREA_ATTRIBUTES,   SGML_EMPTY }, */
+#define T_AREA		0x8000,	0x00000,0x00000,0x08000,0x3FFFF,0x00F1F,0x00001
+ /* { "AU"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_AU		0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000
+ /* { "AUTHOR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_AUTHOR	0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000
+ /* { "B"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_B		0x0001, 0x8B04F,0xAFFFF,0xA778F,0xF7FBF,0x00001,0x00004
+ /* { "BANNER"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_BANNER	0x0200,	0x0FB8F,0x0FFFF,0x30000,0x30000,0x8031F,0x00000
+ /* { "BASE"	, base_attr,	HTML_BASE_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_BASE		0x40000,0x00000,0x00000,0x50000,0x50000,0x8000F,0x00001
+ /* { "BASEFONT", font_attr,	HTML_FONT_ATTRIBUTES,	SGML_EMPTY }, */
+#define	T_BASEFONT	0x1000,	0x00000,0x00000,0x377AF,0x37FAF,0x8F000,0x00001
+ /* { "BDO"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define	T_BDO		0x0100,	0x0B04F,0x8FFFF,0x36680,0xB6FAF,0x0033F,0x00000
+ /* { "BGSOUND"	, bgsound_attr,	HTML_BGSOUND_ATTRIBUTES, SGML_EMPTY }, */
+#define T_BGSOUND	0x1000,	0x00000,0x00000,0x777AF,0x77FAF,0x8730F,0x00001
+ /* { "BIG"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_BIG		0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004
+ /* { "BLINK"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_BLINK		0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FAF,0x00001,0x00004
+ /* { "BLOCKQUOTE", bq_attr,	HTML_BQ_ATTRIBUTES,	SGML_MIXED }, */
+#define T_BLOCKQUOTE	0x0200,	0xAFBCF,0xAFFFF,0xB6680,0xB6FAF,0x8031F,0x00000
+ /* { "BODY"	, body_attr,	HTML_BODY_ATTRIBUTES,	SGML_MIXED }, */
+#define	T_BODY		0x20000,0x2FB8F,0x2FFFF,0x30000,0x30000,0xDFFFF,0x00003
+ /* { "BODYTEXT", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED }, */
+#define T_BODYTEXT	0x20000,0x0FB8F,0xAFFFF,0x30200,0xB7FAF,0x8F17F,0x00003
+ /* { "BQ"	, bq_attr,	HTML_BQ_ATTRIBUTES,	SGML_MIXED }, */
+#define T_BQ		0x0200,	0xAFBCF,0xAFFFF,0xB6680,0xB6FAF,0x8031F,0x00000
+ /* { "BR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_BR		0x1000, 0x00000,0x00000,0x377BF,0x77FBF,0x8101F,0x00001
+ /* { "CAPTION"	, caption_attr,	HTML_CAPTION_ATTRIBUTES, SGML_MIXED }, */
+#define	T_CAPTION	0x0100,	0x0B04F,0x8FFFF,0x06A00,0xB6FA7,0x8035F,0x00000
+ /* { "CENTER"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED }, */
+#define T_CENTER	0x0200,	0x8FBCF,0x8FFFF,0xB6680,0xB6FA7,0x8071F,0x00000
+ /* { "CITE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_CITE		0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00002,0x00000
+ /* { "CODE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_CODE		0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00002,0x00000
+ /* { "COL"	, col_attr,	HTML_COL_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_COL		0x4000, 0x00000,0x00000,0x00820,0x36FA7,0x88F5F,0x00001
+ /* { "COLGROUP", col_attr,	HTML_COL_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_COLGROUP	0x0020, 0x04000,0x04000,0x00800,0x36FA7,0x8875F,0x00001
+ /* { "COMMENT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define	T_COMMENT	0x0004,	0x00000,0x00000,0xA77AF,0x7FFFF,0x00003,0x00000
+ /* { "CREDIT"	, credit_attr,	HTML_CREDIT_ATTRIBUTES,	SGML_MIXED }, */
+#define T_CREDIT	0x0100, 0x0B04F,0x8FFFF,0x06A00,0xB7FBF,0x8030F,0x00000
+ /* { "DD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_DD		0x0400,	0x0FBCF,0x8FFFF,0x00800,0xB6FFF,0x8071F,0x00001
+ /* { "DEL"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_DEL		0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000
+ /* { "DFN"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_DFN		0x0002, 0x8B0CF,0x8FFFF,0x8778F,0xF7FBF,0x00003,0x00000
+ /* { "DIR"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED }, */
+#define T_DIR		0x0800, 0x0B400,0x0F75F,0x37680,0x36FB7,0x84F7F,0x00000
+ /* { "DIV"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED }, */
+#define T_DIV		0x0200,	0x8FB8F,0x8FFFF,0xB66A0,0xB7FFF,0x8031F,0x00004
+ /* { "DL"	, glossary_attr, HTML_DL_ATTRIBUTES,	SGML_MIXED }, */
+#define T_DL		0x0800,	0x0C480,0x8FFFF,0x36680,0xB7FB7,0x0075F,0x00000
+ /* { "DLC"	, glossary_attr, HTML_DL_ATTRIBUTES,	SGML_MIXED }, */
+#define T_DLC		0x0800,	0x0C480,0x8FFFF,0x36680,0xB7FB7,0x0075F,0x00000
+ /* { "DT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_DT		0x0400,	0x0B04F,0x0B1FF,0x00800,0x17FFF,0x8071F,0x00001
+ /* { "EM"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_EM		0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FAF,0x00003,0x00000
+ /* { "EMBED"	, embed_attr,	HTML_EMBED_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_EMBED		0x2000, 0x8F107,0x8FFF7,0xB6FBF,0xB7FBF,0x1FF7F,0x00001
+ /* { "FIELDSET", fieldset_attr,HTML_FIELDSET_ATTRIBUTES, SGML_MIXED }, */
+#define T_FIELDSET	0x0200,	0x0FB40,0x0FF5F,0x07787,0x37FF7,0x8805F,0x00000
+ /* { "FIG"	, fig_attr,	HTML_FIG_ATTRIBUTES,	SGML_MIXED }, */
+#define T_FIG		0x0200, 0x0FB00,0x8FFFF,0x36680,0xB6FBF,0x8834F,0x00000
+ /* { "FN"	, fn_attr,	HTML_FN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_FN		0x0200, 0x8FBCF,0x8FFFF,0xB6680,0xB7EBF,0x8114F,0x00000
+ /* { "FONT"	, font_attr,	HTML_FONT_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_FONT		0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004
+ /* { "FORM"	, form_attr,	HTML_FORM_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_FORM		0x0080,	0x0FF6F,0x0FF7F,0x36E07,0x33F07,0x88DFF,0x00000
+ /* { "FRAME"	, frame_attr,	HTML_FRAME_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_FRAME		0x10000,0x00000,0x00000,0x10000,0x10000,0x9FFFF,0x00001
+ /* { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES, SGML_MIXED }, */
+#define	T_FRAMESET	0x10000,0x90000,0x90000,0x90000,0x93000,0x9FFFF,0x00000
+ /* { "H1"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED }, */
+#define T_H1  		0x0100,	0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000
+ /* { "H2"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED }, */
+#define T_H2  		0x0100,	0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000
+ /* { "H3"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED }, */
+#define T_H3  		0x0100,	0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000
+ /* { "H4"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED }, */
+#define T_H4  		0x0100,	0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000
+ /* { "H5"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED }, */
+#define T_H5  		0x0100,	0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000
+ /* { "H6"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED }, */
+#define T_H6  		0x0100,	0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000
+ /* { "HEAD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_HEAD		0x40000,0x4F000,0x47000,0x10000,0x10000,0x9FFFF,0x00006
+ /* { "HR"	, hr_attr,	HTML_HR_ATTRIBUTES,	SGML_EMPTY }, */
+#define	T_HR		0x4000,	0x00000,0x00000,0x3FE80,0x3FFBF,0x87F37,0x00001
+ /* { "HTML"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_HTML		0x10000,0x7FB8F,0x7FFFF,0x00000,0x00000,0x1FFFF,0x00003
+#define T_HY		0x1000, 0x00000,0x00000,0x3779F,0x77FBF,0x8101F,0x00001
+ /* { "I"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_I		0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004
+ /* { "IMG"     , img_attr,	HTML_IMG_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_IMG		0x1000,	0x00000,0x00000,0x3779F,0x37FBF,0x80000,0x00001
+ /* { "INPUT"   , input_attr,	HTML_INPUT_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_INPUT		0x0040,	0x00000,0x00000,0x03F87,0x37F87,0x8904F,0x00001
+ /* { "INS"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_INS		0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000
+ /* { "ISINDEX" , isindex_attr,	HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY }, */
+#define T_ISINDEX	0x8000, 0x00000,0x00000,0x7778F,0x7FFAF,0x80007,0x00001
+ /* { "KBD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_KBD		0x0002, 0x00000,0x00000,0x2778F,0x77FBF,0x00003,0x00000
+ /* { "KEYGEN"	, keygen_attr,	HTML_KEYGEN_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_KEYGEN	0x0040,	0x00000,0x00000,0x07FB7,0x37FB7,0x80070,0x00001
+ /* { "LABEL"	, label_attr,	HTML_LABEL_ATTRIBUTES,	SGML_MIXED }, */
+#define T_LABEL		0x0020, 0x9FFFF,0x9FFFF,0x9FFFF,0x9FFFF,0x00007,0x00000
+ /* { "LH"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_LH		0x0400,	0x0BB7F,0x8FFFF,0x00800,0x97FFF,0x8071F,0x00001
+ /* { "LI"	, list_attr,	HTML_LI_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_LI		0x0400,	0x0BBFF,0x8FFFF,0x00800,0x97FFF,0x8071F,0x00001
+ /* { "LINK"	, link_attr,	HTML_LINK_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_LINK		0x8000, 0x00000,0x00000,0x50000,0x50000,0x0FF7F,0x00001
+ /* { "LISTING"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL }, */
+#define T_LISTING	0x0800, 0x00000,0x00000,0x36600,0x36F00,0x80F1F,0x00000
+ /* { "MAP"	, map_attr,	HTML_MAP_ATTRIBUTES,	SGML_MIXED }, */
+#define T_MAP		0x8000,	0x08000,0x08000,0x37FCF,0x37FBF,0x0071F,0x00000
+ /* { "MARQUEE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_MARQUEE	0x4000, 0x0000F,0x8F01F,0x37787,0xB7FA7,0x8301C,0x00000
+ /* { "MATH"	, math_attr,	HTML_MATH_ATTRIBUTES,	SGML_LITTERAL }, */
+#define T_MATH		0x0004,	0x0B05F,0x8FFFF,0x2778F,0xF7FBF,0x0001F,0x00000
+ /* { "MENU"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED }, */
+#define T_MENU		0x0800, 0x0B400,0x0F75F,0x17680,0x36FB7,0x88F7F,0x00000
+ /* { "META"	, meta_attr,	HTML_META_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_META		0x8000, 0x00000,0x00000,0x50000,0x50000,0x0FF7F,0x00001
+ /* { "NEXTID"  , nextid_attr,	1,			SGML_EMPTY }, */
+#define T_NEXTID	0x1000, 0x00000,0x00000,0x50000,0x1FFF7,0x00001,0x00001
+ /* { "NOFRAMES", gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define	T_NOFRAMES	0x20000,0x2FB8F,0x0FFFF,0x17000,0x17000,0x0CF5F,0x00000
+ /* { "NOTE"	, note_attr,	HTML_NOTE_ATTRIBUTES,	SGML_MIXED }, */
+#define T_NOTE		0x0200,	0x0BBAF,0x8FFFF,0x376B0,0xB7FFF,0x8031F,0x00000
+ /* { "OBJECT"	, object_attr,	HTML_OBJECT_ATTRIBUTES,	SGML_LITTERAL }, */
+#define	T_OBJECT	0x2000,	0x8FBCF,0x8FFFF,0xB679F,0xB6FBF,0x83F5F,0x00000
+ /* { "OL"	, olist_attr,	HTML_OL_ATTRIBUTES,	SGML_MIXED }, */
+#define T_OL		0x0800, 0x0C400,0x8FFFF,0x37680,0xB7FB7,0x88F7F,0x00000
+ /* { "OPTION"	, option_attr,	HTML_OPTION_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_OPTION	0x8000,	0x00000,0x00000,0x00040,0x37FFF,0x8031F,0x00001
+ /* { "OVERLAY"	, overlay_attr,	HTML_OVERLAY_ATTRIBUTES, SGML_EMPTY }, */
+#define T_OVERLAY	0x4000, 0x00000,0x00000,0x00200,0x37FBF,0x83F7F,0x00001
+ /* { "P"	, p_attr,	HTML_P_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_P   		0x0100,	0x0B04F,0x8FFFF,0x36680,0xB6FA7,0x80117,0x00001
+ /* { "PARAM"	, param_attr,	HTML_PARAM_ATTRIBUTES,	SGML_EMPTY }, */
+#define	T_PARAM		0x1000, 0x00000,0x00000,0x03000,0x17FFF,0x81777,0x00001
+ /* { "PLAINTEXT", gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL }, */
+#define T_PLAINTEXT	0x10000,0xFFFFF,0xFFFFF,0x90000,0x90000,0x3FFFF,0x00001
+ /* { "PRE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_PRE		0x0200,	0x0F04F,0x0F05E,0x36680,0x36FF0,0x8071E,0x00000
+ /* { "Q"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_Q		0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FAF,0x00003,0x00000
+ /* { "S"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_S		0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00000
+ /* { "SAMP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_SAMP		0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00002,0x00000
+ /* { "SCRIPT"	, script_attr,	HTML_SCRIPT_ATTRIBUTES,	SGML_LITTERAL }, */
+#define T_SCRIPT	0x2000,	0x00000,0x00000,0x57F8F,0x57FFF,0x87F5F,0x00000
+ /* { "SELECT"	, select_attr,	HTML_SELECT_ATTRIBUTES,	SGML_MIXED }, */
+#define T_SELECT	0x0040,	0x08000,0x08000,0x03FAF,0x13FBF,0x80F5F,0x00000
+#define T_SHY		0x1000, 0x00000,0x00000,0x3779F,0x77FBF,0x8101F,0x00001
+ /* { "SMALL"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_SMALL		0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004
+ /* { "SPAN"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_SPAN		0x0002, 0x0B04F,0x0FFFF,0x2778F,0x77FBF,0x80003,0x00000
+ /* { "SPOT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_SPOT		0x0008,	0x00000,0x00000,0x3FFF7,0x3FFF7,0x00008,0x00001
+ /* { "STRIKE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_STRIKE	0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00000
+ /* { "STRONG"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_STRONG	0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FAF,0x00003,0x00000
+ /* { "STYLE"	, style_attr,	HTML_STYLE_ATTRIBUTES,	SGML_LITTERAL }, */
+#define T_STYLE		0x40000,0x00000,0x00000,0x7638F,0x76FAF,0x8001F,0x00000
+ /* { "SUB"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_SUB		0x0004,	0x8B05F,0x8FFFF,0x8779F,0xF7FBF,0x00007,0x00000
+ /* { "SUP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_SUP		0x0004, 0x8B05F,0x8FFFF,0x8779F,0xF7FBF,0x00007,0x00000
+ /* { "TAB"	, tab_attr,	HTML_TAB_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_TAB		0x1000,	0x00000,0x00000,0x3778F,0x57FAF,0x00001,0x00001
+ /* { "TABLE"	, table_attr,	HTML_TABLE_ATTRIBUTES,	SGML_MIXED }, */
+#define T_TABLE		0x0800, 0x0F1E0,0x8FFFF,0x36680,0xB6FA7,0x8C57F,0x00000
+ /* { "TBODY"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_TBODY		0x0020, 0x00020,0x8FFFF,0x00880,0xB7FB7,0x8C75F,0x00003
+ /* { "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
+ /* { "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 }, */
+#define T_TFOOT		0x0020, 0x00020,0x8FFFF,0x00800,0xB7FB7,0x8CF5F,0x00001
+ /* { "TH"	, td_attr,	HTML_TD_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_TH		0x0400,	0x0FBCF,0x0FFFF,0x00020,0xB7FB7,0x8CF5F,0x00001
+ /* { "THEAD"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_THEAD		0x0020, 0x00020,0x8FFFF,0x00880,0xB7FB7,0x8CF5F,0x00001
+ /* { "TITLE", 	  gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_RCDATA }, */
+#define T_TITLE		0x40000,0x00000,0x00000,0x50000,0x50000,0x0031F,0x00004
+ /* { "TR"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY }, */
+#define T_TR		0x0020, 0x00400,0x8FFFF,0x00820,0xB7FB7,0x8C75F,0x00001
+ /* { "TT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define	T_TT		0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00000
+ /* { "U"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define	T_U		0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004
+ /* { "UL"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED }, */
+#define T_UL		0x0800,	0x0C480,0x8FFFF,0x36680,0xB7FFF,0x8075F,0x00000
+ /* { "VAR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
+#define T_VAR		0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00000
+#define T_WBR		0x0001, 0x00000,0x00000,0x3778F,0x77FBF,0x8101F,0x00001
+ /* { "XMP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL }, */
+#define T_XMP		0x0800, 0x00000,0x00000,0x367E0,0x36FFF,0x0875F,0x00001
+
 /*	Elements
 **	--------
 **
 **	Must match definitions in HTMLDTD.html!
 **	Must be in alphabetical order.
 **
-**    Name, 	Attributes, 		content
+**  The T_* extra info is listed here, but it won't matter (is not used
+**  in SGML.c if New_DTD is not set).  This mainly simplifies comparison
+**  of the tags_old[] table (otherwise unchanged from original Lynx treatment)
+**  with the tags_new[] table below. - kw
+**
+**    Name, 	Attributes, 	No. of attributes,     content,   extra info...
 */
-static HTTag tags[HTML_ELEMENTS] = {
-    { "A"	, a_attr,	HTML_A_ATTRIBUTES,	SGML_MIXED },
-    { "ABBREV"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "ACRONYM"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "ADDRESS"	, address_attr,	HTML_ADDRESS_ATTRIBUTES, SGML_MIXED },
-    { "APPLET"	, applet_attr,	HTML_APPLET_ATTRIBUTES, SGML_MIXED },
-    { "AREA"	, area_attr,	HTML_AREA_ATTRIBUTES,   SGML_EMPTY },
-    { "AU"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "AUTHOR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "B"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "BANNER"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "BASE"	, base_attr,	HTML_BASE_ATTRIBUTES,	SGML_EMPTY },
-    { "BASEFONT", font_attr,	HTML_FONT_ATTRIBUTES,	SGML_EMPTY },
-    { "BDO"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "BGSOUND"	, bgsound_attr,	HTML_BGSOUND_ATTRIBUTES, SGML_EMPTY },
-    { "BIG"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "BLINK"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "BLOCKQUOTE", bq_attr,	HTML_BQ_ATTRIBUTES,	SGML_MIXED },
-    { "BODY"	, body_attr,	HTML_BODY_ATTRIBUTES,	SGML_MIXED },
-    { "BODYTEXT", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED },
-    { "BQ"	, bq_attr,	HTML_BQ_ATTRIBUTES,	SGML_MIXED },
-    { "BR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY },
-    { "CAPTION"	, caption_attr,	HTML_CAPTION_ATTRIBUTES, SGML_MIXED },
-    { "CENTER"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED },
-    { "CITE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "CODE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "COL"	, col_attr,	HTML_COL_ATTRIBUTES,	SGML_EMPTY },
-    { "COLGROUP", col_attr,	HTML_COL_ATTRIBUTES,	SGML_EMPTY },
-    { "COMMENT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "CREDIT"	, credit_attr,	HTML_CREDIT_ATTRIBUTES,	SGML_MIXED },
-    { "DD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY },
-    { "DEL"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "DFN"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "DIR"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED },
-    { "DIV"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED },
-    { "DL"	, glossary_attr, HTML_DL_ATTRIBUTES,	SGML_MIXED },
-    { "DLC"	, glossary_attr, HTML_DL_ATTRIBUTES,	SGML_MIXED },
-    { "DT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY },
-    { "EM"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "EMBED"	, embed_attr,	HTML_EMBED_ATTRIBUTES,	SGML_EMPTY },
-    { "FIELDSET", fieldset_attr,HTML_FIELDSET_ATTRIBUTES, SGML_MIXED },
-    { "FIG"	, fig_attr,	HTML_FIG_ATTRIBUTES,	SGML_MIXED },
-    { "FN"	, fn_attr,	HTML_FN_ATTRIBUTES,	SGML_MIXED },
-    { "FONT"	, font_attr,	HTML_FONT_ATTRIBUTES,	SGML_EMPTY },
-    { "FORM"	, form_attr,	HTML_FORM_ATTRIBUTES,	SGML_EMPTY },
-    { "FRAME"	, frame_attr,	HTML_FRAME_ATTRIBUTES,	SGML_EMPTY },
-    { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES, SGML_MIXED },
-    { "H1"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED },
-    { "H2"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED },
-    { "H3"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED },
-    { "H4"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED },
-    { "H5"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED },
-    { "H6"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED },
-    { "HEAD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "HR"	, hr_attr,	HTML_HR_ATTRIBUTES,	SGML_EMPTY },
-    { "HTML"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "I"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "IMG"     , img_attr,	HTML_IMG_ATTRIBUTES,	SGML_EMPTY },
-    { "INPUT"   , input_attr,	HTML_INPUT_ATTRIBUTES,	SGML_EMPTY },
-    { "INS"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "ISINDEX" , isindex_attr,	HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY },
-    { "KBD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "KEYGEN"	, keygen_attr,	HTML_KEYGEN_ATTRIBUTES,	SGML_EMPTY },
-    { "LABEL"	, label_attr,	HTML_LABEL_ATTRIBUTES,	SGML_MIXED },
-    { "LH"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY },
-    { "LI"	, list_attr,	HTML_LI_ATTRIBUTES,	SGML_EMPTY },
-    { "LINK"	, link_attr,	HTML_LINK_ATTRIBUTES,	SGML_EMPTY },
-    { "LISTING"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL },
-    { "MAP"	, map_attr,	HTML_MAP_ATTRIBUTES,	SGML_MIXED },
-    { "MARQUEE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "MATH"	, math_attr,	HTML_MATH_ATTRIBUTES,	SGML_LITTERAL },
-    { "MENU"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED },
-    { "META"	, meta_attr,	HTML_META_ATTRIBUTES,	SGML_EMPTY },
-    { "NEXTID"  , nextid_attr,	1,			SGML_EMPTY },
-    { "NOFRAMES", gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "NOTE"	, note_attr,	HTML_NOTE_ATTRIBUTES,	SGML_MIXED },
-    { "OBJECT"	, object_attr,	HTML_OBJECT_ATTRIBUTES,	SGML_LITTERAL },
-    { "OL"	, olist_attr,	HTML_OL_ATTRIBUTES,	SGML_MIXED },
-    { "OPTION"	, option_attr,	HTML_OPTION_ATTRIBUTES,	SGML_EMPTY },
-    { "OVERLAY"	, overlay_attr,	HTML_OVERLAY_ATTRIBUTES, SGML_EMPTY },
-    { "P"	, p_attr,	HTML_P_ATTRIBUTES,	SGML_EMPTY },
-    { "PARAM"	, param_attr,	HTML_PARAM_ATTRIBUTES,	SGML_EMPTY },
-    { "PLAINTEXT", gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL },
-    { "PRE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "Q"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "S"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "SAMP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "SCRIPT"	, script_attr,	HTML_SCRIPT_ATTRIBUTES,	SGML_LITTERAL },
-    { "SELECT"	, select_attr,	HTML_SELECT_ATTRIBUTES,	SGML_MIXED },
-    { "SMALL"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "SPAN"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "SPOT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY },
-    { "STRIKE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "STRONG"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "STYLE"	, style_attr,	HTML_STYLE_ATTRIBUTES,	SGML_LITTERAL },
-    { "SUB"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "SUP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "TAB"	, tab_attr,	HTML_TAB_ATTRIBUTES,	SGML_EMPTY },
-    { "TABLE"	, table_attr,	HTML_TABLE_ATTRIBUTES,	SGML_MIXED },
-    { "TBODY"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY },
-    { "TD"	, td_attr,	HTML_TD_ATTRIBUTES,	SGML_EMPTY },
-    { "TEXTAREA", textarea_attr,HTML_TEXTAREA_ATTRIBUTES, SGML_LITTERAL },
-    { "TEXTFLOW", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED },
-    { "TFOOT"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY },
-    { "TH"	, td_attr,	HTML_TD_ATTRIBUTES,	SGML_EMPTY },
-    { "THEAD"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY },
-    { "TITLE", 	  gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_RCDATA },
-    { "TR"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY },
-    { "TT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "U"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "UL"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED },
-    { "VAR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },
-    { "XMP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL },
+static HTTag tags_old[HTML_ELEMENTS] = {
+    { "A"	, a_attr,	HTML_A_ATTRIBUTES,	SGML_EMPTY,T_A},
+    { "ABBREV"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_ABBREV},
+    { "ACRONYM"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_ACRONYM},
+    { "ADDRESS"	, address_attr,	HTML_ADDRESS_ATTRIBUTES, SGML_MIXED,T_ADDRESS},
+    { "APPLET"	, applet_attr,	HTML_APPLET_ATTRIBUTES, SGML_MIXED,T_APPLET},
+    { "AREA"	, area_attr,	HTML_AREA_ATTRIBUTES,   SGML_EMPTY,T_AREA},
+    { "AU"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_AU},
+    { "AUTHOR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_AUTHOR},
+    { "B"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_B},
+    { "BANNER"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_BANNER},
+    { "BASE"	, base_attr,	HTML_BASE_ATTRIBUTES,	SGML_EMPTY,T_BASE},
+    { "BASEFONT", font_attr,	HTML_FONT_ATTRIBUTES,	SGML_EMPTY,T_BASEFONT},
+    { "BDO"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_BDO},
+    { "BGSOUND"	, bgsound_attr,	HTML_BGSOUND_ATTRIBUTES, SGML_EMPTY,T_BGSOUND},
+    { "BIG"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_BIG},
+    { "BLINK"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_BLINK},
+    { "BLOCKQUOTE", bq_attr,	HTML_BQ_ATTRIBUTES,	SGML_MIXED,T_BLOCKQUOTE},
+    { "BODY"	, body_attr,	HTML_BODY_ATTRIBUTES,	SGML_MIXED,T_BODY},
+    { "BODYTEXT", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED,T_BODYTEXT},
+    { "BQ"	, bq_attr,	HTML_BQ_ATTRIBUTES,	SGML_MIXED,T_BQ},
+    { "BR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_BR},
+    { "CAPTION"	, caption_attr,	HTML_CAPTION_ATTRIBUTES, SGML_MIXED,T_CAPTION},
+    { "CENTER"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED,T_CENTER},
+    { "CITE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_CITE},
+    { "CODE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_CODE},
+    { "COL"	, col_attr,	HTML_COL_ATTRIBUTES,	SGML_EMPTY,T_COL},
+    { "COLGROUP", col_attr,	HTML_COL_ATTRIBUTES,	SGML_EMPTY,T_COLGROUP},
+    { "COMMENT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_COMMENT},
+    { "CREDIT"	, credit_attr,	HTML_CREDIT_ATTRIBUTES,	SGML_MIXED,T_CREDIT},
+    { "DD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_DD},
+    { "DEL"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_DEL},
+    { "DFN"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_DFN},
+    { "DIR"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED,T_DIR},
+    { "DIV"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED,T_DIV},
+    { "DL"	, glossary_attr, HTML_DL_ATTRIBUTES,	SGML_MIXED,T_DL},
+    { "DLC"	, glossary_attr, HTML_DL_ATTRIBUTES,	SGML_MIXED,T_DLC},
+    { "DT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_DT},
+    { "EM"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_EM},
+    { "EMBED"	, embed_attr,	HTML_EMBED_ATTRIBUTES,	SGML_EMPTY,T_EMBED},
+    { "FIELDSET", fieldset_attr,HTML_FIELDSET_ATTRIBUTES, SGML_MIXED,T_FIELDSET},
+    { "FIG"	, fig_attr,	HTML_FIG_ATTRIBUTES,	SGML_MIXED,T_FIG},
+    { "FN"	, fn_attr,	HTML_FN_ATTRIBUTES,	SGML_MIXED,T_FN},
+    { "FONT"	, font_attr,	HTML_FONT_ATTRIBUTES,	SGML_EMPTY,T_FONT},
+    { "FORM"	, form_attr,	HTML_FORM_ATTRIBUTES,	SGML_EMPTY,T_FORM},
+    { "FRAME"	, frame_attr,	HTML_FRAME_ATTRIBUTES,	SGML_EMPTY,T_FRAME},
+    { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES, SGML_MIXED,T_FRAMESET},
+    { "H1"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H1},
+    { "H2"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H2},
+    { "H3"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H3},
+    { "H4"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H4},
+    { "H5"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H5},
+    { "H6"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H6},
+    { "HEAD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_HEAD},
+    { "HR"	, hr_attr,	HTML_HR_ATTRIBUTES,	SGML_EMPTY,T_HR},
+    { "HTML"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_HTML},
+    { "HY"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_HY},
+    { "I"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_I},
+    { "IMG"     , img_attr,	HTML_IMG_ATTRIBUTES,	SGML_EMPTY,T_IMG},
+    { "INPUT"   , input_attr,	HTML_INPUT_ATTRIBUTES,	SGML_EMPTY,T_INPUT},
+    { "INS"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_INS},
+    { "ISINDEX" , isindex_attr,	HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY,T_ISINDEX},
+    { "KBD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_KBD},
+    { "KEYGEN"	, keygen_attr,	HTML_KEYGEN_ATTRIBUTES,	SGML_EMPTY,T_KEYGEN},
+    { "LABEL"	, label_attr,	HTML_LABEL_ATTRIBUTES,	SGML_MIXED,T_LABEL},
+    { "LH"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_LH},
+    { "LI"	, list_attr,	HTML_LI_ATTRIBUTES,	SGML_EMPTY,T_LI},
+    { "LINK"	, link_attr,	HTML_LINK_ATTRIBUTES,	SGML_EMPTY,T_LINK},
+    { "LISTING"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL,T_LISTING},
+    { "MAP"	, map_attr,	HTML_MAP_ATTRIBUTES,	SGML_MIXED,T_MAP},
+    { "MARQUEE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_MARQUEE},
+    { "MATH"	, math_attr,	HTML_MATH_ATTRIBUTES,	SGML_LITTERAL,T_MATH},
+    { "MENU"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED,T_MENU},
+    { "META"	, meta_attr,	HTML_META_ATTRIBUTES,	SGML_EMPTY,T_META},
+    { "NEXTID"  , nextid_attr,	1,			SGML_EMPTY,T_NEXTID},
+    { "NOFRAMES", gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_NOFRAMES},
+    { "NOTE"	, note_attr,	HTML_NOTE_ATTRIBUTES,	SGML_MIXED,T_NOTE},
+    { "OBJECT"	, object_attr,	HTML_OBJECT_ATTRIBUTES,	SGML_LITTERAL,T_OBJECT},
+    { "OL"	, olist_attr,	HTML_OL_ATTRIBUTES,	SGML_MIXED,T_OL},
+    { "OPTION"	, option_attr,	HTML_OPTION_ATTRIBUTES,	SGML_EMPTY,T_OPTION},
+    { "OVERLAY"	, overlay_attr,	HTML_OVERLAY_ATTRIBUTES, SGML_EMPTY,T_OVERLAY},
+    { "P"	, p_attr,	HTML_P_ATTRIBUTES,	SGML_EMPTY,T_P},
+    { "PARAM"	, param_attr,	HTML_PARAM_ATTRIBUTES,	SGML_EMPTY,T_PARAM},
+    { "PLAINTEXT", gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL,T_PLAINTEXT},
+    { "PRE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_PRE},
+    { "Q"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_Q},
+    { "S"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_S},
+    { "SAMP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SAMP},
+    { "SCRIPT"	, script_attr,	HTML_SCRIPT_ATTRIBUTES,	SGML_LITTERAL,T_SCRIPT},
+    { "SELECT"	, select_attr,	HTML_SELECT_ATTRIBUTES,	SGML_MIXED,T_SELECT},
+    { "SHY"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_SHY},
+    { "SMALL"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SMALL},
+    { "SPAN"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SPAN},
+    { "SPOT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_SPOT},
+    { "STRIKE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_STRIKE},
+    { "STRONG"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_STRONG},
+    { "STYLE"	, style_attr,	HTML_STYLE_ATTRIBUTES,	SGML_LITTERAL,T_STYLE},
+    { "SUB"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SUB},
+    { "SUP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SUP},
+    { "TAB"	, tab_attr,	HTML_TAB_ATTRIBUTES,	SGML_EMPTY,T_TAB},
+    { "TABLE"	, table_attr,	HTML_TABLE_ATTRIBUTES,	SGML_MIXED,T_TABLE},
+    { "TBODY"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY,T_TBODY},
+    { "TD"	, td_attr,	HTML_TD_ATTRIBUTES,	SGML_EMPTY,T_TD},
+    { "TEXTAREA", textarea_attr,HTML_TEXTAREA_ATTRIBUTES, SGML_LITTERAL,T_TEXTAREA},
+    { "TEXTFLOW", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED,T_TEXTFLOW},
+    { "TFOOT"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY,T_TFOOT},
+    { "TH"	, td_attr,	HTML_TD_ATTRIBUTES,	SGML_EMPTY,T_TH},
+    { "THEAD"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY,T_THEAD},
+    { "TITLE", 	  gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_RCDATA,T_TITLE},
+    { "TR"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY,T_TR},
+    { "TT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_TT},
+    { "U"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_U},
+    { "UL"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED,T_UL},
+    { "VAR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_VAR},
+    { "WBR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_WBR},
+    { "XMP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL,T_XMP},
 };
 
+static HTTag tags_new[HTML_ELEMENTS] = {
+    { "A"	, a_attr,	HTML_A_ATTRIBUTES,	SGML_MIXED,T_A},
+    { "ABBREV"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_ABBREV},
+    { "ACRONYM"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_ACRONYM},
+    { "ADDRESS"	, address_attr,	HTML_ADDRESS_ATTRIBUTES, SGML_MIXED,T_ADDRESS},
+    { "APPLET"	, applet_attr,	HTML_APPLET_ATTRIBUTES, SGML_MIXED,T_APPLET},
+    { "AREA"	, area_attr,	HTML_AREA_ATTRIBUTES,   SGML_EMPTY,T_AREA},
+    { "AU"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_AU},
+    { "AUTHOR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_AUTHOR},
+    { "B"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_B},
+    { "BANNER"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_BANNER},
+    { "BASE"	, base_attr,	HTML_BASE_ATTRIBUTES,	SGML_EMPTY,T_BASE},
+    { "BASEFONT", font_attr,	HTML_FONT_ATTRIBUTES,	SGML_EMPTY,T_BASEFONT},
+    { "BDO"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_BDO},
+    { "BGSOUND"	, bgsound_attr,	HTML_BGSOUND_ATTRIBUTES, SGML_EMPTY,T_BGSOUND},
+    { "BIG"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_BIG},
+    { "BLINK"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_BLINK},
+    { "BLOCKQUOTE", bq_attr,	HTML_BQ_ATTRIBUTES,	SGML_MIXED,T_BLOCKQUOTE},
+    { "BODY"	, body_attr,	HTML_BODY_ATTRIBUTES,	SGML_MIXED,T_BODY},
+    { "BODYTEXT", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED,T_BODYTEXT},
+    { "BQ"	, bq_attr,	HTML_BQ_ATTRIBUTES,	SGML_MIXED,T_BQ},
+    { "BR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_BR},
+    { "CAPTION"	, caption_attr,	HTML_CAPTION_ATTRIBUTES, SGML_MIXED,T_CAPTION},
+    { "CENTER"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED,T_CENTER},
+    { "CITE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_CITE},
+    { "CODE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_CODE},
+    { "COL"	, col_attr,	HTML_COL_ATTRIBUTES,	SGML_EMPTY,T_COL},
+    { "COLGROUP", col_attr,	HTML_COL_ATTRIBUTES,	SGML_ELEMENT,T_COLGROUP},
+    { "COMMENT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_PCDATA,T_COMMENT},
+    { "CREDIT"	, credit_attr,	HTML_CREDIT_ATTRIBUTES,	SGML_MIXED,T_CREDIT},
+    { "DD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_DD},
+    { "DEL"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_DEL},
+    { "DFN"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_DFN},
+    { "DIR"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED,T_DIR},
+    { "DIV"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED,T_DIV},
+    { "DL"	, glossary_attr, HTML_DL_ATTRIBUTES,	SGML_MIXED,T_DL},
+    { "DLC"	, glossary_attr, HTML_DL_ATTRIBUTES,	SGML_MIXED,T_DLC},
+    { "DT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_DT},
+    { "EM"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_EM},
+    { "EMBED"	, embed_attr,	HTML_EMBED_ATTRIBUTES,	SGML_EMPTY,T_EMBED},
+    { "FIELDSET", fieldset_attr,HTML_FIELDSET_ATTRIBUTES, SGML_MIXED,T_FIELDSET},
+    { "FIG"	, fig_attr,	HTML_FIG_ATTRIBUTES,	SGML_MIXED,T_FIG},
+    { "FN"	, fn_attr,	HTML_FN_ATTRIBUTES,	SGML_MIXED,T_FN},
+    { "FONT"	, font_attr,	HTML_FONT_ATTRIBUTES,	SGML_MIXED,T_FONT},
+    { "FORM"	, form_attr,	HTML_FORM_ATTRIBUTES,	SGML_MIXED,T_FORM},
+    { "FRAME"	, frame_attr,	HTML_FRAME_ATTRIBUTES,	SGML_EMPTY,T_FRAME},
+    { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES, SGML_ELEMENT,T_FRAMESET},
+    { "H1"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H1},
+    { "H2"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H2},
+    { "H3"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H3},
+    { "H4"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H4},
+    { "H5"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H5},
+    { "H6"	, h_attr,	HTML_H_ATTRIBUTES,	SGML_MIXED,T_H6},
+    { "HEAD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_HEAD},
+    { "HR"	, hr_attr,	HTML_HR_ATTRIBUTES,	SGML_EMPTY,T_HR},
+    { "HTML"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_HTML},
+    { "HY"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_HY},
+    { "I"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_I},
+    { "IMG"     , img_attr,	HTML_IMG_ATTRIBUTES,	SGML_EMPTY,T_IMG},
+    { "INPUT"   , input_attr,	HTML_INPUT_ATTRIBUTES,	SGML_EMPTY,T_INPUT},
+    { "INS"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_INS},
+    { "ISINDEX" , isindex_attr,	HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY,T_ISINDEX},
+    { "KBD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_KBD},
+    { "KEYGEN"	, keygen_attr,	HTML_KEYGEN_ATTRIBUTES,	SGML_EMPTY,T_KEYGEN},
+    { "LABEL"	, label_attr,	HTML_LABEL_ATTRIBUTES,	SGML_MIXED,T_LABEL},
+    { "LH"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_LH},
+    { "LI"	, list_attr,	HTML_LI_ATTRIBUTES,	SGML_MIXED,T_LI},
+    { "LINK"	, link_attr,	HTML_LINK_ATTRIBUTES,	SGML_EMPTY,T_LINK},
+    { "LISTING"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL,T_LISTING},
+    { "MAP"	, map_attr,	HTML_MAP_ATTRIBUTES,	SGML_MIXED,T_MAP},
+    { "MARQUEE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_MARQUEE},
+    { "MATH"	, math_attr,	HTML_MATH_ATTRIBUTES,	SGML_LITTERAL,T_MATH},
+    { "MENU"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED,T_MENU},
+    { "META"	, meta_attr,	HTML_META_ATTRIBUTES,	SGML_EMPTY,T_META},
+    { "NEXTID"  , nextid_attr,	1,			SGML_EMPTY,T_NEXTID},
+    { "NOFRAMES", gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_NOFRAMES},
+    { "NOTE"	, note_attr,	HTML_NOTE_ATTRIBUTES,	SGML_MIXED,T_NOTE},
+    { "OBJECT"	, object_attr,	HTML_OBJECT_ATTRIBUTES,	SGML_LITTERAL,T_OBJECT},
+    { "OL"	, olist_attr,	HTML_OL_ATTRIBUTES,	SGML_MIXED,T_OL},
+    { "OPTION"	, option_attr,	HTML_OPTION_ATTRIBUTES,	SGML_PCDATA,T_OPTION},
+    { "OVERLAY"	, overlay_attr,	HTML_OVERLAY_ATTRIBUTES, SGML_PCDATA,T_OVERLAY},
+    { "P"	, p_attr,	HTML_P_ATTRIBUTES,	SGML_MIXED,T_P},
+    { "PARAM"	, param_attr,	HTML_PARAM_ATTRIBUTES,	SGML_EMPTY,T_PARAM},
+    { "PLAINTEXT", gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL,T_PLAINTEXT},
+    { "PRE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_PRE},
+    { "Q"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_Q},
+    { "S"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_S},
+    { "SAMP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SAMP},
+    { "SCRIPT"	, script_attr,	HTML_SCRIPT_ATTRIBUTES,	SGML_LITTERAL,T_SCRIPT},
+    { "SELECT"	, select_attr,	HTML_SELECT_ATTRIBUTES,	SGML_ELEMENT,T_SELECT},
+    { "SHY"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_SHY},
+    { "SMALL"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SMALL},
+    { "SPAN"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SPAN},
+    { "SPOT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_SPOT},
+    { "STRIKE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_STRIKE},
+    { "STRONG"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_STRONG},
+    { "STYLE"	, style_attr,	HTML_STYLE_ATTRIBUTES,	SGML_LITTERAL,T_STYLE},
+    { "SUB"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SUB},
+    { "SUP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_SUP},
+    { "TAB"	, tab_attr,	HTML_TAB_ATTRIBUTES,	SGML_EMPTY,T_TAB},
+    { "TABLE"	, table_attr,	HTML_TABLE_ATTRIBUTES,	SGML_ELEMENT,T_TABLE},
+    { "TBODY"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_ELEMENT,T_TBODY},
+    { "TD"	, td_attr,	HTML_TD_ATTRIBUTES,	SGML_MIXED,T_TD},
+    { "TEXTAREA", textarea_attr,HTML_TEXTAREA_ATTRIBUTES, SGML_LITTERAL,T_TEXTAREA},
+    { "TEXTFLOW", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED,T_TEXTFLOW},
+    { "TFOOT"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_ELEMENT,T_TFOOT},
+    { "TH"	, td_attr,	HTML_TD_ATTRIBUTES,	SGML_MIXED,T_TH},
+    { "THEAD"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_ELEMENT,T_THEAD},
+    { "TITLE", 	  gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_PCDATA,T_TITLE},
+    { "TR"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_MIXED,T_TR},
+    { "TT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_TT},
+    { "U"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_U},
+    { "UL"	, ulist_attr,	HTML_UL_ATTRIBUTES,	SGML_MIXED,T_UL},
+    { "VAR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_VAR},
+    { "WBR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_WBR},
+    { "XMP"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL,T_XMP},
+};
+
+/* Dummy space, will be filled with the contents of either tags_new
+   or tags_old on calling HTSwitchDTD - kw */
+
+static HTTag tags[HTML_ELEMENTS];
+
 PUBLIC CONST SGML_dtd HTML_dtd = {
 	tags,
 	HTML_ELEMENTS,
@@ -1235,6 +1651,25 @@ PUBLIC CONST SGML_dtd HTML_dtd = {
 #endif
 };
 
+/* This function fills the "tags" part of the HTML_dtd structure with
+   what we want to use, either tags_old or tags_new.  Note that it
+   has to be called at least once before HTML_dtd is used, otherwise
+   the HTML_dtd contents will be invalid!  This could be coded in a way
+   that would make an initialisation call unnecessary, but my C knowledge
+   is limited and I didn't want to list the whole tags_new table
+   twice... - kw */
+PUBLIC void HTSwitchDTD ARGS1(
+    BOOL,		new)
+{
+    if (TRACE)
+	fprintf(stderr,"HTMLDTD: Copying DTD element info of size %d, %d * %d\n",
+		new ? sizeof(tags_new) : sizeof(tags_old),
+		HTML_ELEMENTS, sizeof(HTTag));
+    if (new)
+	memcpy(tags, tags_new, HTML_ELEMENTS * sizeof(HTTag));
+    else
+	memcpy(tags, tags_old, HTML_ELEMENTS * sizeof(HTTag));
+}
 
 /*
 **	Utility Routine:  Useful for people building HTML objects.
diff --git a/WWW/Library/Implementation/HTMLDTD.h b/WWW/Library/Implementation/HTMLDTD.h
index ef6c5fbb..09b6936a 100644
--- a/WWW/Library/Implementation/HTMLDTD.h
+++ b/WWW/Library/Implementation/HTMLDTD.h
@@ -85,6 +85,7 @@ typedef enum _HTMLElement {
 	HTML_HEAD,
 	HTML_HR,
 	HTML_HTML,
+	HTML_HY,
         HTML_I,
 	HTML_IMG,
 	HTML_INPUT,
@@ -118,6 +119,7 @@ typedef enum _HTMLElement {
         HTML_SAMP,
 	HTML_SCRIPT,
 	HTML_SELECT,
+	HTML_SHY,
         HTML_SMALL,
 	HTML_SPAN,
 	HTML_SPOT,
@@ -141,9 +143,10 @@ typedef enum _HTMLElement {
         HTML_U,
 	HTML_UL,
         HTML_VAR,
+        HTML_WBR,
 	HTML_XMP } HTMLElement;
 
-#define HTML_ELEMENTS 112
+#define HTML_ELEMENTS 115
 
 /*
 
@@ -855,6 +858,9 @@ Attribute numbers
 
 extern CONST SGML_dtd HTML_dtd;
 
+extern void HTSwitchDTD PARAMS((
+    BOOL new));
+
 /*
 
 Start anchor element
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index 0de7fb71..b915e1e3 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -83,6 +83,8 @@ PRIVATE int	diagnostic;			/* level: 0=none 2=source */
 #define PUTS(s) (*targetClass.put_string)(target, s)
 #define START(e) (*targetClass.start_element)(target, e, 0, 0, 0)
 #define END(e) (*targetClass.end_element)(target, e, 0)
+#define MAYBE_END(e) if (HTML_dtd.tags[e].contents != SGML_EMPTY) \
+                        (*targetClass.end_element)(target, e, 0)
 
 PRIVATE void free_news_globals NOARGS
 {
@@ -834,6 +836,7 @@ PRIVATE int read_article NOARGS
 		PUTS(from);
 	    else
 		PUTS(from);
+	    MAYBE_END(HTML_DT);
 	    PUTC('\n');
 
 	    if (!replyto)
@@ -850,6 +853,7 @@ PRIVATE int read_article NOARGS
     	        PUTS(author_address(replyto));
      	    END(HTML_A);
 	    START(HTML_BR);
+	    MAYBE_END(HTML_DT);
 	    PUTC('\n');
 
 	    FREE(from);
@@ -863,6 +867,7 @@ PRIVATE int read_article NOARGS
 	    END(HTML_B);
             PUTC(' ');
 	    PUTS(date);
+	    MAYBE_END(HTML_DT);
 	    PUTC('\n');
 	    FREE(date);
 	}
@@ -874,6 +879,7 @@ PRIVATE int read_article NOARGS
 	    END(HTML_B);
             PUTC(' ');
 	    PUTS(organization);
+	    MAYBE_END(HTML_DT);
 	    PUTC('\n');
 	    FREE(organization);
 	}
@@ -897,8 +903,10 @@ PRIVATE int read_article NOARGS
 	    PUTS("Newsgroups:");
 	    END(HTML_B);
 	    PUTC('\n');
+	    MAYBE_END(HTML_DT);
 	    START(HTML_DD);
 	    write_anchors(newsgroups);
+	    MAYBE_END(HTML_DD);
 	    PUTC('\n');
 
 	    START(HTML_DT);
@@ -909,6 +917,7 @@ PRIVATE int read_article NOARGS
             start_anchor(href);
             PUTS("newsgroup(s)");
             END(HTML_A);
+	    MAYBE_END(HTML_DT);
 	    PUTC('\n');
 	}
 	FREE(newsgroups);
@@ -919,9 +928,11 @@ PRIVATE int read_article NOARGS
 	    START(HTML_B);
 	    PUTS("References:");
 	    END(HTML_B);
+	    MAYBE_END(HTML_DT);
 	    PUTC('\n');
 	    START(HTML_DD);
 	    write_anchors(references);
+	    MAYBE_END(HTML_DD);
 	    PUTC('\n');
 	    FREE(references);
 	}
@@ -996,7 +1007,7 @@ PRIVATE int read_article NOARGS
 		    char *l = line;
 		    char *p;
 
-		    while ((p = strstr(l, "rticle <")) != 0) {
+		    while ((p = strstr(l, "rticle <")) != NULL) {
 		        char *q  = strchr(p,'>');
 		        char *at = strchr(p, '@');
 		        if (q && at && at<q) {
@@ -1163,12 +1174,13 @@ PRIVATE int read_list ARGS1(char *, arg)
 	    if (TRACE)
 	        fprintf(stderr, "B %s", line);
 	    if (line[0] == '.') {
-		if (line[1] < ' ') {		/* End of article? */
+		if ((unsigned char)line[1] < ' ') {		/* End of article? */
 		    done = YES;
 		    break;
 		} else {			/* Line starts with dot */
 		    START(HTML_DT);
 		    PUTS(&line[1]);
+		    MAYBE_END(HTML_DT);
 		}
 	    } else if (line[0] == '#') {	/* Comment? */
 	        p = line;			/* Restart at beginning */
@@ -1194,9 +1206,11 @@ PRIVATE int read_list ARGS1(char *, arg)
 		    START(HTML_DT);
 		    write_anchor(line, line);
 		    listing++;
+		    MAYBE_END(HTML_DT);
 		    PUTC('\n');
     	            START(HTML_DD);
 		    PUTS(&line[i+1]); /* put description */
+		    MAYBE_END(HTML_DD);
 		} else {
 		    if ((head && strncasecomp(line, pattern, len)) ||
 		        (tail && (i < len ||
@@ -1206,6 +1220,7 @@ PRIVATE int read_list ARGS1(char *, arg)
 		    }
 		    START(HTML_DT);
 		    write_anchor(line, line);
+		    MAYBE_END(HTML_DT);
 		    listing++;
 		}
 	    } /* if not dot */
@@ -1216,6 +1231,7 @@ PRIVATE int read_list ARGS1(char *, arg)
         START(HTML_DT);
 	sprintf(line, "No matches for: %s", arg);
 	PUTS(line);
+	MAYBE_END(HTML_DT);
     }
     END(HTML_DLC);
     PUTC('\n');
@@ -1536,6 +1552,7 @@ PRIVATE int read_group ARGS3(
 		    PUTS(buffer);
 		    FREE(date);
 		}
+		MAYBE_END(HTML_LI);
 		/*
 		**  Indicate progress!   @@@@@@
 		*/
@@ -1563,6 +1580,7 @@ PRIVATE int read_group ARGS3(
 		END(HTML_I);
 		PUTC(' ');
 		PUTS(response_text);
+		MAYBE_END(HTML_LI);
 	    } /* Handle response to HEAD request */
 	} /* Loop over article */	    
     } /* If read headers */
@@ -1858,7 +1876,7 @@ PUBLIC int HTLoadNews ARGS4(
 	    if (TRACE)
 		fprintf(stderr,
 	      		"HTNews: Proxy command is '%.*s'\n",
-			(strlen(proxycmd) - 4), proxycmd);
+			(int)(strlen(proxycmd) - 4), proxycmd);
 	    strcat(command, "/");
 	    StrAllocCopy(ProxyHREF, NewsHREF);
 	    StrAllocCopy(NewsHREF, command);
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index 710005ab..b3c3b16e 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -784,6 +784,14 @@ PUBLIC int HTDoConnect ARGS4(
 	    else
 #endif /* SOCKS */
             ret = select(FD_SETSIZE, NULL, (void *)&writefds, NULL, &timeout);
+
+	   /*
+	   **  If we suspend, then it is possible that select will be 
+	   **  interrupted.  Allow for this possibility. - JED
+	   */
+	   if ((ret == -1) && (errno == EINTR))
+	     continue;
+
             /*
             **  Again according to the Sun and Motorola man pagse for connect:
             **     EALREADY            The socket is non-blocking and a  previ-
@@ -940,16 +948,25 @@ PUBLIC int HTDoRead ARGS3(
 	    return HT_INTERRUPTED;
 	}
 
-        timeout.tv_sec = 0;
-	timeout.tv_usec = 100000;
-        FD_ZERO(&readfds);
-        FD_SET(fildes, &readfds);
+	/*
+	**  If we suspend, then it is possible that select will be 
+	**  interrupted.  Allow for this possibility. - JED
+	*/
+        do {
+	    timeout.tv_sec = 0;
+	    timeout.tv_usec = 100000;
+	    FD_ZERO(&readfds);
+	    FD_SET(fildes, &readfds);
 #ifdef SOCKS
-	if (socks_flag)
-            ret = Rselect(FD_SETSIZE, (void *)&readfds, NULL, NULL, &timeout);
-	else
+	    if (socks_flag)
+	        ret = Rselect(FD_SETSIZE,
+			      (void *)&readfds, NULL, NULL, &timeout);
+	    else
 #endif /* SOCKS */
-        ret = select(FD_SETSIZE, (void *)&readfds, NULL, NULL, &timeout);
+		ret = select(FD_SETSIZE,
+			     (void *)&readfds, NULL, NULL, &timeout);
+	} while ((ret == -1) && (errno == EINTR));
+
         if (ret < 0) {
             return -1;
         } else if (ret > 0) {
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index e78870d6..e617b9c8 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -3,6 +3,7 @@
 ** Modified:
 ** 27 Jan 1994  PDM  Added Ari Luotonen's Fix for Reload when using proxy
 **                   servers.
+** 28 Apr 1997  AJL,FM Do Proxy Authorisation.
 */
 
 #include "HTUtils.h"
@@ -50,6 +51,7 @@ extern BOOL LYNoFromHeader;	/* Never send From header? */
 extern BOOL LYSetCookies;	/* Act on Set-Cookie headers? */
 
 extern BOOL using_proxy;	/* Are we using an HTTP gateway? */
+PUBLIC BOOL auth_proxy = NO;	/* Generate a proxy authentication. - AJL */
 PUBLIC BOOL reloading = FALSE;	/* Reloading => send no-cache pragma to proxy */
 PUBLIC char * redirecting_url = NULL;	    /* Location: value. */
 PUBLIC BOOL permanent_redirection = FALSE;  /* Got 301 status? */
@@ -391,37 +393,94 @@ try_again:
 	}
 
 	/*
-	**  Add 'Cookie:' header, if applicable.
+	**  Add Authorization, Proxy-Authorization,
+	**  and/or Cookie headers, if applicable.
 	*/
 	if (using_proxy) {
 	    /*
-	    **  If it's not an HTTP or HTTPS document being proxied,
-	    **  forget about cookies.
+	    **  If we are using a proxy, first determine if
+	    **  we should include an Authorization header
+	    **  and/or Cookie header for the ultimate target
+	    **  of this request. - FM & AJL
 	    */
-	    if (!strncmp(docname, "http", 4)) {
-		char *host2 = NULL, *path2 = NULL;
-		int port = (strncmp(docname, "https", 5) ?
-					       HTTP_PORT : HTTPS_PORT);
-
-		host2 = HTParse(docname, "", PARSE_HOST);
-		path2 = HTParse(docname, "", PARSE_PATH|PARSE_PUNCTUATION);
-		if (host2) {
-		    if ((colon = strchr(host2, ':')) != NULL) {
-		        /*
-			**  Use non-default port number.
-			*/
-		        *colon = '\0';
-			colon++;
-			port = atoi(colon);
-		    }
+	    char *host2 = NULL, *path2 = NULL;
+	    int port2 = (strncmp(docname, "https", 5) ?
+					   HTTP_PORT : HTTPS_PORT);
+	    host2 = HTParse(docname, "", PARSE_HOST);
+	    path2 = HTParse(docname, "", PARSE_PATH|PARSE_PUNCTUATION);
+	    if (host2) {
+		if ((colon = strchr(host2, ':')) != NULL) {
+		    /* Use non-default port number */
+		    *colon = '\0';
+		    colon++;
+		    port2 = atoi(colon);
+		}
+	    }
+	    /*
+	    **  This composeAuth() does file access, i.e., for
+	    **  the ultimate target of the request. - AJL
+	    */
+	    auth_proxy = NO;
+	    if ((auth = HTAA_composeAuth(host2, port2, path2)) != NULL &&
+		*auth != '\0') {
+		/*
+		**  If auth is not NULL nor zero-length, it's
+		**  an Authorization header to be included. - FM
+		*/ 
+		sprintf(line, "%s%c%c", auth, CR, LF);
+		StrAllocCat(command, line);
+		if (TRACE)
+		    fprintf(stderr, "HTTP: Sending authorization: %s\n", auth);
+	    } else if (auth && *auth == '\0') {
+		/*
+		**  If auth is a zero-length string, the user either
+		**  cancelled or goofed at the username and password
+		**  prompt. - FM
+		*/
+		if (!(traversal || dump_output_immediately) &&
+			HTConfirm(
+			    "Proceed without a username and password?")) {
+		    show_401 = TRUE;
+		} else {
+		    if (traversal || dump_output_immediately)
+			HTAlert(
+			    "Can't proceed without a username and password.");
+		    FREE(command);
+		    FREE(hostname);
+		    FREE(docname);
+		    FREE(host2);
+		    FREE(path2);
+		    status = HT_NOT_LOADED;
+		    goto done;
 		}
-		cookie = LYCookie(host2, path2, port, secure);
-		FREE(host2);
-		FREE(path2);
+	    } else {
+		if (TRACE)
+		    fprintf(stderr,
+		    	    "HTTP: Not sending authorization (yet)\n");
+	    }
+	    /*
+	    **  Add 'Cookie:' header, if it's HTTP or HTTPS
+	    **  document being proxied.
+	    */
+	    if (!strncmp(docname, "http", 4)) {
+		cookie = LYCookie(host2, path2, port2, secure);
 	    }
+	    FREE(host2);
+	    FREE(path2);
+	    /*
+	    **  The next composeAuth() will be for the proxy. - AJL
+	    */
+	    auth_proxy = YES;
 	} else {
+	    /*
+	    **  Add cookie for a non-proxied request. - FM
+	    */
 	    cookie = LYCookie(hostname, abspath, portnumber, secure);
+	    auth_proxy = NO;
 	}
+	/*
+	**  If we do have a cookie set, add it to the request buffer. - FM
+	*/
 	if (cookie != NULL) {
 	    if (*cookie != '\0') {
 	        StrAllocCat(command, "Cookie: ");
@@ -434,16 +493,29 @@ try_again:
 	}
 	FREE(abspath);
 
-        if ((auth = HTAA_composeAuth(hostname, portnumber, docname)) != NULL &&
+	/*
+	**  If we are using a proxy, auth_proxy should be YES, and
+	**  we check here whether we want a Proxy-Authorization header
+	**  for it.  If we are not using a proxy, auth_proxy should
+	**  still be NO, and we check here for whether we want an
+	**  Authorization header. - FM & AJL
+	*/
+        if ((auth = HTAA_composeAuth(hostname,
+				     portnumber, docname)) != NULL &&
 	    *auth != '\0') {
 	    /*
 	    **  If auth is not NULL nor zero-length, it's
-	    **  an Authorization header to be included. - FM
+	    **  an Authorization or Proxy-Authorization
+	    **  header to be included. - FM
 	    */ 
             sprintf(line, "%s%c%c", auth, CR, LF);
             StrAllocCat(command, line);
 	    if (TRACE)
-                fprintf(stderr, "HTTP: Sending authorization: %s\n", auth);
+                fprintf(stderr,
+			(using_proxy ?
+			 "HTTP: Sending proxy authorization: %s\n" :
+			 "HTTP: Sending authorization: %s\n"),
+			auth);
 	} else if (auth && *auth == '\0') {
 	    /*
 	    **  If auth is a zero-length string, the user either
@@ -464,7 +536,10 @@ try_again:
 	    }
         } else {
 	    if (TRACE)
-                fprintf(stderr, "HTTP: Not sending authorization (yet)\n");
+                fprintf(stderr,
+			(using_proxy ?
+			 "HTTP: Not sending proxy authorization (yet).\n" :
+			 "HTTP: Not sending authorization (yet).\n"));
         }
         FREE(hostname);
         FREE(docname);
@@ -1229,6 +1304,7 @@ Cookie_continuation:
 		 *  to show the 401 body or restore the current
 		 *  document. - FM
 		 */
+		auth_proxy = NO;
 		if (show_401)
 		    break;
 		if (HTAA_shouldRetryWithAuth(start_of_data, length,
@@ -1271,17 +1347,55 @@ Cookie_continuation:
 
 	      case 407:
 	        /*
-		 *  Proxy Authentication Required.  We'll handle
-		 *  Proxy-Authenticate headers and retry with a
-		 *  Proxy-Authorization header, someday, but for
-		 *  now, apologized to the user and restore the
-		 *  current document. - FM
+		 *  Authorization for proxy server required.
+		 *  If we are not in fact using a proxy, or
+		 *  show_401 is set, proceed to showing the
+		 *  407 body.  Otherwise, if we can set up
+		 *  authorization based on the Proxy-Authenticate
+		 *  header, and the user provides a username and
+		 *  password, try again.  Otherwise, check whether
+		 *  to show the 401 body or restore the current
+		 *  document. - FM & AJL
 		 */
-	        HTAlert(
-		 "Proxy Authentication Required.  Sorry, not yet supported.");
-                HTTP_NETCLOSE(s, handle);
-	        status = HT_NO_DATA;
-	        goto done;
+		if (!using_proxy || show_401)
+		    break;
+		auth_proxy = YES;
+		if (HTAA_shouldRetryWithAuth(start_of_data, length,
+					     (void *)handle, s)) {
+ 		    extern char *authentication_info[2];
+
+                    HTTP_NETCLOSE(s, handle);
+                    if (dump_output_immediately && !authentication_info[0]) {
+                        fprintf(stderr,
+		      		"HTTP: Proxy authorization required.\n");
+                        fprintf(stderr,
+		      		"       Use the -auth=id:pw parameter.\n");
+                        status = HT_NO_DATA;
+                        goto clean_up;
+                    }
+
+                    if (TRACE) 
+                        fprintf(stderr, "%s %d %s\n",
+                              "HTTP: close socket", s,
+                              "to retry with Proxy Authorization");
+
+                    _HTProgress (
+		    	"Retrying with proxy authorization information.");
+		    FREE(line_buffer);
+		    FREE(line_kept_clean);
+                    goto try_again;
+                    break;
+		} else if (!(traversal || dump_output_immediately) &&
+		           HTConfirm("Show the 407 message body?")) {
+		    break;
+                } else {
+		    if (traversal || dump_output_immediately)
+		        HTAlert(
+	"Can't retry with proxy authorization!  Contact the server's WebMaster.");
+		    HTTP_NETCLOSE(s, handle);
+                    status = -1;
+                    goto clean_up;
+		}
 		break;
 
 	      case 408:
diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c
index 99b91295..a09bc6d8 100644
--- a/WWW/Library/Implementation/HTTelnet.c
+++ b/WWW/Library/Implementation/HTTelnet.c
@@ -33,9 +33,9 @@
 #include "HTAlert.h"
 #if !defined (VMS) && !defined (_WINDOWS)
 #include "../../../userdefs.h"  /* for TELNET_COMMAND and RLOGIN_COMMAND */
-#endif /* not VMS or _WINDOWS */
+#endif /* not VMS */
 
-#ifdef _WINDOWS /* ../../.. doesn't work for me WB */
+#ifdef _WINDOWS /* ../../.. doesn't work for me */
 #include "userdefs.h"  /* for TELNET_COMMAND and RLOGIN_COMMAND */
 #endif
 
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index 2c5576b5..536dad08 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -115,9 +115,14 @@ SOLARIS 2
 #define HAVE_GETCWD 1
 #endif
 
+#ifndef USE_SLANG
 #ifndef NO_KEYPAD
 #define HAVE_KEYPAD 1
 #endif
+#ifndef NO_TTYTYPE
+#define HAVE_TTYTYPE 1
+#endif
+#endif /* USE_SLANG */
 
 #ifndef NO_PUTENV
 #define HAVE_PUTENV 1
@@ -127,10 +132,6 @@ SOLARIS 2
 #define HAVE_SIZECHANGE 1
 #endif
 
-#ifndef NO_TTYTYPE
-#define HAVE_TTYTYPE 1
-#endif
-
 #ifndef NO_UNISTD_H
 #define HAVE_UNISTD_H 1
 #endif
diff --git a/WWW/Library/Implementation/HTWAIS.c b/WWW/Library/Implementation/HTWAIS.c
index 264ce263..2bc4c4f6 100644
--- a/WWW/Library/Implementation/HTWAIS.c
+++ b/WWW/Library/Implementation/HTWAIS.c
@@ -107,6 +107,8 @@ PRIVATE char	line[2048];	/* For building strings to display */
 #define PUTS(s) (*target->isa->put_string)(target, s)
 #define START(e) (*target->isa->start_element)(target, e, 0, 0, 0)
 #define END(e) (*target->isa->end_element)(target, e, 0)
+#define MAYBE_END(e) if (HTML_dtd.tags[e].contents != SGML_EMPTY) \
+                        (*target->isa->end_element)(target, e, 0)
 #define FREE_TARGET (*target->isa->_free)(target)
 
 struct _HTStructured {
@@ -562,6 +564,7 @@ PRIVATE void display_search_response ARGS4(
 	    		head->Score,
 	    		head->Lines);
 		PUTS( line);
+	        MAYBE_END(HTML_LI);
       	    } /* next document header */
     	} /* if there were any document headers */
     
diff --git a/WWW/Library/Implementation/HTWSRC.c b/WWW/Library/Implementation/HTWSRC.c
index cca6394d..3d3647b3 100644
--- a/WWW/Library/Implementation/HTWSRC.c
+++ b/WWW/Library/Implementation/HTWSRC.c
@@ -39,6 +39,8 @@ struct _HTStructured {
 #define PUTS(s) (*me->target->isa->put_string)(me->target, s)
 #define START(e) (*me->target->isa->start_element)(me->target, e, 0, 0, 0)
 #define END(e) (*me->target->isa->end_element)(me->target, e, 0)
+#define MAYBE_END(e) if (HTML_dtd.tags[e].contents != SGML_EMPTY) \
+                        (*me->target->isa->end_element)(me->target, e, 0)
 
 
 /*	Here are the parameters which can be specified in a  source file
@@ -329,6 +331,7 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
     if (source_file) {
 	START(HTML_DT);
 	PUTS("Access links");
+	MAYBE_END(HTML_DT);
 	START(HTML_DD);
 	if (me->par_value[PAR_IP_NAME] &&
 	    me->par_value[PAR_DATABASE_NAME]) {
@@ -365,20 +368,25 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
 	    give_parameter(me, PAR_IP_NAME);
 	    give_parameter(me, PAR_DATABASE_NAME);
 	}
+	MAYBE_END(HTML_DD);
     
     } /* end if source_file */
     
     if (me->par_value[PAR_MAINTAINER]) {
 	START(HTML_DT);
 	PUTS("Maintainer");
+	MAYBE_END(HTML_DT);
 	START(HTML_DD);
 	PUTS(me->par_value[PAR_MAINTAINER]);
+	MAYBE_END(HTML_DD);
     }
     if (me->par_value[PAR_IP_NAME]) {
     	START(HTML_DT);
     	PUTS("Host");
+	MAYBE_END(HTML_DT);
     	START(HTML_DD);
     	PUTS(me->par_value[PAR_IP_NAME]);
+	MAYBE_END(HTML_DD);
     }
 
     END(HTML_DL);
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index 7cfbd68d..1ae3a8b1 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -8,6 +8,13 @@
 **	
 **	 6 Feb 93  Binary seraches used. Intreface modified.
 */
+
+/* Remove the following to disable the experimental HTML DTD parsing.
+   Currently only used in this source file. - kw */
+
+#define EXTENDED_HTMLDTD
+
+
 #include "HTUtils.h"
 #include "tcp.h"		/* For FROMASCII */
 
@@ -188,6 +195,12 @@ extern BOOL historical_comments;
 extern BOOL minimal_comments;
 extern BOOL soft_dquotes;
 
+#ifdef USE_COLOR_STYLE
+#include "AttrList.h"
+extern char class_string[TEMPSTRINGSIZE];
+int current_is_class=0;
+#endif
+
 /*	Handle Attribute
 **	----------------
 */
@@ -211,6 +224,11 @@ PRIVATE void handle_attribute_name ARGS2(
     	    context->current_attribute_number = i;
 	    context->present[i] = YES;
 	    FREE(context->value[i]);
+#ifdef USE_COLOR_STYLE
+	current_is_class=(!strcasecomp("class", s));
+	if (TRACE)
+		fprintf(stderr, "SGML: found attribute %s, %d\n", s, current_is_class);
+#endif
 	    return;
 	} /* if */
 	
@@ -232,6 +250,19 @@ PRIVATE void handle_attribute_value ARGS2(
 {
     if (context->current_attribute_number != INVALID) {
 	StrAllocCopy(context->value[context->current_attribute_number], s);
+#ifdef USE_COLOR_STYLE
+        if (current_is_class)
+        {
+                strncpy (class_string, s, TEMPSTRINGSIZE);
+                if (TRACE)
+                fprintf(stderr, "SGML: class is '%s'\n", s);
+        }
+        else
+        {
+                if (TRACE)
+                fprintf(stderr, "SGML: attribute value is '%s'\n", s);
+        }
+#endif
     } else {
         if (TRACE)
 	    fprintf(stderr, "SGML: Attribute value %s ignored\n", s);
@@ -506,6 +537,75 @@ PRIVATE void handle_sgmlatt ARGS1(
 }
 
 
+PRIVATE BOOL element_valid_within ARGS3(
+    HTTag *, 	new_tag,
+    HTTag *,	stacked_tag,
+    BOOL,	direct)
+{
+    TagClass usecontains, usecontained;
+    if (!stacked_tag || !new_tag)
+	return YES;
+    usecontains = (direct ? stacked_tag->contains : stacked_tag->icontains);
+    usecontained = (direct ? new_tag->contained : new_tag->icontained);
+    if (new_tag == stacked_tag)
+	return ((Tgc_same & usecontains) &&
+		(Tgc_same & usecontained));
+    else
+	return ((new_tag->tagclass & usecontains) &&
+		(stacked_tag->tagclass & usecontained));
+}
+
+#ifdef EXTENDED_HTMLDTD
+
+extern BOOL New_DTD;
+
+typedef enum {
+    close_NO	= 0,
+    close_error = 1,
+    close_valid	= 2,
+} canclose_t;
+
+PRIVATE canclose_t can_close ARGS2(
+    HTTag *, 	new_tag,
+    HTTag *,	stacked_tag)
+{
+    if (!stacked_tag)
+	return close_NO;
+    if (stacked_tag->flags & Tgf_endO)
+	return close_valid;
+    else if (new_tag == stacked_tag)
+	return ((Tgc_same & new_tag->canclose) ? close_error : close_NO);
+    else
+	return ((stacked_tag->tagclass & new_tag->canclose) ?
+		close_error : close_NO);
+}
+PRIVATE void do_close_stacked ARGS1(
+    HTStream *,	context)
+{
+    HTElement * stacked = context->element_stack;
+    if (!stacked)
+	return;			/* stack was empty */
+    (*context->actions->end_element)(
+        context->target,
+        stacked->tag - context->dtd->tags,
+        (char **)&context->include);
+    context->element_stack = stacked->next;
+    FREE(stacked);
+}
+PRIVATE int is_on_stack ARGS2(
+	HTStream *,	context,
+	HTTag *,	old_tag)
+{
+    HTElement * stacked = context->element_stack;
+    int i = 1;
+    for (; stacked; stacked = stacked->next, i++) {
+	if (stacked->tag == old_tag)
+	    return i;
+    }
+    return 0;
+}
+#endif /* EXTENDED_HTMLDTD */
+
 /*	End element
 **	-----------
 */
@@ -513,6 +613,57 @@ PRIVATE void end_element ARGS2(
 	HTStream *,	context,
 	HTTag *,	old_tag)
 {
+#ifdef EXTENDED_HTMLDTD
+
+    BOOL extra_action_taken = NO;
+    canclose_t canclose_check = close_valid;
+    int stackpos = is_on_stack(context, old_tag);
+
+    if (New_DTD) {
+	while (canclose_check != close_NO &&
+	       context->element_stack &&
+	       (stackpos > 1 || (!extra_action_taken && stackpos == 0))) {
+	    canclose_check = can_close(old_tag, context->element_stack->tag);
+	    if (canclose_check != close_NO) {
+		if (TRACE)
+		    fprintf(stderr, "SGML: End </%s> \t<- %s end </%s>\n",
+			    context->element_stack->tag->name,
+			    canclose_check == close_valid ? "supplied," : "forced by",
+			    old_tag->name);
+		do_close_stacked(context);
+		extra_action_taken = YES;
+		stackpos = is_on_stack(context, old_tag);
+	    } else {
+		if (TRACE)
+		    fprintf(stderr, "SGML: Still open %s \t<- invalid end </%s>\n",
+			    context->element_stack->tag->name,
+			    old_tag->name);
+		return;
+	    }
+	}
+
+	if (stackpos == 0 && old_tag->contents != SGML_EMPTY) {
+	    if (TRACE)
+		fprintf(stderr, "SGML: Still open %s, no open %s for </%s>\n",
+			context->element_stack ?
+			context->element_stack->tag->name : "none",
+			old_tag->name,
+			old_tag->name);
+	    return;
+	}
+	if (stackpos > 1) {
+	    if (TRACE)
+		fprintf(stderr, "SGML: Nesting <%s>...<%s> \t<- invalid end </%s>\n",
+			old_tag->name,
+			context->element_stack->tag->name,
+			old_tag->name);
+	    return;
+	}
+    }
+    /* Now let the old code deal with the rest... - kw */
+
+#endif /* EXTENDED_HTMLDTD */
+
     if (TRACE)
         fprintf(stderr, "SGML: End </%s>\n", old_tag->name);
     if (old_tag->contents == SGML_EMPTY) {
@@ -568,7 +719,73 @@ PRIVATE void start_element ARGS1(
 	HTStream *,	context)
 {
     HTTag * new_tag = context->current_tag;
+
+#ifdef EXTENDED_HTMLDTD
+
+    BOOL valid = YES;
+    BOOL direct_container = YES;
+    BOOL extra_action_taken = NO;
+    canclose_t canclose_check = close_valid;
+
+    if (New_DTD) {
+	while (context->element_stack &&
+	       (canclose_check == close_valid ||
+		(canclose_check == close_error &&
+		 new_tag == context->element_stack->tag)) &&
+	       !(valid = element_valid_within(new_tag, context->element_stack->tag,
+					      direct_container))) {
+	    canclose_check = can_close(new_tag, context->element_stack->tag);
+	    if (canclose_check != close_NO) {
+		if (TRACE)
+		    fprintf(stderr, "SGML: End </%s> \t<- %s start <%s>\n",
+			    context->element_stack->tag->name,
+			    canclose_check == close_valid ? "supplied," : "forced by",
+			    new_tag->name);
+		do_close_stacked(context);
+		extra_action_taken = YES;
+		if (canclose_check  == close_error)
+		    direct_container = NO;
+	    } else {
+		if (TRACE)
+		    fprintf(stderr, "SGML: Still open %s \t<- invalid start <%s>\n",
+			    context->element_stack->tag->name,
+			    new_tag->name);
+	    }
+	}
+
+	if (context->element_stack && !extra_action_taken &&
+	    canclose_check == close_NO && !valid && (new_tag->flags & Tgf_mafse)) {
+	    BOOL has_attributes = NO;
+	    int i = 0;
+	    for (; i< new_tag->number_of_attributes && !has_attributes; i++)
+		has_attributes = context->present[i];
+	    if (!has_attributes) {
+		if (TRACE)
+		    fprintf(stderr, "SGML: Still open %s, converting invalid <%s> to </%s>\n",
+			    context->element_stack->tag->name,
+			    new_tag->name,
+			    new_tag->name);
+		end_element(context, new_tag);
+		return;
+	    }
+	}
     
+	if (context->element_stack &&
+	    canclose_check == close_error && !(valid =
+					       element_valid_within(
+						   new_tag,
+						   context->element_stack->tag,
+						   direct_container))) {
+	    if (TRACE)
+		fprintf(stderr, "SGML: Still open %s \t<- invalid start <%s>\n",
+			context->element_stack->tag->name,
+			new_tag->name);
+	}
+    }
+    /* fall through to the old code - kw */
+
+#endif /* EXTENDED_HTMLDTD */
+
     if (TRACE)
         fprintf(stderr, "SGML: Start <%s>\n", new_tag->name);
     (*context->actions->start_element)(
@@ -677,6 +894,7 @@ PUBLIC void SGML_abort ARGS2(
 	HTError, 	e)
 {
     int i;
+    HTElement * cur;
 
     /*
     **  Abort the target. - FM
@@ -692,6 +910,15 @@ PUBLIC void SGML_abort ARGS2(
     FREE(context->csi);
 
     /*
+    **  Free stack memory if any elements were left open. - kw
+    */
+    while (context->element_stack) {
+        cur = context->element_stack;
+	context->element_stack = cur->next;	/* Remove from stack */
+	FREE(cur);
+    }
+
+    /*
     **  Free the strings and context structure. - FM
     */
     HTChunkFree(context->string);
@@ -901,6 +1128,8 @@ top1:
 	    		  (context->element_stack->tag->contents ==
 			  		SGML_MIXED ||
 			   context->element_stack->tag->contents ==
+			  		SGML_PCDATA ||
+			   context->element_stack->tag->contents ==
 			      		SGML_RCDATA)))) {
 	    /*
 	    **  Setting up for possible entity, without the leading '&'. - FM
@@ -1132,20 +1361,6 @@ top1:
 	    PUTC('#');
 	    context->state = S_text;
 	    goto top1;
-	} else if (unsign_c > 127 || isalnum((unsigned char)c)) {
-	    /*
-	    **  We have digit(s), but not a valid terminator,
-	    **  so recover the "&#" and digit(s) and recycle
-	    **  the character. - FM
-	    */
-	    int i;
-	    PUTC('&');
-	    PUTC('#');
-	    for (i = 0; i < string->size; i++)	/* recover */
-	       PUTC(string->data[i]);
-	    string->size = 0;
-	    context->state = S_text;
-	    goto top1;
 	} else {
 	    /*
 	    **  Terminate the numeric entity and try to handle it. - FM
@@ -1837,6 +2052,14 @@ top1:
 	    } else {
 		BOOL tag_OK = (c == '>' || WHITE(c));
 	        context->current_tag = t;
+#ifdef EXTENDED_HTMLDTD
+		/*
+		**  Just handle ALL end tags normally :-) - kw
+		*/
+		if (New_DTD) {
+		    end_element( context, context->current_tag);
+		} else
+#endif /* EXTENDED_HTMLDTD */
 		if (tag_OK &&
 		    (!strcasecomp(string->data, "DD") ||
 		     !strcasecomp(string->data, "DT") ||
@@ -1894,44 +2117,22 @@ top1:
 		    }
 		    break;
 		} else if (tag_OK &&
-			   !strcasecomp(string->data, "FONT")) {
-		    /*
-		    **  Treat a FONT end tag as a FONT start tag with
-		    **  a dummy END attribute.  It's too likely to be
-		    **  interdigited and mess up the parsing, so we've
-		    **  declared FONT as SGML_EMPTY and will handle the
-		    **  end tag in HTML_start_element. - FM
-		    */
-		    if (TRACE)
-		        fprintf(stderr,
-				"SGML: `</%s%c' found!  Treating as '<%s%c'.\n",
-				string->data, c, string->data, c);
-		    {
-		        int i;
-			for (i = 0;
-			     i < context->current_tag->number_of_attributes;
-			     i++) {
-			    context->present[i] = (i == HTML_FONT_END);
-			}
-		    }
-		    string->size = 0;
-		    context->current_attribute_number = INVALID;
-		    if (context->current_tag->name)
-			start_element(context);
-		    if (c != '>') {
-			context->state = S_junk_tag;
-		    } else {
-			context->state = S_text;
-		    }
-		    break;
-		} else if (tag_OK &&
-			   !strcasecomp(string->data, "FORM")) {
+			   (!strcasecomp(string->data, "A") ||
+			    !strcasecomp(string->data, "B") ||
+			    !strcasecomp(string->data, "BLINK") ||
+			    !strcasecomp(string->data, "CITE") ||
+			    !strcasecomp(string->data, "EM") ||
+			    !strcasecomp(string->data, "FONT") ||
+			    !strcasecomp(string->data, "FORM") ||
+			    !strcasecomp(string->data, "I") ||
+			    !strcasecomp(string->data, "STRONG") ||
+			    !strcasecomp(string->data, "U"))) {
 		    /*
-		    **  Handle a FORM end tag.  We declared FORM
-		    **  as SGML_EMPTY to prevent "expected tag
-		    **  substitution" and avoid throwing the
-		    **  HTML.c stack out of whack (Wow, what
-		    **  a hack! 8-). - FM
+		    **  Handle end tags for container elements declared
+		    **  as SGML_EMPTY to prevent "expected tag substitution"
+		    **  but still processed via HTML_end_element() in HTML.c
+		    **  with checks there to avoid throwing the HTML.c stack
+		    **  out of whack (Ugh, what a hack! 8-). - FM
 		    */
 		    if (TRACE)
 		        fprintf(stderr, "SGML: End </%s>\n", string->data);
diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h
index 7ab47c82..2a9f985c 100644
--- a/WWW/Library/Implementation/SGML.h
+++ b/WWW/Library/Implementation/SGML.h
@@ -38,7 +38,8 @@ typedef enum _SGMLContent{
   SGML_CDATA,    /* character data. recognize </ only */
   SGML_RCDATA,   /* replaceable character data. recognize </ and &ref; */
   SGML_MIXED,    /* elements and parsed character data. recognize all markup */
-  SGML_ELEMENT   /* any data found will be returned as an error*/
+  SGML_ELEMENT,  /* any data found will be returned as an error*/
+  SGML_PCDATA    /* added - kw */
   } SGMLContent;
 
 
@@ -47,6 +48,50 @@ typedef struct {
                                 /* Could put type info in here */
 } attr;
 
+typedef enum _TagClass {
+    /* textflow */
+    Tgc_FONTlike	= 0x00001,/* S,STRIKE,I,B,TT,U,BIG,SMALL,STYLE,BLINK;BR,TAB */
+    Tgc_EMlike		= 0x00002, /* EM,STRONG,DFN,CODE,SAMP,KBD,VAR,CITE,Q,INS,DEL,SPAN,.. */
+    Tgc_MATHlike	= 0x00004, /* SUB,SUP,MATH,COMMENT */
+    Tgc_Alike		= 0x00008, /* A */
+    Tgc_formula		= 0x00010, /* not used until math is supported better... */
+    /* used for special structures: forms, tables,... */
+    Tgc_TRlike		= 0x00020,/* TR and similar */
+    Tgc_SELECTlike	= 0x00040,/* SELECT,INPUT,TEXTAREA(,...) */
+    /* structure */
+    Tgc_FORMlike	= 0x00080,/* FORM itself */
+    Tgc_Plike		= 0x00100, /* P,H1..H6,... structures containing text or
+				    insertion but not other structures */
+    Tgc_DIVlike		= 0x00200, /* ADDRESS,FIG,BDO,NOTE,FN,DIV,CENTER;FIG
+				    structures which can contain other structures */
+    Tgc_LIlike		= 0x00400, /* LH,LI,DT,DD;TH,TD structure-like, only valid
+				    within certain other structures */
+    Tgc_ULlike		= 0x00800, /* UL,OL,DL,DIR,MENU;TABLE;XMP,LISTING
+				    special in some way, cannot contain (parsed)
+				    text directly */
+    /* insertions */
+    Tgc_BRlike		= 0x01000,/* BR,IMG,TAB allowed in any text */
+    Tgc_APPLETlike	= 0x02000, /* APPLET,OBJECT,EMBED,SCRIPT */
+    Tgc_HRlike		= 0x04000, /* HR,MARQUEE can contain all kinds of things
+				    and/or are not allowed (?) in running text */
+    Tgc_MAPlike		= 0x08000, /* MAP,AREA some specials that never contain
+				    (directly or indirectly) other things than
+				    special insertions */
+    Tgc_outer		= 0x10000, /* HTML,FRAMESET,FRAME,PLAINTEXT; */
+    Tgc_BODYlike	= 0x20000, /* BODY,BODYTEXT,NOFRAMES,TEXTFLOW; */
+    Tgc_HEADstuff	= 0x40000, /* HEAD,BASE,STYLE,TITLE; */
+    /* special relations */
+    Tgc_same		= 0x80000
+} TagClass;
+
+/* Some more properties of tags (or rather, elements) and rules how
+   to deal with them. - kw */
+typedef enum _TagFlags {
+    Tgf_endO		= 0x00001, /* end tag can be Omitted */
+    Tgf_startO		= 0x00002, /* start tag can be Omitted */
+    Tgf_mafse   	= 0x00004  /* Make Attribute-Free Start-tag End instead
+				      (if found invalid) */
+} TagFlags;
 
 /*              A tag structure describes an SGML element.
 **              -----------------------------------------
@@ -68,6 +113,14 @@ struct _tag{
     attr *      attributes;             /* The list of acceptable attributes */
     int         number_of_attributes;   /* Number of possible attributes */
     SGMLContent contents;               /* End only on end tag @@ */
+    TagClass	tagclass,
+	contains,	/* which classes of elements this one can contain directly */
+	icontains,	/* which classes of elements this one can contain indirectly */
+	contained,	/* in which classes can this tag be contained ? */
+	icontained,	/* in which classes can this tag be indirectly contained ? */
+	canclose;	/* which classes of elements can this one close
+			   if something looks wrong ? */
+    TagFlags	flags;
 };
 
 
diff --git a/WWW/Library/Implementation/tcp.h b/WWW/Library/Implementation/tcp.h
index 7f38e545..f51dfc72 100644
--- a/WWW/Library/Implementation/tcp.h
+++ b/WWW/Library/Implementation/tcp.h
@@ -65,6 +65,8 @@ typedef struct sockaddr_in SockA;  /* See netinet/in.h */
 #define STDIO_H
 #endif /* !STDIO_H */
 
+#include <sys/types.h>
+
 #if HAVE_DIRENT_H
 # include <dirent.h>
 # define D_NAMLEN(dirent) strlen((dirent)->d_name)
@@ -612,6 +614,28 @@ Defaults
 #endif  /* TCP includes */
 
 /*
+
+ROUGH ESTIMATE OF MAX PATH LENGTH
+
+*/
+#ifndef HT_MAX_PATH
+#ifdef MAXPATHLEN
+#define HT_MAX_PATH MAXPATHLEN
+#else
+#ifdef PATH_MAX
+#define HT_MAX_PATH PATH_MAX
+#else
+#define HT_MAX_PATH 1024                        /* Any better ideas? */
+#endif
+#endif
+#endif /* HT_MAX_PATH */
+
+#if HT_MAX_PATH < 256
+#undef HT_MAX_PATH
+#define HT_MAX_PATH 256
+#endif
+
+/*
   MACROS FOR MANIPULATING MASKS FOR SELECT()
  */
 #ifdef SELECT
diff --git a/aclocal.m4 b/aclocal.m4
index a53e46b5..6c5a5f38 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -76,6 +76,23 @@ ifelse($3,,[    :]dnl
 ])dnl
   ])])dnl
 dnl ---------------------------------------------------------------------------
+dnl Check if curses.h defines TRUE/FALSE (it does under SVr4).
+AC_DEFUN([CF_BOOL_DEFS],
+[
+AC_MSG_CHECKING(if TRUE/FALSE are defined)
+AC_CACHE_VAL(cf_cv_bool_defs,[
+AC_TRY_COMPILE([
+#include <curses.h>
+#include <stdio.h>],[int x = TRUE, y = FALSE],
+	[cf_cv_bool_defs=yes],
+	[cf_cv_bool_defs=no])])
+AC_MSG_RESULT($cf_cv_bool_defs)
+if test "$cf_cv_bool_defs" = no ; then
+	AC_DEFINE(TRUE,(1))
+	AC_DEFINE(FALSE,(0))
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl Check if curses supports color.  (Note that while SVr3 curses supports
 dnl color, it does this differently from SVr4 curses; more work would be needed
 dnl to accommodate SVr3).
@@ -89,7 +106,9 @@ AC_CACHE_VAL(cf_cv_color_curses,[
 ],
 	[has_colors();
 	 start_color();
+#ifndef NCURSES_BROKEN
 	 wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */
+#endif
 	],
 	[cf_cv_color_curses=yes],
 	[cf_cv_color_curses=no])
@@ -279,22 +298,26 @@ AC_DEFUN([CF_MAKE_INCLUDE],
 AC_MSG_CHECKING(for style of include in makefiles)
 make_include_left=""
 make_include_right=""
-make_include_quote=""
+make_include_quote="unknown"
 for cf_include in "include" ".include" "!include"
 do
-	for cf_quote in ' ' '"'
+	for cf_quote in '' '"'
 	do
 		cat >WWW/Library/unix/makefile <<CF_EOF
+SHELL=/bin/sh
 ${cf_include} ${cf_quote}../../Library/Implementation/Version.make${cf_quote}
 all :
 	@echo 'cf_make_include=OK'
 CF_EOF
 	cf_make_include=""
-	eval `cd WWW/Library/unix && ${MAKE-make} 2>/dev/null | grep cf_make_include=OK`
+	eval `cd WWW/Library/unix && ${MAKE-make} 2>&5 | grep cf_make_include=OK`
 	if test -n "$cf_make_include"; then
 		make_include_left="$cf_include"
 		make_include_quote="$cf_quote"
 		break
+	else
+		echo Tried 1>&5
+		cat WWW/Library/unix/makefile 1>&5
 	fi
 	done
 	test -n "$cf_make_include" && break
@@ -303,7 +326,7 @@ done
 if test -z "$make_include_left" ; then
 	AC_ERROR(Your $ac_make program does not support includes)
 fi
-if test -n "$make_include_quote" ; then
+if test ".$make_include_quote" != .unknown ; then
 	make_include_left="$make_include_left $make_include_quote"
 	make_include_right="$make_include_quote"
 fi
@@ -312,6 +335,27 @@ AC_SUBST(make_include_left)
 AC_SUBST(make_include_right)
 ])
 dnl ---------------------------------------------------------------------------
+dnl Check for pre-1.9.9g ncurses (among other problems, the most obvious is
+dnl that color combinations don't work).
+AC_DEFUN([CF_NCURSES_BROKEN],
+[AC_CACHE_VAL(cf_cv_ncurses_broken,[
+AC_TRY_COMPILE([
+#include <curses.h>],[
+#if defined(NCURSES_VERSION) && defined(wgetbkgd)
+	make an error
+#else
+	int x = 1
+#endif
+],
+	[cf_cv_ncurses_broken=no],
+	[cf_cv_ncurses_broken=yes])
+])
+if test "$cf_cv_ncurses_broken" = yes ; then
+	AC_MSG_WARN(hmm... you should get an up-to-date version of ncurses)
+	AC_DEFINE(NCURSES_BROKEN)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
 dnl the CPPFLAGS variable.
 dnl
@@ -341,7 +385,7 @@ AC_CACHE_VAL(cf_cv_ncurses_header,[
 			curses.h \
 			ncurses.h
 		do
-			if egrep "NCURSES" $cf_incdir/$cf_header >/dev/null 2>&1; then
+			if egrep "NCURSES" $cf_incdir/$cf_header 1>&5 2>&1; then
 				cf_cv_ncurses_header=$cf_incdir/$cf_header 
 				test -n "$verbose" && echo $ac_n "	... found $ac_c" 1>&6
 				break
@@ -410,6 +454,37 @@ AC_CHECK_LIB(gpm,Gpm_Open,[
 	[AC_CHECK_LIB(ncurses,initscr)])
 ])])
 dnl ---------------------------------------------------------------------------
+dnl Check for the version of ncurses, to aid in reporting bugs, etc.
+AC_DEFUN([CF_NCURSES_VERSION],
+[AC_MSG_CHECKING(for ncurses version)
+AC_CACHE_VAL(cf_cv_ncurses_version,[
+	cf_cv_ncurses_version=no
+	cat > conftest.$ac_ext <<EOF
+#ifdef NCURSESHEADER
+#include <ncurses.h>
+#else
+#include <curses.h>
+#endif
+#ifdef NCURSES_VERSION
+Autoconf NCURSES_VERSION
+#else
+#ifdef __NCURSES_H
+Autoconf "old"
+#endif
+#endif
+EOF
+	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
+	AC_TRY_EVAL(cf_try)
+	if test -f conftest.out ; then
+changequote(,)dnl
+		cf_out=`cat conftest.out | sed -e 's@^[^\"]*\"@@' -e 's@\".*@@'`
+changequote([,])dnl
+		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
+	fi
+])
+AC_MSG_RESULT($cf_cv_ncurses_version)
+])
+dnl ---------------------------------------------------------------------------
 dnl After checking for functions in the default $LIBS, make a further check
 dnl for the functions that are netlib-related (these aren't always in the
 dnl libc, etc., and have to be handled specially because there are conflicting
@@ -450,6 +525,40 @@ AC_CHECK_FUNC(strcasecmp,[AC_DEFINE(HAVE_STRCASECMP)],[
 LIBS="$LIBS $NETLIBS"
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl Check for the symbol NGROUPS
+AC_DEFUN([CF_NGROUPS],
+[
+AC_MSG_CHECKING(if NGROUPS is defined)
+AC_CACHE_VAL(cf_cv_ngroups,[
+AC_TRY_COMPILE([
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+],[int x = NGROUPS],
+	[cf_cv_ngroups=yes],
+	[AC_TRY_COMPILE([
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+],[int x = NGROUPS_MAX],
+		[cf_cv_ngroups=NGROUPS_MAX],
+		[cf_cv_ngroups=no])
+	])
+AC_MSG_RESULT($cf_cv_ngroups)
+if test "$cf_cv_ngroups" = no ; then
+	AC_DEFINE(NGROUPS,16)
+elif test "$cf_cv_ngroups" = NGROUPS_MAX ; then
+	AC_DEFINE(NGROUPS,NGROUPS_MAX)
+fi
+])
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl Check for a given program, defining corresponding symbol.
 dnl	$1 = environment variable, which is suffixed by "_PATH" in the #define.
 dnl	$2 = program name to find.
@@ -579,13 +688,16 @@ AC_DEFUN([CF_SLANG_CPPFLAGS],
 [
 AC_MSG_CHECKING(for slang header file)
 AC_CACHE_VAL(cf_cv_slang_header,[
+	AC_TRY_COMPILE([#include <slang.h>],
+	[printf("%s\n", SLANG_VERSION)],
+	[cf_cv_slang_header=predefined],[
 	CF_HEADER_PATH(cf_search,slang)
 	for cf_incdir in $cf_search
 	do
 		for cf_header in \
 			slang.h
 		do
-			if egrep "SLANG_VERSION" $cf_incdir/$cf_header >/dev/null 2>&1; then
+			if egrep "SLANG_VERSION" $cf_incdir/$cf_header 1>&5 2>&1; then
 				cf_cv_slang_header=$cf_incdir/$cf_header 
 				break
 			fi
@@ -593,7 +705,7 @@ AC_CACHE_VAL(cf_cv_slang_header,[
 		test -n "$cf_cv_slang_header" && break
 	done
 	test -z "$cf_cv_slang_header" && AC_ERROR(not found)
-	])
+	])])
 AC_MSG_RESULT($cf_cv_slang_header)
 AC_DEFINE(USE_SLANG)
 changequote(,)dnl
@@ -611,7 +723,7 @@ AC_DEFUN([CF_SLANG_LIBS],
 		[LIBS="-lslang $LIBS"],
 		[AC_CHECK_LIB(slang,SLtt_get_screen_size,
 			[LIBS="-lslang -lm $LIBS"],
-			AC_ERROR(cannot link -lslang),"-lm")])])
+			AC_ERROR(cannot link -lslang),"-lm")],"-lm")])
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
diff --git a/config.guess b/config.guess
index e9e44559..5bb9a89d 100755
--- a/config.guess
+++ b/config.guess
@@ -141,6 +141,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     VAX*:ULTRIX*:*:*)
 	echo vax-dec-ultrix${UNAME_RELEASE}
 	exit 0 ;;
+    2020:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit 0 ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
 	sed 's/^	//' << EOF >dummy.c
 	int main (argc, argv) int argc; char **argv; {
diff --git a/config.hin b/config.hin
index 48116ae8..645f1a6c 100644
--- a/config.hin
+++ b/config.hin
@@ -1,3 +1,11 @@
+/* The configure script translates "config.hin" into "lynx_cfg.h" */
+#undef USE_COLOR_STYLE		/* FIXME: was 'CS' */
+#undef SLCS			/* FIXME: rename to USE_SLANG_STYLE */
+#undef USEHASH			/* FIXME: rename to USE_HASHING */
+#undef UNPAINT_CACHE		/* FIXME: for RP's code */
+/* #undef TEST			** FIXME: for RP's code */
+#undef LINKEDSTYLES		/* FIXME: for RP's code */
+/* #undef EXP_CHARTRANS		** FIXME: for character-translations */
 #undef ALT_CHAR_SET
 #undef CHMOD_PATH		/* CF_PATH_PROG(chmod) */
 #undef COLOR_CURSES		/* defined by CF_COLOR_CURSES */
@@ -36,9 +44,11 @@
 #undef MKDIR_PATH		/* CF_PATH_PROG(mkdir) */
 #undef MV_PATH			/* CF_PATH_PROG(mv) */
 #undef NCURSES			/* defined for ncurses support */
+#undef NCURSES_BROKEN		/* defined for ncurses color support */
 #undef NCURSESHEADER		/* defined if we include <ncurses.h> */
 #undef NEED_PTEM_H		/* defined by CF_SIZECHANGE */
 #undef NEED_REMOVE		/* defined by CF_REMOVE_BROKEN */
+#undef NGROUPS			/* defined by CF_NGROUPS */
 #undef NO_PARENT_DIR_REFERENCE	/* configure --disable-parent-dir */
 #undef RM_PATH			/* CF_PATH_PROG(rm) */
 #undef STDC_HEADERS
@@ -73,7 +83,6 @@
 /* FIXME:HP_TERMINAL */
 /* FIXME:ISC */
 /* FIXME:LONG_LIST */
-/* FIXME:LY_FIND_LEAKS */
 /* FIXME:NEXT */
 /* FIXME:NOPORT */
 /* FIXME:NO_CHANGE_EXECUTE_PERMS */
@@ -98,7 +107,6 @@
 /* FIXME:SYSLOG_REQUESTED_URLS */
 /* FIXME:TRUE=1 */
 /* FIXME:UNDERLINE_LINKS */
-/* FIXME:UNIXWARE */
 /* FIXME:USG */
 /* FIXME:_BSD=44 */
 /* FIXME:_BUILTINS */
@@ -110,4 +118,3 @@
 /* FIXME:__STDC__ */
 /* FIXME:_locp=__lc_locale */
 /* FIXME:loc_t=_LC_locale_t */
-/* This is a template for the configure script, which produces config.h */
diff --git a/configure b/configure
index 1a728b32..8627b01b 100755
--- a/configure
+++ b/configure
@@ -18,6 +18,8 @@ ac_help="$ac_help
   --with-screen=XXX       select screen type
                           (XXX is curses (default), ncurses or slang)"
 ac_help="$ac_help
+  --with-color-style=XXX  enable color style (types are ncurses, slang)"
+ac_help="$ac_help
   --disable-parent-dir-refs
                           disable \"Up-to\" parent-links in directory listings"
 ac_help="$ac_help
@@ -564,7 +566,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:568: checking host system type" >&5
+echo "configure:570: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -589,7 +591,7 @@ echo "$ac_t""$host" 1>&6
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:593: checking for $ac_word" >&5
+echo "configure:595: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -618,7 +620,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:622: checking for $ac_word" >&5
+echo "configure:624: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -666,7 +668,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:670: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:672: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -676,11 +678,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 680 "configure"
+#line 682 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -700,12 +702,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:704: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:706: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:709: checking whether we are using GNU C" >&5
+echo "configure:711: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -714,7 +716,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:718: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:720: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -729,7 +731,7 @@ if test $ac_cv_prog_gcc = yes; then
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:733: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:735: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -757,7 +759,7 @@ else
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:761: checking how to run the C preprocessor" >&5
+echo "configure:763: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -772,13 +774,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 776 "configure"
+#line 778 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:782: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -789,13 +791,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 793 "configure"
+#line 795 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -820,7 +822,7 @@ echo "$ac_t""$CPP" 1>&6
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:824: checking for $ac_word" >&5
+echo "configure:826: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -847,7 +849,7 @@ else
 fi
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:851: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:853: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -875,25 +877,29 @@ fi
 
 
 echo $ac_n "checking for style of include in makefiles""... $ac_c" 1>&6
-echo "configure:879: checking for style of include in makefiles" >&5
+echo "configure:881: checking for style of include in makefiles" >&5
 make_include_left=""
 make_include_right=""
-make_include_quote=""
+make_include_quote="unknown"
 for cf_include in "include" ".include" "!include"
 do
-	for cf_quote in ' ' '"'
+	for cf_quote in '' '"'
 	do
 		cat >WWW/Library/unix/makefile <<CF_EOF
+SHELL=/bin/sh
 ${cf_include} ${cf_quote}../../Library/Implementation/Version.make${cf_quote}
 all :
 	@echo 'cf_make_include=OK'
 CF_EOF
 	cf_make_include=""
-	eval `cd WWW/Library/unix && ${MAKE-make} 2>/dev/null | grep cf_make_include=OK`
+	eval `cd WWW/Library/unix && ${MAKE-make} 2>&5 | grep cf_make_include=OK`
 	if test -n "$cf_make_include"; then
 		make_include_left="$cf_include"
 		make_include_quote="$cf_quote"
 		break
+	else
+		echo Tried 1>&5
+		cat WWW/Library/unix/makefile 1>&5
 	fi
 	done
 	test -n "$cf_make_include" && break
@@ -902,7 +908,7 @@ done
 if test -z "$make_include_left" ; then
 	{ echo "configure: error: Your $ac_make program does not support includes" 1>&2; exit 1; }
 fi
-if test -n "$make_include_quote" ; then
+if test ".$make_include_quote" != .unknown ; then
 	make_include_left="$make_include_left $make_include_quote"
 	make_include_right="$make_include_quote"
 fi
@@ -921,7 +927,7 @@ echo "$ac_t""${make_include_left}file${make_include_right}" 1>&6
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:925: checking for a BSD compatible install" >&5
+echo "configure:931: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -972,7 +978,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
 echo $ac_n "checking if you want full utility pathnames""... $ac_c" 1>&6
-echo "configure:976: checking if you want full utility pathnames" >&5
+echo "configure:982: checking if you want full utility pathnames" >&5
 # Check whether --enable-full-paths or --disable-full-paths was given.
 if test "${enable_full_paths+set}" = set; then
   enableval="$enable_full_paths"
@@ -992,7 +998,7 @@ echo "$ac_t""$with_full_paths" 1>&6
 
 
 echo $ac_n "checking for system mailer""... $ac_c" 1>&6
-echo "configure:996: checking for system mailer" >&5
+echo "configure:1002: checking for system mailer" >&5
 if eval "test \"`echo '$''{'cf_cv_SYSTEM_MAIL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1019,7 +1025,7 @@ EOF
 
 
 echo $ac_n "checking system mail flags""... $ac_c" 1>&6
-echo "configure:1023: checking system mail flags" >&5
+echo "configure:1029: checking system mail flags" >&5
 if eval "test \"`echo '$''{'cf_cv_system_mail_flags'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1047,7 +1053,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "chmod", so it can be a program name with args.
 set dummy chmod; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1051: checking for $ac_word" >&5
+echo "configure:1057: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_CHMOD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1078,7 +1084,7 @@ fi
 
 else
 	echo $ac_n "checking for chmod""... $ac_c" 1>&6
-echo "configure:1082: checking for chmod" >&5
+echo "configure:1088: checking for chmod" >&5
 	echo "$ac_t""$CHMOD" 1>&6
 fi
 
@@ -1112,7 +1118,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "compress", so it can be a program name with args.
 set dummy compress; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1116: checking for $ac_word" >&5
+echo "configure:1122: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_COMPRESS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1143,7 +1149,7 @@ fi
 
 else
 	echo $ac_n "checking for compress""... $ac_c" 1>&6
-echo "configure:1147: checking for compress" >&5
+echo "configure:1153: checking for compress" >&5
 	echo "$ac_t""$COMPRESS" 1>&6
 fi
 
@@ -1177,7 +1183,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "cp", so it can be a program name with args.
 set dummy cp; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1181: checking for $ac_word" >&5
+echo "configure:1187: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_COPY'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1208,7 +1214,7 @@ fi
 
 else
 	echo $ac_n "checking for cp""... $ac_c" 1>&6
-echo "configure:1212: checking for cp" >&5
+echo "configure:1218: checking for cp" >&5
 	echo "$ac_t""$COPY" 1>&6
 fi
 
@@ -1242,7 +1248,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "gzip", so it can be a program name with args.
 set dummy gzip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1246: checking for $ac_word" >&5
+echo "configure:1252: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GZIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1273,7 +1279,7 @@ fi
 
 else
 	echo $ac_n "checking for gzip""... $ac_c" 1>&6
-echo "configure:1277: checking for gzip" >&5
+echo "configure:1283: checking for gzip" >&5
 	echo "$ac_t""$GZIP" 1>&6
 fi
 
@@ -1307,7 +1313,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "install", so it can be a program name with args.
 set dummy install; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1311: checking for $ac_word" >&5
+echo "configure:1317: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_INSTALL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1338,7 +1344,7 @@ fi
 
 else
 	echo $ac_n "checking for install""... $ac_c" 1>&6
-echo "configure:1342: checking for install" >&5
+echo "configure:1348: checking for install" >&5
 	echo "$ac_t""$INSTALL" 1>&6
 fi
 
@@ -1372,7 +1378,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "mkdir", so it can be a program name with args.
 set dummy mkdir; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1376: checking for $ac_word" >&5
+echo "configure:1382: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1403,7 +1409,7 @@ fi
 
 else
 	echo $ac_n "checking for mkdir""... $ac_c" 1>&6
-echo "configure:1407: checking for mkdir" >&5
+echo "configure:1413: checking for mkdir" >&5
 	echo "$ac_t""$MKDIR" 1>&6
 fi
 
@@ -1437,7 +1443,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "mv", so it can be a program name with args.
 set dummy mv; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1441: checking for $ac_word" >&5
+echo "configure:1447: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1468,7 +1474,7 @@ fi
 
 else
 	echo $ac_n "checking for mv""... $ac_c" 1>&6
-echo "configure:1472: checking for mv" >&5
+echo "configure:1478: checking for mv" >&5
 	echo "$ac_t""$MV" 1>&6
 fi
 
@@ -1502,7 +1508,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "rm", so it can be a program name with args.
 set dummy rm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1506: checking for $ac_word" >&5
+echo "configure:1512: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1533,7 +1539,7 @@ fi
 
 else
 	echo $ac_n "checking for rm""... $ac_c" 1>&6
-echo "configure:1537: checking for rm" >&5
+echo "configure:1543: checking for rm" >&5
 	echo "$ac_t""$RM" 1>&6
 fi
 
@@ -1567,7 +1573,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "tar", so it can be a program name with args.
 set dummy tar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1571: checking for $ac_word" >&5
+echo "configure:1577: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1598,7 +1604,7 @@ fi
 
 else
 	echo $ac_n "checking for tar""... $ac_c" 1>&6
-echo "configure:1602: checking for tar" >&5
+echo "configure:1608: checking for tar" >&5
 	echo "$ac_t""$TAR" 1>&6
 fi
 
@@ -1632,7 +1638,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "touch", so it can be a program name with args.
 set dummy touch; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1636: checking for $ac_word" >&5
+echo "configure:1642: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_TOUCH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1663,7 +1669,7 @@ fi
 
 else
 	echo $ac_n "checking for touch""... $ac_c" 1>&6
-echo "configure:1667: checking for touch" >&5
+echo "configure:1673: checking for touch" >&5
 	echo "$ac_t""$TOUCH" 1>&6
 fi
 
@@ -1697,7 +1703,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "gunzip", so it can be a program name with args.
 set dummy gunzip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1701: checking for $ac_word" >&5
+echo "configure:1707: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_UNCOMPRESS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1728,7 +1734,7 @@ fi
 
 else
 	echo $ac_n "checking for gunzip""... $ac_c" 1>&6
-echo "configure:1732: checking for gunzip" >&5
+echo "configure:1738: checking for gunzip" >&5
 	echo "$ac_t""$UNCOMPRESS" 1>&6
 fi
 
@@ -1762,7 +1768,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "unzip", so it can be a program name with args.
 set dummy unzip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1766: checking for $ac_word" >&5
+echo "configure:1772: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_UNZIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1793,7 +1799,7 @@ fi
 
 else
 	echo $ac_n "checking for unzip""... $ac_c" 1>&6
-echo "configure:1797: checking for unzip" >&5
+echo "configure:1803: checking for unzip" >&5
 	echo "$ac_t""$UNZIP" 1>&6
 fi
 
@@ -1827,7 +1833,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "uudecode", so it can be a program name with args.
 set dummy uudecode; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1831: checking for $ac_word" >&5
+echo "configure:1837: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_UUDECODE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1858,7 +1864,7 @@ fi
 
 else
 	echo $ac_n "checking for uudecode""... $ac_c" 1>&6
-echo "configure:1862: checking for uudecode" >&5
+echo "configure:1868: checking for uudecode" >&5
 	echo "$ac_t""$UUDECODE" 1>&6
 fi
 
@@ -1892,7 +1898,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "zcat", so it can be a program name with args.
 set dummy zcat; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1896: checking for $ac_word" >&5
+echo "configure:1902: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_ZCAT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1923,7 +1929,7 @@ fi
 
 else
 	echo $ac_n "checking for zcat""... $ac_c" 1>&6
-echo "configure:1927: checking for zcat" >&5
+echo "configure:1933: checking for zcat" >&5
 	echo "$ac_t""$ZCAT" 1>&6
 fi
 
@@ -1957,7 +1963,7 @@ if test "$with_full_paths" = yes ; then
 	# Extract the first word of "zip", so it can be a program name with args.
 set dummy zip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1961: checking for $ac_word" >&5
+echo "configure:1967: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_ZIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1988,7 +1994,7 @@ fi
 
 else
 	echo $ac_n "checking for zip""... $ac_c" 1>&6
-echo "configure:1992: checking for zip" >&5
+echo "configure:1998: checking for zip" >&5
 	echo "$ac_t""$ZIP" 1>&6
 fi
 
@@ -2024,12 +2030,12 @@ EOF
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2028: checking for working const" >&5
+echo "configure:2034: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2033 "configure"
+#line 2039 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2078,7 +2084,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:2082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2100,9 +2106,59 @@ fi
 
 
 case $host_os in
+aix4*)
+	CFLAGS="$CFLAGS -DAIX4 -D_BSD=44" 
+	LIBS="$LIBS -lbsd"
+	;;
+aix*)
+	LIBS="$LIBS -lbsd"
+	;;
+apollo*)
+	CFLAGS="$CFLAGS -D_BUILTINS -W0,-opt,4"
+	;;
+bsdi*)
+	CFLAGS="$CFLAGS -DBSDI" 
+	;;
+convex*)
+	CFLAGS="$CFLAGS -D__STDC__ -Dunix"
+	;;
+dgux*)
+	CFLAGS="$CFLAGS -DDGUX" 
+	;;
+hpux*)
+	CFLAGS="$CFLAGS -DSNAKE" 
+	;;
+isc*)
+	# -DPOSIX_JC is necessary, else LYBookmark.c never finds out what a mode_t is.
+	CFLAGS="$CFLAGS -DISC -DPOSIX_JC"
+	LIBS="$LIBS -linet -lnsl_s -lcposix"
+	;;
+irix*)
+	CFLAGS="$CFLAGS -cckr" 
+	;;
 linux*)
 	CFLAGS="$CFLAGS -DLINUX" 
 	;;
+next*)
+	CFLAGS="$CFLAGS -DNEXT -DXMOSAIC_HACK"
+	;;
+openbsd*)
+	LIBS="$LIBS -lcompat"
+	;;
+osf*)
+	# Increase the maximum size of functions that will be optimized.
+	test -z "$GCC" && CFLAGS="$CFLAGS -O -Olimit 4000"
+	CFLAGS="$CFLAGS -DDSYS5"
+	;;
+svr4)
+	CFLAGS="$CFLAGS -DSVR4_BSDSELECT -DSVR4"
+	;;
+sunos3*)
+	CFLAGS="$CFLAGS -DSUN"
+	;;
+sunos4*)
+	CFLAGS="$CFLAGS -DSUN -DSUN4"
+	;;
 ultrix*)
 	# Increase the maximum size of functions that will be optimized.
 	test -z "$GCC" && CFLAGS="$CFLAGS -O -Olimit 600"
@@ -2114,12 +2170,12 @@ esac
 
 NETLIBS=""
 echo $ac_n "checking for gethostname""... $ac_c" 1>&6
-echo "configure:2118: checking for gethostname" >&5
+echo "configure:2174: checking for gethostname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2123 "configure"
+#line 2179 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostname(); below.  */
@@ -2142,7 +2198,7 @@ gethostname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gethostname=yes"
 else
@@ -2164,7 +2220,7 @@ else
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6
-echo "configure:2168: checking for gethostname in -lnsl" >&5
+echo "configure:2224: 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
@@ -2172,7 +2228,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl $NETLIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2176 "configure"
+#line 2232 "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
@@ -2183,7 +2239,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2206,7 +2262,7 @@ EOF
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for gethostname in -lsocket""... $ac_c" 1>&6
-echo "configure:2210: checking for gethostname in -lsocket" >&5
+echo "configure:2266: 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
@@ -2214,7 +2270,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2218 "configure"
+#line 2274 "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
@@ -2225,7 +2281,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2254,12 +2310,12 @@ fi
 fi
 
 echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:2258: checking for socket" >&5
+echo "configure:2314: checking for socket" >&5
 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2263 "configure"
+#line 2319 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char socket(); below.  */
@@ -2282,7 +2338,7 @@ socket();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_socket=yes"
 else
@@ -2304,7 +2360,7 @@ else
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:2308: checking for socket in -lsocket" >&5
+echo "configure:2364: 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
@@ -2312,7 +2368,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $NETLIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2316 "configure"
+#line 2372 "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
@@ -2323,7 +2379,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2346,7 +2402,7 @@ EOF
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for socket in -lbsd""... $ac_c" 1>&6
-echo "configure:2350: checking for socket in -lbsd" >&5
+echo "configure:2406: 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
@@ -2354,7 +2410,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2358 "configure"
+#line 2414 "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
@@ -2365,7 +2421,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2394,12 +2450,12 @@ fi
 fi
 
 echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:2398: checking for gethostbyname" >&5
+echo "configure:2454: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2403 "configure"
+#line 2459 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -2422,7 +2478,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -2444,7 +2500,7 @@ else
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2448: checking for gethostbyname in -lnsl" >&5
+echo "configure:2504: 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
@@ -2452,7 +2508,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl $NETLIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2456 "configure"
+#line 2512 "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
@@ -2463,7 +2519,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2490,12 +2546,12 @@ fi
 fi
 
 echo $ac_n "checking for strcasecmp""... $ac_c" 1>&6
-echo "configure:2494: checking for strcasecmp" >&5
+echo "configure:2550: checking for strcasecmp" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strcasecmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2499 "configure"
+#line 2555 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strcasecmp(); below.  */
@@ -2518,7 +2574,7 @@ strcasecmp();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_strcasecmp=yes"
 else
@@ -2540,7 +2596,7 @@ else
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for strcasecmp in -lresolv""... $ac_c" 1>&6
-echo "configure:2544: checking for strcasecmp in -lresolv" >&5
+echo "configure:2600: 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
@@ -2548,7 +2604,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv $NETLIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2552 "configure"
+#line 2608 "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
@@ -2559,7 +2615,7 @@ int main() {
 strcasecmp()
 ; return 0; }
 EOF
-if { (eval echo configure:2563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2589,7 +2645,7 @@ LIBS="$LIBS $NETLIBS"
 
 
 echo $ac_n "checking for screen type""... $ac_c" 1>&6
-echo "configure:2593: checking for screen type" >&5
+echo "configure:2649: checking for screen type" >&5
 if eval "test \"`echo '$''{'cf_cv_screen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2617,12 +2673,12 @@ case $cf_cv_screen in
 curses)
 	
 echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:2621: checking for initscr" >&5
+echo "configure:2677: 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 2626 "configure"
+#line 2682 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -2645,7 +2701,7 @@ initscr();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -2673,7 +2729,7 @@ if test -d /usr/5lib ; then
 fi
 cf_save_LIBS="$LIBS"
 echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:2677: checking for tgoto in -ltermcap" >&5
+echo "configure:2733: 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
@@ -2681,7 +2737,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2685 "configure"
+#line 2741 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2692,7 +2748,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:2696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2710,7 +2766,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   
 	LIBS="-ltermcap $cf_save_LIBS"
 	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:2714: checking for initscr in -lcurses" >&5
+echo "configure:2770: 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
@@ -2718,7 +2774,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2722 "configure"
+#line 2778 "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
@@ -2729,7 +2785,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:2733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2756,7 +2812,7 @@ else
   echo "$ac_t""no" 1>&6
 
 		echo $ac_n "checking for initscr in -lcursesX""... $ac_c" 1>&6
-echo "configure:2760: checking for initscr in -lcursesX" >&5
+echo "configure:2816: checking for initscr in -lcursesX" >&5
 ac_lib_var=`echo cursesX'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2764,7 +2820,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcursesX  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2768 "configure"
+#line 2824 "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
@@ -2775,7 +2831,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:2779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2802,7 +2858,7 @@ else
   echo "$ac_t""no" 1>&6
 
 			echo $ac_n "checking for initscr in -ljcurses""... $ac_c" 1>&6
-echo "configure:2806: checking for initscr in -ljcurses" >&5
+echo "configure:2862: checking for initscr in -ljcurses" >&5
 ac_lib_var=`echo jcurses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2810,7 +2866,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ljcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2814 "configure"
+#line 2870 "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
@@ -2821,7 +2877,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:2825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2859,7 +2915,7 @@ else
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:2863: checking for initscr in -lcurses" >&5
+echo "configure:2919: 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
@@ -2867,7 +2923,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2871 "configure"
+#line 2927 "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
@@ -2878,7 +2934,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:2882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2914,14 +2970,14 @@ fi
 
 	
 echo $ac_n "checking for curses performance tradeoff""... $ac_c" 1>&6
-echo "configure:2918: checking for curses performance tradeoff" >&5
+echo "configure:2974: 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 2925 "configure"
+#line 2981 "configure"
 #include "confdefs.h"
 
 #include <curses.h>
@@ -2935,11 +2991,11 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:2939: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2995: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 	cat > conftest.$ac_ext <<EOF
-#line 2943 "configure"
+#line 2999 "configure"
 #include "confdefs.h"
 
 #define CURS_PERFORMANCE
@@ -2954,7 +3010,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:2958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_curs_performance=yes
 else
@@ -2979,20 +3035,20 @@ EOF
 ncurses)
 	
 echo $ac_n "checking for ncurses header file""... $ac_c" 1>&6
-echo "configure:2983: checking for ncurses header file" >&5
+echo "configure:3039: 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 2989 "configure"
+#line 3045 "configure"
 #include "confdefs.h"
 #include <curses.h>
 int main() {
 printf("%s\n", NCURSES_VERSION)
 ; return 0; }
 EOF
-if { (eval echo configure:2996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ncurses_header=predefined
 else
@@ -3012,7 +3068,7 @@ test "$prefix" != /usr       && cf_search="$cf_search /usr/include /usr/include/
 			curses.h \
 			ncurses.h
 		do
-			if egrep "NCURSES" $cf_incdir/$cf_header >/dev/null 2>&1; then
+			if egrep "NCURSES" $cf_incdir/$cf_header 1>&5 2>&1; then
 				cf_cv_ncurses_header=$cf_incdir/$cf_header 
 				test -n "$verbose" && echo $ac_n "	... found $ac_c" 1>&6
 				break
@@ -3073,12 +3129,12 @@ done
 esac
 
 	echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:3077: checking for initscr" >&5
+echo "configure:3133: 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 3082 "configure"
+#line 3138 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -3101,7 +3157,7 @@ initscr();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -3130,7 +3186,7 @@ case $cf_cv_ncurses_header in
 	;;
 esac
 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6
-echo "configure:3134: checking for Gpm_Open in -lgpm" >&5
+echo "configure:3190: 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
@@ -3138,7 +3194,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3142 "configure"
+#line 3198 "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
@@ -3149,7 +3205,7 @@ int main() {
 Gpm_Open()
 ; return 0; }
 EOF
-if { (eval echo configure:3153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3166,7 +3222,7 @@ 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:3170: checking for initscr in -lgpm" >&5
+echo "configure:3226: 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
@@ -3174,7 +3230,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3178 "configure"
+#line 3234 "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
@@ -3185,7 +3241,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3203,7 +3259,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   
 		# don't try to link with gpm, since it contains curses
 		echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:3207: checking for initscr in -lncurses" >&5
+echo "configure:3263: checking for initscr in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'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
@@ -3211,7 +3267,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3215 "configure"
+#line 3271 "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
@@ -3222,7 +3278,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3254,17 +3310,17 @@ else
   echo "$ac_t""no" 1>&6
 
 		echo $ac_n "checking if ncurses needs -lgpm to link""... $ac_c" 1>&6
-echo "configure:3258: checking if ncurses needs -lgpm to link" >&5
+echo "configure:3314: checking if ncurses needs -lgpm to link" >&5
 		LIBS="-lncurses $cf_save_LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 3261 "configure"
+#line 3317 "configure"
 #include "confdefs.h"
 #include <$cf_header>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_need_gpm=no
 else
@@ -3273,14 +3329,14 @@ else
   rm -rf conftest*
   LIBS="-lncurses -lgpm $cf_save_LIBS"
 			cat > conftest.$ac_ext <<EOF
-#line 3277 "configure"
+#line 3333 "configure"
 #include "confdefs.h"
 #include <$cf_header>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_need_gpm=yes
 else
@@ -3299,7 +3355,7 @@ fi
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:3303: checking for initscr in -lncurses" >&5
+echo "configure:3359: checking for initscr in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'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
@@ -3307,7 +3363,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3311 "configure"
+#line 3367 "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
@@ -3318,7 +3374,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3361,7 +3417,7 @@ cf_cv_lib_termcap=none
 # HP-UX 9.x terminfo has setupterm, but no tigetstr.
 if test "$termlib" = none; then
 	echo $ac_n "checking for tigetstr in -ltermlib""... $ac_c" 1>&6
-echo "configure:3365: checking for tigetstr in -ltermlib" >&5
+echo "configure:3421: 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
@@ -3369,7 +3425,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermlib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3373 "configure"
+#line 3429 "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
@@ -3380,7 +3436,7 @@ int main() {
 tigetstr()
 ; return 0; }
 EOF
-if { (eval echo configure:3384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3403,7 +3459,7 @@ fi
 fi
 if test "$cf_cv_lib_termcap" = none; then
 	echo $ac_n "checking for tgoto in -ltermlib""... $ac_c" 1>&6
-echo "configure:3407: checking for tgoto in -ltermlib" >&5
+echo "configure:3463: 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
@@ -3411,7 +3467,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermlib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3415 "configure"
+#line 3471 "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
@@ -3422,7 +3478,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:3426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3446,7 +3502,7 @@ fi
 if test "$cf_cv_lib_termcap" = none; then
 	# allow curses library for broken AIX system.
 	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:3450: checking for initscr in -lcurses" >&5
+echo "configure:3506: 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
@@ -3454,7 +3510,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3458 "configure"
+#line 3514 "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
@@ -3465,7 +3521,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3486,7 +3542,7 @@ else
 fi
 
 	echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:3490: checking for tgoto in -ltermcap" >&5
+echo "configure:3546: 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
@@ -3494,7 +3550,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3498 "configure"
+#line 3554 "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
@@ -3505,7 +3561,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:3509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3528,7 +3584,7 @@ fi
 fi
 if test "$cf_cv_lib_termcap" = none; then
 	echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:3532: checking for tgoto in -ltermcap" >&5
+echo "configure:3588: 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
@@ -3536,7 +3592,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3540 "configure"
+#line 3596 "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
@@ -3547,7 +3603,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:3551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3570,7 +3626,7 @@ fi
 fi
 if test "$cf_cv_lib_termcap" = none; then
 	echo $ac_n "checking for tgoto in -lncurses""... $ac_c" 1>&6
-echo "configure:3574: checking for tgoto in -lncurses" >&5
+echo "configure:3630: 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
@@ -3578,7 +3634,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3582 "configure"
+#line 3638 "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
@@ -3589,7 +3645,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:3593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3619,11 +3675,27 @@ fi
 
 	
 echo $ac_n "checking for slang header file""... $ac_c" 1>&6
-echo "configure:3623: checking for slang header file" >&5
+echo "configure:3679: 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 3685 "configure"
+#include "confdefs.h"
+#include <slang.h>
+int main() {
+printf("%s\n", SLANG_VERSION)
+; return 0; }
+EOF
+if { (eval echo configure:3692: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cf_cv_slang_header=predefined
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
 	cf_search=""
 test "$prefix" != NONE       && cf_search="$prefix/include $prefix/include/slang"
 test "$prefix" != /usr/local && cf_search="$cf_search /usr/local/include /usr/local/include/slang"
@@ -3634,7 +3706,7 @@ test "$prefix" != /usr       && cf_search="$cf_search /usr/include /usr/include/
 		for cf_header in \
 			slang.h
 		do
-			if egrep "SLANG_VERSION" $cf_incdir/$cf_header >/dev/null 2>&1; then
+			if egrep "SLANG_VERSION" $cf_incdir/$cf_header 1>&5 2>&1; then
 				cf_cv_slang_header=$cf_incdir/$cf_header 
 				break
 			fi
@@ -3644,6 +3716,8 @@ test "$prefix" != /usr       && cf_search="$cf_search /usr/include /usr/include/
 	test -z "$cf_cv_slang_header" && { echo "configure: error: not found" 1>&2; exit 1; }
 	
 fi
+rm -f conftest*
+fi
 
 echo "$ac_t""$cf_cv_slang_header" 1>&6
 cat >> confdefs.h <<\EOF
@@ -3675,12 +3749,12 @@ done
 
 	
 	echo $ac_n "checking for SLtt_get_screen_size""... $ac_c" 1>&6
-echo "configure:3679: checking for SLtt_get_screen_size" >&5
+echo "configure:3753: 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 3684 "configure"
+#line 3758 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char SLtt_get_screen_size(); below.  */
@@ -3703,7 +3777,7 @@ SLtt_get_screen_size();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_SLtt_get_screen_size=yes"
 else
@@ -3722,15 +3796,15 @@ else
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for SLtt_get_screen_size in -lslang""... $ac_c" 1>&6
-echo "configure:3726: checking for SLtt_get_screen_size in -lslang" >&5
+echo "configure:3800: checking for SLtt_get_screen_size in -lslang" >&5
 ac_lib_var=`echo slang'_'SLtt_get_screen_size | 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="-lslang  $LIBS"
+LIBS="-lslang "-lm" $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3734 "configure"
+#line 3808 "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
@@ -3741,7 +3815,7 @@ int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:3745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3760,7 +3834,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for SLtt_get_screen_size in -lslang""... $ac_c" 1>&6
-echo "configure:3764: checking for SLtt_get_screen_size in -lslang" >&5
+echo "configure:3838: checking for SLtt_get_screen_size in -lslang" >&5
 ac_lib_var=`echo slang'_'SLtt_get_screen_size | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3768,7 +3842,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lslang "-lm" $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3772 "configure"
+#line 3846 "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
@@ -3779,7 +3853,7 @@ int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:3783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3810,12 +3884,12 @@ esac
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3814: checking for ANSI C header files" >&5
+echo "configure:3888: 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 3819 "configure"
+#line 3893 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3823,7 +3897,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3901: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3840,7 +3914,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 3844 "configure"
+#line 3918 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3858,7 +3932,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 3862 "configure"
+#line 3936 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3879,7 +3953,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3883 "configure"
+#line 3957 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3890,7 +3964,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:3894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3914,12 +3988,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3918: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:3992: 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 3923 "configure"
+#line 3997 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3928,7 +4002,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3932: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3953,12 +4027,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:3957: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4031: 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 3962 "configure"
+#line 4036 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -3966,7 +4040,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:3970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4044: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -3991,7 +4065,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:3995: checking for opendir in -ldir" >&5
+echo "configure:4069: 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
@@ -3999,7 +4073,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4003 "configure"
+#line 4077 "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
@@ -4010,7 +4084,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4032,7 +4106,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4036: checking for opendir in -lx" >&5
+echo "configure:4110: 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
@@ -4040,7 +4114,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4044 "configure"
+#line 4118 "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
@@ -4051,7 +4125,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4080,6 +4154,7 @@ for ac_hdr in \
 	sys/fcntl.h \
 	sys/filio.h \
 	sys/ioctl.h \
+	sys/param.h \
 	sys/time.h \
 	termio.h \
 	termios.h \
@@ -4088,17 +4163,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:4092: checking for $ac_hdr" >&5
+echo "configure:4167: 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 4097 "configure"
+#line 4172 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4102: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4126,13 +4201,13 @@ done
 
 
 echo $ac_n "checking termio.h and termios.h""... $ac_c" 1>&6
-echo "configure:4130: checking termio.h and termios.h" >&5
+echo "configure:4205: 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 4136 "configure"
+#line 4211 "configure"
 #include "confdefs.h"
 
 #if HAVE_TERMIO_H
@@ -4145,7 +4220,7 @@ int main() {
 putchar (0x0a)
 ; return 0; }
 EOF
-if { (eval echo configure:4149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_termio_and_termios=yes
 else
@@ -4166,12 +4241,12 @@ EOF
 
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:4170: checking for pid_t" >&5
+echo "configure:4245: 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 4175 "configure"
+#line 4250 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4200,17 +4275,17 @@ fi
 
 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:4204: checking for vfork.h" >&5
+echo "configure:4279: 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 4209 "configure"
+#line 4284 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4289: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4235,18 +4310,18 @@ else
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:4239: checking for working vfork" >&5
+echo "configure:4314: 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:4245: checking for vfork" >&5
+echo "configure:4320: 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 4250 "configure"
+#line 4325 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vfork(); below.  */
@@ -4269,7 +4344,7 @@ vfork();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_vfork=yes"
 else
@@ -4290,7 +4365,7 @@ fi
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 4294 "configure"
+#line 4369 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -4385,7 +4460,7 @@ main() {
   }
 }
 EOF
-if { (eval echo configure:4389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_vfork_works=yes
 else
@@ -4409,20 +4484,20 @@ fi
 
 
 echo $ac_n "checking for broken/missing definition of remove""... $ac_c" 1>&6
-echo "configure:4413: checking for broken/missing definition of remove" >&5
+echo "configure:4488: 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 4419 "configure"
+#line 4494 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 remove("dummy")
 ; return 0; }
 EOF
-if { (eval echo configure:4426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_baddef_remove=no
 else
@@ -4430,7 +4505,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 4434 "configure"
+#line 4509 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 		int __unlink(name) { return unlink(name); } 
@@ -4438,7 +4513,7 @@ int main() {
 remove("dummy")
 ; return 0; }
 EOF
-if { (eval echo configure:4442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_baddef_remove=yes
 else
@@ -4467,12 +4542,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4471: checking for $ac_func" >&5
+echo "configure:4546: 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 4476 "configure"
+#line 4551 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4495,7 +4570,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4522,91 +4597,96 @@ done
 
 
 
-echo $ac_n "checking for errno external decl""... $ac_c" 1>&6
-echo "configure:4527: checking for errno external decl" >&5
-if eval "test \"`echo '$''{'cf_cv_extern_errno'+set}'`\" = set"; then
+echo $ac_n "checking if TRUE/FALSE are defined""... $ac_c" 1>&6
+echo "configure:4602: 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 4533 "configure"
+cat > conftest.$ac_ext <<EOF
+#line 4608 "configure"
 #include "confdefs.h"
 
-#include <errno.h>
+#include <curses.h>
+#include <stdio.h>
 int main() {
-int x = errno
+int x = TRUE, y = FALSE
 ; return 0; }
 EOF
-if { (eval echo configure:4541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4617: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  cf_cv_extern_errno=yes
+  cf_cv_bool_defs=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  cf_cv_extern_errno=no
+  cf_cv_bool_defs=no
 fi
 rm -f conftest*
 fi
 
-echo "$ac_t""$cf_cv_extern_errno" 1>&6
-test $cf_cv_extern_errno = no && cat >> confdefs.h <<\EOF
-#define DECL_ERRNO 1
+echo "$ac_t""$cf_cv_bool_defs" 1>&6
+if test "$cf_cv_bool_defs" = no ; then
+	cat >> confdefs.h <<\EOF
+#define TRUE (1)
 EOF
 
+	cat >> confdefs.h <<\EOF
+#define FALSE (0)
+EOF
 
+fi
 
-echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:4561: checking declaration of sys_errlist" >&5
-if eval "test \"`echo '$''{'cf_cv_dcl_sys_errlist'+set}'`\" = set"; then
+
+echo $ac_n "checking for errno external decl""... $ac_c" 1>&6
+echo "configure:4643: checking for errno external decl" >&5
+if eval "test \"`echo '$''{'cf_cv_extern_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 4567 "configure"
+#line 4649 "configure"
 #include "confdefs.h"
 
-#include <stdio.h>
-#include <sys/types.h>
-#include <errno.h> 
+#include <errno.h>
 int main() {
-char *c = (char *) *sys_errlist
+int x = errno
 ; return 0; }
 EOF
-if { (eval echo configure:4577: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4657: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  cf_cv_dcl_sys_errlist=yes
+  cf_cv_extern_errno=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  cf_cv_dcl_sys_errlist=no
+  cf_cv_extern_errno=no
 fi
 rm -f conftest*
 fi
 
-echo "$ac_t""$cf_cv_dcl_sys_errlist" 1>&6
-test $cf_cv_dcl_sys_errlist = no && cat >> confdefs.h <<\EOF
-#define DECL_SYS_ERRLIST 1
+echo "$ac_t""$cf_cv_extern_errno" 1>&6
+test $cf_cv_extern_errno = no && cat >> confdefs.h <<\EOF
+#define DECL_ERRNO 1
 EOF
 
 
 
 echo $ac_n "checking for setlocale()""... $ac_c" 1>&6
-echo "configure:4597: checking for setlocale()" >&5
+echo "configure:4677: 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 4603 "configure"
+#line 4683 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 setlocale(LC_ALL, "")
 ; return 0; }
 EOF
-if { (eval echo configure:4610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_locale=yes
 else
@@ -4626,21 +4706,130 @@ EOF
 
 
 
+echo $ac_n "checking if NGROUPS is defined""... $ac_c" 1>&6
+echo "configure:4711: 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 4717 "configure"
+#include "confdefs.h"
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+int main() {
+int x = NGROUPS
+; return 0; }
+EOF
+if { (eval echo configure:4731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cf_cv_ngroups=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cat > conftest.$ac_ext <<EOF
+#line 4739 "configure"
+#include "confdefs.h"
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+int main() {
+int x = NGROUPS_MAX
+; return 0; }
+EOF
+if { (eval echo configure:4753: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cf_cv_ngroups=NGROUPS_MAX
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cf_cv_ngroups=no
+fi
+rm -f conftest*
+	
+fi
+rm -f conftest*
+echo "$ac_t""$cf_cv_ngroups" 1>&6
+if test "$cf_cv_ngroups" = no ; then
+	cat >> confdefs.h <<\EOF
+#define NGROUPS 16
+EOF
+
+elif test "$cf_cv_ngroups" = NGROUPS_MAX ; then
+	cat >> confdefs.h <<\EOF
+#define NGROUPS NGROUPS_MAX
+EOF
+
+fi
+
+fi
+
+
+
+echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
+echo "configure:4784: checking declaration of sys_errlist" >&5
+if eval "test \"`echo '$''{'cf_cv_dcl_sys_errlist'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+    cat > conftest.$ac_ext <<EOF
+#line 4790 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <errno.h> 
+int main() {
+char *c = (char *) *sys_errlist
+; return 0; }
+EOF
+if { (eval echo configure:4800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cf_cv_dcl_sys_errlist=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cf_cv_dcl_sys_errlist=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$cf_cv_dcl_sys_errlist" 1>&6
+test $cf_cv_dcl_sys_errlist = no && cat >> confdefs.h <<\EOF
+#define DECL_SYS_ERRLIST 1
+EOF
+
+
+
 echo $ac_n "checking if struct utmp is declared""... $ac_c" 1>&6
-echo "configure:4631: checking if struct utmp is declared" >&5
+echo "configure:4820: 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 4637 "configure"
+#line 4826 "configure"
 #include "confdefs.h"
 #include <utmp.h>
 int main() {
 struct utmp x; char *y = &x.ut_host[0]
 ; return 0; }
 EOF
-if { (eval echo configure:4644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4833: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp=yes
 else
@@ -4648,14 +4837,14 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 4652 "configure"
+#line 4841 "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:4659: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp=utmpx
 else
@@ -4686,13 +4875,13 @@ EOF
 if test $cf_cv_screen != slang ; then
 	
 echo $ac_n "checking if curses supports alternate-character set""... $ac_c" 1>&6
-echo "configure:4690: checking if curses supports alternate-character set" >&5
+echo "configure:4879: checking if curses supports alternate-character set" >&5
 if eval "test \"`echo '$''{'cf_cv_alt_char_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 4696 "configure"
+#line 4885 "configure"
 #include "confdefs.h"
 
 #include <curses.h>
@@ -4703,7 +4892,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:4707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_alt_char_set=yes
 else
@@ -4723,13 +4912,13 @@ EOF
 
 	
 echo $ac_n "checking if curses supports fancy attributes""... $ac_c" 1>&6
-echo "configure:4727: checking if curses supports fancy attributes" >&5
+echo "configure:4916: 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 4733 "configure"
+#line 4922 "configure"
 #include "confdefs.h"
 
 #include <curses.h>
@@ -4742,7 +4931,7 @@ attrset(A_UNDERLINE|A_BOLD|A_REVERSE);
 	
 ; return 0; }
 EOF
-if { (eval echo configure:4746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_fancy_curses=yes
 else
@@ -4761,15 +4950,87 @@ test $cf_cv_fancy_curses = yes && cat >> confdefs.h <<\EOF
 EOF
 
 
+	echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
+echo "configure:4955: 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
+  
+	cf_cv_ncurses_version=no
+	cat > conftest.$ac_ext <<EOF
+#ifdef NCURSESHEADER
+#include <ncurses.h>
+#else
+#include <curses.h>
+#endif
+#ifdef NCURSES_VERSION
+Autoconf NCURSES_VERSION
+#else
+#ifdef __NCURSES_H
+Autoconf "old"
+#endif
+#endif
+EOF
+	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
+	{ (eval echo configure:4976: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	if test -f conftest.out ; then
+		cf_out=`cat conftest.out | sed -e 's@^[^\"]*\"@@' -e 's@\".*@@'`
+		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
+	fi
+
+fi
+
+echo "$ac_t""$cf_cv_ncurses_version" 1>&6
+
+	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 4991 "configure"
+#include "confdefs.h"
+
+#include <curses.h>
+int main() {
+
+#if defined(NCURSES_VERSION) && defined(wgetbkgd)
+	make an error
+#else
+	int x = 1
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cf_cv_ncurses_broken=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cf_cv_ncurses_broken=yes
+fi
+rm -f conftest*
+
+fi
+
+if test "$cf_cv_ncurses_broken" = yes ; then
+	echo "configure: warning: hmm... you should get an up-to-date version of ncurses" 1>&2
+	cat >> confdefs.h <<\EOF
+#define NCURSES_BROKEN 1
+EOF
+
+fi
+
 	
 echo $ac_n "checking if curses supports color attributes""... $ac_c" 1>&6
-echo "configure:4767: checking if curses supports color attributes" >&5
+echo "configure:5028: 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 4773 "configure"
+#line 5034 "configure"
 #include "confdefs.h"
 
 #include <curses.h>
@@ -4777,11 +5038,13 @@ else
 int main() {
 has_colors();
 	 start_color();
+#ifndef NCURSES_BROKEN
 	 wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */
+#endif
 	
 ; return 0; }
 EOF
-if { (eval echo configure:4785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5048: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_color_curses=yes
 else
@@ -4802,7 +5065,7 @@ EOF
 
 	
 echo $ac_n "checking declaration of size-change""... $ac_c" 1>&6
-echo "configure:4806: checking declaration of size-change" >&5
+echo "configure:5069: 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
@@ -4816,7 +5079,7 @@ do
     CFLAGS="$cf_save_CFLAGS"
     test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts"
     cat > conftest.$ac_ext <<EOF
-#line 4820 "configure"
+#line 5083 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if HAVE_TERMIOS_H
@@ -4851,7 +5114,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:4855: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_sizechange=yes
 else
@@ -4882,20 +5145,20 @@ EOF
 
 	
 echo $ac_n "checking if ttytype is declared in curses library""... $ac_c" 1>&6
-echo "configure:4886: checking if ttytype is declared in curses library" >&5
+echo "configure:5149: 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 4892 "configure"
+#line 5155 "configure"
 #include "confdefs.h"
 #include <curses.h>
 int main() {
 char *x = &ttytype[1]
 ; return 0; }
 EOF
-if { (eval echo configure:4899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   cf_cv_have_ttytype=yes
 else
@@ -4920,12 +5183,12 @@ EOF
 	
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4924: checking for $ac_func" >&5
+echo "configure:5187: 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 4929 "configure"
+#line 5192 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4948,7 +5211,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4975,8 +5238,63 @@ done
 fi
 
 
+echo $ac_n "checking if color-style code should be used""... $ac_c" 1>&6
+echo "configure:5243: checking if color-style code should be used" >&5
+if eval "test \"`echo '$''{'cf_cv_color_style'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+# Check whether --with-color-style or --without-color-style was given.
+if test "${with_color_style+set}" = set; then
+  withval="$with_color_style"
+  cf_cv_color_style=$withval
+else
+  cf_cv_color_style=no
+fi
+
+fi
+
+
+if test $cf_cv_color_style != no ; then
+	if test .$cf_cv_color_curses != .yes ; then
+		{ echo "configure: error: Configuration does not support color-styles" 1>&2; exit 1; }
+	fi
+	cat >> confdefs.h <<\EOF
+#define USEHASH 1
+EOF
+
+	cat >> confdefs.h <<\EOF
+#define UNPAINT_CACHE 1
+EOF
+
+	cat >> confdefs.h <<\EOF
+#define LINKEDSTYLES 1
+EOF
+
+fi
+
+case $cf_cv_color_style in
+no)
+	echo "$ac_t""no" 1>&6
+	;;
+slang)
+	cat >> confdefs.h <<\EOF
+#define SLCS 1
+EOF
+
+	echo "$ac_t""slang-style" 1>&6
+	;;
+*)
+	cat >> confdefs.h <<\EOF
+#define USE_COLOR_STYLE 1
+EOF
+
+	echo "$ac_t""curses-style" 1>&6
+	;;
+esac
+
 echo $ac_n "checking if parent-directory references are permitted""... $ac_c" 1>&6
-echo "configure:4980: checking if parent-directory references are permitted" >&5
+echo "configure:5298: checking if parent-directory references are permitted" >&5
 if eval "test \"`echo '$''{'cf_cv_parent_dir'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4999,7 +5317,7 @@ EOF
 
 
 echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6
-echo "configure:5003: checking if you want to see long compiling messages" >&5
+echo "configure:5321: checking if you want to see long compiling messages" >&5
 # Check whether --enable-echo or --disable-echo was given.
 if test "${enable_echo+set}" = set; then
   enableval="$enable_echo"
@@ -5023,7 +5341,7 @@ echo "$ac_t""$enableval" 1>&6
 
 
 echo $ac_n "checking if you want to check memory-leaks""... $ac_c" 1>&6
-echo "configure:5027: checking if you want to check memory-leaks" >&5
+echo "configure:5345: checking if you want to check memory-leaks" >&5
 # Check whether --enable-find-leaks or --disable-find-leaks was given.
 if test "${enable_find_leaks+set}" = set; then
   enableval="$enable_find_leaks"
@@ -5046,7 +5364,7 @@ EOF
 
 
 echo $ac_n "checking if you want to enable debug-code""... $ac_c" 1>&6
-echo "configure:5050: checking if you want to enable debug-code" >&5
+echo "configure:5368: checking if you want to enable debug-code" >&5
 # Check whether --enable-debug or --disable-debug was given.
 if test "${enable_debug+set}" = set; then
   enableval="$enable_debug"
@@ -5071,7 +5389,7 @@ EOF
 if test -n "$GCC"
 then
 echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6
-echo "configure:5075: checking if you want to turn on gcc warnings" >&5
+echo "configure:5393: checking if you want to turn on gcc warnings" >&5
 # Check whether --enable-warnings or --disable-warnings was given.
 if test "${enable_warnings+set}" = set; then
   enableval="$enable_warnings"
@@ -5094,11 +5412,11 @@ then
 if test -n "$GCC"
 then
 		cat > conftest.$ac_ext <<EOF
-#line 5098 "configure"
+#line 5416 "configure"
 int main(int argc, char *argv[]) { return argv[argc-1] == 0; }
 EOF
 		echo "checking for gcc warning options" 1>&6
-echo "configure:5102: checking for gcc warning options" >&5
+echo "configure:5420: checking for gcc warning options" >&5
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS="-W -Wall"
 	for cf_opt in \
@@ -5113,7 +5431,7 @@ echo "configure:5102: checking for gcc warning options" >&5
 		Wstrict-prototypes
 	do
 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo configure:5117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+		if { (eval echo configure:5435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 			test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6
 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 		fi
diff --git a/configure.in b/configure.in
index 790f82ed..e957507b 100644
--- a/configure.in
+++ b/configure.in
@@ -61,9 +61,59 @@ AC_DEFINE(UNIX)
 AC_C_CONST
 
 case $host_os in
+aix4*)
+	CFLAGS="$CFLAGS -DAIX4 -D_BSD=44" 
+	LIBS="$LIBS -lbsd"
+	;;
+aix*)
+	LIBS="$LIBS -lbsd"
+	;;
+apollo*)
+	CFLAGS="$CFLAGS -D_BUILTINS -W0,-opt,4"
+	;;
+bsdi*)
+	CFLAGS="$CFLAGS -DBSDI" 
+	;;
+convex*)
+	CFLAGS="$CFLAGS -D__STDC__ -Dunix"
+	;;
+dgux*)
+	CFLAGS="$CFLAGS -DDGUX" 
+	;;
+hpux*)
+	CFLAGS="$CFLAGS -DSNAKE" 
+	;;
+isc*)
+	# -DPOSIX_JC is necessary, else LYBookmark.c never finds out what a mode_t is.
+	CFLAGS="$CFLAGS -DISC -DPOSIX_JC"
+	LIBS="$LIBS -linet -lnsl_s -lcposix"
+	;;
+irix*)
+	CFLAGS="$CFLAGS -cckr" 
+	;;
 linux*)
 	CFLAGS="$CFLAGS -DLINUX" 
 	;;
+next*)
+	CFLAGS="$CFLAGS -DNEXT -DXMOSAIC_HACK"
+	;;
+openbsd*)
+	LIBS="$LIBS -lcompat"
+	;;
+osf*)
+	# Increase the maximum size of functions that will be optimized.
+	test -z "$GCC" && CFLAGS="$CFLAGS -O -Olimit 4000"
+	CFLAGS="$CFLAGS -DDSYS5"
+	;;
+svr4)
+	CFLAGS="$CFLAGS -DSVR4_BSDSELECT -DSVR4"
+	;;
+sunos3*)
+	CFLAGS="$CFLAGS -DSUN"
+	;;
+sunos4*)
+	CFLAGS="$CFLAGS -DSUN -DSUN4"
+	;;
 ultrix*)
 	# Increase the maximum size of functions that will be optimized.
 	test -z "$GCC" && CFLAGS="$CFLAGS -O -Olimit 600"
@@ -123,6 +173,7 @@ AC_CHECK_HEADERS( \
 	sys/fcntl.h \
 	sys/filio.h \
 	sys/ioctl.h \
+	sys/param.h \
 	sys/time.h \
 	termio.h \
 	termios.h \
@@ -146,15 +197,19 @@ dnl --------------------------------------------------------------------------
 dnl Checks for external-data
 dnl --------------------------------------------------------------------------
 
+CF_BOOL_DEFS
 CF_ERRNO
-CF_SYS_ERRLIST
 CF_LOCALE
+CF_NGROUPS
+CF_SYS_ERRLIST
 CF_UTMP
 
 ### These tests must be run after establishing the curses library.
 if test $cf_cv_screen != slang ; then
 	CF_ALT_CHAR_SET
 	CF_FANCY_CURSES
+	CF_NCURSES_VERSION
+	CF_NCURSES_BROKEN
 	CF_COLOR_CURSES
 	CF_SIZECHANGE
 	CF_TTYTYPE
@@ -168,6 +223,36 @@ dnl --------------------------------------------------------------------------
 dnl Miscellaneous options that don't need to test system features
 dnl --------------------------------------------------------------------------
 
+AC_MSG_CHECKING(if color-style code should be used)
+AC_CACHE_VAL(cf_cv_color_style,[
+AC_ARG_WITH(color-style,
+[  --with-color-style=XXX  enable color style (types are ncurses, slang)],
+	[cf_cv_color_style=$withval],
+	[cf_cv_color_style=no])])
+
+if test $cf_cv_color_style != no ; then
+	if test .$cf_cv_color_curses != .yes ; then
+		AC_ERROR(Configuration does not support color-styles)
+	fi
+	AC_DEFINE(USEHASH)
+	AC_DEFINE(UNPAINT_CACHE)
+	AC_DEFINE(LINKEDSTYLES)
+fi
+
+case $cf_cv_color_style in
+no)
+	AC_MSG_RESULT(no)
+	;;
+slang)
+	AC_DEFINE(SLCS)
+	AC_MSG_RESULT(slang-style)
+	;;
+*)
+	AC_DEFINE(USE_COLOR_STYLE)
+	AC_MSG_RESULT(curses-style)
+	;;
+esac
+
 AC_MSG_CHECKING(if parent-directory references are permitted)
 AC_CACHE_VAL(cf_cv_parent_dir,[
 cf_cv_parent_dir=yes
diff --git a/lynx.cfg b/lynx.cfg
index 3ac662f5..8353b69f 100644
--- a/lynx.cfg
+++ b/lynx.cfg
@@ -141,6 +141,9 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html
 #
 #LOCAL_DOMAIN:ukans.edu
 
+# NOTE: The following paragraph applies for standard Lynx, or if Lynx is
+# compiled without -DEXP_CHARTRANS.
+#
 # CHARACTER_SET defines the default character set, i.e., that assumed
 # to be installed on the user's terminal.  It determines which characters
 # or strings will be used to represent 8-bit character entities within
@@ -163,6 +166,36 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html
 # selected and the document has the corresponding charset, and OFF when an
 # Asian (CJK) character set is selected but the document has the ISO-8859-1
 # charset.
+#
+# With chartrans, the above is modified as follows:
+#
+# Additional character sets and some of their properties may be defined with 
+# tables in the src/chrtrans directory.  It is not necessary to change 
+# src/LYCharSets.c to make these new character sets known to Lynx, (although 
+# definitions for the "older" character sets are still there), but the new ones 
+# have to be listed in src/UCdomap.c and, currently, the makefiles in src/ 
+# and src/chrtrans to be automatically used.  See README.* files in src/chrtrans/.
+#
+# For Lynx a "character set" has two names: a Display Character Set string
+# for the Options scree and for setting CHARACTER_SET here, and a
+# corresponding MIME name (for recognizing properly labelled charset 
+# parameters in HTTP headers etc.).  Not all Display Character Set names
+# crrespond to exactly one valid MIME charset (for example "Other ISO Latin",
+# "Chinese", "Transparent"), in that case an appropriate valid (and more
+# specific) MIME name should be used where required.
+#
+# The default for "raw mode" (before it is changed by -raw or LYK_RAW_TOGGLE),
+# if the display character set is not a CJK character set, now depends on the 
+# display character set as well as the ASSUME_CHARSET value (see below) from 
+# either this file or an -assume_charset command line option.  The mode 
+# defaults to ON if the ASSUME_CHARSET value corresponds to the display
+# character set, otherwise to OFF.  Note that "raw" does not mean that every
+# byte will be passed to the screen.  HTML character entities may get 
+# expanded and translated, inappropriate control characters filtered out, etc.
+# Raw mode effectively changes the charset assumption about unlabelled
+# documents.
+# (There is a "Transparent" pseudo character set for more "rawness".)
+#
 # The default character sets include:
 #    ISO Latin 1
 #    ISO Latin 2
@@ -182,6 +215,47 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html
 #
 CHARACTER_SET:ISO Latin 1
 
+# IF compiled with -DEXP_CHARTRANS:
+# ASSUME_CHARSET changes the handling of documents which do not
+# explicitly specify a charset.  Normally Lynx assumes that 8-bit
+# characters in those document are encoded according to iso-8859-1
+# (the official default for the HTTP protocol).  When ASSUME_CHARSET
+# given here or by an -assume_charset command line flag is in effect, 
+# Lynx will treat documents as if they were encoded accordingly.
+# See above on how this interacts with "raw mode" and the Display
+# Character Set.
+# The value should be the MIME name of a character set recognized by
+# Lynx (case insensitive).  MIME names for some Display Character Sets:
+#    ISO Latin 1               iso-8859-1
+#    ISO Latin 2               iso-8859-2
+#    IBM PC character set      cp437
+#    IBM PC codepage 850       cp850
+#    KOI8-R character set      koi8-r
+#
+#ASSUME_CHARSET:iso-8859-1
+
+# IF compiled with -DEXP_CHARTRANS:
+# ASSUME_LOCAL_CHARSET is like ASSUME_CHARSET but only applies to local
+# files.  If no setting is given here or by an -assume_local_charset
+# command line option, the value for ASSUME_CHARSET or -assume_charset 
+# is used.
+# This option may interfere with "raw mode" toggling when local files
+# are viewed (it is "stronger" than the effective change of the charset
+# assumption caused by changing "raw mode"), so only use when necessary.
+# 
+#ASSUME_LOCAL_CHARSET:iso-8859-1
+
+# IF compiled with -DEXP_CHARTRANS:
+# If Lynx encounters a charset parameter it doesn't recognize, it will
+# replace the value given by ASSUME_UNREC_CHARSET (or a corresponding
+# -assume_unrec_charset command line option) for it.  This can be
+# used to deal with charsets unknown to Lynx, if they are "sufficiently
+# similar" to one that Lynx does know about, by forcing the same 
+# treatment.  There is no default, and you probably should leave this
+# undefined unless necessary.
+#
+#ASSUME_UNREC_CHARSET:iso-8859-1
+
 # PREFERRED_LANGUAGE is the language in MIME notation (e.g., "en",
 # "fr") which will be indicated by Lynx in its Accept-Language headers
 # as the preferred language.  If available, the document will be
@@ -316,6 +390,22 @@ CHARACTER_SET:ISO Latin 1
 #
 #ALWAYS_RESUBMIT_POSTS:FALSE
 
+# If NO_ISMAP_IF_USEMAP is set TRUE, Lynx will not include a link to the
+# server-side image map if both a server-side and client-side map for the
+# same image is indicated in the HTML markup.  The compilation default is
+# FALSE, such that a link with "[ISMAP]" as the link name, followed by a
+# hyphen, will be prepended to the ALT string or "[USEMAP]" pseudo-ALT for
+# accessing Lynx's text-based rendition of the client-side map (based on
+# the content of the associated MAP element).  If the "[ISMAP]" link is
+# activated, Lynx will send a 0,0 coordinate pair to the server, which
+# Lynx-friendly sites can map to a for-text-client document, homologous
+# to what is intended for the content of a FIG element.
+#
+# The compilation default, or default defined here, can be toggled via
+# the "-ismap" command line switch.
+#
+#NO_ISMAP_IF_USEMAP:FALSE
+
 # Local execution links and scripts are completely disabled
 # in the source code unless they are enabled in the
 # userdefs.h file and the sources recompiled.  Please
@@ -968,6 +1058,23 @@ MINIMAL_COMMENTS:TRUE
 #
 #SOFT_DQUOTES:FALSE
 
+# If STRIP_DOTDOT_URLS is TRUE, Lynx emulates the invalid behavior of many 
+# browsers to strip a leading "../" segment from relative URLs in HTML
+# documents with a http or https base URL, if this would otherwise lead to
+# an absolute URLs with those characters still in it.  Such URLs are normally
+# erroneous and not what is intended by page authors.  Lynx will issue 
+# a warning message when this occurs.
+#
+# If STRIP_DOTDOT_URLS is FALSE, Lynx will use those URLs for requests 
+# without taking any special actions or issuing Warnings, in most cases
+# this will result in an error response from the server.
+#
+# Note that Lynx never tries to fix similar URLs for protocols other than
+# http and https, since they are less common and may actually be valid in
+# some cases.
+#
+#STRIP_DOTDOT_URLS:FALSE
+
 # If ENABLE_SCROLLBACK is TRUE, Lynx will clear the entire screen before
 # displaying each new screenful of text.  Though less efficient for normal
 # use, this allows programs that maintain a buffer of previously-displayed
@@ -1448,3 +1555,39 @@ MINIMAL_COMMENTS:TRUE
 #COLOR:5:blue:white
 #COLOR:6:red:white
 #COLOR:7:magenta:cyan
+
+# External application support. This feature allows lynx to pass a given
+# URL to an external program.  It was written for three reasons.
+#
+# 1) To overcome the deficiency	of Lynx_386 not supporting ftp and news.
+#    External programs can be used instead by passing the URL.
+#
+# 2) To allow for background	transfers in multitasking systems.
+#    I use wget for http and ftp transfers via the external command.
+#
+# 3) To allow for new URLs to be used through lynx.
+#	  URLs can be made up such as mymail: to spawn desired applications
+#	  via the external command.
+#
+# Restrictions can be imposed using -restrictions=externals at the lynx
+# command line.  This will disallow all EXTERNAL lines in lynx.cfg that
+# end in FALSE.  TRUE lines will still function.
+#
+# The lynx.cfg line is as follows:
+#
+# EXTERNAL:<url>:<command> %s:<norestriction>
+#
+# <url> Any given URL.  This can be normal ones like ftp or http or it
+# can be one made up like mymail.
+#
+# <command> The command to run with %s being the URL that will be passed.
+# In Linux I use "wget -q %s &" (no quotes) to spawn a copy of wget for
+# downloading http and ftp files in the background.  In Win95 I use
+# "start ncftp %s" to spawn ncftp in a new window.
+#
+# <norestriction> This complements the -restrictions=externals feature to allow
+# for certain externals to be enabled while restricting others.  TRUE means
+# a command will still function while lynx is restricted.  WB
+#
+# EXTERNAL:ftp:wget %s &:TRUE
+
diff --git a/lynx.hlp b/lynx.hlp
index ae2a5795..11019163 100644
--- a/lynx.hlp
+++ b/lynx.hlp
@@ -104,7 +104,7 @@
        forces the first document to be interpreted as HTML.
 
   -from
-       toggle transmissions of From headers.
+       toggles transmissions of From headers.
 
   -ftp 
        disable ftp access.
@@ -130,6 +130,10 @@
   -index=URL
        set the default index file to the specified URL.
 
+  -ismap
+       toggles inclusion of ISMAP links when client-side
+       MAPs are present.
+
   -link=NUMBER
        starting count for lnk#.dat files produced by -crawl.
 
@@ -236,8 +240,8 @@
 
        dired_support - disallow local file management.
 
-       disk_save - disallow saving binary files to disk in the download
-           menu.
+       disk_save - disallow saving to disk in the download and print
+           menus.
 
        download - disallow downloaders in the download menu.
 
@@ -332,6 +336,9 @@
        remote TCP/IP port that starts a script that, in turn, starts another
        Lynx process.)
 
+  -tlog
+       toggles use of a Lynx Trace Log for the current session.
+
   -trace
        turns on WWW trace mode.
 
diff --git a/lynx.man b/lynx.man
index 69edc908..2ac90fb5 100644
--- a/lynx.man
+++ b/lynx.man
@@ -132,7 +132,7 @@ include all versions of files in local VMS directory listings.
 forces the first document to be interpreted as HTML.
 .TP
 .B -from
-toggle transmissions of From headers.
+toggles transmissions of From headers.
 .TP
 .B -ftp 
 disable ftp access.
@@ -158,7 +158,11 @@ toggles inclusion of links for all images.
 .B -index\fR=\fIURL
 set the default index file to the specified URL.
 .TP
-.B -link\fR=\fNUMBER
+.B -ismap
+toggles inclusion of ISMAP links when client-side
+MAPs are present.
+.TP
+.B -link\fR=\fINUMBER
 starting count for lnk#.dat files produced by -crawl.
 .TP
 .B -localhost
@@ -175,10 +179,10 @@ source.
 .B -minimal
 toggles minimal versus valid comment parsing.
 .TP
-.B -newschunksize\fR=\fNUMBER
+.B -newschunksize\fR=\fINUMBER
 number of articles in chunked news listings.
 .TP
-.B -newsmaxchunk\fR=\fNUMBER
+.B -newsmaxchunk\fR=\fINUMBER
 maximum news articles in listings before chunking.
 .TP
 .B -nobrowse
@@ -275,8 +279,8 @@ are setable within userdefs.h.
 - disallow local file management.
 
 .I disk_save 
-- disallow saving binary files to disk in the 
-download menu.
+- disallow saving to disk in the download and
+print menus.
 
 .I download
 - disallow downloaders in the download menu.
@@ -396,6 +400,9 @@ tell Lynx what terminal type to assume its talking to.
 Lynx connects to a remote TCP/IP port that starts a script that,
 in turn, starts another Lynx process.)
 .TP
+.B -tlog
+toggles use of a Lynx Trace Log for the current session.
+.TP
 .B -trace
 turns on WWW trace mode.
 .TP
diff --git a/lynx_help/Lynx_users_guide.html b/lynx_help/Lynx_users_guide.html
index 1e897708..356a98aa 100644
--- a/lynx_help/Lynx_users_guide.html
+++ b/lynx_help/Lynx_users_guide.html
@@ -629,7 +629,9 @@ return to Lynx or the '<em>&gt;</em>' command to save the options to a
    <dt>Keypad as arrows or numbered links
 	<dd>This option gives the choice between navigating with the arrow
 	    keys or having every link numbered so that the links may be
-	    selected by numbers as well as using the arrow keys.
+	    selected by numbers as well as using the arrow keys.  See the
+	    <a href="keystroke_commands/follow_help.html"
+	    >Follow link (or goto link or page) number:</a> help for more information.
 
    <dt>Line edit style
    	<dd>This option allows you to set alternate key bindings for the
@@ -795,10 +797,35 @@ viewing or '<em>l</em>' to save the link that is currently selected on
 the page.  Selecting '<em>c</em>' will cancel without saving anything to
 your bookmark file.
 
+<p>A bookmark file will be created in conjunction with acting on the
+'<em>a</em>'dd command if it does not already exist.  Otherwise, the link
+will be added to the bottom of the pre-existing bookmark file.  You must
+have created a bookmark file via the '<em>a</em>'dd command before you
+can view it.
+
 <p>Use the '<em>v</em>' command to view the list of bookmarks you have
 saved.  While viewing the bookmark list you may select a bookmark as you
-would any other link.  You can remove a link from the bookmark list by
-pressing the '<em>r</em>' key when positioned on that link.
+would any other link.
+
+<p>You can remove a link from the bookmark list by pressing the
+'<em>r</em>' key when positioned on that link.  You also can use a
+standard text editor (e.g., via the '<em>e</em>'dit command while viewing
+a bookmark file, if an external editor has been defined via the <em>Options
+menu</em>) to delete or re-order links in the bookmark file, or to modify
+a link name by editing the content of the <em>A</em>nchor element for the
+link, but you should not change the format within the line for the link,
+consisting of an <em>LI</em> element followed by the <em>A</em>nchor
+element, nor cause the line to become wrapped to a second line.   You
+similarly can change the link destination by editing the double-quoted
+value for the <em>HREF</em> attribute in the <em>A</em>nchor start tag,
+but you should not otherwise change the spacing within the start tag, nor
+add other attributes.  You can add a new link while editing by copying
+an existing line for a link, to ensure the proper format, and then
+modifying its <em>HREF</em> value and <em>A</em>nchor content, but you
+should not add any other HTML markup to the bookmark file.  If the format
+and spacing (other than the <em>A</em>nchor content or <em>HREF</em> value)
+within lines is changed or other HTML markup is added, the '<em>a</em>'dd
+and '<em>r</em>'emove commands may not work properly.
 
 <p>When multi-bookmarks (see <a href="#12">Options Menu</a>) is OFF,
 you will always view or add links to the default bookmark file.  When
@@ -882,14 +909,14 @@ commands.
    <dt><em>^A</em>
   	<dd><em>Control-A</em> jumps you to the beginning of the current
 	    document.  It is a synonym for the Keypad <em>Home</em> key, and
-	    can be used when <em>Links are numbered</em> mode is on.  The
+	    can be used also when <em>Links are numbered</em> mode is on.  The
 	    <em>Find</em> Function key also is a synonym, and ideally the
 	    latter has been mapped to the Function key labeled <em>Home</em>
 	    if you are using an IBM Enhanced Keyboard.
    <dt><em>^E</em>
   	<dd><em>Control-E</em> jumps you to the end of the current document.
 	    It is a synonym for the Keypad <em>End</em> key, and can be used
-	    when <em>Links are numbered</em> mode is on.  The <em>Select</em>
+	    also when <em>Links are numbered</em> mode is on.  The <em>Select</em>
 	    Function key also is a synonym, and ideally the latter has been
 	    mapped to the Function key labeled <em>End</em> if you are using
 	    an IBM Enhanced Keyboard.
@@ -963,14 +990,28 @@ commands.
 	    number of lines in the file, URL, title, owner, and type are
 	    shown.
    <dt><em>^T</em>
-  	<dd><em>Control-T</em> toggles trace mode on and off.  This is useful
-	    for diagnosing bad html.  If you get a <em>Bad HTML</em>
+  	<dd><em>Control-T</em> toggles Lynx trace mode on and off.  This is
+	    useful for diagnosing bad html.  If you get a <em>Bad HTML</em>
 	    statusline message when loading a document, enter
 	    <em>Control-T</em> and then <em>Control-R</em> to reload the
 	    document in trace mode.  You also can submit the document for
 	    validation via links in the online help menu.  If you are able
 	    to diagnose the problem, send a message about it to the
 	    document's author.
+   <dt><em>;</em>
+  	<dd>The <em>;</em> command shows the <em>Lynx Trace Log</em>
+	    (<em>lynx.trace</em> in the home directory) if one has been
+	    started for the current session.  If a log has not been started,
+	    any trace and other stderr messages will be sent to the screen
+	    (and will disturb the normal display) unless the system supports
+	    piping and that was used to redirect stderr messages to a file.
+	    The log is started when Lynx trace mode is turned on via the
+	    <em>-trace</em> command line switch, or via the
+	    <em>Control-T</em> toggle, if Lynx has been compiled to log
+	    the trace and other stderr messages.  If not, ability to
+	    create a log can be toggled on with the <em>-tlog</em> switch.
+	    Note that this ability is disabled in anonymous or validation
+	    accounts.
    <dt><em>*</em>
   	<dd>The '<em>*</em>' command toggles image_links mode on and off.
 	    When on, links will be created for all images, including inlines.
@@ -1009,6 +1050,11 @@ commands.
 	    '<em>z</em>' key at any time during a connect or transfer process
 	    and the process will be halted.  If any data was transferred
 	    before the interrupt, it will be displayed.
+   <dt><em>numbers</em>
+	<dd>Lynx offers other, advanced navigation features when numbers
+	    are used to invoke the <a
+	    href="keystroke_commands/follow_help.html"
+	    >Follow link (or goto link or page) number:</a> prompt.
 	    [<A HREF="#TOC">ToC</A>]
 </dl>
 
@@ -1123,7 +1169,7 @@ resubmitted, even if the content has not changed, when you activate the
 <em>POST</em> as the METHOD if the document returned by the form has links
 which you activated, and then you go back via the PREV_DOC
 (<em>left-arrow</em>) command or via the <a
-href="keystroke_commands/history_help.html">History Page</em>.  Lynx can be
+href="keystroke_commands/history_help.html">History Page</a>.  Lynx can be
 compiled so that it resubmits the form in those cases as well, and the default
 can be changed via <em>lynx.cfg</em>, and toggled via the
 <em>-resubmit_posts</em> command line switch.
@@ -1546,12 +1592,18 @@ Lynx session are cached, so that they need not be retrieved repeatedly
 when referenced in different documents.
 
 <p>If the IMG element also indicates a <em>server-side-image-map</em>
-via an ISMAP attribute, Lynx will create a link for that as well, rather
-than ignoring it, and will submit a 0,0 coordinate pair if that link is
-activated.  However, the <em>client-side-image-map</em> is much more
-useful for a client such as Lynx, because all of the URLs associated
-with the image map can be accessed, and their nature indicated via ALT
-attributes.
+via an ISMAP attribute, Lynx normally will create a link for that as well,
+using an <em>[ISMAP]</em> pseudo-ALT (followed by a hyphen to indicate its
+association with the <em>client-side-image-map</em>) rather than ignoring
+it, and will submit a 0,0 coordinate pair if that link is activated.
+Although, the <em>client-side-image-map</em> may be more useful for a
+client such as Lynx, because all of the URLs associated with the image
+map can be accessed, and their nature indicated via ALT attributes,
+Lynx-friendly sites can map 0,0 such that the server returns a
+for-text-client document homologous to the content of FIG elements (see
+below).  Inclusion of such a link for submissions to the server can be
+disabled by default via the configuration file (lynx.cfg), and the
+default can be toggled via the <em>-ismap</em> command line switch.
 
 <p>Lynx also recognizes the <a
 href="http://www.w3.org/pub/WWW/MarkUp/html3/Contents.html">HTML 3.0</a>
@@ -1788,6 +1840,9 @@ where
 		    <code>URL</code> for the '<em>m</em>'ain menu command.
              <dt><code>-image_links</code>
     		<dd>toggles inclusion of links for all images.
+             <dt><code>-ismap</code>
+    		<dd>toggles inclusion of ISMAP links when client-side
+		    MAPs are present.
              <dt><code>-index=URL</code>
     		<dd>set the default index file to the specified <em>URL</em>
              <dt><code>-link=NUMBER</code>
@@ -1879,8 +1934,8 @@ where
        		<dt>dired_support
         		<dd>disallow local file management.
        		<dt>disk_save 
-        		<dd>disallow saving binary files to disk in the 
-			    download menu.
+        		<dd>disallow saving to disk in the download and print
+			    menus.
 		<dt>download
 			<dd>disallow downloaders in the download menu.
        		<dt>editor  
@@ -1975,8 +2030,24 @@ where
     		    (This may be useful for remote execution, when, for
 		    example, Lynx connects to a remote TCP/IP port that starts
 		    a script that, in turn, starts another Lynx process.)
+             <dt><code>-tlog</code>
+    		<dd>toggles use of a <em>Lynx Trace Log</em> for the current
+		    session.  The log is named <em>lynx.trace</em> and is
+		    created in the home directory when Lynx trace mode is
+		    turned on via the <em>-trace</em> command line switch
+		    (see below), or via the TOGGLE_TRACE (<em>Control-T</em>)
+		    keystroke command.  Once a log is started for the session,
+		    all trace and other stderr messages are written to the
+		    log.  The contents of the log can be examined during
+		    the session via the TRACE_LOG (normally, '<em>;</em>')
+		    keystroke command.
              <dt><code>-trace</code>
-    		<dd>turns on WWW trace mode.
+    		<dd>turns on Lynx trace mode.  If a Lynx Trace Log
+		    (<em>lynx.trace</em> in the home directory) has
+		    been started for the current session, all trace and
+		    other stderr messages are written to that log, and
+		    can be examined during the session via the TRACE_LOG
+		    (normally, '<em>;</em>') command.
              <dt><code>-traversal</code>
     		<dd>traverse all http links derived from startfile.  When
 		    used with <em>-crawl</em>, each link that begins with the
diff --git a/lynx_help/keystroke_commands/follow_help.html b/lynx_help/keystroke_commands/follow_help.html
new file mode 100644
index 00000000..3f2e9c81
--- /dev/null
+++ b/lynx_help/keystroke_commands/follow_help.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html public "-//IETF//DTD HTML 3.0//EN">
+<HTML>
+<HEAD>
+<TITLE>Help on the Follow link (or page) number feature</TITLE>
+<LINK rev="made" href="mailto:lynx-dev@sig.net">
+</HEAD>
+<BODY>
+<h1>+++ Follow link (or goto link or page) number Help +++</h1>
+
+If a user has set <em>Keypad mode</em> to <em>Links are numbered</em>
+as the default or for the current session via the <em>Options menu</em>,
+then hypertext links which have visible link names are prefixed with
+numbers in square brackets.  Entering a keyboard or keypad number is
+treated as an <em>F_LINK_NUM</em> command, and should invoke the
+<em>Follow link (or goto link or page) number:</em> statusline prompt for
+a potentially multiple digit number corresponding to an indicated link
+number.  If RETURN is pressed to terminate the number entry (e.g.,
+<em>123</em>), Lynx will retrieve the document for that link as if you
+had paged or used other navigation commands to make it the current link
+and then ACTIVATE-ed it.  The prompt can be invoked via <em>0</em>,
+but it will not be treated as the lead digit for the number entry,
+whereas <em>1</em> through <em>9</em> both invoke the prompt and are
+treated as the first digit.
+
+<p>If the number entered at the prompt has a '<em>g</em>' suffix (e.g.,
+<em>123g</em>), then Lynx will make the link corresponding to that number
+the current link, paging as appropriate if the link does not appear in
+the currently displayed page.  Alternatively, if the number is given a
+'<em>p</em>' suffix (e.g., <em>123p</em>), Lynx will make the page
+corresponding to that number the currently displayed page, and the first
+link on that page, if any, the current link.  The '<em>g</em>' and
+'<em>p</em>' suffixes thus convert the 
+<em>Follow link (or goto link or page) number:</em>
+feature to an advanced navigation aid.
+
+<p>If the user has set <em>Keypad mode</em> to <em>Numbers as arrows</em>,
+then only '<em>0</em>', rather than every number, will be treated as an
+<em>F_LINK_NUM</em> command for invoking the <em>Follow link (or goto link or page)
+number:</em> prompt.  The '<em>0</em>' will not be treated as the first
+digit for the number, or number plus suffix, entry.
+
+<p>Note that HTML can be structured so that it includes <em>hidden
+links</em>, i.e., without a visible link name intended for ACTIVATE-ing
+the link.  Such links may be created, for example, by making an IMG element
+the sole content of an Anchor element, and including an ALT="" attribute
+name/value pair to suppress access to the link when the browser does not
+have support for image handling available.  They also can be created by
+having truly empty Anchor content, in cases for which the value of an
+Anchor's HREF attribute is intended as a navigation aid for robots
+(typically indexers) and not as content for a browser's rendition of the
+document.  With the <em>-ismap</em> command line switch, Lynx will 
+additionally treat a link to a server-side image maps as hidden if
+there also is a client-side map for the same image.
+Finally, in some cases links which are not intended to be hidden
+may effectively become <em>hidden links</em> because of bad HTML.
+The <em>hidden links</em> differ from Anchors which have only a
+NAME or ID attribute name/value pair (intended as positioning targets from
+other links which do have HREF attributes and values that include a
+fragment).  
+
+<p>Lynx respects instructions for <em>hidden links</em> and normally does
+not include them in the rendition of the document.  However, if the command
+line switch <em>-hiddenlinks=merge</em> is used, such links will still be
+numbered in sequence with other links which are not hidden, and if <em>Links
+are numbered</em> mode is also on, link numbers will appear for them in the
+displayed text (except for links to image maps which are hidden because of 
+<em>-ismap</em>).  If <em>-hiddenlinks=listonly</em> or
+<em>-hiddenlinks=ignore</em> is in effect, <em>hidden links</em> will not be
+shown in the text even in <em>links are numbered</em> mode.  Not using a
+<em>-hiddenlinks</em> flag at all is equivalent to
+<em>-hiddenlinks=listonly</em>.
+
+<p>If a document includes
+<em>hidden links</em>, they will be reported, with appropriate labeling,
+in the menu created for the LIST ('<em>l</em>') command,
+unless <em>-hiddenlinks=ignore</em> is used.  They can then be
+ACTIVATE-ed via that menu.  Also, if a link was hidden due to an ALT
+attribute in an IMG element, it will be converted to a <em>visible link</em>
+whenever the IMAGE_TOGGLE ('<em>*</em>') command is used to create links
+for SRC attritute values of IMG elements, because this indicates that the
+user does have some form of image handling enabled via a helper application, 
+or wishes to download files for subsequent use with a graphic browsers or
+other suitable software.
+</BODY>
+</HTML>
diff --git a/lynx_help/keystroke_commands/keystroke_help.html b/lynx_help/keystroke_commands/keystroke_help.html
index 8e04b767..6c10aa58 100644
--- a/lynx_help/keystroke_commands/keystroke_help.html
+++ b/lynx_help/keystroke_commands/keystroke_help.html
@@ -84,8 +84,13 @@
                CTRL-U         - Erase input line
                CTRL-G         - Cancel input or transfer
                CTRL-T         - Toggle trace mode on and off
+               ;              - View the Lynx Trace Log for the current
+               			session.
                CTRL-K         - Invoke the <A HREF="cookie_help.html"
 	       			>Cookie Jar Page</A>
+               numbers        - Invoke the prompt 
+				<a href="follow_help.html"
+				>Follow link (or goto link or page) number:</a>
 </PRE>
 </BODY>
 </HTML>
diff --git a/lynx_help/keystroke_commands/other_help.html b/lynx_help/keystroke_commands/other_help.html
index ab18bffb..a62320c1 100644
--- a/lynx_help/keystroke_commands/other_help.html
+++ b/lynx_help/keystroke_commands/other_help.html
@@ -138,6 +138,8 @@
 
      CTRL-T   - Toggles trace mode on and off.
 
+       ;      - Views the Lynx Trace Log for the current session.
+
      CTRL-K   - Invokes the Cookie Jar Page.
 </PRE>
 </BODY>
diff --git a/lynx_help/lynx_url_support.html b/lynx_help/lynx_url_support.html
index c90550f4..44fc6f68 100644
--- a/lynx_help/lynx_url_support.html
+++ b/lynx_help/lynx_url_support.html
@@ -348,16 +348,20 @@ to="ngp">(post a followup message)<BR>
 NNTPSERVER configuration or environmental variable.  Inclusion of at
 least one newsgroup in the URL is required, and additional groups can
 be specified as a comma-separated list.  Wildcarding of newgroup names
-is not supported for these URLs.  For newsreply and snewsreply URLs, the
-user is offered the option to include the currently displayed document,
+is not supported for these URLs.  For newsreply and snewsreply URLs, if
+an external editor has been defined via the <em>Options Menu</em>, the
+user is offered an option to include the currently displayed document,
 which presumeably is a news article with a <em>followup</em> link that
 was activated, and if confirmed, each line of that document is prefixed
-with a right-angle-bracket.  These URLs can be used as command line
-startfiles (in which case, Lynx will exit after posting the message,
-and the newreply or snewsreply URLs degrade to newspost or snewpost
-URLs, respectively).  They also can be used as HREF attribute values
-in any HTML document homologously to <a href="#mailto">mailto</a> URLs,
-with the qualification that they presently are supported only by Lynx. 
+with a right-angle-bracket.  The user is expected to edit such an inclusion
+so that only the passages relevant to the followup message are retained.
+
+<p>These URLs can be used as command line startfiles (in which case, Lynx
+will exit after posting the message, and the newreply or snewsreply URLs
+degrade to newspost or snewpost URLs, respectively).  They also can be used
+as HREF attribute values in any HTML document homologously to <a
+href="#mailto">mailto</a> URLs, with the qualification that they presently
+are supported only by Lynx.
 <HR WIDTH="100%">
 
 <H2><a name="mailto">The <em>mailto</em> URL:</a></H2>
@@ -434,6 +438,13 @@ transmission across gateways.  If the ENCTYPE was not <em>text/plain</em>,
 any script which decodes the mailed content should ignore the physical
 newlines and recognize only hex escaped newline characters as intended
 to be present in the decoded content.
+
+<p>If the mailto URL is not the ACTION for a FORM, and if an external
+editor has been defined via the <em>Options Menu</em>, the user is offered
+an option to include the currently displayed document.  If this option is
+accepted, each line of that document is prefixed with a right-angle-bracket,
+and the prefixed inclusion should be trimmed by the user to just those
+passages relevant to the message which will be sent.
 <HR WIDTH="100%">
 
 <H2><a name="finger">The <em>finger</em> URL:</a></H2>
diff --git a/makefile.in b/makefile.in
index b5156b99..c076f11a 100644
--- a/makefile.in
+++ b/makefile.in
@@ -14,8 +14,12 @@ CFLAGS		= $(CPPOPTS) @CFLAGS@
 LIBS		= @LIBS@
 
 ##this is the name of the directory the lynx source code is in.
+##(e.g. lynx2-7-1, not the full path)
+lynxdir= lynx2-7-1
+
+##this is the name of the directory the lynx source code is in.
 ##(e.g. lynx2-7, not the full path)
-lynxname= lynx2-7
+lynxname= lynx2-7-1
 
 ## Where you want lynx installed
 bindir= @bindir@
@@ -142,24 +146,6 @@ DIRED_PERMIT   =   -DOK_PERMIT
 # directories via the "change_exec_perms" command line restriction):
 #DIRED_NOXPERMS   =   -DNO_CHANGE_EXECUTE_PERMS
 
-# !!!!!!!!!!! NOTE:  NetBSD and FreeBSD !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-# On NetBSD 1.1 and earlier, as well as FreeBSD 2.0.5 and earlier,
-# the system make program uses different syntax for including files
-# than the GNU make program.  If you get the following error --
-#   * "Makefile", line 27: Need an operator *
-# you have several choices to run GNU make:
-#
-# * Install GNU make as `/usr/bin/make', after moving /usr/bin/make
-#   to /usr/bin/old-make
-#
-# * Install GNU make in a different directory which is earlier in
-#   your search path.
-#
-# * Install GNU make as gmake, and change occurrences of `make' to
-#   `gmake' in any Makefile used by your install.  You won't need to
-#   change all of the Makefiles, just the top-level one, and the one
-#   in WWW/Library/???bsd
-
 # !!!!!!!!!!! Lynx Wishful Thinking !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 # If you are on one of the supported systems (see all: list below)
 # you should not have to modify anything from here down (but check
@@ -176,52 +162,21 @@ DIRED_PERMIT   =   -DOK_PERMIT
 all:
 	@echo
 	@echo "Please run make with one of the following arguments"
-	@echo "aix4       -- for RS/6000 running AIX 4.n and some 3.2"
-	@echo "aix32      -- for RS/6000 running AIX 3.2"
-	@echo "apollo     -- apollo systems (untested)"
-	@echo "bsdi       -- BSD Interactive"
 	@echo "clix       -- for Intergraph CLIX"
-	@echo "convex     -- for Convex C-series"
-	@echo "dgux       -- for DGUX "
-	@echo "freebsd    -- for FreeBSD"
 	@echo "generic    -- for generic UNIX"
-	@echo "isc        -- for Interactive Machines (untested)"
-	@echo "linux      -- for PC linux"
-	@echo "mips       -- for MIPS, svr3/bsd flavour (untested)"
-	@echo "netbsd     -- for NetBSD"
-	@echo "news       -- for SONY NEWS-OS 4.2.1R"
-	@echo "next       -- for NeXT OS"
-	@echo "osf        -- for Alpha OSF/1"
-	@echo "ptx        -- for Sequent's DYNIX/ptx, version 4, (current version)"
 	@echo "ptx        -- for Sequent's DYNIX/ptx, current version"
 	@echo "ptx2       -- for Sequent's DYNIX/ptx, version 2"
-	@echo "riscos     -- Control Data Unix machine running EP/IX"
 	@echo "sco        -- for SCO machines"
 	@echo "sco5       -- for SCO OpenServer Release 5 machines"
-	@echo "sgi        -- for SGI machines"
-	@echo "sun3       -- for SUN 3 OS with System V curses"
-	@echo "sun4       -- for SUN 4 OS"
-	@echo "svr4       -- for SVR4"
-	@echo "snake      -- for HP-UX lt 9.01 (gcc)"
 	@echo "snake2     -- for HP-UX gte 9.01 (gcc)"
 	@echo "snake3     -- for HP-UX (purchased compiler)"
-	@echo "solaris    -- for solaris 2.x"
-	@echo "ultrix     -- for DEC Ultrix"
-	@echo "decstation -- for DEC Ultrix (same as ultrix)"
-	@echo "umaxv   -- for Encore's UMAXV (SVR3.x) "
-	@echo "unixware   -- for Novell's Unixware"
-	@echo "univell    -- for Novell's Unixware"
+	@echo "umaxv      -- for Encore's UMAXV (SVR3.x) "
 	@echo "clean      -- removes all '.o' and 'core' files"
 	@echo "tar        -- runs clean, removes executable, and tars the whole directory"
 	@echo "compress   -- runs tar, then compresses the result"
 	@echo "zip        -- runs clean, removes executable, and zips the whole directory"
 	@echo
 
-# Map some extra commands to existing ones
-unix: generic
-decstation: ultrix
-univell: unixware
-
 DIR_LYDEFS = $(DIRED_SUPPORT) $(DIR_LONG_LIST) $(DIR_PARENT)
 
 DIR_DEFS = $(DIRED_SUPPORT) $(DIRED_ARCHIVE) $(DIRED_TAR) $(DIRED_ZIP) $(DIRED_GZIP) $(DIRED_UUDECODE) $(DIRED_OVERRIDE) $(DIRED_PERMIT) $(DIRED_NOXPERMS)
@@ -231,7 +186,7 @@ DIR_DEFS = $(DIRED_SUPPORT) $(DIRED_ARCHIVE) $(DIRED_TAR) $(DIRED_ZIP) $(DIRED_G
 #SITE_LIBS= # Your libraries here (remove the "#")
 
 # Set SITE_LYDEFS to one or more of the defines for the WWW Library:
-SITE_LYDEFS = $(DIR_LYDEFS) -DEXP_CHARTRANS # Your defines here
+SITE_LYDEFS = $(DIR_LYDEFS) -DEXP_CHARTRANS -I../../../src # Your defines here
 
 # Set SITE_DEFS to one or more of the defines for lynx below:
 SITE_DEFS = $(DIR_DEFS) -DEXP_CHARTRANS # Your defines here
@@ -278,20 +233,14 @@ SITE_DEFS = $(DIR_DEFS) -DEXP_CHARTRANS # Your defines here
 #
 # -DSYSLOG_REQUESTED_URLS
 #
-## if you would like to enable code to detect memory leaks define this in both
-## LYFLAGS (SITE_LYDEFS) and MCFLAGS (SITE_DEFS)
-##
-## -DLY_FIND_LEAKS
-#
 # for installation of local execution links, please see the file userdefs.h
 
-#generic machines with original Berkeley curses
 generic: # NOT-TESTED
 	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
 		LYFLAGS="$(SITE_LYDEFS) -I../../.."
 	cd src; $(MAKE) all CC="$(CC)" \
 		MCFLAGS="" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
+		LIBS="$(LIBS) $(RESOLVLIB) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
 		SITE_DEFS="$(SITE_DEFS)" \
 		WWWINC=$(WWWINC) \
 		WWWLIB="../WWW/Library/unix/libwww.a"
@@ -302,104 +251,15 @@ generic: # NOT-TESTED
 # character file name limit.
 clix:	# NOT-TESTED
 	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -DUSG -DCLIX" \
+		LYFLAGS="$(SITE_LYDEFS) -I../../.. -DUSG" \
 	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DUSG -DCLIX" \
+		MCFLAGS="-DUSG" \
 		LIBS="-lmalloc -lcurses -ltermcap -lbsd -lc_s \
 		$(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
 		SITE_DEFS="$(SITE_DEFS)" \
 		WWWINC=$(WWWINC) \
 		WWWLIB="../WWW/Library/unix/libwww.a"
 
-# Tested on C3 series under ConvexOS 10.1, CC V5.0;
-# Should work on other C-series
-convex:	# NOT-TESTED (replaces convex-curses, convex-ncurses)
-	cd WWW/Library/convex; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -D__STDC__ -Dunix" \
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-D__STDC__ -Dunix" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-dgux:	# NOT-TESTED
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -DDGUX"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DDGUX" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-mips:	# NOT-TESTED
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -systype svr3 -I/svr3/usr/include/bsd"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-systype svr3 -I/svr3/usr/include/bsd" \
-		LIBS="-lcurses -lnsl -lbsd \
-		$(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-freebsd: # NOT-TESTED: replaces freebsd-curses, freebsd-ncurses, freebsd-slang
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.."
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-netbsd:  # NOT-TESTED: replaces netbsd-curses, netbsd-ncurses, netbsd-slang
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.."
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-# Tested on DN 3500 & 4500's running Domain O/S 10.4 BSD
-# -Acpu,mathchip may have to be changed on other machines - see man cpuhep
-apollo:	# NOT-TESTED
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -D_BUILTINS -W0,-opt,4"
-	cd src; $(MAKE) all CC="cc" \
-		MCFLAGS="-D_BUILTINS -W0,-opt,4" \
-		LIBS="-lcurses -ltermcap \
-		$(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a $(MYWWWLIB)"
-
-riscos:	# NOT-TESTED
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.."
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-Dremove=unlink" \
-		LIBS="-lcurses -ltermcap \
-		$(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-# aka HP-UX
-snake:	# NOT-TESTED
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.."
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DSNAKE" \
-		LIBS="-lcurses -ltermcap \
-		$(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
 snake2:	# NOT-TESTED
 	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
 		LYFLAGS="$(SITE_LYDEFS) -I../../.. \
@@ -408,7 +268,7 @@ snake2:	# NOT-TESTED
 		-D_INCLUDE_AES_SOURCE \
 		-D_INCLUDE_XOPEN_SOURCE"
 	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DSNAKE \
+		MCFLAGS="\
 		-D_INCLUDE_HPUX_SOURCE \
 		-D_INCLUDE_POSIX_SOURCE \
 		-D_INCLUDE_AES_SOURCE \
@@ -426,17 +286,7 @@ snake3:	# NOT-TESTED (replaces snake3-curses, snake3-slang)
 	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
 		LYFLAGS="$(SITE_LYDEFS) -I../../.. -Ae"
 	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-Ae -DSNAKE" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-svr4:	# NOT-TESTED
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -DSVR4_BSDSELECT -DSVR4"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DSVR4_BSDSELECT -DTRUE=1 -DFALSE=0" \
+		MCFLAGS="-Ae" \
 		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
 		SITE_DEFS="$(SITE_DEFS)" \
 		WWWINC=$(WWWINC) \
@@ -476,16 +326,6 @@ umaxv:	# NOT-TESTED (replaces umaxv-curses, umaxv-slang)
 		WWWINC=$(WWWINC) \
 		WWWLIB="../WWW/Library/unix/libwww.a"
 
-unixware: # NOT-TESTED (replaces unixware-curses, unixware-slang)
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -DUNIXWARE"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DTRUE=1 -DFALSE=0 -DUNIXWARE" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
 #     has a const/volatile bug in its native cc compiler. (don't use it ;)
 sco:	# NOT-TESTED
 	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
@@ -507,157 +347,6 @@ sco5:	# NOT-TESTED
 		WWWINC=$(WWWINC) \
 		WWWLIB="../WWW/Library/unix/libwww.a"
 
-bsdi:	# TESTED(97/4/15 dickey): replaces bsdi-curses, bsdi-ncurses
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -DBSDI"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-solaris: # TESTED(97/2/17 dickey) replaces solaris2 solaris2cc solaris2-slang solaris2-slangcc
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -DNGROUPS=16 -Dd_namlen=d_reclen -DSOLARIS2 -DSVR4"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="" \
-		LIBS="$(LIBS) $(RESOLVLIB) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-osf:	# NOT-TESTED: replaces osf-curses, osf-slang
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -Olimit 2000 -DSYS5"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-Olimit 4000" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-sgi:	# TESTED(97/2/17 dickey) curses, ncurses, slang
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -cckr"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-cckr" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-linux:	# TESTED(97/2/16 dickey): curses, ncurses, slang
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.."
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-##Various AIX environments
-aix:
-	@echo "Run make again and use \"make aix4\" or \"make aix32\""
-
-# For AIX 4.n, and AIX 3.2.5 with POWER2 architectures, L2 caches,
-# and APAR#IX58890
-aix4:	# NOT-TESTED
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -D_BSD=44"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DAIX4 -D_BSD=44" \
-		LIBS="$(LIBS) -lbsd $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-aix32:	# NOT-TESTED
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.."
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="" \
-		LIBS="$(LIBS) -lbsd $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-##ultrix - DEC Ultrix
-ultrix:	# NOT-TESTED (replaces ultrix-curses, ultrix-slang)
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.."
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-##Various SunOS environments
-sun:
-	@echo "Run make again and use \"make sun3\" or \"make sun4\""
-
-# define RESOLVLIB (above) for the "LIBS" entry if needed
-sun3:	# NOT-TESTED
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.."
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DSUN" \
-		LIBS="$(LIBS) $(RESOLVLIB) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-# define RESOLVLIB (above) for the "LIBS" entry if needed
-sun4:	# TESTED(97/2/17 dickey) replaces sun4-curses, sun4-ncurses, sun4-slang
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.."
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DSUN -DSUN4" \
-		LIBS="$(LIBS) $(RESOLVLIB) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-# news - SONY NEWS-OS 4.2.1R
-news:	# NOT-TESTED (replaces news-curses, news-ncurses, news-slang)
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.."
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-# next - Nextstep
-next:	# NOT-TESTED: replaces next-curses, next-ncurses, next-slang
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -DXMOSAIC_HACK"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DNEXT" \
-		LIBS="$(LIBS) $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
-# isc - Interactive Unix for i386 and i486 machines
-# According to Robert Salter (salter1@mster.nsbf.nasa.gov),
-#  cc should be used instead of gcc.
-# According to Walter Skorski (walt@clyde.jmp.tju.edu),
-#  -DPOSIX_JC is necessary, else LYBookmark.c never finds out
-#  what a mode_t is.
-isc:	# NOT-TESTED
-	cd WWW/Library/unix; $(MAKE) CC="$(CC)" \
-		LYFLAGS="$(SITE_LYDEFS) -I../../.. -DISC"
-	cd src; $(MAKE) all CC="$(CC)" \
-		MCFLAGS="-DISC -DPOSIX_JC" \
-		LIBS="$(LIBS) -linet -lnsl_s -lcposix $(WAISLIB) $(SOCKSLIB) $(SITE_LIBS)" \
-		SITE_DEFS="$(SITE_DEFS)" \
-		WWWINC=$(WWWINC) \
-		WWWLIB="../WWW/Library/unix/libwww.a"
-
 ##Miscellaneous actions
 clean:
 	rm -f WWW/Library/*/*.[aob]
diff --git a/samples/lynx.cfg b/samples/lynx.cfg
index 3ac662f5..452c5165 100644
--- a/samples/lynx.cfg
+++ b/samples/lynx.cfg
@@ -316,6 +316,22 @@ CHARACTER_SET:ISO Latin 1
 #
 #ALWAYS_RESUBMIT_POSTS:FALSE
 
+# If NO_ISMAP_IF_USEMAP is set TRUE, Lynx will not include a link to the
+# server-side image map if both a server-side and client-side map for the
+# same image is indicated in the HTML markup.  The compilation default is
+# FALSE, such that a link with "[ISMAP]" as the link name, followed by a
+# hyphen, will be prepended to the ALT string or "[USEMAP]" pseudo-ALT for
+# accessing Lynx's text-based rendition of the client-side map (based on
+# the content of the associated MAP element).  If the "[ISMAP]" link is
+# activated, Lynx will send a 0,0 coordinate pair to the server, which
+# Lynx-friendly sites can map to a for-text-client document, homologous
+# to what is intended for the content of a FIG element.
+#
+# The compilation default, or default defined here, can be toggled via
+# the "-ismap" command line switch.
+#
+#NO_ISMAP_IF_USEMAP:FALSE
+
 # Local execution links and scripts are completely disabled
 # in the source code unless they are enabled in the
 # userdefs.h file and the sources recompiled.  Please
@@ -1448,3 +1464,39 @@ MINIMAL_COMMENTS:TRUE
 #COLOR:5:blue:white
 #COLOR:6:red:white
 #COLOR:7:magenta:cyan
+
+# External application support. This feature allows lynx to pass a given
+# URL to an external program.  It was written for three reasons.
+#
+# 1) To overcome the deficiency	of Lynx_386 not supporting ftp and news.
+#    External programs can be used instead by passing the URL.
+#
+# 2) To allow for background	transfers in multitasking systems.
+#    I use wget for http and ftp transfers via the external command.
+#
+# 3) To allow for new URLs to be used through lynx.
+#	  URLs can be made up such as mymail: to spawn desired applications
+#	  via the external command.
+#
+# Restrictions can be imposed using -restrictions=externals at the lynx
+# command line.  This will disallow all EXTERNAL lines in lynx.cfg that
+# end in FALSE.  TRUE lines will still function.
+#
+# The lynx.cfg line is as follows:
+#
+# EXTERNAL:<url>:<command> %s:<norestriction>
+#
+# <url> Any given URL.  This can be normal ones like ftp or http or it
+# can be one made up like mymail.
+#
+# <command> The command to run with %s being the URL that will be passed.
+# In Linux I use "wget -q %s &" (no quotes) to spawn a copy of wget for
+# downloading http and ftp files in the background.  In Win95 I use
+# "start ncftp %s" to spawn ncftp in a new window.
+#
+# <norestriction> This complements the -restrictions=externals feature to allow
+# for certain externals to be enabled while restricting others.  TRUE means
+# a command will still function while lynx is restricted.  WB
+#
+# EXTERNAL:ftp:wget %s &:TRUE
+
diff --git a/src/AttrList.h b/src/AttrList.h
new file mode 100644
index 00000000..d0a95c3c
--- /dev/null
+++ b/src/AttrList.h
@@ -0,0 +1,65 @@
+#if !defined(__ATTRLIST_H)
+#define __ATTRLIST_H
+
+#include "HText.h"
+#include "HTMLDTD.h"
+
+#define TEMPSTRINGSIZE 256
+
+enum {
+ ABS_OFF = 0,
+ STACK_OFF = 0,
+ STACK_ON,
+ ABS_ON
+};
+
+#define STARTAT 8
+
+enum {
+ DSTYLE_LINK = HTML_A+STARTAT,
+ DSTYLE_STATUS = HTML_ELEMENTS+STARTAT,
+ DSTYLE_ALINK, /* active link */
+ DSTYLE_NORMAL, /* default attributes */
+	DSTYLE_OPTION, 		/* option on the option screen */
+	DSTYLE_VALUE, 		/* value on the option screen */
+	DSTYLE_HIGH,
+ DSTYLE_CANDY, /* possibly going to vanish */
+ DSTYLE_ELEMENTS
+};
+
+enum {
+ MSTYLE_NORMAL = 0,
+ MSTYLE_EM = 1,
+ MSTYLE_STRONG = 2,
+ MSTYLE_PHYSICAL = 3,
+ MSTYLE_A = 4,
+ MSTYLE_A_OFF = 4, 
+ MSTYLE_A_ON,
+ MSTYLE_BOLD,
+ MSTYLE_UL,
+ MSTYLE_STATUS,
+ MSTYLE_CANDY,
+ MSTYLE_NOMORE
+};
+
+typedef struct {
+ int color; /* color highlighting to be done */
+ int mono; /* mono highlighting to be done */
+ int cattr; /* attributes to go with the color */
+} HTCharStyle;
+
+typedef struct _linkedlist {
+ char name[64];
+ struct _linkedlist *next;
+} linked_list;
+
+#define HText_characterStyle if(TRACE)fprintf(stderr,"HTC called from %s/%d\n",__FILE__,__LINE__);_internal_HTC
+
+#undef HText_characterStyle
+#define HText_characterStyle _internal_HTC
+
+#if defined(USE_COLOR_STYLE)
+extern void _internal_HTC PARAMS((HText * text, int style, int dir));
+#endif
+
+#endif
diff --git a/src/DefaultStyle.c b/src/DefaultStyle.c
index b4ee349a..974a27db 100644
--- a/src/DefaultStyle.c
+++ b/src/DefaultStyle.c
@@ -284,7 +284,7 @@ PRIVATE HTStyle HTStylePreformatted = {
 	&HTStyleExample,  	"Preformatted", "PRE",
 	HT_FONT, 1.0, HT_BLACK,		0, 0,
 	0, 0, 0, HT_LEFT,		1, 0,	tabs_8,
-	NO, YES, 0, 0,			0
+	NO, NO, 0, 0,			0
 };	
 
 PRIVATE HTStyle HTStyleListing = {
diff --git a/src/GridText.c b/src/GridText.c
index ef0c7de5..179cbeed 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -13,6 +13,7 @@
 #include "GridText.h"
 #include "HTFont.h"
 #include "HTAccess.h"
+#include "HTAnchor.h"
 #include "HTParse.h"
 #include "HTTP.h"
 #include "HTAlert.h"
@@ -44,6 +45,26 @@
 #endif /* SYSLOG_REQUESTED_URLS */
 #endif /* !VMS */
 
+#ifdef USE_COLOR_STYLE
+#include "AttrList.h"
+#include "LYHash.h"
+
+unsigned cached_styles[CACHEH][CACHEW];
+
+#endif
+
+#ifdef USE_COLOR_STYLE_UNUSED
+void LynxClearScreenCache NOARGS
+{
+	int i,j;
+if (TRACE)
+	fprintf(stderr, "flushing cached screen styles\n");
+	for (i=0;i<CACHEH;i++)
+		for (j=0;j<CACHEW;j++)
+			cached_styles[i][j]=s_a;
+}
+#endif /* USE_COLOR_STYLE */
+
 struct _HTStream {                      /* only know it as object */
     CONST HTStreamClass *       isa;
     /* ... */
@@ -86,6 +107,17 @@ PUBLIC char * unchecked_radio = "( )";
 PUBLIC BOOLEAN underline_on = OFF;
 PUBLIC BOOLEAN bold_on      = OFF;
 
+#if defined(USE_COLOR_STYLE) || defined(SLCS)
+#define MAX_STYLES_ON_LINE 64
+
+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;
+#endif
+
 typedef struct _line {
 	struct _line	*next;
 	struct _line	*prev;
@@ -93,6 +125,10 @@ typedef struct _line {
 	int unsigned	size;		/* Number of characters */
 	BOOL	split_after;		/* Can we split after? */
 	BOOL	bullet;			/* Do we bullet? */
+#if defined(USE_COLOR_STYLE) || defined(SLCS)
+	HTStyleChange	styles[MAX_STYLES_ON_LINE];
+	int	numstyles;
+#endif
 	char	data[1];		/* Space for terminator at least! */
 } HTLine;
 
@@ -102,13 +138,13 @@ typedef struct _TextAnchor {
 	struct _TextAnchor *	next;
 	int			number;		/* For user interface */
 	int			start;		/* Characters */
-        int			line_pos;	/* Position in text */
-	int			extent;		/* Characters */
+	int			line_pos;	/* Position in text */
+	int			extent; 	/* Characters */
 	int			line_num;	/* Place in document */
-	char *		        hightext;	/* The link text */
-	char *		        hightext2;	/* A second line*/
-        int 		    	hightext2offset;/* offset from left */
-	int			link_type;	/* Normal or form? */
+	char *			hightext;	/* The link text */
+	char *			hightext2;	/* A second line*/
+	int			hightext2offset;/* offset from left */
+	int			link_type;	/* Normal, internal, or form? */
 	FormInfo *		input_field;	/* Info for form links */
 	BOOL			show_anchor;	/* Show the anchor? */
 	HTChildAnchor *		anchor;
@@ -136,6 +172,7 @@ struct _HText {
 	BOOL			source;		/* Is the text source? */
 	BOOL			toolbar;	/* Toolbar set? */
 	HTList *		tabs;		/* TAB IDs */
+	HTList *		hidden_links;	/* Content-less links */
 	BOOL			no_cache;	/* Always refresh? */
 	char			LastChar;	/* For aborbing white space */
 	BOOL			IgnoreExcess;	/* Ignore chars at wrap point */
@@ -149,24 +186,28 @@ struct _HText {
 	int			permissible_split;	/* in last line */
 	BOOL			in_line_1;		/* of paragraph */
 	BOOL			stale;			/* Must refresh */
+	BOOL			page_has_target; /* has target on screen */
 
-        HTkcode			kcode;			/* Kanji code? */
-	enum grid_state	      { S_text, S_esc, S_dollar, S_paren,
+	HTkcode 		kcode;			/* Kanji code? */
+	enum grid_state       { S_text, S_esc, S_dollar, S_paren,
 				S_nonascii_text, S_dollar_paren,
 				S_jisx0201_text }
 				state;			/* Escape sequence? */
 	char			kanji_buf;		/* Lead multibyte */
 	int			in_sjis;		/* SJIS flag */
 
-        HTStream*               target;                 /* Output stream */
-        HTStreamClass           targetClass;            /* Output routines */
+	HTStream*		target; 		/* Output stream */
+	HTStreamClass		targetClass;		/* Output routines */
 #ifdef EXP_CHARTRANS
-    LYUCcharset	* UCI;	/* pointer to node_anchor's UCInfo */
-    int	UCLYhndl;		/* tells us what charset we are fed */
-    UCTransParams T;
+	LYUCcharset	* UCI;	/* pointer to node_anchor's UCInfo */
+	int	UCLYhndl;	/* tells us what charset we are fed */
+	UCTransParams T;
+	BOOL 	have_8bit_chars;	/* Any non-ASCII characters? */
 #endif
 };
 
+PRIVATE void HText_AddHiddenLink PARAMS((HText *text, TextAnchor *textanchor));
+
 /*
  *  Boring static variable used for moving cursor across
  */
@@ -275,6 +316,9 @@ PUBLIC HText *	HText_new ARGS1(
         outofmem(__FILE__, "HText_New");
     line->next = line->prev = line;
     line->offset = line->size = 0;
+#ifdef USE_COLOR_STYLE
+    line->numstyles = 0;
+#endif
     self->Lines = self->chars = 0;
     self->first_anchor = self->last_anchor = NULL;
     self->style = &default_style;
@@ -284,6 +328,7 @@ PUBLIC HText *	HText_new ARGS1(
     self->stale = YES;
     self->toolbar = NO;
     self->tabs = NULL;
+    self->hidden_links = NULL;
     self->no_cache = ((anchor->no_cache || anchor->post_data) ?
     							  YES : NO);
     self->LastChar = '\0';
@@ -302,6 +347,7 @@ PUBLIC HText *	HText_new ARGS1(
     self->state = S_text;
     self->kanji_buf = '\0';
     self->in_sjis = 0;
+    self->have_8bit_chars = NO;
 
 #ifdef EXP_CHARTRANS
 	htext_get_chartrans_info(self);
@@ -454,6 +500,20 @@ PUBLIC void HText_free ARGS1(
 	    FREE(Tab->name);
 	}
 	HTList_delete(self->tabs);
+	self->tabs = NULL;
+    }
+
+    /*
+     *  Free the hidden links list. - FM
+     */
+    if (self->hidden_links) {
+        char * href = NULL;
+	HTList * cur = self->hidden_links;
+
+	while (NULL != (href = (char *)HTList_nextObject(cur)))
+	    FREE(href);
+	HTList_delete(self->hidden_links);
+	self->hidden_links = NULL;
     }
 
     /*
@@ -467,7 +527,11 @@ PUBLIC void HText_free ARGS1(
 	HTAnchor_resetUCInfoStage(self->node_anchor, -1, UCT_STAGE_HTEXT,
 				  UCT_SETBY_NONE);
 #endif /* EXP_CHARTRANS */
-        HTAnchor_delete(self->node_anchor);
+        if (HTAnchor_delete(self->node_anchor))
+	    /*
+	     * Make sure HTMainAnchor won't point to an invalid structure. - kw
+	     */
+	    HTMainAnchor = NULL;
     }
 
     FREE(self);
@@ -489,7 +553,11 @@ PRIVATE int display_line ARGS2(
     char buffer[7];
     char *data;
 #ifdef EXP_CHARTRANS
-    int utf_extra = 0;
+    size_t utf_extra = 0;
+#endif
+#ifdef USE_COLOR_STYLE
+    int current_style = 0;
+    int real_position = 0;
 #endif
 
     buffer[0] = buffer[1] = buffer[2] = '\0';
@@ -511,39 +579,51 @@ PRIVATE int display_line ARGS2(
     /* add data */
     data = line->data;
     i++;
+#ifdef USE_COLOR_STYLE
+    real_position = i;
+#endif
     while ((i < LYcols) && ((buffer[0] = *data) != '\0')) {
 	data++;
-	i++;
 
+#if defined(USE_COLOR_STYLE) || defined(SLSC)
+#define CStyle line->styles[current_style]
+
+	while (current_style < line->numstyles &&
+	       i >= CStyle.horizpos + line->offset + 1)
+	{
+		(void) LynxChangeStyle (CStyle.style,CStyle.direction,CStyle.previous);
+		current_style++;
+	}
+#endif
    	switch (buffer[0]) {
 
+#ifndef USE_COLOR_STYLE
 	    case LY_UNDERLINE_START_CHAR:
-	        if (!(dump_output_immediately && use_underscore)) {
-		    start_underline();
-		    i--;
+	        if (dump_output_immediately && use_underscore) {
+		    addch ('_');
+		    i++;
 		} else {
-		    addch('_');
+		    lynx_start_underline_color ();
 		}
 		break;
 
 	    case LY_UNDERLINE_END_CHAR:
-	        if (!(dump_output_immediately && use_underscore)) {
-		    stop_underline();
-		    i--;
+	        if (dump_output_immediately && use_underscore) {
+		    addch ('_');
+		    i++;
 		} else {
-		    addch('_');
+		    lynx_stop_underline_color ();
 		}
 		break;
 
 	    case LY_BOLD_START_CHAR:
-	        start_bold();
-		i--;
+		lynx_start_bold_color ();
 		break;
 
 	    case LY_BOLD_END_CHAR:
-	        stop_bold ();
-		i--;
+		lynx_stop_bold_color ();
 		break;
+#endif
 
 	    case LY_SOFT_HYPHEN:
 	        if (*data != '\0') {
@@ -551,16 +631,17 @@ PRIVATE int display_line ARGS2(
 		     *  Ignore the soft hyphen if it is not
 		     *  the last character in the line. - FM
 		     */
-		    i--;
 		    break;
 		} else {
 		    /*
 		     *  Make it a hard hyphen and fall through. - FM
 		     */
 		    buffer[0] = '-';
+		    i++;
 		}
 
 	    default:
+		    i++;
 #ifdef EXP_CHARTRANS
 		    if (text->T.output_utf8 && !isascii(buffer[0])) {
 			if ((*buffer & 0xe0) == 0xc0) {
@@ -604,8 +685,17 @@ PRIVATE int display_line ARGS2(
     /* add the return */
     addch('\n');
 
-    stop_underline();
-    stop_bold();
+#ifndef USE_COLOR_STYLE
+    lynx_stop_underline_color ();
+    lynx_stop_bold_color ();
+#else
+    while (current_style < line->numstyles)
+    {
+	(void) LynxChangeStyle (CStyle.style, CStyle.direction, CStyle.previous);
+	current_style++;
+    }
+#undef CStyle
+#endif
     return(0);
 }
 
@@ -616,7 +706,10 @@ PRIVATE void display_title ARGS1(
 	HText *,	text)
 {
     char *title = NULL;
-    char percent[20], format[20];
+    char percent[20];
+#ifdef NOTDEFINED
+    char format[20];
+#endif
     char *cp = NULL;
     unsigned char *tmp = NULL;
     int i = 0, j = 0;
@@ -627,6 +720,8 @@ PRIVATE void display_title ARGS1(
     if (!text)
         return;
 
+    lynx_start_title_color ();
+
     /*
      *  Load the title field. - FM
      */
@@ -670,12 +765,18 @@ PRIVATE void display_title ARGS1(
     /*
      *  Generate format string.
      */
+#ifdef NOTDEFINED
+    /* Using this kind of format string, sprintf() didn't always get it
+       right at least on solaris if the title string contained some 8-bit 
+       characters.  - kw
+       */
     sprintf(format, "%s%%%d.%ds%%s\n",
     		    ((text->top_of_screen > 0 &&
 		      HText_hasToolbar(text)) ?
 		      			  "#" : " "),
 		    (LYcols-2)-strlen(percent),
 		    (LYcols-2)-strlen(percent));
+#endif /* NOTDEFINED */
 
     /*
      *  Generate and display the complete title string.
@@ -697,18 +798,39 @@ PRIVATE void display_title ARGS1(
 		    }
 		}
 	    }
-	    sprintf(cp, format, tmp, percent);
-	    FREE(tmp);
-        } else {
-	    sprintf(cp, format, title, percent);
+	    FREE(title);
+	    title = tmp;
         }
-    } else {
-        sprintf(cp, format, title, percent);
     }
+
     move(0,0);
+    clrtoeol();
+    if (text->top_of_screen > 0 && HText_hasToolbar(text)) {
+	addch('#');
+    }
+
+    i = (LYcols-2)-strlen(percent);
+    if ((i = (LYcols-1) - strlen(percent) - strlen(title)) > 0) {
+	move(0,i);
+    } else {
+	title[LYcols - 2 - strlen(percent)] = '\0';
+	move(0,1);
+    }
+    sprintf(cp, "%s%s\n", title, percent);
+#ifdef USE_COLOR_STYLE 
+/* turn the TITLE style on */
+    LynxChangeStyle(s_title, ABS_ON, 0);
+    addstr(cp);
+/* turn the TITLE style off */
+    LynxChangeStyle(s_title, ABS_OFF, 0);
+#else
     addstr(cp);
+#endif
     FREE(cp);
     FREE(title);
+   
+    lynx_stop_title_color ();
+
     return;
 }
 
@@ -728,11 +850,15 @@ PRIVATE void display_page ARGS3(
     TextAnchor *Anchor_ptr = NULL;
     FormInfo *FormInfo_ptr;
     BOOL display_flag = FALSE;
-    HTAnchor *link_dest;
+    HTAnchor *link_dest, *link_dest_intl = NULL;
     static int last_nlinks = 0;
 #ifdef EXP_CHARTRANS
     int utf_found = 0;
+#ifdef EXP_CHARTRANS_AUTOSWITCH
+#ifdef LINUX
     static int charset_last_displayed = -1;
+#endif
+#endif
 #endif /* EXP_CHARTRANS */
 
     lynx_mode = NORMAL_LYNX_MODE;
@@ -755,6 +881,7 @@ PRIVATE void display_page ARGS3(
     }
 
     tmp[0] = tmp[1] = tmp[2] = '\0';
+    text->page_has_target = NO;
     last_screen = text->Lines - (display_lines-2);
     line = text->last_line->prev;
 
@@ -784,8 +911,20 @@ PRIVATE void display_page ARGS3(
 	LYCursesON) {
 	charset_last_displayed = current_char_set;
 	stop_curses();
+	if (LYTraceLogFP)
+	    /*
+	     *  Set stderr back to its original value,
+	     *  because the current UCChangeTerminalCodepage()
+	     *  writes escape sequences to stderr. - kw
+	     */
+	    *stderr = LYOrigStderr;
 	UCChangeTerminalCodepage(current_char_set,
-				&LYCharSet_UC[current_char_set]);
+				 &LYCharSet_UC[current_char_set]);
+	if (LYTraceLogFP)
+	    /*
+	     *  Set stderr back to the log file on return.
+	     */
+	    *stderr = *LYTraceLogFP;
 	start_curses();
     }
 #endif /* LINUX */
@@ -846,12 +985,12 @@ PRIVATE void display_page ARGS3(
 	    int x_pos=(int)line->offset + (int)(cp - line->data);
 	    int len = strlen(target);
 #ifdef EXP_CHARTRANS
-	    int utf_extra = 0;
+	    size_t utf_extra = 0;
 #endif /* EXP_CHARTRANS */
 
-	    start_bold();
-	    start_reverse();
-	    start_underline();
+	    text->page_has_target = YES;
+
+	    lynx_start_target_color ();
 		/* underline string */
 	    for (; written < len && (tmp[0] = line->data[itmp]) != '\0';
 		   itmp++)  {
@@ -946,9 +1085,7 @@ PRIVATE void display_page ARGS3(
 		}
 	    }
 
-	    stop_underline();
-	    stop_reverse();
-	    stop_bold();
+	    lynx_stop_target_color ();
 	    move(i+2, 0);
 	}
 
@@ -986,7 +1123,7 @@ PRIVATE void display_page ARGS3(
 		/* load normal hypertext anchors */
 	    if (Anchor_ptr->show_anchor && Anchor_ptr->hightext && 
 			strlen(Anchor_ptr->hightext)>0 && 
-			Anchor_ptr->link_type == HYPERTEXT_ANCHOR) {
+			(Anchor_ptr->link_type & HYPERTEXT_ANCHOR)) {
 
                 links[nlinks].hightext  = Anchor_ptr->hightext;
                 links[nlinks].hightext2 = Anchor_ptr->hightext2;
@@ -1004,9 +1141,31 @@ PRIVATE void display_page ARGS3(
 	            auto char *cp_AnchorAddress = NULL;
 		    if (traversal)
 		        cp_AnchorAddress = stub_HTAnchor_address(link_dest);
-		    else
-			cp_AnchorAddress = HTAnchor_address(link_dest);
-
+		    else {
+			if (Anchor_ptr->link_type == INTERNAL_LINK_ANCHOR) {
+			    link_dest_intl = HTAnchor_followTypedLink(
+				(HTAnchor *)Anchor_ptr->anchor, LINK_INTERNAL);
+			    if (link_dest_intl && link_dest_intl != link_dest) {
+				if (TRACE)
+				    fprintf(stderr,
+				    "display_page: unexpected typed link to %s!\n",
+					    link_dest_intl->parent->address);
+				link_dest_intl = NULL;
+			    }
+			} else
+			    link_dest_intl = NULL;
+			if (link_dest_intl) {
+			    char *cp2 = HTAnchor_address(link_dest_intl);
+			    cp = strchr(cp2, '#');
+			    if (cp && cp != cp2 &&
+				0!=strncmp(cp2, "LYNXIMGMAP:", 11)) {
+				StrAllocCopy(cp_AnchorAddress, cp);
+				FREE(cp2);
+			    } else
+				cp_AnchorAddress = cp2;
+			} else
+			    cp_AnchorAddress = HTAnchor_address(link_dest);
+		    }
 		    FREE(links[nlinks].lname);
 
 		    if (cp_AnchorAddress != NULL)
@@ -1017,8 +1176,12 @@ PRIVATE void display_page ARGS3(
 
       	        links[nlinks].lx = Anchor_ptr->line_pos;
       	        links[nlinks].ly = (Anchor_ptr->line_num+1)-line_number;
-	        links[nlinks].type = WWW_LINK_TYPE;
+		if (link_dest_intl)
+		    links[nlinks].type = WWW_INTERN_LINK_TYPE;
+		else
+		    links[nlinks].type = WWW_LINK_TYPE;
 		links[nlinks].target = empty_string;
+		links[nlinks].form = NULL;
 
 	        nlinks++;
 		display_flag = TRUE;
@@ -1060,6 +1223,7 @@ PRIVATE void display_page ARGS3(
 
   		/* never a second line on form types */
 		links[nlinks].hightext2 = NULL;
+		links[nlinks].hightext2_offset = 0;
 
 		nlinks++;
 	         /* bold the link after incrementing nlinks */
@@ -1197,6 +1361,23 @@ PRIVATE void split_line ARGS2(
     previous->next->prev = line;
     line->prev = previous;
     line->next = previous->next;
+#if defined(USE_COLOR_STYLE) || defined(SLCS)
+#define LastStyle (previous->numstyles-1)
+    line->numstyles = 0;
+    /* FIXME: RJP - shouldn't use 0xffffffff for largest integer */
+    line->styles[0].horizpos = 0xffffffff;
+    if (previous->numstyles && previous->styles[LastStyle].direction)
+    {
+	line->numstyles = 1;
+	line->styles[0].horizpos = 0;
+	line->styles[0].direction = ON;
+	line->styles[0].style = previous->styles[LastStyle].style;
+	previous->styles[previous->numstyles].style = line->styles[0].style;
+	previous->styles[previous->numstyles].direction = ABS_OFF;
+	previous->styles[previous->numstyles].horizpos = previous->size;
+	previous->numstyles++;
+    }
+#endif
     previous->next = line;
     text->last_line = line;
     line->size = 0;
@@ -1502,6 +1683,12 @@ PUBLIC void HText_appendCharacter ARGS2(
      */
     if (ch == '\033' && HTCJK == NOCJK)			/* decimal 27 */
 	return;
+#ifdef EXP_CHARTRANS
+    if ((unsigned char)ch >= 128 && HTCJK == NOCJK &&
+	!text->T.transp && !text->T.output_utf8 &&
+	(unsigned char)ch < LYlowest_eightbit[current_char_set])
+	return;
+#endif /* EXP_CHARTRANS */
     if ((unsigned char)ch == 155 && HTCJK == NOCJK) {	/* octal 233 */
         if (!HTPassHighCtrlRaw &&
 #ifdef EXP_CHARTRANS
@@ -1633,6 +1820,7 @@ PUBLIC void HText_appendCharacter ARGS2(
     }
 
     if (ch != LY_SOFT_HYPHEN && IsSpecialAttrChar(ch)) {
+#ifndef USE_COLOR_STYLE
         if (ch == LY_UNDERLINE_START_CHAR) { 
             line->data[line->size++] = LY_UNDERLINE_START_CHAR;
 	    line->data[line->size] = '\0';
@@ -1660,6 +1848,9 @@ PUBLIC void HText_appendCharacter ARGS2(
 	    ctrl_chars_on_this_line++;
             return;
 	}
+#else
+	return;
+#endif
     }
 
 #ifdef EXP_CHARTRANS
@@ -1821,6 +2012,9 @@ check_IgnoreExcess:
         ch = ' ';
     }
 
+    if (ch & 0x80)
+	text->have_8bit_chars = YES;
+
     {
         HTLine * line = text->last_line;	/* May have changed */
         HTFont font = style->font;
@@ -1878,6 +2072,35 @@ check_IgnoreExcess:
     }
 }
 
+#ifdef USE_COLOR_STYLE
+/*  Insert a style change into the current line
+**  -------------------------------------------
+*/
+PUBLIC void _internal_HTC ARGS3(HText *,text, int,style, int,dir)
+{
+ HTLine* line;
+ static int last_style = -1;
+ static int last_dir = -1;
+
+ /* can't change style if we have no text to change style with */
+ if (!text) return;
+
+ line = text->last_line;
+
+ if ((style != last_style || dir != last_dir) && line->numstyles < MAX_STYLES_ON_LINE)
+ {
+      line->styles[line->numstyles].horizpos = line->size;
+      line->styles[line->numstyles].style = style;
+      line->styles[line->numstyles].direction = dir;
+      line->numstyles++;
+ }
+ last_style = style;
+ last_dir = dir;
+}
+#endif
+
+
+
 /*	Set LastChar element in the text object.
 **	----------------------------------------
 */
@@ -1945,20 +2168,25 @@ PUBLIC void HText_beginAnchor ARGS2(
     a->next = 0;
     a->anchor = anc;
     a->extent = 0;
-    a->link_type = HYPERTEXT_ANCHOR;
     text->last_anchor = a;
     
-    if (HTAnchor_followMainLink((HTAnchor*)anc)) {
+    if (HTAnchor_followTypedLink((HTAnchor*)anc, LINK_INTERNAL)) {
+        a->number = ++(text->last_anchor_number);
+	a->link_type = INTERNAL_LINK_ANCHOR;
+    } else if (HTAnchor_followMainLink((HTAnchor*)anc)) {
         a->number = ++(text->last_anchor_number);
+	a->link_type = HYPERTEXT_ANCHOR;
     } else {
         a->number = 0;
+	a->link_type = HYPERTEXT_ANCHOR;
     }
 
     /* if we are doing link_numbering add the link number */
     if (keypad_mode == LINKS_ARE_NUMBERED && a->number > 0) {
 	sprintf(marker,"[%d]", a->number);
         HText_appendText(text, marker);
-	a->start += strlen(marker);
+	a->start = text->chars + text->last_line->size;
+	a->line_pos = text->last_line->size;
     }
 }
 
@@ -1971,28 +2199,300 @@ PUBLIC void HText_endAnchor ARGS1(
         /*
 	 *  If it goes somewhere...
 	 */
-        a->extent += text->chars + text->last_line->size - a->start;
-	if (a->extent <= 2) {
+	int i, j, k;
+	BOOL remove_numbers_on_empty =
+	    (keypad_mode == LINKS_ARE_NUMBERED &&
+	     (LYHiddenLinks != HIDDENLINKS_MERGE ||
+	      (LYNoISMAPifUSEMAP &&
+	       HTAnchor_isISMAPScript(
+		   HTAnchor_followMainLink((HTAnchor *)a->anchor)))));
+	HTLine *last = text->last_line;
+	HTLine *prev = text->last_line->prev;
+
+	/*
+	 *  Check if the anchor content has only
+	 *  white and special characters. - FM
+	 */
+        a->extent += text->chars + last->size - a->start;
+	if (a->extent > last->size) {
+	    /*
+	     *  It extends over more than one line, so
+	     *  set up to check the last line. - FM
+	     */
+	    i = last->size;
+	} else {
+	    i = a->extent;
+	}
+	j = (last->size - i);
+	while (j < last->size) {
+	    if (!IsSpecialAttrChar(last->data[j]) &&
+	        !isspace((unsigned char)last->data[j]) &&
+		last->data[j] != HT_NON_BREAK_SPACE &&
+		last->data[j] != HT_EM_SPACE)
+		break;
+	    i--;
+	    j++;
+	}
+	if (i == 0 && a->extent > last->size) {
+	    /*
+	     *  The last line had only white and special
+	     *  characters, and it extends over more than
+	     *  one line, so check the next to last. - FM
+	     */
+	    j = prev->size - a->extent + last->size + 1;
+	    if (j < 0) {
+	        /*
+		 *  It extends over more than two lines,
+		 *  so check all of the previous line. - FM
+		 */
+	        j = 0;
+		i = prev->size;
+	    } else {
+	        i = a->extent - last->size - 1;
+	    }
+	    while (j < prev->size) {
+	        if (!IsSpecialAttrChar(prev->data[j]) &&
+		    !isspace((unsigned char)prev->data[j]) &&
+		    prev->data[j] != HT_NON_BREAK_SPACE &&
+		    prev->data[j] != HT_EM_SPACE)
+		    break;
+		i--;
+		j++;
+	    }
+	    if (i == 0 && a->extent > (last->size + prev->size + 1)) {
+	        /*
+		 *  It extends over more than two lines, and the
+		 *  last two have only white and special characters,
+		 *  so check the second to last line. - FM
+		 */
+	        prev = prev->prev;
+		j = prev->size - a->extent + last->size + prev->next->size + 2;
+		if (j < 0) {
+		    /*
+		     *  It extends over more than three lines,
+		     *  so check all of the second to last. - FM
+		     */
+		    j = 0;
+		    i = prev->size;
+		} else {
+		    i = a->extent - last->size - prev->next->size - 2;
+		}
+		while (j < prev->size) {
+		    if (!IsSpecialAttrChar(prev->data[j]) &&
+		        !isspace((unsigned char)prev->data[j]) &&
+			prev->data[j] != HT_NON_BREAK_SPACE &&
+			prev->data[j] != HT_EM_SPACE)
+			break;
+		    i--;
+		    j++;
+		}
+		if (i == 0 &&
+		    a->extent >
+		    (last->size + prev->size + prev->prev->size + 2)) {
+		    /*
+		     *  It extends over more than three lines, and the
+		     *  last three have only white and special characters,
+		     *  so for now, we'll assume it should be shown. - FM
+		     */
+		    i = a->extent;
+		}
+	    }
+	}
+	if (i == 0) {
 	    /*
-	     *  Might be a blank anchor from an ALT="". - FM
+	     *  It's an invisible anchor probably from an ALT=""
+	     *  or an ignored ISMAP attribute due to a companion
+	     *  USEMAP. - FM
 	     */
-    	    int j;
 	    a->show_anchor = NO;
-	    for (j = (text->last_line->size - a->extent);
-	         text->last_line->data[j] != '\0'; j++) {
-		if (!IsSpecialAttrChar(text->last_line->data[j])) {
+	    prev = last->prev;
+
+	    /*
+	     *  If links are numbered, then try to get rid of the
+	     *  numbered bracket and adjust the anchor count. - FM
+	     *
+	     * Well, let's do this only if -hiddenlinks=merged is not in
+	     * effect, or if we can be reasonably sure that
+	     * this is the result of an intentional non-generation of
+	     * anchor text via NO_ISMAP_IF_USEMAP. In other cases it can
+	     * actually be a feature that numbered links alert the viewer
+	     * to the presence of a link which is otherwise not selectable -
+	     * possibly caused by HTML errors. - kw
+	     */
+	    if (remove_numbers_on_empty) {
+		j = (last->size - a->extent - 1);
+		if (j < 0)
+		    j = 0;
+		i = j;
+		if (last->data[j] == ']') {
+		    j--;
+		    while (j >= 0 && isdigit((unsigned char)last->data[j]))
+		        j--;
+		    if (j < 0)
+		        j = 0;
+		    if (last->data[j] == '[') {
+		        /*
+			 *  The numbered bracket is on the last line. - FM
+			 */
+			HText_AddHiddenLink(text, a);
+			a->number = 0;
+			text->last_anchor_number--;
+			k = (i + 1);
+			while (k < last->size) {
+			    if (last->data[k] == LY_UNDERLINE_START_CHAR ||
+				last->data[k] == LY_UNDERLINE_END_CHAR ||
+				last->data[k] == LY_BOLD_START_CHAR ||
+				last->data[k] == LY_BOLD_END_CHAR ||
+				last->data[k] == LY_SOFT_HYPHEN)
+			        ctrl_chars_on_this_line--;
+			    k++;
+			}
+		        last->size = j;
+			last->data[j] = '\0';
+		    } else if (prev && prev->size > 1) {
+		        k = (i + 1);
+		        i = prev->size;
+		        j = (prev->size - 1);
+			while ((j >= 0) &&
+			       (prev->data[j] == LY_BOLD_START_CHAR ||
+			        prev->data[j] == LY_BOLD_END_CHAR ||
+				prev->data[j] == LY_UNDERLINE_START_CHAR ||
+			        prev->data[j] == LY_UNDERLINE_END_CHAR ||
+				prev->data[j] == LY_SOFT_HYPHEN))
+			    j--;
+			while (j >= 0 && isdigit((unsigned char)prev->data[j]))
+			    j--;
+			if (j < 0)
+			    j = 0;
+			if (prev->data[j] == '[') {
+			    /*
+			     *  The numbered bracket started on the
+			     *  previous line, and part of it was
+			     *  wrapped to the last line. - FM
+			     */
+			    HText_AddHiddenLink(text, a);
+			    a->number = 0;
+			    text->last_anchor_number--;
+			    prev->size = j;
+			    prev->data[j] = '\0';
+			    text->chars -= (i - j);
+			    while (k < last->size) {
+				if (last->data[k] == LY_UNDERLINE_START_CHAR ||
+				    last->data[k] == LY_UNDERLINE_END_CHAR ||
+				    last->data[k] == LY_BOLD_START_CHAR ||
+				    last->data[k] == LY_BOLD_END_CHAR ||
+				    last->data[k] == LY_SOFT_HYPHEN)
+			            ctrl_chars_on_this_line--;
+				k++;
+			    }
+			    last->size = 0;
+			    last->data[0] = '\0';
+			    for (j = 1; j < k; j++)
+			        last->data[j] = '\0';
+			}
+		    }
+		} else if (prev && prev->size > 2) {
+		    i = (prev->size - 1);
+		    while ((i >= 0) &&
+			   (prev->data[i] == LY_BOLD_START_CHAR ||
+			    prev->data[i] == LY_BOLD_END_CHAR ||
+			    prev->data[i] == LY_UNDERLINE_START_CHAR ||
+			    prev->data[i] == LY_UNDERLINE_END_CHAR ||
+			    prev->data[i] == LY_SOFT_HYPHEN))
+		        i--;
+		    if (i < 0)
+		        i = 0;
+		    j = i;
+		    i++;
+		    if ((j > 2) &&
+		        (prev->data[j] == ']' &&
+			 isdigit((unsigned char)prev->data[j - 1]))) {
+		        k = (j + 1);
+		        j--;
+			while (j >=0 && isdigit((unsigned char)prev->data[j]))
+			    j--;
+			if (j < 0)
+			    j = 0;
+			if (prev->data[j] == '[') {
+			    /*
+			     *  The numbered bracket is all on the
+			     *  previous line, and the anchor content
+			     *  was wrapped to the last line. - FM
+			     */
+			    HText_AddHiddenLink(text, a);
+			    a->number = 0;
+			    text->last_anchor_number--;
+			    while (k < prev->size) {
+				if (prev->data[k] == LY_UNDERLINE_START_CHAR ||
+				    prev->data[k] == LY_UNDERLINE_END_CHAR ||
+				    prev->data[k] == LY_BOLD_START_CHAR ||
+				    prev->data[k] == LY_BOLD_END_CHAR ||
+				    prev->data[k] == LY_SOFT_HYPHEN)
+				prev->data[j++] = prev->data[k++];
+				i++;
+			    }
+			    prev->size = j;
+			    prev->data[j] = '\0';
+			    text->chars -= (i - j);
+			    k = 0;
+			    while (k < last->size) {
+				if (last->data[k] == LY_UNDERLINE_START_CHAR ||
+				    last->data[k] == LY_UNDERLINE_END_CHAR ||
+				    last->data[k] == LY_BOLD_START_CHAR ||
+				    last->data[k] == LY_BOLD_END_CHAR ||
+				    last->data[k] == LY_SOFT_HYPHEN)
+			            ctrl_chars_on_this_line--;
+				k++;
+			    }
+			    last->data[0] = '\0';
+			    last->size = 0;
+			} else {
+			    /*
+			     *  Shucks!  We didn't find the
+			     *  numbered bracket. - FM
+			     */
+			    a->show_anchor = YES;
+			}
+		    } else {
+			/*
+			 *  Shucks!  We didn't find the
+			 *  numbered bracket. - FM
+			 */
+		        a->show_anchor = YES;
+		    }
+		} else {
+		    /*
+		     *  Shucks!  We didn't find the
+		     *  numbered bracket. - FM
+		     */
 		    a->show_anchor = YES;
-		    break;
 		}
+	    } else if (LYHiddenLinks != HIDDENLINKS_MERGE) {
+		HText_AddHiddenLink(text, a);
+		a->number = 0;
+	        text->last_anchor_number--;
 	    }
 	} else {
+	    /*
+	     *  The anchor content does not contain only
+	     *  white and special characters (or extends
+	     *  over more than three lines and we're punting,
+	     *  for now), so we'll show it as a link. - FM
+	     */
 	    a->show_anchor = YES;
 	}
+	if (a->show_anchor == NO) {
+	    a->extent = 0;
+	}
     } else {
+        /*
+	 *  It's a named anchor without an HREF, so it
+	 *  should be registered but not shown as a
+	 *  link. - FM
+	 */
         a->show_anchor = NO;
 	a->extent = 0;
     }
- 
 }
 
 
@@ -2071,11 +2571,11 @@ PUBLIC void HText_endAppend ARGS1(
 	FREE(text->last_line);
         text->last_line = next_to_the_last_line;
         text->Lines--;
-
+#ifdef NOTUSED_BAD_FOR_SCREEN
         if (TRACE)
             fprintf(stderr, "GridText: New bottom line: %s\n",
                             text->last_line->data);
-
+#endif
     }
 
     if (TRACE)
@@ -2110,7 +2610,7 @@ re_parse:
 	 *  Strip off any spaces or SpecialAttrChars at the beginning,
 	 *  if they exist, but only on HYPERTEXT_ANCHORS.
 	 */
-	if (anchor_ptr->link_type == HYPERTEXT_ANCHOR) {
+	if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) {
 	    ch = (unsigned char)line_ptr->data[anchor_ptr->line_pos];
             while (isspace(ch) ||
 	           IsSpecialAttrChar(ch)) {
@@ -2122,11 +2622,11 @@ re_parse:
 
 	if (anchor_ptr->extent < 0)
 	    anchor_ptr->extent = 0;
-
+#ifdef NOTUSED_BAD_FOR_SCREEN
 	if (TRACE)
 	    fprintf(stderr, "anchor text: '%s'   pos: %d\n",
 	    		    line_ptr->data, anchor_ptr->line_pos);
-
+#endif
 	/* 
 	 *  If the link begins with a end of line and we have more
 	 *  lines, then start the highlighting on the next line.
@@ -2139,11 +2639,11 @@ re_parse:
 		fprintf(stderr, "found anchor at end of line\n");
 	    goto re_parse;
 	}
-
+#ifdef NOTUSED_BAD_FOR_SCREEN
 	if (TRACE)
 	    fprintf(stderr, "anchor text: '%s'   pos: %d\n",
 	    		    line_ptr->data, anchor_ptr->line_pos);
-
+#endif
 	/*
 	 *  Copy the link name into the data structure.
 	 */
@@ -2247,38 +2747,171 @@ PUBLIC HTChildAnchor * HText_childNumber ARGS1(
 
 /*
  *  HTGetLinkInfo returns some link info based on the number.
+ *
+ *  If go_line is not NULL, caller requests to know a line number for
+ *  the link indicated by number.  It will be returned in *go_line, and
+ *  *linknum will be set to an index into the links[] array, to use after
+ *  the line in *line has been made the new top screen line.
+ *  *hightext and *lname are unchanged. - KW
+ *
+ *  If go_line is NULL, info on the link indicated by number is deposited
+ *  in *hightext and *lname.
  */
-PUBLIC int HTGetLinkInfo ARGS3(
+PUBLIC int HTGetLinkInfo ARGS5(
 	int,		number,
+	int *,		go_line,
+	int *,		linknum,
 	char **,	hightext,
 	char **,	lname)
 {
     TextAnchor * a;
-    HTAnchor *link_dest;
+    HTAnchor *link_dest, *link_dest_intl = NULL;
+    int anchors_this_line = 0, anchors_this_screen = 0;
+    int prev_anchor_line = -1, prev_prev_anchor_line = -1;
 
     if (!HTMainText)
         return(NO);
 
     for (a = HTMainText->first_anchor; a; a = a->next) {
-        if (a->number == number) {
-	    *hightext= a->hightext;
-            link_dest = HTAnchor_followMainLink(
-                                               (HTAnchor *)a->anchor);
-	    {
+	/*
+	 *  Count anchors, first on current line if there is more
+	 *  than one.  We have to count all links, including form
+	 *  field anchors and others with a->number==0, because
+	 *  they are or will be included in the links[] array.
+	 *  The exception are hidden form fields and anchors with
+	 *  show_anchor not set, because they won't appear in links[]
+	 *  and don't count towards nlinks. - KW
+	 */
+	if ((go_line && a->show_anchor) &&
+	    (a->link_type != INPUT_ANCHOR ||
+	     a->input_field->type != F_HIDDEN_TYPE)) {
+	    if (a->line_num == prev_anchor_line) {
+		anchors_this_line++;
+	    } else {
 		/*
-		 *	Memory Leak fixed.
-		 *	05-28-94 Lynx 2-3-1 Garrett Arch Blythe
-	 	 */
-		auto char *cp_freeme = NULL;
-		if (traversal)
-		    cp_freeme = stub_HTAnchor_address(link_dest);
-		else
-		    cp_freeme = HTAnchor_address(link_dest);
-            	StrAllocCopy(*lname, cp_freeme);
-		FREE(cp_freeme);
+		 *  This anchor is on a different line than the previous one.
+		 *  Remember which was the line number of the previous anchor,
+		 *  for use in screen positioning later. - KW
+		 */
+		anchors_this_line = 1;
+		prev_prev_anchor_line = prev_anchor_line;
+		prev_anchor_line = a->line_num;
+	    }
+	    if (a->line_num >= HTMainText->top_of_screen) {
+		/*
+		 *  Count all anchors starting with the top line of the
+		 *  currently displayed screen.  Just keep on counting
+		 *  beyound this screen's bottom line - we'll know whether 
+		 *  a found anchor is below the current screen by a check
+		 *  against nlinks later. - KW
+		 */
+		anchors_this_screen++;
 	    }
-	    return(YES);
 	}
+
+	if (a->number == number) {
+	    /*
+	     *  We found it.  Now process it, depending
+	     *  on what kind of info is requested. - KW
+	     */
+	    if (go_line) {
+		if (a->show_anchor == NO) {
+		    /*
+		     *  The number requested has been assigned to an anchor
+		     *  without any selectable text, so we cannot position
+		     *  on it.  The code for suppressing such anchors in
+		     *  HText_endAnchor() may not have applied, or it may
+		     *  have failed.  Return a failure indication so that
+		     *  the user will notice that something is wrong,
+		     *  instead of positioning on some other anchor which
+		     *  might result in inadvertant activation. - KW
+		     */
+		    return(NO);
+		}
+	        if (anchors_this_screen > 0 &&
+		    anchors_this_screen <= nlinks &&
+		    a->line_num >= HTMainText->top_of_screen &&
+		    a->line_num < HTMainText->top_of_screen+(display_lines)) {
+		    /*
+		     *  If the requested anchor is within the current screen,
+		     *  just set *go_line so that the screen window won't move
+		     *  (keep it as it is), and set *linknum to the index of
+		     *  this link in the current links[] array. - KW
+		     */
+		    *go_line = HTMainText->top_of_screen;
+		    if (linknum)
+		        *linknum = anchors_this_screen - 1;
+		} else {
+		    /*
+		     *  if the requested anchor is not within the currently
+		     *  displayed screen, set *go_line such that the top line
+		     *  will be either 
+		     *  (1) the line immediately below the previous
+		     *      anchor, or
+		     *  (2) about one third of a screenful above the line
+		     *      with the target, or
+		     *  (3) the first line of the document -
+		     *  whichever comes last.  In all cases the line with our
+		     *  target will end up being the first line with any links
+		     *  on the new screen, so that we can use the
+		     *  anchors_this_line counter to point to the anchor in
+		     *  the new links[] array.  - kw
+		     */
+		    int max_offset = SEARCH_GOAL_LINE - 1;
+		    if (max_offset < 0)
+			max_offset = 0;
+		    else if (max_offset >= display_lines)
+			max_offset = display_lines - 1;
+		    *go_line = prev_anchor_line - max_offset;
+		    if (*go_line <= prev_prev_anchor_line)
+		        *go_line = prev_prev_anchor_line + 1;
+		    if (*go_line < 0)
+		        *go_line = 0;
+		    if (linknum)
+		        *linknum = anchors_this_line - 1;
+	        }
+	        return(LINK_LINE_FOUND);
+	    } else {
+		*hightext= a->hightext;
+		link_dest = HTAnchor_followMainLink((HTAnchor *)a->anchor);
+		{
+		    char *cp_freeme = NULL;
+		    if (traversal)
+			cp_freeme = stub_HTAnchor_address(link_dest);
+		    else {
+			if (a->link_type == INTERNAL_LINK_ANCHOR) {
+			    link_dest_intl = HTAnchor_followTypedLink(
+				(HTAnchor *)a->anchor, LINK_INTERNAL);
+			    if (link_dest_intl && link_dest_intl != link_dest) {
+				if (TRACE)
+				    fprintf(stderr,
+					    "HTGetLinkInfo: unexpected typed link to %s!\n",
+					    link_dest_intl->parent->address);
+				link_dest_intl = NULL;
+			    }
+			}
+			if (link_dest_intl) {
+			    char *cp2 = HTAnchor_address(link_dest_intl);
+			    char *cp = strchr(cp2, '#');
+			    if (cp && cp != cp2 &&
+                                0!=strncmp(cp2, "LYNXIMGMAP:", 11)) {
+				StrAllocCopy(*lname, cp);
+				FREE(cp2);
+				return(WWW_INTERN_LINK_TYPE);
+			    } else {
+				FREE(*lname);
+				*lname = cp2;
+				return(WWW_INTERN_LINK_TYPE);
+			    }
+			} else
+			    cp_freeme = HTAnchor_address(link_dest);
+		    }
+		    StrAllocCopy(*lname, cp_freeme);
+		    FREE(cp_freeme);
+		}
+		return(WWW_LINK_TYPE);
+	    }
+        }
     }
     return(NO);
 }
@@ -2302,6 +2935,14 @@ PUBLIC char * HText_getTitle NOARGS
    	  (char *) HTAnchor_title(HTMainText->node_anchor) : NULL);
 }
 
+#ifdef USEHASH
+PUBLIC char *HText_getStyle NOARGS
+{
+   return(HTMainText ?
+	  (char *) HTAnchor_style(HTMainText->node_anchor) : NULL);
+}
+#endif
+
 /*
  *  HText_getSugFname returns the suggested filename of the current
  *  document (normally derived from a Content-Disposition header with
@@ -2358,6 +2999,18 @@ PUBLIC void HText_pageDisplay ARGS2(
 } 
 
 /*
+ *  Return YES if we have a whereis search target on the displayed
+ *  page. - kw
+ */
+PUBLIC BOOL HText_pageHasPrevTarget NOARGS
+{
+    if (!HTMainText)
+	return NO;
+    else
+	return HTMainText->page_has_target;
+} 
+
+/*
  *  HText_LinksInLines returns the number of links in the
  *  'Lines' number of lines beginning with 'line_num'-1. - FM
  */
@@ -2379,7 +3032,9 @@ PUBLIC int HText_LinksInLines ARGS3(
 			Anchor_ptr = Anchor_ptr->next) {
 	if (Anchor_ptr->line_num >= start &&
 	    Anchor_ptr->line_num < end &&
-	    Anchor_ptr->show_anchor)
+	    Anchor_ptr->show_anchor &&
+	    (Anchor_ptr->link_type != INPUT_ANCHOR ||
+	     Anchor_ptr->input_field->type != F_HIDDEN_TYPE))
 	    ++total;
 	if (Anchor_ptr == text->last_anchor)
 	    break;
@@ -2475,6 +3130,13 @@ PUBLIC BOOL HText_select ARGS1(
     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
+	 */
+	if (text)
+	    text->page_has_target = NO;
 	/*
 	 *  Make this text the most current in the loaded texts list. - FM
 	 */
@@ -3085,12 +3747,88 @@ PUBLIC void print_crawl_to_fd ARGS3(
 #endif /* VMS */
 }
 
-PUBLIC void www_user_search ARGS2(
+PRIVATE void adjust_search_result ARGS3(
+    document *,	doc,
+    int,	tentative_result,
+    int,	start_line)
+{
+    if (tentative_result > 0) {
+	int anch_line = -1;
+	TextAnchor * a;
+	int nl_closest = -1;
+	int goal = SEARCH_GOAL_LINE;
+	int max_offset;
+	BOOL on_screen = (tentative_result > HTMainText->top_of_screen &&
+	    tentative_result <= HTMainText->top_of_screen+display_lines);
+	if (goal < 1)
+	    goal = 1;
+	else if (goal > display_lines)
+	    goal = display_lines;
+	max_offset = goal - 1;
+
+	if (on_screen && nlinks > 0) {
+	    int i;
+	    for (i = 0; i < nlinks; i++) {
+		if (doc->line + links[i].ly - 1 <= tentative_result)
+		    nl_closest = i;
+		if (doc->line + links[i].ly - 1 >= tentative_result)
+		    break;
+	    }
+	    if (nl_closest >= 0 &&
+		doc->line + links[nl_closest].ly - 1 == tentative_result) {
+		www_search_result = doc->line;
+		doc->link = nl_closest;
+		return;
+	    }
+	}
+
+	/* find last anchor before or on target line */
+	for (a = HTMainText->first_anchor;
+	     a && a->line_num <= tentative_result-1; a = a->next) {
+	    anch_line = a->line_num + 1;
+	}
+	/* position such that the anchor found is on first screen line,
+	   if it is not too far above the target line; but also try to
+	   make sure we move forward. */
+	if (anch_line >= 0 &&
+	    anch_line >= tentative_result - max_offset &&
+	    (anch_line > start_line ||
+		tentative_result <= HTMainText->top_of_screen)) {
+	    www_search_result = anch_line;
+	} else
+	if (tentative_result - start_line > 0 &&
+	    tentative_result - (start_line + 1) <= max_offset) {
+	    www_search_result = start_line + 1;
+	} else
+	if (tentative_result > HTMainText->top_of_screen &&
+	    tentative_result <= start_line && /* have wrapped */
+	    tentative_result <= HTMainText->top_of_screen+goal) {
+	    www_search_result = HTMainText->top_of_screen + 1;
+	} else
+	if (tentative_result <= goal)
+	    www_search_result = 1;
+	else
+	    www_search_result = tentative_result - max_offset;
+	if (www_search_result == doc->line) {
+	    if (nl_closest >= 0) {
+		doc->link = nl_closest;
+		return;
+	    }
+	}
+    }
+}
+
+PUBLIC void www_user_search ARGS3(
 	int,		start_line,
+	document *,	doc,
 	char *,		target)
 {
     register HTLine * line;
     register int count;
+    int tentative_result = -1;
+    TextAnchor *a;
+    OptionType *option;
+    char *stars = NULL, *cp;
     extern BOOLEAN case_sensitive;
 
     if (!HTMainText) {
@@ -3108,15 +3846,148 @@ PUBLIC void www_user_search ARGS2(
 	    break;
 	}
     }
+    a = HTMainText->first_anchor;
+    while (a && a->line_num < count - 1) {
+        a = a->next;
+    }
 
     for (;;) {
+	while ((a != NULL) && a->line_num == (count - 1)) {
+	    if (a->show_anchor &&
+		(a->link_type != INPUT_ANCHOR ||
+		 a->input_field->type != F_HIDDEN_TYPE)) {
+		if (((a->hightext != NULL && case_sensitive == TRUE) &&
+		     LYno_attr_char_strstr(a->hightext, target)) ||
+		    ((a->hightext != NULL && case_sensitive == FALSE) &&
+		     LYno_attr_char_case_strstr(a->hightext, target))) {
+		    adjust_search_result(doc, count, start_line);
+		    return;
+		}
+		if (((a->hightext2 != NULL && case_sensitive == TRUE) &&
+		     LYno_attr_char_strstr(a->hightext2, target)) ||
+		    ((a->hightext2 != NULL && case_sensitive == FALSE) &&
+		     LYno_attr_char_case_strstr(a->hightext2, target))) {
+		    adjust_search_result(doc, count, start_line);
+		    return;
+		}
+
+		/*
+		 *  Search the relevant form fields, taking the
+		 *  case_sensitive setting into account. - FM
+		 */
+		if ((a->input_field != NULL && a->input_field->value != NULL) &&
+		    a->input_field->type != F_HIDDEN_TYPE) {
+		    if (a->input_field->type == F_PASSWORD_TYPE) {
+		        /*
+			 *  Check the actual, hidden password, and then
+			 *  the displayed string. - FM
+			 */
+			if (((case_sensitive == TRUE) &&
+			     LYno_attr_char_strstr(a->input_field->value,
+						   target)) ||
+			    ((case_sensitive == FALSE) &&
+			     LYno_attr_char_case_strstr(a->input_field->value,
+							target))) {
+			    adjust_search_result(doc, count, start_line);
+			    return;
+			}
+			StrAllocCopy(stars, a->input_field->value);
+			for (cp = stars; *cp != '\0'; cp++)
+			    *cp = '*';
+			if (((case_sensitive == TRUE) &&
+			     LYno_attr_char_strstr(stars, target)) ||
+			    ((case_sensitive == FALSE) &&
+			     LYno_attr_char_case_strstr(stars, target))) {
+			    FREE(stars);
+			    adjust_search_result(doc, count, start_line);
+			    return;
+			}
+			FREE(stars);
+		   } else if (a->input_field->type == F_OPTION_LIST_TYPE) {
+			/*
+			 *  Search the option strings that are displayed
+			 *  when the popup is invoked. - FM
+			 */
+			option = a->input_field->select_list;
+			while (option != NULL) {
+			    if (((option->name != NULL &&
+				  case_sensitive == TRUE) &&
+				 LYno_attr_char_strstr(option->name,
+						       target)) ||
+				((option->name != NULL &&
+				  case_sensitive == FALSE) &&
+				 LYno_attr_char_case_strstr(option->name,
+							    target))) {
+				adjust_search_result(doc, count, start_line);
+				return;
+			    }
+			    option = option->next;
+			}
+		    } else if (a->input_field->type == F_RADIO_TYPE) {
+			/*
+			 *  Search for checked or unchecked parens. - FM
+			 */
+		        if (a->input_field->num_value) {
+			    cp = checked_radio;
+			} else {
+			    cp = unchecked_radio;
+			}
+			if (((case_sensitive == TRUE) &&
+			     LYno_attr_char_strstr(cp, target)) ||
+			    ((case_sensitive == FALSE) &&
+			     LYno_attr_char_case_strstr(cp, target))) {
+			    adjust_search_result(doc, count, start_line);
+			    return;
+			}
+		    } else if (a->input_field->type == F_CHECKBOX_TYPE) {
+			/*
+			 *  Search for checked or unchecked
+			 *  square brackets. - FM
+			 */
+		        if (a->input_field->num_value) {
+			    cp = checked_box;
+			} else {
+			    cp = unchecked_box;
+			}
+			if (((case_sensitive == TRUE) &&
+			     LYno_attr_char_strstr(cp, target)) ||
+			    ((case_sensitive == FALSE) &&
+			     LYno_attr_char_case_strstr(cp, target))) {
+			    adjust_search_result(doc, count, start_line);
+			    return;
+			}
+		    } else {
+		        /*
+			 *  Check the values intended for display.
+			 *  May have been found already via the
+			 *  hightext search, but make sure here
+			 *  that the entire value is searched. - FM
+			 */
+			if (((case_sensitive == TRUE) &&
+			     LYno_attr_char_strstr(a->input_field->value,
+						   target)) ||
+			    ((case_sensitive == FALSE) &&
+			     LYno_attr_char_case_strstr(a->input_field->value,
+							target))) {
+			    adjust_search_result(doc, count, start_line);
+			    return;
+			}
+		    }
+		}
+	    }
+	    a = a->next;
+	}
+	if (a != NULL && a->line_num <= (count - 1)) {
+	    a = a->next;
+	}
+
 	if (case_sensitive && LYno_attr_char_strstr(line->data, target)) {
-	    www_search_result=count;
-	    return;
+	    tentative_result=count;
+	    break;
 	} else if (!case_sensitive &&
 		   LYno_attr_char_case_strstr(line->data, target)) {
-	    www_search_result=count;
-	    return;
+	    tentative_result=count;
+	    break;
 	} else if (line == HTMainText->last_line) {  /* next line */
 	    break;
 	} else {			/* end */
@@ -3124,19 +3995,158 @@ PUBLIC void www_user_search ARGS2(
 	    count++;
 	}
     }
+    if (tentative_result > 0) {
+	adjust_search_result(doc, tentative_result, start_line);
+	return;
+    }
 
-	/* search from the beginning */
+    /*
+     *  Search from the beginning.
+     */
     line = HTMainText->last_line->next; /* set to first line */
     count = 1;
+    a = HTMainText->first_anchor;
+    while (a && a->line_num < count - 1) {
+        a = a->next;
+    }
 
     for (;;) {
+	while ((a != NULL) && a->line_num == (count - 1)) {
+	    if (a->show_anchor &&
+		(a->link_type != INPUT_ANCHOR ||
+		 a->input_field->type != F_HIDDEN_TYPE)) {
+		if (((a->hightext != NULL && case_sensitive == TRUE) &&
+		     LYno_attr_char_strstr(a->hightext, target)) ||
+		    ((a->hightext != NULL && case_sensitive == FALSE) &&
+		     LYno_attr_char_case_strstr(a->hightext, target))) {
+		    adjust_search_result(doc, count, start_line);
+		    return;
+		}
+		if (((a->hightext2 != NULL && case_sensitive == TRUE) &&
+		     LYno_attr_char_strstr(a->hightext2, target)) ||
+		    ((a->hightext2 != NULL && case_sensitive == FALSE) &&
+		     LYno_attr_char_case_strstr(a->hightext2, target))) {
+		    adjust_search_result(doc, count, start_line);
+		    return;
+		}
+
+		/*
+		 *  Search the relevant form fields, taking the
+		 *  case_sensitive setting into account. - FM
+		 */
+		if ((a->input_field != NULL && a->input_field->value != NULL) &&
+		    a->input_field->type != F_HIDDEN_TYPE) {
+		    if (a->input_field->type == F_PASSWORD_TYPE) {
+		        /*
+			 *  Check the actual, hidden password, and then
+			 *  the displayed string. - FM
+			 */
+			if (((case_sensitive == TRUE) &&
+			     LYno_attr_char_strstr(a->input_field->value,
+						   target)) ||
+			    ((case_sensitive == FALSE) &&
+			     LYno_attr_char_case_strstr(a->input_field->value,
+							target))) {
+			    adjust_search_result(doc, count, start_line);
+			    return;
+			}
+			StrAllocCopy(stars, a->input_field->value);
+			for (cp = stars; *cp != '\0'; cp++)
+			    *cp = '*';
+			if (((case_sensitive == TRUE) &&
+			     LYno_attr_char_strstr(stars, target)) ||
+			    ((case_sensitive == FALSE) &&
+			     LYno_attr_char_case_strstr(stars, target))) {
+			    FREE(stars);
+			    adjust_search_result(doc, count, start_line);
+			    return;
+			}
+			FREE(stars);
+		   } else if (a->input_field->type == F_OPTION_LIST_TYPE) {
+			/*
+			 *  Search the option strings that are displayed
+			 *  when the popup is invoked. - FM
+			 */
+			option = a->input_field->select_list;
+			while (option != NULL) {
+			    if (((option->name != NULL &&
+				  case_sensitive == TRUE) &&
+				 LYno_attr_char_strstr(option->name,
+						       target)) ||
+				((option->name != NULL &&
+				  case_sensitive == FALSE) &&
+				 LYno_attr_char_case_strstr(option->name,
+							    target))) {
+				adjust_search_result(doc, count, start_line);
+				return;
+			    }
+			    option = option->next;
+			}
+		    } else if (a->input_field->type == F_RADIO_TYPE) {
+			/*
+			 *  Search for checked or unchecked parens. - FM
+			 */
+		        if (a->input_field->num_value) {
+			    cp = checked_radio;
+			} else {
+			    cp = unchecked_radio;
+			}
+			if (((case_sensitive == TRUE) &&
+			     LYno_attr_char_strstr(cp, target)) ||
+			    ((case_sensitive == FALSE) &&
+			     LYno_attr_char_case_strstr(cp, target))) {
+			    adjust_search_result(doc, count, start_line);
+			    return;
+			}
+		    } else if (a->input_field->type == F_CHECKBOX_TYPE) {
+			/*
+			 *  Search for checked or unchecked
+			 *  square brackets. - FM
+			 */
+		        if (a->input_field->num_value) {
+			    cp = checked_box;
+			} else {
+			    cp = unchecked_box;
+			}
+			if (((case_sensitive == TRUE) &&
+			     LYno_attr_char_strstr(cp, target)) ||
+			    ((case_sensitive == FALSE) &&
+			     LYno_attr_char_case_strstr(cp, target))) {
+			    adjust_search_result(doc, count, start_line);
+			    return;
+			}
+		    } else {
+		        /*
+			 *  Check the values intended for display.
+			 *  May have been found already via the
+			 *  hightext search, but make sure here
+			 *  that the entire value is searched. - FM
+			 */
+			if (((case_sensitive == TRUE) &&
+			     LYno_attr_char_strstr(a->input_field->value,
+						   target)) ||
+			    ((case_sensitive == FALSE) &&
+			     LYno_attr_char_case_strstr(a->input_field->value,
+							target))) {
+			    adjust_search_result(doc, count, start_line);
+			    return;
+			}
+		    }
+		}
+	    }
+	    a = a->next;
+	}
+	if (a != NULL && a->line_num <= (count - 1)) {
+	    a = a->next;
+	}
+
 	    if (case_sensitive && LYno_attr_char_strstr(line->data, target)) {
-	        www_search_result=count;
-		return;
+	        tentative_result=count;
+		break;
 	    } else if (!case_sensitive &&
 	    	       LYno_attr_char_case_strstr(line->data, target)) {
-	        www_search_result=count;
-		return;
+	        tentative_result=count;
+		break;
 	    } else if (count > start_line) {  /* next line */
     		_user_message(STRING_NOT_FOUND, target);
     		sleep(MessageSecs);
@@ -3144,7 +4154,10 @@ PUBLIC void www_user_search ARGS2(
 	    } else {
 	        line = line->next;
 		count++;
-	    }
+	}
+    }
+    if (tentative_result > 0) {
+	adjust_search_result(doc, tentative_result, start_line);
     }
 }
 
@@ -3234,10 +4247,29 @@ PUBLIC void HTuncache_current_document NOARGS
      *  Should remove current document from memory.
      */
     if (HTMainText) {
+	HTParentAnchor * htmain_anchor = HTMainText->node_anchor;
+#ifdef EXP_CHARTRANS
+	if (htmain_anchor) {
+	    if (!(HTOutputFormat && HTOutputFormat == WWW_SOURCE)) {
+		FREE(htmain_anchor->UCStages);
+	    }
+	}
+#endif /* EXP_CHARTRANS */
+	if (TRACE) {
+	    fprintf(stderr, "\rHTuncache.. freeing document for %s %s\n",
+		    (htmain_anchor && htmain_anchor->address) ?
+		    htmain_anchor->address : "unknown anchor",
+		    (htmain_anchor && htmain_anchor->post_data) ?
+		    "with POST data" : ""
+		    );
+	}
         HTList_removeObject(loaded_texts, HTMainText);
 	HText_free(HTMainText);
 	HTMainText = NULL;
-    }
+    } else
+	if (TRACE) {
+	    fprintf(stderr, "HTuncache.. HTMainText already is NULL!\n");
+	}
 }
 
 PUBLIC int HTisDocumentSource NOARGS
@@ -3311,6 +4343,14 @@ PUBLIC char * HTLoadedDocumentCharset NOARGS
 	return (NULL);
 }
 
+PUBLIC BOOL HTLoadedDocumentEightbit NOARGS
+{
+    if (!HTMainText)
+	return (NO);
+    else
+	return (HTMainText->have_8bit_chars);
+}
+
 PUBLIC void HText_setNodeAnchorBookmark ARGS1(
 	CONST char *,	bookmark)
 {
@@ -3354,7 +4394,8 @@ PUBLIC int HText_PreviousLineSize ARGS1(
 
 PRIVATE int HText_TrueLineSize ARGS2(HTLine *,line, HText *,text)
 {
-    int i, true_size = 0;
+    size_t i;
+    int true_size = 0;
 
     if (!line || !line->size)
         return 0;
@@ -3497,6 +4538,81 @@ PUBLIC int HText_getTabIDColumn ARGS2(
     return column;
 }
 
+/*
+ *  This function is for saving the address of a link
+ *  which had an attribute in the markup that resolved
+ *  to a URL (i.e., not just a NAME or ID attribute),
+ *  but was found in HText_endAnchor() to have no visible
+ *  content for use as a link name.  It loads the address
+ *  into text->hidden_links, whose count can be determined
+ *  via HText_HiddenLinks(), below.  The addresses can be
+ *  retrieved via HText_HiddenLinkAt(), below, based on
+ *  count. - FM
+ */
+PRIVATE void HText_AddHiddenLink ARGS2(
+	HText *,	text,
+	TextAnchor *,	textanchor)
+{
+    HTAnchor *dest;
+
+    /*
+     *  Make sure we have an HText structure and anchor. - FM
+     */
+    if (!(text && textanchor && textanchor->anchor))
+        return;
+
+    /*
+     *  Create the hidden links list
+     *  if it hasn't been already. - FM
+     */
+    if (text->hidden_links == NULL)
+    	text->hidden_links = HTList_new();
+
+    /*
+     *  Store the address, in reverse list order
+     *  so that first in will be first out on
+     *  retrievals. - FM
+     */
+    if ((dest = HTAnchor_followMainLink((HTAnchor *)textanchor->anchor)) &&
+	(LYHiddenLinks != HIDDENLINKS_IGNORE ||
+	 HTList_isEmpty(text->hidden_links)))
+	HTList_appendObject(text->hidden_links, HTAnchor_address(dest));
+
+    return;
+}
+
+/*
+ *  This function returns the number of addresses
+ *  that are loaded in text->hidden_links. - FM
+ */
+PUBLIC int HText_HiddenLinkCount ARGS1(
+	HText *,	text)
+{
+    int count = 0;
+
+    if (text && text->hidden_links)
+        count = HTList_count((HTList *)text->hidden_links);
+
+    return(count);
+}
+
+/*
+ *  This function returns the address, corresponding to
+ *  a hidden link, at the position (zero-based) in the
+ *  text->hidden_links list of the number argument. - FM
+ */
+PUBLIC char * HText_HiddenLinkAt ARGS2(
+	HText *,	text,
+	int,		number)
+{
+    char *href = NULL;
+
+    if (text && text->hidden_links && number >= 0)
+        href = (char *)HTList_objectAt((HTList *)text->hidden_links, number);
+    
+    return(href);
+}
+
 
 /*
  *  Form methods
@@ -4129,8 +5245,6 @@ PUBLIC int HText_beginInput ARGS2(
 	    StrAllocCopy(f->value, "[IMAGE]-Submit");
 	    f->size = 14;
 	} else {
-	    StrAllocCopy(f->value, "[IMAGE]-Submit");
-	    f->size = 14;
 	    StrAllocCopy(f->value, "Submit");
 	    f->size = 6;
 	}
@@ -4167,8 +5281,42 @@ PUBLIC int HText_beginInput ARGS2(
     /*
      *  Restrict SIZE to maximum allowable size.
      */
-    if (f->size > LYcols-10)
-	f->size = LYcols-10;  /* maximum */
+    switch (f->type) {
+        int MaximumSize;
+
+	case F_SUBMIT_TYPE:
+	case F_IMAGE_SUBMIT_TYPE:
+	case F_RESET_TYPE:
+	    /*
+	     *  For submit and reset buttons, we limit the size
+	     *  element to that of one line for the current style
+	     *  because that's the most we could highlight on
+	     *  overwrites- FM
+	     */
+	    MaximumSize = (LYcols - 1) -
+			  (int)text->style->leftIndent -
+			  (int)text->style->rightIndent;
+	    if (f->size > MaximumSize)
+	        f->size = MaximumSize;
+	    /*
+	     *  Save value for submit/reset buttons so they
+	     *  will be visible when printing the page. - LE
+	     */
+	    I->value = f->value;
+	    break;
+
+	default:
+	    /*
+	     *  For all other fields we limit the size element
+	     *  to 10 less than the screen width, because either
+	     *  they are types with small placeholders, or are a
+	     *  type which can be scrolled horizontally within
+	     *  an editing window. - FM
+	     */
+	    if (f->size > LYcols-10)
+		f->size = LYcols-10;  /* maximum */
+	    break;
+    }
 
     /*
      *  Add this anchor to the anchor list
@@ -5167,3 +6315,118 @@ PUBLIC void HText_setKcode ARGS2(
     return;
 }
 
+/*
+**  Set a permissible split at the current end of the last line. - FM
+*/
+PUBLIC void HText_setBreakPoint ARGS1(
+	HText *,	text)
+{
+    if (!text)
+        return;
+
+    text->permissible_split = (int)text->last_line->size;  /* Can split here */
+
+    return;
+}
+
+/*
+**  This function determines whether a document which
+**  would be sought via the a URL that has a fragment
+**  directive appended is otherwise identical to the
+**  currently loaded document, and if so, returns
+**  FALSE, so that any no_cache directives can be
+**  overridden "safely", on the grounds that we are
+**  simply acting on the equivalent of a paging
+**  command.  Otherwise, it returns TRUE, i.e, that
+**  the target document might differ from the current,
+**  based on any caching directives or analyses which
+**  claimed or suggested this. - FM
+*/
+PUBLIC BOOL HText_AreDifferent ARGS2(
+	HTParentAnchor *,	anchor,
+	CONST char *,		full_address)
+{
+    HTParentAnchor *MTanc;
+    char *pound;
+
+    /*
+     *  Do we have a loaded document and both
+     *  arguments for this function?
+     */
+    if (!(HTMainText && anchor && full_address))
+	return TRUE;
+
+    /*
+     *  Do we have both URLs?
+     */
+    MTanc = HTMainText->node_anchor;
+    if (!(MTanc->address && anchor->address))
+	return (TRUE);
+
+    /*
+     *  Do we have a fragment associated with the target?
+     */
+    if ((pound = strchr(full_address, '#')) == NULL)
+	return (TRUE);
+
+    /*
+     *  Always treat client-side image map menus
+     *  as potentially stale.
+     */
+    if (!strncasecomp(anchor->address, "LYNXIMGMAP:", 11))
+	return (TRUE);
+
+    /*
+     *  Do they differ in the type of request?
+     */
+    if (MTanc->isHEAD != anchor->isHEAD)
+        return (TRUE);
+
+    /* 
+     *  Are the actual URLs different?
+     */
+    if (strcmp(MTanc->address, anchor->address))
+	return(TRUE);
+
+    /*
+     *  Do the docs have different contents?
+     */
+    if (MTanc->post_data) {
+	if (anchor->post_data) {
+	    if (strcmp(MTanc->post_data, anchor->post_data)) {
+	        /*
+		 *  Both have contents, and they differ.
+		 */
+		return(TRUE);
+	    }
+	} else {
+	    /*
+	     *  The loaded document has content, but the
+	     *  target doesn't, so they're different.
+	     */
+	    return(TRUE);
+	}
+    } else if (anchor->post_data) {
+    	    /*
+	     *  The loaded document does not have content, but
+	     *  the target does, so they're different.
+	     */
+	    return(TRUE);
+    }
+
+    /*
+     *  Are we seeking a position in the loaded document
+     *  based on a fragment?
+     */
+    if (!strncmp(MTanc->address, full_address, (pound - full_address)))
+	return(FALSE);
+
+    /*
+     *  We'll assume the loaded document and target should be
+     *  treated as different, either because we are reloading,
+     *  or because we had header, META, or other directives not
+     *  to use a cached rendition. - FM
+     */
+    return(TRUE);
+
+}
diff --git a/src/GridText.h b/src/GridText.h
index e027c17c..d606c16f 100644
--- a/src/GridText.h
+++ b/src/GridText.h
@@ -57,6 +57,7 @@ extern void HText_scrollDown PARAMS((HText * text));	/* One page */
 extern void HText_scrollTop PARAMS((HText * text));
 extern void HText_scrollBottom PARAMS((HText * text));
 extern void HText_pageDisplay PARAMS((int line_num, char *target));
+extern BOOL HText_pageHasPrevTarget NOPARAMS;
 
 extern int HText_LinksInLines PARAMS((HText *text, int line_num, int Lines));
 
@@ -75,16 +76,25 @@ extern char * HText_getServer NOPARAMS;
 extern char * HText_getOwner NOPARAMS;
 extern char * HText_getContentBase NOPARAMS;
 extern char * HText_getContentLocation NOPARAMS;
+#ifdef USEHASH
+extern char * HText_getStyle NOPARAMS;
+#endif
 extern void HText_setMainTextOwner PARAMS((CONST char * owner));
 extern char * HText_getRevTitle NOPARAMS;
 extern void print_wwwfile_to_fd PARAMS((FILE * fp, int is_reply));
 extern BOOL HText_select PARAMS((HText *text));
 extern BOOL HText_POSTReplyLoaded PARAMS((document *doc));
 extern BOOL HTFindPoundSelector PARAMS((char *selector));
-extern int HTGetLinkInfo PARAMS((int number, char **hightext, char **lname));
+extern int HTGetLinkInfo PARAMS((
+	int		number,
+	int *		go_line,
+	int *		linknum,
+	char **		hightext,
+	char **		lname));
 extern int HTisDocumentSource NOPARAMS;
 extern void HTuncache_current_document NOPARAMS;
 extern int HText_getTopOfScreen NOPARAMS;
+extern int HText_getLines PARAMS((HText * text));
 extern int HText_getNumOfLines NOPARAMS;
 extern int do_www_search PARAMS((document *doc));
 extern char * HTLoadedDocumentURL NOPARAMS;
@@ -93,6 +103,7 @@ extern char * HTLoadedDocumentTitle NOPARAMS;
 extern BOOLEAN HTLoadedDocumentIsHEAD NOPARAMS;
 extern BOOLEAN HTLoadedDocumentIsSafe NOPARAMS;
 extern char * HTLoadedDocumentCharset NOPARAMS;
+extern BOOL HTLoadedDocumentEightbit NOPARAMS;
 extern void HText_setNodeAnchorBookmark PARAMS((CONST char *bookmark));
 extern char * HTLoadedDocumentBookmark NOPARAMS;
 extern int HText_LastLineSize PARAMS((HText *me));
@@ -103,29 +114,33 @@ extern int HText_getCurrentColumn PARAMS((HText *text));
 extern int HText_getMaximumColumn PARAMS((HText *text));
 extern void HText_setTabID PARAMS((HText *text, CONST char *name));
 extern int HText_getTabIDColumn PARAMS((HText *text, CONST char *name));
+extern int HText_HiddenLinkCount PARAMS((HText *text));
+extern char * HText_HiddenLinkAt PARAMS((HText *text, int number));
 
 /* forms stuff */
-extern void HText_beginForm PARAMS((char *action,
-				    char *method,
-				    char *enctype,
-				    char *title));
+extern void HText_beginForm PARAMS((
+	char *		action,
+	char *		method,
+	char *		enctype,
+	char *		title));
 extern void HText_endForm PARAMS((HText *text));
 extern void HText_beginSelect PARAMS((char *name, BOOLEAN multiple, char *len));
-extern char * HText_setLastOptionValue PARAMS((HText *text, char *value,
-						char *submit_value,
-						int order, BOOLEAN checked));
+extern char * HText_setLastOptionValue PARAMS((
+	HText *		text,
+	char *		value,
+	char *		submit_value,
+	int 		order,
+	BOOLEAN		checked));
 extern int HText_beginInput PARAMS((HText *text, InputFieldData *I));
-extern void HText_SubmitForm PARAMS((FormInfo *submit_item, document *doc,
-				     char *link_name, char *link_value));
+extern void HText_SubmitForm PARAMS((
+	FormInfo *	submit_item,
+	document *	doc,
+	char *		link_name,
+	char *		link_value));
 extern void HText_DisableCurrentForm NOPARAMS;
 extern void HText_ResetForm PARAMS((FormInfo *form));
 extern void HText_activateRadioButton PARAMS((FormInfo *form));
 
-#ifdef CURSES
-extern int HText_getTopOfScreen NOPARAMS;
-extern int HText_getLines PARAMS((HText * text));
-#endif /* CURSES */
-
 extern HTList * search_queries; /* Previous isindex and whereis queries */
 extern void HTSearchQueries_free NOPARAMS;
 extern void HTAddSearchQuery PARAMS((char *query));
@@ -134,10 +149,12 @@ extern void user_message PARAMS((char * message, char * argument));
 
 #define _user_message(msg, arg)	mustshow = TRUE, user_message(msg, arg)
 
-extern void www_user_search PARAMS((int start_line, char *target));
+extern void www_user_search PARAMS((int start_line, document *doc, char *target));
 
-extern void print_crawl_to_fd PARAMS((FILE * fp, char * thelink,
-				      char * thetitle));
+extern void print_crawl_to_fd PARAMS((
+	FILE *		fp,
+	char *		thelink,
+	char *		thetitle));
 extern char * stub_HTAnchor_address PARAMS((HTAnchor *me));
 
 extern void HText_setToolbar PARAMS((HText *text));
@@ -148,4 +165,10 @@ extern BOOL HText_hasNoCacheSet PARAMS((HText *text));
 
 extern void HText_setKcode PARAMS((HText *text, CONST char *charset));
 
+extern void HText_setBreakPoint PARAMS((HText *text));
+
+extern BOOL HText_AreDifferent PARAMS((
+	HTParentAnchor *	anchor,
+	CONST char *		full_address));
+
 #endif /* LYGRIDTEXT_H */
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index 55e5d932..24bbb136 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -195,6 +195,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
 		     *  so the uncompression failed. - FM
 		     */
 		    fclose(fp);
+		    fp = NULL;
 		    if (!dump_output_immediately) {
 		        clearok(curscr, TRUE);
 			refresh();
@@ -453,14 +454,16 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3(
     if (anchor->FileCache) {
         strcpy(fnam, anchor->FileCache);
 	FREE(anchor->FileCache);
-        if ((fp=fopen(fnam, "r")) != NULL) {
+        if ((fp = fopen(fnam, "r")) != NULL) {
 	    fclose(fp);
+	    fp = NULL;
 	    remove(fnam);
 	}
     } else {
         /*
 	 *  Lynx routine to create a temporary filename
 	 */
+SaveAndExecute_tempname:
         tempname (fnam, NEW_FILE);
 	/*
 	 *  Check for a suffix.
@@ -483,6 +486,15 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3(
 	        strcat(fnam, ".bin");
 	    } else if ((suffix = HTFileSuffix(pres->rep)) && *suffix == '.') {
 	        strcat(fnam, suffix);
+		/*
+		 *  It's not one of the suffixes checked for a
+		 *  spoof in tempname(), so check it now. - FM
+		 */
+		if ((fp = fopen(fnam, "r")) != NULL) {
+		    fclose(fp);
+		    fp = NULL;
+		    goto SaveAndExecute_tempname;
+		}
 	    } else {
 	        *cp = '.';
 	    }
@@ -630,14 +642,16 @@ PUBLIC HTStream* HTSaveToFile ARGS3(
     if (anchor->FileCache) {
         strcpy(fnam, anchor->FileCache);
 	FREE(anchor->FileCache);
-        if ((fp=fopen(fnam, "r")) != NULL) {
+        if ((fp = fopen(fnam, "r")) != NULL) {
 	    fclose(fp);
+	    fp = NULL;
 	    remove(fnam);
 	}
     } else {
         /*
 	 *  Lynx routine to create a temporary filename
 	 */
+SaveToFile_tempname:
         tempname(fnam, NEW_FILE);
 	/*
 	 *  Check for a suffix.
@@ -660,6 +674,15 @@ PUBLIC HTStream* HTSaveToFile ARGS3(
 	        strcat(fnam, ".bin");
 	    } else if ((suffix = HTFileSuffix(pres->rep)) && *suffix == '.') {
 	        strcat(fnam, suffix);
+		/*
+		 *  It's not one of the suffixes checked for a
+		 *  spoof in tempname(), so check it now. - FM
+		 */
+		if ((fp = fopen(fnam, "r")) != NULL) {
+		    fclose(fp);
+		    fp = NULL;
+		    goto SaveToFile_tempname;
+		}
 	    } else {
 	        *cp = '.';
 	    }
@@ -884,6 +907,7 @@ PUBLIC HTStream* HTCompressed ARGS3(
     /*
      *  Get a new temporary filename and substitute a suitable suffix. - FM
      */
+Compressed_tempname:
     tempname(fnam, NEW_FILE);
     if ((cp = strchr(fnam, '.')) != NULL) {
 	*cp = '\0';
@@ -922,7 +946,16 @@ PUBLIC HTStream* HTCompressed ARGS3(
 	strcat(fnam, ".");
     }
     strcat(fnam, compress_suffix);
-    
+    /*
+     *  It's not one of the suffixes checked for a
+     *  spoof in tempname(), so check it now. - FM
+     */
+    if ((fp = fopen(fnam, "r")) != NULL) {
+	fclose(fp);
+	fp = NULL;
+	goto Compressed_tempname;
+    }
+
     /*
      *  Open the file for receiving the compressed input stream. - FM
      */
diff --git a/src/HTForms.h b/src/HTForms.h
index 612bbb89..c152f0a9 100644
--- a/src/HTForms.h
+++ b/src/HTForms.h
@@ -76,6 +76,7 @@ typedef struct _FormInfo {
 
 #define HYPERTEXT_ANCHOR 1
 #define INPUT_ANCHOR     2   /* forms mode input fields */
+#define INTERNAL_LINK_ANCHOR 5	/* 1+4, can be used as bitflag... - kw */
 
 #define F_TEXT_TYPE	   1
 #define F_PASSWORD_TYPE    2
@@ -94,6 +95,9 @@ typedef struct _FormInfo {
 
 #define WWW_FORM_LINK_TYPE  1
 #define WWW_LINK_TYPE   2
+#define WWW_INTERN_LINK_TYPE   6 /* can be used as a bitflag... - kw */
+#define LINK_LINE_FOUND	8	/* used in follow_link_number - kw */
+
 /* #define different lynx modes */
 #define NORMAL_LYNX_MODE 1
 #define FORMS_LYNX_MODE  2
diff --git a/src/HTInit.c b/src/HTInit.c
index adc9a64e..e8c74065 100644
--- a/src/HTInit.c
+++ b/src/HTInit.c
@@ -278,7 +278,9 @@ PRIVATE char *Cleanse ARGS1(char *,s)
 
 PRIVATE int ProcessMailcapEntry ARGS2(FILE *,fp, struct MailcapEntry *,mc)
 {
-    int i, j, rawentryalloc = 2000, len;
+    int i, j;
+    size_t rawentryalloc = 2000;
+    size_t len;
     char *rawentry, *s, *t, *LineBuf;
 
     LineBuf = malloc(LINE_BUF_SIZE);
@@ -815,7 +817,7 @@ PUBLIC void HTFileInit NOARGS
     HTSetSuffix(".xwd",		"image/x-xwindowdump", "binary", 1.0);
 
     HTSetSuffix(".rtx",		"text/richtext", "8bit", 1.0);
-    HTSetSuffix(".tsv",		"text/tab-separated-values", "8-bit", 1.0);
+    HTSetSuffix(".tsv",		"text/tab-separated-values", "8bit", 1.0);
     HTSetSuffix(".etx",		"text/x-setext", "8bit", 1.0);
 
     HTSetSuffix(".mpg",		"video/mpeg", "binary", 1.0);
diff --git a/src/HTML.c b/src/HTML.c
index 81cb1894..f49e0084 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -22,8 +22,10 @@
 
 #include "HTCJK.h"
 #include "HTAtom.h"
+#include "HTAnchor.h"
 #include "HTMLGen.h"
 #include "HTParse.h"
+#include "HTList.h"
 
 #include "LYGlobalDefs.h"
 #include "LYCharUtils.h"
@@ -42,6 +44,7 @@
 #include "LYSignal.h"
 #include "LYUtils.h"
 #include "LYMap.h"
+#include "LYList.h"
 #include "LYBookmark.h"
 
 #ifdef VMS
@@ -49,6 +52,15 @@
 #include "HTVMSUtils.h"
 #endif /* VMS */
 
+#ifdef USE_COLOR_STYLE
+#include "AttrList.h"
+#include "LYHash.h"
+#include "LYStyle.h"
+#undef SELECTED_STYLES
+#define pHText_changeStyle(X,Y,Z) {}
+char Style_className[16384];
+#endif
+
 #include "LYexit.h"
 #include "LYLeaks.h"
 
@@ -96,6 +108,19 @@ PRIVATE void change_paragraph_style PARAMS((HTStructured * me,
 */
 #define UPDATE_STYLE if (me->style_change) { actually_set_style(me); }
 
+/*	Set an internal flag that the next call to a stack-affecting method
+**	is only internal and the stack manipulation should be skipped. - kw
+*/
+#define SET_SKIP_STACK(el_num) if (HTML_dtd.tags[el_num].contents != SGML_EMPTY) \
+                          			{ me->skip_stack++; }
+
+extern int hash_code PARAMS((char* i));
+
+PUBLIC void strtolower ARGS1(char*, i)
+{
+        if (!i) return;
+        while (*i) { *i=tolower(*i); i++; }
+}
 
 /*		Flattening the style structure
 **		------------------------------
@@ -212,6 +237,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
 	return;
 
     case HTML_SELECT:	
+    case HTML_OPTION:	
     	HTChunkPutc(&me->option, c);
 	return;
 
@@ -332,7 +358,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
 /*	String handling
 **	---------------
 **
-**	This is written separately from put_character becuase the loop can
+**	This is written separately from put_character because the loop can
 **	in some cases be promoted to a higher function call level for speed.
 */
 PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
@@ -376,6 +402,7 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
 	break;
 
     case HTML_SELECT:	
+    case HTML_OPTION:	
     	HTChunkPuts(&me->option, s);
 	break;
 	
@@ -455,6 +482,25 @@ PUBLIC void HTML_write ARGS3(HTStructured *, me, CONST char*, s, int, l)
         HTML_put_character(me, *p);
 }
 
+/* A flag is used to keep track of whether an "URL reference" encountered
+   had a real "URL" or not.  (This is the terminology of the Fielding
+   Internet Draft.)  In the latter case, it will be marked as an "internal"
+   link.  The flag is set before we stard messing around with the string
+   (resolution of relative URLs etc.). - kw */
+#define CHECK_FOR_INTERN(s) intern_flag = (s && (*s=='#' || *s=='\0')) ? TRUE : FALSE; 
+/* Last argument to pass to HTAnchor_findChildAndLink() calls,
+   just an abbreviation. - kw */
+#define INTERN_LT (HTLinkType *)(intern_flag ? LINK_INTERNAL : NULL)
+
+#ifdef USE_COLOR_STYLE
+char class_string[TEMPSTRINGSIZE];
+char prevailing_class[TEMPSTRINGSIZE];
+#endif
+
+#ifdef USE_COLOR_STYLE
+    char myHash[128];
+    int hcode;
+#endif
 /*	Start Element
 **	-------------
 */
@@ -474,32 +520,99 @@ PRIVATE void HTML_start_element ARGS5(
 #ifdef EXP_CHARTRANS
     int dest_char_set  = -1;
 #endif
-    static BOOLEAN first_option = TRUE;	     /* is this the first option tag? */
-    HTParentAnchor *dest = NULL;	     /* an anchor's destination */
-    BOOL dest_ismap = FALSE;	     	     /* is dest an image map script? */
+    HTParentAnchor *dest = NULL;	     /* An anchor's destination */
+    BOOL dest_ismap = FALSE;	     	     /* Is dest an image map script? */
     HTChildAnchor *ID_A = NULL;		     /* HTML_foo_ID anchor */
     int url_type = 0, i = 0;
+    BOOL intern_flag = FALSE;
     char *cp = NULL;
 
     if (LYMapsOnly) {
-        if (!(element_number == HTML_MAP || element_number == HTML_AREA)) {
+        if (!(element_number == HTML_MAP || element_number == HTML_AREA ||
+	      element_number == HTML_BASE)) {
 	    return;
 	}
     }
 
+/* this should be done differently */
+#if defined(USE_COLOR_STYLE)
+        strcat (Style_className, ";");
+        strcat (Style_className, HTML_dtd.tags[element_number].name);
+        strcpy (myHash, HTML_dtd.tags[element_number].name);
+        if (class_string[0])
+        {
+                strcat (Style_className, ".");
+                strcat (Style_className, class_string);
+                strcat (myHash, ".");
+                strcat (myHash, class_string);
+#if !defined(PREVAIL)
+        }
+#else /* PREVAIL */
+                strcpy (prevailing_class, class_string);
+        }
+        else if (prevailing_class[0])
+        {
+                strcat (Style_className, ".");
+                strcat (Style_className, prevailing_class);
+                strcat (myHash, ".");
+                strcat (myHash, prevailing_class);
+        }
+#endif /* !PREVAIL */
+        class_string[0]='\0';
+        strtolower(myHash);
+        hcode=hash_code(myHash);
+        strtolower(Style_className);
+
+        if (TRACE)
+        {
+                fprintf(stderr, "CSSTRIM:%s -> %d", myHash, hcode);
+                if (hashStyles[hcode].code!=hcode)
+                {
+                        char *rp=strrchr(myHash, '.');
+                        fprintf(stderr, " (undefined) %s\n", myHash);
+                        if (rp)
+                        {
+                                int hcode;
+                                *rp='\0'; /* trim the class */
+                                hcode=hash_code(myHash);
+                                fprintf(stderr, "CSS:%s -> %d", myHash, hcode);
+                                if (hashStyles[hcode].code!=hcode)
+                                        fprintf(stderr, " (undefined) %s\n", myHash);
+                                else
+                                        fprintf(stderr, " ca=%d\n", hashStyles[hcode].color);
+                        }
+                }
+                else
+                        fprintf(stderr, " ca=%d\n", hashStyles[hcode].color);
+        }
+
+    if (displayStyles[element_number].color > -2) /* actually set */
+    {
+        if (TRACE)
+                fprintf(stderr, "CSSTRIM: start_element: top <%s>\n", HTML_dtd.tags[element_number].name);
+        HText_characterStyle(me->text, hcode, 1);
+    }
+#endif /* USE_COLOR_STYLE */
+
+#if 0 
+	me->inStyle[element_number]=1; /* this is a goodthing(tm) */
+#endif
+
     switch (element_number) {
 
     case HTML_HTML:
-        UPDATE_STYLE;
-	if (me->inUnderline) {
+	if (!me->text)
+	    UPDATE_STYLE;
+	if (me->inUnderline) {	/* This block could go away(?) - kw */
 	    HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
 	    me->inUnderline = FALSE;
 	}
 	break;
 
     case HTML_HEAD:
-        UPDATE_STYLE;
-	if (me->inUnderline) {
+	if (!me->text)
+	    UPDATE_STYLE;
+	if (me->inUnderline) {	/* This block could go away(?) - kw */
 	    HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
 	    me->inUnderline = FALSE;
 	}
@@ -512,7 +625,8 @@ PRIVATE void HTML_start_element ARGS5(
 	    char *related = NULL;
 
 	    StrAllocCopy(base, (char *)value[HTML_BASE_HREF]);
-	    if (!(url_type = LYLegitimizeHREF(me, (char**)&base, TRUE))) {
+	    if (!(url_type = LYLegitimizeHREF(me, (char**)&base,
+	    				      TRUE, TRUE))) {
 	        if (TRACE)
 		    fprintf(stderr,
 		    	    "HTML: BASE '%s' is not an absolute URL.\n",
@@ -592,17 +706,21 @@ PRIVATE void HTML_start_element ARGS5(
 	break;
 
     case HTML_TITLE:
+	if (!me->text)
+	    UPDATE_STYLE;
         HTChunkClear(&me->title);
-	if (me->inUnderline) {
-	    if (!me->text)
-	        UPDATE_STYLE;
+	if (me->inUnderline) {	/* This block could go away(?) - kw */
 	    HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
 	    me->inUnderline = FALSE;
 	}
 	break;
 
     case HTML_LINK:
+	intern_flag = FALSE;
+	if (!me->text)
+	    UPDATE_STYLE;
 	if (present && present[HTML_LINK_HREF]) {
+	    CHECK_FOR_INTERN(value[HTML_LINK_HREF]);
 	    /*
 	     *  Prepare to do housekeeping on the reference. - FM
 	     */
@@ -614,7 +732,7 @@ PRIVATE void HTML_start_element ARGS5(
 		}
 	    } else {
 		StrAllocCopy(href, value[HTML_LINK_HREF]);
-		url_type = LYLegitimizeHREF(me, (char**)&href, TRUE);
+		url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE);
 	    }
 
 	    /*
@@ -701,13 +819,45 @@ PRIVATE void HTML_start_element ARGS5(
 		/*
 		 *  Ignore style sheets, for now. - FM
 		 */
-		if (!strcasecomp(value[HTML_LINK_REL], "StyleSheet")) {
+		if (!strcasecomp(value[HTML_LINK_REL], "StyleSheet") ||
+		    !strcasecomp(value[HTML_LINK_REL], "Style")) {
 		    if (TRACE) {
 		        fprintf(stderr,
 				"HTML: StyleSheet link found.\n");
-		        fprintf(stderr,
-				"        StyleSheets not yet implemented.\n");
 		    }
+#ifdef LINKEDSTYLES
+		    if (href && *href != '\0')
+		    {
+			int res = -999;
+			if ((url_type = is_url(href)) == 0 ||
+			    (url_type == FILE_URL_TYPE && LYisLocalFile(href))) {
+			    if (url_type == FILE_URL_TYPE) {
+				temp = HTParse(href, "", PARSE_PATH+PARSE_PUNCTUATION);
+				HTUnEscape(temp);
+				if (temp && *temp != '\0') {
+				    res = style_readFromFile(temp);
+				    if (res != 0)
+					StrAllocCopy(href, temp);
+				}
+				FREE(temp);
+			    } else {
+				res = style_readFromFile(href);
+			    }
+			}
+			if (TRACE)
+			    fprintf(stderr, "CSS: StyleSheet=%s %d\n", href, res);
+			if (res == 0)
+			    HTAnchor_setStyle (me->node_anchor, href);
+		    }
+		    else
+			if (TRACE)
+			    fprintf(stderr,
+				"        non-local StyleSheets not yet implemented.\n");
+#else
+		    if (TRACE)
+			fprintf(stderr,
+				"        StyleSheets not yet implemented.\n");
+#endif
 		    FREE(href);
 		    break;
 		}
@@ -824,7 +974,7 @@ PRIVATE void HTML_start_element ARGS5(
 				me->node_anchor,	/* Parent */
 		    		NULL,			/* Tag */
 		    		href,			/* Addresss */
-		    		(void *)0);		/* Type */
+		    		INTERN_LT);		/* Type */
 	    if ((dest = HTAnchor_parent(
 			    HTAnchor_followMainLink((HTAnchor*)me->CurrentA)
 			    	      )) != 0) {
@@ -838,7 +988,7 @@ PRIVATE void HTML_start_element ARGS5(
 					me->node_anchor,	/* Parent */
 					LYToolbarName,		/* Tag */
 					NULL,			/* Addresss */
-					(void *)0))) {		/* Type */
+					(HTLinkType*)0))) {	/* Type */
 		HText_appendCharacter(me->text, '#');
 		HText_beginAnchor(me->text, ID_A);
 		HText_endAnchor(me->text);
@@ -847,7 +997,27 @@ PRIVATE void HTML_start_element ARGS5(
 	    HText_beginAnchor(me->text, me->CurrentA);
 	    if (me->inBoldH == FALSE)
 	        HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
+#if USE_COLOR_STYLE
+	    if (present && present[HTML_LINK_CLASS] &&
+	    value && *value[HTML_LINK_CLASS]!='\0')
+	    {
+		char tmp[1024];
+		sprintf(tmp, "link.%s.%s.%s", value[HTML_LINK_CLASS], title, value[HTML_LINK_CLASS]);
+		if (TRACE)
+			fprintf(stderr, "CSSTRIM:link=%s\n", tmp);
+
+		HText_characterStyle(me->text, hash_code(tmp), 1);
+		HTML_put_string(me, title);
+		HTML_put_string(me, " (");
+		HTML_put_string(me, value[HTML_LINK_CLASS]);
+		HTML_put_string(me, ")");
+		HText_characterStyle(me->text, hash_code(tmp), 0);
+	    }
+	    else
+		HTML_put_string(me, title);
+#else	
 	    HTML_put_string(me, title);
+#endif
 	    if (me->inBoldH == FALSE)
 	        HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
 	    HText_endAnchor(me->text);
@@ -857,6 +1027,8 @@ PRIVATE void HTML_start_element ARGS5(
 	break;
 
     case HTML_ISINDEX:
+	if (!me->text)
+	    UPDATE_STYLE;
 	if (((present)) &&
 	    ((present[HTML_ISINDEX_HREF] && value[HTML_ISINDEX_HREF]) ||
 	     (present[HTML_ISINDEX_ACTION] && value[HTML_ISINDEX_ACTION]))) {
@@ -873,7 +1045,8 @@ PRIVATE void HTML_start_element ARGS5(
 	        StrAllocCopy(isindex_href, value[HTML_ISINDEX_HREF]);
 	    else
 	        StrAllocCopy(isindex_href, value[HTML_ISINDEX_ACTION]);
-	    url_type = LYLegitimizeHREF(me, (char**)&isindex_href, TRUE);
+	    url_type = LYLegitimizeHREF(me, (char**)&isindex_href,
+	    				TRUE, TRUE);
 
 	    /*
 	     *  Check whether a base tag is in effect.
@@ -960,8 +1133,9 @@ PRIVATE void HTML_start_element ARGS5(
 	break;
 
     case HTML_BODY:
-        UPDATE_STYLE;
-	if (me->inUnderline) {
+	if (!me->text)
+	    UPDATE_STYLE;
+	if (me->inUnderline) {	/* This block could go away(?) - kw */
 	    HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
 	    me->inUnderline = FALSE;
 	}
@@ -993,7 +1167,8 @@ PRIVATE void HTML_start_element ARGS5(
 	if (present && present[HTML_FRAME_SRC] &&
 	    value[HTML_FRAME_SRC] && *value[HTML_FRAME_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_FRAME_SRC]);
-	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE);
+	    CHECK_FOR_INTERN(href);
+	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE);
 
 	    /*
 	     *  Check whether a base tag is in effect. - FM
@@ -1019,7 +1194,7 @@ PRIVATE void HTML_start_element ARGS5(
 				me->node_anchor,	/* Parent */
 				NULL,			/* Tag */
 				href,			/* Addresss */
-				(void *)0);		/* Type */
+				INTERN_LT);		/* Type */
 	    LYEnsureSingleSpace(me);
 	    if (me->inUnderline == FALSE)
 	        HText_appendCharacter(me->text, LY_UNDERLINE_START_CHAR);
@@ -1059,7 +1234,7 @@ PRIVATE void HTML_start_element ARGS5(
 					me->node_anchor,	/* Parent */
 					LYToolbarName,		/* Tag */
 					NULL,			/* Addresss */
-					(void *)0))) {		/* Type */
+					(HTLinkType*)0))) {	/* Type */
 	    HText_beginAnchor(me->text, ID_A);
 	    HText_endAnchor(me->text);
 	    HText_setToolbar(me->text);
@@ -1069,7 +1244,7 @@ PRIVATE void HTML_start_element ARGS5(
 
     case HTML_CENTER:
     case HTML_DIV:
-	if (me->Division_Level < MAX_NESTING) {
+	if (me->Division_Level < (MAX_NESTING - 1)) {
 	    me->Division_Level++;
 	} else if (TRACE) {
             fprintf(stderr, 
@@ -1235,7 +1410,7 @@ PRIVATE void HTML_start_element ARGS5(
 
 	/*
 	 *  Mark that we are starting a new paragraph
-	 *  and don't have any of it's text yet. - FM
+	 *  and don't have any of its text yet. - FM
 	 *
 	 */
 	me->inP = FALSE;
@@ -1253,6 +1428,19 @@ PRIVATE void HTML_start_element ARGS5(
 	me->inP = FALSE;
 	break;
 
+    case HTML_WBR:
+        UPDATE_STYLE;
+	LYCheckForID(me, present, value, (int)HTML_GEN_ID);
+	HText_setBreakPoint(me->text);
+	break;
+
+    case HTML_HY:
+    case HTML_SHY:
+        UPDATE_STYLE;
+	LYCheckForID(me, present, value, (int)HTML_GEN_ID);
+	HText_appendCharacter(me->text, LY_SOFT_HYPHEN);
+	break;
+
     case HTML_HR:
 	{
 	    int width;
@@ -1456,6 +1644,30 @@ PRIVATE void HTML_start_element ARGS5(
     case HTML_FONT:
 	if (!me->text)
 	    UPDATE_STYLE;
+
+        /*
+	 *  FONT *may* have been declared SGML_EMPTY in HTMLDTD.c, and
+	 *  SGML_character() in SGML.c *may* check for a FONT end
+	 *  tag to call HTML_end_element() directly (with a
+	 *  check in that to bypass decrementing of the HTML
+	 *  parser's stack).  Or this may have been really a </FONT>
+	 *  end tag, for which some incarnations of SGML.c would fake
+	 *  a <FONT> start tag instead. - fm & kw
+	 *
+	 *  But if we have an open FONT, DON'T close that one now,
+	 *  since FONT tags can be legally nested AFAIK, and Lynx
+	 *  currently doesn't do anything with them anyway... - kw
+	 */
+#ifdef NOTUSED_FOTEMODS
+	if (me->inFONT == TRUE)
+	    HTML_end_element(me, HTML_FONT, (char **)&include);
+#endif /* NOTUSED_FOTEMODS */
+
+	/*
+	 *  Set flag to know we are in a FONT container, and
+	 *  add code to do something about it, someday. - FM
+	 */
+	me->inFONT = TRUE;
 	break;
 
     case HTML_B:			/* Physical character highlighting */
@@ -1676,19 +1888,19 @@ PRIVATE void HTML_start_element ARGS5(
 	}
 	me->inP = FALSE;
 	break;
-	
+
     case HTML_DD:
 	if (!me->text)
 	    UPDATE_STYLE;
 	LYCheckForID(me, present, value, (int)HTML_GEN_ID);
 	HText_setLastChar(me->text, ' ');  /* absorb white space */
-        if (!me->style_change) 
-	    HText_appendCharacter(me->text, '\r');
-	else 
-	  {
+        if (!me->style_change)  {
+	    if (HText_LastLineSize(me->text))
+		HText_appendCharacter(me->text, '\r');
+	} else {
             UPDATE_STYLE;
 	    HText_appendCharacter(me->text, '\t');
-	  }
+	}
 	me->sp->style->alignment = HT_LEFT;
 	me->in_word = NO;
 	me->inP = FALSE;
@@ -1865,7 +2077,8 @@ PRIVATE void HTML_start_element ARGS5(
         UPDATE_STYLE;  /* update to the new style */
 	HText_appendParagraph(me->text);
 	LYCheckForID(me, present, value, (int)HTML_GEN_ID);
-	HText_appendCharacter(me->text, ' ');
+	HTML_put_character(me, HT_NON_BREAK_SPACE);
+	HText_setLastChar(me->text, ' ');
 	me->in_word = NO;
 	break;
 
@@ -1937,28 +2150,33 @@ PRIVATE void HTML_start_element ARGS5(
 	    }
 	    me->Last_OL_Count = seqnum;
 	    me->Last_OL_Type = seqtype;
-	    /* hack, because there is no append string! */
+	    /*
+	     *  Hack, because there is no append string!
+	     */
 	    for (i = 0; number_string[i] != '\0'; i++)
 		if (number_string[i] == ' ')
-	            HText_appendCharacter(me->text, number_string[i]);
+		    HTML_put_character(me, HT_NON_BREAK_SPACE);
 		else
 	    	    HTML_put_character(me, number_string[i]);
 
-	    /* use HTML_put_character so that any other spaces
-	     * coming through will be collapsed
+	    /*
+	     *  Use HTML_put_character so that any other spaces
+	     *  coming through will be collapsed.  We'll use
+	     *  nbsp, so it won't break at the spacing character
+	     *  if there are no spaces in the subsequent text up
+	     *  to the right margin, but will declare it as a
+	     *  normal space to ensure collapsing if a normal
+	     *  space does immediately follow it. - FM
 	     */
-	    HTML_put_character(me, ' ');  /* the spacing charactor */	
+	    HTML_put_character(me, HT_NON_BREAK_SPACE);
+	    HText_setLastChar(me->text, ' ');
 
 	} else if (me->sp[0].tag_number == HTML_UL) {
 	    /*
 	     *  Hack, because there is no append string!
 	     */
-	    HText_appendCharacter(me->text, ' ');
-	    HText_appendCharacter(me->text, ' ');
-	    /* 
-	     *  Use HTML_put_character so that any other spaces
-	     *  comming through will be collapsed
-	     */
+	    HTML_put_character(me, HT_NON_BREAK_SPACE);
+	    HTML_put_character(me, HT_NON_BREAK_SPACE);
 	    switch(me->List_Nesting_Level % 7) {
 		case 0:
 	    	    HTML_put_character(me, '*');
@@ -1983,13 +2201,24 @@ PRIVATE void HTML_start_element ARGS5(
 		    break;
 		    
 	    }
-	    HTML_put_character(me, ' ');	
+	    /*
+	     *  Keep using HTML_put_character so that any other
+	     *  spaces coming through will be collapsed.  We use
+	     *  nbsp, so we won't wrap at the spacing character
+	     *  if there are no spaces in the subsequent text up
+	     *  to the right margin, but will declare it as a
+	     *  normal space to ensure collapsing if a normal
+	     *  space does immediately follow it. - FM
+	     */
+	    HTML_put_character(me, HT_NON_BREAK_SPACE);
+	    HText_setLastChar(me->text, ' ');
 	} else {
 	    /*
 	     *  Hack, because there is no append string!
 	     */
-	    HText_appendCharacter(me->text, ' ');
-	    HText_appendCharacter(me->text, ' ');
+	    HTML_put_character(me, HT_NON_BREAK_SPACE);
+	    HTML_put_character(me, HT_NON_BREAK_SPACE);
+	    HText_setLastChar(me->text, ' ');
 	}
 	me->in_word = NO;
 	me->inP = FALSE;
@@ -2041,6 +2270,18 @@ PRIVATE void HTML_start_element ARGS5(
 	break;
 
     case HTML_A:
+        /*
+	 *  A may have been declared SGML_EMPTY in HTMLDTD.c, and
+	 *  SGML_character() in SGML.c may check for an A end
+	 *  tag to call HTML_end_element() directly (with a
+	 *  check in that to bypass decrementing of the HTML
+	 *  parser's stack), so if we have an open A, close
+	 *  that one now. - FM & kw
+	 */
+	if (me->inA == TRUE) {
+	    SET_SKIP_STACK(HTML_A);
+	    HTML_end_element(me, HTML_A, (char **)&include);
+	}
 	/*
 	 *  Set to know we are in an anchor.
 	 */
@@ -2067,6 +2308,11 @@ PRIVATE void HTML_start_element ARGS5(
 	 *  Handle the reference. - FM
 	 */
 	if (present && present[HTML_A_HREF]) {
+
+	    if (present[HTML_A_ISMAP])
+		intern_flag = FALSE;
+	    else
+		CHECK_FOR_INTERN(value[HTML_A_HREF]);
 	    /*
 	     *  Prepare to do housekeeping on the reference. - FM
 	     */
@@ -2080,7 +2326,7 @@ PRIVATE void HTML_start_element ARGS5(
 	    } else {
 		StrAllocCopy(href, value[HTML_A_HREF]);
 	    }
-	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE);
+	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE);
 
 	    /*
 	     *  Deal with our ftp gateway kludge. - FM
@@ -2121,22 +2367,31 @@ PRIVATE void HTML_start_element ARGS5(
 	        me->inBoldA = TRUE;
 	    }
 	}
+	if (present && present[HTML_A_TYPE] && value[HTML_A_TYPE]) {
+	    StrAllocCopy(temp, value[HTML_A_TYPE]);
+	    if (!intern_flag && href &&
+		!strcasecomp(value[HTML_A_TYPE], HTAtom_name(LINK_INTERNAL)) &&
+		0 != strcmp(me->node_anchor->address, LYlist_temp_url()) &&
+		0 != strncmp(me->node_anchor->address, "LYNXIMGMAP:", 11)) {
+		/* Some kind of spoof?
+		** Found TYPE="internal link" but not in a valid context
+		** where we have written it. - kw
+		*/
+		if (TRACE)
+		    fprintf(stderr,
+			    "HTML: Found invalid HREF=\"%s\" TYPE=\"%s\"!\n",
+			    href, temp);
+		FREE(temp);
+	    }
+	}
 
 	me->CurrentA = HTAnchor_findChildAndLink(
 			me->node_anchor,			/* Parent */
 			id_string,				/* Tag */
 			href,					/* Address */
-			(present &&
-			 present[HTML_A_TYPE] &&
-			   value[HTML_A_TYPE]) ? 
-   (HTLinkType*)HTAtom_for(value[HTML_A_TYPE]) : (HTLinkType *)0);	/* Type */
-
-	/*
-	 *  Get rid of href since no longer needed.
-	 *  Memory leak fixed
-	 *  06-16-94 Lynx 2-3-1 Garrett Arch Blythe
-	 */
-	FREE(href);
+			temp ?
+		(HTLinkType*)HTAtom_for(temp) : INTERN_LT);  /* Type */
+	FREE(temp);
 	FREE(id_string);
 	    
 	if (me->CurrentA && present) {
@@ -2190,15 +2445,26 @@ PRIVATE void HTML_start_element ARGS5(
 	HText_beginAnchor(me->text, me->CurrentA);
 	if (me->inBoldA == TRUE && me->inBoldH == FALSE)
 	    HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
+#ifdef 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
+	 */
+	if (href == NULL && me->inBoldA == FALSE)
+	    HTML_end_element(me, HTML_A, (char **)&include);
+#endif /* NOTUSED_FOTEMODS */
+	FREE(href);
     	break;
 
     case HTML_IMG:			/* Images */
 	if (!me->text)
 	    UPDATE_STYLE;
 	/*
-	 *  If it's a clickable image for the current anchor,
-	 *  set our flags for faking a 0,0 coordinate pair,
-	 *  which typically returns the image's default. - FM
+	 *  If we're in an anchor, get the destination, and if it's a
+	 *  clickable image for the current anchor, set our flags for
+	 *  faking a 0,0 coordinate pair, which typically returns the
+	 *  image's default. - FM
 	 */
 	if (me->inA && me->CurrentA) {
 	    if ((dest = HTAnchor_parent(
@@ -2208,7 +2474,7 @@ PRIVATE void HTML_start_element ARGS5(
 		    dest_ismap = TRUE;
 		    if (TRACE)
 		        fprintf(stderr,
-				"HTML: '%s' as an ISMAP script\n",
+				"HTML: '%s' is an ISMAP script\n",
 				dest->address);
 		} else if (present && present[HTML_IMG_ISMAP]) {
 		    dest_ismap = TRUE;
@@ -2221,13 +2487,15 @@ PRIVATE void HTML_start_element ARGS5(
 	    }
 	}
 
+	intern_flag = FALSE;	/* unless set below - kw */
 	/*
 	 *  If there's a USEMAP, resolve it. - FM
 	 */
 	if (present && present[HTML_IMG_USEMAP] &&
 	    value[HTML_IMG_USEMAP] && *value[HTML_IMG_USEMAP]) {
 	    StrAllocCopy(map_href, value[HTML_IMG_USEMAP]);
-	    url_type = LYLegitimizeHREF(me, (char**)&map_href, TRUE);
+	    CHECK_FOR_INTERN(map_href);
+	    url_type = LYLegitimizeHREF(me, (char**)&map_href, TRUE, TRUE);
 	    if (*map_href == '\0') {
 	        FREE(map_href);
 	    }
@@ -2274,6 +2542,15 @@ PRIVATE void HTML_start_element ARGS5(
 	}
 
 	/*
+	 *  Check whether we want to suppress the server-side
+	 *  ISMAP link if a client-side MAP is present. - FM
+	 */
+	if (LYNoISMAPifUSEMAP && map_href) {
+	    dest_ismap = FALSE;
+	    dest = NULL;
+	}
+
+	/*
 	 *  Check for a TITLE attribute. - FM
 	 */
 	if (present && present[HTML_IMG_TITLE] &&
@@ -2318,10 +2595,10 @@ PRIVATE void HTML_start_element ARGS5(
 	        LYTrimHead(alt_string);
 	        LYTrimTail(alt_string);
 		if (*alt_string == '\0') {
-		    if (map_href)
+		    if (map_href) {
 		        StrAllocCopy(alt_string, (title ?
 						  title : "[USEMAP]"));
-		    else if (dest_ismap || present[HTML_IMG_ISMAP]) {
+		    } else if (dest_ismap) {
 		        StrAllocCopy(alt_string, (title ?
 						  title : "[ISMAP]"));
 		    } else if (me->inA == TRUE && dest) {
@@ -2367,9 +2644,7 @@ PRIVATE void HTML_start_element ARGS5(
 	    fprintf(stderr,
 	    	    "HTML IMG: USEMAP=%d ISMAP=%d ANCHOR=%d PARA=%d\n",
 		    map_href ? 1 : 0,
-		    ((dest_ismap == TRUE) ||
-		     (me->inA && present && present[HTML_IMG_ISMAP])) ?
-		     						    1 : 0,
+		    (dest_ismap == TRUE) ? 1 : 0,
 		    me->inA, me->inP);
 	}
 
@@ -2392,7 +2667,7 @@ PRIVATE void HTML_start_element ARGS5(
 	    present && present[HTML_IMG_SRC] &&
 	    value[HTML_IMG_SRC] && *value[HTML_IMG_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_IMG_SRC]);
-	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE);
+	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE);
 
 	    /*
 	     *  Check whether a base tag is in effect. - FM
@@ -2424,9 +2699,9 @@ PRIVATE void HTML_start_element ARGS5(
 		 *  start a new one for the client-side MAP. - FM
 		 */
 		if (map_href) {
-		    if (dest_ismap || (present && present[HTML_IMG_ISMAP])) {
+		    if (dest_ismap) {
 		        HTML_put_string(me, "[ISMAP]");
-		    } else {
+		    } else if (dest) {
 		        HTML_put_string(me, "[LINK]");
 		    }
 		    if (me->inBoldA == TRUE && me->inBoldH == FALSE) {
@@ -2434,13 +2709,14 @@ PRIVATE void HTML_start_element ARGS5(
 		    }
 		    me->inBoldA = FALSE;
 		    HText_endAnchor(me->text);
-		    HText_appendCharacter(me->text, '-');
+		    if (dest_ismap || dest)
+		        HText_appendCharacter(me->text, '-');
 		    if (id_string) {
 		        if ((ID_A = HTAnchor_findChildAndLink(
 				  me->node_anchor,	/* Parent */
 				  id_string,		/* Tag */
 				  NULL,			/* Addresss */
-				  (void *)0)) != 0) {	/* Type */
+				  (HTLinkType*)0)) != NULL) {	/* Type */
 		            HText_beginAnchor(me->text, ID_A);
 		            HText_endAnchor(me->text);
 		        }
@@ -2449,7 +2725,7 @@ PRIVATE void HTML_start_element ARGS5(
 		    		me->node_anchor,	/* Parent */
 				NULL,			/* Tag */
 				map_href,		/* Addresss */
-				(void *)0);		/* Type */
+				INTERN_LT);		/* Type */
 		    if (me->CurrentA && title) {
 			if ((dest = HTAnchor_parent(
 				HTAnchor_followMainLink((HTAnchor*)me->CurrentA)
@@ -2481,7 +2757,7 @@ PRIVATE void HTML_start_element ARGS5(
 				  me->node_anchor,	/* Parent */
 				  id_string,		/* Tag */
 				  NULL,			/* Addresss */
-				  (void *)0)) != 0) {	/* Type */
+				  (HTLinkType*)0)) != NULL) {	/* Type */
 		        HText_beginAnchor(me->text, ID_A);
 		        HText_endAnchor(me->text);
 		    }
@@ -2494,7 +2770,7 @@ PRIVATE void HTML_start_element ARGS5(
 				  me->node_anchor,	/* Parent */
 				  id_string,		/* Tag */
 				  NULL,			/* Addresss */
-				  (void *)0)) != 0) {	/* Type */
+				  (HTLinkType*)0)) != NULL) {	/* Type */
 		        HText_beginAnchor(me->text, ID_A);
 		        HText_endAnchor(me->text);
 		    }
@@ -2503,7 +2779,7 @@ PRIVATE void HTML_start_element ARGS5(
 		    		me->node_anchor,	/* Parent */
 				NULL,			/* Tag */
 				map_href,		/* Addresss */
-				(void *)0);		/* Type */
+				INTERN_LT);		/* Type */
 		if (me->CurrentA && title) {
 		    if ((dest = HTAnchor_parent(
 				HTAnchor_followMainLink((HTAnchor*)me->CurrentA)
@@ -2535,7 +2811,7 @@ PRIVATE void HTML_start_element ARGS5(
 				  me->node_anchor,	/* Parent */
 				  id_string,		/* Tag */
 				  NULL,			/* Addresss */
-				  (void *)0)) != 0) {	/* Type */
+				  (HTLinkType*)0)) != NULL) {	/* Type */
 		        HText_beginAnchor(me->text, ID_A);
 		        HText_endAnchor(me->text);
 		    }
@@ -2549,7 +2825,7 @@ PRIVATE void HTML_start_element ARGS5(
 			me->node_anchor,		/* Parent */
 			NULL,				/* Tag */
 			href,				/* Addresss */
-			(void *)0);			/* Type */
+			(HTLinkType*)0);		/* Type */
 	    FREE(href);
 	    HText_beginAnchor(me->text, me->CurrentA);
 	    if (me->inBoldH == FALSE)
@@ -2570,7 +2846,9 @@ PRIVATE void HTML_start_element ARGS5(
 		 *  We're in an anchor and have a USEMAP, so end the anchor
 		 *  and start a new one for the client-side MAP. - FM
 		 */
-		if (!(dest_ismap || (present && present[HTML_IMG_ISMAP]))) {
+		if (dest_ismap) {
+		    HTML_put_string(me, "[ISMAP]");
+		} else if (dest) {
 		    HTML_put_string(me, "[LINK]");
 		}
 		if (me->inBoldA == TRUE && me->inBoldH == FALSE) {
@@ -2578,7 +2856,7 @@ PRIVATE void HTML_start_element ARGS5(
 		}
 		me->inBoldA = FALSE;
 		HText_endAnchor(me->text);
-		if (!(dest_ismap || (present && present[HTML_IMG_ISMAP])))
+		if (dest_ismap || dest)
 		    HText_appendCharacter(me->text, '-');
 	    } else {
 	        HTML_put_character(me, ' ');
@@ -2588,7 +2866,7 @@ PRIVATE void HTML_start_element ARGS5(
 		    		me->node_anchor,	/* Parent */
 				NULL,			/* Tag */
 				map_href,		/* Addresss */
-				(void *)0);		/* Type */
+				INTERN_LT);		/* Type */
 	    if (me->CurrentA && title) {
 		if ((dest = HTAnchor_parent(
 				HTAnchor_followMainLink((HTAnchor*)me->CurrentA)
@@ -2625,7 +2903,7 @@ PRIVATE void HTML_start_element ARGS5(
 				  me->node_anchor,	/* Parent */
 				  id_string,		/* Tag */
 				  NULL,			/* Addresss */
-				  (void *)0)) != 0) {	/* Type */
+				  (HTLinkType*)0)) != NULL) {	/* Type */
 		    HText_beginAnchor(me->text, ID_A);
 		    HText_endAnchor(me->text);
 		}
@@ -2666,11 +2944,13 @@ PRIVATE void HTML_start_element ARGS5(
 	 *  Load map_address. - FM
 	 */
 	if (id_string) {
-	    if (me->inBASE && me->base_href && *me->base_href) {
-		StrAllocCopy(me->map_address, me->base_href);
-	    } else {
-		StrAllocCopy(me->map_address, me->node_anchor->address);
-	    }
+	    /*
+	     *  The MAP must be in the current stream, even if it
+	     *  had a BASE tag, so we'll use its address here, but
+	     *  still use the BASE, if present, when resolving the
+	     *  AREA elements in its content. - FM && KW
+	     */
+	    StrAllocCopy(me->map_address, me->node_anchor->address);
 	    if ((cp = strrchr(me->map_address, '#')) != NULL)
 	        *cp = '\0';
 	    StrAllocCat(me->map_address, "#");
@@ -2701,13 +2981,16 @@ PRIVATE void HTML_start_element ARGS5(
 	    present && present[HTML_AREA_HREF] &&
 	    value[HTML_AREA_HREF] && *value[HTML_AREA_HREF]) {
 	    /*
-	     * Resolve the HREF. - FM
+	     *  Resolve the HREF. - FM
 	     */
 	    StrAllocCopy(href, value[HTML_AREA_HREF]);
-	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE);
+	    CHECK_FOR_INTERN(href);
+	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE);
 
 	    /*
-	     *  Check whether a base tag is in effect. - FM
+	     *  Check whether a BASE tag is in effect, and use it
+	     *  for resolving, even though we used this stream's
+	     *  address for locating the MAP itself. - FM
 	     */
 	    if ((me->inBASE && *href != '\0' && *href != '#') &&
 		(temp = HTParse(href, me->base_href, PARSE_ALL)) &&
@@ -2773,7 +3056,7 @@ PRIVATE void HTML_start_element ARGS5(
 	        StrAllocCopy(alt_string, href);
 	    }
 
-	    LYAddMapElement(me->map_address, href, alt_string);
+	    LYAddMapElement(me->map_address, href, alt_string, intern_flag);
 	    FREE(href);
 	    FREE(alt_string);
 	}
@@ -2823,7 +3106,8 @@ PRIVATE void HTML_start_element ARGS5(
 	if (clickable_images && present && present[HTML_FIG_SRC] &&
 	    value[HTML_FIG_SRC] && *value[HTML_FIG_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_FIG_SRC]);
-	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE);
+	    CHECK_FOR_INTERN(href);
+	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE);
 	    if (*href) {
 		/*
 		 *  Check whether a base tag is in effect. - FM
@@ -2849,7 +3133,7 @@ PRIVATE void HTML_start_element ARGS5(
 		       			me->node_anchor,	/* Parent */
 		       			NULL,			/* Tag */
 		       			href,			/* Addresss */
-		       			(void *)0))) {		/* Type */
+		       			INTERN_LT))) {		/* Type */
 		    HText_beginAnchor(me->text, me->CurrentA);
 		    if (me->inBoldH == FALSE)
 			HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
@@ -2996,7 +3280,8 @@ PRIVATE void HTML_start_element ARGS5(
 	    present && present[HTML_OVERLAY_SRC] &&
 	    value[HTML_OVERLAY_SRC] && *value[HTML_OVERLAY_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_OVERLAY_SRC]);
-	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE);
+	    CHECK_FOR_INTERN(href);
+	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE);
 	    if (*href) {
 		/*
 		 *  Check whether a base tag is in effect. - FM
@@ -3022,7 +3307,7 @@ PRIVATE void HTML_start_element ARGS5(
 					me->node_anchor,	/* Parent */
 					NULL,			/* Tag */
 					href,			/* Addresss */
-					(void *)0))) {		/* Type */
+					INTERN_LT))) {		/* Type */
 		    if (!me->text) {
 		        UPDATE_STYLE;
 		    } else {
@@ -3124,7 +3409,7 @@ PRIVATE void HTML_start_element ARGS5(
 		    StrAllocCopy(base, "/");
 		if (base[strlen(base)-1] != '/')
 		    StrAllocCat(base, "/");
-		url_type = LYLegitimizeHREF(me, (char**)&base, TRUE);
+		url_type = LYLegitimizeHREF(me, (char**)&base, TRUE, FALSE);
 
 		/*
 		 *  Check whether to fill in localhost. - FM
@@ -3155,7 +3440,7 @@ PRIVATE void HTML_start_element ARGS5(
 	    }
 
 	    StrAllocCopy(code, value[HTML_APPLET_CODE]);
-	    url_type = LYLegitimizeHREF(me, (char**)&code, TRUE);
+	    url_type = LYLegitimizeHREF(me, (char**)&code, TRUE, FALSE);
 	    href = HTParse(code, base, PARSE_ALL);
 	    FREE(base);
 	    FREE(code);
@@ -3165,7 +3450,7 @@ PRIVATE void HTML_start_element ARGS5(
 					me->node_anchor,	/* Parent */
 					NULL,			/* Tag */
 					href,			/* Addresss */
-					(void *)0))) {		/* Type */
+					(HTLinkType*)0))) {	/* Type */
 		HText_beginAnchor(me->text, me->CurrentA);
 		if (me->inBoldH == FALSE)
 		    HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
@@ -3196,7 +3481,8 @@ PRIVATE void HTML_start_element ARGS5(
 	if (clickable_images && present && present[HTML_BGSOUND_SRC] &&
 	    value[HTML_BGSOUND_SRC] && *value[HTML_BGSOUND_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_BGSOUND_SRC]);
-	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE);
+	    CHECK_FOR_INTERN(href);
+	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE);
 	    if (*href == '\0') {
 	        FREE(href);
 		break;
@@ -3228,7 +3514,7 @@ PRIVATE void HTML_start_element ARGS5(
 					me->node_anchor,	/* Parent */
 					NULL,			/* Tag */
 					href,			/* Addresss */
-					(void *)0))) {		/* Type */
+					INTERN_LT))) {		/* Type */
 		HTML_put_character(me, ' ');  /* space char may be ignored */
 		me->in_word = NO;
 		HText_beginAnchor(me->text, me->CurrentA);
@@ -3307,7 +3593,8 @@ PRIVATE void HTML_start_element ARGS5(
 	if (clickable_images && present && present[HTML_EMBED_SRC] &&
 	    value[HTML_EMBED_SRC] && *value[HTML_EMBED_SRC] != '\0') {
 	    StrAllocCopy(href, value[HTML_EMBED_SRC]);
-	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE);
+	    CHECK_FOR_INTERN(href);
+	    url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE);
 	    if (*href != '\0') {
 		/*
 		 *  Check whether a base tag is in effect. - FM
@@ -3333,7 +3620,7 @@ PRIVATE void HTML_start_element ARGS5(
 					me->node_anchor,	/* Parent */
 					NULL,			/* Tag */
 					href,			/* Addresss */
-					(void *)0))) {		/* Type */
+					INTERN_LT))) {		/* Type */
 		    HText_beginAnchor(me->text, me->CurrentA);
 		    if (me->inBoldH == FALSE)
 			HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
@@ -3432,7 +3719,8 @@ PRIVATE void HTML_start_element ARGS5(
 	    HTChildAnchor * source;
 	    HTAnchor *link_dest;
 
-	    UPDATE_STYLE;
+	    if (!me->text)
+	        UPDATE_STYLE;
 	    /*
 	     *  FORM was declared SGML_EMPTY in HTMLDTD.c, and
 	     *  SGML_character() in SGML.c checks for a FORM end
@@ -3446,6 +3734,7 @@ PRIVATE void HTML_start_element ARGS5(
 		    fprintf(stderr,
 			    "HTML: Missing FORM end tag. Faking it!\n");
 		}
+		SET_SKIP_STACK(HTML_FORM);
 		HTML_end_element(me, HTML_FORM, (char **)&include);
 	    }
 
@@ -3460,7 +3749,7 @@ PRIVATE void HTML_start_element ARGS5(
 		 *  Prepare to do housekeeping on the reference. - FM
 		 */
 		StrAllocCopy(action, value[HTML_FORM_ACTION]);
-		url_type = LYLegitimizeHREF(me, (char**)&action, TRUE);
+		url_type = LYLegitimizeHREF(me, (char**)&action, TRUE, TRUE);
 
 		/*
 		 *  Check whether a base tag is in effect.
@@ -3496,8 +3785,8 @@ PRIVATE void HTML_start_element ARGS5(
 	        source = HTAnchor_findChildAndLink(me->node_anchor, 
 						   NULL,
 						   action,
-						   (void *)0);
-		if ((link_dest = HTAnchor_followMainLink((HTAnchor *)source)) != 0) {
+						   (HTLinkType*)0);
+		if ((link_dest = HTAnchor_followMainLink((HTAnchor *)source)) != NULL) {
 		    /*
 		     *  Memory leak fixed.
 		     *  05-28-94 Lynx 2-3-1 Garrett Arch Blythe
@@ -3562,8 +3851,6 @@ PRIVATE void HTML_start_element ARGS5(
 	    FREE(enctype);
 	    FREE(title);
 	}
-	if (!me->text)
-	    UPDATE_STYLE;
 	LYCheckForID(me, present, value, (int)HTML_FORM_ID);
 	break;
 
@@ -3585,6 +3872,7 @@ PRIVATE void HTML_start_element ARGS5(
 	    int chars;
 	    BOOL UseALTasVALUE = FALSE;
 	    BOOL HaveSRClink = FALSE;
+	    BOOL IsSubmitOrReset = FALSE;
 
 	    /*
 	     *  Make sure we're in a form.
@@ -3626,10 +3914,22 @@ PRIVATE void HTML_start_element ARGS5(
 	    UPDATE_STYLE;
 
 	    /*
-	     *  Before any input field add a space if necessary
+	     *  Before any input field, add a collapsible space if
+	     *  we're not in a PRE block, to promote a wrap there
+	     *  for any long values that would extent past the right
+	     *  margin from our current position in the line.  If
+	     *  we are in a PRE block, start a new line if the last
+	     *  line already is within 6 characters of the wrap point
+	     *  for PRE blocks. - FM
 	     */
-	    HTML_put_character(me, ' ');
-	    me->in_word = NO;
+	    if (me->sp[0].tag_number != HTML_PRE && !me->inPRE &&
+		me->sp->style->freeFormat) {
+		HTML_put_character(me, ' ');
+		me->in_word = NO;
+	    } else if (HText_LastLineSize(me->text) > (LYcols - 7)) {
+		HTML_put_character(me, '\n');
+		me->in_word = NO;
+	    }
 
 	    if (present && present[HTML_INPUT_NAME] && value[HTML_INPUT_NAME])
 		I.name = (char *)value[HTML_INPUT_NAME];
@@ -3699,7 +3999,7 @@ PRIVATE void HTML_start_element ARGS5(
 		 *  SRC's value a link if it's still not zero-length
 		 *  legitiimizing it. - FM
 		 */
-		url_type = LYLegitimizeHREF(me, (char**)&href, TRUE);
+		url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE);
 		if (*href) {
 		    /*
 		     *  Check whether a base tag is in effect. - FM
@@ -3726,7 +4026,7 @@ PRIVATE void HTML_start_element ARGS5(
 		       			me->node_anchor,	/* Parent */
 		       			NULL,			/* Tag */
 		       			href,			/* Addresss */
-		       			(void *)0))) {		/* Type */
+		       			(HTLinkType*)0))) {	/* Type */
 		        HText_beginAnchor(me->text, me->CurrentA);
 			if (me->inBoldH == FALSE)
 			    HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
@@ -3848,20 +4148,127 @@ PRIVATE void HTML_start_element ARGS5(
 		I.md = (char *)value[HTML_INPUT_MD];
 
 	    chars = HText_beginInput(me->text, &I);
-	    if (me->sp[0].tag_number == HTML_PRE && chars > 20) {
+	    /*
+	     *  Submit and reset buttons have values which don't change,
+	     *  so HText_beginInput() sets I.value to the string which
+	     *  should be displayed, and we'll enter that instead of
+	     *  underscore placeholders into the HText structure to
+	     *  see it instead of underscores when dumping or printing.
+	     *  We also won't worry about a wrap in PRE blocks, because
+	     *  the line editor never is invoked for submit or reset
+	     *  buttons. - LE & FM
+	     */
+	    if (I.type &&
+	        (!strcasecomp(I.type,"submit") ||
+		 !strcasecomp(I.type,"reset") ||
+		 !strcasecomp(I.type,"image")))
+		IsSubmitOrReset = TRUE;
+
+	    if (I.type && chars == 3 &&
+		!strcasecomp(I.type, "radio")) {
+		/*
+		 *  Put a (_) placeholder, and one space
+		 *  (collapsible) before the label that is
+		 *  expected to follow. - FM
+		 */
+		HTML_put_string(me, "(_)");
+		chars = 0;
+		me->in_word = YES;
+		if (me->sp[0].tag_number != HTML_PRE &&
+		    !me->sp->style->freeFormat) {
+		    HTML_put_character(me, ' ');
+		    me->in_word = NO;
+		}
+	    } else if (I.type && chars == 3 &&
+		!strcasecomp(I.type, "checkbox")) {
+		/*
+		 *  Put a [_] placeholder, and one space
+		 *  (collapsible) before the label that is
+		 *  expected to follow. - FM
+		 */
+		HTML_put_string(me, "[_]");
+		chars = 0;
+		me->in_word = YES;
+		if (me->sp[0].tag_number != HTML_PRE &&
+		    !me->sp->style->freeFormat) {
+		    HTML_put_character(me, ' ');
+		    me->in_word = NO;
+		}
+	    } else if ((me->sp[0].tag_number == HTML_PRE ||
+			!me->sp->style->freeFormat)
+		       && chars > 6 &&
+		       IsSubmitOrReset == FALSE) {
 	        /*
-		 *  The code inadequately handles INPUT fields in PRE tags.
-		 *  We'll put up a minimum of 20 underscores, and if any
-		 *  more would exceed the wrap column, we'll ignore them.
+		 *  This is not a submit or reset button, and we are
+		 *  in a PRE block with a field intended to exceed 6
+		 *  character widths.  The code inadequately handles
+		 *  INPUT fields in PRE tags if wraps occur (at the
+		 *  right margin) for the underscore placeholders.
+		 *  We'll put up a minimum of 6 underscores, since we
+		 *  should have wrapped artificially, above, if the
+		 *  INPUT begins within 6 columns of the right margin,
+		 *  and if any more would exceed the wrap column, we'll
+		 *  ignore them.  Note that if we somehow get tripped
+		 *  up and a wrap still does occur before all 6 of the
+		 *  underscores are output, the wrapped ones won't be
+		 *   treated as part of the editing window, nor be
+		 *  highlighted when not editing (Yuk!). - FM
 		 */
-		for (i = 0; i < 20; i++) {
+		for (i = 0; i < 6; i++) {
 	            HTML_put_character(me, '_');
 		    chars--;
 		}
 		HText_setIgnoreExcess(me->text, TRUE);
 	    }
-	    for (; chars > 0; chars--)
-	    	HTML_put_character(me, '_');
+	    if (IsSubmitOrReset == FALSE) {
+	        /*
+		 *  This is not a submit or reset button,
+		 *  so output the rest of the underscore
+		 *  placeholders, if any more are needed. - FM
+		 */
+		for (; chars > 0; chars--)
+		    HTML_put_character(me, '_');
+	    } else {
+		if (me->sp[0].tag_number == HTML_PRE ||
+		    !me->sp->style->freeFormat) {
+		    /*
+		     *  We have a submit or reset button in a PRE block,
+		     *  so output the entire value from the markup.  If
+		     *  it extends to the right margin, it will wrap
+		     *  there, and only the portion before that wrap will
+		     *  be hightlighted on screen display (Yuk!) but we
+		     *  may as well show the rest of the full value on
+		     *  the next or more lines. - FM
+		     */
+		    while (I.value[i])
+		        HTML_put_character(me, I.value[i++]);
+		} else {
+		    /*
+		     *  The submit or reset button is not in a PRE block.
+		     *  Note that if a wrap occurs before outputting the
+		     *  entire value, the wrapped portion will not be
+		     *  highlighted or clearly indicated as part of the
+		     *  link for submission or reset (Yuk!).
+		     *  We'll replace any spaces in the submit or reset
+		     *  button value with nbsp, to promote a wrap at the
+		     *  space we ensured would be present before the start
+		     *  of the string, as when we use all underscores
+		     *  instead of the INPUT's actual value, but we could
+		     *  still get a wrap at the right margin, instead, if
+		     *  the value is greater than a line width for the
+		     *  current style.  Also, if chars somehow ended up
+		     *  longer than the length of the actual value
+		     *  (shouldn't have), we'll continue padding with nbsp
+		     *  up to the length of chars. - FM
+		     */
+	            for (i = 0; I.value[i]; i++)
+		        HTML_put_character(me,
+					   (I.value[i] ==  ' ' ?
+					    HT_NON_BREAK_SPACE : I.value[i]));
+		    while (i < chars)
+			HTML_put_character(me, HT_NON_BREAK_SPACE);
+		}
+	    }
 	    HText_setIgnoreExcess(me->text, FALSE);
 	}
 	break;
@@ -3925,10 +4332,10 @@ PRIVATE void HTML_start_element ARGS5(
 	    LYUnEscapeToLatinOne(&id_string, TRUE);
 	    if ((id_string != '\0') &&
 	        (ID_A = HTAnchor_findChildAndLink(
-				me->node_anchor,	 /* Parent */
-				id_string,		 /* Tag */
-				NULL,			 /* Addresss */
-				(void *)0))) {		 /* Type */
+				me->node_anchor,	/* Parent */
+				id_string,		/* Tag */
+				NULL,			/* Addresss */
+				(HTLinkType*)0))) {	/* Type */
 		if (!me->text)
 		    UPDATE_STYLE;
 		HText_beginAnchor(me->text, ID_A);
@@ -4029,13 +4436,29 @@ PRIVATE void HTML_start_element ARGS5(
 		me->inUnderline = FALSE;
 	    }
 
+	if ((multiple == NO && LYSelectPopups == TRUE) &&
+	    (me->sp[0].tag_number == HTML_PRE || me->inPRE == TRUE ||
+	     !me->sp->style->freeFormat) &&
+	        HText_LastLineSize(me->text) > (LYcols - 8)) {
+		/*
+		 *  Force a newline when we're using a popup in
+		 *  a PRE block and are within 7 columns from the
+		 *  right margin.  This will allow for the '['
+		 *  popup designater and help avoid a wrap in the
+		 *  underscore placeholder for the retracted popup
+		 *  entry in the HText structure. - FM
+		 */
+		HTML_put_character(me, '\n');
+		me->in_word = NO;
+	    }
+
 	    LYCheckForID(me, present, value, (int)HTML_SELECT_ID);
 
 	    HText_beginSelect(name, multiple, size);
 	    FREE(name);
 	    FREE(size);
 
-	    first_option = TRUE;
+	    me->first_option = TRUE;
 	}
 	break;
 
@@ -4067,7 +4490,7 @@ PRIVATE void HTML_start_element ARGS5(
 
 	    if (!me->text)
 	        UPDATE_STYLE;
-	    if (!first_option) {
+	    if (!me->first_option) {
 	        /*
 		 *  Finish the data off.
 		 */
@@ -4088,7 +4511,7 @@ PRIVATE void HTML_start_element ARGS5(
 	     *  are enabled, then don't use the checkbox/button method,
 	     *  and don't put anything on the screen yet.
 	     */
-	    if (first_option ||
+	    if (me->first_option ||
 	        HTCurSelectGroupType == F_CHECKBOX_TYPE ||
 		LYSelectPopups == FALSE) {
 		if (HTCurSelectGroupType == F_CHECKBOX_TYPE ||
@@ -4117,7 +4540,7 @@ PRIVATE void HTML_start_element ARGS5(
 	        I.type = "OPTION";
     
 	        if ((present && present[HTML_OPTION_SELECTED]) ||
-		    (first_option && LYSelectPopups == FALSE &&
+		    (me->first_option && LYSelectPopups == FALSE &&
 		     HTCurSelectGroupType == F_RADIO_TYPE))
 		    I.checked=YES;
 
@@ -4159,7 +4582,7 @@ PRIVATE void HTML_start_element ARGS5(
 				    me->node_anchor,	   /* Parent */
 				    value[HTML_OPTION_ID], /* Tag */
 				    NULL,		   /* Addresss */
-				    (void *)0)) != 0) {	   /* Type */
+				    (HTLinkType*)0)) != NULL) {	   /* Type */
 			HText_beginAnchor(me->text, ID_A);
 			HText_endAnchor(me->text);
 		        I.id = (char *)value[HTML_OPTION_ID];
@@ -4168,13 +4591,26 @@ PRIVATE void HTML_start_element ARGS5(
 
 	        HText_beginInput(me->text, &I);
     
-		if (HTCurSelectGroupType == F_CHECKBOX_TYPE ||
-		    LYSelectPopups == FALSE) {
+		if (HTCurSelectGroupType == F_CHECKBOX_TYPE) {
+	            /*
+		     *  Put a "[_]" placeholder, and one space
+		     *  (collapsible) before the label that is
+		     *  expected to follow. - FM
+		     */
+	    	    HText_appendCharacter(me->text, '[');
+	    	    HText_appendCharacter(me->text, '_');
+	    	    HText_appendCharacter(me->text, ']');
+	            HText_appendCharacter(me->text, ' ');
+		    me->in_word = NO;
+		} else if (LYSelectPopups == FALSE) {
 	            /*
-		     *  Put 3 underscores and one space before each option.
+		     *  Put a "(_)" placeholder, and one space
+		     *  (collapsible) before the label that is
+		     *  expected to follow. - FM
 		     */
-                    for (i = 0; i < 3; i++)
-	    	        HText_appendCharacter(me->text, '_');
+	    	    HText_appendCharacter(me->text, '(');
+	    	    HText_appendCharacter(me->text, '_');
+	    	    HText_appendCharacter(me->text, ')');
 	            HText_appendCharacter(me->text, ' ');
 		    me->in_word = NO;
 		}
@@ -4185,12 +4621,12 @@ PRIVATE void HTML_start_element ARGS5(
 	     */
             HTChunkClear(&me->option);
 	    if ((present && present[HTML_OPTION_SELECTED]) ||
-	        (first_option && LYSelectPopups == FALSE &&
+	        (me->first_option && LYSelectPopups == FALSE &&
 		 HTCurSelectGroupType == F_RADIO_TYPE))
 		me->LastOptionChecked = TRUE;
 	    else
 		me->LastOptionChecked = FALSE;
-	    first_option = FALSE;
+	    me->first_option = FALSE;
 
 
 	    if (present && present[HTML_OPTION_VALUE] &&
@@ -4275,11 +4711,27 @@ PRIVATE void HTML_start_element ARGS5(
 
     } /* end switch */
 
-    if (HTML_dtd.tags[element_number].contents!= SGML_EMPTY) {
+    if (HTML_dtd.tags[element_number].contents != SGML_EMPTY) {
+	if (me->skip_stack > 0) {
+	    if (TRACE)
+		fprintf(stderr,
+	    "HTML:begin_element: internal call (level %d), leaving on stack - %s\n",
+			me->skip_stack, me->sp->style->name);
+	    me->skip_stack--;
+	    return;
+	}
 	if (me->sp == me->stack) {
-            fprintf(stderr, 
-		"HTML: ****** Maximum nesting of %d tags exceeded!\n",
-            	MAX_NESTING);
+	    if (me->stack_overrun == FALSE) {
+		if (TRACE) {
+		    fprintf(stderr, 
+			"HTML: ****** Maximum nesting of %d tags exceeded!\n",
+			MAX_NESTING);
+	    
+		} else {
+		    HTAlert(HTML_STACK_OVERRUN);
+		}
+		me->stack_overrun = TRUE;
+	    }
             return;
         }
 
@@ -4291,6 +4743,49 @@ PRIVATE void HTML_start_element ARGS5(
 	    fprintf(stderr,"HTML:begin_element: adding style to stack - %s\n",
 							me->new_style->name);
     }	
+
+#if defined(USE_COLOR_STYLE)
+/* end empty tags straight away */
+        if (HTML_dtd.tags[element_number].contents == SGML_EMPTY)
+        {
+                if (TRACE)
+                        fprintf(stderr, "STYLE:begin_element:ending EMPTY element style\n");
+#if !defined(USEHASH)
+        HText_characterStyle(me->text, element_number+STARTAT, STACK_OFF);
+#else
+        HText_characterStyle(me->text, hcode, STACK_OFF);
+#endif /* USEHASH */
+                {
+                        char *end, *start=NULL, *lookfrom;
+                        char tmp[64];
+                        sprintf(tmp, ";%s", HTML_dtd.tags[element_number].name);
+                        strtolower(tmp);
+
+                        lookfrom = Style_className;
+                        do
+                        {
+                                end = start;
+                                start = strstr(lookfrom, tmp);
+                                lookfrom = start + 1;
+                        }
+                        while (start);
+                        if (end)
+                                *end='\0';
+
+#if defined(PREVAIL)
+                        start=strrchr(Style_className, '.');
+                        if (start)
+                                strcpy(prevailing_class, (char*)(start+1));
+                        else
+                                strcpy(prevailing_class, "");
+#endif
+
+
+                        if (TRACE)
+                        fprintf(stderr, "CSS:%s (trimmed %s, SGML_EMPTY)\n", Style_className, tmp);
+		}
+	}
+#endif /* USE_COLOR_STYLE */
 }
 
 /*		End Element
@@ -4317,7 +4812,7 @@ PRIVATE void HTML_end_element ARGS3(
 
 #ifdef CAREFUL			/* parser assumed to produce good nesting */
     if (element_number != me->sp[0].tag_number &&
-	HTML_dtd.tags[element_number].contents != SGML_EMPTY) {
+        HTML_dtd.tags[element_number].contents != SGML_EMPTY) {
         fprintf(stderr, 
 		"HTMLText: end of element %s when expecting end of %s\n",
 		HTML_dtd.tags[element_number].name,
@@ -4337,10 +4832,31 @@ PRIVATE void HTML_end_element ARGS3(
     }
 
     /*
-     *  Pop state off stack if it's not a FORM end tag. - FM
+     *  Pop state off stack if we didn't declare the element
+     *  SGML_EMPTY in HTMLDTD.c. - FM & KW
      */
     if (HTML_dtd.tags[element_number].contents != SGML_EMPTY) {
-        if (me->sp < me->stack + MAX_NESTING+1) {
+	if (me->skip_stack > 0) {
+	    if (TRACE)
+		fprintf(stderr,
+	    "HTML:end_element: Internal call (level %d), leaving on stack - %s\n",
+			me->skip_stack, me->sp->style->name);
+	    me->skip_stack--;
+	} else if (me->stack_overrun == TRUE &&
+	    element_number != me->sp[0].tag_number) {
+	    /*
+	     *  Ignore non-corresponding tags if we had
+	     *  a stack overrun.  This is not a completely
+	     *  fail-safe strategy for protection against
+	     *  any seriously adverse consequences of a
+	     *  stack overrun, and the rendering of the
+	     *  document will not be as intended, but we
+	     *  expect overruns to be rare, and this should
+	     *  offer reasonable protection against crashes
+	     *  if an overrun does occur. - FM
+	     */
+	    return;
+	} else if (me->sp < (me->stack + MAX_NESTING - 1)) {
 	    (me->sp)++;
 	    if (TRACE)
 		fprintf(stderr,
@@ -4371,24 +4887,27 @@ PRIVATE void HTML_end_element ARGS3(
     switch(element_number) {
 
     case HTML_HTML:
-	if (me->inUnderline) {
-	    if (!me->text)
-	        UPDATE_STYLE;
+        if (!me->text)
+	    UPDATE_STYLE;
+	if (me->inUnderline) {	/* This block could go away(?) - kw */
 	    HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
 	    me->inUnderline = FALSE;
 	}
-	if (me->inA || me->inFORM || me->inSELECT || me->inTEXTAREA)
-	    if (TRACE)
+	if (me->inA || me->inSELECT || me->inTEXTAREA)
+	    if (TRACE) {
 	        fprintf(stderr,
 			"HTML: Something not closed before HTML close-tag\n");
-	    else if (!me->inBadHTML) {
+	    } else if (!me->inBadHTML) {
 	        _statusline(BAD_HTML_USE_TRACE);
+		me->inBadHTML = TRUE;
+		sleep(MessageSecs);
 	    }
 	break;
 
     case HTML_HEAD:
-	UPDATE_STYLE;
-	if (me->inUnderline) {
+        if (!me->text)
+	    UPDATE_STYLE;
+	if (me->inUnderline) {	/* This block could go away(?) - kw */
 	    HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
 	    me->inUnderline = FALSE;
 	}
@@ -4396,17 +4915,12 @@ PRIVATE void HTML_end_element ARGS3(
 	    HText_appendParagraph(me->text);
 	break;
 
-#ifdef NOT_DEFINED /* BASE will be a container in HTML+ */
-    case HTML_BASE:
-	FREE(me->base_href);
-        me->inBASE = FALSE;
-	break;
-#endif /* NOT_DEFINED */
-
     case HTML_TITLE:
         HTChunkTerminate(&me->title);
     	HTAnchor_setTitle(me->node_anchor, me->title.data);
         HTChunkClear(&me->title);
+        if (!me->text)
+	    UPDATE_STYLE;
 	/*
 	 *  Check if it's a bookmark file, and if so, and multiple
 	 *  bookmark support is on, or it's off but this isn't the
@@ -4481,18 +4995,20 @@ PRIVATE void HTML_end_element ARGS3(
 	break;
 
     case HTML_BODY:
-	if (me->inUnderline) {
-	    if (!me->text)
-	        UPDATE_STYLE;
+	if (!me->text)
+	    UPDATE_STYLE;
+	if (me->inUnderline) {	/* This block could go away(?) - kw */
 	    HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
 	    me->inUnderline = FALSE;
 	}
-	if (me->inA || me->inFORM || me->inSELECT || me->inTEXTAREA)
-	    if (TRACE)
+	if (me->inA || me->inSELECT || me->inTEXTAREA)
+	    if (TRACE) {
 	        fprintf(stderr,
 			"HTML: Something not closed before BODY close-tag\n");
-	    else if (!me->inBadHTML) {
+	    } else if (!me->inBadHTML) {
 	        _statusline(BAD_HTML_USE_TRACE);
+		me->inBadHTML = TRUE;
+		sleep(MessageSecs);
 	    }
 	break;
 
@@ -4575,10 +5091,83 @@ PRIVATE void HTML_end_element ARGS3(
 	}
 	break;
 
-#ifdef NOTDEFINED
+
     case HTML_P:
+	UPDATE_STYLE;
+	    /*
+	     *  In general, treat </P> as an instruction to
+	     *  end the current line if it has been started,
+	     *  and ensure spacing as required by the current
+	     *  paragraph style's spaceAfter.  Don't insert
+	     *  spacing required for starting the next paragraph
+	     *  as required by its style->spaceBefore, since we
+	     *  don't know yet whether the next structure element
+	     *  (if any) will be.  If it is a another P, it will
+	     *  take care of its leading space on its own.  - kw
+	     */
+	if (me->List_Nesting_Level >= 0) {
+	    /*
+	     *  We're in a list.  Treat </P> as an instruction to
+	     *  end the current line if it has been started,
+	     *  and set "second line" margins.
+	     */
+	    if (me->inP) {
+	        if (me->inFIG || me->inAPPLET ||
+		    me->inCAPTION || me->inCREDIT ||
+		    me->sp->style->spaceAfter > 0) {
+	            LYEnsureDoubleSpace(me);
+		} else {
+	            LYEnsureSingleSpace(me);
+		}
+	    }
+	} else if (me->sp[0].tag_number == HTML_ADDRESS) {
+	    /*
+	     *  We're in an ADDRESS. Treat </P> as an instruction 
+	     *  to start a newline, if needed. - kw
+	     */
+	    if (HText_LastLineSize(me->text)) {
+	        HText_appendCharacter(me->text, '\r');
+	    }
+	} else {
+	    if (me->sp->style->spaceAfter > 0) {
+		LYEnsureDoubleSpace(me);
+	    } else {
+		LYEnsureSingleSpace(me);
+	    }
+	    me->inLABEL = FALSE;
+	}
+	me->in_word = NO;
+
+	/*
+	 *  If the P ending here had an ALIGN attribute, we have to
+	 *  revert to whatever is in effect for outer elements or
+	 *  the default. - kw
+	 */
+	if (LYoverride_default_alignment(me)) {
+	    me->sp->style->alignment = styles[me->sp[0].tag_number]->alignment;
+	} else if (me->List_Nesting_Level >= 0 ||
+		   ((me->Division_Level < 0) &&
+		    (!strcmp(me->sp->style->name, "Normal") ||
+		     !strcmp(me->sp->style->name, "Preformatted")))) {
+	        me->sp->style->alignment = HT_LEFT;
+	} else {
+	    me->sp->style->alignment = me->current_default_alignment;
+	}
+
+	/*
+	 *  Mark that we have to start a new paragraph
+	 *  and don't have any of its text yet. - kw
+	 *
+	 */
+	me->inP = FALSE;
+
         break;
-#endif /* NOTDEFINED */
+
+    case HTML_FONT:
+	if (!me->text)
+	    UPDATE_STYLE;
+	me->inFONT = FALSE;
+	break;
 
     case HTML_B:			/* Physical character highlighting */
     case HTML_BLINK:
@@ -4590,9 +5179,19 @@ PRIVATE void HTML_end_element ARGS3(
     case HTML_STRONG:
 	if (!me->text)
 	    UPDATE_STYLE;
-	if (me->Underline_Level > 0)
-	    me->Underline_Level--;
-	if (me->inUnderline == TRUE && me->Underline_Level < 1) {
+        /*
+	 *  Ignore any emphasis end tags if the
+	 *  Underline_Level is not set. - FM
+	 */
+	if (me->Underline_Level <= 0)
+	    break;
+
+	/*
+	 *  Adjust the Underline level counter, and
+	 *  turn off underlining if appropriate. - FM
+	 */
+	me->Underline_Level--;
+	if (me->inUnderline && me->Underline_Level < 1) {
 	    HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
 	    me->inUnderline = FALSE;
 	    if (TRACE)
@@ -4617,6 +5216,8 @@ PRIVATE void HTML_end_element ARGS3(
     case HTML_SUP:
     case HTML_TT:
     case HTML_VAR:
+	if (!me->text)
+	    UPDATE_STYLE;
 	break;
 
     case HTML_DEL:
@@ -4648,6 +5249,8 @@ PRIVATE void HTML_end_element ARGS3(
 	break;
 
     case HTML_Q:
+	if (!me->text)
+	    UPDATE_STYLE;
         if (me->Quote_Level > 0)
 	    me->Quote_Level--;
         /*
@@ -4664,6 +5267,7 @@ PRIVATE void HTML_end_element ARGS3(
         break;
 
     case HTML_PRE:				/* Formatted text */
+	me->inPRE = FALSE;
     case HTML_LISTING:				/* Litteral text */
     case HTML_XMP:
     case HTML_PLAINTEXT:
@@ -4672,6 +5276,10 @@ PRIVATE void HTML_end_element ARGS3(
     	if (me->comment_start)
     	    HText_appendText(me->text, me->comment_start);
 	change_paragraph_style(me, me->sp->style);  /* Often won't really change */
+	if (me->List_Nesting_Level >= 0) {
+	    UPDATE_STYLE;
+	    HText_NegateLineOne(me->text);
+	}
 	break;
 
     case HTML_NOTE:
@@ -4716,9 +5324,16 @@ PRIVATE void HTML_end_element ARGS3(
 	 *  attributes, and the me->node_anchor->charset and/or
 	 *  yet to be added structure elements. - FM
 	 */
+	if (!me->text)
+	    UPDATE_STYLE;
         break;
 
     case HTML_A:
+        /*
+	 *  Ignore any spurious A end tags. - FM
+	 */
+        if (me->inA == FALSE)
+	    break;
 	/*
 	 *  Set to know that we are no longer in an anchor.
 	 */
@@ -5108,9 +5723,9 @@ End_Object:
     case HTML_FORM:
 	/*
 	 *  Check if we had a FORM start tag, and issue a
-	 *  message if not, but fall through to ensure that
-	 *  the FORM-related globals in GridText.c are
-	 *  initialized. - FM
+	 *  message if not, but fall through to check for
+	 *  an open SELECT and ensure that the FORM-related
+	 *  globals in GridText.c are initialized. - FM
 	 */
 	if (!me->inFORM) {
 	    if (TRACE) {
@@ -5123,13 +5738,46 @@ End_Object:
 	}
 
 	/*
+	 *  Check if we still have a SELECT element open.
+	 *  FORM may have been declared SGML_EMPTY in HTMLDTD.c,
+	 *  and in that case SGML_character() in SGML.c is
+	 *  not able to ensure correct nesting; or it may have
+	 *  failed to enforce valid nesting.  If a SELECT is open,
+	 *  issue a message, then 
+	 *  call HTML_end_element() directly (with a
+	 *  check in that to bypass decrementing of the HTML
+	 *  parser's stack) to close the SELECT. - kw
+	 */
+	if (me->inSELECT) {
+	    if (TRACE) {
+		fprintf(stderr,
+		   "HTML: Open SELECT at FORM end. Faking SELECT end tag.\n");
+	    } else if (!me->inBadHTML) {
+		_statusline(BAD_HTML_USE_TRACE);
+		me->inBadHTML = TRUE;
+		sleep(MessageSecs);
+	    }
+	    SET_SKIP_STACK(HTML_SELECT);
+	    HTML_end_element(me, HTML_SELECT, (char **)&include);
+	}
+
+	/*
 	 *  Set to know that we are no longer in an form.
 	 */
 	me->inFORM = FALSE;
 
-	UPDATE_STYLE;
+	if (!me->text)
+	    UPDATE_STYLE;
 	HText_endForm(me->text);
-	HText_appendCharacter(me->text, '\r'); 
+	/*
+	 *  If we are in a list and are on the first line
+	 *  with no text following a bullet or number,
+	 *  don't force a newline.  This could happen if
+	 *  we were called from HTML_start_element() due
+	 *  to a missing FORM end tag. - FM
+	 */
+	if (!(me->List_Nesting_Level >= 0 && !me->inP))
+	    LYEnsureSingleSpace(me);
 	break;
 
     case HTML_FIELDSET:
@@ -5266,6 +5914,26 @@ End_Object:
 	    me->select_disabled = FALSE;
 
 	    /*
+	     *  Make sure we're in a form.
+	     */
+	    if (!me->inFORM) {
+	        if (TRACE) {
+		    fprintf(stderr,
+			    "HTML: SELECT end tag not within FORM tag\n");
+		} else if (!me->inBadHTML) {
+		    _statusline(BAD_HTML_USE_TRACE);
+		    me->inBadHTML = TRUE;
+		    sleep(MessageSecs);
+		}
+
+	        /*
+		 *  Too likely to cause a crash, so we'll ignore it. - kw
+		 */
+		HTChunkClear(&me->option);
+		break;
+	    }
+
+	    /*
 	     *  Finish the data off.
 	     */
        	    HTChunkTerminate(&me->option);
@@ -5291,13 +5959,15 @@ End_Object:
 		 *  but use non-breaking spaces for output.
 		 */
 	        if (ptr &&
-		    me->sp[0].tag_number == HTML_PRE && strlen(ptr) > 20) {
+		    (me->sp[0].tag_number == HTML_PRE || me->inPRE == TRUE ||
+		     !me->sp->style->freeFormat) &&
+		    strlen(ptr) > 6) {
 	            /*
 		     *  The code inadequately handles OPTION fields in PRE tags.
-		     *  We'll put up a minimum of 20 characters, and if any
+		     *  We'll put up a minimum of 6 characters, and if any
 		     *  more would exceed the wrap column, we'll ignore them.
 		     */
-		    for (i = 0; i < 20; i++) {
+		    for (i = 0; i < 6; i++) {
 		        if (*ptr == ' ')
 	    	            HText_appendCharacter(me->text,HT_NON_BREAK_SPACE); 
 		        else
@@ -5338,7 +6008,7 @@ End_Object:
         me->inTABLE = FALSE;
         break;
 
-#ifdef NOTDEFINED /* These are SGML_EMPTY for now. - FM */
+/* These TABLE related elements may now not be SGML_EMPTY. - kw */
     case HTML_TR:
         break;
 
@@ -5355,7 +6025,14 @@ End_Object:
 
     case HTML_TD:
         break;
-#endif /* NOTDEFINED */
+
+/* More stuff that may now not be SGML_EMPTY any more: */
+    case HTML_DT:
+    case HTML_DD:
+    case HTML_LH:
+    case HTML_LI:
+    case HTML_OVERLAY:
+	break;
 
     case HTML_MATH:
 	if (!me->text)
@@ -5388,6 +6065,48 @@ End_Object:
 	break;
 	
     } /* switch */
+#ifdef USE_COLOR_STYLE
+    {
+        char *end, *start=NULL, *lookfrom;
+        char tmp[64];
+        sprintf(tmp, ";%s", HTML_dtd.tags[element_number].name);
+        strtolower(tmp);
+
+        lookfrom = Style_className;
+        do
+        {
+            end = start;
+            start = strstr(lookfrom, tmp);
+            lookfrom = start + 1;
+        }
+        while (start);
+/* trim the last matching element off the end
+** - should match classes here as well (rp)
+*/
+        if (end)
+            *end='\0';
+        if (TRACE)
+            fprintf(stderr, "CSS:%s (trimmed %s, END_ELEMENT)\n", Style_className, tmp);
+    }
+
+    if (HTML_dtd.tags[element_number].contents != SGML_EMPTY)
+    {
+        if (TRACE)
+            fprintf(stderr, "STYLE:end_element: ending non-EMPTY style\n");
+#if !defined(USEHASH)
+        HText_characterStyle(me->text, element_number+STARTAT, STACK_OFF);
+#else
+        HText_characterStyle(me->text, hcode, STACK_OFF);
+#endif /* USEHASH */
+#if defined(PREVAIL)
+        /* reset the prevailing class to the previous one */
+        {
+                char *dot=strrchr(Style_className,'.');
+                strcpy (prevailing_class, dot ? (char*)(dot+1) : "");
+        }
+#endif
+    }
+#endif /* USE_COLOR_STYLE */
 }
 
 /*		Expanding entities
@@ -5440,28 +6159,54 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
 {
     char *include = NULL;
 
+    if (LYMapsOnly && !me->text) {
+        /*
+	 *  We only handled MAP, AREA and BASE tags, and didn't
+	 *  create an HText structure for the document nor want
+	 *  one now, so just make sure we free anything that might
+	 *  have been allocated. - FM
+	 */
+	FREE(me->base_href);
+	FREE(me->map_address);
+	FREE(me);
+	return;
+    }
+
     UPDATE_STYLE;		/* Creates empty document here! */
     if (me->comment_end)
 	HTML_put_string(me, me->comment_end);
     if (me->text) {
-        /*
-	 *  Emphasis containers should have been closed via
-	 *  the SGML_free() wind-down, but let's play it
-	 *  safe. - FM
+	/*
+	 *  Emphasis containters, A, FONT, and FORM may be declared
+	 *  SGML_EMPTY in HTMLDTD.c, and SGML_character() in SGML.c
+	 *  may check for their end tags to call HTML_end_element()
+	 *  directly (with a check in that to bypass decrementing
+	 *  of the HTML parser's stack).  So if we still have the
+	 *  emphasis (Underline) on, or any open A, FONT, or FORM
+	 *  containers, turn it off or close them now. - FM & kw
+	 *
+	 *  IF those tags are not declared SGML_EMPTY, but we let
+	 *  the SGML.c parser take care of correctly stacked ordering,
+	 *  and of correct wind-down on end-of-stream (in SGML_free 
+	 *  SGML_abort),
+	 *  THEN these and other checks here in HTML.c should not be
+	 *  necessary.  Still it can't hurt to include them. - kw
 	 */
 	if (me->inUnderline) {
 	    HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
 	    me->inUnderline = FALSE;
+	    me->Underline_Level = 0;
+	    if (TRACE)
+	        fprintf(stderr,"HTML_free: Ending underline\n");
+	}
+	if (me->inA) {
+	    HTML_end_element(me, HTML_A, (char **)&include);
+	    me->inA = FALSE;
+	}
+	if (me->inFONT) {
+	    HTML_end_element(me, HTML_FONT, (char **)&include);
+	    me->inFONT = FALSE;
 	}
-
-	/*
-	 *  FORM was declared SGML_EMPTY in HTMLDTD.c, and
-	 *  SGML_character() in SGML.c checks for a FORM end
-	 *  tag to call HTML_end_element() directly (with a
-	 *  check in that to bypass decrementing of the HTML
-	 *  parser's stack), so if we still have an open FORM,
-	 *  close it now. - FM
-	 */
 	if (me->inFORM) {
 	    HTML_end_element(me, HTML_FORM, (char **)&include);
 	    me->inFORM = FALSE;
@@ -5501,16 +6246,22 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e)
 
     if (me->text) {
         /*
-	 *  If we have an open emphasis container, close it now. - FM
+	 *  If we have emphasis on, or open A, FONT, or FORM
+	 *  containers, turn it off or close them now. - FM
 	 */
 	if (me->inUnderline) {
 	    HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
 	    me->inUnderline = FALSE;
+	    me->Underline_Level = 0;
+	}
+	if (me->inA) {
+	    HTML_end_element(me, HTML_A, (char **)&include);
+	    me->inA = FALSE;
+	}
+	if (me->inFONT) {
+	    HTML_end_element(me, HTML_FONT, (char **)&include);
+	    me->inFONT = FALSE;
 	}
-
-        /*
-	 *  If we have an open FORM container, close it now. - FM
-	 */
 	if (me->inFORM) {
 	    HTML_end_element(me, HTML_FORM, (char **)&include);
 	    me->inFORM = FALSE;
@@ -5714,6 +6465,7 @@ PUBLIC HTStructured* HTML_new ARGS3(
     me->option.growby = 128;
     me->option.allocated = 0;
     me->option.data = NULL;
+    me->first_option = TRUE;
     me->LastOptionValue = NULL;
     me->LastOptionChecked = FALSE;
     me->select_disabled = FALSE;
@@ -5748,10 +6500,12 @@ PUBLIC HTStructured* HTML_new ARGS3(
     me->new_style = default_style;
     me->old_style = 0;
     me->current_default_alignment = HT_LEFT;
-    me->sp = me->stack + MAX_NESTING - 1;
+    me->sp = (me->stack + MAX_NESTING - 1);
+    me->skip_stack = 0;
     me->sp->tag_number = -1;				/* INVALID */
     me->sp->style = default_style;			/* INVALID */
     me->sp->style->alignment = HT_LEFT;
+    me->stack_overrun = FALSE;
 
     me->Division_Level = -1;
     me->Underline_Level = 0;
@@ -5773,6 +6527,7 @@ PUBLIC HTStructured* HTML_new ARGS3(
     me->inAPPLET = FALSE;
     me->inAPPLETwithP = FALSE;
     me->inBadBASE = FALSE;
+    me->inBadHREF = FALSE;
     me->inBadHTML = FALSE;
     me->inBASE = FALSE;
     me->inBoldA = FALSE;
@@ -5781,6 +6536,7 @@ PUBLIC HTStructured* HTML_new ARGS3(
     me->inCREDIT = FALSE;
     me->inFIG = FALSE;
     me->inFIGwithP = FALSE;
+    me->inFONT = FALSE;
     me->inFORM = FALSE;
     me->inLABEL = FALSE;
     me->inP = FALSE;
diff --git a/src/HTML.h b/src/HTML.h
index ed3aefee..3593ba8a 100644
--- a/src/HTML.h
+++ b/src/HTML.h
@@ -69,6 +69,7 @@ struct _HTStructured {
     char *			object_codetype;
     char *			object_name;
     HTChunk			option;		/* Grow by 128 */
+    BOOL			first_option;	/* First OPTION in SELECT? */
     char *			LastOptionValue;
     BOOL			LastOptionChecked;
     BOOL			select_disabled;
@@ -111,6 +112,8 @@ struct _HTStructured {
     BOOL			in_word;  /* Have just had a non-white char */
     stack_element 	stack[MAX_NESTING];
     stack_element 	*sp;		/* Style stack pointer */
+    BOOL		stack_overrun;	/* Was MAX_NESTING exceeded? */
+    int			skip_stack; /* flag to skip next style stack operation */
 
     /*
     **  Track if we are in an anchor, paragraph, address, base, etc.
@@ -119,6 +122,7 @@ struct _HTStructured {
     BOOL		inAPPLET;
     BOOL		inAPPLETwithP;
     BOOL		inBadBASE;
+    BOOL		inBadHREF;
     BOOL		inBadHTML;
     BOOL		inBASE;
     BOOL		inBoldA;
@@ -127,6 +131,7 @@ struct _HTStructured {
     BOOL		inCREDIT;
     BOOL		inFIG;
     BOOL		inFIGwithP;
+    BOOL		inFONT;
     BOOL		inFORM;
     BOOL		inLABEL;
     BOOL		inP;
@@ -159,6 +164,8 @@ extern void HTML_write PARAMS((HTStructured *me, CONST char *s, int l));
 extern int HTML_put_entity PARAMS((HTStructured *me, int entity_number));
 #endif /* Lynx_HTML_Handler */
 
+extern void strtolower PARAMS((char* i));
+
 /*				P U B L I C
 */
 
diff --git a/src/LYBookmark.c b/src/LYBookmark.c
index 79e61df9..caf859a1 100644
--- a/src/LYBookmark.c
+++ b/src/LYBookmark.c
@@ -345,16 +345,19 @@ PUBLIC void save_bookmark_link ARGS2(
      *  If we created a new bookmark file, write the headers. - FM
      */
     if (first_time) {
-	fprintf(fp,"<head>\n<title>%s</title>\n</head>\n",BOOKMARK_TITLE);
+	fprintf(fp,"<head>\n");
+#ifdef EXP_CHARTRANS
+	add_META_charset_to_fd(fp, -1);
+#endif
+	fprintf(fp,"<title>%s</title>\n</head>\n",BOOKMARK_TITLE);
 	fprintf(fp,"\
-     You can delete links using the remove bookmark command.  It\n\
-     is usually the 'R' key but may have been remapped by you or\n\
-     your system administrator.<br>\n\
-     This file may also be edited with a standard text editor.\n\
-     Outdated or invalid links may be removed by simply deleting\n\
-     the line the link appears on in this file.\n\
-     Please refer to the Lynx documentation or help files\n\
-     for the HTML link syntax.\n\n<p>\n<ol>\n");
+     You can delete links using the remove bookmark command.  It is usually\n\
+     the 'R' key but may have been remapped by you or your system\n\
+     administrator.<br>\n\
+     This file also may be edited with a standard text editor to delete\n\
+     outdated or invalid links, or to change their order, but you should\n\
+     not change the format within the lines or add other HTML markup.\n\n\
+     <p>\n<ol>\n");
     }
 
     /*
@@ -755,8 +758,7 @@ draw_bookmark_choices:
      */
     clear();
     move(1, 5);
-    if (bold_H1 || bold_headers)
-	start_bold();
+    lynx_start_h1_color ();
     if (MBM_screens > 1) {
         sprintf(shead_buffer,
 		MULTIBOOKMARKS_SHEAD_MASK, MBM_current, MBM_screens);
@@ -764,8 +766,8 @@ draw_bookmark_choices:
     } else {
         addstr(MULTIBOOKMARKS_SHEAD);
     }
-    if (bold_H1 || bold_headers)
-	stop_bold();
+   
+   lynx_stop_h1_color ();
 
     MBM_tmp_count = 0;
     for (c = MBM_from; c <= MBM_to; c++) {
diff --git a/src/LYCgi.c b/src/LYCgi.c
index fce4596a..531c237e 100644
--- a/src/LYCgi.c
+++ b/src/LYCgi.c
@@ -309,6 +309,13 @@ PRIVATE int LYLoadCGI ARGS4(
 		buf[(sizeof(buf) - 1)] = '\0';
 		add_environment_value(buf);
 
+		if (pref_charset) {
+		    sprintf(buf, "HTTP_ACCEPT_CHARSET=%.*s",
+			    (sizeof(buf) - 21), pref_charset);
+		    buf[(sizeof(buf) - 1)] = '\0';
+		    add_environment_value(buf);
+		}
+
 		if (anAnchor->post_data) { /* post script, read stdin */
 		    close(fd1[1]);
 		    dup2(fd1[0], fileno(stdin));
diff --git a/src/LYCharSets.c b/src/LYCharSets.c
index 6f3b7123..016d24c4 100644
--- a/src/LYCharSets.c
+++ b/src/LYCharSets.c
@@ -2176,6 +2176,34 @@ PUBLIC int current_char_set = 0;		/* Index for tranaslation */
  */
 PUBLIC void HTMLSetCharacterHandling ARGS1(int,i)
 {
+#ifdef EXP_CHARTRANS
+    if (LYCharSet_UC[i].enc != UCT_ENC_CJK) {
+	int chndl = 0;
+	if (UCAssume_MIMEcharset)
+	    chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset);
+	HTCJK = NOCJK;
+	kanji_code = NOKANJI;
+	if (i == (chndl < 0 ? 0 : chndl))
+	    LYRawMode = LYUseDefaultRawMode ? TRUE : FALSE;
+	else
+	    LYRawMode = LYUseDefaultRawMode ? FALSE : TRUE;
+	if (LYRawMode)
+	    HTPassEightBitRaw = (LYlowest_eightbit[i] <= 160);
+	else
+	    HTPassEightBitRaw = FALSE;
+
+	HTPassEightBitNum =
+	    ((LYCharSet_UC[i].codepoints & UCT_CP_SUPERSETOF_LAT1) ||
+		(LYCharSet_UC[i].like8859 & UCT_R_HIGH8BIT));
+	
+	if (LYRawMode || i == chndl)
+	    HTPassHighCtrlRaw = (LYlowest_eightbit[i] <= 130);
+	else
+	    HTPassHighCtrlRaw = FALSE;
+
+	HTPassHighCtrlNum = FALSE;
+    } else
+#endif
     if (!strncmp(LYchar_set_names[i], "ISO Latin 1", 11)) {
 	HTCJK = NOCJK;
 	kanji_code = NOKANJI;
@@ -2258,7 +2286,7 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i)
 		int chndl = 0;
 		if (UCAssume_MIMEcharset)
 		    chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset);
-		if (chndl != i || chndl != UCLYhndl_for_unspec)
+		if (chndl != i)
 		    UCLYhndl_for_unspec = chndl < 0 ? 0 : chndl;
 		else
 		    UCLYhndl_for_unspec = 0;
@@ -2303,6 +2331,17 @@ PUBLIC void HTMLSetRawModeDefault ARGS1(int,i)
  */
 PUBLIC void HTMLSetUseDefaultRawMode ARGS2(int,i, BOOLEAN,modeflag)
 {
+#ifdef EXP_CHARTRANS
+    if (LYCharSet_UC[i].enc != UCT_ENC_CJK) {
+	int chndl = 0;
+	if (UCAssume_MIMEcharset)
+	    chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset);
+	if (i == chndl)
+	    LYUseDefaultRawMode = modeflag;
+	else
+	    LYUseDefaultRawMode = (!modeflag);
+    } else
+#endif /* EXP_CHARTRANS */
     if (!strncmp(LYchar_set_names[i], "ISO Latin 1", 11) ||
     	!strncmp(LYchar_set_names[i], "Chinese", 7) ||
 	!strncmp(LYchar_set_names[i], "Japanese (EUC)", 14) ||
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index 6a3a3858..cf1ecfb8 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -35,9 +35,9 @@
 #include "LYUtils.h"
 #include "LYMap.h"
 #include "LYBookmark.h"
+#include "LYCurses.h"
 
 #ifdef VMS
-#include "LYCurses.h"
 #include "HTVMSUtils.h"
 #endif /* VMS */
 #ifdef DOSPATH
@@ -208,16 +208,6 @@ PUBLIC char * LYUnEscapeEntities ARGS3(
 		       isdigit((unsigned char)*p))
 		    p++;
 		/*
-		**  Make sure we had a valid terminator. - FM
-		*/
-		if ((unsigned char)*p >= 127 ||
-		    isalnum((unsigned char)*p)) {
-		    *q++ = '&';
-		    *q++ = '#';
-		    p = cp;
-		    continue;
-		}
-		/*
 		**  Save the terminator and isolate the digit(s). - FM
 		*/
 		cpe = *p;
@@ -681,10 +671,10 @@ PUBLIC void LYUnEscapeToLatinOne ARGS2(
 	    */
 	    if (*p == '#' && len > 2 &&
 	        (unsigned char)*(p+1) < 127 &&
-		isalnum((unsigned char)*(p+1))) {
+		isdigit((unsigned char)*(p+1))) {
 		cp = ++p;
 		while (*p && (unsigned char)*p < 127 &&
-		       isalnum((unsigned char)*p))
+		       isdigit((unsigned char)*p))
 		    p++;
 		cpe = *p;
 		if (*p)
@@ -1000,6 +990,7 @@ PUBLIC void LYEntify ARGS2(
 	}
     }
     StrAllocCopy(*str, cp);
+    FREE(cp);
 }
 
 /*
@@ -1609,6 +1600,53 @@ PUBLIC void html_get_chartrans_info ARGS1(HTStructured *, me)
     }
     me->UCI = HTAnchor_getUCInfoStage(me->node_anchor,UCT_STAGE_STRUCTURED);
 }
+
+/*
+**  This function writes a line with a META tag to an open file,
+**  which will specify a charset parameter to use when the file is
+**  read back in.  It is meant for temporary HTML files used by the
+**  various special pages which may show titles of documents.  When those
+**  files are created, the title strings normally have been translated and
+**  expanded to the display character set, so we have to make sure the
+**  don't get translated again.
+**  If the user has changed the display character set during the lifetime
+**  of the Lynx session (or, more exactly, during the time the title
+**  strings to be written were generated), the may now have different
+**  character encodings and there is currently no way to get it all right.
+**  To change this, we would have to add a variable for each string which
+**  keeps track of its character encoding...
+**  But at least we can try to ensure that reading the file after future
+**  display character set changes will give reasonable output.
+**
+**  The META tag is not written if the display character set (passed as
+**  disp_chndl) already corresponds to the charset assumption that
+**  would be made when the file is read. -kw
+*/
+PUBLIC void add_META_charset_to_fd ARGS2(
+    FILE *,	fp,
+    int,	disp_chndl
+    )
+{
+    if (disp_chndl == -1)	/* -1 means use current_char_set */
+	disp_chndl = current_char_set;
+    if (fp == NULL || disp_chndl < 0)
+	return;			/* should not happen */
+    if (UCLYhndl_HTFile_for_unspec == disp_chndl)
+	return;			/* not need to do, so we don't */
+    if (LYCharSet_UC[disp_chndl].enc == UCT_ENC_7BIT)
+	return;			/* There shouldn't be any 8-bit characters
+				 in this case. */
+    /*
+     * In other cases we don't know because UCLYhndl_for_unspec may
+     * change during the lifetime of the file (by toggling raw mode
+     * or changing the display character set), so proceed.
+     */
+
+    fprintf(fp,"<META %s content=\"text/html;charset=%s\">\n",
+	    "http-equiv=\"content-type\"",
+	    LYCharSet_UC[disp_chndl].MIMEname);
+}
+
 #endif /* EXP_CHARTRANS */
 
 /*
@@ -1622,7 +1660,7 @@ PUBLIC void LYHandleMETA ARGS4(
 {
     char *http_equiv = NULL, *name = NULL, *content = NULL;
     char *href = NULL, *id_string = NULL, *temp = NULL;
-    char *cp, *cp0, *cp1 = 0;
+    char *cp, *cp0, *cp1 = NULL;
     int url_type = 0, i;
 
     if (!me || !present)
@@ -1692,8 +1730,8 @@ PUBLIC void LYHandleMETA ARGS4(
      * Check for a no-cache Pragma
      * or Cache-Control directive. - FM
      */
-    if (!strcasecomp((http_equiv ? http_equiv : name), "Pragma") ||
-        !strcasecomp((http_equiv ? http_equiv : name), "Cache-Control")) {
+    if (!strcasecomp((http_equiv ? http_equiv : ""), "Pragma") ||
+        !strcasecomp((http_equiv ? http_equiv : ""), "Cache-Control")) {
 	LYUnEscapeToLatinOne(&content, FALSE);
 	LYTrimHead(content);
 	LYTrimTail(content);
@@ -1710,7 +1748,7 @@ PUBLIC void LYHandleMETA ARGS4(
 	 *  should. - FM
 	 */
 	if ((!me->node_anchor->cache_control) &&
-	    !strcasecomp((http_equiv ? http_equiv : name), "Cache-Control")) {
+	    !strcasecomp((http_equiv ? http_equiv : ""), "Cache-Control")) {
 	    for (i = 0; content[i]; i++)
 		 content[i] = TOLOWER(content[i]);
 	    StrAllocCopy(me->node_anchor->cache_control, content);
@@ -1757,9 +1795,9 @@ PUBLIC void LYHandleMETA ARGS4(
     /*
      * Check for an Expires directive. - FM
      */
-    } else if (!strcasecomp((http_equiv ? http_equiv : name), "Expires")) {
+    } else if (!strcasecomp((http_equiv ? http_equiv : ""), "Expires")) {
 	/*
-	 *  If we didn't get a Expires MIME header,
+	 *  If we didn't get an Expires MIME header,
 	 *  store it in the anchor element, and if we
 	 *  haven't yet set no_cache, check whether we
 	 *  should. - FM
@@ -1782,7 +1820,7 @@ PUBLIC void LYHandleMETA ARGS4(
      *  the charset via a server's header. - AAC & FM
      */
     } else if (!(me->node_anchor->charset && *me->node_anchor->charset) && 
-	       !strcasecomp((http_equiv ? http_equiv : name), "Content-Type")) {
+	       !strcasecomp((http_equiv ? http_equiv : ""), "Content-Type")) {
 	LYUnEscapeToLatinOne(&content, FALSE);
 	LYTrimHead(content);
 	LYTrimTail(content);
@@ -1958,7 +1996,7 @@ PUBLIC void LYHandleMETA ARGS4(
     /*
      *  Check for a Refresh directive. - FM
      */
-    } else if (!strcasecomp((http_equiv ? http_equiv : name), "Refresh")) {
+    } else if (!strcasecomp((http_equiv ? http_equiv : ""), "Refresh")) {
 	char *Seconds = NULL;
 
 	/*
@@ -1971,9 +2009,9 @@ PUBLIC void LYHandleMETA ARGS4(
 	    cp1 = cp;
 	    while (*cp1 && isdigit(*cp1))
 		cp1++;
-	    *cp1 = '\0';
+	    if (*cp1)
+		*cp1++ = '\0';
 	    StrAllocCopy(Seconds, cp);
-	    cp1++;
 	}
 	if (Seconds) {
 	    /*
@@ -1999,7 +2037,8 @@ PUBLIC void LYHandleMETA ARGS4(
 		/*
 		 *  We found a URL field, so check it out. - FM
 		 */
-		if (!(url_type = LYLegitimizeHREF(me, (char**)&href, TRUE))) {
+		if (!(url_type = LYLegitimizeHREF(me, (char**)&href,
+						  TRUE, FALSE))) {
 		    /*
 		     *  The specs require a complete URL,
 		     *  but this is a Netscapism, so don't
@@ -2087,7 +2126,7 @@ PUBLIC void LYHandleMETA ARGS4(
      */
     } else if (!(me->node_anchor->SugFname && *me->node_anchor->SugFname) &&
     	       !strcasecomp((http_equiv ?
-    			     http_equiv : name), "Content-Disposition")) {
+	       		     http_equiv : ""), "Content-Disposition")) {
 	cp = content;
 	while (*cp != '\0' && strncasecomp(cp, "file;", 5))
 	    cp++;
@@ -2112,7 +2151,7 @@ PUBLIC void LYHandleMETA ARGS4(
     /*
      *  Check for a Set-Cookie directive. - AK
      */
-    } else if (!strcasecomp((http_equiv ? http_equiv : name), "Set-Cookie")) {
+    } else if (!strcasecomp((http_equiv ? http_equiv : ""), "Set-Cookie")) {
 	/*
 	 *  We're using the Request-URI as the second argument,
 	 *  regardless of whether a Content-Base header or BASE
@@ -2137,10 +2176,11 @@ free_META_copies:
 **  are to be treated as partial or absolute
 **  URLs. - FM
 */
-PUBLIC int LYLegitimizeHREF ARGS3(
+PUBLIC int LYLegitimizeHREF ARGS4(
 	HTStructured *, 	me,
 	char **,		href,
-	BOOL,			force_slash)
+	BOOL,			force_slash,
+	BOOL,			strip_dots)
 {
     int url_type = 0;
 
@@ -2173,7 +2213,7 @@ PUBLIC int LYLegitimizeHREF ARGS3(
 		 "file:", 5)) {
         /*
 	 *  The Fielding RFC/ID for resolving partial HREFs says
-	 *  that a slash should be on the end or the preceding
+	 *  that a slash should be on the end of the preceding
 	 *  symbolic element for "." and "..", but all tested
 	 *  browsers only do that for an explicit "./" or "../",
 	 *  so we'll respect the RFC/ID only if force_slash was
@@ -2181,6 +2221,61 @@ PUBLIC int LYLegitimizeHREF ARGS3(
 	 */
 	StrAllocCat(*href, "/");
     }
+    if ((!url_type && LYStripDotDotURLs && strip_dots && *(*href) == '.') &&
+	 !strncasecomp((me->inBASE ?
+		     me->base_href : me->node_anchor->address),
+		       "http", 4)) {
+	/*
+	 *  We will be resolving a partial reference versus an http
+	 *  or https URL, and it has lead dots, which are retained
+	 *  when resolving, in compliance with the URL specs, but
+	 *  the request would fail if the first element of the
+	 *  resultant path is two dots, because no http or https
+	 *  server accepts such paths, so if that's the case, and
+	 *  strip_dots is TRUE, we'll strip that element now, but
+	 *  issue a message about this as "immediate feedback",
+	 *  such that the bad partial reference might get corrected
+	 *  by the document provider.  Note that if the second and
+	 *  further symbolic elements also contain(s) only dots,
+	 *  those will still be retained, and the resolved URL may
+	 *  still fail, but it should, IMHO, if the partial reference
+	 *  is that much out of compliance with the URL specs. - FM
+	 */
+        int i = 0, j = 0;
+	char *temp = NULL, *str = "";
+
+	if (((temp = HTParse((me->inBASE ?
+			  me->base_href : me->node_anchor->address),
+			     "", PARSE_PATH + PARSE_PUNCTUATION)) == NULL) ||
+	    *temp == '\0' ||
+	    strchr(&temp[1], '/') == NULL) {
+	    FREE(temp);
+	    temp = *href;
+	    if ((me->inBASE ?
+	   me->base_href[4] : me->node_anchor->address[4]) == 's')
+	        str = "s";
+	    while (temp[j] == '.')
+		j++;
+	    if ((j == 2) && (temp[j] == '/' || temp[j] == '\0')) {
+		if (TRACE) {
+		    fprintf(stderr,
+			 "LYLegitimizeHREF: Bad value '%s' for http%s URL.\n",
+			   *href, str);
+		    fprintf(stderr,
+			   "                  Stripping lead dots.\n");
+		} else if (!me->inBadHREF) {
+		    _statusline(BAD_PARTIAL_REFERENCE);
+		    me->inBadHREF = TRUE;
+		    sleep(AlertSecs);
+		}
+		while (temp[j] != '\0')
+		    temp[i++] = temp[j++];
+		temp[i] = '\0';
+	    }
+	    temp = NULL;
+	}
+	FREE(temp);
+    }
     return(url_type); 
 }
 
@@ -2316,7 +2411,7 @@ PUBLIC void LYHandleID ARGS2(
 				me->node_anchor,	/* Parent */
 				id,			/* Tag */
 				NULL,			/* Addresss */
-				(void *)0)) != 0) {	/* Type */
+				(void *)0)) != NULL) {	/* Type */
 	HText_beginAnchor(me->text, ID_A);
 	HText_endAnchor(me->text);
     }
diff --git a/src/LYCharUtils.h b/src/LYCharUtils.h
index 8c71b5c0..b6b0d892 100644
--- a/src/LYCharUtils.h
+++ b/src/LYCharUtils.h
@@ -41,7 +41,6 @@ extern char *LYUppercaseI_OL_String PARAMS((
 	int			seqnum));
 extern char *LYLowercaseI_OL_String PARAMS((
 	int			seqnum));
-extern void html_get_chartrans_info PARAMS((HTStructured * me));
 extern void LYHandleMETA PARAMS((
 	HTStructured *		me,
 	CONST BOOL*	 	present,
@@ -50,7 +49,8 @@ extern void LYHandleMETA PARAMS((
 extern int LYLegitimizeHREF PARAMS((
 	HTStructured *	 	me,
 	char **			href,
-	BOOL			force_slash));
+	BOOL			force_slash,
+	BOOL			strip_dots));
 extern void LYCheckForContentBase PARAMS((
 	HTStructured *		me));
 extern void LYCheckForID PARAMS((
@@ -74,4 +74,13 @@ extern BOOLEAN LYCheckForCSI PARAMS((
 	char **			url));
 #endif /* Lynx_HTML_Handler */
 
+#ifdef EXP_CHARTRANS
+#ifdef HTML_H
+extern void html_get_chartrans_info PARAMS((HTStructured * me));
+#endif
+extern void add_META_charset_to_fd PARAMS((
+    FILE *	fp,
+    int		disp_chndl));
+#endif /* EXP_CHARTRANS */
+
 #endif /* LYCHARUTILS_H */
diff --git a/src/LYClean.c b/src/LYClean.c
index bfdaa98f..1b411319 100644
--- a/src/LYClean.c
+++ b/src/LYClean.c
@@ -59,9 +59,10 @@ PUBLIC void cleanup_sig ARGS1(
 	_statusline(REALLY_EXIT);
 	c = LYgetch();
 #ifdef QUIT_DEFAULT_YES
-	if(TOUPPER(c) == 'N')
+	if (TOUPPER(c) == 'N' ||
+	    c == 7)
 #else
-	if(TOUPPER(c) != 'Y')
+	if (TOUPPER(c) != 'Y')
 #endif /* QUIT_DEFAULT_YES */
 	    return;
     }
@@ -109,7 +110,7 @@ PUBLIC void cleanup_sig ARGS1(
 #endif /* NOSIGHUP */
 
 #ifndef NOSIGHUP
-	 (void) signal(SIGHUP, SIG_IGN);
+	 (void) signal(SIGHUP, SIG_DFL);
 #endif /* NOSIGHUP */
     (void) signal(SIGTERM, SIG_DFL);
 #ifndef VMS
@@ -162,9 +163,7 @@ PUBLIC void cleanup NOARGS
         move(LYlines-1, 0);
         clrtoeol();
 
-        stop_bold();
-        stop_underline();
-        stop_reverse();
+        lynx_stop_all_colors ();
         refresh();
 
         stop_curses();
@@ -184,4 +183,8 @@ PUBLIC void cleanup NOARGS
 #endif /* VMS */
 
     fflush(stdout);
+    fflush(stderr);
+    if (LYTraceLogFP != NULL) {
+        fclose(LYTraceLogFP);
+    }
 }
diff --git a/src/LYCookie.c b/src/LYCookie.c
index 17690dc0..d43a6664 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -152,11 +152,10 @@ PRIVATE void LYCookieJar_free NOARGS
 	    cl = de->cookie_list;
 	    while (cl) {
 		next = cl->next;
+		co = cl->object;
 		if (co) {
-		    co = cl->object;
 		    HTList_removeObject(de->cookie_list, co);
 		    freeCookie(co);
-		    co = NULL;
 		}
 		cl = next;
 	    }
@@ -166,6 +165,19 @@ PRIVATE void LYCookieJar_free NOARGS
 	}
 	dl = dl->next;
     }
+    if (dump_output_immediately) {
+	cl = cookie_list;
+	while (cl) {
+	    next = cl->next;
+	    co = cl->object;
+	    if (co) {
+		HTList_removeObject(cookie_list, co);
+		freeCookie(co);
+	    }
+	    cl = next;
+	}
+	HTList_delete(cookie_list);
+    }
     cookie_list = NULL;
     HTList_delete(domain_list);
     domain_list = NULL;
@@ -431,8 +443,8 @@ PRIVATE char * scan_cookie_sublist ARGS6(
 	next = hl->next;
 
 	if (TRACE && co) {
-	    fprintf(stderr, "Checking cookie %x %s=%s\n",
-		    	    hl,
+	    fprintf(stderr, "Checking cookie %lx %s=%s\n",
+		    	    (long) hl,
 			    (co->name ? co->name : "(no name)"),
 			    (co->value ? co->value : "(no value)"));
 	    fprintf(stderr, "%s %s %i %s %s %i%s\n",
@@ -750,8 +762,8 @@ PUBLIC void LYSetCookie ARGS2(
 			cur_cookie->expires = (time(NULL) + temp);
 			if (TRACE)
 			    fprintf(stderr,
-			    	    "LYSetCooke: expires %i, %s",
-				    cur_cookie->expires,
+			    	    "LYSetCooke: expires %ld, %s",
+				    (long) cur_cookie->expires,
 				    ctime(&cur_cookie->expires));
 		    }
 		}
@@ -777,8 +789,8 @@ PUBLIC void LYSetCookie ARGS2(
 			if (cur_cookie->expires > 0) {
 			    if (TRACE)
 				fprintf(stderr,
-					"LYSetCooke: expires %i, %s",
-					cur_cookie->expires,
+					"LYSetCooke: expires %ld, %s",
+					(long) cur_cookie->expires,
 					ctime(&cur_cookie->expires));
 			}
 		    }
@@ -849,10 +861,20 @@ PUBLIC void LYSetCookie ARGS2(
     /*
      *  Store the final cookie if within length limit. - FM
      */
-    if (length <= 4096) {
+    if (length <= 4096 && cur_cookie != NULL) {
         /*
-	 *  Force the secure flag on if it's not
-	 *  set but this is an https URL. - FM
+	 *  Force the secure flag on if it's not set but this
+	 *  is an https URL.  This ensures that cookies from
+	 *  https servers will not be shared with ones for
+	 *  http (non-SSL) servers and thus be transmitted
+	 *  unencrypted, and is redundant with the current,
+	 *  blanket port restriction.  However, this seemed
+	 *  a side-effect rather than conscious intent within
+	 *  the port restriction.  A port attribute is likely
+	 *  to be added, and we can independently regulate
+	 *  sharing based on port versus scheme, with user
+	 *  configuration and run time options, "when the
+	 *  time is right". - FM
 	 */
         if (!strncasecomp(address, "https:", 6) &&
 	    !(cur_cookie->flags & COOKIE_FLAG_SECURE)) {
diff --git a/src/LYCurses.c b/src/LYCurses.c
index cc3f423d..968c23d5 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -1,6 +1,7 @@
 #include "HTUtils.h"
 #include "tcp.h"
 #include "LYCurses.h"
+#include "LYStyle.h"
 #include "LYUtils.h"
 #include "LYGlobalDefs.h"
 #include "LYSignal.h"
@@ -31,6 +32,12 @@ extern int _NOSHARE(LINES);
 extern int _NOSHARE(COLS);
 #endif /* VMS && __GNUC__ */
 
+#ifdef USE_COLOR_STYLE
+#include "AttrList.h"
+#include "LYHash.h"
+int has_color = 0;
+#endif
+
 /*
  *  These are routines to start and stop curses and to cleanup
  *  the screen at the end.
@@ -39,7 +46,7 @@ extern int _NOSHARE(COLS);
 PRIVATE int dumbterm PARAMS((char *terminal));
 BOOLEAN LYCursesON = FALSE;
 
-#if defined(USE_SLANG) || defined(COLOR_CURSES)
+#if USE_COLOR_TABLE || USE_SLANG
 PRIVATE int Current_Attr;
 #endif
 
@@ -62,6 +69,12 @@ PUBLIC void LY_SLrefresh NOARGS
     return;
 }
 
+PUBLIC void LY_SLclear NOARGS
+{
+    SLsmg_gotorc (0, 0);
+    SLsmg_erase_eos ();
+}
+
 #ifdef VMS
 PUBLIC void VTHome NOARGS
 {
@@ -111,13 +124,16 @@ PUBLIC void lynx_setup_colors NOARGS
     SLtt_set_mono(7, NULL, SLTT_ULINE_MASK | SLTT_BOLD_MASK | SLTT_REV_MASK);
 }
 
+
+
 PRIVATE void sl_suspend ARGS1(
 	int,		sig)
 {
-#ifndef VMS
 #ifdef SIGSTOP
+#ifndef VMS
     int r, c;
-
+   
+    lynx_enable_mouse (0);
     if (sig == SIGTSTP)
         SLsmg_suspend_smg();
     SLang_reset_tty();
@@ -142,14 +158,191 @@ PRIVATE void sl_suspend ARGS1(
     if ((r != SLtt_Screen_Rows) || (c != SLtt_Screen_Cols)) {
 	recent_sizechange = TRUE;
     }
-#endif /* SIGSTOP */
+    lynx_enable_mouse (1);
 #endif /* !VMS */
+#endif /* SIGSTOP */
    return;
 }
 #endif /* USE_SLANG */
 
+#if defined(USE_COLOR_STYLE) || defined(SLCS)
+PRIVATE int last_styles[128];
+PRIVATE int last_ptr=0;
+#endif
+
+#if defined(USE_COLOR_STYLE)
+/* Ok, explanation of the USE_COLOR_STYLE styles.  The basic styles (ie non
+ * HTML) are set the same as the SLANG version for ease of programming.  The
+ * other styles are simply the HTML enum from HTMLDTD.h + 16.
+ */
+PUBLIC HTCharStyle displayStyles[DSTYLE_ELEMENTS];
+
+/*
+ * set a style's attributes - RP
+ */
+PUBLIC void setStyle ARGS4(int,style,int,color,int,cattr,int,mono)
+{
+	displayStyles[style].color=color;
+	displayStyles[style].cattr=cattr;
+	displayStyles[style].mono=mono;
+}
+
+PUBLIC void setHashStyle ARGS5(int,style,int,color,int,cattr,int,mono,char*,element)
+{
+        bucket* ds=&hashStyles[style];
+        if (TRACE)
+                fprintf(stderr, "CSS(SET): <%s> hash=%d, ca=%d, ma=%d\n", element, style, color, mono);
+        ds->color=color;
+        ds->cattr=cattr;
+        ds->mono=mono;
+        ds->code=style;
+        ds->name=malloc(sizeof(char)*(strlen(element)+2));
+        strcpy(ds->name, element);
+}
 
-#ifdef COLOR_CURSES
+/*
+ * set the curses attributes to be color or mono - RP
+ */
+PRIVATE int LYAttrset ARGS3(WINDOW*,win,int,color,int,mono)
+{
+	if (TRACE)
+		fprintf(stderr, "CSS:LYAttrset (%d, %d)\n", color, mono);
+	if (has_color && color > -1)
+	{
+		wattrset(win,color);
+#if 0
+		//wbkgdset(win,color);
+#endif
+		return color;
+	}
+	if (mono > -1)
+	{
+		wattrset(win,mono);
+#if 0
+		//wbkgdset(win,mono);
+#endif
+		return mono;
+	}
+	wattrset(win,A_NORMAL);
+#if 0
+	//wbkgdset(win,A_NORMAL);
+#endif
+	return A_NORMAL;
+}
+
+PUBLIC void curses_w_style ARGS4(WINDOW*,win,int,style,int,dir,int,previous)
+{
+	int YP,XP;
+	bucket* ds=&hashStyles[style];
+
+	if (!ds->name)
+	{
+		if (TRACE)
+		fprintf(stderr, "CSS.CS:Style %d not configured\n",style);
+		return;
+	}
+	if (TRACE)
+		fprintf(stderr, "CSS.CS:<%s%s> (%d)\n",(dir?"":"/"),ds->name,ds->code);
+
+	getyx (win, YP, XP);
+
+	if (style == s_normal && dir)
+	{
+		wattrset(win,A_NORMAL);
+		if (win==stdscr) cached_styles[YP][XP]=s_normal;
+		return;
+	}
+
+	switch (dir)
+	{
+		/* ABS_OFF is the same as STACK_OFF for the moment */
+	case STACK_OFF:
+		if (last_ptr)
+			LYAttrset(win,last_styles[--last_ptr],-1);
+		else
+			LYAttrset(win,A_NORMAL,-1);
+		return;
+
+	case STACK_ON: /* remember the current attributes */
+#ifndef _NCURSES_H
+		last_styles[last_ptr++] = getattrs(stdscr);
+#else
+		last_styles[last_ptr++] = attr_get();
+#endif
+		/* don't cache style changes for active links */
+		if (style != s_alink)
+		{
+			if (TRACE)
+				fprintf(stderr, "CACHED: <%s> @(%d,%d)\n", ds->name, YP, XP);
+			if (win==stdscr) cached_styles[YP][XP]=style;
+			LYAttrset(win, ds->color, ds->mono);
+		}
+		else
+		{
+			LYAttrset(win, ds->color, ds->mono);
+		}
+		return;
+
+	case ABS_ON: /* change without remembering the previous style */
+		/* don't cache style changes for active links */
+		if (style != s_alink)
+		{
+			if (TRACE)
+				fprintf(stderr, "CACHED: <%s> @(%d,%d)\n", ds->name, YP, XP);
+			if (win==stdscr) cached_styles[YP][XP]=style;
+			LYAttrset(win, ds->color, ds->mono);
+		}
+		else
+		{
+			LYAttrset(win, ds->color, ds->mono);
+		}
+		return;
+	}
+}
+
+/*
+ * wrapper function to set on-screen styles - RP
+ */
+PUBLIC void wcurses_css ARGS3(WINDOW *,win,char*,name,int,dir)
+{
+	int try_again=1;
+	while (try_again)
+	{
+		int tmpHash=hash_code(name);
+		if (TRACE)
+			fprintf(stderr, "CSSTRIM:trying to set [%s] style - ", name);
+		if (tmpHash==NOSTYLE) {
+			char *class=strrchr(name, '.');
+			if (TRACE) fprintf(stderr, "undefined, trimming at %p\n", class);
+			if (class)	*class='\0';
+			else 		try_again=0;
+		} else {
+			if (TRACE) fprintf(stderr, "ok (%d)\n", hash_code(name));
+			curses_w_style(win, hash_code(name), dir, 0);
+			try_again=0;
+		}
+	}
+}
+
+PUBLIC void curses_css ARGS2(char *,name,int,dir)
+{
+	wcurses_css(stdscr, name, dir);
+}
+
+PUBLIC void curses_style ARGS3(int,style,int,dir,int,previous)
+{
+        curses_w_style(stdscr, style, dir, previous);
+}
+
+#if UNUSED
+void attribute ARGS2(int,style,int,dir)
+{
+        curses_style(style, dir, 0);
+}
+#endif
+#endif /* USE_COLOR_STYLE */
+
+#if USE_COLOR_TABLE && defined(COLOR_CURSES)
 /*
  * This block of code is designed to produce the same color effects using SVr4
  * curses as the slang library's implementation in this module.  That maps the
@@ -346,9 +539,9 @@ PUBLIC void lynx_setup_colors NOARGS
     for (n = 0; n < 8; n++)
 	lynx_map_color(n);
 }
-#endif /* COLOR_CURSES */
+#endif /* USE_COLOR_TABLE */
 
-#if defined (DJGPP) && !defined (SLANG)
+#if defined (DJGPP) && !defined (USE_SLANG)
 /*
  * Sorry about making a completely new function,
  * but the real one is messy! WB
@@ -368,11 +561,17 @@ PUBLIC void start_curses NOARGS
 		  fflush(stdout);
                   lynx_init_colors();
                   lynx_called_initscr = TRUE;
+
+ /* Inform pdcurses that we're interested in knowing when mouse
+    buttons are clicked.  Maybe someday pdcurses will support it.
+ */
+	 if (LYUseMouse)
+	      lynx_enable_mouse (1);
+
 	 } else sock_init();
 
 	 LYCursesON = TRUE;
 	 clear();
-
 }
 #else
 PUBLIC void start_curses NOARGS
@@ -420,11 +619,14 @@ PUBLIC void start_curses NOARGS
    SLtty_set_suspend_state(1);
 #endif /* _WINDOWS */
 #ifdef SIGTSTP
-    signal(SIGTSTP, sl_suspend);
+   if (!no_suspend)
+       signal(SIGTSTP, sl_suspend);
 #endif /* SIGTSTP */
     signal(SIGINT, cleanup_sig);
 #endif /* !VMS */
 
+   lynx_enable_mouse (1);
+
 #else /* Using curses: */
 
 #ifdef VMS
@@ -455,15 +657,21 @@ PUBLIC void start_curses NOARGS
 #endif /* SIGTSTP */
 	    exit (-1);
 	}
+#ifdef USE_COLOR_STYLE
+	has_color = has_colors();
+	if (has_color)
+		start_color();
+	parse_userstyles();	
+#endif
         first_time = FALSE;
-#if defined(COLOR_CURSES)
+#if USE_COLOR_TABLE
 	lynx_init_colors();
 	lynx_called_initscr = TRUE;
 #endif /* USE_SLANG */
     }
 #endif /* VMS */
 
-    /* nonl();   *//* seems to slow things down */
+    /* nonl();   */ /* seems to slow things down */
 
 #ifdef VMS
     crmode();
@@ -483,25 +691,49 @@ PUBLIC void start_curses NOARGS
     keypad(stdscr,TRUE);
 #endif /* HAVE_KEYPAD */
 
-#ifdef NCURSES_MOUSE_VERSION
- /* Inform ncurses that we're interested in knowing when mouse
-    button 1 is clicked */
-    if (LYUseMouse)
-      mousemask(BUTTON1_CLICKED, NULL);
-#endif /* NCURSES_MOUSE_VERSION */
+   lynx_enable_mouse (1);
 
     fflush(stdin);
     fflush(stdout);
+    fflush(stderr);
 #endif /* USE_SLANG */
 
 #ifdef _WINDOWS
-	 clear();
+    clear();
 #endif
 
     LYCursesON = TRUE;
 }
-#endif /* defined (DJGPP) && !defined (SLANG) */
+#endif /* defined (DJGPP) && !defined (USE_SLANG) */
 
+PUBLIC void lynx_enable_mouse ARGS1(int,state)
+{
+   if (LYUseMouse == 0) 
+     return;
+
+#ifdef USE_SLANG_MOUSE
+   SLtt_set_mouse_mode (state, 0);
+   SLtt_flush_output ();
+#else
+#ifdef NCURSES_MOUSE_VERSION
+     /* Inform ncurses that we're interested in knowing when mouse
+      button 1 is clicked */
+#ifndef _WINDOWS
+   if (state)
+     mousemask(BUTTON1_CLICKED, NULL);
+   else
+     mousemask(0, NULL);
+#else
+   if (state) mouse_set(BUTTON1_CLICKED && BUTTON2_CLICKED && BUTTON3_CLICKED);
+#endif /* _WINDOWS */
+#endif /* NCURSES_MOUSE_VERSION */
+
+#if defined(DJGPP) && !defined(USE_SLANG)
+     if (state)
+       mouse_set(BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED);
+#endif
+#endif				       /* NOT USE_SLANG_MOUSE */
+}
 
 PUBLIC void stop_curses NOARGS
 {
@@ -509,7 +741,7 @@ PUBLIC void stop_curses NOARGS
 #ifdef DJGPP
 		  sock_exit();
 #endif
-#if defined (DOSPATH) && !defined (SLANG)
+#if defined (DOSPATH) && !defined (USE_SLANG)
 	 clrscr();
 /*
 		  clear();
@@ -522,18 +754,21 @@ PUBLIC void stop_curses NOARGS
      *	05-28-94 Lynx 2-3-1 Garrett Arch Blythe
      */
     if(LYCursesON == TRUE)	{
-#ifdef NCURSES_MOUSE_VERSION
-        mousemask(0, NULL);
-#endif
-    	endwin();	/* stop curses */
+         lynx_enable_mouse (0);
+         endwin();	/* stop curses */
     }
 
     fflush(stdout);
 #endif /* DJGPP */
+    fflush(stderr);
 
     LYCursesON = FALSE;
 
 #ifndef VMS
+#ifdef SIGTSTP
+   if (!no_suspend)
+       signal(SIGTSTP, SIG_DFL);
+#endif /* SIGTSTP */
     signal(SIGINT, SIG_DFL);
 #endif /* !VMS */
 }
@@ -818,8 +1053,10 @@ PUBLIC void VMSexit NOARGS
 	    fprintf(stderr,
 "TRACEBACK if it can be captured, and any other relevant information.\n");
 
-            fprintf(stderr,"\nPress RETURN to clean up: ");
-	    (void) getchar();
+	    if (LYTraceLogFP == NULL) {
+		fprintf(stderr,"\nPress RETURN to clean up: ");
+		(void) getchar();
+	    }
 	} else if (LYCursesON) {
 	    _statusline(MEMORY_EXHAUSTED_ABORT);
 	    sleep(AlertSecs);
@@ -829,6 +1066,7 @@ PUBLIC void VMSexit NOARGS
     if (LYOutOfMemory == TRUE) {
 	printf("\r\n%s\r\n\r\n", MEMORY_EXHAUSTED_ABORT);
 	fflush(stdout);
+	fflush(stderr);
     }
 }
 
@@ -1202,3 +1440,140 @@ PUBLIC void VMSbox ARGS3(
 }
 #endif /* !USE_SLANG */
 #endif /* VMS */
+
+
+
+PUBLIC void lynx_start_underline_color NOARGS
+{
+   start_underline ();
+}
+
+PUBLIC void lynx_stop_underline_color NOARGS
+{
+   stop_underline ();
+}
+
+PUBLIC void lynx_start_bold_color NOARGS
+{
+   start_bold ();
+}
+
+PUBLIC void lynx_stop_bold_color NOARGS
+{
+   stop_bold ();
+}
+
+PUBLIC void lynx_start_title_color NOARGS
+{
+}
+
+PUBLIC void lynx_stop_title_color NOARGS
+{
+}
+
+PUBLIC void lynx_start_link_color ARGS1(int, flag)
+{
+    if (flag) {
+	/* makes some terminals work wrong because
+	 * they can't handle two attributes at the 
+	 * same time
+	 */
+	/* start_bold();  */
+	start_reverse();
+#if defined(USE_SLANG) || defined(FANCY_CURSES)
+	start_underline ();
+#endif /* USE_SLANG */
+     } else {
+	start_bold();
+     }
+}
+
+PUBLIC void lynx_stop_link_color ARGS1(int, flag)
+{
+#ifdef USE_COLOR_STYLE
+    LynxChangeStyle(flag == ON ? s_alink : s_a, ABS_OFF, 0);
+#else
+    if (flag) {
+	stop_reverse();
+#if defined(USE_SLANG) || defined(FANCY_CURSES)
+	stop_underline ();
+#endif /* USE_SLANG */
+    } else
+	stop_bold();
+#endif
+}
+
+
+PUBLIC void lynx_stop_target_color NOARGS
+{
+   stop_underline();
+   stop_reverse();
+   stop_bold();
+}
+
+PUBLIC void lynx_start_target_color NOARGS
+{
+   start_bold();
+   start_reverse();
+   start_underline();
+}
+
+
+PUBLIC void lynx_start_status_color NOARGS
+{
+#if USE_COLOR_TABLE && defined(COLOR_CURSES)
+   lynx_set_color (2);
+#else
+   start_reverse ();
+#endif
+}
+
+PUBLIC void lynx_stop_status_color NOARGS
+{
+#if USE_COLOR_TABLE && defined(COLOR_CURSES)
+   lynx_set_color (0);
+#else
+   stop_reverse ();
+#endif
+}
+
+PUBLIC void lynx_start_h1_color NOARGS
+{
+   if (bold_H1 || bold_headers)
+     start_bold();
+}
+
+PUBLIC void lynx_stop_h1_color NOARGS
+{
+   if (bold_H1 || bold_headers)
+     stop_bold();
+}
+
+PUBLIC void lynx_start_prompt_color NOARGS
+{
+   start_reverse ();
+}
+
+PUBLIC void lynx_stop_prompt_color NOARGS
+{
+   stop_reverse ();
+}
+
+PUBLIC void lynx_start_radio_color NOARGS
+{
+   start_bold ();
+}
+
+PUBLIC void lynx_stop_radio_color NOARGS
+{
+   stop_bold ();
+}
+
+PUBLIC void lynx_stop_all_colors NOARGS
+{
+   stop_underline ();
+   stop_reverse ();
+   stop_bold ();
+}
+   
+	
diff --git a/src/LYCurses.h b/src/LYCurses.h
index ea4d3b82..82efadc9 100644
--- a/src/LYCurses.h
+++ b/src/LYCurses.h
@@ -1,6 +1,18 @@
 #ifndef LYCURSES_H
 #define LYCURSES_H
 
+/*
+ * The simple color scheme maps the 8 combinations of bold/underline/reverse
+ * to the standard 8 ANSI colors (with some variations based on context).
+ */
+#undef USE_COLOR_TABLE
+
+#ifndef USE_COLOR_STYLE
+#if defined(USE_SLANG) || defined(COLOR_CURSES)
+#define USE_COLOR_TABLE 1
+#endif
+#endif
+
 #ifdef TRUE
 #undef TRUE  /* to prevent parse error :( */
 #endif /* TRUE */
@@ -108,7 +120,20 @@ extern void VMSbox PARAMS((WINDOW *win, int height, int width));
 #endif /* !USE_SLANG */
 #endif /* VMS */
 
-#if defined(USE_SLANG) || defined(COLOR_CURSES)
+#if defined(USE_COLOR_STYLE)
+extern void curses_css PARAMS((char * name,int dir));
+extern void curses_style PARAMS((int style,int dir,int previous));
+extern void curses_w_style PARAMS((WINDOW* win,int style,int dir,int previous));
+extern void setHashStyle PARAMS((int style,int color,int cattr,int mono,char* element));
+extern void setStyle PARAMS((int style,int color,int cattr,int mono));
+extern void wcurses_css PARAMS((WINDOW * win,char* name,int dir));
+#define LynxChangeStyle curses_style
+#else
+extern int slang_style PARAMS((int style,int dir,int previous));
+#define LynxChangeStyle slang_style
+#endif /* USE_COLOR_STYLE */
+
+#if USE_COLOR_TABLE
 extern void lynx_add_attr PARAMS((int a));
 extern void lynx_sub_attr PARAMS((int a));
 extern void lynx_setup_colors NOPARAMS;
@@ -116,6 +141,10 @@ extern unsigned int Lynx_Color_Flags;
 #endif
 
 #ifdef USE_SLANG
+#if !defined(VMS) && !defined(DJGPP)
+#define USE_SLANG_MOUSE		1
+#endif
+
 #define SL_LYNX_USE_COLOR	1
 #define SL_LYNX_USE_BLINK	2
 #define start_bold()      lynx_add_attr(1)
@@ -140,7 +169,8 @@ extern int PHYSICAL_SLtt_Screen_Cols;
 #define LINES SLtt_Screen_Rows
 #define move SLsmg_gotorc
 #define addstr SLsmg_write_string
-#define clear SLsmg_cls
+extern void LY_SLclear NOPARAMS;
+#define clear LY_SLclear
 #define standout SLsmg_reverse_video
 #define standend  SLsmg_normal_video
 #define clrtoeol SLsmg_erase_eol
@@ -192,7 +222,7 @@ extern void VTHome NOPARAMS;
 
 #else /* NOT VMS: */
 
-#ifdef COLOR_CURSES
+#if USE_COLOR_TABLE
 extern void lynx_add_wattr PARAMS((WINDOW *, int));
 extern void lynx_sub_wattr PARAMS((WINDOW *, int));
 extern void lynx_set_color PARAMS((int));
@@ -247,4 +277,26 @@ extern int  lynx_chg_color PARAMS((int, int, int));
 #endif /* FANCY_CURSES */
 #endif /* USE_SLANG */
 
+extern void lynx_enable_mouse PARAMS((int));
+extern void lynx_start_underline_color NOPARAMS;
+extern void lynx_stop_underline_color NOPARAMS;
+extern void lynx_start_bold_color NOPARAMS;
+extern void lynx_stop_bold_color NOPARAMS;
+extern void lynx_start_title_color NOPARAMS;
+extern void lynx_stop_title_color NOPARAMS;
+extern void lynx_start_link_color PARAMS((int));
+extern void lynx_stop_link_color PARAMS((int));
+extern void lynx_stop_target_color NOPARAMS;
+extern void lynx_start_target_color NOPARAMS;
+extern void lynx_start_status_color NOPARAMS;
+extern void lynx_stop_status_color NOPARAMS;
+extern void lynx_start_h1_color NOPARAMS;
+extern void lynx_stop_h1_color NOPARAMS;
+extern void lynx_start_prompt_color NOPARAMS;
+extern void lynx_stop_prompt_color NOPARAMS;
+extern void lynx_start_radio_color NOPARAMS;
+extern void lynx_stop_radio_color NOPARAMS;
+extern void lynx_stop_all_colors NOPARAMS;
+
+
 #endif /* LYCURSES_H */
diff --git a/src/LYExtern.c b/src/LYExtern.c
new file mode 100644
index 00000000..7ec3f5d8
--- /dev/null
+++ b/src/LYExtern.c
@@ -0,0 +1,87 @@
+/*
+ External application support.
+ This feature allows lynx to pass a given URL to an external program.
+ It was written for three reasons.
+ 1) To overcome the deficiency	of Lynx_386 not supporting ftp and news.
+    External programs can be used instead by passing the URL.
+
+ 2) To allow for background transfers in multitasking systems.
+    I use wget for http and ftp transfers via the external command.
+
+ 3) To allow for new URLs to be used through lynx.
+    URLs can be made up such as mymail: to spawn desired applications
+    via the external command.
+
+ See lynx.cfg for other info.
+*/
+
+#ifdef USE_EXTERNALS
+#include "tcp.h"
+#include "LYGlobalDefs.h"
+#include "LYUtils.h"
+#include "LYExtern.h"
+
+#include "LYLeaks.h"
+
+#define FREE(x) if (x) {free(x); x = NULL;}
+
+void run_external(char * c)
+{
+	char command[1024];
+	lynx_html_item_type *externals2=0;
+
+	if (externals == NULL) return;
+
+	for(externals2=externals; externals2 != NULL;
+		 externals2=externals2->next)
+	{
+
+#ifdef _WINDOWS
+	 if (!strnicmp(externals2->name,c,strlen(externals2->name)))
+#else
+	 if (!strncasecomp(externals2->name,c,strlen(externals2->name)))
+#endif
+	 {
+	     char *cp;
+
+		if(no_externals && !externals2->always_enabled)
+		{
+		  statusline(EXTERNALS_DISABLED);
+		  sleep(MessageSecs);
+		  return;
+		}
+
+		/*  Too dangerous to leave any URL that may come along unquoted.
+		 *  They often contain '&', ';', and '?' chars, and who knows
+		 *  what else may occur.
+		 *  Prevent spoofing of the shell.
+		 *  Dunno how this needs to be modified for VMS or DOS. - kw
+		 */
+#if defined(VMS) || defined(DOSPATH)
+		sprintf(command, externals2->command, c);
+#else /* Unix or DOS/Win: */
+		cp = quote_pathname(c);
+		sprintf(command, externals2->command, cp);
+		FREE(cp);
+#endif /* VMS */
+
+		if (*command != '\0')
+		{
+
+		 statusline(command);
+		 sleep(MessageSecs);
+
+		 stop_curses();
+		 fflush(stdout);
+		 system(command);
+		 fflush(stdout);
+		 start_curses();
+		}
+
+		return;
+	 }
+	}
+
+	return;
+}
+#endif /* USE_EXTERNALS */
diff --git a/src/LYExtern.h b/src/LYExtern.h
new file mode 100644
index 00000000..be9d1562
--- /dev/null
+++ b/src/LYExtern.h
@@ -0,0 +1,10 @@
+#ifndef EXTERNALS_H

+#define EXTERNALS_H
+
+#ifndef LYSTRUCTS_H
+#include "LYStructs.h"

+#endif /* LYSTRUCTS_H */

+
+void run_external(char * c);
+
+#endif /* EXTERNALS_H */

diff --git a/src/LYForms.c b/src/LYForms.c
index 6385fc02..3aba947a 100644
--- a/src/LYForms.c
+++ b/src/LYForms.c
@@ -14,6 +14,11 @@
 
 #include "LYLeaks.h"
 
+#ifdef USE_COLOR_STYLE
+#include "AttrList.h"
+#include "LYHash.h"
+#endif
+
 #ifdef ALT_CHAR_SET
 #define BOXVERT 0   /* use alt char set for popup window vertical borders */
 #define BOXHORI 0   /* use alt char set for popup window vertical borders */
@@ -76,7 +81,7 @@ PUBLIC int change_form_link ARGS6(struct link *, form_link, int, mode,
 		dummy = popup_options(form->num_value, form->select_list,
 				form_link->ly, form_link->lx, form->size,
 				form->size_l, form->disabled);
-	        c = 12;  /* CTRL-R for repaint */
+	        c = 12;  /* CTRL-L for repaint */
 	        break;
 	    }
 	    form->num_value = popup_options(form->num_value, form->select_list,
@@ -91,7 +96,12 @@ PUBLIC int change_form_link ARGS6(struct link *, form_link, int, mode,
 		form->value = opt_ptr->name;   /* set the name */
 		form->cp_submit_value = opt_ptr->cp_submit_value; /* set the value */
 	    }
-	    c = 12;  /* CTRL-R for repaint */
+#if defined(FANCY_CURSES) || defined(USE_SLANG)
+	    if (!enable_scrollback)
+		c = DO_NOTHING;
+	    else
+#endif
+		c = 12;  /* CTRL-L for repaint */
 	    break;
 
 	case F_RADIO_TYPE:
@@ -109,7 +119,7 @@ PUBLIC int change_form_link ARGS6(struct link *, form_link, int, mode,
 		/* run though list of the links on the screen and
 		 * unselect any that are selected. :) 
 		 */
-		start_bold();
+		lynx_start_radio_color ();
 		for (i = 0; i < nlinks; i++)
 		   if (links[i].type == WWW_FORM_LINK_TYPE &&
 		       links[i].form->type == F_RADIO_TYPE &&
@@ -122,7 +132,7 @@ PUBLIC int change_form_link ARGS6(struct link *, form_link, int, mode,
 			addstr(unchecked_radio);
 			links[i].hightext = unchecked_radio;
 		     }
-		stop_bold();
+		lynx_stop_radio_color ();
 		/* will unselect other button and select this one */
 		HText_activateRadioButton(form);
 		/* now highlight this one */
@@ -175,9 +185,11 @@ PUBLIC int change_form_link ARGS6(struct link *, form_link, int, mode,
 		}
 		if (form->submit_method == URL_MAIL_METHOD)
 		    *refresh_screen = TRUE;
-		else
+		else {
 	            /* returns new document URL */
 	            newdoc->link = 0;
+		    newdoc->internal_link = FALSE;
+		}
 		c = DO_NOTHING;
 		break;
 	    } else {
@@ -197,9 +209,11 @@ PUBLIC int change_form_link ARGS6(struct link *, form_link, int, mode,
 	    HText_SubmitForm(form, newdoc, link_name, link_value);
 	    if (form->submit_method == URL_MAIL_METHOD)
                 *refresh_screen = TRUE;
-	    else
+	    else {
 	        /* returns new document URL */
 	        newdoc->link = 0;
+		newdoc->internal_link = FALSE;
+	    }
 	    break;
 
     }
@@ -535,8 +549,10 @@ PRIVATE int popup_options ARGS7(
 #define getbkgd(w) wgetbkgd(w)	/* workaround pre-1.9.9g bug */
 #endif
     LYsubwindow(form_window);
+#ifdef getbkgd			/* not defined in ncurses 1.8.7 */
     wbkgd(form_window, getbkgd(stdscr));
 #endif
+#endif
 #else
     SLsmg_fill_region (top, lx - 1, bottom - top, width + 4, ' ');
 #endif /* !USE_SLANG */
@@ -577,7 +593,13 @@ redraw:
 #ifdef VMS
     VMSbox(form_window, (bottom - top), (width + 4));
 #else
+#ifdef CSS
+    wcurses_css(form_window, "frame", ABS_ON);
+    box(form_window, BOXVERT, BOXHORI);
+    wcurses_css(form_window, "frame", ABS_OFF);
+#else
     box(form_window, BOXVERT, BOXHORI);
+#endif
 #endif /* VMS */
     wrefresh(form_window);
 #else
@@ -623,12 +645,15 @@ redraw:
 #endif /* !USE_SLANG  */
 
         c = LYgetch();
-	cmd = keymap[c+1];
+	if (c == 3 || c == 7)	/* Control-C or Control-G */
+	    cmd = LYK_QUIT;
+	else
+	    cmd = keymap[c+1];
 #ifdef VMS
-	  if (HadVMSInterrupt) {
-	      HadVMSInterrupt = FALSE;
-	      cmd = 7;
-	  }
+	if (HadVMSInterrupt) {
+	    HadVMSInterrupt = FALSE;
+	    cmd = LYK_QUIT;
+	}
 #endif /* VMS */
 
         switch(cmd) {
@@ -821,6 +846,28 @@ redraw:
 		break;
 
 	    case LYK_NEXT:
+		if (recall && *prev_target_buffer == '\0') {
+		    /*
+		     *  We got a 'n'ext command with no prior query
+		     *  specified within the popup window.  See if
+		     *  one was entered when the popup was retracted,
+		     *  and if so, assume that's what's wanted.  Note
+		     *  that it will become the default within popups,
+		     *  unless another is entered within a popup.  If
+		     *  the within popup default is to be changed at
+		     *  that point, use WHEREIS ('/') and enter it,
+		     *  or the up- or down-arrow keys to seek any of
+		     *  the previously entered queries, regardless of
+		     *  whether they were entered within or outside
+		     *  of a popup window. - FM
+		     */
+		    if ((cp = (char *)HTList_objectAt(search_queries,
+	    					      0)) != NULL) {
+			strcpy(prev_target_buffer, cp);
+			QueryNum = 0;
+			FirstRecall = FALSE;
+		    }
+		}
 	        strcpy(prev_target, prev_target_buffer);
 	    case LYK_WHEREIS:
 	        if (*prev_target == '\0' ) {
@@ -1064,8 +1111,6 @@ restore_popup_statusline:
 	    case LYK_QUIT:
 	    case LYK_ABORT:
 	    case LYK_PREV_DOC:
-	    case 7:	/* Control-G */
-	    case 3:	/* Control-C */
 		cur_selection = orig_selection;
 		cmd = LYK_ACTIVATE; /* to exit */
 		break;
diff --git a/src/LYGetFile.c b/src/LYGetFile.c
index dd0b5376..9abe48d8 100644
--- a/src/LYGetFile.c
+++ b/src/LYGetFile.c
@@ -47,6 +47,7 @@
 PRIVATE int fix_http_urls PARAMS((document *doc));
 extern char * WWW_Download_File;
 extern BOOL redirect_post_content;
+extern BOOL reloading;
 #ifdef VMS
 extern BOOLEAN LYDidRename;
 #endif /* VMS */
@@ -321,6 +322,9 @@ Try_Redirected_URL:
 		    WWWDoc.bookmark = doc->bookmark;
 		    WWWDoc.isHEAD = doc->isHEAD;
 		    WWWDoc.safe = doc->safe;
+		    if (doc->internal_link && !reloading) {
+			LYoverride_no_cache = TRUE;
+		    }
 
 		    if (!HTLoadAbsolute(&WWWDoc)) {
 		        HTMLSetCharacterHandling(current_char_set);
@@ -751,6 +755,7 @@ Try_Redirected_URL:
 			    LYAddVisitedLink(doc);
 			    StrAllocCopy(doc->address, fname);
 			    FREE(fname);
+			    doc->internal_link = FALSE;
 		    	    WWWDoc.address = doc->address;
 			    FREE(doc->post_data);
 		    	    WWWDoc.post_data = NULL;
@@ -814,49 +819,96 @@ Try_Redirected_URL:
 }
 
 /*
- *  The user wants to select a link by number.
+ *  The user wants to select a link or a page by number.
  *  If follow_link_number returns DO_LINK_STUFF do_link
- *   will be run immeditely following its execution.
+ *   will be run immediately following its execution.
+ *  If follow_link_number returns DO_GOTOLINK_STUFF
+ *   it has updated the passed in doc for positioning on a link.
+ *  If follow_link_number returns DO_GOTOPAGE_STUFF
+ *   it has set doc->line to the top line of the desired page
+ *   for displaying that page.
  *  If follow_link_number returns PRINT_ERROR an error message
  *   will be given to the user.
  *  If follow_link_number returns DO_FORMS_STUFF some forms stuff
- *   will be done.
+ *   will be done. (Not yet implemented.)
  *  If follow_link_number returns DO_NOTHING nothing special
  *   will run after it.
  */
-PUBLIC int follow_link_number ARGS2(
+PUBLIC int follow_link_number ARGS4(
 	int,		c,
-	int,		cur)
+	int,		cur,
+	document *,	doc,
+	int *,		num)
 {
     char temp[120];
-    int link_number;
+    int new_top, new_link;
+    BOOL want_go;
 
     temp[0] = c;
     temp[1] = '\0';
+    *num = -1;
     _statusline(FOLLOW_LINK_NUMBER);
     /*
-     *  Get the number from the user.
+     *  Get the number, possibly with a letter suffix, from the user.
      */
     if (LYgetstr(temp, VISIBLE, sizeof(temp), NORECALL) < 0 || *temp == 0) {
         _statusline(CANCELLED);
         sleep(InfoSecs);
         return(DO_NOTHING);
     }
+    *num = atoi(temp);
 
-    link_number = atoi(temp);
+    /*
+     *  Check if we had a 'p' or 'P' following the number as
+     *  a flag for displaying the page with that number. - FM
+     */
+    if (strchr(temp, 'p') != NULL || strchr(temp, 'P') != NULL) {
+        int nlines = HText_getNumOfLines();
+        int npages = ((nlines + 1) > display_lines) ?
+		(((nlines + 1) + (display_lines - 1))/(display_lines))
+						    : 1;
+        if (*num < 1)
+	    *num = 1;
+	doc->line = (npages <= 1) ?
+			        1 :
+		((*num <= npages) ? (((*num - 1) * display_lines) + 1)
+				  : (((npages - 1) * display_lines) + 1));
+	return(DO_GOTOPAGE_STUFF);
+    }
 
-    if (link_number > 0) {
+    /*
+     *  Check if we want to make the link corresponding to the
+     *  number the current link, rather than ACTIVATE-ing it.
+     */
+    want_go = (strchr(temp, 'g') != NULL || strchr(temp, 'G') != NULL);
+ 
+   /*
+    *  If we have a valid number, act on it.
+    */
+   if (*num > 0) {
+	int info;
         /*
-	 *  Get the lname, and hightext, direct from
-	 *  www structures and add it to the cur link
-	 *  so that we can pass it transparently on to
-	 *  get_file().  This is done so that you may select a link
-	 * anywhere in the document, whether it is displayed
-	 * on the screen or not!
+	 *  Get the lname, and hightext, directly from www
+	 *  structures and add it to the cur link so that
+	 *  we can pass it transparently on to getfile(),
+	 *  and load new_top and new_link if we instead want
+	 *  to make the link number current.  These things
+	 *  are done so that a link can be selected anywhere
+	 *  in the current document, whether it is displayed
+	 *  on the screen or not!
 	 */
-	if (HTGetLinkInfo(link_number,
+	if ((info = HTGetLinkInfo(*num,
+				  want_go ? &new_top : NULL,
+				  want_go ? &new_link : NULL,
 			  &links[cur].hightext, 
-			  &links[cur].lname)) {
+			  &links[cur].lname)) == WWW_INTERN_LINK_TYPE) {
+	    links[cur].type = WWW_INTERN_LINK_TYPE;
+	    return(DO_LINK_STUFF);
+	} else if (info == LINK_LINE_FOUND) {
+	    doc->line = new_top + 1;
+	    doc->link = new_link;
+	    return(DO_GOTOLINK_STUFF);
+	} else if (info) {
 	    links[cur].type = WWW_LINK_TYPE;
 	    return(DO_LINK_STUFF);
 	} else {
diff --git a/src/LYGetFile.h b/src/LYGetFile.h
index 2e4faede..8ddfb999 100644
--- a/src/LYGetFile.h
+++ b/src/LYGetFile.h
@@ -7,14 +7,20 @@
 #define NULLFILE 3
 
 extern BOOLEAN getfile PARAMS((document *doc));
-extern int follow_link_number PARAMS((int c, int cur));
+extern int follow_link_number PARAMS((
+	int		c,
+	int		cur,
+	document *	doc,
+	int *		num));
 extern void add_trusted PARAMS((char *str, int type));
 extern BOOLEAN exec_ok PARAMS((CONST char *source, CONST char *linkpath, int type));
 
-/* values for follow_link_number.c */
-#define DO_FORMS_STUFF 1
-#define DO_LINK_STUFF  2
-#define PRINT_ERROR    3
+/* values for follow_link_number() */
+#define DO_LINK_STUFF		1
+#define DO_GOTOLINK_STUFF	2
+#define DO_GOTOPAGE_STUFF	3
+#define DO_FORMS_STUFF		4
+#define PRINT_ERROR		5
 
 /* values for add_trusted() and exec_ok() */
 #define EXEC_PATH 0
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index 5a46b095..0877cfec 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -82,6 +82,10 @@ extern BOOLEAN local_exec_on_local_files; /* TRUE to enable local program  *
 #define NUMBERS_AS_ARROWS 0
 #define LINKS_ARE_NUMBERED 1
 
+#define HIDDENLINKS_MERGE	0
+#define HIDDENLINKS_SEPARATE	1
+#define HIDDENLINKS_IGNORE	2
+
 #define NOVICE_MODE 	  0
 #define INTERMEDIATE_MODE 1
 #define ADVANCED_MODE 	  2
@@ -277,6 +281,13 @@ extern int LYStatusLine;		/* Line for statusline() or -1   */
 extern BOOLEAN LYCollapseBRs;		/* Collapse serial BRs?		 */
 extern BOOLEAN LYSetCookies;		/* Process Set-Cookie headers?	 */
 extern char *XLoadImageCommand;		/* Default image viewer for X	 */
+#ifdef USE_EXTERNALS
+extern BOOLEAN no_externals; /* don't allow the use of externals */
+#endif
+extern BOOLEAN LYNoISMAPifUSEMAP;	/* Omit ISMAP link if MAP present? */
+extern int LYHiddenLinks;
+
+extern BOOL New_DTD; 
 
 #define BOOKMARK_TITLE "Bookmark file"
 #define MOSAIC_BOOKMARK_TITLE "Converted Mosaic Hotlist"
@@ -287,4 +298,10 @@ extern char *XLoadImageCommand;		/* Default image viewer for X	 */
  */
 extern char *MBM_A_subbookmark[MBM_V_MAXFILES+1];
 extern char *MBM_A_subdescript[MBM_V_MAXFILES+1];
+extern FILE *LYTraceLogFP;		/* Pointer for TRACE log	 */
+extern char *LYTraceLogPath;		/* Path for TRACE log		 */
+extern BOOLEAN LYUseTraceLog;		/* Use a TRACE log?		 */
+extern FILE LYOrigStderr;		/* Original stderr pointer	 */
+extern BOOLEAN LYStripDotDotURLs;	/* Try to fix ../ in some URLs?  */
+
 #endif /* LYGLOBALDEFS_H */
diff --git a/src/LYHash.c b/src/LYHash.c
new file mode 100644
index 00000000..49a0696a
--- /dev/null
+++ b/src/LYHash.c
@@ -0,0 +1,33 @@
+/* A hash table for the (fake) CSS support in Lynx-rp
+** (c) 1996 Rob Partington
+*/
+
+#include "LYStructs.h"
+#include "LYCurses.h"
+#include "AttrList.h"
+#include "SGML.h"
+#include "HTMLDTD.h"
+
+#include "LYHash.h"
+
+PUBLIC int hash_table[HASHSIZE]; /* 32K should be big enough */
+
+#if UNUSED
+PUBLIC int hash_code_rp ARGS1(char*,string)
+{
+	char* hash_ptr = string;
+	int hash_tmp = 0xC00A | ((*hash_ptr) << 4);
+
+	while (*hash_ptr++)
+	{
+		hash_tmp ^= (((*hash_ptr)<<4) ^ ((*hash_ptr)<<12));
+		hash_tmp >>= 1;
+	}
+	return (hash_tmp % HASHSIZE);
+}
+#endif
+
+PUBLIC int hash_code ARGS1 (char*, string)
+{
+	return HASH_FUNCTION(string);
+}
diff --git a/src/LYHash.h b/src/LYHash.h
new file mode 100644
index 00000000..474a2cae
--- /dev/null
+++ b/src/LYHash.h
@@ -0,0 +1,33 @@
+#if !defined(_LYHASH_H_)
+#define _LYHASH_H_ 1
+
+struct _hashbucket {
+	char *name; /* name of this item */
+	int	code; /* code of this item */
+	int color; /* color highlighting to be done */
+	int mono; /* mono highlighting to be done */
+	int cattr; /* attributes to go with the color */
+	struct _hashbucket *next; /* next item */
+};
+
+typedef struct _hashbucket bucket;
+	
+#if !defined(HASHSIZE)
+#define HASHSIZE 32768
+#endif
+
+#define NOSTYLE -1
+
+extern bucket hashStyles[HASHSIZE];
+extern int hash_code PARAMS((char*));
+extern int hash_table[HASHSIZE]; /* 32K should be big enough */
+
+extern int	s_alink, s_a, s_status,
+		s_label, s_value, s_high,
+		s_normal, s_alert, s_title;
+#define CACHEW 128
+#define CACHEH 64
+
+extern unsigned cached_styles[CACHEH][CACHEW];
+
+#endif /* _LYHASH_H_ */
diff --git a/src/LYHistory.c b/src/LYHistory.c
index 9b6daabc..b54d8778 100644
--- a/src/LYHistory.c
+++ b/src/LYHistory.c
@@ -78,7 +78,8 @@ PUBLIC void LYAddVisitedLink ARGS1(
 	!strcmp((doc->title ? doc->title : ""), LIST_PAGE_TITLE) ||
 	!strcmp((doc->title ? doc->title : ""), SHOWINFO_TITLE) ||
 	!strcmp((doc->title ? doc->title : ""), COOKIE_JAR_TITLE) ||
-	!strcmp((doc->title ? doc->title : ""), VISITED_LINKS_TITLE)) {
+	!strcmp((doc->title ? doc->title : ""), VISITED_LINKS_TITLE) ||
+	!strcmp((doc->title ? doc->title : ""), LYNX_TRACELOG_TITLE)) {
 	return;
     }
 
@@ -168,9 +169,21 @@ PUBLIC void LYpush ARGS2(
 		history[nhist-1].bookmark : "",
                 doc->bookmark ?
 		doc->bookmark : "") &&
-	history[nhist-1].isHEAD == doc->isHEAD) 
-        return;
+	history[nhist-1].isHEAD == doc->isHEAD) {
+	if (history[nhist-1].internal_link == doc->internal_link) {
+	    /* But it is nice to have the last position remembered!
+	       - kw */
+	    history[nhist].link = doc->link;
+	    history[nhist].page = doc->line;
+ 	    return;
+	}
+    }
 
+#ifdef NOT_USED
+    /* The following segment not used any more - What's it good for,
+       anyway??  Doing a pop when a push is requested is confusing,
+       also to the user.  Moreover, the way it was done seems to cause
+       a memory leak. - kw */
     /*
      *  If file is identical to one two before it, don't push it.
      */
@@ -191,6 +204,7 @@ PUBLIC void LYpush ARGS2(
 	nhist--;
         return;
     }
+#endif	/* NOT_USED */
 
     /*
      *  OK, push it if we have stack space.
@@ -210,9 +224,101 @@ PUBLIC void LYpush ARGS2(
 	StrAllocCopy(history[nhist].bookmark, doc->bookmark);
 	history[nhist].isHEAD = doc->isHEAD;
 	history[nhist].safe = doc->safe;
+
+	history[nhist].internal_link = FALSE; /* by default */
+	history[nhist].intern_seq_start = -1; /* by default */
+	if (doc->internal_link) {
+ 	    /* Now some tricky stuff: if the caller thinks that the doc
+	       to push was the result of following an internal
+	       (fragment) link, we check whether we believe it.
+	       It is only accepted as valid if the immediately preceding
+	       item on the history stack is actually the same document
+	       except for fragment and location info.  I.e. the Parent
+	       Anchors are the same.
+	       Also of course this requires that this is not the first
+	       history item. - kw */
+	    if (nhist > 0) {
+		DocAddress WWWDoc;
+		HTParentAnchor *thisparent, *thatparent = NULL;
+		WWWDoc.address = doc->address;
+		WWWDoc.post_data = doc->post_data;
+		WWWDoc.post_content_type = doc->post_content_type;
+		WWWDoc.bookmark = doc->bookmark;
+		WWWDoc.isHEAD = doc->isHEAD;
+		WWWDoc.safe = doc->safe;
+		thisparent =
+		    HTAnchor_parent(HTAnchor_findAddress(&WWWDoc));
+		/* Now find the ParentAnchor for the previous history
+		** item - kw
+		*/
+		if (thisparent) {
+		    /* If the last-pushed item is a LYNXIMGMAP but THIS one
+		    ** isn't, compare the physical URLs instead. - kw
+		    */
+		    if (0==strncmp(history[nhist-1].address,"LYNXIMGMAP:",11) &&
+			0!=strncmp(doc->address,"LYNXIMGMAP:",11)) {
+			WWWDoc.address = history[nhist-1].address + 11;
+		    /*
+		    ** If THIS item is a LYNXIMGMAP but the last-pushed one
+		    ** isn't, fake it by using THIS item's address for
+		    ** thatparent... - kw
+		    */
+		    } else if ((0==strncmp(doc->address,"LYNXIMGMAP:",11) &&
+		       0!=strncmp(history[nhist-1].address,"LYNXIMGMAP:",11))) {
+			char *temp = NULL;
+			StrAllocCopy(temp, "LYNXIMGMAP:");
+			StrAllocCat(temp, doc->address+11);
+			WWWDoc.address = temp;
+			WWWDoc.post_content_type = history[nhist-1].post_content_type;
+			WWWDoc.bookmark = history[nhist-1].bookmark;
+			WWWDoc.isHEAD = history[nhist-1].isHEAD;
+			WWWDoc.safe = history[nhist-1].safe;
+			thatparent =
+			    HTAnchor_parent(HTAnchor_findAddress(&WWWDoc));
+			FREE(temp);
+		    } else {
+			WWWDoc.address = history[nhist-1].address;
+		    }
+		    if (!thatparent) { /* if not yet done */
+			WWWDoc.post_data = history[nhist-1].post_data;
+			WWWDoc.post_content_type = history[nhist-1].post_content_type;
+			WWWDoc.bookmark = history[nhist-1].bookmark;
+			WWWDoc.isHEAD = history[nhist-1].isHEAD;
+			WWWDoc.safe = history[nhist-1].safe;
+			thatparent =
+			    HTAnchor_parent(HTAnchor_findAddress(&WWWDoc));
+		    }
+		/* In addition to equality of the ParentAnchors, require
+		** that IF we have a HTMainText (i.e. it wasn't just
+		** HTuncache'd by mainloop), THEN it has to be consistent
+		** with what we are trying to push.
+		**   This may be overkill... - kw
+		*/
+		    if (thatparent == thisparent &&
+			(!HTMainText || HTMainAnchor == thisparent)
+			) {
+			history[nhist].internal_link = TRUE;
+			history[nhist].intern_seq_start =
+			    history[nhist-1].intern_seq_start >= 0 ?
+			    history[nhist-1].intern_seq_start : nhist-1;
+			if (TRACE) {
+			    fprintf(stderr,
+				"\nLYpush: pushed as internal link, OK\n");
+			}
+		    }
+		}
+	    }
+	    if (!history[nhist].internal_link) {
+		if (TRACE) {
+		    fprintf(stderr,
+			    "\nLYpush: push as internal link requested, %s\n",
+			    "but didn't check out!");
+		}
+	    }
+	}
 	nhist++;
-   	if (TRACE) {
-    	    fprintf(stderr,
+	if (TRACE) {
+	    fprintf(stderr,
 		    "\nLYpush: address:%s\n        title:%s\n",
 		    doc->address, doc->title);
 	}
@@ -251,6 +357,7 @@ PUBLIC void LYpop ARGS1(
 	doc->bookmark = history[nhist].bookmark; /* will be freed later */
 	doc->isHEAD = history[nhist].isHEAD;
 	doc->safe = history[nhist].safe;
+	doc->internal_link = history[nhist].internal_link;
         if (TRACE) {
 	    fprintf(stderr,
 	    	    "LYpop: address:%s\n     title:%s\n",
@@ -278,6 +385,7 @@ PUBLIC void LYpop_num ARGS2(
 	StrAllocCopy(doc->bookmark, history[number].bookmark);
 	doc->isHEAD = history[number].isHEAD;
 	doc->safe = history[number].safe;
+	doc->internal_link = history[number].internal_link; /* ?? */
     }
 }
 
@@ -320,7 +428,11 @@ PUBLIC int showhistory ARGS1(
     LYforce_HTML_mode = TRUE;	/* force this file to be HTML */
     LYforce_no_cache = TRUE;	/* force this file to be new */
 
-    fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n",
+    fprintf(fp0, "<head>\n");
+#ifdef EXP_CHARTRANS
+    add_META_charset_to_fd(fp0, -1);
+#endif
+    fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n",
 		 HISTORY_PAGE_TITLE);
 
     fprintf(fp0, "<h1>You have reached the History Page</h1>\n");
@@ -339,7 +451,7 @@ PUBLIC int showhistory ARGS1(
 	}
 	fprintf(fp0,
 		"%s<em>%d</em>. <tab id=t%d><a href=\"LYNXHIST:%d\">%s</a>\n",
-		(x > 99 ? "" : x < 9 ? "  " : " "),  
+		(x > 99 ? "" : x < 10 ? "  " : " "),  
 		x, x, x, Title);
 	if (history[x].address != NULL) {
 	    StrAllocCopy(Title, history[x].address);
@@ -347,6 +459,12 @@ PUBLIC int showhistory ARGS1(
 	} else {
 	    StrAllocCopy(Title, "(no address)");
 	}
+	if (history[x].internal_link) {
+	    if (history[x].intern_seq_start == history[nhist-1].intern_seq_start)
+		StrAllocCat(Title, " (internal)");
+	    else
+		StrAllocCat(Title, " (was internal)");
+	}
 	fprintf(fp0, "<tab to=t%d>%s\n", x, Title);
     }
 
@@ -357,6 +475,8 @@ PUBLIC int showhistory ARGS1(
     return(0);
 }
 
+extern BOOL reloading;
+
 /* 
  *  This function makes the history page seem like any other type of
  *  file since more info is needed than can be provided by the normal
@@ -370,6 +490,7 @@ PUBLIC BOOLEAN historytarget ARGS1(
     DocAddress WWWDoc;
     HTParentAnchor *tmpanchor;
     HText *text;
+    BOOLEAN treat_as_intern = FALSE;
 
     if ((!newdoc || !newdoc->address) ||
         strlen(newdoc->address) < 10 || !isdigit(*(newdoc->address+9)))
@@ -379,7 +500,14 @@ PUBLIC BOOLEAN historytarget ARGS1(
         return(FALSE);
 
     LYpop_num(number, newdoc);
-
+    if (newdoc->internal_link &&
+	history[number].intern_seq_start == history[nhist-1].intern_seq_start) {
+	LYforce_no_cache = FALSE;
+	LYoverride_no_cache = TRUE;
+	treat_as_intern = TRUE;
+    } else {
+	newdoc->internal_link = FALSE;
+    }
     /*
      *  If we have POST content, and have LYresubmit_posts set
      *  or have no_cache set or do not still have the text cached,
@@ -394,9 +522,10 @@ PUBLIC BOOLEAN historytarget ARGS1(
 	WWWDoc.safe = newdoc->safe;
 	tmpanchor = HTAnchor_parent(HTAnchor_findAddress(&WWWDoc));
 	text = (HText *)HTAnchor_document(tmpanchor);
-        if (((LYresubmit_posts == TRUE) ||
-	     (LYforce_no_cache == TRUE &&
-	      LYoverride_no_cache == FALSE) ||
+        if (((((LYresubmit_posts == TRUE) ||
+	       (LYforce_no_cache == TRUE &&
+		LYoverride_no_cache == FALSE)) &&
+	      !(treat_as_intern && !reloading)) ||
 	     text == NULL) &&
 	    HTConfirm(CONFIRM_POST_RESUBMISSION) == TRUE) {
 	    LYforce_no_cache = TRUE;
@@ -462,7 +591,11 @@ PUBLIC int LYShowVisitedLinks ARGS1(
     LYforce_HTML_mode = TRUE;	/* force this file to be HTML */
     LYforce_no_cache = TRUE;	/* force this file to be new */
 
-    fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n",
+    fprintf(fp0, "<head>\n");
+#ifdef EXP_CHARTRANS
+    add_META_charset_to_fd(fp0, -1);
+#endif
+    fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n",
 		 VISITED_LINKS_TITLE);
 
     fprintf(fp0, "<h1>You have reached the Visited Links Page</h1>\n");
@@ -487,12 +620,12 @@ PUBLIC int LYShowVisitedLinks ARGS1(
 	    LYEntify(&Address, FALSE);
 	    fprintf(fp0,
 		    "%s<em>%d</em>. <tab id=t%d><a href=\"%s\">%s</a>\n",
-		    (x > 99 ? "" : x < 9 ? "  " : " "),
+		    (x > 99 ? "" : x < 10 ? "  " : " "),
 		    x, x, Address, Title);
 	} else {
 	    fprintf(fp0,
 		    "%s<em>%d</em>. <tab id=t%d><em>%s</em>\n",
-		    (x > 99 ? "" : x < 9 ? "  " : " "),
+		    (x > 99 ? "" : x < 10 ? "  " : " "),
 		    x, x, Title);
 	}
 	if (Address != NULL) {
diff --git a/src/LYJump.c b/src/LYJump.c
index e5e67871..739c1e2f 100644
--- a/src/LYJump.c
+++ b/src/LYJump.c
@@ -378,7 +378,7 @@ PRIVATE unsigned LYRead_Jumpfile ARGS1(struct JumpTable *,jtp)
     BOOL IsStream_LF = TRUE;
 #endif /* VMS */
     char *cp;
-    int i;
+    unsigned i;
 
     if (jtp->file == NULL || *(jtp->file) == '\0')
 	return 0;
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index af1e19de..d3dee733 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -43,7 +43,7 @@ LYK_UP_TWO,             0,          LYK_RELOAD,        0,
 LYK_TRACE_TOGGLE,       0,          LYK_VERSION,   LYK_REFRESH,
 /* ^T */            /* ^U */        /* ^V */       /* ^W */
 #endif /* NOT_USED */
-LYK_TRACE_TOGGLE,       0,              0,         LYK_REFRESH,
+LYK_TRACE_TOGGLE,       0,        LYK_SWITCH_DTD,  LYK_REFRESH,
 /* ^T */            /* ^U */        /* ^V */       /* ^W */
 
 0,                      0,              0,             0,
@@ -61,16 +61,21 @@ LYK_NEXT_PAGE,       LYK_SHELL,  LYK_SOFT_DQUOTES,  LYK_TOOLBAR,
 LYK_UP_HALF,      LYK_DOWN_HALF, LYK_IMAGE_TOGGLE,  LYK_NEXT_PAGE,
 /* ( */              /* ) */         /* * */        /* + */
 
+#ifndef USE_EXTERNALS
 LYK_NEXT_PAGE,    LYK_PREV_PAGE,        0,          LYK_WHEREIS,
 /* , */              /* - */         /* . */        /* / */
+#else
+LYK_NEXT_PAGE,    LYK_PREV_PAGE, LYK_EXTERN,        LYK_WHEREIS,
+/* , */              /* - */         /* . */        /* / */
+#endif
 
-0,                   LYK_1,          LYK_2,         LYK_3,
+LYK_F_LINK_NUM,      LYK_1,          LYK_2,         LYK_3,
 /* 0 */              /* 1 */         /* 2 */        /* 3 */
 
 LYK_4,               LYK_5,          LYK_6,         LYK_7,
 /* 4 */              /* 5 */         /* 6 */        /* 7 */
 
-LYK_8,               LYK_9,             0,             0,
+LYK_8,               LYK_9,             0,          LYK_TRACE_LOG,
 /* 8 */              /* 9 */         /* : */        /* ; */
 
 LYK_UP_LINK,         LYK_INFO,     LYK_DOWN_LINK,   LYK_HELP,
@@ -166,7 +171,7 @@ LYK_NOCACHE,            0,          LYK_INTERRUPT,     0,
 LYK_PIPE,               0,              0,          LYK_HISTORY,
 /* | */               /* } */         /* ~ */       /* del */
 
-/* 80..99 (illegal ISO-8859-1) 8-bit characters. */
+/* 80..9F (illegal ISO-8859-1) 8-bit characters. */
    0,                  0,              0,             0,
    0,                  0,              0,             0,
    0,                  0,              0,             0,
@@ -267,17 +272,17 @@ char override[] = {
     0,                 0,         LYK_TAG_LINK,      0,
 /* , */             /* - */         /* . */       /* / */
 
-   0,                 0,               0,            0,
-/* 0 */             /* 1 */        /* 2 */        /* 3 */
+   0,                  0,              0,            0,
+/* 0 */             /* 1 */         /* 2 */       /* 3 */
 
-   0,                 0,               0,            0,
-/* 4 */             /* 5 */        /* 6 */        /* 7 */
+   0,                  0,              0,            0,
+/* 4 */             /* 5 */         /* 6 */       /* 7 */
 
-   0,                 0,              0,             0,
-/* 8 */             /* 9 */        /* : */        /* ; */
+   0,                  0,              0,             0,
+/* 8 */             /* 9 */         /* : */        /* ; */
 
-   0,                 0,              0,             0,
-/* < */             /* = */        /* > */        /* ? */
+   0,                  0,              0,             0,
+/* < */             /* = */         /* > */        /* ? */
 
    0,                  0,              0,         LYK_CREATE,
 /* @ */             /* A */         /* B */        /* C */
@@ -327,7 +332,7 @@ LYK_TAG_LINK,      LYK_UPLOAD,         0,             0,
    0,                   0,             0,              0,
 /* | */              /* } */         /* ~ */       /* del */
 
-/* 80..99 (illegal ISO-8859-1) 8-bit characters. */
+/* 80..9F (illegal ISO-8859-1) 8-bit characters. */
    0,                  0,              0,             0,
    0,                  0,              0,             0,
    0,                  0,              0,             0,
@@ -441,6 +446,7 @@ PRIVATE struct rmap revmap[] = {
 { "SHELL",		"escape from the browser to the system" },
 { "DOWNLOAD",		"download the current link to your computer" },
 { "TRACE_TOGGLE",	"toggle tracing of browser operations" },
+{ "TRACE_LOG",		"view trace log if started in the current session" },
 { "IMAGE_TOGGLE",	"toggle handling of all images as links" },
 { "INLINE_TOGGLE",	"toggle pseudo-ALTs for inlines with no ALT string" },
 { "HEAD",		"send a HEAD request for the current document or link" },
@@ -454,7 +460,12 @@ PRIVATE struct rmap revmap[] = {
 { "MINIMAL",		"toggle minimal vs. valid comment parsing" },
 { "SOFT_DQUOTES",	"toggle valid vs. soft double-quote parsing" },
 { "RAW_TOGGLE",		"toggle raw 8-bit translations or CJK mode ON or OFF" },
-{ "COOKIE_JAR",		"Examine the Cookie Jar" },
+{ "COOKIE_JAR",		"examine the Cookie Jar" },
+{ "F_LINK_NUM",		"invoke the 'Follow link (or page) number:' prompt" },
+{ "SWITCH_DTD",		"switch between old and new parsing of HTML" },
+#ifdef USE_EXTERNALS
+{ "EXTERN",		"run external program with url" },
+#endif
 #ifdef VMS
 { "DIRED_MENU",		"invoke File/Directory Manager, if available" },
 #else
@@ -559,6 +570,7 @@ PRIVATE int LYLoadKeymap ARGS4 (
 	HTAlert(buf);
 	return(HT_NOT_LOADED);
     }
+    anAnchor->no_cache = TRUE;
 
     sprintf(buf, "<head>\n<title>%s</title>\n</head>\n<body>\n",
     		  CURRENT_KEYMAP_TITLE);
@@ -698,52 +710,59 @@ static BOOLEAN did_number_keys;
 
 PUBLIC void set_numbers_as_arrows NOARGS
 {
-      saved_number_keys[0] = keymap['4'+1];
-      keymap['4'+1] = LYK_PREV_DOC;
-      saved_number_keys[1] = keymap['2'+1];
-      keymap['2'+1] = LYK_NEXT_LINK;
-      saved_number_keys[2] = keymap['8'+1];
-      keymap['8'+1] = LYK_PREV_LINK;
-      saved_number_keys[3] = keymap['6'+1];
-      keymap['6'+1] = LYK_ACTIVATE;
-      saved_number_keys[4] = keymap['7'+1];
-      keymap['7'+1] = LYK_HOME;
-      saved_number_keys[5] = keymap['1'+1];
-      keymap['1'+1] = LYK_END;
-      saved_number_keys[6] = keymap['9'+1];
-      keymap['9'+1] = LYK_PREV_PAGE;
-      saved_number_keys[7] = keymap['3'+1];
-      keymap['3'+1] = LYK_NEXT_PAGE;
-
-	/* disable the 5 */
-      saved_number_keys[8] = keymap['5'+1];
-      keymap['5'+1] = LYK_DO_NOTHING;
-
-      did_number_keys = TRUE;
+    /*
+     *  Map numbers to functions as labeled on the
+     *  IBM Enhanced keypad, and save their original
+     *  mapping for reset_numbers_as_arrows(). - FM
+     */
+    saved_number_keys[0] = keymap['4'+1];
+    keymap['4'+1] = LYK_PREV_DOC;
+    saved_number_keys[1] = keymap['2'+1];
+    keymap['2'+1] = LYK_NEXT_LINK;
+    saved_number_keys[2] = keymap['8'+1];
+    keymap['8'+1] = LYK_PREV_LINK;
+    saved_number_keys[3] = keymap['6'+1];
+    keymap['6'+1] = LYK_ACTIVATE;
+    saved_number_keys[4] = keymap['7'+1];
+    keymap['7'+1] = LYK_HOME;
+    saved_number_keys[5] = keymap['1'+1];
+    keymap['1'+1] = LYK_END;
+    saved_number_keys[6] = keymap['9'+1];
+    keymap['9'+1] = LYK_PREV_PAGE;
+    saved_number_keys[7] = keymap['3'+1];
+    keymap['3'+1] = LYK_NEXT_PAGE;
+
+    /*
+     *  Disable the 5.
+     */
+    saved_number_keys[8] = keymap['5'+1];
+    keymap['5'+1] = LYK_DO_NOTHING;
+
+    did_number_keys = TRUE;
 }
 
 PUBLIC void reset_numbers_as_arrows NOARGS
 {
-      if (!did_number_keys)
-              return;
-
-      keymap['4'+1] = saved_number_keys[0];
-      keymap['2'+1] = saved_number_keys[1];
-      keymap['8'+1] = saved_number_keys[2];
-      keymap['6'+1] = saved_number_keys[3];
-      keymap['7'+1] = saved_number_keys[4];
-      keymap['1'+1] = saved_number_keys[5];
-      keymap['9'+1] = saved_number_keys[6];
-      keymap['3'+1] = saved_number_keys[7];
-      keymap['5'+1] = saved_number_keys[8];
-
-      did_number_keys = FALSE;
+    if (!did_number_keys)
+	return;
+
+    keymap['4'+1] = saved_number_keys[0];
+    keymap['2'+1] = saved_number_keys[1];
+    keymap['8'+1] = saved_number_keys[2];
+    keymap['6'+1] = saved_number_keys[3];
+    keymap['7'+1] = saved_number_keys[4];
+    keymap['1'+1] = saved_number_keys[5];
+    keymap['9'+1] = saved_number_keys[6];
+    keymap['3'+1] = saved_number_keys[7];
+    keymap['5'+1] = saved_number_keys[8];
+
+    did_number_keys = FALSE;
 }
 
 PUBLIC char *key_for_func ARGS1 (int,func)
 {
 	static char buf[512];
-	int i;
+	size_t i;
 
 	buf[0] = '\0';
 	for (i = 1; i < sizeof(keymap); i++) {
diff --git a/src/LYKeymap.h b/src/LYKeymap.h
index c5b42c19..b704c2d3 100644
--- a/src/LYKeymap.h
+++ b/src/LYKeymap.h
@@ -76,37 +76,46 @@ extern char override[];
 #define       LYK_SHELL 	52
 #define       LYK_DOWNLOAD      53
 #define       LYK_TRACE_TOGGLE  54
-#define       LYK_IMAGE_TOGGLE  55
-#define       LYK_INLINE_TOGGLE 56
-#define       LYK_HEAD          57
-#define       LYK_DO_NOTHING    58
-#define       LYK_TOGGLE_HELP	59
-#define       LYK_JUMP		60
-#define       LYK_KEYMAP	61
-#define       LYK_LIST		62
-#define       LYK_TOOLBAR	63
-#define       LYK_HISTORICAL	64
-#define       LYK_MINIMAL	65
-#define       LYK_SOFT_DQUOTES	66
-#define       LYK_RAW_TOGGLE	67
-#define       LYK_COOKIE_JAR    68
+#define       LYK_TRACE_LOG     55
+#define       LYK_IMAGE_TOGGLE  56
+#define       LYK_INLINE_TOGGLE 57
+#define       LYK_HEAD          58
+#define       LYK_DO_NOTHING    59
+#define       LYK_TOGGLE_HELP	60
+#define       LYK_JUMP		61
+#define       LYK_KEYMAP	62
+#define       LYK_LIST		63
+#define       LYK_TOOLBAR	64
+#define       LYK_HISTORICAL	65
+#define       LYK_MINIMAL	66
+#define       LYK_SOFT_DQUOTES	67
+#define       LYK_RAW_TOGGLE	68
+#define       LYK_COOKIE_JAR    69
+#define       LYK_F_LINK_NUM    70
+#define       LYK_SWITCH_DTD	71
 
-#ifdef VMS
-#define       LYK_DIRED_MENU    69
-#endif /* VMS */
+#ifdef USE_EXTERNALS
+#define       LYK_EXTERN    72
+#if defined(VMS) || defined(DIRED_SUPPORT)
+#define		LYK_DIRED_MENU	73
+#endif /* VMS || DIRED_SUPPORT */
+#else  /* USE_EXTERNALS */
+#if defined(VMS) || defined(DIRED_SUPPORT)
+#define		LYK_DIRED_MENU	72
+#endif /* VMS || DIRED_SUPPORT */
+#endif /* !defined(USE_EXTERNALS) */
 #ifdef DIRED_SUPPORT
-#define       LYK_DIRED_MENU    69
-#define       LYK_CREATE        70
-#define       LYK_REMOVE        71
-#define       LYK_MODIFY        72
-#define       LYK_TAG_LINK      73
-#define       LYK_UPLOAD        74
-#define       LYK_INSTALL       75
+#define       LYK_CREATE        (LYK_DIRED_MENU+1)
+#define       LYK_REMOVE        (LYK_DIRED_MENU+2)
+#define       LYK_MODIFY        (LYK_DIRED_MENU+3)
+#define       LYK_TAG_LINK      (LYK_DIRED_MENU+4)
+#define       LYK_UPLOAD        (LYK_DIRED_MENU+5)
+#define       LYK_INSTALL       (LYK_DIRED_MENU+6)
 #endif /* DIRED_SUPPORT */
 #ifdef NOT_USED
-#define       LYK_VERSION	76
-#define       LYK_FORM_UP       77
-#define       LYK_FORM_DOWN     78
+#define       LYK_VERSION	80
+#define       LYK_FORM_UP       81
+#define       LYK_FORM_DOWN     82
 #endif /* NOT_USED */
 
 #endif /* LYKEYMAP_H */
diff --git a/src/LYLeaks.c b/src/LYLeaks.c
index 7ce360b4..8bdc8694 100644
--- a/src/LYLeaks.c
+++ b/src/LYLeaks.c
@@ -98,7 +98,7 @@ PUBLIC void LYLeaks NOARGS	{
 			}
 		}
 		else	{
-			int i_counter;
+			size_t i_counter;
 
 			/*
 			 *	Increment the count of total memory lost and
diff --git a/src/LYList.c b/src/LYList.c
index 59f6d497..66c02dbb 100644
--- a/src/LYList.c
+++ b/src/LYList.c
@@ -34,18 +34,31 @@
 **			Clear:  we only get addresses.
 */
 
+static char list_filename[256] = "\0";
+
+PUBLIC char * LYlist_temp_url NOARGS
+{
+    return list_filename;
+}
+
 PUBLIC int showlist ARGS2(char **, newfile, BOOLEAN, titles)
 {
     int cnt;
-    int refs;
+    int refs, hidden_links;
     static char tempfile[256];
     static BOOLEAN first = TRUE;
-    static char list_filename[256];
     FILE *fp0;
     char *Address = NULL, *Title = NULL, *cp = NULL;
 
     refs = HText_sourceAnchors(HTMainText);
-    if (refs <= 0) {
+    hidden_links = HText_HiddenLinkCount(HTMainText);
+    if (refs <= 0 && hidden_links > 0 &&
+	LYHiddenLinks != HIDDENLINKS_SEPARATE) {
+	_statusline(NO_VISIBLE_REFS_FROM_DOC);
+	sleep(MessageSecs);
+	return(-1);
+    }
+    if (refs <= 0 && hidden_links <= 0) {
 	_statusline(NO_REFS_FROM_DOC);
 	sleep(MessageSecs);
 	return(-1);
@@ -60,7 +73,7 @@ PUBLIC int showlist ARGS2(char **, newfile, BOOLEAN, titles)
 #endif /* VMS */
     }
 
-    if ((fp0 = fopen(tempfile,"w")) == NULL) {
+    if ((fp0 = fopen(tempfile, "w")) == NULL) {
 	_statusline(CANNOT_OPEN_TEMP);
 	sleep(MessageSecs);
 	return(-1);
@@ -75,34 +88,53 @@ PUBLIC int showlist ARGS2(char **, newfile, BOOLEAN, titles)
     sprintf(list_filename, "file://localhost%s", tempfile);
 #endif /* VMS */
     StrAllocCopy(*newfile, list_filename);
-    LYforce_HTML_mode=TRUE; /* force this file to be HTML */
-    LYforce_no_cache=TRUE; /* force this file to be new */
+    LYforce_HTML_mode = TRUE; /* force this file to be HTML */
+    LYforce_no_cache = TRUE; /* force this file to be new */
 
-    fprintf(fp0,"<head>\n<title>%s</title>\n</head>\n<body>\n",
-						LIST_PAGE_TITLE);
 
-    fprintf(fp0,"<h1>You have reached the List Page</h1>\n");
-    fprintf(fp0,"<h2>%s Version %s</h2>\n", LYNX_NAME, LYNX_VERSION);
+    fprintf(fp0, "<head>\n");
+#ifdef EXP_CHARTRANS
+    add_META_charset_to_fd(fp0, -1);
+#endif
+    fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n",
+		 LIST_PAGE_TITLE);
+
+    fprintf(fp0, "<h1>You have reached the List Page</h1>\n");
+    fprintf(fp0, "<h2>%s Version %s</h2>\n", LYNX_NAME, LYNX_VERSION);
 
     fprintf(fp0, "  References in this document:<p>\n");
     fprintf(fp0, "<%s compact>\n", (keypad_mode == LINKS_ARE_NUMBERED) ?
     				   "ul" : "ol");
+    if (hidden_links > 0) {
+        fprintf(fp0, "<lh><em>Visible links:</em>\n");
+	if (LYHiddenLinks == HIDDENLINKS_IGNORE)
+	    hidden_links = 0;
+    }
     for (cnt=1; cnt<=refs; cnt++) {
-	HTAnchor *dest = HTAnchor_followMainLink((HTAnchor *)
-						 HText_childNumber(cnt));
+	HTChildAnchor *child = HText_childNumber(cnt);
+	HTAnchor *dest_intl = HTAnchor_followTypedLink((HTAnchor *)child,
+						       LINK_INTERNAL);
+	HTAnchor *dest = dest_intl ?
+	    dest_intl : HTAnchor_followMainLink((HTAnchor *)child);
 	HTParentAnchor *parent = HTAnchor_parent(dest);
 	char *address =  HTAnchor_address(dest);
 	CONST char *title = titles ? HTAnchor_title(parent) : NULL;
 
 	StrAllocCopy(Address, address);
 	FREE(address);
-	LYEntify(&Address, FALSE);
-	if (title) {
+	LYEntify(&Address, TRUE);
+	if (title && *title) {
 	    StrAllocCopy(Title, title);
-	    LYEntify(&Title, TRUE);
+	    if (*Title)
+		LYEntify(&Title, TRUE);
+	    else
+		FREE(Title);
 	    cp = strchr(Address, '#');
 	}
-        fprintf(fp0, "<li><a href=\"%s\">%s%s%s%s</a>\n", Address,
+
+        fprintf(fp0, "<li><a href=\"%s\"%s>%s%s%s%s%s</a>\n", Address,
+		        dest_intl ? " TYPE=\"internal link\"" : "", 
+		        dest_intl ? "(internal) " : "", 
 			((HTAnchor*)parent != dest) && Title ? "in " : "",
 			(char *)(Title ? Title : Address),
 			(Title && cp) ? " - " : "",
@@ -112,6 +144,28 @@ PUBLIC int showlist ARGS2(char **, newfile, BOOLEAN, titles)
 	FREE(Title);
     }
 
+    if (hidden_links > 0) {
+        if (refs > 0)
+	    fprintf(fp0, "\n</%s>\n\n<p>\n",
+	    		 (keypad_mode == LINKS_ARE_NUMBERED) ?
+							"ul" : "ol");
+        fprintf(fp0, "<%s compact>\n", (keypad_mode == LINKS_ARE_NUMBERED) ?
+    				       "ul" : "ol continue");
+        fprintf(fp0, "<lh><em>Hidden links:</em>\n");
+    }
+
+    for (cnt = 0; cnt < hidden_links; cnt++) {
+	StrAllocCopy(Address, HText_HiddenLinkAt(HTMainText, cnt));
+	LYEntify(&Address, FALSE);
+	if (!(Address && *Address)) {
+	    FREE(Address);
+	    continue;
+	}
+        fprintf(fp0, "<li><a href=\"%s\">%s</a>\n", Address, Address);
+
+	FREE(Address);
+    }
+
     fprintf(fp0,"\n</%s>\n</body>\n", (keypad_mode == LINKS_ARE_NUMBERED) ?
     				      "ul" : "ol");
 
@@ -130,27 +184,40 @@ PUBLIC int showlist ARGS2(char **, newfile, BOOLEAN, titles)
 **			Clear:  we only get addresses.
 */
 
-PUBLIC void printlist ARGS2(FILE *, fp, BOOLEAN, titles)
+PUBLIC void printlist ARGS2(
+	FILE *,		fp,
+	BOOLEAN,	titles)
 {
 #ifdef VMS
     extern BOOLEAN HadVMSInterrupt;
 #endif /* VMS */
     int cnt;
-    int refs;
+    int refs, hidden_links;
+    char *address = NULL;
+
     refs = HText_sourceAnchors(HTMainText);
-    if (refs <= 0) {
+    if (refs <= 0 && LYHiddenLinks != HIDDENLINKS_SEPARATE)
+        return;
+    hidden_links = HText_HiddenLinkCount(HTMainText);
+    if (refs <= 0 && hidden_links <= 0) {
         return;
     } else {
 	fprintf(fp, "\n%s\n\n", "References");
-	for (cnt=1; cnt<=refs; cnt++) {
+	if (hidden_links > 0) {
+	    fprintf(fp, "   Visible links:\n");
+	    if (LYHiddenLinks == HIDDENLINKS_IGNORE)
+		hidden_links = 0;
+	}
+	for (cnt = 1; cnt <= refs; cnt++) {
 	    HTAnchor *dest =
 		HTAnchor_followMainLink((HTAnchor *)
 					HText_childNumber(cnt));
 	    HTParentAnchor * parent = HTAnchor_parent(dest);
-	    char * address =  HTAnchor_address(dest);
 	    CONST char * title = titles ? HTAnchor_title(parent) : NULL;
+
+	    address =  HTAnchor_address(dest);
 	    fprintf(fp, "%4d. %s%s\n", cnt,
-		    ((HTAnchor*)parent!=dest) && title ? "in " : "",
+		    ((HTAnchor*)parent != dest) && title ? "in " : "",
 		    (char *)(title ? title : address));
 	    FREE(address);
 #ifdef VMS
@@ -158,6 +225,22 @@ PUBLIC void printlist ARGS2(FILE *, fp, BOOLEAN, titles)
 	        break;
 #endif /* VMS */
 	}
+
+	if (hidden_links > 0)
+	    fprintf(fp, "%s   Hidden links:\n", ((refs > 0) ? "\n" : ""));
+	for (cnt = 0; cnt < hidden_links; cnt++) {
+	    StrAllocCopy(address, HText_HiddenLinkAt(HTMainText, cnt));
+	    if (!(address && *address)) {
+		FREE(address);
+		continue;
+	    }
+	    fprintf(fp, "%4d. %s\n", ((cnt + 1) + refs), address);
+	    FREE(address);
+#ifdef VMS
+	    if (HadVMSInterrupt)
+	        break;
+#endif /* VMS */
+	}
     }
     return;
 }      
diff --git a/src/LYList.h b/src/LYList.h
index 1d14c687..e1e0b8de 100644
--- a/src/LYList.h
+++ b/src/LYList.h
@@ -2,6 +2,7 @@
 #ifndef LYLIST_H
 #define LYLIST_H
 
+extern char * LYlist_temp_url NOPARAMS;
 extern int showlist PARAMS((char **newfile, BOOLEAN titles));
 extern void printlist PARAMS((FILE *fp, BOOLEAN titles));
 
diff --git a/src/LYMail.c b/src/LYMail.c
index b943efb2..271d2af3 100644
--- a/src/LYMail.c
+++ b/src/LYMail.c
@@ -11,6 +11,10 @@
 #include "LYGlobalDefs.h"
 #include "HTParse.h"
 #include "LYMail.h"
+#ifdef EXP_CHARTRANS
+#include "LYCharSets.h"  /* to get current charset for mail header */
+extern BOOLEAN LYHaveCJKCharacterSet;
+#endif
 
 #include "LYLeaks.h"
 
@@ -713,6 +717,28 @@ PUBLIC void reply_by_mail ARGS3(
     sprintf(buf,"To: %s\n", address);
     StrAllocCopy(header, buf);
 #endif
+
+#ifdef EXP_CHARTRANS
+    /*
+     *  Put the Mime-Version, Content-Type and
+     *  Content-Transfer-Encoding in the header.
+     *  This assumes that the same character set is used
+     *  for composing the mail which is currently selected
+     *  as display character set...
+     *  Don't send a charset if we have a CJK character set
+     *  selected, since it may not be appropriate for mail...
+     *  Also don't use an inofficial "x-" charset. - kw
+     */
+    StrAllocCat(header, "Mime-Version: 1.0\n");
+    if (!LYHaveCJKCharacterSet &&
+	strncasecomp(LYCharSet_UC[current_char_set].MIMEname, "x-", 2)
+	!= 0) {
+	sprintf(buf,"Content-Type: text/plain; charset=%s\n",
+		LYCharSet_UC[current_char_set].MIMEname);
+	StrAllocCat(header, buf);
+    }
+    StrAllocCat(header, "Content-Transfer-Encoding: 8bit\n");
+#endif
     /*
      *  Put the X-URL and X-Mailer lines in the header.
      */
diff --git a/src/LYMain.c b/src/LYMain.c
index b6a36167..85d7d55e 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -9,6 +9,7 @@
 #endif /* VMS */
 #include "HTInit.h"
 #include "LYCurses.h"
+#include "LYStyle.h"
 #include "HTML.h"
 #include "LYUtils.h"
 #include "LYGlobalDefs.h"
@@ -26,6 +27,7 @@
 #include "LYKeymap.h"
 #include "LYList.h"
 #include "LYJump.h"
+#include "LYMainLoop.h"
 #include "LYBookmark.h"
 #ifdef DOSPATH
 #include "HTDOS.h"
@@ -143,6 +145,10 @@ PUBLIC lynx_printer_item_type *printers = NULL;
 			    /* linked list of download options */
 PUBLIC lynx_html_item_type *downloaders = NULL;
 			    /* linked list of upload options */
+#ifdef USE_EXTERNALS
+PUBLIC lynx_html_item_type *externals = NULL;
+                            /* linked list of external options */
+#endif
 PUBLIC lynx_html_item_type *uploaders = NULL;
 PUBLIC int port_syntax = 1;
 PUBLIC BOOLEAN LYShowCursor = SHOW_CURSOR; /* to show or not to show */
@@ -180,6 +186,9 @@ PUBLIC BOOLEAN news_ok = TRUE;
 PUBLIC BOOLEAN rlogin_ok = TRUE;
 PUBLIC BOOLEAN ftp_ok = TRUE;
 PUBLIC BOOLEAN system_editor = FALSE;
+#ifdef USE_EXTERNALS
+PUBLIC BOOLEAN no_externals = FALSE;
+#endif
 PUBLIC BOOLEAN no_inside_telnet = FALSE;
 PUBLIC BOOLEAN no_outside_telnet = FALSE;
 PUBLIC BOOLEAN no_telnet_port = FALSE;
@@ -328,6 +337,15 @@ PUBLIC int LYStatusLine = -1;		 /* Line for statusline() if > -1 */
 PUBLIC BOOLEAN LYCollapseBRs = COLLAPSE_BR_TAGS;  /* Collapse serial BRs? */
 PUBLIC BOOLEAN LYSetCookies = SET_COOKIES; /* Process Set-Cookie headers? */
 PUBLIC char *XLoadImageCommand = NULL;	/* Default image viewer for X */
+PUBLIC BOOLEAN LYNoISMAPifUSEMAP = FALSE; /* Omit ISMAP link if MAP present? */
+PUBLIC int LYHiddenLinks = HIDDENLINKS_SEPARATE; /* Show hidden links? */
+
+PUBLIC BOOL New_DTD = YES;
+PUBLIC FILE *LYTraceLogFP = NULL;		/* Pointer for TRACE log  */
+PUBLIC char *LYTraceLogPath = NULL;		/* Path for TRACE log	   */
+PUBLIC BOOLEAN LYUseTraceLog = USE_TRACE_LOG;	/* Use a TRACE log?	   */
+PUBLIC FILE LYOrigStderr;			/* Original stderr pointer */
+PUBLIC BOOLEAN LYStripDotDotURLs = FALSE;	/* Try to fix ../ in some URLs? */
 
 /* These are declared in cutil.h for current freeWAIS libraries. - FM */
 #ifdef DECLARE_WAIS_LOGFILES
@@ -425,6 +443,7 @@ PRIVATE void free_lynx_globals NOARGS
     FREE(URLDomainPrefixes);
     FREE(URLDomainSuffixes);
     FREE(XLoadImageCommand);
+    FREE(LYTraceLogPath);
     for (i = 0; i < nlinks; i++) {
         FREE(links[i].lname);
     }
@@ -433,6 +452,37 @@ PRIVATE void free_lynx_globals NOARGS
     return;
 }
 
+#if defined(USEHASH)
+    char *lynx_lss_file=NULL;
+#endif
+
+PRIVATE char *make_homedir_lynxrc_filename ARGS1(char *, name)
+{
+   char *home = NULL;
+
+   if (name == NULL)
+     {
+#if defined(UNIX) && !defined(DJGPP)
+	name = "/.lynxrc";
+#else
+	name = "/lynx.rc";
+#endif
+     }
+
+#ifdef DOSPATH
+   StrAllocCopy(home, HTDOS_wwwName((char *)Home_Dir()));
+#else
+#ifdef VMS
+   StrAllocCopy(home, HTVMS_wwwName((char *)Home_Dir()));
+#else
+   StrAllocCopy(home, Home_Dir());
+#endif /* VMS */
+#endif /* DOSPATH */
+   
+   StrAllocCat(home, name);
+   return home;
+}
+
 /*
  * Wow!  Someone wants to start up Lynx.
  */
@@ -474,7 +524,7 @@ WSADATA WSAData;
 #endif
 
 #ifdef DOSPATH
-	 terminal = "vt100";
+    terminal = "vt100";
 #endif
 
     /*
@@ -549,23 +599,6 @@ WSADATA WSAData;
 	HTUnEscapeSome(startfile, " \r\n\t");
 	convert_to_spaces(startfile, TRUE);
     }
-    StrAllocCopy(jumpprompt, JUMP_PROMPT);
-#ifdef JUMPFILE
-    StrAllocCopy(jumpfile, JUMPFILE);
-    {
-        temp = (char *)malloc(strlen(jumpfile) + 10);
-	if (!temp) {
-	    outofmem(__FILE__, "main");
-	} else {
-	    sprintf(temp, "JUMPFILE:%s", jumpfile);
-	    if (!LYJumpInit(temp)) {
-		if (TRACE)
-		    fprintf(stderr, "Failed to register %s\n", temp);
-	    }
-	    FREE(temp);
-	}
-    }
-#endif /* JUMPFILE */
     StrAllocCopy(indexfile, DEFAULT_INDEX_FILE);
     StrAllocCopy(global_type_map, GLOBAL_MAILCAP);
     StrAllocCopy(personal_type_map, PERSONAL_MAILCAP);
@@ -683,17 +716,30 @@ WSADATA WSAData;
     no_newspost = (LYNewsPosting == FALSE);
 
     /*
-     *  Set up trace, the anonymous account defaults, and/or
-     *  the nosocks flag, if requested, and an alternate
-     *  configuration file, if specified, NOW.  Also, if
-     *  we only want the help menu, output that and exit. - FM
+     *  Set up trace, the anonymous account defaults,
+     *  validate restrictions, and/or the nosocks flag,
+     *  if requested, and an alternate configuration
+     *  file, if specified, NOW.  Also, if we only want
+     *  the help menu, output that and exit. - FM
      */
-    for (i=1; i<argc; i++) {
+    for (i = 1; i < argc; i++) {
 	if (strncmp(argv[i], "-trace", 6) == 0) {
 	    WWW_TraceFlag = TRUE;
+	} else if (strncmp(argv[i], "-tlog", 5) == 0) {
+	    if (LYUseTraceLog) {
+	        LYUseTraceLog = FALSE;
+	    } else {
+	        LYUseTraceLog = TRUE;
+	    }
 	} else if (strncmp(argv[i], "-anonymous", 10) == 0) {
-	    parse_restrictions("default");
+	    if (!LYValidate)
+	        parse_restrictions("default");
 	    anon_restrictions_set = TRUE;
+	} else if (strcmp(argv[0], "-validate") == 0) {
+	    /*
+	     *  Follow only http URLs.
+	     */
+	    LYValidate = TRUE;
 #ifdef SOCKS
 	} else if (strncmp(argv[i], "-nosocks", 8) == 0) {
 	    socks_flag = FALSE;
@@ -715,11 +761,22 @@ WSADATA WSAData;
 #endif /* SOCKS */
 
     /*
-     *  If we didn't get and act on an -anonymous switch,
-     *  but can verify that this is the anonymous account,
-     *  set the default restrictions for that account NOW. - FM
+     *  If we had -validate set all of the restrictions
+     *  and disallow a TRACE log NOW. - FM
+     */
+    if (LYValidate == TRUE) {
+	parse_restrictions("all");
+	LYUseTraceLog = FALSE;
+    }
+
+    /*
+     *  If we didn't get and act on a -validate or -anonymous
+     *  switch, but can verify that this is the anonymous account,
+     *  set the default restrictions for that account and disallow
+     *  a TRACE log NOW. - FM
      */
-    if (!anon_restrictions_set && strlen((char *)ANONYMOUS_USER) > 0 &&
+    if (!LYValidate && !anon_restrictions_set &&
+        strlen((char *)ANONYMOUS_USER) > 0 &&
 #if defined (VMS) || defined (NOUSERS)
 	!strcasecomp(((char *)getenv("USER")==NULL ? " " : getenv("USER")),
 		     ANONYMOUS_USER)) {
@@ -732,12 +789,76 @@ WSADATA WSAData;
 #endif /* VMS */
 	parse_restrictions("default");
 	anon_restrictions_set = TRUE;
+	LYUseTraceLog = FALSE;
     }
+
+    /*
+     *  Set up the TRACE log path, and logging if appropriate. - FM
+     */
+#ifdef VMS
+    StrAllocCopy(LYTraceLogPath, "sys$login:Lynx.trace");
+#else
+    StrAllocCopy(LYTraceLogPath, (Home_Dir() ? Home_Dir() : ""));
+    StrAllocCat(LYTraceLogPath, "/Lynx.trace");
+#endif /* VMS */
+    LYOrigStderr = *stderr;
+    if (TRACE && LYUseTraceLog) {
+        /*
+	 *  If we can't open it for writing, give up.
+	 *  Otherwise, on VMS close it, delete it and any
+	 *  versions from previous sessions so they don't
+	 *  accumulate, and open it again. - FM
+	 */
+	if ((LYTraceLogFP = fopen(LYTraceLogPath, "w")) == NULL) {
+	    WWW_TraceFlag = FALSE;
+	    fprintf(stderr, "%s\n", TRACELOG_OPEN_FAILED);
+	    exit(-1);
+	}
+#ifdef VMS
+	fclose(LYTraceLogFP);
+	while (remove(LYTraceLogPath) == 0)
+	    ;
+	if ((LYTraceLogFP = fopen(LYTraceLogPath, "w",
+				  "shr=get")) == NULL) {
+	    WWW_TraceFlag = FALSE;
+	    printf("%s\n", TRACELOG_OPEN_FAILED);
+	    exit(-1);
+	}
+#endif /* VMS */
+	*stderr = *LYTraceLogFP;
+	fprintf(stderr, "\t\t%s\n\n", LYNX_TRACELOG_TITLE);
+    }
+
+    /*
+     *  If TRACE is on, indicate whether the
+     *  anonymous restrictions are set. - FM
+     */
     if (TRACE && anon_restrictions_set) {
 	fprintf(stderr, "LYMain: Anonymous restrictions set.\n");
     }
 
     /*
+     *  Set up the default jump file stuff. - FM
+     */
+    StrAllocCopy(jumpprompt, JUMP_PROMPT);
+#ifdef JUMPFILE
+    StrAllocCopy(jumpfile, JUMPFILE);
+    {
+        temp = (char *)malloc(strlen(jumpfile) + 10);
+	if (!temp) {
+	    outofmem(__FILE__, "main");
+	} else {
+	    sprintf(temp, "JUMPFILE:%s", jumpfile);
+	    if (!LYJumpInit(temp)) {
+		if (TRACE)
+		    fprintf(stderr, "Failed to register %s\n", temp);
+	    }
+	    FREE(temp);
+	}
+    }
+#endif /* JUMPFILE */
+
+    /*
      *  If no alternate configuration file was specified on
      *  the command line, see if it's in the environment.
      */
@@ -747,6 +868,21 @@ WSADATA WSAData;
 	    StrAllocCopy(lynx_cfg_file, cp);
     }
 
+   /* If we still have no config file, check one in home directory */
+   if (NULL == lynx_cfg_file)
+     {
+	temp = make_homedir_lynxrc_filename (NULL);
+	if (temp != NULL)
+	  {
+	     if (NULL != (fp = fopen (temp, "r")))
+	       {
+		  fclose (fp);
+		  StrAllocCopy (lynx_cfg_file, temp);
+	       }
+	     FREE(temp);
+	  }
+     }
+
     /*
      *  If we still don't have a configuration file,
      *  use the userdefs.h definition.
@@ -758,25 +894,15 @@ WSADATA WSAData;
      *  Convert a '~' in the configuration file path to $HOME.
      */
 #ifndef _WINDOWS /* avoid the whole ~ thing for now */
-    if ((cp = strchr(lynx_cfg_file, '~'))) {
-	*(cp++) = '\0';
-	StrAllocCopy(temp, lynx_cfg_file);
-	if (((len = strlen(temp)) > 0) && temp[len-1] == '/')
-	    temp[len-1] = '\0';
-#ifdef DOSPATH
-	StrAllocCat(temp, HTDOS_wwwName((char *)Home_Dir()));
-#else
-#ifdef VMS
-	StrAllocCat(temp, HTVMS_wwwName((char *)Home_Dir()));
-#else
-	StrAllocCat(temp, Home_Dir());
-#endif /* VMS */
-#endif /* DOSPATH */
-	StrAllocCat(temp, cp);
-	StrAllocCopy(lynx_cfg_file, temp);
-	FREE(temp);
-    }
-#endif /* _WINDOWS */
+   /* I think this should only be performed if lynx_cfg_file starts with ~/ */
+   if ((lynx_cfg_file[0] == '~') && (lynx_cfg_file[1] == '/'))
+     {
+	temp = make_homedir_lynxrc_filename (lynx_cfg_file + 2);
+	FREE(lynx_cfg_file);
+	lynx_cfg_file = temp;
+	temp = NULL;
+     }
+#endif
 
     /*
      *  If the configuration file is not available,
@@ -800,6 +926,59 @@ WSADATA WSAData;
     }
 #endif /* EXP_CHARTRANS */
 
+#if defined(USEHASH)
+    /*
+     *  If no alternate lynxile file was specified on
+     *  the command line, see if it's in the environment.
+     */
+    if (!lynx_lss_file) {
+        if (((cp=getenv("LYNX_LSS")) != NULL) ||
+            (cp=getenv("lynx_lss")) != NULL)
+            StrAllocCopy(lynx_lss_file, cp);
+    }
+
+    /*
+     *  If we still don't have a lynxile file,
+     *  use the userdefs.h definition.
+     */
+    if (!lynx_lss_file)
+        StrAllocCopy(lynx_lss_file, LYNX_LSS_FILE);
+
+    /*
+     *  Convert a '~' in the lynxile file path to $HOME.
+     */
+    if ((cp = strchr(lynx_lss_file, '~'))) {
+        char *temp = NULL;
+        int len;
+
+        *(cp++) = '\0';
+        StrAllocCopy(temp, lynx_lss_file);
+        if ((len=strlen(temp)) > 0 && temp[len-1] == '/')
+            temp[len-1] = '\0';
+#ifdef VMS
+        StrAllocCat(temp, HTVMS_wwwName((char *)Home_Dir()));
+#else
+        StrAllocCat(temp, Home_Dir());
+#endif /* VMS */
+        StrAllocCat(temp, cp);
+        StrAllocCopy(lynx_lss_file, temp);
+        FREE(temp);
+    }
+    /*
+     *  If the lynxile file is not available,
+     *  inform the user and exit.
+     */
+    if ((fp = fopen(lynx_lss_file, "r")) == NULL) {
+        fprintf(stderr, "\nLynxile file %s is not available.\n\n",
+                        lynx_lss_file);
+    }
+    else
+    {
+        fclose(fp);
+        style_readFromFile(lynx_lss_file);
+    }
+#endif
+
     /*
      *  Make sure we have the edit map declared. - FM
      */
@@ -808,7 +987,7 @@ WSADATA WSAData;
 	exit(-1);
     }
 
-#if defined(USE_SLANG) || defined(COLOR_CURSES)
+#if USE_COLOR_TABLE
     /*
      *  Set up default foreground and background colors.
      */
@@ -837,6 +1016,8 @@ WSADATA WSAData;
     read_cfg(lynx_cfg_file);
     FREE(lynx_cfg_file);
 
+    HTSwitchDTD(New_DTD);
+
     /*
      *  Check for a save space path in the environment.
      *  If one was set in the configuration file, that
@@ -858,7 +1039,7 @@ WSADATA WSAData;
 	    if (((len = strlen(temp)) > 0) && temp[len-1] == '/')
 	        temp[len-1] = '\0';
 #ifdef DOSPATH
-	StrAllocCat(temp, HTDOS_wwwName((char *)Home_Dir()));
+	    StrAllocCat(temp, HTDOS_wwwName((char *)Home_Dir()));
 #else
 #ifdef VMS
 	    StrAllocCat(temp, HTVMS_wwwName((char *)Home_Dir()));
@@ -1654,6 +1835,19 @@ PRIVATE void parse_arg ARGS3(
 	 */
 	HEAD_request = TRUE;
 
+    } else if (strncmp(argv[0], "-hiddenlinks", 7) == 0) {
+        if (nextarg) {
+	    if (strncasecomp(cp, "merge", 1) == 0)
+		LYHiddenLinks = HIDDENLINKS_MERGE;
+	    else if (strncasecomp(cp, "listonly", 1) == 0)
+		LYHiddenLinks = HIDDENLINKS_SEPARATE;
+	    else if (strncasecomp(cp, "ignore", 1) == 0)
+		LYHiddenLinks = HIDDENLINKS_IGNORE;
+	    else
+		goto Output_Error_and_Help_List;
+	} else
+	    LYHiddenLinks = HIDDENLINKS_MERGE;
+
     } else if (strncmp(argv[0], "-historical", 11) == 0) {
         if (historical_comments)
 	    historical_comments = FALSE;
@@ -1693,6 +1887,12 @@ PRIVATE void parse_arg ARGS3(
 	if (nextarg)
 	    StrAllocCopy(indexfile, cp);
 
+    } else if (strncmp(argv[0], "-ismap", 6) == 0) {
+	if (LYNoISMAPifUSEMAP)
+	    LYNoISMAPifUSEMAP = FALSE;
+	else
+	    LYNoISMAPifUSEMAP = TRUE;
+
     } else {
         goto Output_Error_and_Help_List;
     }
@@ -1702,6 +1902,16 @@ PRIVATE void parse_arg ARGS3(
     if (strncmp(argv[0], "-link", 5) == 0) {
         if (nextarg)
 	    ccount = atoi(cp);
+#if defined(USEHASH)
+        } else if (strncmp(argv[0], "-lss", 4) == 0) {
+        fprintf(stderr, "***********************\n");
+            if ((cp=strchr(argv[0],'=')) != NULL)
+                StrAllocCopy(lynx_lss_file, cp+1);
+            else {
+                StrAllocCopy(lynx_lss_file, argv[1]);
+                i++;
+            }
+#endif
 
     } else if (strncmp(argv[0], "-localhost", 10) == 0) {
 	local_host_only = TRUE;
@@ -1908,12 +2118,17 @@ PRIVATE void parse_arg ARGS3(
    dired_support   disallow local file management\n");
 #endif /* DIRED_SUPPORT */
 	        printf("\
-   disk_save       disallow saving binary files to disk in the download menu\n\
+   disk_save       disallow saving to disk in the download and print menus\n\
    dotfiles        disallow access to, or creation of, hidden (dot) files\n\
    download        disallow downloaders in the download menu\n\
    editor          disallow editing\n\
    exec            disable execution scripts\n\
-   exec_frozen     disallow the user from changing the execution link\n\
+    exec_frozen     disallow the user from changing the execution link\n");
+#ifdef USE_EXTERNALS
+        printf("\
+    externals       disable passing URLs to external programs\n");
+#endif
+        printf("\
    file_url        disallow using G)oto, served links or bookmarks for\n\
                    file: URL's\n\
    goto            disable the 'g' (goto) command\n");
@@ -2005,6 +2220,16 @@ PRIVATE void parse_arg ARGS3(
 	     HTAtom_for("www/download") : HTAtom_for("www/dump"));
 	LYcols=999;
 
+#if defined(USEHASH)
+    } else if (strncmp(argv[0], "-lss", 4) == 0) {
+        /*
+         *  Already read the alternate lynxile file
+         *  so just check whether we need to increment i
+         */
+        if (nextarg)
+            ; /* do nothing */
+#endif
+
     } else if (strncmp(argv[0], "-stack_dump", 11) == 0) {
 	stack_dump = TRUE;
 
@@ -2032,8 +2257,17 @@ PRIVATE void parse_arg ARGS3(
 	if (nextarg)
 	    terminal = cp;
 
+    } else if (strncmp(argv[0], "-tlog", 5) == 0) {
+        /*
+	 *  Already handled. - FM
+	 */
+	break;
+
     } else if (strncmp(argv[0], "-trace", 6) == 0) {
-	WWW_TraceFlag = TRUE;
+        /*
+	 *  Already handled. - FM
+	 */
+	break;
 
     } else if (strncmp(argv[0], "-traversal", 10) == 0) {
 	traversal = TRUE;
@@ -2055,7 +2289,7 @@ PRIVATE void parse_arg ARGS3(
 	else
 	    use_underscore = TRUE;
 
-#ifdef NCURSES_MOUSE_VERSION
+#if defined(NCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE)
     } else if (strncmp(argv[0], "-use_mouse", 9) == 0) {
         LYUseMouse = TRUE;
 #endif
@@ -2068,9 +2302,9 @@ PRIVATE void parse_arg ARGS3(
     if (strcmp(argv[0], "-validate") == 0) {
         /*
 	 *  Follow only http URLs.
+	 *  Already handled. - FM
 	 */
-	LYValidate = TRUE;
-	parse_restrictions("all");
+	break;
 
     } else if (strncmp(argv[0], "-version", 8) == 0) {
 	printf("\n%s Version %s (1997)\n", LYNX_NAME, LYNX_VERSION);
@@ -2096,7 +2330,12 @@ Output_Error_and_Help_List:
 #ifdef VMS
     printf(" LYNX: Invalid Option: %s\n", argv[0]);
 #else
-    printf("%s: Invalid Option: %s\n", pgm, argv[0]);
+#ifdef UNIX
+    if (strncmp(argv[0], "-help", 5) != 0)
+	fprintf(stderr, "%s: Invalid Option: %s\n", pgm, argv[0]);
+    else
+#endif /* UNIX */
+	printf("%s: Invalid Option: %s\n", pgm, argv[0]);
 #endif /* VMS */
 Output_Help_List:
 #ifdef VMS
@@ -2152,12 +2391,18 @@ Output_Help_List:
     printf("                     terminated by '---' on a line\n");
     printf("    -head            send a HEAD request\n");
     printf("    -help            print this usage message\n");
+    printf("    -hiddenlinks=[option]  hidden links: options are merge, listonly, or ignore\n");
     printf("    -historical      toggles use of '>' or '-->' as a terminator for comments\n");
     printf("    -homepage=URL    set homepage separate from start page\n");
     printf("    -image_links     toggles inclusion of links for all images\n");
     printf("    -index=URL       set the default index file to URL\n");
+    printf("    -ismap           toggles inclusion of ISMAP links when client-side\n");
+    printf("                     MAPs are present\n");
     printf("    -link=NUMBER     starting count for lnk#.dat files produced by -crawl\n");
     printf("    -localhost       disable URLs that point to remote hosts\n");
+#if defined(USEHASH)
+    printf("    -lss=FILENAME    specifies a lynx.css file other than the default\n");
+#endif
     printf("    -mime_header     include mime headers and force source dump\n");
     printf("    -minimal         toggles minimal versus valid comment parsing\n");
     printf("    -newschunksize=NUMBER  number of articles in chunked news listings\n");
@@ -2204,10 +2449,11 @@ Output_Help_List:
 #endif /* !VMS */
     printf("    -telnet          disable telnets\n");
     printf("    -term=TERM       set terminal type to TERM\n");
-    printf("    -trace           turns on WWW trace mode\n");
+    printf("    -tlog            toggles use of a Lynx Trace Log for the current session\n");
+    printf("    -trace           turns on Lynx trace mode\n");
     printf("    -traversal       traverse all http links derived from startfile\n");
     printf("    -underscore      toggles use of _underline_ format in dumps\n");
-#ifdef NCURSES_MOUSE_VERSION
+#if defined(NCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE)
     printf("    -use_mouse       enable use of the mouse\n");
 #endif
     printf("    -validate        accept only http URLs (for validation)\n");
@@ -2229,7 +2475,7 @@ PRIVATE void FatalProblem ARGS1(
      *  Ignore further interrupts. - mhc: 11/2/91
      */
 #ifndef NOSIGHUP
-				(void) signal(SIGHUP, SIG_DFL);
+				(void) signal(SIGHUP, SIG_IGN);
 #endif /* NOSIGHUP */
     (void) signal (SIGTERM, SIG_IGN);
     (void) signal (SIGINT, SIG_IGN);
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 50fcbffb..a721ea4b 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -7,6 +7,7 @@
 #include "HTFile.h"
 #include "HTTP.h"
 #include "LYCurses.h"
+#include "LYStyle.h"
 #include "LYGlobalDefs.h"
 #include "HTAlert.h"
 #include "LYUtils.h"
@@ -34,10 +35,15 @@
 #include "LYCharSets.h"
 #include "LYCharUtils.h"
 #include "LYCookie.h"
+#include "LYMainLoop.h"
 #ifdef DOSPATH
 #include "HTDOS.h"
 #endif
 
+#ifdef USE_EXTERNALS
+#include "LYExtern.h"
+#endif
+
 #ifdef VMS
 #include "HTVMSUtils.h"
 #endif /* VMS */
@@ -53,6 +59,7 @@
 extern BOOL reloading;		/* For Flushing Cache on Proxy Server */
 
 PRIVATE int are_different PARAMS((document *doc1, document *doc2));
+PRIVATE int are_phys_different PARAMS((document *doc1, document *doc2));
 PUBLIC void HTGotoURLs_free NOPARAMS;
 PUBLIC void HTAddGotoURL PARAMS((char *url));
 
@@ -79,6 +86,8 @@ PRIVATE document curdoc;
 PRIVATE char *traversal_host = NULL;
 PRIVATE char *traversal_link_to_add = NULL;
 PRIVATE char *CurrentUserAgent = NULL;
+PRIVATE char *CurrentNegoLanguage = NULL;
+PRIVATE char *CurrentNegoCharset = NULL;
 
 /*
  *  Function for freeing allocated mainloop() variables. - FM
@@ -95,9 +104,15 @@ PRIVATE void free_mainloop_variables NOARGS
     FREE(curdoc.post_data);
     FREE(curdoc.post_content_type);
     FREE(curdoc.bookmark);
+#ifdef USEHASH
+    FREE(curdoc.style);
+    FREE(newdoc.style);
+#endif
     FREE(traversal_host);
     FREE(traversal_link_to_add);
     FREE(CurrentUserAgent);
+    FREE(CurrentNegoLanguage);
+    FREE(CurrentNegoCharset);
 #ifdef DIRED_SUPPORT
     clear_tags();
 #endif /* DIRED_SUPPORT */
@@ -116,7 +131,8 @@ PRIVATE void free_mainloop_variables NOARGS
 
 int mainloop NOARGS
 {
-    int c = 0, real_c = 0, old_c = 0, cmd;
+    int c = 0, real_c = 0, old_c = 0, cmd, real_cmd = LYK_DO_NOTHING;
+    int getresult;
     int arrowup = FALSE, show_help = FALSE;
     int lines_in_file = -1;
     int Newline = 0;
@@ -127,6 +143,7 @@ int mainloop NOARGS
     BOOLEAN first_file = TRUE;
     BOOLEAN refresh_screen = FALSE;
     BOOLEAN force_load = FALSE;
+    BOOLEAN try_internal = FALSE;
     BOOLEAN crawl_ok = FALSE;
     BOOLEAN rlink_exists;
     BOOLEAN rlink_allowed;
@@ -139,6 +156,7 @@ int mainloop NOARGS
     BOOLEAN show_dotfiles_flag = show_dotfiles;
     BOOLEAN LYRawMode_flag = LYRawMode;
     BOOLEAN LYSelectPopups_flag = LYSelectPopups;
+    BOOLEAN trace_mode_flag = FALSE;
     char cfile[128];
     FILE *cfp;
     char *cp, *toolbar;
@@ -179,12 +197,20 @@ int mainloop NOARGS
     curdoc.post_data = NULL;
     curdoc.post_content_type = NULL;
     curdoc.bookmark = NULL;
+#ifdef USEHASH
+    curdoc.style = NULL;
+    newdoc.style = NULL;
+#endif
     nhist = 0;
     user_input_buffer[(sizeof(user_input_buffer) - 1)] = '\0';
     *prev_target = '\0';
     *user_input_buffer = '\0';
     StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
     				    LYUserAgent : ""));
+    StrAllocCopy(CurrentNegoLanguage, (language ?
+				       language : ""));
+    StrAllocCopy(CurrentNegoCharset, (pref_charset ?
+				      pref_charset : ""));
     atexit(free_mainloop_variables);
 initialize:
     StrAllocCopy(newdoc.address, startfile);
@@ -192,6 +218,7 @@ initialize:
     StrAllocCopy(newdoc.title, "Entry into main screen");
     newdoc.isHEAD = FALSE;
     newdoc.safe = FALSE;
+    newdoc.internal_link = FALSE;
     newdoc.line = 1;
     newdoc.link = 0;
 
@@ -259,6 +286,9 @@ initialize:
         display_lines = LYlines-2;
 
     while (TRUE) {
+#ifdef USEHASH
+	if (curdoc.style != NULL) force_load = TRUE;
+#endif
 	/*
 	 *  If newdoc.address is different then curdoc.address then
 	 *  we need to go out and find and load newdoc.address.
@@ -289,7 +319,18 @@ try_again:
 		     *  and LYresubmit_posts is set. - FM
 		     */
                     LYpop(&newdoc);
-		    if ((newdoc.bookmark != NULL) ||
+		    /*
+		    ** If curdoc had been reached via an internal
+		    ** (fragment) link from what we now have just
+		    ** popped into newdoc, then override non-caching in
+		    ** all cases. - kw
+		    */
+		    if (curdoc.internal_link &&
+			!are_phys_different(&curdoc, &newdoc)) {
+		        LYoverride_no_cache = TRUE;
+			LYforce_no_cache = FALSE;
+			try_internal = TRUE;
+		    } else if ((newdoc.bookmark != NULL) ||
 		        (newdoc.post_data != NULL && LYresubmit_posts)) {
 		        LYoverride_no_cache = FALSE;
 		    } else {
@@ -304,9 +345,61 @@ try_again:
 		    if (newdoc.address &&
 		        !strncmp(newdoc.address, "http", 4))
 		        newdoc.isHEAD = TRUE;
+		    try_internal = FALSE;
 		    HEAD_request = FALSE;
 		}
 
+		/*
+		 *  If we're getting the TRACE log and it's not new,
+		 *  check whether its HText structure has been dumped,
+		 *  and if so, fflush() and fclose() it to ensure it is
+		 *  fully updated, and then fopen() it again. - FM
+		 */
+		if (LYUseTraceLog == TRUE &&
+		    trace_mode_flag == FALSE &&
+		    LYTraceLogFP != NULL &&
+		    !strcmp((newdoc.title ? newdoc.title : ""),
+			     LYNX_TRACELOG_TITLE)) {
+		    DocAddress WWWDoc;
+		    HTParentAnchor *tmpanchor;
+
+		    WWWDoc.address = newdoc.address;
+	            WWWDoc.post_data = newdoc.post_data;
+	            WWWDoc.post_content_type = newdoc.post_content_type;
+	            WWWDoc.bookmark = newdoc.bookmark;
+		    WWWDoc.isHEAD = newdoc.isHEAD;
+		    WWWDoc.safe = newdoc.safe;
+		    tmpanchor = HTAnchor_parent(HTAnchor_findAddress(&WWWDoc));
+		    if ((HText *)HTAnchor_document(tmpanchor) == NULL) {
+			if (TRACE)
+			    fprintf(stderr,
+				    "\nTurning off TRACE for fetch of log.\n");
+			fflush(stderr);
+			fclose(LYTraceLogFP);
+			*stderr = LYOrigStderr;
+#ifdef VMS
+			if ((LYTraceLogFP = fopen(LYTraceLogPath,
+						  "a+", "shr=get")) == NULL)
+#else
+			if ((LYTraceLogFP = fopen(LYTraceLogPath,
+						  "a+")) == NULL)
+#endif /* VMS */
+			{
+			    WWW_TraceFlag = FALSE;
+			    _statusline(TRACELOG_OPEN_FAILED);
+			    sleep(MessageSecs);
+			    old_c = 0;
+			    cmd = LYK_PREV_DOC;
+			    goto new_cmd;
+			}
+			*stderr = *LYTraceLogFP;
+			if (TRACE) {
+			    WWW_TraceFlag = FALSE;
+			    trace_mode_flag = TRUE;
+			}
+		    }
+		}
+
 		LYRequestTitle = newdoc.title;
 		if (newdoc.bookmark)
 		    LYforce_HTML_mode = TRUE;
@@ -317,7 +410,55 @@ try_again:
 		     !strcmp(newdoc.address, homepage))) {
 		    LYPermitURL = TRUE;
 		}
-		switch(getfile(&newdoc)) {
+
+		if (try_internal) {
+		    if (newdoc.address &&
+			0==strncmp(newdoc.address, "LYNXIMGMAP:", 11)) {
+			try_internal = FALSE;
+		    } else if (curdoc.address &&	
+			0==strncmp(curdoc.address, "LYNXIMGMAP:", 11)) {
+			try_internal = FALSE;
+		    }
+		}
+		if (try_internal) {
+		    char *cp = strchr(newdoc.address,'#');
+		    if (cp) {
+			HTFindPoundSelector(cp+1);
+		    }
+		    getresult = (HTMainText != NULL) ? NORMAL : NOT_FOUND;
+		    try_internal = FALSE; /* done */
+		    /* fix up newdoc.address which may have been fragment-only */
+		    if (getresult == NORMAL && (!cp || cp == newdoc.address)) {
+			if (!cp) {
+			    StrAllocCopy(newdoc.address, HTLoadedDocumentURL());
+			} else {
+			    StrAllocCopy(temp, HTLoadedDocumentURL());
+			    StrAllocCat(temp, cp); /* append fragment */
+			    StrAllocCopy(newdoc.address, temp);
+			    FREE(temp);
+			}
+		    }
+		} else {
+		    if (newdoc.internal_link && newdoc.address &&
+			*newdoc.address == '#' && nhist > 0) {
+			char *cp;
+			if (0==strncmp(history[nhist-1].address, "LYNXIMGMAP:", 11))
+			    cp = history[nhist-1].address + 11;
+			else
+			    cp = history[nhist-1].address;
+			StrAllocCopy(temp, cp);
+			cp = strchr(temp, '#');
+			if (cp)
+			    *cp = '\0';
+			StrAllocCat(temp, newdoc.address);
+			FREE(newdoc.address);
+			newdoc.address = temp;
+			temp = NULL;
+		    }
+		    getresult = getfile(&newdoc);
+		}
+
+		switch(getresult) {
 
 		case NOT_FOUND:
 		    /*
@@ -325,6 +466,11 @@ try_again:
 		     *  Do any error logging, if appropriate.
 		     */
 		    LYoverride_no_cache = FALSE; /* Was TRUE if popped. - FM */
+		    if (trace_mode_flag == TRUE) {
+			WWW_TraceFlag = TRUE;
+			trace_mode_flag = FALSE;
+			fprintf(stderr, "Turning TRACE back on.\n\n");
+		    }
 		    if (error_logging && 
 		        first_file && owner_address && !LYCancelledFetch) {
 		        /*
@@ -379,7 +525,13 @@ try_again:
 			 */
 			if (!dump_output_immediately)
 			    cleanup();
-		        printf("\nlynx: Can't access startfile %s\n",
+#ifdef UNIX
+			if (dump_output_immediately)
+			    fprintf(stderr,"\nlynx: Can't access startfile %s\n",
+			       startfile);
+			else
+#endif /* UNIX */
+			    printf("\nlynx: Can't access startfile %s\n",
 			       startfile);
 			if (!dump_output_immediately) {
 #ifndef NOSIGHUP
@@ -403,6 +555,11 @@ try_again:
 		     *  Not supposed to return any file.
 		     */
 		    LYoverride_no_cache = FALSE; /* Was TRUE if popped. - FM */
+		    if (trace_mode_flag == TRUE) {
+			WWW_TraceFlag = TRUE;
+			trace_mode_flag = FALSE;
+			fprintf(stderr, "Turning TRACE back on.\n\n");
+		    }
 		    FREE(newdoc.address); /* to pop last doc */
 		    FREE(newdoc.bookmark);
 		    LYJumpFileURL = FALSE;
@@ -410,6 +567,7 @@ try_again:
 		    LYPermitURL = FALSE;
 		    LYCancelledFetch = FALSE;
 		    ForcePush = FALSE;
+		    LYforce_HTML_mode = FALSE;
 		    if (traversal) {
 		        crawl_ok = FALSE;
 			if (traversal_link_to_add) {
@@ -456,12 +614,22 @@ try_again:
 			   StrAllocCopy(startfile, homepage);
 			   newdoc.isHEAD = FALSE;
 			   newdoc.safe = FALSE;
+			   newdoc.internal_link = FALSE;
 		       } else {
 		           if (!dump_output_immediately)
 			       cleanup();
-			   printf(
+#ifdef UNIX
+		           if (dump_output_immediately) {
+			       fprintf(stderr,
+ "\nlynx: Start file could not be found or is not text/html or text/plain\n");
+			       fprintf(stderr,"      Exiting...\n");
+			   } else
+#endif /* UNIX */
+			   {
+			       printf(
  "\nlynx: Start file could not be found or is not text/html or text/plain\n");
-			   printf("      Exiting...\n");
+			       printf("      Exiting...\n");
+			   }
 		           if (!dump_output_immediately) {
 #ifndef NOSIGHUP
 				(void) signal(SIGHUP, SIG_DFL);
@@ -488,6 +656,11 @@ try_again:
 		     *  Marvelously, we got the document!
 		     */
 		    LYoverride_no_cache = FALSE; /* Was TRUE if popped. - FM */
+		    if (trace_mode_flag == TRUE) {
+			WWW_TraceFlag = TRUE;
+			trace_mode_flag = FALSE;
+			fprintf(stderr, "Turning TRACE back on.\n\n");
+		    }
 		    *prev_target = '\0';    /* Reset for this document. - FM */
 
 		    /*
@@ -583,6 +756,10 @@ try_again:
 							(BookmarkPage + 2)));
 				    StrAllocCopy(newdoc.title, BOOKMARK_TITLE);
 				    StrAllocCopy(newdoc.bookmark, BookmarkPage);
+#ifdef USEHASH
+				    if (curdoc.style)
+					StrAllocCopy(newdoc.style, curdoc.style);
+#endif
 				    StrAllocCopy(startrealm, newdoc.address);
 				    FREE(newdoc.post_data);
 				    FREE(newdoc.post_content_type);
@@ -633,12 +810,14 @@ try_again:
 		     */
 		    if (newdoc.address && curdoc.title &&
 		        !strncmp(newdoc.address, "LYNXDOWNLOAD:", 13) &&
-		        !strcmp(curdoc.title, DOWNLOAD_OPTIONS_TITLE)) {
+		        !strcmp((curdoc.title ? curdoc.title : ""),
+				DOWNLOAD_OPTIONS_TITLE)) {
 			StrAllocCopy(newdoc.address, curdoc.address);
 			StrAllocCopy(newdoc.title, curdoc.title);
 			StrAllocCopy(newdoc.bookmark, curdoc.bookmark);
 			newdoc.line = curdoc.line;
 			newdoc.link = curdoc.link;
+			newdoc.internal_link = FALSE; /* can't be true. - kw */
 		    }
 
 		    /*
@@ -674,7 +853,13 @@ try_again:
 	    StrAllocCopy(curdoc.post_data, newdoc.post_data);
 	    StrAllocCopy(curdoc.post_content_type, newdoc.post_content_type);
 	    StrAllocCopy(curdoc.bookmark, newdoc.bookmark);
+#ifdef USEHASH
+	    StrAllocCopy(curdoc.style, HText_getStyle());
+	    if (curdoc.style != NULL)
+		style_readFromFile (curdoc.style);
+#endif
 	    curdoc.isHEAD = newdoc.isHEAD;
+	    curdoc.internal_link = newdoc.internal_link;
 
 	    /*
 	     *  Set the remaining document elements and add to
@@ -713,6 +898,7 @@ try_again:
 	   HEAD_request = FALSE;	/* only set for HEAD requests */
 	   LYPermitURL = FALSE;		/* only set for LYValidate */
 	   ForcePush = FALSE;		/* only set for some PRINT requests. */
+	   LYforce_HTML_mode = FALSE;
 
   	} /* end if (STREQ(newdoc.address, curdoc.address) */
 
@@ -734,8 +920,8 @@ try_again:
 		start_curses(); 
 		clear();
 		refresh_screen = TRUE; /* to force a redraw */
-		recent_sizechange=FALSE;
-		if (user_mode==NOVICE_MODE) {
+		recent_sizechange = FALSE;
+		if (user_mode == NOVICE_MODE) {
 		    display_lines = LYlines-4;
 		} else {
 		    display_lines = LYlines-2;
@@ -905,7 +1091,7 @@ try_again:
 	}
 
 	/*
-	 *  Refesh the screen if neccessary.
+	 *  Refresh the screen if neccessary.
 	 */
 	if (refresh_screen) {
 	    clear();
@@ -917,7 +1103,7 @@ try_again:
 #endif /* DIRED_SUPPORT */
 	    if (user_mode == NOVICE_MODE)
 		noviceline(more);  /* print help message */
-	    refresh_screen=FALSE;
+	    refresh_screen = FALSE;
 
 	}
 
@@ -955,11 +1141,11 @@ try_again:
 #else
 #ifdef NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES
 	    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0 &&
-	    	       links[curdoc.link].type != WWW_LINK_TYPE) {
+	    	       !(links[curdoc.link].type & WWW_LINK_TYPE)) {
 #else
 	    } else if (lynx_mode == FORMS_LYNX_MODE && nlinks > 0 &&
 	    	       !(user_mode == ADVANCED_MODE &&
-	    	         links[curdoc.link].type == WWW_LINK_TYPE)) {
+	    	         (links[curdoc.link].type & WWW_LINK_TYPE))) {
 #endif /* NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES */
 #endif /* INDICATE_FORMS_MODE_FOR_ALL_LINKS_ON_PAGE */
                 if (links[curdoc.link].type == WWW_FORM_LINK_TYPE)
@@ -1106,7 +1292,13 @@ try_again:
 	        } else {
 		    if (!dump_output_immediately)
 		        cleanup();
-	            printf(
+#ifdef UNIX
+		    if (dump_output_immediately)
+			fprintf(stderr,
+		        "Fatal error - could not open output file %s\n",cfile);
+		    else
+#endif
+			printf(
 		        "Fatal error - could not open output file %s\n",cfile);
 		    if (!dump_output_immediately) {
 #ifndef NOSIGHUP
@@ -1229,7 +1421,7 @@ new_keyboard_input:
 	        if (lookup(links[curdoc.link].lname)) {
 		    if (more_links ||
 			(curdoc.link > -1 && curdoc.link < nlinks -1))
-		        c=DNARROW;
+		         c= DNARROW;
 		    else {
 		        if (STREQ(curdoc.title,"Entry into main screen") ||
 			    (nhist <= 0 )) {
@@ -1250,7 +1442,7 @@ new_keyboard_input:
 			    }
 			    return(-1);
 			}
-			c=LTARROW;
+			c = LTARROW;
 		    }
 		} else {
 		    StrAllocCopy(traversal_link_to_add,
@@ -1265,7 +1457,7 @@ new_keyboard_input:
 		    add_to_reject_list(links[curdoc.link].lname);
 		if (more_links ||
 		    (curdoc.link > -1 && curdoc.link < nlinks-1))
- 		    c=DNARROW;
+ 		    c = DNARROW;
 		else {
 		    /*
 		     *  curdoc.title doesn't always work, so
@@ -1290,18 +1482,20 @@ new_keyboard_input:
 			}
 			return(-1);
 		    }
-	            c=LTARROW;
+	            c = LTARROW;
 		}
 	    } /* right link not NULL or link to another site*/
 	} /* traversal */
 
-	cmd=keymap[c+1];  /* add 1 to map EOF to 0 */
+	cmd = keymap[c+1];  /* add 1 to map EOF to 0 */
 
 #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE)
 	if (lynx_edit_mode && override[c+1] && !no_dired_support)
 	  cmd = override[c+1];
 #endif /* DIRED_SUPPORT && OK_OVERRIDE */
 
+	real_cmd = cmd;
+
 new_cmd:  /*
 	   *  A goto point for new input without going
            *  back through the getch() loop.
@@ -1329,6 +1523,8 @@ new_cmd:  /*
 	     */
 	    break;
 
+	case LYK_F_LINK_NUM:
+	     c = '\0';
 	case LYK_1:
 	case LYK_2:
 	case LYK_3:
@@ -1338,22 +1534,36 @@ new_cmd:  /*
 	case LYK_7:
 	case LYK_8:
 	case LYK_9:
+	{
 	    /*
 	     *  Get a number from the user and follow that link number.
 	     */
-	    switch(follow_link_number(c, ((nlinks > 0) ? curdoc.link : 0))) {
+	    int lindx = ((nlinks > 0) ? curdoc.link : 0);
+	    int number;
+
+	    switch (follow_link_number(c, lindx, &newdoc, &number)) {
 	    case DO_LINK_STUFF:
                 /*
 		 *  Follow a normal link.
 		 */
-		if (nlinks > 0)
-                    StrAllocCopy(newdoc.address, links[curdoc.link].lname);
-		else
-		    StrAllocCopy(newdoc.address, links[0].lname);
+		StrAllocCopy(newdoc.address, links[lindx].lname);
+		StrAllocCopy(newdoc.title, links[lindx].hightext);
 		/*
 		 *  Might be an anchor in the same doc from a POST
 		 *  form.  If so, don't free the content. -- FM
 		 */
+		if (links[lindx].type == WWW_INTERN_LINK_TYPE) {
+		    LYoverride_no_cache = TRUE;
+		    newdoc.internal_link = TRUE;
+		    if (0==strcmp(curdoc.address, LYlist_temp_url()) &&
+			0==strcmp((curdoc.title ? curdoc.title : ""),
+				      LIST_PAGE_TITLE)) {
+			FREE(curdoc.address);
+		    } else
+			try_internal = TRUE;
+		    force_load = TRUE;
+		    break;
+		}
 		if (are_different(&curdoc, &newdoc)) {
 		    FREE(newdoc.post_data);
 		    FREE(newdoc.post_content_type);
@@ -1361,18 +1571,88 @@ new_cmd:  /*
 		    newdoc.isHEAD = FALSE;
 		    newdoc.safe = FALSE;
 		}
+		newdoc.internal_link = FALSE;
 		force_load = TRUE;  /* force MainLoop to reload */
 		break;
 
+	    case DO_GOTOLINK_STUFF:
+                /*
+		 *  Position on a normal link, don't follow it. - KW
+		 */
+		Newline = newdoc.line;
+		newdoc.line = 1;
+		if (Newline == curdoc.line) {
+		    /*
+		     *  It's a link in the current page. - FM
+		     */
+		    if (nlinks > 0 && curdoc.link > -1) {
+		        if (curdoc.link == newdoc.link) {
+			    /*
+			     *  It's the current link, and presumeably
+			     *  reflects a typo in the statusline entry,
+			     *  so issue a statusline message for the
+			     *  typo-prone users (like me 8-). - FM
+			     */
+			    StrAllocCopy(temp, user_input_buffer);
+			    sprintf(user_input_buffer,
+				    LINK_ALREADY_CURRENT, number);
+			    _statusline(user_input_buffer);
+			    sleep(MessageSecs);
+			    strcpy(user_input_buffer, temp);
+			    FREE(temp);
+			} else {
+			    /*
+			     *  It's a different link on this page,
+			     *  so turn the highlighting off, set the
+			     *  current link to the new link value from
+			     *  follow_link_number(), and re-initialize
+			     *  the new link value. - FM
+			     */
+			    highlight(OFF, curdoc.link);
+			    curdoc.link = newdoc.link;
+			    newdoc.link = 0;
+			}
+		    }
+		}
+		break;		/* nothing more to do */
+
+	    case DO_GOTOPAGE_STUFF:
+                /*
+		 *  Position on a page in this document. - FM
+		 */
+		Newline = newdoc.line;
+		newdoc.line = 1;
+		if (Newline == curdoc.line) {
+		    /*
+		     *  It's the current page, so issue a
+		     *  statusline message for the typo-prone
+		     *  users (like me 8-). - FM
+		     */
+		    if (Newline <= 1) {
+		        _statusline(ALREADY_AT_BEGIN);
+		    } else if (!more) {
+		        _statusline(ALREADY_AT_END);
+		    } else {
+			StrAllocCopy(temp, user_input_buffer);
+			sprintf(user_input_buffer,
+				ALREADY_AT_PAGE, number);
+			_statusline(user_input_buffer);
+			sleep(MessageSecs);
+			strcpy(user_input_buffer, temp);
+			FREE(temp);
+		    }
+		    sleep(MessageSecs);
+		}
+		break;
+
 	    case PRINT_ERROR:
-		if (old_c == real_c)
-		    break;
 		old_c = real_c;
 		_statusline(BAD_LINK_NUM_ENTERED);
 		sleep(MessageSecs);
 		break;
 	    }
 	    break;
+	}
 
 	case LYK_SOURCE:  /* toggle view source mode */
 	    /*
@@ -1452,7 +1732,13 @@ new_cmd:  /*
 	     *  Reload should force a cache refresh on a proxy.
 	     *        -- Ari L. <luotonen@dxcern.cern.ch>
 	     */
-            reloading = TRUE;
+	    /* - but only if this was really a reload requested by
+	     *  the user, not if we jumped here to handle reloading for
+	     *  INLINE_TOGGLE, IMAGE_TOGGLE, RAW_TOGGLE, etc.
+	     *  - kw
+	     */
+	    if (real_cmd == LYK_RELOAD)
+		reloading = TRUE;
 	    break;
 
 	case LYK_HISTORICAL:  
@@ -1542,6 +1828,40 @@ new_cmd:  /*
 	    sleep(MessageSecs);
 	    break;
 
+	case LYK_SWITCH_DTD:
+	    /*
+	     *  Check if this is a reply from a POST, and if so,
+	     *  seek confirmation of reload if the safe element
+	     *  is not set. - FM, kw
+	     */
+	    if ((curdoc.post_data != NULL &&
+	         curdoc.safe != TRUE) &&
+		HTConfirm(CONFIRM_POST_RESUBMISSION) == FALSE) {
+		_statusline(WILL_NOT_RELOAD_DOC);
+		sleep(InfoSecs);
+	    } else {
+	        HTuncache_current_document();
+		StrAllocCopy(newdoc.address, curdoc.address);
+		FREE(curdoc.address);
+	    }
+#ifdef NO_ASSUME_SAME_DOC
+            newdoc.line=1;
+            newdoc.link=0;
+#else
+            newdoc.line = ((curdoc.line > 0) ? curdoc.line : 1);
+            newdoc.link = ((curdoc.link > -1) ? curdoc.link : 0);
+#endif /* NO_ASSUME_SAME_DOC */
+	    if (New_DTD)
+	        New_DTD = NO;
+	    else
+	        New_DTD = YES;
+	    HTSwitchDTD(New_DTD);
+	    _statusline(New_DTD ?
+		"Now using the experimental DTD!" : "Now using the old Lynx DTD.");
+/*		SOFT_DOUBLE_QUOTE_ON : SOFT_DOUBLE_QUOTE_OFF);*/
+	    sleep(MessageSecs);
+	    break;
+
 #ifdef NOT_DONE_YET
 	case LYK_PIPE:  
 	    /* ignore for now */
@@ -1552,7 +1872,8 @@ new_cmd:  /*
 	    _statusline(REALLY_QUIT);
 	    c = LYgetch();
 #ifdef QUIT_DEFAULT_YES
-	    if (TOUPPER(c) != 'N')
+	    if (TOUPPER(c) != 'N' &&
+	        c != 7)
 #else
 	    if (TOUPPER(c) == 'Y')
 #endif /* QUIT_DEFAULT_YES */
@@ -1585,7 +1906,7 @@ new_cmd:  /*
 		Newline -= display_lines;
 	    } else if (curdoc.link > 0) {
 		highlight(OFF,curdoc.link);
-		curdoc.link = 0;  /* put on last link */
+		curdoc.link = 0;  /* put on first link */
 	    } else if (old_c != real_c) {
 		old_c = real_c;
 		_statusline(ALREADY_AT_BEGIN);
@@ -1665,10 +1986,10 @@ new_cmd:  /*
 	    break;
 
 	case LYK_REFRESH:
-	   refresh_screen=TRUE;
-#ifdef VMS
+	   refresh_screen = TRUE;
+#if defined(VMS) || defined(USE_SLANG)
 	   clearok(curscr, TRUE);
-#endif /* VMS */
+#endif /* VMS || USE_SLANG */
 	   break;
 
 	case LYK_HOME:
@@ -1875,13 +2196,15 @@ new_cmd:  /*
 	    /*
 	     *  Don't do if already viewing the cookie jar.
 	     */	
-	    if (strcmp(curdoc.title, COOKIE_JAR_TITLE)) {
+	    if (strcmp((curdoc.title ? curdoc.title : ""),
+		       COOKIE_JAR_TITLE)) {
 	        StrAllocCopy(newdoc.address, "LYNXCOOKIE:/");
 		FREE(newdoc.post_data);
 		FREE(newdoc.post_content_type);
 		FREE(newdoc.bookmark);
 		newdoc.isHEAD = FALSE;
 		newdoc.safe = FALSE;
+		newdoc.internal_link = FALSE;
 		LYforce_no_cache = TRUE;
 		if (LYValidate || check_realm) {
 		    LYPermitURL = TRUE;
@@ -1904,7 +2227,7 @@ new_cmd:  /*
 		 *  contains the current file for printing purposes.
 		 *  Pop the file afterwards to prevent multiple copies.
 		 */
-		if (TRACE && LYCursesON) {
+		if (TRACE && !LYUseTraceLog && LYCursesON) {
 		    move(LYlines-1, LYcols-1);  /* make sure cursor is down */
 #ifdef USE_SLANG
 		    addstr("\n");
@@ -1920,11 +2243,13 @@ new_cmd:  /*
 		    LYpop(&curdoc);
 		    break;
 		}
+		StrAllocCopy(newdoc.title, HISTORY_PAGE_TITLE);
 		FREE(newdoc.post_data);
 		FREE(newdoc.post_content_type);
 		FREE(newdoc.bookmark);
 		newdoc.isHEAD = FALSE;
 		newdoc.safe = FALSE;
+		newdoc.internal_link = FALSE;
  		FREE(curdoc.address);  /* so it doesn't get pushed */
 
 		refresh_screen = TRUE;
@@ -1969,8 +2294,13 @@ new_cmd:  /*
 		    if (HTAnchor_safe(tmpanchor)) {
 			break;
 		    }
-		    if ((LYresubmit_posts ||
-		         (HText *)HTAnchor_document(tmpanchor) == NULL) &&
+		    if (((HText *)HTAnchor_document(tmpanchor) == NULL ||
+			 (LYresubmit_posts &&
+			  !(curdoc.internal_link &&
+			    !are_phys_different((document *)&history[(nhist - 1)],
+						&curdoc))
+			     )
+			) &&
 			HTConfirm(CONFIRM_POST_RESUBMISSION) == FALSE) {
 			if (nhist == 1) {
 			    _statusline(CANCELLED);
@@ -2130,6 +2460,7 @@ new_cmd:  /*
 			    StrAllocCopy(newdoc.bookmark, curdoc.bookmark);
 			    newdoc.isHEAD = curdoc.isHEAD;
 			    newdoc.safe = curdoc.safe;
+			    newdoc.internal_link = curdoc.internal_link;
 			    break;
 			}
 		    }
@@ -2157,6 +2488,26 @@ new_cmd:  /*
 		    StrAllocCopy(newdoc.address, links[curdoc.link].lname);
 		    StrAllocCopy(newdoc.title, links[curdoc.link].hightext);
 		    /*
+		     *  Might be an internal link anchor in the same doc.
+		     *  If so, take the try_internal shortcut if we didn't
+		     *  fall through from LYK_NOCACHE. - kw
+		     */
+		    newdoc.internal_link =
+			(links[curdoc.link].type == WWW_INTERN_LINK_TYPE);
+		    if (newdoc.internal_link && cmd != LYK_NOCACHE) {
+			if (0==strcmp(curdoc.address, LYlist_temp_url()) &&
+			    0==strcmp((curdoc.title ? curdoc.title : ""),
+				      LIST_PAGE_TITLE)) {
+			    FREE(curdoc.address);
+			} else 
+			    try_internal = TRUE;
+			LYoverride_no_cache = TRUE;	/* ??? */
+			/* We still set force_load so that history pushing
+			** etc. will be done.  - kw */
+			force_load = TRUE;
+			break;
+		    }
+		    /*
 		     *  Might be an anchor in the same doc from a POST
 		     *  form.  If so, dont't free the content. -- FM
 		     */
@@ -2556,6 +2907,7 @@ check_goto_URL:
 		    FREE(newdoc.post_content_type);
 		    FREE(newdoc.bookmark);
 		    newdoc.safe = FALSE;
+		    newdoc.internal_link = FALSE;
 		    force_load = TRUE;
 		    LYUserSpecifiedURL = TRUE;
 #ifdef DIRED_SUPPORT
@@ -2582,6 +2934,7 @@ check_goto_URL:
 		FREE(newdoc.bookmark);
 		newdoc.isHEAD = FALSE;
 		newdoc.safe = FALSE;
+		newdoc.internal_link = FALSE;
 	    }
 	    break;
 
@@ -2606,6 +2959,7 @@ check_goto_URL:
 		    FREE(newdoc.bookmark);
 		    newdoc.isHEAD = FALSE;
 		    newdoc.safe = FALSE;
+		    newdoc.internal_link = FALSE;
 	        } /* end else */
 	    }  /* end if */
 	    break;
@@ -2670,6 +3024,7 @@ check_goto_URL:
 		    FREE(newdoc.bookmark);
 		    newdoc.isHEAD = FALSE;
 		    newdoc.safe = FALSE;
+		    newdoc.internal_link = FALSE;
 	            highlight(OFF,curdoc.link); 
 #ifdef DIRED_SUPPORT
 		    if (lynx_edit_mode)
@@ -2709,9 +3064,14 @@ check_goto_URL:
 		CurrentCharSet_flag != current_char_set ||
 		LYRawMode_flag != LYRawMode ||
 		LYSelectPopups_flag != LYSelectPopups ||
-		(strcmp(CurrentUserAgent, (LYUserAgent ?
-					   LYUserAgent : "")) &&
-		 !strncmp(curdoc.address, "http", 4))) {
+		((strcmp(CurrentUserAgent, (LYUserAgent ?
+					   LYUserAgent : "")) ||
+		  strcmp(CurrentNegoLanguage, (language ?
+					       language : "")) ||
+		  strcmp(CurrentNegoCharset, (pref_charset ?
+					      pref_charset : ""))
+		  ) && (strncmp(curdoc.address, "http", 4) == 0 ||
+			strncmp(curdoc.address, "lynxcgi:", 8) == 0))) {
 	        /*
 		 *  Check if this is a reply from a POST, and if so,
 		 *  seek confirmation of reload if the safe element
@@ -2726,7 +3086,42 @@ check_goto_URL:
 		} else {
 		    LYforce_no_cache = TRUE;
 		    StrAllocCopy(newdoc.address, curdoc.address);
-		    if (keypad_mode_flag != keypad_mode ||
+		    if (((strcmp(CurrentNegoLanguage,
+				 (language ? language : "")) ||
+			  strcmp(CurrentNegoCharset,
+				 (pref_charset ? pref_charset : ""))) &&
+			 (strncmp(curdoc.address, "http", 4) == 0 ||
+			  strncmp(curdoc.address, "lynxcgi:", 8) == 0))) {
+			/*
+			 * An option has changed which may influence
+			 * content negotiation, and the resource is from
+			 * a http or https or lynxcgi URL (the only protocols
+			 * which currently do anything with this information).
+			 * Set reloading=TRUE so that proxy caches will be
+			 * flushed, which is necessary until the time when
+			 * all proxies understand HTTP 1.1 Vary: and all
+			 * Servers properly use it...  Treat like
+			 * case LYK_RELOAD (see comments there). - kw
+			 */
+			if (HTisDocumentSource()) {
+			    HTOutputFormat = WWW_SOURCE;
+			}
+			HEAD_request = HTLoadedDocumentIsHEAD();
+			HTuncache_current_document();
+#ifdef NO_ASSUME_SAME_DOC
+			newdoc.line=1;
+			newdoc.link=0;
+#else
+			if (lynx_mode == FORMS_LYNX_MODE) {
+			    _statusline(RELOADING_FORM);
+			    sleep(AlertSecs);
+			}
+			newdoc.line = ((curdoc.line > 0) ? curdoc.line : 1);
+			newdoc.link = ((curdoc.link > -1) ? curdoc.link : 0);
+#endif /* NO_ASSUME_SAME_DOC */
+		        FREE(curdoc.address);
+			reloading = TRUE;
+		    } else if (keypad_mode_flag != keypad_mode ||
 		        (user_mode_flag != user_mode &&
 			 (user_mode_flag == NOVICE_MODE ||
 			  user_mode == NOVICE_MODE)) ||
@@ -2739,7 +3134,7 @@ check_goto_URL:
 			  !strncmp(curdoc.address, "ftp:", 4))) ||
 			LYSelectPopups_flag != LYSelectPopups ||
 			(strcmp(CurrentUserAgent, (LYUserAgent ?
-			 			   LYUserAgent : "")) &&
+						    LYUserAgent : "")) &&
 			 !strncmp(curdoc.address, "http", 4))) {
 		        HTuncache_current_document();
 		        FREE(curdoc.address);
@@ -2756,6 +3151,10 @@ check_goto_URL:
 		StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
 						LYUserAgent : ""));
 	    }
+	    StrAllocCopy(CurrentNegoLanguage, (language ?
+					       language : ""));
+	    StrAllocCopy(CurrentNegoCharset, (pref_charset ?
+					      pref_charset : ""));
 	    refresh_screen = TRUE; /* to repaint screen */
 	    break;
 
@@ -2774,7 +3173,7 @@ check_goto_URL:
 		    /*
 		     *  Yah, the search succeeded.
 		     */
-		    if (TRACE && LYCursesON) {
+		    if (TRACE && !LYUseTraceLog && LYCursesON) {
 		        /*
 			 *  Make sure cursor is down.
 			 */
@@ -2792,6 +3191,7 @@ check_goto_URL:
 		     */ 
 		    StrAllocCopy(curdoc.address, newdoc.address);
 		    StrAllocCopy(newdoc.post_data, curdoc.post_data);
+		    newdoc.internal_link = FALSE;
 		    curdoc.line = -1;
 		    Newline = 0;
 		    refresh_screen = TRUE; /* redisplay it */
@@ -2811,6 +3211,7 @@ check_goto_URL:
 		    FREE(newdoc.bookmark);
 		    newdoc.isHEAD = FALSE;
 		    newdoc.safe = FALSE;
+		    newdoc.internal_link = FALSE;
 	            FREE(use_this_url_instead);
 		    force_load = TRUE;
 		    break;
@@ -2825,6 +3226,7 @@ check_goto_URL:
 		    StrAllocCopy(newdoc.bookmark, curdoc.bookmark);
 		    newdoc.isHEAD = curdoc.isHEAD;
 		    newdoc.safe = curdoc.safe;
+		    newdoc.internal_link = curdoc.internal_link;
 		}
 	    } else if (old_c != real_c)	{
 		old_c = real_c;
@@ -2836,6 +3238,17 @@ check_goto_URL:
 	case LYK_WHEREIS: /* search within the document */
 	case LYK_NEXT:    /* search for the next occurrence in the document */
             /* user search */
+	{
+	    BOOLEAN have_target_onscreen = (*prev_target != '\0' &&
+					    HText_pageHasPrevTarget());
+	    BOOL found;
+	    int oldcur = curdoc.link; /* temporarily remember */
+	    char *remember_old_target = NULL;
+	    if (have_target_onscreen)
+		StrAllocCopy(remember_old_target, prev_target);
+	    else
+		StrAllocCopy(remember_old_target, "");
+
 	    if (cmd != LYK_NEXT) {
 	        /* 
 		 *  Reset prev_target to force prompting
@@ -2844,7 +3257,7 @@ check_goto_URL:
 		 *  is entered by the user.
 		 */
 	        *prev_target = '\0';
-	        textsearch(&curdoc, prev_target, FALSE);
+	        found = textsearch(&curdoc, prev_target, FALSE);
 	    } else {
 	        /*
 		 *  When the third argument is TRUE, the previous
@@ -2856,7 +3269,7 @@ check_goto_URL:
 		 *  after prev_target was reset on fetch of that
 		 *  document.
 		 */
-	        textsearch(&curdoc, prev_target, TRUE);
+	        found = textsearch(&curdoc, prev_target, TRUE);
 	    }
 	    
 	    /*
@@ -2865,7 +3278,29 @@ check_goto_URL:
 	     *  of highlighting is the default search string
 	     *  was erased without replacement. - FM
 	     */
-	    refresh_screen = TRUE;
+	    /*
+	    ** Well let's try to avoid it at least in a few cases
+	    ** where it is not needed. - kw
+	    */
+	    if (www_search_result >= 0 && www_search_result != curdoc.line) {
+		refresh_screen = TRUE; /* doesn't really matter */
+	    } else if (!found) {
+		refresh_screen = have_target_onscreen;
+	    } else if (!have_target_onscreen && found) {
+		refresh_screen = TRUE;
+	    } else if (www_search_result == curdoc.line &&
+		       curdoc.link == oldcur &&
+		       curdoc.link >= 0 && nlinks > 0 &&
+		       links[curdoc.link].ly >= (display_lines/3)) {
+		refresh_screen = TRUE;
+	    } else if ((case_sensitive && 0!=strcmp(prev_target,
+						    remember_old_target)) ||
+		       (!case_sensitive && 0!=strcasecomp(prev_target,
+							  remember_old_target))) {
+		refresh_screen = TRUE;
+	    }
+	    FREE(remember_old_target);
+	}
 	    break;
 
 	case LYK_COMMENT:  /* reply by mail */
@@ -2931,6 +3366,7 @@ check_goto_URL:
 			 *  The address is a URL.  Just follow the link.
 			 */
 		        StrAllocCopy(newdoc.address, owner_address);
+			newdoc.internal_link = FALSE;
 	            } else {
 		        /*
 			 *  The owner_address is a mailto: URL.
@@ -2947,7 +3383,7 @@ check_goto_URL:
 	      	            reply_by_mail(owner_address, curdoc.address,
 				          (cp ? cp : "")); 
 
-	                refresh_screen=TRUE;  /* to force a showpage */
+	                refresh_screen = TRUE;  /* to force a showpage */
 	           }
 	       }
 	   }
@@ -3007,7 +3443,7 @@ check_goto_URL:
 
 	        ret = local_modify(&curdoc, &newdoc.address);
 	        if (ret == PERMIT_FORM_RESULT) { /* Permit form thrown up */
-		    refresh_screen=TRUE;
+		    refresh_screen = TRUE;
 	        } else if (ret) {
 		    HTuncache_current_document();
 		    StrAllocCopy(newdoc.address, curdoc.address);
@@ -3017,6 +3453,7 @@ check_goto_URL:
 		    FREE(newdoc.bookmark);
 		    newdoc.isHEAD = FALSE;
 		    newdoc.safe = FALSE;
+		    newdoc.internal_link = FALSE;
 		    newdoc.line = curdoc.line;
 		    newdoc.link = curdoc.link;
 		    clear();
@@ -3185,15 +3622,18 @@ check_goto_URL:
 	    /*
 	     *  Don't do if already viewing info page.
 	     */	
-	    if (strcmp((curdoc.title ? curdoc.title : ""), SHOWINFO_TITLE)) {
+	    if (strcmp((curdoc.title ? curdoc.title : ""),
+		       SHOWINFO_TITLE)) {
 	        if (!showinfo(&curdoc, lines_in_file,
 			      &newdoc, owner_address))
 		    break;
+		StrAllocCopy(newdoc.title, SHOWINFO_TITLE);
 		FREE(newdoc.post_data);
 		FREE(newdoc.post_content_type);
 		FREE(newdoc.bookmark);
 		newdoc.isHEAD = FALSE;
 		newdoc.safe = FALSE;
+		newdoc.internal_link = FALSE;
 		LYforce_no_cache = TRUE;
 		if (LYValidate || check_realm)
 		    LYPermitURL = TRUE;
@@ -3224,8 +3664,7 @@ check_goto_URL:
 
                 if (print_options(&newdoc.address, lines_in_file) < 0)
 		    break;
-		if (!strcmp((curdoc.title ? curdoc.title : ""),
-			    HISTORY_PAGE_TITLE))
+		StrAllocCopy(newdoc.title, PRINT_OPTIONS_TITLE);
 		FREE(newdoc.post_data);
 		FREE(newdoc.post_content_type);
 		FREE(newdoc.bookmark);
@@ -3234,7 +3673,7 @@ check_goto_URL:
 		ForcePush = TRUE;
 		if (check_realm)
 		    LYPermitURL = TRUE;
-	        refresh_screen=TRUE;  /* redisplay */
+	        refresh_screen = TRUE;  /* redisplay */
 	    }
 	    break;
 
@@ -3256,11 +3695,13 @@ check_goto_URL:
 	     */
 	    if (showlist(&newdoc.address, TRUE) < 0)
 		break;
+	    StrAllocCopy(newdoc.title, LIST_PAGE_TITLE);
 	    FREE(newdoc.post_data);
 	    FREE(newdoc.post_content_type);
 	    FREE(newdoc.bookmark);
 	    newdoc.isHEAD = FALSE;
 	    newdoc.safe = FALSE;
+	    newdoc.internal_link = FALSE;
 	    refresh_screen = TRUE;  /* redisplay */
 	    if (LYValidate || check_realm) {
 		LYPermitURL = TRUE;
@@ -3269,7 +3710,8 @@ check_goto_URL:
 	    break;
 
 	case LYK_VLINKS:  /* list links visited during the current session */
-	    if (!strcmp(curdoc.title, VISITED_LINKS_TITLE)) {
+	    if (!strcmp((curdoc.title ? curdoc.title : ""),
+			VISITED_LINKS_TITLE)) {
 		/*
 		 *  Already viewing visited links page, so get out.
 		 */
@@ -3285,11 +3727,13 @@ check_goto_URL:
 		sleep(MessageSecs);
 		break;
 	    }
+	    StrAllocCopy(newdoc.title, VISITED_LINKS_TITLE);
 	    FREE(newdoc.post_data);
 	    FREE(newdoc.post_content_type);
 	    FREE(newdoc.bookmark);
 	    newdoc.isHEAD = FALSE;
 	    newdoc.safe = FALSE;
+	    newdoc.internal_link = FALSE;
 	    refresh_screen = TRUE;
 	    if (LYValidate || check_realm) {
 		LYPermitURL = TRUE;
@@ -3315,6 +3759,7 @@ check_goto_URL:
 		    *cp = '#';
 		StrAllocCopy(newdoc.address, toolbar);
 		FREE(toolbar);
+		try_internal = TRUE;
 		force_load = TRUE;  /* force MainLoop to reload */
 	    }
 	    break;
@@ -3454,6 +3899,13 @@ check_goto_URL:
 #endif /* VMS */
 #endif /* DIRED_SUPPORT || VMS*/
 
+#ifdef USE_EXTERNALS
+		  case LYK_EXTERN:  /* use external program on url */
+			 run_external(links[curdoc.link].lname);
+			 refresh_screen = TRUE;
+			 break;
+#endif /* USE_EXTERNALS */
+
 	case LYK_ADD_BOOKMARK:  /* add link to bookmark file */
 	    if (LYValidate) {
 		if (old_c != real_c)	{
@@ -3574,6 +4026,7 @@ check_add_bookmark_to_self:
 		    FREE(curdoc.address);	
 		    newdoc.line = curdoc.line;
 		    newdoc.link = curdoc.link;
+		    newdoc.internal_link = FALSE;
 		}
 		FREE(temp);
 	    } else {
@@ -3613,6 +4066,7 @@ check_add_bookmark_to_self:
 		FREE(newdoc.post_content_type);
 		newdoc.isHEAD = FALSE;
 		newdoc.safe = FALSE;
+		newdoc.internal_link = FALSE;
 	    } else {
 		if (old_c != real_c) {
 		    old_c = real_c;
@@ -3630,6 +4084,13 @@ check_add_bookmark_to_self:
 	        stop_curses();
 		printf(SPAWNING_MSG);
 	        fflush(stdout);
+		fflush(stderr);
+		if (LYTraceLogFP)
+		    /*
+		     *  Set stderr back to its orginal value
+		     *  during the shell escape. - FM
+		     */
+		    *stderr = LYOrigStderr;
 #ifdef DOSPATH	
 	system("cls");	
 	system("echo Type EXIT to return to Lynx.");
@@ -3641,8 +4102,14 @@ check_add_bookmark_to_self:
 	        system("exec $SHELL");
 #endif /* VMS */
 #endif /* DOSPATH */
+		if (LYTraceLogFP)
+		    /*
+		     *  Set stderr back to the log file on
+		     *  return from the shell escape. - FM
+		     */
+		    *stderr = *LYTraceLogFP;
 	        start_curses();
-	        refresh_screen=TRUE;  /* for a showpage */
+	        refresh_screen = TRUE;  /* for a showpage */
 	    } else {
 		if (old_c != real_c)	{
 			old_c = real_c;
@@ -3715,7 +4182,7 @@ check_add_bookmark_to_self:
 
 #ifdef DIRED_SUPPORT
 		} else if (!strcmp((curdoc.title ? curdoc.title : ""),
-				  UPLOAD_OPTIONS_TITLE)) {
+				   UPLOAD_OPTIONS_TITLE)) {
 		    if (old_c != real_c)	{
 			old_c = real_c;
 			_statusline(NO_DOWNLOAD_UPLOAD_OP);
@@ -3739,6 +4206,8 @@ check_add_bookmark_to_self:
                     if (LYdownload_options(&newdoc.address,
 		    			   links[curdoc.link].lname) < 0)
 			StrAllocCopy(newdoc.address, temp);
+		    else
+			newdoc.internal_link = FALSE;
 		    FREE(temp);
 #endif /* DIRED_SUPPORT */
 
@@ -3765,6 +4234,7 @@ check_add_bookmark_to_self:
 				     history[number].post_content_type);
 		    newdoc.isHEAD = history[number].isHEAD;
 		    newdoc.safe = history[number].safe;
+		    newdoc.internal_link = FALSE;
                     newdoc.link = 0;
 	            HTOutputFormat = HTAtom_for("www/download");
 		    LYUserSpecifiedURL = TRUE;
@@ -3788,6 +4258,7 @@ check_add_bookmark_to_self:
 		     */
                     StrAllocCopy(newdoc.address, links[curdoc.link].lname);
                     StrAllocCopy(newdoc.title, links[curdoc.link].hightext);
+		    newdoc.internal_link = FALSE;
 		    /*
 		     *  Might be an anchor in the same doc from a POST
 		     *  form.  If so, don't free the content. -- FM
@@ -3825,11 +4296,13 @@ check_add_bookmark_to_self:
 	    if (lynx_edit_mode && !no_dired_support) {
                 LYUpload_options((char **)&newdoc.address,
 				 (char *)curdoc.address);
+		StrAllocCopy(newdoc.title, UPLOAD_OPTIONS_TITLE);
 		FREE(newdoc.post_data);
 		FREE(newdoc.post_content_type);
 		FREE(newdoc.bookmark);
 		newdoc.isHEAD = FALSE;
 		newdoc.safe = FALSE;
+		newdoc.internal_link = FALSE;
 		/*
 		 *  Uncache the current listing so that it will
 		 *  be updated to included the uploaded file if
@@ -3840,14 +4313,119 @@ check_add_bookmark_to_self:
 	    break;
 #endif /* DIRED_SUPPORT */
 
-	case LYK_TRACE_TOGGLE:
+	case LYK_TRACE_TOGGLE:	/*  Toggle TRACE mode. */
 	    if (WWW_TraceFlag)
-		WWW_TraceFlag = FALSE;	
+		WWW_TraceFlag = FALSE;
 	    else 
-		WWW_TraceFlag = TRUE;	
+		WWW_TraceFlag = TRUE;
 
 	    _statusline(WWW_TraceFlag ? TRACE_ON : TRACE_OFF);
 	    sleep(MessageSecs);
+
+	    if (TRACE && LYUseTraceLog && LYTraceLogFP == NULL) {
+		/*
+		 *  We haven't yet started a TRACE log for this
+		 *  session.  If we can't open the file with write
+		 *  access, turn off TRACE and give up.  Otherwise,
+		 *  on VMS we'll close it and delete it and any
+		 *  log file from a previous session, so they don't
+		 *  accumulate, and then open it again, including
+		 *  "shr=get" to overcome open file locking when
+		 *  attempting to read the log via the TRACE_LOG
+		 *  command. - FM
+		 */
+	        if ((LYTraceLogFP = fopen(LYTraceLogPath, "w")) == NULL) {
+		    WWW_TraceFlag = FALSE;
+		    _statusline(TRACELOG_OPEN_FAILED);
+		    sleep(MessageSecs);
+		    break;
+		}
+#ifdef VMS
+		fclose(LYTraceLogFP);
+		while (remove(LYTraceLogPath) == 0)
+		    ;
+		if ((LYTraceLogFP = fopen(LYTraceLogPath, "w",
+					  "shr=get")) == NULL) {
+		    WWW_TraceFlag == FALSE;
+		    _statusline(TRACELOG_OPEN_FAILED);
+		    sleep(MessageSecs);
+		    break;
+		}
+#endif /* VMS */
+		*stderr = *LYTraceLogFP;
+		fprintf(stderr, "\t\t%s\n\n", LYNX_TRACELOG_TITLE);
+	    }
+	    break;
+
+	case LYK_TRACE_LOG:	/*  View TRACE log. */
+	    /*
+	     *  Check whether we've started a TRACE log
+	     *  in this session. - FM
+	     */
+	    if (LYTraceLogFP == NULL) {
+	        _statusline(NO_TRACELOG_STARTED);
+		sleep(MessageSecs);
+		break;
+	    }
+
+	    /*
+	     *  Don't do if already viewing the TRACE log. - FM
+	     */	
+	    if (!strcmp((curdoc.title ? curdoc.title : ""),
+			LYNX_TRACELOG_TITLE))
+		break;
+
+	    /*
+	     *  If TRACE mode is on, turn it off during this fetch of the
+	     *  TRACE log, so we don't enter stuff about this fetch, and
+	     *  set a flag for turning it back on when we return to this
+	     *  loop.  Note that we'll miss any messages about memory
+	     *  exhaustion if it should occur.  It seems unlikely that
+	     *  anything else bad might happen, but if it does, we'll
+	     *  miss messages about that too.  We also fflush(), close,
+	     *  and open it again, to make sure all stderr messages thus
+	     *  far will be in the log. - FM
+	     */
+	    if (TRACE)
+		fprintf(stderr, "\nTurning off TRACE for fetch of log.\n");
+	    fflush(stderr);
+	    fclose(LYTraceLogFP);
+	    *stderr = LYOrigStderr;
+#ifdef VMS
+	    if ((LYTraceLogFP = fopen(LYTraceLogPath,
+				      "a+", "shr=get")) == NULL)
+#else
+	    if ((LYTraceLogFP = fopen(LYTraceLogPath,
+				      "a+")) == NULL)
+#endif /* VMS */
+	    {
+		WWW_TraceFlag = FALSE;
+		_statusline(TRACELOG_OPEN_FAILED);
+		sleep(MessageSecs);
+		break;
+	    }
+	    *stderr = *LYTraceLogFP;
+	    if (TRACE) {
+		WWW_TraceFlag = FALSE;
+		trace_mode_flag = TRUE;
+	    }
+	    StrAllocCopy(newdoc.address, "file://localhost");
+#ifdef VMS
+	    StrAllocCat(newdoc.address, HTVMS_wwwName(LYTraceLogPath));
+#else
+	    StrAllocCat(newdoc.address, LYTraceLogPath);
+#endif /* VMS */
+	    StrAllocCopy(newdoc.title, LYNX_TRACELOG_TITLE);
+	    FREE(newdoc.post_data);
+	    FREE(newdoc.post_content_type);
+	    FREE(newdoc.bookmark);
+	    newdoc.isHEAD = FALSE;
+	    newdoc.safe = FALSE;
+	    newdoc.internal_link = FALSE;
+	    if (LYValidate || check_realm) {
+		LYPermitURL = TRUE;
+	    }
+	    LYforce_no_cache = TRUE;
 	    break;
 
 	case LYK_IMAGE_TOGGLE:
@@ -3923,7 +4501,10 @@ check_add_bookmark_to_self:
 		    break;
 		} else if (TOUPPER(c) == 'L') {
 		    if (links[curdoc.link].type != WWW_FORM_LINK_TYPE &&
-		    	strncmp(links[curdoc.link].lname, "http", 4)) {
+		    	strncmp(links[curdoc.link].lname, "http", 4) &&
+			(links[curdoc.link].type != WWW_INTERN_LINK_TYPE ||
+			 !curdoc.address ||
+			 strncmp(curdoc.address, "http", 4))) {
 		        _statusline(LINK_NOT_HTTP_URL);
 			sleep(MessageSecs);
 		    } else if (links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
@@ -3989,11 +4570,13 @@ check_add_bookmark_to_self:
 	    if (old_c != real_c) {
 	        old_c = real_c;
 		StrAllocCopy(newdoc.address, "LYNXKEYMAP:");
+		StrAllocCopy(newdoc.title, CURRENT_KEYMAP_TITLE);
 	        FREE(newdoc.post_data);
 	        FREE(newdoc.post_content_type);
 		FREE(newdoc.bookmark);
 		newdoc.isHEAD = FALSE;
 		newdoc.safe = FALSE;
+		newdoc.internal_link = FALSE;
 		/*
 		 *  If vi_keys changed, the keymap did too,
 		 *  so force no cache, and reset the flag. - FM
@@ -4012,9 +4595,9 @@ check_add_bookmark_to_self:
 		 */
 		if (!no_dired_support) {
 		    prev_lynx_edit_mode = lynx_edit_mode;
-		    LYforce_no_cache = TRUE;
 		}
 #endif /* DIRED_SUPPORT && OK_OVERRIDE */
+		LYforce_no_cache = TRUE;
 	    }
 	    break;
 
@@ -4083,6 +4666,7 @@ check_add_bookmark_to_self:
 			FREE(newdoc.bookmark);
 			newdoc.isHEAD = FALSE;
 			newdoc.safe = FALSE;
+			newdoc.internal_link = FALSE;
 			FREE(ret);
 			LYUserSpecifiedURL = TRUE;
 		    } else {
@@ -4178,6 +4762,90 @@ PRIVATE int are_different ARGS2(
     return(FALSE);
 }
 
+/* This determines whether two docs are _physically_ different,
+ * meaning they are "from different files". - kw
+ */
+PRIVATE int are_phys_different ARGS2(
+	document *,	doc1,
+	document *,	doc2)
+{
+    char *cp1, *cp2, *ap1 = doc1->address, *ap2 = doc2->address;
+
+    /*
+     *  Do we have two addresses?
+     */
+    if (!doc1->address || !doc2->address)
+	return (TRUE);
+
+    /*
+     *  Do they differ in the type of request?
+     */
+    if (doc1->isHEAD != doc2->isHEAD)
+        return (TRUE);
+
+    /*
+     * Skip over possible LYNXIMGMAP parts. - kw
+     */
+    if (0==strncmp(doc1->address, "LYNXIMGMAP:", 11))
+	ap1 += 11;
+    if (0==strncmp(doc2->address, "LYNXIMGMAP:", 11))
+	ap2 += 11;
+    /*
+     * If there isn't any real URL in doc2->address, but maybe just
+     * a fragment, doc2 is assumed to be an internal reference in
+     * the same physical document, so return FALSE. - kw
+     */
+    if (*ap2 == '\0' || *ap2 == '#')
+	return(FALSE);
+
+    /*
+     *  See if the addresses are different, making sure
+     *  we're not tripped up by multiple anchors in the
+     *  the same document from a POST form. -- FM
+     */
+    if ((cp1 = strchr(doc1->address, '#')) != NULL)
+        *cp1 = '\0';
+    if ((cp2 = strchr(doc2->address, '#')) != NULL)
+        *cp2 = '\0';
+    /* 
+     *  Are the base addresses different?
+     */
+    if (strcmp(ap1, ap2))
+      {
+        if (cp1)
+	    *cp1 = '#';
+        if (cp2)
+	    *cp2 = '#';
+	return(TRUE);
+      }
+    if (cp1)
+        *cp1 = '#';
+    if (cp2)
+        *cp2 = '#';
+
+    /*
+     *  Do the docs have different contents?
+     */
+    if (doc1->post_data)
+      {
+	if (doc2->post_data)
+	  {
+	    if (strcmp(doc1->post_data, doc2->post_data))
+		return(TRUE);
+	  }
+	else
+	    return(TRUE);
+      }
+    else
+        if (doc2->post_data)
+	    return(TRUE);
+
+    /*
+     *  We'll assume the two documents in fact are the same.
+     */
+    return(FALSE);
+}
+
 /* 
  *  Utility for freeing the list of goto URLs. - FM
  */
diff --git a/src/LYMap.c b/src/LYMap.c
index 4aa0346a..e4141cf6 100644
--- a/src/LYMap.c
+++ b/src/LYMap.c
@@ -32,45 +32,47 @@
 
 extern BOOL reloading;    /* For Flushing Cache on Proxy Server */
 
-typedef struct _MapElement {
+typedef struct _LYMapElement {
    char * address;
    char * title;
-} MapElement;
+   BOOL   intern_flag;
+} LYMapElement;
 
-typedef struct _ImageMap {
+typedef struct _LYImageMap {
    char * address;
    char * title;
    HTList * elements;
-} ImageMap;
+} LYImageMap;
 
 struct _HTStream 
 {
   HTStreamClass * isa;
 };
 
-PUBLIC HTList * LynxMaps = NULL;
+PRIVATE HTList * LynxMaps = NULL;
+
 PUBLIC BOOL LYMapsOnly = FALSE;
 
 /* 
- * Utility for freeing the list of MAPs. - FM
+ *  Utility for freeing the list of MAPs. - FM
  */
 PRIVATE void LYLynxMaps_free NOARGS
 {
-    ImageMap *map;
-    MapElement *element;
+    LYImageMap *map;
+    LYMapElement *element;
     HTList *cur = LynxMaps;
     HTList *current;
 
     if (!cur)
         return;
 
-    while (NULL != (map = (ImageMap *)HTList_nextObject(cur))) {
+    while (NULL != (map = (LYImageMap *)HTList_nextObject(cur))) {
         FREE(map->address);
 	FREE(map->title);
 	if (map->elements) {
 	    current = map->elements;
 	    while (NULL !=
-	    	   (element = (MapElement *)HTList_nextObject(current))) {
+	    	   (element = (LYMapElement *)HTList_nextObject(current))) {
 	        FREE(element->address);
 		FREE(element->title);
 		FREE(element);
@@ -86,14 +88,21 @@ PRIVATE void LYLynxMaps_free NOARGS
 }
 
 /* 
- * Utility for creating an ImageMap list (LynxMaps), if it doesn't
- * exist already, and adding ImageMap entry structures. - FM
+ *  Utility for creating an LYImageMap list (LynxMaps), if it doesn't
+ *  exist already, adding LYImageMap entry structures if needed, and
+ *  removing any LYMapElements in a pre-existing LYImageMap entry so that
+ *  it will have only those from AREA tags for the current analysis of
+ *  MAP element content. - FM
  */
-PUBLIC BOOL LYAddImageMap ARGS2(char *, address, char *, title)
+PUBLIC BOOL LYAddImageMap ARGS2(
+	char *,		address,
+	char *,		title)
 {
-    ImageMap *new = NULL;
-    ImageMap *old;
+    LYImageMap *new = NULL;
+    LYImageMap *old = NULL;
     HTList *cur = NULL;
+    HTList *curele = NULL;
+    LYMapElement *ele = NULL;
 
     if (!(address && *address))
         return FALSE;
@@ -103,14 +112,28 @@ PUBLIC BOOL LYAddImageMap ARGS2(char *, address, char *, title)
 	atexit(LYLynxMaps_free);
     } else {
         cur = LynxMaps;
-	while (NULL != (old = (ImageMap *)HTList_nextObject(cur))) {
+	while (NULL != (old = (LYImageMap *)HTList_nextObject(cur))) {
 	    if (!strcmp(old->address, address)) {
-		return TRUE;
+		FREE(old->address);
+		FREE(old->title);
+		if (old->elements) {
+		    curele = old->elements;
+		    while (NULL !=
+		    	   (ele = (LYMapElement *)HTList_nextObject(curele))) {
+		        FREE(ele->address);
+			FREE(ele->title);
+			FREE(ele);
+		    }
+		    HTList_delete(old->elements);
+		    old->elements = NULL;
+		}
+		break;
 	    }
 	}
     }
 
-    new = (ImageMap *)calloc(1, sizeof(ImageMap));
+    new = (old != NULL) ?
+		    old : (LYImageMap *)calloc(1, sizeof(LYImageMap));
     if (new == NULL) {
 	perror("Out of memory in LYAddImageMap");
 	return FALSE;
@@ -118,18 +141,23 @@ PUBLIC BOOL LYAddImageMap ARGS2(char *, address, char *, title)
     StrAllocCopy(new->address, address);
     if (title && *title)
         StrAllocCopy(new->title, title);
-    HTList_addObject(LynxMaps, new);
+    if (new != old)
+        HTList_addObject(LynxMaps, new);
     return TRUE;
 }
 
 /* 
- * Utility for adding MapElements to ImageMaps
+ * Utility for adding LYMapElements to LYImageMaps
  * in the LynxMaps list. - FM
  */
-PUBLIC BOOL LYAddMapElement ARGS3(char *,map, char *,address, char *, title)
+PUBLIC BOOL LYAddMapElement ARGS4(
+	char *,		map,
+	char *,		address,
+	char *,		title,
+				  BOOL,	intern_flag)
 {
-    MapElement *new = NULL;
-    ImageMap *theMap = NULL;
+    LYMapElement *new = NULL;
+    LYImageMap *theMap = NULL;
     HTList *cur = NULL;
 
     if (!(map && *map && address && *address))
@@ -139,7 +167,7 @@ PUBLIC BOOL LYAddMapElement ARGS3(char *,map, char *,address, char *, title)
         LYAddImageMap(map, NULL);
 
     cur = LynxMaps;
-    while (NULL != (theMap = (ImageMap *)HTList_nextObject(cur))) {
+    while (NULL != (theMap = (LYImageMap *)HTList_nextObject(cur))) {
         if (!strcmp(theMap->address, map)) {
 	    break;
 	}
@@ -149,7 +177,7 @@ PUBLIC BOOL LYAddMapElement ARGS3(char *,map, char *,address, char *, title)
     if (!theMap->elements)
         theMap->elements = HTList_new();
     cur = theMap->elements;
-    while (NULL != (new = (MapElement *)HTList_nextObject(cur))) {
+    while (NULL != (new = (LYMapElement *)HTList_nextObject(cur))) {
         if (!strcmp(new->address, address)) {
 	    FREE(new->address);
 	    FREE(new->title);
@@ -159,7 +187,7 @@ PUBLIC BOOL LYAddMapElement ARGS3(char *,map, char *,address, char *, title)
 	}
     }
 
-    new = (MapElement *)calloc(1, sizeof(MapElement));
+    new = (LYMapElement *)calloc(1, sizeof(LYMapElement));
     if (new == NULL) {
 	perror("Out of memory in LYAddMapElement");
 	return FALSE;
@@ -169,10 +197,36 @@ PUBLIC BOOL LYAddMapElement ARGS3(char *,map, char *,address, char *, title)
         StrAllocCopy(new->title, title);
     else
         StrAllocCopy(new->title, address);
+    new->intern_flag = intern_flag;
     HTList_appendObject(theMap->elements, new);
     return TRUE;
 }
 
+/*
+ *  Utility for checking whether an LYImageMap entry
+ *  with a given address already exists in the LynxMaps
+ *  structure. - FM
+ */
+#if UNUSED
+PUBLIC BOOL LYHaveImageMap ARGS1(
+	char *,		address)
+{
+    LYImageMap *Map;
+    HTList *cur = LynxMaps;
+
+    if (!(cur && address && *address != '\0'))
+        return FALSE;
+
+    while (NULL != (Map = (LYImageMap *)HTList_nextObject(cur))) {
+	if (!strcmp(Map->address, address)) {
+	    return TRUE;
+	}
+    }
+
+    return FALSE;
+}
+#endif
+
 /* 	LYLoadIMGmap - F.Macrides (macrides@sci.wfeb.edu)
 **	------------
 **  	Create a text/html stream with a list of links
@@ -188,8 +242,8 @@ PRIVATE int LYLoadIMGmap ARGS4 (
     HTFormat format_in = WWW_HTML;
     HTStream *target = NULL;
     char buf[1024];
-    MapElement *new = NULL;
-    ImageMap *theMap = NULL;
+    LYMapElement *new = NULL;
+    LYImageMap *theMap = NULL;
     char *MapTitle = NULL;
     char *MapAddress = NULL;
     HTList *cur = NULL;
@@ -239,7 +293,7 @@ PRIVATE int LYLoadIMGmap ARGS4 (
     }
 
     cur = LynxMaps;
-    while (NULL != (theMap = (ImageMap *)HTList_nextObject(cur))) {
+    while (NULL != (theMap = (LYImageMap *)HTList_nextObject(cur))) {
         if (!strcmp(theMap->address, address)) {
 	    break;
 	}
@@ -268,7 +322,7 @@ PRIVATE int LYLoadIMGmap ARGS4 (
 	HTOutputFormat = old_format_out;
 	LYMapsOnly = FALSE;
 	cur = LynxMaps;
-	while (NULL != (theMap = (ImageMap *)HTList_nextObject(cur))) {
+	while (NULL != (theMap = (LYImageMap *)HTList_nextObject(cur))) {
 	    if (!strcmp(theMap->address, address)) {
 		break;
 	    }
@@ -279,6 +333,8 @@ PRIVATE int LYLoadIMGmap ARGS4 (
 	}
     }
 
+    anAnchor->no_cache = TRUE;
+
     target = HTStreamStack(format_in, 
 			   format_out,
 			   sink, anAnchor);
@@ -321,15 +377,19 @@ PRIVATE int LYLoadIMGmap ARGS4 (
     				   "ul" : "ol");
     (*target->isa->put_block)(target, buf, strlen(buf));
     cur = theMap->elements;
-    while (NULL != (new=(MapElement *)HTList_nextObject(cur))) {
+    while (NULL != (new=(LYMapElement *)HTList_nextObject(cur))) {
         StrAllocCopy(MapAddress, new->address);
 	LYEntify(&MapAddress, FALSE);
-        sprintf(buf, "<li><a href=\"%s\"\n", MapAddress);
-	(*target->isa->put_block)(target, buf, strlen(buf));
+	(*target->isa->put_block)(target, "<li><a href=\"", 13);
+	(*target->isa->put_block)(target, MapAddress, strlen(MapAddress));
+	if (new->intern_flag)
+	    (*target->isa->put_block)(target, "\" TYPE=\"internal link\"\n>",24);
+	else
+	    (*target->isa->put_block)(target, "\"\n>", 3);
         StrAllocCopy(MapTitle, new->title);
 	LYEntify(&MapTitle, TRUE);
-	sprintf(buf, ">%s</a>\n", MapTitle);
-	(*target->isa->put_block)(target, buf, strlen(buf));
+	(*target->isa->put_block)(target, MapTitle, strlen(MapTitle));
+	(*target->isa->put_block)(target, "</a>\n", 5);
     }
     sprintf(buf,"</%s>\n</body>\n", (keypad_mode == LINKS_ARE_NUMBERED) ?
     				      "ul" : "ol");
diff --git a/src/LYMap.h b/src/LYMap.h
index 4620cfbe..48829eb7 100644
--- a/src/LYMap.h
+++ b/src/LYMap.h
@@ -5,6 +5,6 @@
 extern BOOL LYMapsOnly;
 
 extern BOOL LYAddImageMap PARAMS((char *address, char *title));
-extern BOOL LYAddMapElement PARAMS((char *map, char *address, char *title));
+extern BOOL LYAddMapElement PARAMS((char *map, char *address, char *title, BOOL intern_flag));
 
 #endif /* LYMAP_H */
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 236ba680..b26ee2ad 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -111,15 +111,14 @@ draw_options:
     response = 0;
     clear(); 
     move(0, 5);
-    if (bold_H1 || bold_headers)
-        start_bold();
+    
+    lynx_start_h1_color ();
     addstr("         Options Menu (");
     addstr(LYNX_NAME);
     addstr(" Version ");
     addstr(LYNX_VERSION);
     addch(')');
-    if (bold_H1 || bold_headers)
-        stop_bold();
+    lynx_stop_h1_color ();
     move(L_EDITOR, 5);  
     addstr("E)ditor                      : ");
     addstr((editor && *editor) ? editor : "NONE");
@@ -258,9 +257,9 @@ draw_options:
 	   response != 7 &&  response != 3) {
 
            move(LYlines-2, 0);
-	   start_reverse();
+           lynx_start_prompt_color ();
 	   addstr(COMMAND_PROMPT);
-	   stop_reverse();
+           lynx_stop_prompt_color ();
 
 	   refresh();
            response = LYgetch();
@@ -965,18 +964,25 @@ PRIVATE int boolean_choice ARGS4(
 
     number--;
 
-    option_statusline(ACCEPT_DATA);
+    /*
+     *  Update the statusline.
+     */
+    option_statusline(ANY_KEY_CHANGE_RET_ACCEPT);
+
     /*
      *  Highlight the current selection.
      */
     move(line, col);
     standout();
     addstr(choices[status]);
+    refresh();
 
-    standend();
-    option_statusline(ANY_KEY_CHANGE_RET_ACCEPT);
-    standout();
-
+    /*
+     *  Get the keyboard entry, and leave the
+     *  cursor at the choice, to indicate that
+     *  it can be changed, until the user accepts
+     *  the current choice.
+     */
     while (1) {
 	move(line, col);
 	response = LYgetch();
@@ -1038,7 +1044,7 @@ PRIVATE int boolean_choice ARGS4(
 	    addstr(choices[status]);
 
 	    option_statusline(VALUE_ACCEPTED);
-	     return(status);
+	    return(status);
 	}
     }
 }
@@ -1087,16 +1093,17 @@ draw_bookmark_list:
      */
     clear(); 
     move(0, 5);
-    if (bold_H1 || bold_headers)
-        start_bold();
+
+    lynx_start_h1_color ();
+
     if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {
         sprintf(ehead_buffer, MULTIBOOKMARKS_EHEAD_MASK, MBM_current);
 	addstr(ehead_buffer);
     } else {
         addstr(MULTIBOOKMARKS_EHEAD);
     }
-    if (bold_H1 || bold_headers)
-        stop_bold();
+    
+   lynx_stop_h1_color ();
 
     if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {
 	for (a = ((MBM_V_MAXFILES/2 + 1) * (MBM_current - 1));
@@ -1169,9 +1176,10 @@ draw_bookmark_list:
 	   response != '>') {
 
 	move((LYlines - 2), 0);
-	start_reverse();
+        
+	lynx_start_prompt_color ();
 	addstr(MULTIBOOKMARKS_LETTER);
-	stop_reverse();
+	lynx_stop_prompt_color ();
 
 	refresh();
         response = (def_response ? def_response : LYgetch());
diff --git a/src/LYPrint.c b/src/LYPrint.c
index f7cf2e34..3bd365d7 100644
--- a/src/LYPrint.c
+++ b/src/LYPrint.c
@@ -22,6 +22,10 @@
 #ifdef DOSPATH
 #include "HTDOS.h"
 #endif
+#ifdef EXP_CHARTRANS
+#include "LYCharSets.h"  /* to get current charset for mail header */
+extern BOOLEAN LYHaveCJKCharacterSet;
+#endif
 
 #include "LYLeaks.h"
 
@@ -61,7 +65,7 @@ PUBLIC int printfile ARGS1(document *,newdoc)
     int pages = 0;
     int type = 0, c, len;
     FILE *outfile_fp;
-    char *cp;
+    char *cp = NULL;
     lynx_printer_item_type *cur_printer;
     char *sug_filename = NULL;
     char *link_info = NULL;
@@ -74,6 +78,8 @@ PUBLIC int printfile ARGS1(document *,newdoc)
     char *content_base = NULL, *content_location = NULL;
     HTFormat format;
     HTAtom *encoding;
+    BOOL use_mime, use_cte, use_type;
+    char *disp_charset;
 #ifdef VMS
     extern BOOLEAN HadVMSInterrupt;
 #endif /* VMS */
@@ -134,6 +140,27 @@ PUBLIC int printfile ARGS1(document *,newdoc)
         StrAllocCopy(sug_filename, HText_getSugFname()); /* must be freed */
     else
         StrAllocCopy(sug_filename, newdoc->address); /* must be freed */
+    /*
+     *  Strip any gzip or compress suffix, if present. - FM
+     */
+    cp = NULL;
+    if (strlen(sug_filename) > 3) {
+        cp = (char *)&sug_filename[(strlen(sug_filename) - 3)];
+        if ((*cp == '.' || *cp == '-' || *cp == '_') &&
+	    !strcasecomp((cp + 1), "gz")) {
+	    *cp = '\0';
+	} else {
+	    cp = NULL;
+	}
+    }
+    if ((cp == NULL) && strlen(sug_filename) > 2) {
+        cp = (char *)&sug_filename[(strlen(sug_filename) - 2)];
+        if ((*cp == '.' || *cp == '-' || *cp == '_') &&
+	    !strcasecomp((cp + 1), "Z")) {
+	    *cp = '\0';
+	}
+    }
+    cp = NULL;
 
     /*
      *  Get the number of lines in the file.
@@ -523,17 +550,47 @@ PUBLIC int printfile ARGS1(document *,newdoc)
 			break;
 		}
 #endif
+		
+		/*
+		 *  Determine which mail headers should be sent.
+		 *  Send Content-Transfer-Encoding only if the document
+		 *  has 8-bit characters.  Send a charset parameter only
+		 *  if the document has 8-bit characters and we we seem
+		 *  to have a valid charset.  Also use Content-Type
+		 *  and MIME-Version headers only if needed.  - kw
+		 */
+		use_cte = HTLoadedDocumentEightbit();
+#ifdef EXP_CHARTRANS
+		disp_charset = LYCharSet_UC[current_char_set].MIMEname;
+		/*
+		 *  Don't send a charset if we have a CJK character set
+		 *  selected, since it may not be appropriate for mail...
+		 *  Also don't use an inofficial "x-" charset. - kw
+		 */
+		if (!use_cte || LYHaveCJKCharacterSet ||
+		    strncasecomp(disp_charset, "x-", 2) == 0)
+		    disp_charset = NULL;
+#else
+		disp_charset = HTLoadedDocumentCharset();
+#endif /* EXP_CHARTRANS */
+		use_type =  (disp_charset || HTisDocumentSource());
+		use_mime = (use_cte || use_type);
+
+		if (use_mime) {
+		    fprintf(outfile_fp, "Mime-Version: 1.0\n");
+		    if (use_cte)
+			fprintf(outfile_fp, "Content-Transfer-Encoding: 8bit\n");
+		}
+
 		if (HTisDocumentSource()) {
 		    /*
 		     *  Add Content-Type, Content-Location, and
 		     *  Content-Base headers for HTML source. - FM
-		     *  Also add Mime-Version header. - HM
 		     */
-		    fprintf(outfile_fp, "Mime-Version: 1.0\n");
 		    fprintf(outfile_fp, "Content-Type: text/html");
-		    if (HTLoadedDocumentCharset() != NULL) {
+		    if (disp_charset != NULL) {
 		        fprintf(outfile_fp, "; charset=%s\n",
-					    HTLoadedDocumentCharset());
+					    disp_charset);
 		    } else {
 		        fprintf(outfile_fp, "\n");
 		    }
@@ -541,6 +598,17 @@ PUBLIC int printfile ARGS1(document *,newdoc)
 		    			content_base);
 		    fprintf(outfile_fp, "Content-Location: %s\n",
 		    			content_location);
+		} else {
+		    /*
+                     * Add Content-Type: text/plain if we have 8-bit
+		     * characters and a valid charset for non-source
+		     * documents. - kw
+                     */
+		    if (disp_charset != NULL) {
+			fprintf(outfile_fp,
+				"Content-Type: text/plain; charset=%s\n",
+				disp_charset);
+		    }
 		}
 		fprintf(outfile_fp, "X-URL: %s\n", newdoc->address);
 		fprintf(outfile_fp, "To: %s\nSubject:%s\n\n",
@@ -983,16 +1051,18 @@ PUBLIC int print_options ARGS2(char **,newfile, int,lines_in_file)
     	    lines_in_file, pages, (pages > 1 ? "s" : ""));
     fputs(buffer,fp0);
 
-    if (no_print || child_lynx || no_mail)
+    if (no_print || no_disk_save || child_lynx || no_mail)
 	fputs("Some print functions have been disabled!!!<br>\n", fp0);
 
     fputs("You have the following print choices.<br>\n", fp0);
     fputs("Please select one:<br>\n<pre>\n", fp0);
 
-    if (child_lynx == FALSE && no_print == FALSE)
+    if (child_lynx == FALSE && no_disk_save == FALSE && no_print == FALSE)
         fprintf(fp0,
    "   <a href=\"LYNXPRINT://LOCAL_FILE/lines=%d\">Save to a local file</a>\n",
 	 	lines_in_file);
+    else
+	fprintf(fp0,"   Save to disk disabled.\n");
     if (child_lynx == FALSE && no_mail == FALSE)
          fprintf(fp0,
    "   <a href=\"LYNXPRINT://MAIL_FILE/lines=%d\">Mail the file</a>\n",
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index 69c56c63..1ec86c3c 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -6,6 +6,9 @@
 #include "LYStructs.h"
 #include "LYGlobalDefs.h"
 #include "LYCharSets.h"
+#ifdef EXP_CHARTRANS
+#include "UCMap.h"
+#endif /* EXP_CHARTRANS */
 #include "LYKeymap.h"
 #include "LYJump.h"
 #include "LYGetFile.h"
@@ -102,6 +105,18 @@ PRIVATE void free_item_list NOARGS
     uploaders = NULL;
 #endif /* DIRED_SUPPORT */
 
+#ifdef USE_EXTERNALS
+    cur = externals;
+    while (cur) {
+        next = cur->next;
+    	FREE(cur->name);
+    	FREE(cur->command);
+	FREE(cur);
+        cur = next;
+    }
+    externals = NULL;
+#endif /* USE_EXTERNALS */
+
     return;
 }
 
@@ -273,7 +288,7 @@ PRIVATE void add_printer_to_list ARGS2(
     }
 }
 
-#if defined(USE_SLANG) || defined(COLOR_CURSES)
+#if USE_COLOR_TABLE
 #ifdef DOSPATH /* I.E. broken curses */
 static char *Color_Strings[16] =
 {
@@ -397,7 +412,7 @@ PRIVATE void parse_color ARGS1(
 	exit_with_color_syntax();
 #endif
 }
-#endif /* defined(USE_SLANG) || defined(COLOR_CURSES) */
+#endif /* USE_COLOR_TABLE */
 
 /*
  * Process the configuration file (lynx.cfg).
@@ -475,6 +490,30 @@ PUBLIC void read_cfg ARGS1(
 	} else if (!strncasecomp(buffer, "ALWAYS_TRUSTED_EXEC:", 20)) {
 	    add_trusted(&buffer[20], ALWAYS_EXEC_PATH); /* Add exec path */
 #endif /* EXEC_LINKS */
+
+#ifdef EXP_CHARTRANS
+	} else if (!strncasecomp(buffer, "ASSUME_CHARSET:", 15)) {
+	    StrAllocCopy(UCAssume_MIMEcharset, buffer+15);
+	    for (i = 0; UCAssume_MIMEcharset[i]; i++)
+	        UCAssume_MIMEcharset[i] = TOLOWER(UCAssume_MIMEcharset[i]);
+	    UCLYhndl_for_unspec =
+		UCGetLYhndl_byMIME(UCAssume_MIMEcharset);
+
+	} else if (!strncasecomp(buffer, "ASSUME_LOCAL_CHARSET:", 21)) {
+	    StrAllocCopy(UCAssume_localMIMEcharset, buffer+21);
+	    for (i = 0; UCAssume_localMIMEcharset[i]; i++)
+	        UCAssume_localMIMEcharset[i] = TOLOWER(UCAssume_localMIMEcharset[i]);
+	    UCLYhndl_HTFile_for_unspec =
+		UCGetLYhndl_byMIME(UCAssume_localMIMEcharset);
+
+	} else if (!strncasecomp(buffer, "ASSUME_UNREC_CHARSET:", 21)) {
+	    StrAllocCopy(UCAssume_unrecMIMEcharset, buffer+21);
+	    for (i = 0; UCAssume_unrecMIMEcharset[i]; i++)
+	        UCAssume_unrecMIMEcharset[i] = TOLOWER(UCAssume_unrecMIMEcharset[i]);
+	    UCLYhndl_for_unrec =
+		UCGetLYhndl_byMIME(UCAssume_unrecMIMEcharset);
+#endif /* EXP_CHARTRANS */
+
 	}
 	break;
 
@@ -513,10 +552,10 @@ PUBLIC void read_cfg ARGS1(
 	} else if (!strncasecomp(buffer, "COLLAPSE_BR_TAGS:", 17)) {
 		LYCollapseBRs = is_true(buffer+17);
 
-#if defined(USE_SLANG) || defined(COLOR_CURSES)
+#if USE_COLOR_TABLE
 	} else if (!strncasecomp(buffer, "COLOR:", 6)) {
 		parse_color(buffer + 6);
-#endif /* defined(USE_SLANG) || defined(COLOR_CURSES) */
+#endif /* USE_COLOR_TABLE */
 
 	} else if (!strncasecomp(buffer, "cso_proxy:", 10)) {
 	    if (getenv("cso_proxy") == NULL) {
@@ -593,6 +632,11 @@ PUBLIC void read_cfg ARGS1(
 	} else if (!strncasecomp(buffer, "ENABLE_SCROLLBACK:", 18)) {
 	    enable_scrollback = is_true(buffer+18);
 	}
+#ifdef USE_EXTERNALS
+        else if(!strncasecomp(buffer,"EXTERNAL:",9)) {
+            add_item_to_list(&buffer[9],&externals);
+                }
+#endif
 	break;
 
 	case 'F':
@@ -820,11 +864,7 @@ PUBLIC void read_cfg ARGS1(
 	break;
 
 	case 'N':
-	if (!strncasecomp(buffer, "NEWS_POSTING:", 13)) {
-	    LYNewsPosting = is_true(buffer+13);
-	    no_newspost = (LYNewsPosting == FALSE);
-
-	} else if (!strncasecomp(buffer, "NEWS_CHUNK_SIZE:", 16)) {
+	if (!strncasecomp(buffer, "NEWS_CHUNK_SIZE:", 16)) {
 		HTNewsChunkSize = atoi(buffer+16);
 		/*
 		 * If the new HTNewsChunkSize exceeds the maximum,
@@ -844,6 +884,10 @@ PUBLIC void read_cfg ARGS1(
 		    HTNewsChunkSize = HTNewsMaxChunk;
 		}
 
+	} else if (!strncasecomp(buffer, "NEWS_POSTING:", 13)) {
+	    LYNewsPosting = is_true(buffer+13);
+	    no_newspost = (LYNewsPosting == FALSE);
+
 	} else if (!strncasecomp(buffer, "news_proxy:", 11)) {
 	    if (getenv("news_proxy") == NULL) {
 #ifdef VMS
@@ -918,6 +962,9 @@ PUBLIC void read_cfg ARGS1(
 	} else if (!strncasecomp(buffer, "NO_FROM_HEADER:", 15)) {
 	    LYNoFromHeader = is_true(buffer+15);
 
+	} else if (!strncasecomp(buffer, "NO_ISMAP_IF_USEMAP:", 19)) {
+	    LYNoISMAPifUSEMAP = is_true(buffer+19);
+
 	} else if (!strncasecomp(buffer, "no_proxy:", 9)) {
 	    if (getenv("no_proxy") == NULL) {
 #ifdef VMS
@@ -1012,6 +1059,9 @@ PUBLIC void read_cfg ARGS1(
 	} else if (!strncasecomp(buffer, "STARTFILE:", 10)) {
 	    StrAllocCopy(startfile, buffer+10);
 
+	} else if (!strncasecomp(buffer, "STRIP_DOTDOT_URLS:", 18)) {
+	    LYStripDotDotURLs = is_true(buffer+18);
+
 	} else if (!strncasecomp(buffer, "SUBSTITUTE_UNDERSCORES:", 23)) {
 	    use_underscore = is_true(buffer+23);
 
@@ -1082,7 +1132,7 @@ PUBLIC void read_cfg ARGS1(
 	    UseFixedRecords = is_true(buffer+18);
 #endif /* VMS */
 
-#ifdef NCURSES_MOUSE_VERSION
+#if defined(NCURSES_MOUSE_VERSION) || defined(USE_SLANG_MOUSE)
 	} else if(!strncasecomp(buffer, "USE_MOUSE:",10)) {
 		LYUseMouse = is_true(buffer+10);
 #endif
@@ -1161,7 +1211,7 @@ PUBLIC void read_cfg ARGS1(
 
 	case 'X':
 	if (!strncasecomp(buffer, "XLOADIMAGE_COMMAND:", 19)) {
-	    StrAllocCat(XLoadImageCommand, (char *)&buffer[19]);
+	    StrAllocCopy(XLoadImageCommand, (char *)&buffer[19]);
 	}
 	break;
 
diff --git a/src/LYSearch.c b/src/LYSearch.c
index 7dd6c26b..495e9e19 100644
--- a/src/LYSearch.c
+++ b/src/LYSearch.c
@@ -9,36 +9,151 @@
 
 #include "LYLeaks.h"
 
+#define FREE(x) if (x) {free(x); x = NULL;}
+
 /*
- * search for the target string inside of the links
- * that are currently displayed on the screen beginning
- * with the one after the currently selected one!
- * if found set cur to the new value and return true
- * in not found do not reset cur and return false.
+ *  Search for the target string inside of the links
+ *  that are currently displayed on the screen beginning
+ *  with the one after the currently selected one.
+ *  If found set cur to the new value and return TRUE.
+ *  If not found do not reset cur and return FALSE.
  */
 
-PRIVATE int check_for_target_in_links ARGS2(int *,cur, char *,new_target)
+PRIVATE int check_for_target_in_links ARGS2(
+	int *,		cur,
+	char *,		new_target)
 {
-    int i = *cur+1;
+    int i = *cur + 1;
+    OptionType *option;
+    char *stars = NULL, *cp;
 
-    if(nlinks==0)
+    if (nlinks == 0)
 	return(FALSE);
 
-    for(; i < nlinks; i++)
-        if(case_sensitive) {
-	    if(strstr(links[i].hightext,new_target) != NULL)
-		break;
-        } else {
-	    if(LYstrstr(links[i].hightext,new_target) != NULL)
-		break;
+    for (; i < nlinks; i++) {
+        /*
+	 *  Search the hightext string, and hightext2 if present,
+	 *  taking the case_sensitive setting into account. - FM
+	 */
+	if (((links[i].hightext != NULL && case_sensitive == TRUE) &&
+	     LYno_attr_char_strstr(links[i].hightext, new_target)) ||
+	    ((links[i].hightext != NULL && case_sensitive == FALSE) &&
+	     LYno_attr_char_case_strstr(links[i].hightext, new_target))) {
+	    break;
+	}
+	if (((links[i].hightext2 != NULL && case_sensitive == TRUE) &&
+	     LYno_attr_char_strstr(links[i].hightext2, new_target)) ||
+	    ((links[i].hightext2 != NULL && case_sensitive == FALSE) &&
+	     LYno_attr_char_case_strstr(links[i].hightext2, new_target))) {
+	    break;
+	}
+
+	/*
+	 *  Search the relevant form fields, taking the
+	 *  case_sensitive setting into account. - FM
+	 */
+	if ((links[i].form != NULL && links[i].type == WWW_FORM_LINK_TYPE &&
+	     links[i].form->value != NULL) &&
+	    links[i].form->type != F_HIDDEN_TYPE) {
+	    if (links[i].form->type == F_PASSWORD_TYPE) {
+	        /*
+		 *  Check the actual, hidden password, and then
+		 *  the displayed string. - FM
+		 */
+		if (((case_sensitive == TRUE) &&
+		     LYno_attr_char_strstr(links[i].form->value,
+					   new_target)) ||
+		    ((case_sensitive == FALSE) &&
+		     LYno_attr_char_case_strstr(links[i].form->value,
+						new_target))) {
+		    break;
+		}
+		StrAllocCopy(stars, links[i].form->value);
+		for (cp = stars; *cp != '\0'; cp++)
+		    *cp = '*';
+		if (((case_sensitive == TRUE) &&
+		     LYno_attr_char_strstr(stars, new_target)) ||
+		    ((case_sensitive == FALSE) &&
+		     LYno_attr_char_case_strstr(stars, new_target))) {
+		    FREE(stars);
+		    break;
+		}
+		FREE(stars);
+	    } else if (links[i].form->type == F_OPTION_LIST_TYPE) {
+		/*
+		 *  Search the option strings that are displayed
+		 *  when the popup is invoked. - FM
+		 */
+		option = links[i].form->select_list;
+		while (option != NULL) {
+		    if (((option->name != NULL &&
+			  case_sensitive == TRUE) &&
+			 LYno_attr_char_strstr(option->name, new_target)) ||
+			((option->name != NULL &&
+			  case_sensitive == FALSE) &&
+			 LYno_attr_char_case_strstr(option->name,
+						    new_target))) {
+			break;
+		    }
+		    option = option->next;
+		}
+		if (option != NULL) {
+		    break;
+		}
+	    } else if (links[i].form->type == F_RADIO_TYPE) {
+		/*
+		 *  Search for checked or unchecked parens. - FM
+		 */
+	        if (links[i].form->num_value) {
+		    cp = checked_radio;
+		} else {
+		    cp = unchecked_radio;
+		}
+		if (((case_sensitive == TRUE) &&
+		     LYno_attr_char_strstr(cp, new_target)) ||
+		    ((case_sensitive == FALSE) &&
+		     LYno_attr_char_case_strstr(cp, new_target))) {
+		    break;
+		}
+	    } else if (links[i].form->type == F_CHECKBOX_TYPE) {
+		/*
+		 *  Search for checked or unchecked square brackets. - FM
+		 */
+	        if (links[i].form->num_value) {
+		    cp = checked_box;
+		} else {
+		    cp = unchecked_box;
+		}
+		if (((case_sensitive == TRUE) &&
+		     LYno_attr_char_strstr(cp, new_target)) ||
+		    ((case_sensitive == FALSE) &&
+		     LYno_attr_char_case_strstr(cp, new_target))) {
+		    break;
+		}
+	    } else {
+	        /*
+		 *  Check the values intended for display.
+		 *  May have been found already via the
+		 *  hightext search, but make sure here
+		 *  that the entire value is searched. - FM
+		 */
+		if (((case_sensitive == TRUE) &&
+		     LYno_attr_char_strstr(links[i].form->value,
+					   new_target)) ||
+		    ((case_sensitive == FALSE) &&
+		     LYno_attr_char_case_strstr(links[i].form->value,
+						new_target))) {
+		    break;
+		}
+	    }
 	}
+    }
 
     if (i == nlinks)
 	return(FALSE);
  
-    /* else */
-        *cur = i;
-        return(TRUE);
+    *cur = i;
+    return(TRUE);
 }
 
 /*
@@ -53,21 +168,22 @@ PRIVATE int check_for_target_in_links ARGS2(int *,cur, char *,new_target)
  *
  */
 		
-PUBLIC void textsearch ARGS3(document *,cur_doc,
-				 char *,prev_target, BOOL, next)
+PUBLIC BOOL textsearch ARGS3(document *,cur_doc,
+	char *,		prev_target,
+	BOOL,		next)
 {
     int offset;
     int oldcur = cur_doc->link;
     static char prev_target_buffer[512]; /* Search string buffer */
     static BOOL first = TRUE;
     char *cp;
-    int ch=0, recall;
+    int ch = 0, recall;
     int QueryTotal;
     int QueryNum;
     BOOLEAN FirstRecall = TRUE;
 
     /*
-     * Initialize the search string buffer. - FM
+     *  Initialize the search string buffer. - FM
      */
     if (first) {
 	*prev_target_buffer = '\0';
@@ -80,30 +196,30 @@ PUBLIC void textsearch ARGS3(document *,cur_doc,
 
     if (next)
         /*
-	 * LYK_NEXT was pressed, so copy the
-	 * buffer into prev_target. - FM
+	 *  LYK_NEXT was pressed, so copy the
+	 *  buffer into prev_target. - FM
 	 */
 	strcpy(prev_target, prev_target_buffer);
 
-    if(strlen(prev_target) == 0 ) {
+    if (strlen(prev_target) == 0 ) {
         /*
-	 * This is a new WHEREIS search ('/'), or
-	 * LYK_NEXT was pressed but there was no
-	 * previous search, so we need to get a
-	 * search string from the user. - FM
+	 *  This is a new WHEREIS search ('/'), or
+	 *  LYK_NEXT was pressed but there was no
+	 *  previous search, so we need to get a
+	 *  search string from the user. - FM
 	 */
 	_statusline(ENTER_WHEREIS_QUERY);
 
-	if ((ch=LYgetstr(prev_target, VISIBLE,
-	    		 sizeof(prev_target_buffer), recall)) < 0) {
+	if ((ch = LYgetstr(prev_target, VISIBLE,
+	    		   sizeof(prev_target_buffer), recall)) < 0) {
 	    /*
-	     * User cancelled the search via ^G.
-	     * Restore prev_target and return. - FM
+	     *  User cancelled the search via ^G.
+	     *  Restore prev_target and return. - FM
 	     */
 	    strcpy(prev_target, prev_target_buffer);
 	    _statusline(CANCELLED);
 	    sleep(InfoSecs);
-	    return;
+	    return(FALSE);
 	}
     }
 
@@ -111,26 +227,26 @@ check_recall:
     if (strlen(prev_target) == 0 &&
         !(recall && (ch == UPARROW || ch == DNARROW))) {
         /*
-	 * No entry.  Simply return, retaining the current buffer.
-	 * Because prev_target is now reset, highlighting of the
-	 * previous search string will no longer occur, but it can
-	 * be used again via LYK_NEXT.   - FM
+	 *  No entry.  Simply return, retaining the current buffer.
+	 *  Because prev_target is now reset, highlighting of the
+	 *  previous search string will no longer occur, but it can
+	 *  be used again via LYK_NEXT.   - FM
 	 */
         _statusline(CANCELLED);
         sleep(InfoSecs);
-	return;
+	return(FALSE);
     }
 
     if (recall && ch == UPARROW) {
 	if (FirstRecall) {
 	    /*
-	     * Use the current string or last query in the list. - FM
+	     *  Use the current string or last query in the list. - FM
 	     */
 	    FirstRecall = FALSE;
 	    if (*prev_target_buffer) {
 	        for (QueryNum = (QueryTotal - 1); QueryNum > 0; QueryNum--) {
-		    if ((cp=(char *)HTList_objectAt(search_queries,
-	    					    QueryNum)) != NULL &&
+		    if ((cp = (char *)HTList_objectAt(search_queries,
+	    					      QueryNum)) != NULL &&
 		        !strcmp(prev_target_buffer, cp)) {
 		        break;
 		    }
@@ -140,17 +256,17 @@ check_recall:
 	     }
 	} else {
 	    /*
-	     * Go back to the previous query in the list. - FM
+	     *  Go back to the previous query in the list. - FM
 	     */
 	    QueryNum++;
 	}
 	if (QueryNum >= QueryTotal)
 	    /*
-	     * Roll around to the last query in the list. - FM
+	     *  Roll around to the last query in the list. - FM
 	     */
 	    QueryNum = 0;
-	if ((cp=(char *)HTList_objectAt(search_queries,
-	    				QueryNum)) != NULL) {
+	if ((cp = (char *)HTList_objectAt(search_queries,
+	    				  QueryNum)) != NULL) {
 	    strcpy(prev_target, cp);
 	    if (*prev_target_buffer &&
 	        !strcmp(prev_target_buffer, prev_target)) {
@@ -161,29 +277,29 @@ check_recall:
 	    } else {
 		_statusline(EDIT_A_PREV_QUERY);
 	    }
-	    if ((ch=LYgetstr(prev_target, VISIBLE,
-	    		 sizeof(prev_target_buffer), recall)) < 0) {
+	    if ((ch = LYgetstr(prev_target, VISIBLE,
+	    		       sizeof(prev_target_buffer), recall)) < 0) {
 	        /*
-		 * User cancelled the search via ^G.
-		 * Restore prev_target and return. - FM
+		 *  User cancelled the search via ^G.
+		 *  Restore prev_target and return. - FM
 		 */
 		strcpy(prev_target, prev_target_buffer);
 		_statusline(CANCELLED);
 		sleep(InfoSecs);
-		return;
+		return(FALSE);
 	    }
 	    goto check_recall;
 	}
     } else if (recall && ch == DNARROW) {
 	if (FirstRecall) {
 	    /*
-	     * Use the current string or first query in the list. - FM
+	     *  Use the current string or first query in the list. - FM
 	     */
 	    FirstRecall = FALSE;
 	    if (*prev_target_buffer) {
 	        for (QueryNum = 0; QueryNum < (QueryTotal - 1); QueryNum++) {
-		    if ((cp=(char *)HTList_objectAt(search_queries,
-	    					    QueryNum)) != NULL &&
+		    if ((cp = (char *)HTList_objectAt(search_queries,
+	    					      QueryNum)) != NULL &&
 		        !strcmp(prev_target_buffer, cp)) {
 		        break;
 		    }
@@ -193,17 +309,17 @@ check_recall:
 	    }
 	} else {
 	    /*
-	     * Advance to the next query in the list. - FM
+	     *  Advance to the next query in the list. - FM
 	     */
 	    QueryNum--;
 	}
 	if (QueryNum < 0)
 	    /*
-	     * Roll around to the first query in the list. - FM
+	     *  Roll around to the first query in the list. - FM
 	     */
 	    QueryNum = QueryTotal - 1;
-	if ((cp=(char *)HTList_objectAt(search_queries,
-	    				QueryNum)) != NULL) {
+	if ((cp = (char *)HTList_objectAt(search_queries,
+	    				  QueryNum)) != NULL) {
 	    strcpy(prev_target, cp);
 	    if (*prev_target_buffer &&
 	        !strcmp(prev_target_buffer, prev_target)) {
@@ -214,51 +330,56 @@ check_recall:
 	    } else {
 		_statusline(EDIT_A_PREV_QUERY);
 	    }
-	    if ((ch=LYgetstr(prev_target, VISIBLE,
-	    		 sizeof(prev_target_buffer), recall)) < 0) {
+	    if ((ch = LYgetstr(prev_target, VISIBLE,
+			       sizeof(prev_target_buffer), recall)) < 0) {
 	        /*
-		 * User cancelled the search via ^G.
-		 * Restore prev_target and return. - FM
+		 *  User cancelled the search via ^G.
+		 *  Restore prev_target and return. - FM
 		 */
 		strcpy(prev_target, prev_target_buffer);
 		_statusline(CANCELLED);
 		sleep(InfoSecs);
-		return;
+		return(FALSE);
 	    }
 	    goto check_recall;
 	}
     }
     /*
-     * Replace the search string buffer with the new target. - FM
+     *  Replace the search string buffer with the new target. - FM
      */
     strcpy(prev_target_buffer, prev_target);
     HTAddSearchQuery(prev_target_buffer);
 
     /*
-     * Search only links for the string,
-     * starting from the current link
+     *  Search the links on the currently displayed page for
+     *  the string, starting after the current link. - FM
      */
     if (check_for_target_in_links(&cur_doc->link, prev_target)) {
 	/*
-	 * Found in link, changed cur, we're done.
+	 *  Found in link, changed cur, we're done.
 	 */
 	highlight(OFF, oldcur);
-	return; 
+	return(TRUE); 
     }
 	
     /*
-     * We'll search the text starting from the
-     * link we are on, or the next page.
+     *  We'll search the text starting from the
+     *  link we are on, or the next page.
      */
     if (nlinks == 0)
 	offset = (display_lines - 1);
     else
-	offset = links[cur_doc->link].ly;
+	offset = links[cur_doc->link].ly - 1;
 
     /*
-     * Resume search, this time for all text.
-     * Set www_search_result if string found,
-     * and position the hit at top of screen.
+     *  Resume search, this time for all text.
+     *  Set www_search_result if string found,
+     *  and position the hit at top of screen.
      */
-    www_user_search(cur_doc->line+offset, prev_target);
+    www_user_search(cur_doc->line+offset, cur_doc, prev_target);
+    if (cur_doc->link != oldcur) {
+	highlight(OFF, oldcur);
+	return(TRUE);
+    }
+    return(www_search_result > 0);
 }
diff --git a/src/LYSearch.h b/src/LYSearch.h
index 3e5faa0d..cff7b806 100644
--- a/src/LYSearch.h
+++ b/src/LYSearch.h
@@ -6,7 +6,7 @@
 #include "LYStructs.h"
 #endif /* LYSTRUCT_H */
 
-extern void textsearch PARAMS((document *cur_doc,
+extern BOOL textsearch PARAMS((document *cur_doc,
 			       char *prev_target, BOOL next));
 
 #define IN_FILE 1
diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c
index dc314523..23c6b6de 100644
--- a/src/LYShowInfo.c
+++ b/src/LYShowInfo.c
@@ -92,7 +92,11 @@ PUBLIC int showinfo ARGS4(
 	}
     }
 
-    fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n",
+    fprintf(fp0, "<head>\n");
+#ifdef EXP_CHARTRANS
+    add_META_charset_to_fd(fp0, -1);
+#endif
+    fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n",
 		 SHOWINFO_TITLE);
     fprintf(fp0,"<h1>You have reached the Information Page</h1>\n");
     fprintf(fp0,"<h2>%s Version %s</h2>\n", LYNX_NAME, LYNX_VERSION);
@@ -243,7 +247,7 @@ PUBLIC int showinfo ARGS4(
     fprintf(fp0,"<dt><em>Linkname:</em> %s\n", Title);
 
     StrAllocCopy(Address, doc->address);
-    LYEntify(&Address, FALSE);
+    LYEntify(&Address, TRUE);
     fprintf(fp0,
     	    "<dt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>URL:</em> %s\n", Address);
 
@@ -283,7 +287,7 @@ PUBLIC int showinfo ARGS4(
 
     if (owner_address) {
         StrAllocCopy(Address, owner_address);
-	LYEntify(&Address, FALSE);
+	LYEntify(&Address, TRUE);
     } else {
         StrAllocCopy(Address, "None");
     }
@@ -292,8 +296,11 @@ PUBLIC int showinfo ARGS4(
     fprintf(fp0,
 	"<dt>&nbsp;&nbsp;&nbsp;&nbsp;<em>size:</em> %d lines\n", size_of_file);
 
-    fprintf(fp0, "<dt>&nbsp;&nbsp;&nbsp;&nbsp;<em>mode:</em> %s\n",
-		 (lynx_mode == FORMS_LYNX_MODE ? "forms mode" : "normal"));
+    fprintf(fp0, "<dt>&nbsp;&nbsp;&nbsp;&nbsp;<em>mode:</em> %s%s%s\n",
+		 (lynx_mode == FORMS_LYNX_MODE ? "forms mode" : "normal"),
+	    (doc->safe ? ", safe" : ""),
+	    (doc->internal_link ? ", internal link" : "")
+	    );
 
     fprintf(fp0, "</dl>\n");  /* end of list */
 
@@ -320,7 +327,7 @@ PUBLIC int showinfo ARGS4(
 	    }
 	    if (links[doc->link].form->submit_action) {
 	        StrAllocCopy(Address, links[doc->link].form->submit_action);
-		LYEntify(&Address, FALSE);
+		LYEntify(&Address, TRUE);
 	        fprintf(fp0, "<dt>&nbsp;&nbsp;<em>Action:</em> %s\n", Address);
 	    }
 	    if (!(links[doc->link].form->submit_method &&
@@ -334,7 +341,7 @@ PUBLIC int showinfo ARGS4(
 	    } else {
 	        StrAllocCopy(Title, "");
 	    }
-	    fprintf(fp0, "<dt><em>Filename:</em> %s\n", Title);
+	    fprintf(fp0, "<dt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>URL:</em> %s\n", Title);
 	}
 	fprintf(fp0, "</dl>\n");  /* end of list */
 
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 093ca774..f5c88ffd 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -189,6 +189,49 @@ PUBLIC void LYsubwindow ARGS1(WINDOW *, param)
 }
 #endif
 
+#ifdef USE_SLANG_MOUSE
+PRIVATE int sl_parse_mouse_event ARGS3(int *, x, int *, y, int *, button)
+{
+   /* "ESC [ M" has already been processed.  There more characters are 
+    * expected:  BUTTON X Y
+    */
+   *button = SLang_getkey ();
+   switch (*button)
+     {
+      case 040:			       /* left button */
+      case 041:			       /* middle button */
+      case 042:			       /* right button */
+	*button -= 040;
+	break;
+
+      default:			       /* Hmmm.... */
+	SLang_flush_input ();
+	return -1;
+     }
+
+   *x = SLang_getkey () - 33;
+   *y = SLang_getkey () - 33;
+   return 0;
+}
+#endif
+
+#ifdef USE_SLANG_MOUSE
+PRIVATE int map_function_to_key ARGS1(char, keysym)
+{
+   int i;
+   
+   /* I would prefer to use sizeof keymap but its size is not available.
+    * A better method would be to declare it as some fixed size.
+    */
+   for (i = 1; i < 256; i++)
+     {
+	if (keymap[i] == keysym)
+	  return i - 1;
+     }
+   return -1;
+}
+#endif
+
 /*
  * LYgetch() translates some escape sequences and may fake noecho
  */
@@ -233,7 +276,6 @@ re_read:
 			case 440: c = 'Q'; break;  /* alt x */
 			default: break;
 		}
-//		if (c < 256) return(c);
 	}
 #endif
 #ifdef USE_GETCHAR
@@ -300,7 +342,32 @@ re_read:
         case 's': c = PGDOWN; break;  /* keypad on pc ncsa telnet */
         case 'w': c = HOME; break;  /* keypad on pc ncsa telnet */
         case 'q': c = END; break;  /* keypad on pc ncsa telnet */
-        case 'M': c = '\n'; break; /* kepad enter on pc ncsa telnet */
+        case 'M':
+#ifdef USE_SLANG_MOUSE
+	   if ((c == 27) && (b == '['))
+	     {
+		int mouse_x, mouse_y, button;
+		
+		mouse_link = -1;
+		c = -1;
+		if (-1 != sl_parse_mouse_event (&mouse_x, &mouse_y, &button))
+		  {
+		     if (button == 0)  /* left */
+		       c = set_clicked_link (mouse_x, mouse_y);
+		     else if (button == 2)   /* right */
+		       {
+			  /* Right button: go back to prev document.  
+			   * The problem is that we need to determine 
+			   * what to return to achieve this.
+			   */
+			  c = map_function_to_key (LYK_PREV_DOC);
+		       }
+		  }
+	     }
+	   else 
+#endif
+	     c = '\n'; /* kepad enter on pc ncsa telnet */
+	   break; 
 
         case 'm':
 #ifdef VMS
@@ -330,6 +397,12 @@ re_read:
 #endif /* VMS */
                 c = F1;  /* macintosh help button */
             break;
+        case 'p':
+#ifdef VMS
+            if (b == 'O')
+#endif /* VMS */
+                c = '0';  /* keypad 0 */
+            break;
         case '1':                           /** VT300  Find  **/
             if ((b == '[' || c == 155) && (d=GetChar()) == '~')
                 c = FIND_KEY;
@@ -366,6 +439,12 @@ re_read:
             if ((b == '[' || c == 155) && (d=GetChar()) == '~')
                 c = PGDOWN;
             break;
+        case '[':                            /** Linux F1-F5: ^[[[A etc. **/
+            if (b == '[' || c == 155) {
+		if ((d=GetChar()) == 'A')
+		    c = F1;
+		break;
+	    }
 	default:
 	   if (TRACE) {
 		fprintf(stderr,"Unknown key sequence: %d:%d:%d\n",c,b,a);
@@ -443,9 +522,11 @@ re_read:
 	   c=127;		   /* backspace key (delete, not Ctrl-H) */
 	   break;
 #endif /* KEY_BACKSPACE */
+
 #ifdef NCURSES_MOUSE_VERSION
 	case KEY_MOUSE:
 	  {
+#ifndef DOSPATH
            MEVENT event;
            int err;
 
@@ -455,6 +536,26 @@ re_read:
 	   if (event.bstate & BUTTON1_CLICKED) {
 	     c = set_clicked_link(event.x, event.y);
 	   }
+#else /* pdcurses version */
+              int left,right;
+              /* yes, I am assuming that my screen will be a certain width. */
+              left = 6;
+              right = LYcols-6;
+              c = -1;
+              mouse_link = -1;
+              request_mouse_pos();
+              if (Mouse_status.button[0] & BUTTON_CLICKED) {
+                if (Mouse_status.y == (LYlines-1))
+                       if (Mouse_status.x < left) c=LTARROW;
+                       else if (Mouse_status.x > right) c='\b';
+                       else c=PGDOWN;
+                else if (Mouse_status.y == 0)
+                       if (Mouse_status.x < left) c=LTARROW;
+                       else if (Mouse_status.x > right) c='\b';
+                       else c=PGUP;
+                else c = set_clicked_link(Mouse_status.x, Mouse_status.y);
+              }
+#endif /* _WINDOWS */
 	  }
 	  break;
 #endif /* NCURSES_MOUSE_VERSION */
@@ -462,6 +563,13 @@ re_read:
     }
 #endif /* defined(HAVE_KEYPAD) */
 
+    if (c > DO_NOTHING)
+    /* Don't return raw values for KEYPAD symbols which we may have missed
+     * in the switch above if they are obviously invalid when used as an
+     * index into (e.g.) keypad[]. - kw
+     */
+       return (0);
+    else
     return(c);
 }
 
diff --git a/src/LYStructs.h b/src/LYStructs.h
index 12ad43be..2ea0de0d 100644
--- a/src/LYStructs.h
+++ b/src/LYStructs.h
@@ -35,6 +35,11 @@ typedef struct _document {
    char * bookmark;
    int    link;
    int    line;
+   BOOL   internal_link;	/* whether doc was reached via an internal
+				 (fragment) link. - kw */
+#ifdef USEHASH
+   char * style;
+#endif
 } document;
 
 #ifndef HTFORMS_H
@@ -51,6 +56,11 @@ typedef struct _histstruct {
     BOOL   isHEAD;
     int    link;
     int    page;
+   BOOL   internal_link;	/* whether doc was reached via an internal
+				 (fragment) link. - kw */
+    int   intern_seq_start;	/* indicates which element on the history
+				   is the start of this sequence of
+				   "internal links", otherwise -1 */
 } histstruct;
 
 typedef struct _VisitedLink {
@@ -92,4 +102,9 @@ extern lynx_html_item_type *downloaders;
 /* for upload commands */
 extern lynx_html_item_type *uploaders;
 
+#ifdef USE_EXTERNALS
+/* for external commands */
+extern lynx_html_item_type *externals;
+#endif
+
 #endif /* LYSTRUCTS_H */
diff --git a/src/LYStyle.c b/src/LYStyle.c
new file mode 100644
index 00000000..dd4d12fd
--- /dev/null
+++ b/src/LYStyle.c
@@ -0,0 +1,396 @@
+/* character level styles for Lynx
+ * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-)
+ * $Id: LYStyle.c,v 1.1 1997/05/25 00:14:19 tom Exp $
+ */
+#include "HTUtils.h"
+#include "HTML.h"
+#include "tcp.h"
+#include "LYSignal.h"
+#include "LYGlobalDefs.h"
+
+#include "LYStructs.h"
+#include "LYCurses.h"
+#include "LYCharUtils.h"
+#include "AttrList.h"
+#include "SGML.h"
+#include "HTMLDTD.h"
+
+/* Hash table definitions */
+#include "LYHash.h"
+#include "LYStyle.h"
+
+#include "LYexit.h"
+
+#ifdef USE_COLOR_STYLE
+
+PUBLIC bucket hashStyles[HASHSIZE];
+
+/* definitions for the mono attributes we can use */
+static int ncursesMono[7] = {
+ A_NORMAL, A_BOLD, A_REVERSE, A_UNDERLINE, A_STANDOUT, A_BLINK, A_DIM
+};
+
+/*
+ * If these strings don't match the meanings of the above attributes,
+ * you'll confuse the hell out of people, so make them the same. - RP
+ */
+static char *Mono_Strings[7] =
+{
+ "normal", "bold", "reverse", "underline", "standout", "blink", "dim"
+};
+
+/* definitions for the colour attributes we can use */
+static int ncursesColors[8] = {
+ COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, 
+ COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
+};
+
+/*
+ * Ditto for these strings - RP
+ */
+static char *Color_Strings[16] =
+{
+ "black", "red", "green", "brown", "blue", "magenta", "cyan", "lightgray",
+ "gray", "brightred", "brightgreen", "yellow", "brightblue", "brightmagenta",
+ "brightcyan", "white"
+};
+
+/* Remember the hash codes for common elements */
+PUBLIC int	s_alink=NOSTYLE, s_a=NOSTYLE, s_status=NOSTYLE,
+		s_label=NOSTYLE, s_value=NOSTYLE, s_high=NOSTYLE,
+		s_normal=NOSTYLE, s_alert=NOSTYLE, s_title=NOSTYLE;
+
+/* start somewhere safe */ 
+PRIVATE int colorPairs=0;
+
+#define FREE(x) if (x) {free(x); x = NULL;}
+
+/* icky parsing of the style options */
+PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char*,element)
+{
+ int i;
+ int mA=0, fA=COLOR_WHITE, bA=COLOR_BLACK, cA=0;
+	int newstyle=hash_code(element);
+	if (TRACE)
+	fprintf(stderr, "CSS(PA):style d=%d / h=%d, e=%s\n", style, newstyle,element);
+ 
+ for (i=0; i<7; i++)
+ {
+	if (!strcasecmp(Mono_Strings[i], mono))
+	{
+	 mA = ncursesMono[i];
+	}
+ }
+	if (TRACE)
+	fprintf(stderr, "CSS(CP):%d\n", colorPairs);
+ /*
+  * `nocolor' means don't even try to do colour for this - RP
+  */
+ if (!strcasecmp("nocolor", fg))
+ {
+	fA=-1;
+	bA=-1;
+	cA=-1;
+ }
+ else
+ {
+	for (i=0; i<16; i++)
+	{
+	 if (!strcasecmp(Color_Strings[i], fg))
+	 {
+		fA = ncursesColors[i%8];
+		/*
+		 * if the string was in the upper 8, then it's
+		 * a bright version, so set the BOLD attribute
+		 */
+		cA = (i>=8 ? A_BOLD : 0);
+	 }
+	}
+	/* 
+	 * Backgrounds are horribly broken under ncurses - RP
+	 */
+	for (i=0; i<16; i++)
+	{
+	 if (!strcasecmp(Color_Strings[i], bg))
+	 {
+		bA = ncursesColors[i%8];
+		cA |=(i>=8 ? A_BOLD : 0);
+	 }
+	}
+ }
+
+ /* 
+  * If we have colour, and space to create a new colour attribute,
+  * and we have a valid colour description, then add this style
+  */
+ if (has_color && colorPairs < COLOR_PAIRS-1 && fA!=-1)
+ {
+	colorPairs++;
+	init_pair(colorPairs, fA, bA);
+	setStyle(style, COLOR_PAIR(colorPairs)|cA, cA, mA);
+	setHashStyle(newstyle, COLOR_PAIR(colorPairs)|cA, cA, mA, element);
+ }
+ else
+ {
+	/* only mono is set */
+	setStyle(style, -1, -1, mA);
+	setHashStyle(newstyle, -1, -1, mA, element);
+ }
+}
+
+/* parse a style option of the format
+ * STYLE:<OBJECT>:FG:BG
+ */
+PRIVATE void parse_style ARGS1(char*,buffer)
+{
+ char *tmp = strchr(buffer, ':');
+ char *element, *mono, *fg, *bg;
+ 
+ if(!tmp)
+ {
+	fprintf (stderr, "\
+Syntax Error parsing style in lss file:\n\
+[%s]\n\
+The line must be of the form:\n\
+OBJECT:MONO:COLOR (ie em:bold:brightblue:white)\n\
+where OBJECT is one of EM,STRONG,B,I,U,BLINK etc.\n\n", buffer);
+	if (!dump_output_immediately) {
+#ifndef NOSIGHUP
+	    (void) signal(SIGHUP, SIG_DFL);
+#endif /* NOSIGHUP */
+	    (void) signal(SIGTERM, SIG_DFL);
+#ifndef VMS
+	    (void) signal(SIGINT, SIG_DFL);
+#endif /* !VMS */
+#ifdef SIGTSTP
+	    if (no_suspend)
+		(void) signal(SIGTSTP,SIG_DFL);
+#endif /* SIGTSTP */
+	    exit(-1);
+	}
+	exit(1);
+ }
+	{
+		char *i;
+		for (i=buffer; *i; *i++=tolower(*i));
+	}
+ *tmp='\0';
+ element=buffer;
+ 
+ mono=tmp+1;
+ tmp=strchr(mono, ':');
+ 
+ if (!tmp) { fg="nocolor"; bg="nocolor"; }
+ else      
+ {
+	*tmp='\0';
+	fg=tmp+1;
+	tmp=strchr(fg, ':');
+	if (!tmp) bg="black";
+	else {*tmp='\0'; bg=tmp+1;}
+ }
+
+	if (TRACE)
+	{
+		int bucket = hash_code(element);
+		fprintf(stderr, "CSSPARSE:%s => %d %s\n", 
+			element, bucket,
+			(hashStyles[bucket].name ? "used" : ""));
+	}
+
+	strtolower(element);	
+
+ /* 
+  * We use some pseudo-elements, so catch these first
+  */
+ if (!strncasecmp(element, "alink", 5)) /* active link */
+ {
+	parse_attributes(mono,fg,bg,DSTYLE_ALINK,"alink");
+ }
+ else if (!strcasecmp(element, "a")) /* normal link */
+ {
+	parse_attributes(mono,fg,bg, DSTYLE_LINK,"a");
+	parse_attributes(mono,fg,bg, HTML_A,"a");
+ }
+ else if (!strncasecmp(element, "status", 4)) /* status bar */
+ {
+	parse_attributes(mono,fg,bg, DSTYLE_STATUS,"status");
+ }
+ else if (!strncasecmp(element, "label", 6)) /* [INLINE]'s */
+ {
+	parse_attributes(mono,fg,bg,DSTYLE_OPTION,"label");
+ }
+ else if (!strncasecmp(element, "value", 5)) /* [INLINE]'s */
+ {
+	parse_attributes(mono,fg,bg,DSTYLE_VALUE,"value");
+ }
+ else if (!strncasecmp(element, "high", 4)) /* [INLINE]'s */
+ {
+	parse_attributes(mono,fg,bg,DSTYLE_HIGH,"high");
+ }
+ /* this may vanish */
+ else if (!strncasecmp(element, "candy", 5)) /* [INLINE]'s */
+ {
+	parse_attributes(mono,fg,bg,DSTYLE_CANDY,"candy");
+ }
+ /* Ok, it must be a HTML element, so look through the list until we
+	* find it
+	*/
+ else
+ {
+#if !defined(USEHASH)
+	int i;
+	for (i=0; i<HTML_ELEMENTS; i++)
+	{
+	 if (!strcasecmp (HTML_dtd.tags[i].name, element))
+	 {
+		if (TRACE)
+		 fprintf(stderr, "PARSECSS:applying style <%s,%s,%s> for HTML_%s\n",mono,fg,bg,HTML_dtd.tags[i].name);
+		parse_attributes(mono,fg,bg,i+STARTAT,element);
+		break;
+	 }
+	}
+#else
+	parse_attributes(mono,fg,bg,hash_code(element),element);
+#endif
+ }
+}
+
+/*
+ * initialise the default style sheet
+ * This should be able to be read from a file in CSS format :-)
+ */
+PRIVATE void initialise_default_stylesheet NOARGS
+{
+}
+
+/* Set all the buckets in the hash table to be empty */
+PUBLIC void style_initialiseHashTable NOARGS
+{
+	int i;
+	
+	for (i=0; i<HASHSIZE; i++)
+	{
+		hashStyles[i].name=NULL;
+		hashStyles[i].color=-1;
+		hashStyles[i].cattr=-1;
+		hashStyles[i].mono=-1;
+	}
+	s_high=hash_code("high");
+	s_alink=hash_code("alink");
+	s_value=hash_code("value");
+	s_label=hash_code("label");
+	s_a=hash_code("a");
+	s_status=hash_code("status");
+	s_alert=hash_code("alert");
+	s_title=hash_code("title");
+}
+	
+/* because curses isn't started when we parse the config file, we
+ * need to remember the STYLE: lines we encounter and parse them
+ * after curses has started
+ */
+HTList *lss_styles = NULL;
+
+PUBLIC void parse_userstyles NOARGS
+{
+	char *name;
+	HTList *cur = lss_styles;
+	colorPairs=0;
+	style_initialiseHashTable();
+
+	/* set our styles to be the same as vanilla-curses-lynx */
+	initialise_default_stylesheet();
+
+	while ((name=HTList_nextObject(cur)) != NULL)
+	{
+		if (TRACE)
+			fprintf(stderr, "LSS:%s\n", name ? name : "!?! empty !?!");
+		if (name != NULL)
+		    parse_style(name);
+	}
+}
+
+
+/* Add a STYLE: option line to our list */
+PUBLIC void HStyle_addStyle ARGS1(char*,buffer)
+{
+	char *name=NULL;
+	StrAllocCopy(name, buffer);
+	if (lss_styles==NULL)
+		lss_styles=HTList_new();
+	strtolower(name);
+	if (TRACE)
+		fprintf(stderr, "READCSS:%s\n", name ? name : "!?! empty !?!");
+	HTList_addObject (lss_styles, name);
+}
+
+PUBLIC void style_deleteStyleList NOARGS
+{
+    char *name;
+    while ((name = HTList_removeLastObject(lss_styles)) != NULL)
+	FREE(name);
+    HTList_delete (lss_styles);
+    lss_styles=NULL;
+}
+
+char* default_stylesheet[]={
+	"a:bold", "em:bold", "strong:bold", "b:bold", "i:bold",
+	"alink:reverse", "status:reverse", NULL
+};
+
+PUBLIC void style_defaultStyleSheet NOARGS
+{
+	int i;
+	for (i=0; default_stylesheet[i]; i++)
+		HStyle_addStyle(default_stylesheet[i]);
+}
+
+PUBLIC int style_readFromFile ARGS1(char*, file)
+{
+	FILE *fh;
+	char buffer[1024];
+	int len;
+
+	if (TRACE)
+	    fprintf(stderr, "CSS:Reading styles from file: %s\n", file ? file : "?!? empty ?!?");
+	if (file == NULL || *file == '\0')
+	    return -1;
+	fh=fopen(file, "r");
+	if (!fh) 
+	{
+/* this should probably be an alert or something */
+		if (TRACE)
+			fprintf(stderr, "CSS:Can't open style file %s, using defaults\n", file);
+		return -1;
+	}
+	
+	style_initialiseHashTable();
+	style_deleteStyleList();
+
+	while (!feof(fh)
+	 && fgets(buffer, sizeof(buffer)-1, fh) != NULL)
+	{
+		len = strlen(buffer);
+		if (len > 0) {
+		    if (buffer[len-1] == '\n' || buffer[len-1] == '\r')
+			buffer[len-1]='\0'; /* hack */
+		    else
+			buffer[1023]='\0'; /* hack */
+		}
+		LYTrimTail(buffer);
+		LYTrimHead(buffer);
+		if (buffer[0] != '#' && (len = strlen(buffer)) > 0)
+		    HStyle_addStyle(buffer);
+	}
+	/* the default styles are added after the user styles in order
+	** that they come before them  <grin>  RP
+	*/ 
+/*	style_defaultStyleSheet(); */
+
+	fclose (fh);
+	if (LYCursesON)
+		parse_userstyles();
+	return 0;
+}
+#endif /* USE_COLOR_STYLE */
diff --git a/src/LYStyle.h b/src/LYStyle.h
new file mode 100644
index 00000000..cfc4ae69
--- /dev/null
+++ b/src/LYStyle.h
@@ -0,0 +1,32 @@
+#ifndef LYSTYLE_H
+#define LYSTYLE_H
+
+#ifdef USE_COLOR_STYLE
+
+#include "AttrList.h"
+
+/* list of elements */
+extern CONST SGML_dtd HTML_dtd;
+
+/* array of currently set styles */
+extern HTCharStyle displayStyles[DSTYLE_ELEMENTS];
+
+/* Can we do colour? - RP */
+extern int has_color;
+
+/* Set all the buckets in the hash table to be empty */
+extern void style_initialiseHashTable NOPARAMS;
+
+extern void parse_userstyles NOPARAMS;
+
+extern void HStyle_addStyle PARAMS((char* buffer));
+
+extern void style_deleteStyleList NOPARAMS;
+
+extern void style_defaultStyleSheet NOPARAMS;
+
+extern int style_readFromFile PARAMS((char* file));
+
+#endif /* USE_COLOR_STYLE */
+
+#endif /* LYSTYLE_H */
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 4543edca..37ad23f2 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -48,6 +48,12 @@
 
 #include "LYLeaks.h"
 
+#ifdef USE_COLOR_STYLE
+#include "AttrList.h"
+#include "LYHash.h"
+#include "LYStyle.h"
+#endif
+
 #ifdef SVR4_BSDSELECT
 extern int BSDselect PARAMS((int nfds, fd_set * readfds, fd_set * writefds,
 	 		     fd_set * exceptfds, struct timeval * timeout));
@@ -105,20 +111,28 @@ PUBLIC void highlight ARGS2(
         cur = 0;
 
     if (nlinks > 0) {
+#ifdef USE_COLOR_STYLE
+#define LXP (links[cur].lx)
+#define LYP (links[cur].ly)
+#endif
 	move(links[cur].ly, links[cur].lx);
+#ifndef USE_COLOR_STYLE
+	lynx_start_link_color (flag == ON);
+#else
 	if (flag == ON) { 
-	    /* makes some terminals work wrong because
-	     * they can't handle two attributes at the 
-	     * same time
-	     */
-	    /* start_bold();  */
-	    start_reverse();
-#if defined(USE_SLANG) || defined(FANCY_CURSES)
-	    start_underline ();
-#endif /* USE_SLANG */
+	    LynxChangeStyle(s_alink, ABS_ON, 0);
 	} else {
-	    start_bold();
+		/* the logic is flawed here - no provision is made for links that
+		** aren't coloured as [s_a] by default - rjp
+		*/
+	    if (cached_styles[LYP][LXP]) {
+		LynxChangeStyle(cached_styles[LYP][LXP], ABS_ON, 0);
+	    }
+	    else {
+		LynxChangeStyle(s_a, ABS_ON, 0);
+	    }
 	}
+#endif
 
 	if (links[cur].type == WWW_FORM_LINK_TYPE) {
 	    int len;
@@ -156,55 +170,37 @@ PUBLIC void highlight ARGS2(
 
 	/* display a second line as well */
 	if (links[cur].hightext2 && links[cur].ly < display_lines) {
-	    if (flag == ON) {
-	        stop_reverse();
-#if defined(USE_SLANG) || defined(FANCY_CURSES)
-		stop_underline ();
-#endif /* USE_SLANG */
-	    } else {
-	        stop_bold();
-	    }
+	    lynx_stop_link_color (flag == ON);
 
 	    addch('\n');
 	    for (i=0; i < links[cur].hightext2_offset; i++)
-	        addch(' ');
+		addch(' ');
 
-	    if (flag == ON) {
-	        start_reverse();
-#if defined(USE_SLANG) || defined(FANCY_CURSES)
-		start_underline ();
-#endif /* USE_SLANG */
-	    } else {
-	        start_bold();
-	    }
+#ifndef USE_COLOR_STYLE
+	    lynx_start_link_color (flag == ON);
+#else
+	    LynxChangeStyle(flag == ON ? s_alink : s_a, ABS_ON, 0);
+#endif
 
 	    for (i = 0; (tmp[0] = links[cur].hightext2[i]) != '\0' &&
-	    	      i+links[cur].hightext2_offset < LYcols; i++) {
+		      i+links[cur].hightext2_offset < LYcols; i++) {
 		if (!IsSpecialAttrChar(links[cur].hightext2[i])) {
 		    /* For CJK strings, by Masanobu Kimura */
 		    if (HTCJK != NOCJK && !isascii(tmp[0])) {
-		        tmp[1] = links[cur].hightext2[++i];
+			tmp[1] = links[cur].hightext2[++i];
 			addstr(tmp);
 			tmp[1] = '\0';
 		    } else {
-		        addstr(tmp);
+			addstr(tmp);
 		    }
 		 }
 	    }
 	}
-
-	if (flag == ON) {
-	    stop_reverse();
-#if defined(USE_SLANG) || defined(FANCY_CURSES)
-	    stop_underline ();
-#endif /* USE_SLANG */
-	} else {
-	    stop_bold();
-	}
+	lynx_stop_link_color (flag == ON);
 
 #if defined(FANCY_CURSES) || defined(USE_SLANG)
 	if (!LYShowCursor)
-	    move(LYlines-1, LYcols-1);  /* get cursor out of the way */
+	    move(LYlines-1, LYcols-1);	/* get cursor out of the way */
 	else
 #endif /* FANCY CURSES || USE_SLANG */
 	    /* never hide the cursor if there's no FANCY CURSES or SLANG */
@@ -349,7 +345,7 @@ PUBLIC void statusline ARGS1(
      *  make sure text is not longer than the statusline window. - FM
      */
     max_length = ((LYcols - 2) < 256) ? (LYcols - 2) : 255;
-    if ((buffer[0] != '\0') &&
+    if ((text[0] != '\0') &&
         (LYHaveCJKCharacterSet)) {
         /*
 	 *  Translate or filter any escape sequences. - FM
@@ -427,14 +423,21 @@ PUBLIC void statusline ARGS1(
     }
     clrtoeol();
     if (text != NULL) {
-#ifdef COLOR_CURSES
-	lynx_set_color(2);
-	addstr(buffer);
-	lynx_set_color(0);
+#ifndef USE_COLOR_STYLE
+	lynx_start_status_color ();
+	addstr (buffer);
+	lynx_stop_status_color ();
 #else
-	start_reverse();
-	addstr(buffer);
-	stop_reverse();
+	/* draw the status bar in the STATUS style */
+	{
+		int a=(strncmp(buffer, "Alert", 5) || !hashStyles[s_alert].name ? s_status : s_alert);
+		LynxChangeStyle (a, ABS_ON, 1);
+		addstr(buffer);
+		wbkgdset(stdscr, hashStyles[a].color);
+		clrtoeol();
+		wbkgdset(stdscr, hashStyles[s_normal].color);
+		LynxChangeStyle (a, ABS_OFF, 0);
+	}
 #endif
     }
     refresh();
@@ -471,7 +474,7 @@ PUBLIC void noviceline ARGS1(
 	return;
 
     move(LYlines-2,0);
-    stop_reverse();
+    /* stop_reverse(); */
     clrtoeol();
     addstr(NOVICE_LINE_ONE);
     clrtoeol();
@@ -555,7 +558,11 @@ PUBLIC int HTCheckForInterrupt NOARGS
         ret = select(FD_SETSIZE, (void *)&readfds, NULL, NULL,
 	  	     &socket_timeout);
 
-    /** No keystroke was entered **/
+    /** Suspended? **/
+    if ((ret == -1) && (errno == EINTR))
+	 return((int)FALSE); 
+
+    /** No keystroke was entered? **/
     if (!FD_ISSET(0,&readfds))
 	 return((int)FALSE); 
 #endif /* USE_SLANG */
@@ -1201,7 +1208,7 @@ PUBLIC void remove_backslashes ARGS1(
 PUBLIC char * quote_pathname ARGS1(
 	char *,		pathname)
 {
-    int i, n = 0;
+    size_t i, n = 0;
     char * result;
 
     for (i=0; i < strlen(pathname); ++i)
@@ -1422,7 +1429,7 @@ PUBLIC void change_sug_filename ARGS1(
 	char *,		fname)
 {
      char *temp, *cp, *cp1, *end;
-     int len;
+     size_t len;
 #ifdef VMS
      char *dot;
      int j,k;
@@ -1636,25 +1643,100 @@ PUBLIC void tempname ARGS2(
 	char *,		namebuffer,
 	int,		action)
 {
-	static int counter = 0;
-
-	if (action == REMOVE_FILES) { /* REMOVE ALL FILES */ 
-	    for (; counter > 0; counter--) {
-	        sprintf(namebuffer, "%sL%d%uTMP.txt", lynx_temp_space,
-						      (int)getpid(), counter-1);
-		remove(namebuffer);
-	        sprintf(namebuffer, "%sL%d%uTMP.html", lynx_temp_space,
-						       (int)getpid(), counter-1);
-		remove(namebuffer);
+    static int counter = 0;
+    FILE *fp = NULL;
+    int LYMaxTempCount = 10000; /* Arbitrary limit.  Make it configurable? */
+
+    if (action == REMOVE_FILES) {
+        /*
+	 *  Remove all temporary files with .txt or .html suffixes. - FM
+	 */ 
+	for (; counter > 0; counter--) {
+	    sprintf(namebuffer,
+	    	    "%sL%d%uTMP.txt",
+		    lynx_temp_space, (int)getpid(), counter-1);
+	    remove(namebuffer);
+	    sprintf(namebuffer,
+	    	    "%sL%d%uTMP.html",
+		    lynx_temp_space, (int)getpid(), counter-1);
+	    remove(namebuffer);
+	}
+    } else {
+        /*
+	 *  Load a tentative temporary file name into namebuffer. - FM
+	 */
+	while (counter < LYMaxTempCount) {
+	    /*
+	     *  Create names with .txt, then .bin, then
+	     *  .html suffixes, and check for their prior
+	     *  existence.  If any already exist, someone
+	     *  might be trying to spoof us, so increment
+	     *  the count and try again.  Otherwise, return
+	     *  with the name which has the .html suffix
+	     *  loaded in namebuffer. - FM
+	     */
+	    sprintf(namebuffer,
+		    "%sL%d%uTMP.txt",
+		    lynx_temp_space, (int)getpid(), counter);
+	    if ((fp = fopen(namebuffer, "r")) != NULL) {
+		fclose(fp);
+		if (TRACE)
+		    fprintf(stderr,
+		    	    "tempname: file '%s' already exits!\n",
+			    namebuffer);
+		counter++;
+		continue;
+	    }
+	    sprintf(namebuffer,
+		    "%sL%d%uTMP.bin",
+		    lynx_temp_space, (int)getpid(), counter);
+	    if ((fp = fopen(namebuffer, "r")) != NULL) {
+		fclose(fp);
+		if (TRACE)
+		    fprintf(stderr,
+		    	    "tempname: file '%s' already exits!\n",
+			    namebuffer);
+		counter++;
+		continue;
+	    }
+	    sprintf(namebuffer,
+		    "%sL%d%uTMP.html",
+		    lynx_temp_space, (int)getpid(), counter++);
+	    if ((fp = fopen(namebuffer, "r")) != NULL) {
+		fclose(fp);
+		if (TRACE)
+		    fprintf(stderr,
+		    	    "tempname: file '%s' already exits!\n",
+			    namebuffer);
+		continue;
 	    }
-	} else /* add a file */ {
+	    /*
+	     *  Return to the calling function, with the tentative
+	     *  temporary file name loaded in namebuffer.  Note that
+	     *  if the calling function will use a suffix other than
+	     *  .txt, .bin, or .html, it similarly should do tests for
+	     *  a spoof.  The file name can be reused if it is written
+	     *  to on receipt of this name, and thereafter accessed
+	     *  for reading.  Note that if writing to a file is to
+	     *  be followed by reading it, as it the usual case for
+	     *  Lynx, the spoof attempt will be apparent, and the user
+	     *  can take appropriate action. - FM
+	     */
+	    return;
+	}
 	/*
-	 * 	Create name
+	 *  The tempfile maximum count has been reached.
+	 *  Issue a message and exit. - FM
 	 */
-	    sprintf(namebuffer, "%sL%d%uTMP.html", lynx_temp_space,
-	    					   (int)getpid(), counter++);
-	}
-	return;
+	_statusline(MAX_TEMPCOUNT_REACHED);
+	sleep(AlertSecs);
+	exit(-1);
+    }
+
+    /*
+     *  We were called for a clean up, and have done it. - FM
+     */
+    return;
 }
 
 /*
@@ -1736,6 +1818,9 @@ PRIVATE char *restrict_name[] = {
        "change_exec_perms",
 #endif /* OK_PERMIT */
 #endif /* DIRED_SUPPORT */
+#ifdef USE_EXTERNALS
+       "externals" ,
+#endif
        (char *) 0     };
 
 	/* restrict_name and restrict_flag structure order
@@ -1778,6 +1863,9 @@ PRIVATE BOOLEAN *restrict_flag[] = {
        &no_change_exec_perms,
 #endif /* OK_PERMIT */
 #endif /* DIRED_SUPPORT */
+#ifdef USE_EXTERNALS
+       &no_externals ,
+#endif
        (BOOLEAN *) 0  };
 
 PUBLIC void parse_restrictions ARGS1(
@@ -2049,7 +2137,7 @@ PUBLIC void LYConvertToURL ARGS1(
         return;
 
 #ifdef DOSPATH
-{
+    {
 	 char *cp_url = *AllocatedString;
 	 for(; *cp_url != '\0'; cp_url++)
 		if(*cp_url == '\\') *cp_url = '/';
@@ -2060,7 +2148,7 @@ PUBLIC void LYConvertToURL ARGS1(
 	 if(strlen(old_string) > 3 && *cp_url == '/')
 		*cp_url = '\0';
 #endif
-}
+    }
 #endif
 
 	 *AllocatedString = NULL;  /* so StrAllocCopy doesn't free it */
@@ -2310,7 +2398,9 @@ have_VMS_URL:
 		/*
 		 *  It is a subdirectory or file on the local system.
 		 */
-		StrAllocCat(*AllocatedString, temp);
+		cp = HTEscape(temp, URL_PATH);
+		StrAllocCat(*AllocatedString, cp);
+		FREE(cp);
 		if (TRACE) {
 		    fprintf(stderr, "Converted '%s' to '%s'\n",
 				    old_string, *AllocatedString);
@@ -2377,6 +2467,8 @@ have_VMS_URL:
 	}
 #endif /* VMS */
     } else { 
+	struct stat st;
+	FILE *fptemp = NULL;
 	/*
 	 *  Path begins with a slash.  Simplify and use it.
 	 */
@@ -2391,6 +2483,27 @@ have_VMS_URL:
 #else
 	    StrAllocCat(*AllocatedString, "/");
 #endif /* VMS */
+	} else if ((stat(old_string, &st) > -1) ||
+		   (fptemp = fopen(old_string, "r")) != NULL) {
+	    /*
+	     *  It is an absolute directory or file
+	     *  on the local system. - kw
+	     */
+	    StrAllocCopy(temp, old_string);
+	    LYTrimRelFromAbsPath(temp);
+	    if (TRACE) {
+		fprintf(stderr, "Converted '%s' to '%s'\n", old_string, temp);
+	    }
+	    cp = HTEscape(temp, URL_PATH);
+	    StrAllocCat(*AllocatedString, cp);
+	    FREE(cp);
+	    FREE(temp);
+	    if (fptemp)
+		fclose(fptemp);
+	    if (TRACE) {
+		fprintf(stderr, "Converted '%s' to '%s'\n",
+			old_string, *AllocatedString);
+	    }
 	} else if (old_string[1] == '~') {
 	    /*
 	     *  Has a Home_Dir() reference.  Handle it
@@ -3500,7 +3613,7 @@ PUBLIC time_t LYmktime ARGS1(
         clock2 = (time_t)0;
     if (TRACE && clock2 > 0)
         fprintf(stderr,
-		"LYmktime: clock=%i, ctime=%s", clock2, ctime(&clock2));
+		"LYmktime: clock=%ld, ctime=%s", (long) clock2, ctime(&clock2));
 
     return(clock2);
 }
diff --git a/src/LYexit.c b/src/LYexit.c
index 7d737606..7b3035d5 100644
--- a/src/LYexit.c
+++ b/src/LYexit.c
@@ -53,7 +53,7 @@ PUBLIC void LYexit ARGS1(
 	 *  Ignore further interrupts. - FM
  	 */
 #ifndef NOSIGHUP
-				(void) signal(SIGHUP, SIG_DFL);
+				(void) signal(SIGHUP, SIG_IGN);
 #endif /* NOSIGHUP */
 	(void) signal (SIGTERM, SIG_IGN);
 	(void) signal (SIGINT, SIG_IGN);
diff --git a/src/Makefile b/src/Makefile
index e11132e1..112f0521 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,8 +8,8 @@ LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
 LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
 HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
 LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \
-LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o \
- $(CHARTRANS_OBJS)
+LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o\
+LYStyle.o LYHash.o $(CHARTRANS_OBJS)
 
 CFLAGS= $(MCFLAGS) -I.. $(SLANGINC)
 
diff --git a/src/UCAuto.c b/src/UCAuto.c
index ec267f26..cd786b76 100644
--- a/src/UCAuto.c
+++ b/src/UCAuto.c
@@ -64,6 +64,12 @@ PRIVATE void call_setfont ARGS3(char *,font, char *,fnsuffix, char *,umap)
     }
     
     if (*T_setfont_cmd) {
+    
+            if (TRACE) {
+                        fprintf(stderr, "Executing setfont: '%s'\n", 
+                        T_setfont_cmd);
+                        }
+                                
 	system(T_setfont_cmd);
     }
 }
diff --git a/src/chrtrans/MAKEW32.BAT b/src/chrtrans/MAKEW32.BAT
index 1259b344..3655ba0f 100644
--- a/src/chrtrans/MAKEW32.BAT
+++ b/src/chrtrans/MAKEW32.BAT
@@ -22,4 +22,3 @@ makeuctb rfc_suni.tbl > rfc_suni.h
 makeuctb def7_uni.tbl > def7_uni.h
 makeuctb koi8r_uni.tbl > koi8r_uni.h
 
-
diff --git a/src/chrtrans/Makefile b/src/chrtrans/Makefile
index 055dbad2..02f36f4f 100644
--- a/src/chrtrans/Makefile
+++ b/src/chrtrans/Makefile
@@ -54,12 +54,14 @@ makeuctb: makeuctb.c UCkd.h
 
 iso01_uni.h: iso01_uni.tbl makeuctb
 iso02_uni.h: iso02_uni.tbl makeuctb
+def7_uni.h: def7_uni.tbl makeuctb
 iso03_uni.h: iso03_uni.tbl makeuctb
 iso04_uni.h: iso04_uni.tbl makeuctb
 iso05_uni.h: iso05_uni.tbl makeuctb
 iso07_uni.h: iso07_uni.tbl makeuctb
 iso09_uni.h: iso09_uni.tbl makeuctb
 iso10_uni.h: iso10_uni.tbl makeuctb
+koi8r_uni.h: koi8r_uni.tbl makeuctb
 cp437_uni.h: cp437_uni.tbl makeuctb
 cp850_uni.h: cp850_uni.tbl makeuctb
 cp852_uni.h: cp852_uni.tbl makeuctb
diff --git a/src/chrtrans/README.tables b/src/chrtrans/README.tables
index 94622a99..c9a86605 100644
--- a/src/chrtrans/README.tables
+++ b/src/chrtrans/README.tables
@@ -45,8 +45,10 @@ if in doubt, check the last lines of the corresponding ...uni.h file.]
 c) To let make automatically notice when you have changed one of the
    table files, and automatically regenerate the *uni.h file(s), 
 you also have to add any new tables to both src/Makefile *and*
-src/chrtrans/Makefile.  (That may be inconvenient, but I didn't want to
-depend on features than not all makes may have.)  Note that for recompiling
-Lynx, a `make clean' should not be necessary if you have *only* made 
+src/chrtrans/Makefile.  Or, for auto-config, the equivalent files
+named makefile.in before running ./configure, or makefile after running
+./configure.  (That may be inconvenient, but I didn't want to depend
+on features than not all makes may have.)  Note that for recompiling
+Lynx, a `make clean' should not be necessary if you have *only* made
 changes to the files in src/chrtrans.
 
diff --git a/src/chrtrans/def7_uni.tbl b/src/chrtrans/def7_uni.tbl
index ab7fd4de..7978e73a 100644
--- a/src/chrtrans/def7_uni.tbl
+++ b/src/chrtrans/def7_uni.tbl
@@ -1230,7 +1230,7 @@ U+2020:/-
 U+2021:/=
 U+2022: o 
 U+2025:..
-U+2025:...
+U+2026:...
 
 # Dont wanna see these:
 # POP DIRECTIONAL FORMATTING      202C
diff --git a/src/chrtrans/makefile.in b/src/chrtrans/makefile.in
index 8d5da41f..246e94ba 100644
--- a/src/chrtrans/makefile.in
+++ b/src/chrtrans/makefile.in
@@ -76,12 +76,14 @@ makeuctb: makeuctb.c UCkd.h
 
 iso01_uni.h: iso01_uni.tbl makeuctb
 iso02_uni.h: iso02_uni.tbl makeuctb
+def7_uni.h: def7_uni.tbl makeuctb
 iso03_uni.h: iso03_uni.tbl makeuctb
 iso04_uni.h: iso04_uni.tbl makeuctb
 iso05_uni.h: iso05_uni.tbl makeuctb
 iso07_uni.h: iso07_uni.tbl makeuctb
 iso09_uni.h: iso09_uni.tbl makeuctb
 iso10_uni.h: iso10_uni.tbl makeuctb
+koi8r_uni.h: koi8r_uni.tbl makeuctb
 cp437_uni.h: cp437_uni.tbl makeuctb
 cp850_uni.h: cp850_uni.tbl makeuctb
 cp852_uni.h: cp852_uni.tbl makeuctb
diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c
index aeb1a0e9..f5f73066 100644
--- a/src/chrtrans/makeuctb.c
+++ b/src/chrtrans/makeuctb.c
@@ -503,6 +503,11 @@ static u8 dfont_unicount%s[%d] = \n\
         printf(", ");
     }
 
+  /* If lowest_eightbit is anything else but 999, this can't be 7-bit
+   * only. */
+  if (lowest_eight != 999 && !RawUni)
+    RawUni = UCT_ENC_8BIT;
+
   if (nuni)
     printf("\nstatic u16 dfont_unitable%s[%d] = \n{\n\t", id_append, nuni);
   else
diff --git a/src/makefile.dos b/src/makefile.dos
index 8a820ab8..367d2e62 100644
--- a/src/makefile.dos
+++ b/src/makefile.dos
@@ -5,14 +5,13 @@ LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
 LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
 HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
 LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \
-LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o HTML.o \
-UCAUTO.o UCAUX.o UCDOMAP.o
+LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o HTML.o 
 
 CFLAGS= $(MCFLAGS) -I.. $(SLANGINC)
 
 CC = gcc
 #MCFLAGS = -O -DNCURSES -DFANCY_CURSES -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/library/implementation -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp -I../djgpp/pdcurses/include
-MCFLAGS = -DEXP_CHARTRANS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/library/implementation -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp -I../djgpp/pdcurses/include
+MCFLAGS = -DNCURSES -DFANCY_CURSES -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/library/implementation -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp -I../djgpp/pdcurses/include
 WWWLIB = ../WWW/library/djgpp/libwww.a ../djgpp/pdcurses/lib/libcurso.a ../djgpp/tcplib/obj/libtcp.a
 
 all: lynx
diff --git a/src/makefile.in b/src/makefile.in
index 92977d01..847a724e 100644
--- a/src/makefile.in
+++ b/src/makefile.in
@@ -24,8 +24,8 @@ LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
 LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
 HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
 LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \
-LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o \
- $(CHARTRANS_OBJS)
+LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \
+LYStyle.o LYHash.o $(CHARTRANS_OBJS)
 
 all: lynx
 
diff --git a/styles/lynx.lss b/styles/lynx.lss
new file mode 100644
index 00000000..597a2059
--- /dev/null
+++ b/styles/lynx.lss
@@ -0,0 +1,60 @@
+#
+#it's best to put these in a .lss file and use "lynx -lss=file.lss whatever" for now.
+#
+#----/cut here for my styles/----
+# normal type styles, use bold if mono, otherwise brightblue on <defaultbackground>
+em:bold:brightblue
+strong:bold:brightred
+b:bold:red
+i:bold:blue
+alink:reverse:yellow
+a:bold:green
+img:dim:brown
+status:normal:yellow:blue
+fig:normal:gray
+caption:reverse:brown
+hr:normal:yellow
+blockquote:normal:brightblue
+ul:normal:brown
+address:normal:magenta
+title:normal:magenta:black
+tt:dim:gray:blue
+h1:bold:yellow:blue
+label:normal:magenta
+value:normal:green
+high:bold:brightmagenta
+q:normal:yellow:magenta
+small:dim:gray
+big:bold:yellow
+sup:bold:yellow
+sub:dim:gray
+lh:bold:yellow:magenta
+
+# styles with classes <ul class=red> etc.
+ul.red:underline:brightred
+ul.blue:bold:brightblue
+li.red:reverse:red:yellow
+li:normal:magenta
+li.blue:bold:blue
+strong.a:bold:black:red
+em.a:reverse:black:blue
+strong.b:bold:white:red
+em.b:reverse:white:blue
+alert:bold:yellow:red
+strong.debug:reverse:green
+tr:bold:brown
+tr.baone:bold:yellow
+tr.batwo:bold:green
+tr.bathree:bold:red
+# special cases for link - the type is appended after the class
+link.green:bold:brightgreen
+# special cases for link - the rel is appended after the class
+# <link rel=next class=red href="1">
+link.red.next:bold:red
+link.red.prev:bold:yellow:red
+link.blue.prev:bold:yellow:blue
+link.blue.next:bold:blue
+link.red:bold:black:red
+link.blue:bold:white:blue
+link.toc:bold:black:white
+link.green.toc:bold:white:green
diff --git a/userdefs.h b/userdefs.h
index 336aab4e..5809b547 100644
--- a/userdefs.h
+++ b/userdefs.h
@@ -75,6 +75,11 @@
 #define LYNX_CFG_FILE "Lynx_Dir:lynx.cfg"
 #endif /* LYNX_CFG_FILE */
 
+#ifndef LYNX_LSS_FILE
+#define LYNX_LSS_FILE "Lynx_Dir:lynx.lss"
+#endif /* LYNX_LSS_FILE */
+
+
 /**************************
  * The EXTENSION_MAP file allows you to map file suffix's to 
  * mime types.
@@ -223,6 +228,10 @@
 #endif /* DOSPATH */
 #endif /* LYNX_CFG_FILE */
 
+#ifndef LYNX_LSS_FILE
+#define LYNX_LSS_FILE "/usr/local/lib/lynx.lss"
+#endif /* LYNX_LSS_FILE */
+
 /**************************
  * The EXTENSION_MAP file allows you to map file suffix's to 
  * mime types.
@@ -310,10 +319,10 @@
 
 /********************************
  * Don't let the user enter his/her email address when sending a message.
- * Anonymous mail makes it far too easy for a user to spoof someone elses
+ * Anonymous mail makes it far too easy for a user to spoof someone else's
  * email address.
  * This requires that your mailer agent put in the From: field for you.
-
+ *
  * The default should be to uncomment this line but there probably are too
  * many mail agents out there that won't do the right thing if there is no
  * From: line.
@@ -388,6 +397,25 @@
  */
 #define DEFAULT_INDEX_FILE "http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html"
 
+/*****************************
+ * If USE_TRACE_LOG is set FALSE, then when TRACE mode is invoked the
+ * syserr messages will not be directed to a log file named lynx.trace
+ * in the account's HOME directory.  The default defined here can be
+ * toggled via the -tlog command line switch.  Also, it is set FALSE
+ * automatically when Lynx is executed in an anonymous or validation
+ * account (if indicated via the -anonymous or -validate command line
+ * switches, or via the check for the ANONYMOUS_USER, defined below).
+ * When FALSE, the TRACE_LOG command (normally ';') cannot be used to
+ * examine the Lynx Trace Log during the current session.  If left
+ * TRUE, but you wish to use command line piping of stderr to a file
+ * you specify, include the -tlog toggle on the command line.  Note
+ * that once TRACE mode is turned on during a session and stderr is
+ * directed to the log, all stderr messages will continue going to
+ * the log, even if TRACE mode is turned off via the TOGGLE_TRACE
+ * (Control-T) command.
+ */
+#define USE_TRACE_LOG	FALSE
+
 /*******************************
  * If GOTOBUFFER is set to TRUE here or in lynx.cfg the last entered
  * goto URL, if any, will be offered as a default for reuse or editing
@@ -1169,11 +1197,16 @@
  */
 
 #define LYNX_NAME "Lynx"
-/* The strange-looking comment on the next line tells PRCS to replace
+#ifdef USE_COLOR_STYLE
+/* The strange-looking comments on the next line tell PRCS to replace
  * the version definition with the Project Version on checkout. Just
  * ignore it. - kw */
+/* $Format: "#define LYNX_VERSION \"$ProjectVersion$-Styles\""$ */
+#define LYNX_VERSION "2.7.1ac-0.28-Styles"
+#else
 /* $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$ */
-#define LYNX_VERSION "2.7.1ac-0.5"
+#define LYNX_VERSION "2.7.1ac-0.28"
+#endif
 
 /****************************************************************
  * The LYMessages_en.h header defines default, English strings
@@ -1197,6 +1230,10 @@
 #define MAXHIST  1024		/* max links we remember in history */
 #define MAXLINKS 1024		/* max links on one screen */
 
+#ifndef SEARCH_GOAL_LINE
+#define SEARCH_GOAL_LINE 4	/* try to position search target there */
+#endif
+
 #ifdef EXP_CHARTRANS
 #define MAX_CHARSETS 40
 #define MAX_CHARSETSP 41	/* always one more */