about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2000-06-23 16:13:42 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2000-06-23 16:13:42 -0400
commitfe76940414337a9058df2d426bf5527154ca283a (patch)
treebdc0234689e8778492902fd6939d18a139f0b520
parent03239fe7d0beedb4b52c96d56729d24fa0db0405 (diff)
downloadlynx-snapshots-fe76940414337a9058df2d426bf5527154ca283a.tar.gz
snapshot of project "lynx", label v2-8-4dev_4
-rw-r--r--CHANGES40
-rw-r--r--WWW/Library/Implementation/HTGopher.c2
-rw-r--r--WWW/Library/Implementation/HText.h2
-rw-r--r--aclocal.m42
-rwxr-xr-xconfig.guess483
-rwxr-xr-xconfig.sub370
-rw-r--r--lynx.cfg28
-rw-r--r--lynx.hlp588
-rw-r--r--lynx.man13
-rw-r--r--src/GridText.c195
-rw-r--r--src/HTAlert.c19
-rw-r--r--src/HTFWriter.c6
-rw-r--r--src/HTML.c7
-rw-r--r--src/LYBookmark.c8
-rw-r--r--src/LYCgi.c5
-rw-r--r--src/LYCookie.c30
-rw-r--r--src/LYCurses.c3
-rw-r--r--src/LYCurses.h33
-rw-r--r--src/LYExtern.c15
-rw-r--r--src/LYExtern.h3
-rw-r--r--src/LYForms.c9
-rw-r--r--src/LYGetFile.c2
-rw-r--r--src/LYGlobalDefs.h6
-rw-r--r--src/LYKeymap.c242
-rw-r--r--src/LYKeymap.h9
-rw-r--r--src/LYLocal.c31
-rw-r--r--src/LYMail.c10
-rw-r--r--src/LYMain.c34
-rw-r--r--src/LYMainLoop.c114
-rw-r--r--src/LYMainLoop.h3
-rw-r--r--src/LYOptions.c81
-rw-r--r--src/LYPrint.c4
-rw-r--r--src/LYReadCFG.c16
-rw-r--r--src/LYStrings.c142
-rw-r--r--src/LYStrings.h19
-rw-r--r--src/LYStructs.h7
-rw-r--r--src/LYStyle.c4
-rw-r--r--src/LYUtils.c11
-rw-r--r--src/LYexit.c3
-rw-r--r--userdefs.h24
40 files changed, 1855 insertions, 768 deletions
diff --git a/CHANGES b/CHANGES
index 54b683eb..0513613e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,46 @@
 Changes since Lynx 2.8 release
 ===============================================================================
 
+2000-06-23 (2.8.4dev.4)
+* modify handling to EXTERNAL settings by adding a new field in lynx.cfg.  When
+  TRUE, then activating (using arrow-right for example) the link with URL
+  matching the one specified by 'prefix' field will be equal to pressing '.' on
+  it -VH
+* restore commented-out "clearok(curscr, TRUE)" in display_page() in GridText.c
+  to workaround problem repainting multibyte characters (reported by Takuya
+  ASADA <asada@isoternet.org>) -KW
+* add HIDDEN_LINK_MARKER entry to lynx.cfg, allowing user to specify string to
+  mark hidden links with (thus hidden links become non-hidden, thus they won't
+  be listed as hidden in the 'l' page) - the name of the setting is
+  hidden_link_marker.  If the string to mark with is empty, then old behaviour
+  is restored -VH
+* implement "change directory" command.  This is tested only on linux.  It's
+  bound to 'C' in both modes (before this in normal modem COMMENT command was
+  bound to 'c' and 'C' in normal mode, and CREATE was bound to 'c' and 'C' in
+  dired mode).  The main purpose of this command is not to type the name of the
+  directory when 'p'rinting to files and 'd'ownloading.  If this command is
+  invoked in dired mode, the listing of destination directory will be
+  automatically loaded.  Dired file operations menu lists this command too as
+  the first item.  To disable it, comment the line
+      #define SUPPORT_CHDIR 
+  in userdefs.h -VH
+* add definitions to allow slang configuration to implement scrollbars.  This
+  will no work for any termcap/terminfo-based systems, appears specific to
+  MS-DOS (patch by Gisle Vanem)
+* updates for config.guess, config.sub from tin -TD
+* fix typo in CF_CHECK_ERRNO configure macro (reported by John Coyne
+  <John.Coyne@ctbto.org>) -TD
+* add <html> and </html> around generated HTML in HTGopher.c, LYKeymap.c,
+  LYCookie.c and LYCgi.c to make them more-correct.  Did not modify
+  LYBookmark.c because the logic there relies on appending to the bookmark file
+  (report by Patrick Boylan <pboylan@island.net>) -TD
+* make pretty_html() in LYKeymap.c quote ampersand and quote, simplified logic
+  as well with LYKeycodeToString() implemented for command-logging -TD
+* add command-line options -cmd_log and -cmd_script, to provide a simple
+  command logging and scripting facility -TD
+* minor correction to -stdin option, add newline at the end of each line
+  copied -TD
+
 2000-06-02 (2.8.4dev.3)
 * initial support for SOURCE_CACHE_FOR_ABORTED -VH 
 * change default_keypad_mode_fun() to use config_enum() -TD
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index b3ae7d99..d960e373 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -1097,7 +1097,7 @@ PRIVATE int generate_cso_form ARGS4(
     char *key, *line;
     CSOformgen_context ctx;
     static char *template[] = {
-   "<HEAD>\n<TITLE>CSO/PH Query Form for $(HOST)</TITLE>\n</HEAD>\n<BODY>",
+   "<HTML>\n<HEAD>\n<TITLE>CSO/PH Query Form for $(HOST)</TITLE>\n</HEAD>\n<BODY>",
    "<H2><I>CSO/PH Query Form</I> for <EM>$(HOST)</EM></H2>",
    "To search the database for a name, fill in one or more of the fields",
    "in the form below and activate the 'Submit query' button.  At least",
diff --git a/WWW/Library/Implementation/HText.h b/WWW/Library/Implementation/HText.h
index 7258a343..6aa336dc 100644
--- a/WWW/Library/Implementation/HText.h
+++ b/WWW/Library/Implementation/HText.h
@@ -126,7 +126,7 @@ extern int HText_beginAnchor PARAMS((
 	BOOL		underline,
 	HTChildAnchor *	anc));
 extern void HText_endAnchor PARAMS((HText * text, int number));
-
+extern BOOL HText_isAnchorBlank PARAMS((HText * text, int number));
 
 /*
 
diff --git a/aclocal.m4 b/aclocal.m4
index 836c81f5..31adcaa9 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -685,7 +685,7 @@ AC_CACHE_VAL(cf_cv_dcl_$1,[
 #include <errno.h> ],
     [long x = (long) $1],
     [eval 'cf_cv_dcl_'$1'=yes'],
-    [eval 'cf_cv_dcl_'$1'=no]')
+    [eval 'cf_cv_dcl_'$1'=no'])
 ])
 
 eval 'cf_result=$cf_cv_dcl_'$1
diff --git a/config.guess b/config.guess
index ad5f70da..aed5f011 100755
--- a/config.guess
+++ b/config.guess
@@ -1,6 +1,7 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
+#   Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -23,6 +24,7 @@
 
 # Written by Per Bothner <bothner@cygnus.com>.
 # The master version of this file is at the FSF in /home/gd/gnu/lib.
+# Please send patches to <autoconf-patches@gnu.org>.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
@@ -35,6 +37,20 @@
 # (but try to keep the structure clean).
 #
 
+# Use $HOST_CC if defined. $CC may point to a cross-compiler
+if test x"$CC_FOR_BUILD" = x; then
+  if test x"$HOST_CC" != x; then
+    CC_FOR_BUILD="$HOST_CC"
+  else
+    if test x"$CC" != x; then
+      CC_FOR_BUILD="$CC"
+    else
+      CC_FOR_BUILD=cc
+    fi
+  fi
+fi
+
+
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
 # (ghazi@noc.rutgers.edu 8/24/94.)
 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
@@ -46,7 +62,8 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
 
 # Note: order is significant - the case branches are not exclusive.
 
@@ -59,7 +76,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	cat <<EOF >dummy.s
+	cat <<EOF >$dummy.s
 	.globl main
 	.ent main
 main:
@@ -76,9 +93,9 @@ main:
 	ret \$31,(\$26),1
 	.end main
 EOF
-	${CC-cc} dummy.s -o dummy 2>/dev/null
+	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
 	if test "$?" = 0 ; then
-		./dummy
+		./$dummy
 		case "$?" in
 			7)
 				UNAME_MACHINE="alpha"
@@ -97,8 +114,14 @@ EOF
 				;;
 		esac
 	fi
-	rm -f dummy.s dummy
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
+	rm -f $dummy.s $dummy
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
 	exit 0 ;;
     21064:Windows_NT:50:3)
 	echo alpha-dec-winnt3.5
@@ -133,6 +156,9 @@ EOF
     wgrisc:OpenBSD:*:*)
 	echo mipsel-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit 0 ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit 0;;
@@ -142,7 +168,7 @@ EOF
     SR2?01:HI-UX/MPP:*:*)
 	echo hppa1.1-hitachi-hiuxmpp
 	exit 0;;
-    Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*)
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
 	if test "`(/bin/universe) 2>/dev/null`" = att ; then
 		echo pyramid-pyramid-sysv3
@@ -150,10 +176,7 @@ EOF
 		echo pyramid-pyramid-bsd
 	fi
 	exit 0 ;;
-    "Power Macintosh":Rhapsody:*:*)
-	echo powerpc-apple-rhapsody`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
-    NILE:*:*:dcosx)
+    NILE*:*:*:dcosx)
 	echo pyramid-pyramid-svr4
 	exit 0 ;;
     sun4H:SunOS:5.*:*)
@@ -204,6 +227,32 @@ EOF
     atari*:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit 0 ;;
     sun3*:NetBSD:*:*)
 	echo m68k-sun-netbsd${UNAME_RELEASE}
 	exit 0 ;;
@@ -226,8 +275,8 @@ EOF
 	echo powerpc-apple-machten${UNAME_RELEASE}
 	exit 0 ;;
     macppc:NetBSD:*:*)
-        echo powerpc-apple-netbsd${UNAME_RELEASE}
-        exit 0 ;;
+	echo powerpc-apple-netbsd${UNAME_RELEASE}
+	exit 0 ;;
     RISC*:Mach:*:*)
 	echo mips-dec-mach_bsd4.3
 	exit 0 ;;
@@ -241,8 +290,12 @@ EOF
 	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; {
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
 	#if defined (host_mips) && defined (MIPSEB)
 	#if defined (SYSTYPE_SYSV)
 	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
@@ -257,10 +310,10 @@ EOF
 	  exit (-1);
 	}
 EOF
-	${CC-cc} dummy.c -o dummy \
-	  && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-	  && rm dummy.c dummy && exit 0
-	rm -f dummy.c dummy
+	$CC_FOR_BUILD $dummy.c -o $dummy \
+	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+	  && rm $dummy.c $dummy && exit 0
+	rm -f $dummy.c $dummy
 	echo mips-mips-riscos${UNAME_RELEASE}
 	exit 0 ;;
     Night_Hawk:Power_UNIX:*:*)
@@ -276,18 +329,21 @@ EOF
 	echo m88k-motorola-sysv3
 	exit 0 ;;
     AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
-        if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
-	if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-	     -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
 		echo m88k-dg-dgux${UNAME_RELEASE}
-	else
+	    else
 		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
-        else echo i586-dg-dgux${UNAME_RELEASE}
-        fi
- 	exit 0 ;;
+	exit 0 ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
 	exit 0 ;;
@@ -306,17 +362,17 @@ EOF
 	exit 0 ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
 	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
-	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+	exit 0 ;;	       # Note that: echo "'`uname -s`'" gives 'AIX '
     i?86:AIX:*:*)
 	echo i386-ibm-aix
 	exit 0 ;;
-    *:MVS:*:* | *:OS390:*:*|*:OS/390:*:*)
+    *:MVS:*:* | *:OS390:*:* | *:OS/390:*:*)
 			       # uname -m gives a processor model number  /* S/390 -- gil -- 1389 */
 	echo s390-ibm-os390    # on R1 and R2, uname -s reports OS390
 	exit 0 ;;              # on R3, uname -s reports OS/390
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		sed 's/^		//' << EOF >dummy.c
+		sed 's/^		//' << EOF >$dummy.c
 		#include <sys/systemcfg.h>
 
 		main()
@@ -327,8 +383,8 @@ EOF
 			exit(0);
 			}
 EOF
-		${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
-		rm -f dummy.c dummy
+		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+		rm -f $dummy.c $dummy
 		echo rs6000-ibm-aix3.2.5
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
 		echo rs6000-ibm-aix3.2.4
@@ -375,46 +431,46 @@ EOF
 	case "${UNAME_MACHINE}" in
 	    9000/31? )            HP_ARCH=m68000 ;;
 	    9000/[34]?? )         HP_ARCH=m68k ;;
-	    9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[13679] | 9000/892 )
-              sed 's/^              //' << EOF >dummy.c
-              #include <stdlib.h>
-              #include <unistd.h>
-
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
-
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
+	    9000/[678][0-9][0-9])
+	      sed 's/^              //' << EOF >$dummy.c
+	      #include <stdlib.h>
+	      #include <unistd.h>
+
+	      int main ()
+	      {
+	      #if defined(_SC_KERNEL_BITS)
+		  long bits = sysconf(_SC_KERNEL_BITS);
+	      #endif
+		  long cpu  = sysconf (_SC_CPU_VERSION);
+
+		  switch (cpu)
+		{
+		case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+		case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+		case CPU_PA_RISC2_0:
+	      #if defined(_SC_KERNEL_BITS)
+		    switch (bits)
+			{
+			case 64: puts ("hppa2.0w"); break;
+			case 32: puts ("hppa2.0n"); break;
+			default: puts ("hppa2.0"); break;
+			} break;
+	      #else  /* !defined(_SC_KERNEL_BITS) */
+		    puts ("hppa2.0"); break;
+	      #endif
+		default: puts ("hppa1.0"); break;
+		}
+		  exit (0);
+	      }
 EOF
-	(${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy`
-	rm -f dummy.c dummy
+	(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+	rm -f $dummy.c $dummy
 	esac
 	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
 	exit 0 ;;
     3050*:HI-UX:*:*)
-	sed 's/^	//' << EOF >dummy.c
+	sed 's/^	//' << EOF >$dummy.c
 	#include <unistd.h>
 	int
 	main ()
@@ -439,8 +495,8 @@ EOF
 	  exit (0);
 	}
 EOF
-	${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
-	rm -f dummy.c dummy
+	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+	rm -f $dummy.c $dummy
 	echo unknown-hitachi-hiuxwe2
 	exit 0 ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@@ -449,6 +505,9 @@ EOF
     9000/8??:4.3bsd:*:*)
 	echo hppa1.0-hp-bsd
 	exit 0 ;;
+    *9??*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit 0 ;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
 	echo hppa1.1-hp-osf
 	exit 0 ;;
@@ -465,27 +524,30 @@ EOF
     parisc*:Lites*:*:*)
 	echo hppa1.1-hp-lites
 	exit 0 ;;
+    hppa*:OpenBSD:*:*)
+	echo hppa-unknown-openbsd
+	exit 0 ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
-        exit 0 ;;
+	exit 0 ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-        exit 0 ;;
+	exit 0 ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
-        exit 0 ;;
+	exit 0 ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
-        exit 0 ;;
+	exit 0 ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
-        exit 0 ;;
+	exit 0 ;;
     CRAY*X-MP:*:*:*)
 	echo xmp-cray-unicos
-        exit 0 ;;
+	exit 0 ;;
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE}
 	exit 0 ;;
@@ -497,14 +559,17 @@ EOF
     CRAY*TS:*:*:*)
 	echo t90-cray-unicos${UNAME_RELEASE}
 	exit 0 ;;
+    CRAY*T3E:*:*:*)
+	echo alpha-cray-unicosmk${UNAME_RELEASE}
+	exit 0 ;;
     CRAY-2:*:*:*)
 	echo cray2-cray-unicos
-        exit 0 ;;
+	exit 0 ;;
     F300:UNIX_System_V:*:*)
-        FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit 0 ;;
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit 0 ;;
     F301:UNIX_System_V:*:*)
        echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
        exit 0 ;;
@@ -514,17 +579,26 @@ EOF
     hp300:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
+    i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit 0 ;;
     sparc*:BSD/OS:*:*)
 	echo sparc-unknown-bsdi${UNAME_RELEASE}
 	exit 0 ;;
-    i?86:BSD/386:*:* | *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit 0 ;;
     *:FreeBSD:*:*)
+	if test -x /usr/bin/objformat; then
+	    if test "elf" = "`/usr/bin/objformat`"; then
+		echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
+		exit 0
+	    fi
+	fi
 	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit 0 ;;
     *:NetBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
 	exit 0 ;;
     *:OpenBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
@@ -535,6 +609,15 @@ EOF
     i*:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i386-pc-interix
+	exit 0 ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit 0 ;;
     p*:CYGWIN*:*)
 	echo powerpcle-unknown-cygwin
 	exit 0 ;;
@@ -545,32 +628,90 @@ EOF
 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit 0 ;;
     *:Linux:*:*)
-	# uname on the ARM produces all sorts of strangeness, and we need to
-	# filter it out.
-	case "$UNAME_MACHINE" in
-	  arm* | sa110*)	      UNAME_MACHINE="arm" ;;
-	esac
 
 	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us.
-	ld_help_string=`ld --help 2>&1`
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	ld_help_string=`cd /; ld --help 2>&1`
 	ld_supported_emulations=`echo $ld_help_string \
 			 | sed -ne '/supported emulations:/!d
 				    s/[ 	][ 	]*/ /g
 				    s/.*supported emulations: *//
 				    s/ .*//
 				    p'`
-        case "$ld_supported_emulations" in
-	  i?86linux)  echo "${UNAME_MACHINE}-pc-linux-gnuaout"      ; exit 0 ;;
-	  i?86coff)   echo "${UNAME_MACHINE}-pc-linux-gnucoff"      ; exit 0 ;;
-	  sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
-	  armlinux)   echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
-	  m68klinux)  echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
-	  elf32ppc*)  echo "powerpc-unknown-linux-gnu"              ; exit 0 ;;
+	case "$ld_supported_emulations" in
+	  *ia64)
+		echo "${UNAME_MACHINE}-unknown-linux"
+		exit 0
+		;;
+	  i?86linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit 0
+		;;
+	  i?86coff)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit 0
+		;;
+	  sparclinux)
+		echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+		exit 0
+		;;
+	  armlinux)
+		echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+		exit 0
+		;;
+	  elf32arm*)
+		echo "${UNAME_MACHINE}-unknown-linux-gnu"
+		exit 0
+		;;
+	  armelf_linux*)
+		echo "${UNAME_MACHINE}-unknown-linux-gnu"
+		exit 0
+		;;
+	  m68klinux)
+		echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+		exit 0
+		;;
+	  elf32ppc*)
+		# Determine Lib Version
+		cat >$dummy.c <<EOF
+#include <features.h>
+#if defined(__GLIBC__)
+extern char __libc_version[];
+extern char __libc_release[];
+#endif
+main(argc, argv)
+     int argc;
+     char *argv[];
+{
+#if defined(__GLIBC__)
+  printf("%s %s\n", __libc_version, __libc_release);
+#else
+  printf("unkown\n");
+#endif
+  return 0;
+}
+EOF
+		LIBC=""
+		$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
+		if test "$?" = 0 ; then
+			./$dummy | grep 1\.99 > /dev/null
+			if test "$?" = 0 ; then
+				LIBC="libc1"
+			fi
+		fi
+		rm -f $dummy.c $dummy
+		echo powerpc-unknown-linux-gnu${LIBC}
+		exit 0
+		;;
+	elf64_ia64)
+		echo "${UNAME_MACHINE}-unknown-linux-gnu"
+		exit 0
+		;;
 	esac
 
 	if test "${UNAME_MACHINE}" = "alpha" ; then
-		sed 's/^	//'  <<EOF >dummy.s
+		sed 's/^	//'  <<EOF >$dummy.s
 		.globl main
 		.ent main
 	main:
@@ -588,9 +729,9 @@ EOF
 		.end main
 EOF
 		LIBC=""
-		${CC-cc} dummy.s -o dummy 2>/dev/null
+		$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
 		if test "$?" = 0 ; then
-			./dummy
+			./$dummy
 			case "$?" in
 			7)
 				UNAME_MACHINE="alpha"
@@ -609,20 +750,21 @@ EOF
 				;;
 			esac
 
-			objdump --private-headers dummy | \
+			objdump --private-headers $dummy | \
 			  grep ld.so.1 > /dev/null
 			if test "$?" = 0 ; then
 				LIBC="libc1"
 			fi
 		fi
-		rm -f dummy.s dummy
+		rm -f $dummy.s $dummy
 		echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
 	elif test "${UNAME_MACHINE}" = "mips" ; then
-	  cat >dummy.c <<EOF
-main(argc, argv)
-     int argc;
-     char *argv[];
-{
+	  cat >$dummy.c <<EOF
+#ifdef __cplusplus
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
 #ifdef __MIPSEB__
   printf ("%s-unknown-linux-gnu\n", argv[1]);
 #endif
@@ -632,8 +774,8 @@ main(argc, argv)
   return 0;
 }
 EOF
-	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
-	  rm -f dummy.c dummy
+	  $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+	  rm -f $dummy.c $dummy
 	else
 	  # Either a pre-BFD a.out linker (linux-gnuoldld)
 	  # or one that does not give us useful --help.
@@ -652,15 +794,16 @@ EOF
 	    ;;
 	  esac
 	  # Determine whether the default compiler is a.out or elf
-	  cat >dummy.c <<EOF
+	  cat >$dummy.c <<EOF
 #include <features.h>
-main(argc, argv)
-     int argc;
-     char *argv[];
-{
+#ifdef __cplusplus
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
 #ifdef __ELF__
 # ifdef __GLIBC__
-#  if (__GLIBC__ >= 2)
+#  if __GLIBC__ >= 2
     printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
 #  else
     printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
@@ -674,8 +817,8 @@ main(argc, argv)
   return 0;
 }
 EOF
-	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
-	  rm -f dummy.c dummy
+	  $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+	  rm -f $dummy.c $dummy
 	fi ;;
 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
 # are messed up and put the nodename in both sysname and nodename.
@@ -683,32 +826,28 @@ EOF
 	echo i386-sequent-sysv4
 	exit 0 ;;
     i?86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
+	# Unixware is an offshoot of SVR4, but it has its own version
+	# number series starting with 2...
+	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
+	# Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit 0 ;;
-    # SysVr5/Unixware7
-    i?86:*:5*:* | i?86:SYSTEM_V:5*:*)
-	 if uname -a | grep SCO >/dev/null 2>/dev/null ; then
-	    (/bin/uname -s|egrep UnixWare >/dev/null) && UNAME_VER=uw${UNAME_VERSION}
-	    if /bin/uname -X 2>/dev/null >/dev/null ; then
-		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
-		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
-			&& UNAME_MACHINE=i586
-	    fi
-		echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}${UNAME_VER}
+    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
 	else
-		echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
 	fi
 	exit 0 ;;
-    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
-	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv4.2uw${UNAME_VERSION}
+    i?86:*:5:7*)
+	# Fixed at (any) Pentium or better
+	UNAME_MACHINE=i586
+	if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
+	    echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
 	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+	    echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
 	fi
 	exit 0 ;;
     i?86:*:3.2:*)
@@ -720,23 +859,20 @@ EOF
 		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
 		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
 			&& UNAME_MACHINE=i586
+		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
 		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
 	else
 		echo ${UNAME_MACHINE}-pc-sysv32
 	fi
 	exit 0 ;;
-    i?86:UnixWare:*:*)
-	if /bin/uname -X 2>/dev/null >/dev/null ; then
-	  (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
-	    && UNAME_MACHINE=i586
-	fi
-	echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION}
-	exit 0 ;;
     pc:*:*:*)
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i386.
 	echo i386-pc-msdosdjgpp
-        exit 0 ;;
+	exit 0 ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
 	exit 0 ;;
@@ -765,15 +901,15 @@ EOF
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
 	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && echo i486-ncr-sysv4 && exit 0 ;;
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && echo i486-ncr-sysv4 && exit 0 ;;
     m68*:LynxOS:2.*:*)
 	echo m68k-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
 	exit 0 ;;
-    i?86:LynxOS:2.*:*)
+    i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
     TSUNAMI:LynxOS:2.*:*)
@@ -785,6 +921,9 @@ EOF
     SM[BE]S:UNIX_SV:*:*)
 	echo mips-dde-sysv${UNAME_RELEASE}
 	exit 0 ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
     RM*:SINIX-*:*:*)
 	echo mips-sni-sysv4
 	exit 0 ;;
@@ -797,9 +936,9 @@ EOF
 	fi
 	exit 0 ;;
     PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                           # says <Richard.M.Bartel@ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit 0 ;;
+			   # says <Richard.M.Bartel@ccMail.Census.GOV>
+	echo i586-unisys-sysv4
+	exit 0 ;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes@openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
@@ -815,13 +954,13 @@ EOF
     news*:NEWS-OS:*:6*)
 	echo mips-sony-newsos6
 	exit 0 ;;
-    R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
+		echo mips-nec-sysv${UNAME_RELEASE}
 	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
+		echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
-        exit 0 ;;
+	exit 0 ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
 	exit 0 ;;
@@ -831,12 +970,27 @@ EOF
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
 	echo i586-pc-beos
 	exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:QNX:*:4*)
+	echo i386-qnx-qnx${UNAME_VERSION}
+	exit 0 ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
 
-cat >dummy.c <<EOF
+cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
 # include <sys/types.h>
 # include <sys/utsname.h>
@@ -852,11 +1006,11 @@ main ()
 #include <sys/param.h>
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
-          "4"
+	  "4"
 #else
 	  ""
 #endif
-         ); exit (0);
+	 ); exit (0);
 #endif
 #endif
 
@@ -874,7 +1028,10 @@ main ()
 #endif
   int version;
   version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
   exit (0);
 #endif
 
@@ -934,8 +1091,8 @@ main ()
 }
 EOF
 
-${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
 
 # Apollos put the system type in the environment.
 
diff --git a/config.sub b/config.sub
index f121512b..7ed14e67 100755
--- a/config.sub
+++ b/config.sub
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Configuration validation subroutine script, version 1.1.
-#   Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
+#   Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc.
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
 # can handle that machine.  It does not imply ALL GNU software can.
@@ -68,11 +68,7 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  hurd-gnu*)
-    os=$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  linux-gnu*)
+  hurd-gnu* | linux-gnu*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -102,11 +98,21 @@ case $os in
 		os=
 		basic_machine=$1
 		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
 	-sco5)
-		os=sco3.2v5
+		os=-sco3.2v5
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco4)
@@ -125,6 +131,9 @@ case $os in
 		os=-sco3.2v2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-isc)
 		os=-isc2.2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -147,23 +156,33 @@ case $os in
 	-psos*)
 		os=-psos
 		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
 esac
 
 # Decode aliases for certain CPU-COMPANY combinations.
 case $basic_machine in
 	# Recognize the basic CPU types without company name.
 	# Some are omitted here because they have special meanings below.
-	tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+	tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
 		| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
 		| 580 | i960 | h8300 \
-		| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w \
-		| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
-		| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
-		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
-		| mipstx39 | mipstx39el \
-		| sparc | sparclet | sparclite | sparc64 | v850 | ia64)
+		| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
+		| alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
+		| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
+		| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
+		| mips64orion | mips64orionel | mipstx39 | mipstx39el \
+		| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
+		| mips64vr5000 | miprs64vr5000el | mcore \
+		| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
+		| thumb | d10v | fr30)
 		basic_machine=$basic_machine-unknown
 		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
+		;;
+
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
@@ -176,28 +195,45 @@ case $basic_machine in
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
-	vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
+	# FIXME: clean up the formatting here.
+	vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
 	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
 	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
-	      | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
+	      | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
 	      | xmp-* | ymp-* \
-	      | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
-	      | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
-	      | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
+	      | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
+	      | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \
+	      | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
+	      | clipper-* | orion-* \
 	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
-	      | sparc64-* | mips64-* | mipsel-* \
-	      | mips64el-* | mips64orion-* | mips64orionel-*  \
-	      | mipstx39-* | mipstx39el-* \
-	      | f301-* | ia64-*)
+	      | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
+	      | mips64el-* | mips64orion-* | mips64orionel-* \
+	      | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
+	      | mipstx39-* | mipstx39el-* | mcore-* \
+	      | f301-* | armv*-* | t3e-* \
+	      | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
+	      | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* )
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
 	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
 		basic_machine=m68000-att
 		;;
 	3b*)
 		basic_machine=we32k-att
 		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
 	alliant | fx80)
 		basic_machine=fx80-alliant
 		;;
@@ -227,6 +263,10 @@ case $basic_machine in
 		basic_machine=m68k-apollo
 		os=-sysv
 		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -303,6 +343,10 @@ case $basic_machine in
 	encore | umax | mmax)
 		basic_machine=ns32k-encore
 		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
 	fx2800)
 		basic_machine=i860-alliant
 		;;
@@ -321,6 +365,14 @@ case $basic_machine in
 		basic_machine=h8300-hitachi
 		os=-hms
 		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
 	harris)
 		basic_machine=m88k-harris
 		os=-sysv3
@@ -336,13 +388,30 @@ case $basic_machine in
 		basic_machine=m68k-hp
 		os=-hpux
 		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
 	hp9k2[0-9][0-9] | hp9k31[0-9])
 		basic_machine=m68000-hp
 		;;
 	hp9k3[2-9][0-9])
 		basic_machine=m68k-hp
 		;;
-	hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
 		basic_machine=hppa1.1-hp
 		;;
 	hp9k8[0-9][0-9] | hp8[0-9][0-9])
@@ -351,6 +420,14 @@ case $basic_machine in
 	hppa-next)
 		os=-nextstep3
 		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		os=-mvs
@@ -379,6 +456,25 @@ case $basic_machine in
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-solaris2
 		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	i386-go32 | go32)
+		basic_machine=i386-unknown
+		os=-go32
+		;;
+	i386-mingw32 | mingw32)
+		basic_machine=i386-unknown
+		os=-mingw32
+		;;
+	i386-qnx | qnx)
+		basic_machine=i386-qnx
+		;;
 	iris | iris4d)
 		basic_machine=mips-sgi
 		case $os in
@@ -407,6 +503,10 @@ case $basic_machine in
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
 	mipsel*-linux*)
 		basic_machine=mipsel-unknown
 		os=-linux-gnu
@@ -421,10 +521,30 @@ case $basic_machine in
 	mips3*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
 		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	msdos)
+		basic_machine=i386-unknown
+		os=-msdos
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
 		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
 	news | news700 | news800 | news900)
 		basic_machine=m68k-sony
 		os=-newsos
@@ -437,6 +557,10 @@ case $basic_machine in
 		basic_machine=mips-sony
 		os=-newsos
 		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
 	next | m*-next )
 		basic_machine=m68k-next
 		case $os in
@@ -462,9 +586,25 @@ case $basic_machine in
 		basic_machine=i960-intel
 		os=-nindy
 		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
 	np1)
 		basic_machine=np1-gould
 		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
 	pa-hitachi)
 		basic_machine=hppa1.1-hitachi
 		os=-hiuxwe2
@@ -479,22 +619,22 @@ case $basic_machine in
 	pbb)
 		basic_machine=m68k-tti
 		;;
-        pc532 | pc532-*)
+	pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
-	pentium | p5 | k5 | nexen)
+	pentium | p5 | k5 | k6 | nexen)
 		basic_machine=i586-pc
 		;;
-	pentiumpro | p6 | k6 | 6x86)
+	pentiumpro | p6 | 6x86)
 		basic_machine=i686-pc
 		;;
 	pentiumii | pentium2)
 		basic_machine=i786-pc
 		;;
-	pentium-* | p5-* | k5-* | nexen-*)
+	pentium-* | p5-* | k5-* | k6-* | nexen-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumpro-* | p6-* | k6-* | 6x86-*)
+	pentiumpro-* | p6-* | 6x86-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pentiumii-* | pentium2-*)
@@ -506,24 +646,32 @@ case $basic_machine in
 	power)	basic_machine=rs6000-ibm
 		;;
 	ppc)	basic_machine=powerpc-unknown
-	        ;;
+		;;
 	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
-	        ;;
+		;;
 	ppcle-* | powerpclittle-*)
 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ps2)
 		basic_machine=i386-ibm
 		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
 	rm[46]00)
 		basic_machine=mips-siemens
 		;;
 	rtpc | rtpc-*)
 		basic_machine=romp-ibm
 		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
 	sequent)
 		basic_machine=i386-sequent
 		;;
@@ -531,6 +679,10 @@ case $basic_machine in
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
+	sparclite-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
 	sps7)
 		basic_machine=m68k-bull
 		os=-sysv2
@@ -538,6 +690,13 @@ case $basic_machine in
 	spur)
 		basic_machine=spur-unknown
 		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -582,6 +741,10 @@ case $basic_machine in
 		basic_machine=i386-sequent
 		os=-dynix
 		;;
+	t3e)
+		basic_machine=t3e-cray
+		os=-unicos
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -599,6 +762,10 @@ case $basic_machine in
 		basic_machine=a29k-nyu
 		os=-sym1
 		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
 	vaxv)
 		basic_machine=vax-dec
 		os=-sysv
@@ -608,8 +775,8 @@ case $basic_machine in
 		os=-vms
 		;;
 	vpp*|vx|vx-*)
-               basic_machine=f301-fujitsu
-               ;;
+	       basic_machine=f301-fujitsu
+	       ;;
 	vxworks960)
 		basic_machine=i960-wrs
 		os=-vxworks
@@ -622,13 +789,25 @@ case $basic_machine in
 		basic_machine=a29k-wrs
 		os=-vxworks
 		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
 	xmp)
 		basic_machine=xmp-cray
 		os=-unicos
 		;;
-        xps | xps100)
+	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
 	none)
 		basic_machine=none-none
 		os=-none
@@ -636,6 +815,15 @@ case $basic_machine in
 
 # Here we handle the default manufacturer of certain CPU types.  It is in
 # some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
 	mips)
 		if [ x$os = x-linux-gnu ]; then
 			basic_machine=mips-unknown
@@ -658,10 +846,10 @@ case $basic_machine in
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sparc)
+	sparc | sparcv9)
 		basic_machine=sparc-sun
 		;;
-        cydra)
+	cydra)
 		basic_machine=cydra-cydrome
 		;;
 	orion)
@@ -670,6 +858,16 @@ case $basic_machine in
 	orion105)
 		basic_machine=clipper-highlevel
 		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	c4x*)
+		basic_machine=c4x-none
+		os=-coff
+		;;
 	*)
 		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
 		exit 1
@@ -693,8 +891,8 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
+	# First match some system type aliases
+	# that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
@@ -723,25 +921,36 @@ case $os in
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* | -os390* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos*)
+	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
-	-linux*)
-		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+	      | -macos* | -mpw* | -magic* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
 		;;
 	-hurd*)
 		os=`echo $os `
 		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
 	-sunos5*)
 		os=`echo $os | sed -e 's|sunos5|solaris2|'`
 		;;
 	-sunos6*)
 		os=`echo $os | sed -e 's|sunos6|solaris3|'`
 		;;
+	-opened*)
+		os=-openedition
+		;;
 	-osfrose*)
 		os=-osfrose
 		;;
@@ -757,11 +966,14 @@ case $os in
 	-acis*)
 		os=-aos
 		;;
+	-386bsd)
+		os=-bsd
+		;;
 	-ctix* | -uts*)
 		os=-sysv
 		;;
 	-ns2 )
-	        os=-nextstep2
+		os=-nextstep2
 		;;
 	# Preserve the version number of sinix5.
 	-sinix5.*)
@@ -776,6 +988,9 @@ case $os in
 	-oss*)
 		os=-sysv3
 		;;
+	-qnx)
+		os=-qnx4
+		;;
 	-svr4)
 		os=-sysv4
 		;;
@@ -788,9 +1003,18 @@ case $os in
 	# This must come after -sysvr4.
 	-sysv*)
 		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
 	-xenix)
 		os=-xenix
 		;;
+	-*mint | -*MiNT)
+		os=-mint
+		;;
 	-none)
 		;;
 	*)
@@ -816,10 +1040,13 @@ case $basic_machine in
 	*-acorn)
 		os=-riscix1.2
 		;;
+	arm*-rebel)
+		os=-linux
+		;;
 	arm*-semi)
 		os=-aout
 		;;
-        pdp11-*)
+	pdp11-*)
 		os=-none
 		;;
 	*-dec | vax-*)
@@ -837,6 +1064,15 @@ case $basic_machine in
 		# default.
 		# os=-sunos4
 		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
 	*-tti)	# must be before sparc entry or we get the wrong os.
 		os=-sysv3
 		;;
@@ -852,6 +1088,15 @@ case $basic_machine in
 	*-ibm)
 		os=-aix
 		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
 	*-hp)
 		os=-hpux
 		;;
@@ -894,19 +1139,19 @@ case $basic_machine in
 	*-next)
 		os=-nextstep3
 		;;
-        *-gould)
+	*-gould)
 		os=-sysv
 		;;
-        *-highlevel)
+	*-highlevel)
 		os=-bsd
 		;;
 	*-encore)
 		os=-bsd
 		;;
-        *-sgi)
+	*-sgi)
 		os=-irix
 		;;
-        *-siemens)
+	*-siemens)
 		os=-sysv4
 		;;
 	*-masscomp)
@@ -915,6 +1160,18 @@ case $basic_machine in
 	f301-fujitsu)
 		os=-uxpv
 		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
 	*)
 		os=-none
 		;;
@@ -936,9 +1193,15 @@ case $basic_machine in
 			-aix*)
 				vendor=ibm
 				;;
+			-beos*)
+				vendor=be
+				;;
 			-hpux*)
 				vendor=hp
 				;;
+			-mpeix*)
+				vendor=hp
+				;;
 			-hiux*)
 				vendor=hitachi
 				;;
@@ -954,7 +1217,7 @@ case $basic_machine in
 			-genix*)
 				vendor=ns
 				;;
-			-mvs*)
+			-mvs* | -opened*)
 				vendor=ibm
 				;;
 			-ptx*)
@@ -966,6 +1229,15 @@ case $basic_machine in
 			-aux*)
 				vendor=apple
 				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -*MiNT)
+				vendor=atari
+				;;
 		esac
 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
 		;;
diff --git a/lynx.cfg b/lynx.cfg
index d965c809..57ceb5a1 100644
--- a/lynx.cfg
+++ b/lynx.cfg
@@ -2314,6 +2314,7 @@ MINIMAL_COMMENTS:TRUE
 #KEYMAP:/:WHEREIS		# Find a string within the current document
 #KEYMAP:n:NEXT			# Find next occurrence of string within document
 #KEYMAP:c:COMMENT		# Comment to the author of the current document
+#KEYMAP:C:CHDIR			# Change current directory
 #KEYMAP:e:EDIT			# Edit current document or form's textarea (call: ^Ve)
 #KEYMAP:E:ELGOTO		# Edit the current link's URL or ACTION and go to it
 #KEYMAP:=:INFO			# Show info about current document
@@ -2380,6 +2381,7 @@ MINIMAL_COMMENTS:TRUE
 #KEYMAP:^U:PREV_DOC:DIRED	# Return to the previous document
 #KEYMAP:.:TAG_LINK:DIRED	# Tag a file or directory for later action
 #KEYMAP:c:CREATE:DIRED		# Create a new file or directory
+#KEYMAP:C:CHDIR:DIRED		# change current directory
 #KEYMAP:f:DIRED_MENU:DIRED	# Display a menu of file operations
 #KEYMAP:m:MODIFY:DIRED		# Modify name or location of a file or directory
 #KEYMAP:r:REMOVE:DIRED		# Remove files or directories
@@ -2798,13 +2800,14 @@ MINIMAL_COMMENTS:TRUE
 #	  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.
+# Restrictions can be imposed using -restrictions=externals at the Lynx command
+# line.  This will disallow all EXTERNAL lines in lynx.cfg that have FALSE in
+# the 3rd field (not counting the name of the setting).  TRUE lines will still
+# function.
 #
 # The lynx.cfg line is as follows:
 #
-# EXTERNAL:<url>:<command> %s:<norestriction>
+# EXTERNAL:<url>:<command> %s:<norestriction>:<allow_for_activate>
 #
 # <url> Any given URL.  This can be normal ones like ftp or http or it
 # can be one made up like mymail.
@@ -2818,6 +2821,12 @@ MINIMAL_COMMENTS:TRUE
 # for certain externals to be enabled while restricting others.  TRUE means
 # a command will still function while Lynx is restricted.  WB
 #
+# <allow_for_activate> Setting this to TRUE allows the use of this command not
+# only when EXTERN key is pressed, but also when ACTIVATE command is invoked
+# (i.e activating the link with the given prefix will be equivalent to
+# pressing EXTERN key on it).  If this component of the line is absent, then
+# FALSE is assumed.
+# 
 # For invoking the command use the EXTERN key.  By default it is mapped
 # to '.' (if the feature is enabled), see the KEYMAP section above.
 #
@@ -2990,6 +2999,17 @@ MINIMAL_COMMENTS:TRUE
 #
 #FORCE_EMPTY_HREFLESS_A:FALSE
 
+.h2 HIDDEN_LINK_MARKER
+# HIDDEN_LINK_MARKER - HTML parsing
+# This option defines the string that will be used as title of hidden link (a
+# link that otherwise will have no label associated with it).  Using an empty
+# string as the value will cause lynx to behave in the old way - hidden links
+# will be handled according to other settings (mostly the parameter of
+# --hiddenlinks command-line switch).  If the value is non-empty string, hidden
+# link becomes non-hidden so it won't be handled as hidden link, e.g., listed
+# among hidden links on 'l'isting page.
+#
+#HIDDEN_LINK_MARKER:
 
 .h1 Appearance
 
diff --git a/lynx.hlp b/lynx.hlp
index 7459e195..4dbf01ad 100644
--- a/lynx.hlp
+++ b/lynx.hlp
@@ -103,21 +103,31 @@
        -child exit  on  left-arrow in startfile, and disable save
               to disk.
 
-       -color forces color mode on, if available.  Default  color
-              control  sequences  which  work  for  many terminal
-              types  are  assumed  if  the  terminal   capability
-
-              description  does  not specify how to handle color.
-              Lynx needs to be compiled with  the  slang  library
-              for  this  flag,  it  is  equivalent to setting the
-              COLORTERM environment variable.  (If color  support
+       -cmd_log=FILENAME
+              write keystroke commands and related information to
+              the specified file.
+
+       -cmd_script=FILENAME
+              read  keystroke  commands  from the specified file.
+              You can use the data  written  using  the  -cmd_log
+              option.   Lynx  will ignore other information which
+              the  command-logging  may  have  written   to   the
+              logfile.
+
+       -color forces  color mode on, if available.  Default color
+              control sequences  which  work  for  many  terminal
+              types   are  assumed  if  the  terminal  capability
+              description does not specify how to  handle  color.
+              Lynx  needs  to  be compiled with the slang library
+              for this flag, it  is  equivalent  to  setting  the
+              COLORTERM  environment variable.  (If color support
               is  instead  provided  by  a  color-capable  curses
               library like ncurses, Lynx relies completely on the
-              terminal  description  to  determine  whether color
-              mode is possible, and this flag is not  needed  and
-              thus   unavailable.)    A  saved  show_color=always
-              setting found in a .lynxrc file at startup has  the
-              same  effect.   A  saved  show_color=never found in
+              terminal description  to  determine  whether  color
+              mode  is  possible, and this flag is not needed and
+              thus  unavailable.)   A   saved   show_color=always
+              setting  found in a .lynxrc file at startup has the
+              same effect.  A  saved  show_color=never  found  in
               .lynxrc on startup is overridden by this flag.
 
        -cookies
@@ -127,14 +137,14 @@
               specifies a file to use to store cookies.
 
        -connect_timeout=N
-              Sets the connection timeout, where N  is  given  in
-              seconds.   This is not available under DOS (use the
+              Sets  the  connection  timeout, where N is given in
+              seconds.  This is not available under DOS (use  the
               sockdelay parameter of WATTCP under DOS).
 
        -core  toggles forced core dumps on fatal errors.
 
-       -crawl with -traversal, output each page to a file.   with
-              -dump,  format  output  as  with -traversal, but to
+       -crawl with  -traversal, output each page to a file.  with
+              -dump, format output as  with  -traversal,  but  to
               stdout.
 
        -debug_partial
@@ -144,52 +154,51 @@
               set the display variable for X rexec-ed programs.
 
        -dont_wrap_pre
-              inhibit wrapping of text in  <pre>  when  -dump'ing
-              and  -crawl'ing,  mark wrapped lines in interactive
+              inhibit  wrapping  of  text in <pre> when -dump'ing
+              and -crawl'ing, mark wrapped lines  in  interactive
               session.
 
-       -dump  dumps the formatted output of the default  document
-              or  one  specified  on the command line to standard
+       -dump  dumps  the formatted output of the default document
+              or one specified on the command  line  to  standard
               output.  This can be used in the following way:
-
               lynx -dump http://www.trill-home.com/lynx.html
 
        -editor=EDITOR
-              enable  external  editing,  using   the   specified
+              enable   external   editing,  using  the  specified
               EDITOR. (vi, ed, emacs, etc.)
 
        -emacskeys
               enable emacs-like key movement.
 
        -enable_scrollback
-              toggles  compatibility with communication programs'
-              scrollback keys  (may  be  incompatible  with  some
+              toggles compatibility with communication  programs'
+              scrollback  keys  (may  be  incompatible  with some
               curses packages).
 
        -error_file=FILE
-              define  a  file  where Lynx will report HTTP access
+              define a file where Lynx will  report  HTTP  access
               codes.
 
-       -exec  enable  local  program  execution   (normally   not
+       -exec  enable   local   program  execution  (normally  not
               configured).
 
        -fileversions
-              include   all   versions  of  files  in  local  VMS
+              include  all  versions  of  files  in   local   VMS
               directory listings.
 
        -force_empty_hrefless_a
-              force HREF-less 'A' elements  to  be  empty  (close
+              force  HREF-less  'A'  elements  to be empty (close
               them as soon as they are seen).
 
        -force_html
-              forces  the  first  document  to  be interpreted as
+              forces the first  document  to  be  interpreted  as
               HTML.
 
        -force_secure
               toggles forcing of the secure flag for SSL cookies.
 
        -forms_options
-              toggles  whether  the  Options Menu is key-based or
+              toggles whether the Options Menu  is  key-based  or
               form-based.
 
        -from  toggles transmissions of From headers.
@@ -197,8 +206,8 @@
        -ftp   disable ftp access.
 
        -get_data
-              properly formatted data for a get form are read  in
-              from  stdin  and  passed  to  the  form.   Input is
+              properly  formatted data for a get form are read in
+              from stdin  and  passed  to  the  form.   Input  is
               terminated by a line that starts with '---'.
 
        -head  send a HEAD request for the mime headers.
@@ -209,19 +218,18 @@
               control the display of hidden links.
 
               merge hidden links show up as bracketed numbers and
-              are  numbered  together  with  other  links  in the
+              are numbered  together  with  other  links  in  the
               sequence of their occurrence in the document.
 
-              listonly hidden  links  are  shown  only  on  L)ist
+              listonly  hidden  links  are  shown  only  on L)ist
               screens and listings generated by -dump or from the
-              P)rint menu, but appear separately at  the  end  of
-
+              P)rint  menu,  but  appear separately at the end of
               those lists.  This is the default behavior.
 
               ignore hidden links do not appear even in listings.
 
        -historical
-              toggles use of '>' or '-->'  as  a  terminator  for
+              toggles  use  of  '>'  or '-->' as a terminator for
               comments.
 
        -homepage=URL
@@ -233,7 +241,7 @@
        -index=URL
               set the default index file to the specified URL.
 
-       -ismap toggles  inclusion  of ISMAP links when client-side
+       -ismap toggles inclusion of ISMAP links  when  client-side
               MAPs are present.
 
        -justify
@@ -247,12 +255,12 @@
               disable URLs that point to remote hosts.
 
        -locexec
-              enable  local  program  execution  from local files
-              only (if Lynx was  compiled  with  local  execution
+              enable local program  execution  from  local  files
+              only  (if  Lynx  was  compiled with local execution
               enabled).
 
        -mime_header
-              prints  the MIME header of a fetched document along
+              prints the MIME header of a fetched document  along
               with its source.
 
        -minimal
@@ -262,7 +270,7 @@
               number of articles in chunked news listings.
 
        -newsmaxchunk=NUMBER
-              maximum news articles in listings before  chunking.
+              maximum  news articles in listings before chunking.
 
        -nobold
               disable bold video-attribute.
@@ -270,20 +278,20 @@
        -nobrowse
               disable directory browsing.
 
-       -nocc  disable  Cc:  prompts  for self copies of mailings.
-              Note that this does not disable any CCs  which  are
+       -nocc  disable Cc: prompts for self  copies  of  mailings.
+              Note  that  this does not disable any CCs which are
               incorporated within a mailto URL or form ACTION.
 
        -nocolor
               force   color   mode   off,   overriding   terminal
-              capabilities  and  any  -color   flags,   COLORTERM
+              capabilities   and   any  -color  flags,  COLORTERM
               variable, and saved .lynxrc settings.
 
        -noexec
               disable local program execution. (DEFAULT)
 
        -nofilereferer
-              disable  transmissions  of Referer headers for file
+              disable transmissions of Referer headers  for  file
               URLs.
 
        -nolist
@@ -293,10 +301,10 @@
               owners.
 
        -nonrestarting_sigwinch
-              This  flag  is  not  available on all systems, Lynx
-              needs to be compiled with  HAVE_SIGACTION  defined.
-              If  available,  this  flag  may cause Lynx to react
-              more immediately to window changes when run  within
+              This flag is not available  on  all  systems,  Lynx
+              needs  to  be compiled with HAVE_SIGACTION defined.
+              If available, this flag may  cause  Lynx  to  react
+              more  immediately to window changes when run within
               an xterm.
 
        -nopause
@@ -325,7 +333,7 @@
               disable underline video-attribute.
 
        -number_fields
-              force numbering of links  as  well  as  form  input
+              force  numbering  of  links  as  well as form input
               fields
 
        -number_links
@@ -339,24 +347,24 @@
               with partial-display logic
 
        -pauth=ID:PASSWD
-              set authorization ID and password for  a  protected
-              proxy  server  at  startup.  Be sure to protect any
+              set  authorization  ID and password for a protected
+              proxy server at startup.  Be sure  to  protect  any
               script files which use this switch.
 
-       -popup toggles handling of  single-choice  SELECT  options
+       -popup toggles  handling  of  single-choice SELECT options
               via popup windows or as lists of radio buttons.
 
        -post_data
               properly formatted data for a post form are read in
-              from stdin  and  passed  to  the  form.   Input  is
+              from  stdin  and  passed  to  the  form.   Input is
               terminated by a line that starts with '---'.
 
        -preparsed
-              show  HTML  source  preparsed  and reformatted when
+              show HTML source  preparsed  and  reformatted  when
               used with -source or in source view.
 
        -prettysrc
-              show HTML source view  with  lexical  elements  and
+              show  HTML  source  view  with lexical elements and
               tags in color.
 
        -print enable print functions. (default)
@@ -364,43 +372,42 @@
        -pseudo_inlines
               toggles pseudo-ALTs for inlines with no ALT string.
 
-       -raw   toggles  default   setting   of   8-bit   character
-              translations  or CJK mode for the startup character
+       -raw   toggles   default   setting   of   8-bit  character
+              translations or CJK mode for the startup  character
               set.
 
        -realm restricts access to URLs in the starting realm.
-
        -reload
               flushes the cache on a proxy server (only the first
               document affected).
 
        -restrictions=[option][,option][,option]...
-              allows   a   list   of   services  to  be  disabled
+              allows  a  list  of   services   to   be   disabled
               selectively. Dashes and underscores in option names
               can be intermixed. The following list is printed if
               no options are specified.
 
               all - restricts all options listed below.
 
-              bookmark - disallow changing the  location  of  the
+              bookmark  -  disallow  changing the location of the
               bookmark file.
 
-              bookmark_exec  -  disallow  execution links via the
+              bookmark_exec - disallow execution  links  via  the
               bookmark file.
 
-              change_exec_perms - disallow changing  the  eXecute
-              permission   on  files  (but  still  allow  it  for
+              change_exec_perms  -  disallow changing the eXecute
+              permission  on  files  (but  still  allow  it   for
               directories) when local file management is enabled.
 
-              default  -  same as command line option -anonymous.
+              default - same as command line  option  -anonymous.
               Disables default services for anonymous users.  Set
-              to   all  restricted,  except  for:  inside_telnet,
-              outside_telnet,      inside_ftp,       outside_ftp,
+              to  all  restricted,  except  for:   inside_telnet,
+              outside_telnet,       inside_ftp,      outside_ftp,
               inside_rlogin,     outside_rlogin,     inside_news,
               outside_news, telnet_port, jump, mail, print, exec,
-              and  goto.   The  settings  for  these,  as well as
-              additional  goto  restrictions  for  specific   URL
-              schemes  that  are  also  applied, are derived from
+              and goto.  The  settings  for  these,  as  well  as
+              additional   goto  restrictions  for  specific  URL
+              schemes that are also  applied,  are  derived  from
               definitions within userdefs.h.
 
               dired_support - disallow local file management.
@@ -408,43 +415,44 @@
               disk_save - disallow saving to disk in the download
               and print menus.
 
-              dotfiles  -  disallow  access  to,  or creation of,
+              dotfiles - disallow  access  to,  or  creation  of,
               hidden (dot) files.
 
-              download  -  disallow  some  downloaders   in   the
-              download    menu    (does   not   imply   disk_save
+              download   -   disallow  some  downloaders  in  the
+              download   menu   (does   not    imply    disk_save
               restriction).
 
               editor - disallow external editing.
 
               exec - disable execution scripts.
 
-              exec_frozen - disallow the user from  changing  the
+              exec_frozen  -  disallow the user from changing the
               local execution option.
 
-              externals  - disallow some "EXTERNAL" configuration
-              lines if  support  for  passing  URLs  to  external
-              applications  (with the EXTERN command) is compiled
+              externals - disallow some "EXTERNAL"  configuration
+              lines  if  support  for  passing  URLs  to external
+
+              applications (with the EXTERN command) is  compiled
               in.
 
-              file_url - disallow using G)oto,  served  links  or
+              file_url  -  disallow  using G)oto, served links or
               bookmarks for file: URLs.
 
               goto - disable the 'g' (goto) command.
 
-              inside_ftp  -  disallow ftps for people coming from
+              inside_ftp - disallow ftps for people  coming  from
               inside your domain (utmp required for selectivity).
 
-              inside_news  -  disallow  USENET  news  posting for
-              people  coming  from  inside  your   domain   (utmp
+              inside_news -  disallow  USENET  news  posting  for
+              people   coming   from  inside  your  domain  (utmp
               required for selectivity).
 
-              inside_rlogin  - disallow rlogins for people coming
-              from  inside  your  domain   (utmp   required   for
+              inside_rlogin - disallow rlogins for people  coming
+              from   inside   your   domain  (utmp  required  for
               selectivity).
 
-              inside_telnet  - disallow telnets for people coming
-              from  inside  your  domain   (utmp   required   for
+              inside_telnet - disallow telnets for people  coming
+              from   inside   your   domain  (utmp  required  for
               selectivity).
 
               jump - disable the 'j' (jump) command.
@@ -455,44 +463,44 @@
 
               news_post - disallow USENET News posting.
 
-              options_save  - disallow saving options in .lynxrc.
+              options_save - disallow saving options in  .lynxrc.
 
-              outside_ftp - disallow ftps for people coming  from
-              outside    your    domain    (utmp   required   for
+              outside_ftp  - disallow ftps for people coming from
+              outside   your   domain    (utmp    required    for
               selectivity).
 
-              outside_news - disallow  USENET  news  reading  and
-              posting  for people coming from outside your domain
-              (utmp required for selectivity).  This  restriction
-              applies   to   "news",   "nntp",   "newspost",  and
-              "newsreply" URLs, but not to "snews",  "snewspost",
+              outside_news  -  disallow  USENET  news reading and
+              posting for people coming from outside your  domain
+              (utmp  required for selectivity).  This restriction
+              applies  to   "news",   "nntp",   "newspost",   and
+              "newsreply"  URLs, but not to "snews", "snewspost",
               or "snewsreply" in case they are supported.
 
               outside_rlogin - disallow rlogins for people coming
-              from  outside  your  domain  (utmp   required   for
+              from   outside   your  domain  (utmp  required  for
               selectivity).
 
               outside_telnet - disallow telnets for people coming
-              from  outside  your  domain  (utmp   required   for
+              from   outside   your  domain  (utmp  required  for
               selectivity).
 
               print - disallow most print options.
-
-              shell  -  disallow  shell  escapes  and lynxexec or
+              shell - disallow  shell  escapes  and  lynxexec  or
               lynxprog G)oto's.
 
-              suspend - disallow  Unix  Control-Z  suspends  with
+              suspend  -  disallow  Unix  Control-Z suspends with
               escape to shell.
 
-              telnet_port  - disallow specifying a port in telnet
+              telnet_port - disallow specifying a port in  telnet
               G)oto's.
-              useragent - disallow  modifications  of  the  User-
+
+              useragent  -  disallow  modifications  of the User-
               Agent header.
 
        -resubmit_posts
-              toggles  forced  resubmissions  (no-cache) of forms
-              with method POST when the documents  they  returned
-              are  sought  with  the PREV_DOC command or from the
+              toggles forced resubmissions  (no-cache)  of  forms
+              with  method  POST when the documents they returned
+              are sought with the PREV_DOC command  or  from  the
               History List.
 
        -rlogin
@@ -502,69 +510,69 @@
               require .www_browsable files to browse directories.
 
        -short_url
-              show  very  long URLs in the status line with "..."
+              show very long URLs in the status line  with  "..."
               to represent the portion which cannot be displayed.
-              The  beginning  and  end  of the URL are displayed,
+              The beginning and end of  the  URL  are  displayed,
               rather than suppressing the end.
 
        -show_cursor
-              If enabled the cursor will not  be  hidden  in  the
+              If  enabled  the  cursor  will not be hidden in the
               right hand corner but will instead be positioned at
-              the start of the  currently  selected  link.   Show
-              cursor   is   the   default   for  systems  without
+              the  start  of  the  currently selected link.  Show
+              cursor  is  the   default   for   systems   without
               FANCY_CURSES     capabilities.      The     default
               configuration  can  be  changed  in  userdefs.h  or
-              lynx.cfg.  The  command  line  switch  toggles  the
+              lynx.cfg.   The  command  line  switch  toggles the
               default.
 
        -soft_dquotes
-              toggles  emulation  of  the old Netscape and Mosaic
+              toggles emulation of the old  Netscape  and  Mosaic
               bug  which  treated  '>'  as  a  co-terminator  for
               double-quotes and tags.
 
        -source
-              works  the  same  as  dump  but outputs HTML source
+              works the same as  dump  but  outputs  HTML  source
               instead of formatted text.
 
        -stack_dump
               disable SIGINT cleanup handler
 
        -startfile_ok
-              allow  non-http   startfile   and   homepage   with
+              allow   non-http   startfile   and   homepage  with
               -validate.
 
        -stdin read the startfile from standard input (UNIX only).
 
        -tagsoup
-              initialize parser, using Tag Soup DTD  rather  than
+              initialize  parser,  using Tag Soup DTD rather than
               SortaSGML.
 
        -telnet
               disable recognition of telnet commands.
 
        -term=TERM
-              tell  Lynx  what  terminal  type  to  assume  it is
-              talking  to.   (This  may  be  useful  for   remote
-              execution,  when,  for  example, Lynx connects to a
-              remote TCP/IP port that starts a  script  that,  in
+              tell Lynx  what  terminal  type  to  assume  it  is
+              talking   to.   (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.)
 
        -timeout=N
-              For  win32,  sets the network read-timeout, where N
+              For win32, sets the network read-timeout,  where  N
               is given in seconds.
 
-       -tlog  toggles between using a Lynx Trace Log  and  stderr
+       -tlog  toggles  between  using a Lynx Trace Log and stderr
               for trace output from the session.
 
        -tna   turns on "Textfields Need Activation" mode.
 
-       -trace turns  on  Lynx  trace  mode.  Destination of trace
+       -trace turns on Lynx trace  mode.   Destination  of  trace
               output depends on -tlog.
 
        -traversal
-              traverse all http  links  derived  from  startfile.
-              When  used  with -crawl, each link that begins with
-              the same string as startfile is output to  a  file,
+              traverse  all  http  links  derived from startfile.
+              When used with -crawl, each link that  begins  with
+              the  same  string as startfile is output to a file,
               intended for indexing.  See CRAWL.announce for more
               information.
 
@@ -572,27 +580,27 @@
               toggles use of _underline_ format in dumps.
 
        -use_mouse
-              turn on mouse support, if available.  Clicking  the
+              turn  on mouse support, if available.  Clicking the
               left mouse button on a link traverses it.  Clicking
               the right mouse button pops back.  Click on the top
-              line  to  scroll  up.   Click on the bottom line to
-              scroll down.  The first few positions  in  the  top
-              and  bottom  line  may invoke additional functions.
-              Lynx must be compiled  with  ncurses  or  slang  to
+              line to scroll up.  Click on  the  bottom  line  to
+              scroll  down.   The  first few positions in the top
+              and bottom line may  invoke  additional  functions.
+              Lynx  must  be  compiled  with  ncurses or slang to
               support this feature.  If ncurses is used, clicking
-              the middle mouse button  pops  up  a  simple  menu.
-              Mouse  clicks  may only work reliably while Lynx is
+              the  middle  mouse  button  pops  up a simple menu.
+              Mouse clicks may only work reliably while  Lynx  is
               idle waiting for input.
 
        -useragent=Name
               set alternate Lynx User-Agent header.
 
        -validate
-              accept only http URLs (for  validation).   Complete
+              accept  only  http URLs (for validation).  Complete
               security restrictions also are implemented.
 
        -verbose
-              toggle  [LINK],  [IMAGE] and [INLINE] comments with
+              toggle [LINK], [IMAGE] and [INLINE]  comments  with
               filenames of these images.
 
        -version
@@ -602,220 +610,222 @@
               enable vi-like key movement.
 
        -wdebug
-              enable Waterloo tcp/ip packet debug (print to  watt
-              debugfile).   This  applies  only  to  DOS versions
+              enable  Waterloo tcp/ip packet debug (print to watt
+              debugfile).  This  applies  only  to  DOS  versions
               compiled with WATTCP or WATT-32.
 
        -width=NUMBER
-              number of columns for formatting of dumps,  default
+              number  of columns for formatting of dumps, default
               is 80.
 
        -with_backspaces
-              emit  backspaces in output if -dumping or -crawling
+              emit backspaces in output if -dumping or  -crawling
               (like 'man' does)
 
 2 COMMANDS
-       o Use Up arrow and Down arrow to scroll through  hypertext
+       o  Use Up arrow and Down arrow to scroll through hypertext
        links.
-       o   Right  arrow  or  Return  will  follow  a  highlighted
+       o  Right  arrow  or  Return  will  follow  a   highlighted
        hypertext link.
        o Left Arrow will retreat from a link.
        o Type "H" or "?" for online help and descriptions of key-
        stroke commands.
-       o  Type  "K" for a complete list of the current key-stroke
+       o Type "K" for a complete list of the  current  key-stroke
        command mappings.
 
 2 ENVIRONMENT
-       In addition to various  "standard"  environment  variables
-       such  as  HOME,  PATH,  USER,  DISPLAY,  TMPDIR, etc, Lynx
-       utilizes several Lynx-specific environment  variables,  if
+       In  addition  to  various "standard" environment variables
+       such as HOME,  PATH,  USER,  DISPLAY,  TMPDIR,  etc,  Lynx
+       utilizes  several  Lynx-specific environment variables, if
        they exist.
 
-       Others  may be created or modified by Lynx to pass data to
-       an external program, or  for  other  reasons.   These  are
+       Others may be created or modified by Lynx to pass data  to
+       an  external  program,  or  for  other reasons.  These are
        listed separately below.
 
-       See  also the sections on SIMULATED CGI SUPPORT and NATIVE
+       See also the sections on SIMULATED CGI SUPPORT and  NATIVE
        LANGUAGE SUPPORT, below.
 
        Note:  Not all environment variables apply to all types of
-       platforms  supported by Lynx, though most do.  Feedback on
+       platforms supported by Lynx, though most do.  Feedback  on
        platform dependencies is solicited.
 
        Environment Variables Used By Lynx:
 
-       COLORTERM           If  set,  color  capability  for   the
+       COLORTERM           If   set,  color  capability  for  the
                            terminal is forced on at startup time.
-                           The  actual  value  assigned  to   the
-
+                           The   actual  value  assigned  to  the
                            variable is ignored.  This variable is
                            only  meaningful  if  Lynx  was  built
-                           using    the   slang   screen-handling
+                           using   the   slang    screen-handling
                            library.
 
-       LYNX_CFG            This variable, if set,  will  override
-                           the  default  location and name of the
-                           global configuration  file  (normally,
+       LYNX_CFG            This  variable,  if set, will override
+                           the default location and name  of  the
+                           global  configuration  file (normally,
                            lynx.cfg)  that  was  defined  by  the
                            LYNX_CFG_FILE    constant    in    the
-                           userdefs.h  file, during installation.
-                           See  the  userdefs.h  file  for   more
+                           userdefs.h file, during  installation.
+                           See   the  userdefs.h  file  for  more
                            information.
 
-       LYNX_LSS            This  variable,  if set, specifies the
+       LYNX_LSS            This variable, if set,  specifies  the
                            location of the default Lynx character
                            style  sheet  file.   [Currently  only
-                           meaningful if  Lynx  was  built  using
+                           meaningful  if  Lynx  was  built using
                            experimental color style support.]
 
-       LYNX_SAVE_SPACE     This  variable,  if set, will override
+       LYNX_SAVE_SPACE     This variable, if set,  will  override
                            the  default  path  prefix  for  files
-                           saved  to  disk that is defined in the
-                           lynx.cfg SAVE_SPACE:  statement.   See
+                           saved to disk that is defined  in  the
+                           lynx.cfg  SAVE_SPACE:  statement.  See
                            the    lynx.cfg    file    for    more
                            information.
 
-       LYNX_TEMP_SPACE     This variable, if set,  will  override
-                           the  default path prefix for temporary
-                           files   that   was   defined    during
-                           installation,  as  well  as  any value
-                           that may be  assigned  to  the  TMPDIR
+       LYNX_TEMP_SPACE     This  variable,  if set, will override
+                           the default path prefix for  temporary
+                           files    that   was   defined   during
+                           installation, as  well  as  any  value
+                           that  may  be  assigned  to the TMPDIR
                            variable.
 
-       MAIL                This  variable  specifies  the default
+       MAIL                This variable  specifies  the  default
                            inbox Lynx will check for new mail, if
-                           such   checking   is  enabled  in  the
+                           such  checking  is  enabled   in   the
                            lynx.cfg file.
 
-       NEWS_ORGANIZATION   This variable, if  set,  provides  the
-                           string   used   in  the  Organization:
-                           header of USENET  news  postings.   It
-                           will   override  the  setting  of  the
-                           ORGANIZATION environment variable,  if
-                           it  is  also  set  (and,  on UNIX, the
+       NEWS_ORGANIZATION   This  variable,  if  set, provides the
+                           string  used  in   the   Organization:
+                           header  of  USENET  news postings.  It
+                           will  override  the  setting  of   the
+                           ORGANIZATION  environment variable, if
+                           it is also  set  (and,  on  UNIX,  the
                            contents of an /etc/organization file,
                            if present).
 
-       NNTPSERVER          If  set,  this  variable specifies the
-                           default NNTP server that will be  used
-                           for  USENET  news  reading and posting
+       NNTPSERVER          If set, this  variable  specifies  the
+                           default  NNTP server that will be used
+                           for USENET news  reading  and  posting
                            with Lynx, via news: URL's.
 
-       ORGANIZATION        This variable, if  set,  provides  the
-
-                           string   used   in  the  Organization:
-                           header of USENET  news  postings.   On
+       ORGANIZATION        This  variable,  if  set, provides the
+                           string  used  in   the   Organization:
+                           header  of  USENET  news postings.  On
                            UNIX, it will override the contents of
                            an /etc/organization file, if present.
 
        PROTOCOL_proxy      Lynx supports the use of proxy servers
-                           that can act as firewall gateways  and
-                           caching  servers.  They are preferable
+                           that  can act as firewall gateways and
+                           caching servers.  They are  preferable
                            to  the  older  gateway  servers  (see
-                           WWW_access_GATEWAY,    below).    Each
-                           protocol used  by  Lynx,  (http,  ftp,
+                           WWW_access_GATEWAY,   below).     Each
+                           protocol  used  by  Lynx,  (http, ftp,
                            gopher, etc), can be mapped separately
-                           by setting  environment  variables  of
+                           by  setting  environment  variables of
                            the  form  PROTOCOL_proxy  (literally:
                            http_proxy,  ftp_proxy,  gopher_proxy,
                            etc),                               to
                            "http://some.server.dom:port/".    See
-                           Lynx   Users   Guide   for  additional
+                           Lynx  Users   Guide   for   additional
                            details and examples.
 
-       WWW_access_GATEWAY  Lynx still  supports  use  of  gateway
-                           servers,  with  the  servers specified
+       WWW_access_GATEWAY  Lynx  still  supports  use  of gateway
+                           servers, with  the  servers  specified
                            via   "WWW_access_GATEWAY"   variables
-                           (where  "access" is lower case and can
+                           (where "access" is lower case and  can
                            be "http", "ftp", "gopher" or "wais"),
                            however most gateway servers have been
-                           discontinued.  Note that  you  do  not
-                           include  a  terminal '/' for gateways,
-                           but  do  for  proxies   specified   by
-                           PROTOCOL_proxy  environment variables.
+                           discontinued.   Note  that  you do not
+                           include a terminal '/'  for  gateways,
+                           but   do   for  proxies  specified  by
+                           PROTOCOL_proxy environment  variables.
                            See Lynx Users Guide for details.
 
-       WWW_HOME            This variable, if set,  will  override
-                           the  default  startup URL specified in
+       WWW_HOME            This  variable,  if set, will override
+                           the default startup URL  specified  in
                            any of the Lynx configuration files.
 
        Environment Variables Set or Modified By Lynx:
 
        LYNX_PRINT_DATE     This  variable  is  set  by  the  Lynx
-                           p(rint)  function, to the Date: string
-                           seen in  the  document's  "Information
-                           about"  page  (=  cmd), if any.  It is
-                           created  for  use   by   an   external
+                           p(rint) function, to the Date:  string
+                           seen  in  the  document's "Information
+                           about" page (= cmd), if  any.   It  is
+                           created   for   use   by  an  external
                            program,  as  defined  in  a  lynx.cfg
                            PRINTER: definition statement.  If the
+
                            field does not exist for the document,
-                           the variable is set to a  null  string
+                           the  variable  is set to a null string
                            under UNIX, or "No Date" under VMS.
 
        LYNX_PRINT_LASTMOD  This  variable  is  set  by  the  Lynx
-                           p(rint) function,  to  the  Last  Mod:
-                           string    seen   in   the   document's
-                           "Information about" page (=  cmd),  if
-                           any.   It  is  created  for  use by an
-
+                           p(rint)  function,  to  the  Last Mod:
+                           string   seen   in   the    document's
+                           "Information  about"  page (= cmd), if
+                           any.  It is  created  for  use  by  an
                            external  program,  as  defined  in  a
                            lynx.cfg      PRINTER:      definition
                            statement.   If  the  field  does  not
-                           exist  for  the document, the variable
+                           exist for the document,  the  variable
                            is set to a null string under UNIX, or
                            "No LastMod" under VMS.
 
        LYNX_PRINT_TITLE    This  variable  is  set  by  the  Lynx
                            p(rint)  function,  to  the  Linkname:
-                           string    seen   in   the   document's
-                           "Information about" page (=  cmd),  if
-                           any.   It  is  created  for  use by an
+                           string   seen   in   the    document's
+                           "Information  about"  page (= cmd), if
+                           any.  It is  created  for  use  by  an
                            external  program,  as  defined  in  a
                            lynx.cfg      PRINTER:      definition
                            statement.   If  the  field  does  not
-                           exist  for  the document, the variable
+                           exist for the document,  the  variable
                            is set to a null string under UNIX, or
                            "No Title" under VMS.
 
        LYNX_PRINT_URL      This  variable  is  set  by  the  Lynx
-                           p(rint) function, to the  URL:  string
-                           seen  in  the  document's "Information
-                           about" page (= cmd), if  any.   It  is
-                           created   for   use   by  an  external
+                           p(rint)  function,  to the URL: string
+                           seen in  the  document's  "Information
+                           about"  page  (=  cmd), if any.  It is
+                           created  for  use   by   an   external
                            program,  as  defined  in  a  lynx.cfg
                            PRINTER: definition statement.  If the
                            field does not exist for the document,
-                           the  variable  is set to a null string
+                           the variable is set to a  null  string
                            under UNIX, or "No URL" under VMS.
 
-       LYNX_VERSION        This variable is always set  by  Lynx,
+       LYNX_TRACE          If  set,  causes Lynx to write a trace
+                           file as  if  the  -trace  option  were
+                           supplied.
+
+       LYNX_VERSION        This  variable  is always set by Lynx,
                            and may be used by an external program
-                           to determine  if  it  was  invoked  by
-                           Lynx.   See  also  the comments in the
+                           to  determine  if  it  was  invoked by
+                           Lynx.  See also the  comments  in  the
                            distribution's  sample  mailcap  file,
                            for notes on usage in such a file.
 
-       TERM                Normally,  this  variable  is  used by
-                           Lynx to determine  the  terminal  type
-                           being   used   to  invoke  Lynx.   If,
-                           however, it is unset at  startup  time
-                           (or  has  the  value "unknown"), or if
-                           the -term command-line option is  used
+       TERM                Normally, this  variable  is  used  by
+                           Lynx  to  determine  the terminal type
+                           being  used  to  invoke   Lynx.    If,
+                           however,  it  is unset at startup time
+                           (or has the value  "unknown"),  or  if
+                           the  -term command-line option is used
                            (see OPTIONS section above), Lynx will
-                           set or modify its value  to  the  user
-                           specified  terminal type (for the Lynx
-                           execution  environment).    Note:   If
-                           set/modified  by  Lynx,  the values of
-                           the LINES and/or  COLUMNS  environment
+                           set  or  modify  its value to the user
+                           specified terminal type (for the  Lynx
+                           execution   environment).    Note:  If
+                           set/modified by Lynx,  the  values  of
+                           the  LINES  and/or COLUMNS environment
                            variables may also be changed.
 
 2 SIMULATED CGI SUPPORT
-       If  built  with  the cgi-links option enabled, Lynx allows
-       access to a cgi script directly without the  need  for  an
+       If built with the cgi-links option  enabled,  Lynx  allows
+       access  to  a  cgi script directly without the need for an
        http daemon.
 
-       When  executing  such  "lynxcgi scripts" (if enabled), the
-       following variables  may  be  set  for  simulating  a  CGI
+       When executing such "lynxcgi scripts"  (if  enabled),  the
+       following  variables  may  be  set  for  simulating  a CGI
        environment:
 
        CONTENT_LENGTH
@@ -844,115 +854,115 @@
 
        SERVER_SOFTWARE
 
-       Other  environment  variables  are  not  inherited  by the
+       Other environment  variables  are  not  inherited  by  the
        script, unless they are provided via a LYNXCGI_ENVIRONMENT
-       statement  in  the  configuration  file.  See the lynx.cfg
-       file,   and   the   (draft)    CGI    1.1    Specification
+       statement in the configuration  file.   See  the  lynx.cfg
+       file,    and    the    (draft)   CGI   1.1   Specification
        <http://Web.Golux.Com/coar/cgi/draft-coar-cgi-v11-00.txt>
        for the definition and usage of these variables.
 
        The CGI Specification, and other associated documentation,
-       should  be consulted for general information on CGI script
+       should be consulted for general information on CGI  script
+
        programming.
 
 2 NATIVE LANGUAGE SUPPORT
-       If configured and installed with Native Language  Support,
-       Lynx  will display status and other messages in your local
-       language.   See  the  file   ABOUT_NLS   in   the   source
-       distribution,   or  at  your  local  GNU  site,  for  more
+       If  configured and installed with Native Language Support,
+       Lynx will display status and other messages in your  local
+       language.    See   the   file   ABOUT_NLS  in  the  source
+       distribution,  or  at  your  local  GNU  site,  for   more
        information about internationalization.
 
-       The following environment variables may be used  to  alter
+       The  following  environment variables may be used to alter
        default settings:
 
-       LANG                This  variable,  if set, will override
-
-                           the default message language.   It  is
+       LANG                This variable, if set,  will  override
+                           the  default  message language.  It is
                            an ISO 639 two-letter code identifying
-                           the language.  Language codes are  NOT
+                           the  language.  Language codes are NOT
                            the same as the country codes given in
                            ISO 3166.
 
-       LANGUAGE            This variable, if set,  will  override
+       LANGUAGE            This  variable,  if set, will override
                            the default message language.  This is
-                           a  GNU  extension  that   has   higher
-                           priority   for   setting  the  message
+                           a   GNU   extension  that  has  higher
+                           priority  for  setting   the   message
                            catalog than LANG or LC_ALL.
 
        LC_ALL              and
 
-       LC_MESSAGES         These variables, if set,  specify  the
-                           notion  of  native language formatting
+       LC_MESSAGES         These  variables,  if set, specify the
+                           notion of native  language  formatting
                            style.  They are POSIXly correct.
 
-       LINGUAS             This  variable,  if   set   prior   to
+       LINGUAS             This   variable,   if   set  prior  to
                            configuration,  limits  the  installed
                            languages to specific values.  It is a
-                           space-separated   list  of  two-letter
+                           space-separated  list  of   two-letter
                            codes.  Currently, it is hard-coded to
                            a wish list.
 
-       NLSPATH             This  variable, if set, is used as the
+       NLSPATH             This variable, if set, is used as  the
                            path prefix for message catalogs.
 
 2 NOTES
        This is the Lynx v2.8.3 Release
 
-       If you wish to contribute to the  further  development  of
-       Lynx,  subscribe  to  our  mailing  list.   Send  email to
-       <majordomo@sig.net> with "subscribe lynx-dev" as the  only
+       If  you  wish  to contribute to the further development of
+       Lynx, subscribe  to  our  mailing  list.   Send  email  to
+       <majordomo@sig.net>  with "subscribe lynx-dev" as the only
        line in the body of your message.
 
-       Send   bug   reports,   comments,  suggestions  to  <lynx-
+       Send  bug  reports,  comments,   suggestions   to   <lynx-
        dev@sig.net> after subscribing.
 
-       Unsubscribe by sending email to  <majordomo@sig.net>  with
-       "unsubscribe  lynx-dev"  as  the  only line in the body of
-       your message.  Do not send the unsubscribe message to  the
+       Unsubscribe  by  sending email to <majordomo@sig.net> with
+       "unsubscribe lynx-dev" as the only line  in  the  body  of
+       your  message.  Do not send the unsubscribe message to the
        lynx-dev list, itself.
 
 2 SEE ALSO
-       catgets(3),   curses(3),  environ(7),  execve(2),  ftp(1),
-       gettext(GNU),  localeconv(3),  ncurses(3),   setlocale(3),
+       catgets(3),  curses(3),  environ(7),  execve(2),   ftp(1),
+       gettext(GNU),   localeconv(3),  ncurses(3),  setlocale(3),
        slang(?), termcap(5), terminfo(5), wget(GNU)
 
-       Note  that  man page availability and section numbering is
-       somewhat platform dependent, and may vary from  the  above
+       Note that man page availability and section  numbering  is
+       somewhat  platform  dependent, and may vary from the above
        references.
 
-       A  section  shown as (GNU), is intended to denote that the
-       topic may be available via an info page, instead of a  man
-       page  (i.e.,  try  "info  subject",  rather than "man subject").
+       A section shown as (GNU), is intended to denote  that  the
+       topic  may be available via an info page, instead of a man
+       page (i.e., try "info  subject",  rather  than  "man  subject").
 
-       A section shown as (?) denotes that documentation  on  the
+       A  section  shown as (?) denotes that documentation on the
        topic exists, but is not part of an established documentation
-       retrieval system (see the distribution files  associated
-       with the topic, or contact your System Administrator
+       retrieval system (see the distribution files associated
+       with the topic, or contact your System  Administrator
        for further information).
 
 2 ACKNOWLEDGMENTS
        Lynx has incorporated code from a variety of sources along
        the way.  The earliest versions of Lynx included code from
-       Earl Fogel of Computing  Services  at  the  University  of
-       Saskatchewan,  who  implemented HYPERREZ in the Unix envi-
-       ronment.   HYPERREZ  was  developed  by  Niel  Larson   of
-       Think.com  and  served as the model for the early versions
-       of Lynx.  Those versions also incorporated libraries  from
-       the  Unix  Gopher  clients  developed at the University of
-       Minnesota, and the later versions of Lynx rely on the  WWW
-       client  library  code developed by Tim Berners-Lee and the
-       WWW community.  Also a special thanks to  Foteos  Macrides
-       who  ported  much of Lynx to VMS and did or organized most
-       of its development since the departures  of  Lou  Montulli
-       and  Garrett  Blythe  from the University of Kansas in the
-       summer of 1994 through the release of v2.7.2, and  to  ev-
-       eryone  on  the net who has contributed to Lynx's develop-
+       Earl  Fogel  of  Computing  Services  at the University of
+       Saskatchewan, who implemented HYPERREZ in the  Unix  envi-
+       ronment.    HYPERREZ  was  developed  by  Niel  Larson  of
+       Think.com and served as the model for the  early  versions
+       of  Lynx.  Those versions also incorporated libraries from
+       the Unix Gopher clients developed  at  the  University  of
+       Minnesota,  and the later versions of Lynx rely on the WWW
+       client library code developed by Tim Berners-Lee  and  the
+       WWW  community.   Also a special thanks to Foteos Macrides
+       who ported much of Lynx to VMS and did or  organized  most
+       of  its  development  since the departures of Lou Montulli
+       and Garrett Blythe from the University of  Kansas  in  the
+       summer  of  1994 through the release of v2.7.2, and to ev-
+       eryone on the net who has contributed to  Lynx's  develop-
        ment either directly (through patches, comments or bug re-
-       ports)  or indirectly (through inspiration and development
+       ports) or indirectly (through inspiration and  development
        of other systems).
 
 2 AUTHORS
-       Lou Montulli,  Garrett  Blythe,  Craig  Lavender,  Michael
+       Lou  Montulli,  Garrett  Blythe,  Craig  Lavender, Michael
        Grobe, Charles Rezac
        Academic Computing Services
        University of Kansas
diff --git a/lynx.man b/lynx.man
index 2b940938..af88a945 100644
--- a/lynx.man
+++ b/lynx.man
@@ -124,6 +124,15 @@ lynx.cfg.
 .B -child
 exit on left-arrow in startfile, and disable save to disk.
 .TP
+.B -cmd_log\fR=\fIFILENAME
+write keystroke commands and related information to the specified file.
+.TP
+.B -cmd_script\fR=\fIFILENAME
+read keystroke commands from the specified file.
+You can use the data written using the \fB\-cmd_log\fR option.
+Lynx will ignore other information which the command-logging may have
+written to the logfile.
+.TP
 .B -color
 forces color mode on, if available.  Default color control sequences
 which work for many terminal types are assumed if the terminal
@@ -783,6 +792,10 @@ It is created for use by an external program, as defined in a
 If the field does not exist for the document, the variable is set to a
 null string under \fBUNIX\fR, or "No URL" under \fBVMS\fR.
 .TP 20
+.B LYNX_TRACE
+If set, causes \fILynx\fR to write a trace file as if the \fB-trace\fR
+option were supplied. 
+.TP 20
 .B LYNX_VERSION
 This variable is always set by \fILynx\fR, and may be used by an external
 program to determine if it was invoked by \fILynx\fR.  See also the comments
diff --git a/src/GridText.c b/src/GridText.c
index a1b91980..3c148609 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1649,7 +1649,7 @@ PRIVATE void display_scrollbar ARGS1(
 	}
 #endif /* USE_COLOR_STYLE */
 	move(1, LYcols - 1);
-	addch(ACS_UARROW);
+	addch_raw(ACS_UARROW);
 #ifdef USE_COLOR_STYLE
 	LynxChangeStyle(s, STACK_OFF, 0);
 #endif /* USE_COLOR_STYLE */
@@ -1690,7 +1690,7 @@ PRIVATE void display_scrollbar ARGS1(
 	}
 #endif /* USE_COLOR_STYLE */
 	move(h + 2, LYcols - 1);
-	addch(ACS_DARROW);
+	addch_raw(ACS_DARROW);
 #ifdef USE_COLOR_STYLE
 	LynxChangeStyle(s, STACK_OFF, 0);
 #endif /* USE_COLOR_STYLE */
@@ -2285,9 +2285,11 @@ PRIVATE void display_page ARGS3(
 	/*
 	 *  For non-multibyte curses.
 	 *
-	 *  Is this repainting necessary??  Let's try without.
+	 *  Full repainting is necessary, otherwise only part of a multibyte 
+	 *  character sequence might be written because of curses output 
+	 *  optimizations. 
 	 */
-	/*clearok(curscr, TRUE);*/
+	clearok(curscr, TRUE); 
     }
     refresh();
 }
@@ -5098,6 +5100,191 @@ PUBLIC int HText_beginAnchor ARGS3(
     return(a->number);
 }
 
+/*
+    This returns whether the given anchor has blank content. Shamelessly copied
+    from HText_endAnchor. The values returned are meaningful only for "normal"
+    links - like ones produced by <a href=".">foo</a>, no inputs, etc. - VH
+*/
+#ifdef MARK_HIDDEN_LINKS
+PUBLIC BOOL HText_isAnchorBlank ARGS2(
+	HText *,	text,
+	int,		number)
+{
+    TextAnchor *a;
+
+    /*
+     *  The number argument is set to 0 in HTML.c and
+     *  LYCharUtils.c when we want to end the anchor
+     *  for the immediately preceding HText_beginAnchor()
+     *  call.  If it's greater than 0, we want to handle
+     *  a particular anchor.  This allows us to set links
+     *  for positions indicated by NAME or ID attributes,
+     *  without needing to close any anchor with an HREF
+     *  within which that link might be embedded. - FM
+     */
+    if (number <= 0 || number == text->last_anchor->number) {
+	a = text->last_anchor;
+    } else {
+	for (a = text->first_anchor; a; a = a->next) {
+	    if (a->number == number) {
+		break;
+	    }
+	}
+	if (a == NULL) {
+	    /*
+	     *  There's no anchor with that number,
+	     *  so we'll default to the last anchor,
+	     *  and cross our fingers. - FM
+	     */
+	    a = text->last_anchor;
+	}
+    }
+
+    CTRACE((tfp, "GridText:HText_isAnchorBlank: number:%d link_type:%d\n",
+			a->number, a->link_type));
+    if (a->link_type == INPUT_ANCHOR) {
+	/*
+	 *  Shouldn't happen, but put test here anyway to be safe. - LE
+	 */
+
+	CTRACE((tfp,
+	   "HText_isAnchorBlank: internal error: last anchor was input field!\n"));
+	return 0;
+    }
+    if (a->number) {
+	/*
+	 *  If it goes somewhere...
+	 */
+	int i, j, k;
+	HTLine *last = text->last_line;
+	HTLine *prev = text->last_line->prev;
+	HTLine *start = last;
+	int CurBlankExtent = 0;
+	int BlankExtent = 0;
+	
+	int extent_adjust = (text->chars + last->size) - a->start -
+		     (text->Lines - a->line_num);
+
+	/*
+	 *  Check if the anchor content has only
+	 *  white and special characters, starting
+	 *  with the content on the last line. - FM
+	 */
+	a->extent += extent_adjust;
+	if (a->extent > (int)last->size) {
+	    /*
+	     *  The anchor extends over more than one line,
+	     *  so set up to check the entire last line. - FM
+	     */
+	    i = last->size;
+	} else {
+	    /*
+	     *  The anchor is restricted to the last line,
+	     *  so check from the start of the anchor. - FM
+	     */
+	    i = a->extent;
+	}
+	k = j = (last->size - i);
+	while (j < (int)last->size) {
+	    if (!IsSpecialAttrChar(last->data[j]) &&
+		!isspace((unsigned char)last->data[j]) &&
+		last->data[j] != HT_NON_BREAK_SPACE &&
+		last->data[j] != HT_EN_SPACE)
+		break;
+	    i--;
+	    j++;
+	}
+	if (i == 0) {
+	    if (a->extent > (int)last->size) {
+		/*
+		 *  The anchor starts on a preceding line, and
+		 *  the last line has only white and special
+		 *  characters, so declare the entire extent
+		 *  of the last line as blank. - FM
+		 */
+		CurBlankExtent = BlankExtent = last->size;
+	    } else {
+		/*
+		 *  The anchor starts on the last line, and
+		 *  has only white or special characters, so
+		 *  declare the anchor's extent as blank. - FM
+		 */
+		CurBlankExtent = BlankExtent = a->extent;
+	    }
+	}
+	/*
+	 *  While the anchor starts on a line preceding
+	 *  the one we just checked, and the one we just
+	 *  checked has only white and special characters,
+	 *  check whether the anchor's content on the
+	 *  immediately preceding line also has only
+	 *  white and special characters. - FM
+	 */
+	while (i == 0 &&
+	       (a->extent > CurBlankExtent ||
+		(a->extent == CurBlankExtent &&
+		 k == 0 &&
+		 prev != text->last_line &&
+		 (prev->size == 0 ||
+		  prev->data[prev->size - 1] == ']')))) {
+	    start = prev;
+	    k = j = prev->size - a->extent + CurBlankExtent;
+	    if (j < 0) {
+		/*
+		 *  The anchor starts on a preceding line,
+		 *  so check all of this line. - FM
+		 */
+		j = 0;
+		i = prev->size;
+	    } else {
+		/*
+		 *  The anchor starts on this line. - FM
+		 */
+		i = a->extent - CurBlankExtent;
+	    }
+	    while (j < (int)prev->size) {
+		if (!IsSpecialAttrChar(prev->data[j]) &&
+		    !isspace((unsigned char)prev->data[j]) &&
+		    prev->data[j] != HT_NON_BREAK_SPACE &&
+		    prev->data[j] != HT_EN_SPACE)
+		    break;
+		i--;
+		j++;
+	    }
+	    if (i == 0) {
+		if (a->extent > (CurBlankExtent + (int)prev->size) ||
+		    (a->extent == CurBlankExtent + (int)prev->size &&
+		     k == 0 &&
+		     prev->prev != text->last_line &&
+		     (prev->prev->size == 0 ||
+		      prev->prev->data[prev->prev->size - 1] == ']'))) {
+		    /*
+		     *  This line has only white and special
+		     *  characters, so treat its entire extent
+		     *  as blank, and decrement the pointer for
+		     *  the line to be analyzed. - FM
+		     */
+		    CurBlankExtent += prev->size;
+		    BlankExtent = CurBlankExtent;
+		    prev = prev->prev;
+		} else {
+		    /*
+		     *  The anchor starts on this line, and it
+		     *  has only white or special characters, so
+		     *  declare the anchor's extent as blank. - FM
+		     */
+		    BlankExtent = a->extent;
+		    break;
+		}
+	    }
+	}
+	a->extent -= extent_adjust;
+	return i==0;
+    } else
+	return 0;
+}
+#endif /* MARK_HIDDEN_LINKS */
+
 
 PUBLIC void HText_endAnchor ARGS2(
 	HText *,	text,
diff --git a/src/HTAlert.c b/src/HTAlert.c
index 5e339488..b698481d 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -457,23 +457,23 @@ PUBLIC int HTConfirmDefault ARGS2(CONST char *, Msg, int, Dft)
 	FREE(msg);
 
 	while (result < 0) {
-	    int c = LYgetch_for(FOR_SINGLEKEY);
+	    int c = LYgetch_single();
 #ifdef VMS
 	    if (HadVMSInterrupt) {
 		HadVMSInterrupt = FALSE;
-		c = *msg_no;
+		c = TOUPPER(*msg_no);
 	    }
 #endif /* VMS */
 	    if (c == 7 || c == 3) { /* remember we had ^G or ^C */
 		conf_cancelled = YES;
 		result = NO;
-	    } else if (TOUPPER(c) == TOUPPER(*msg_yes)) {
+	    } else if (c == TOUPPER(*msg_yes)) {
 		result = YES;
-	    } else if (TOUPPER(c) == TOUPPER(*msg_no)) {
+	    } else if (c == TOUPPER(*msg_no)) {
 		result = NO;
-	    } else if (fallback_y && TOLOWER(c) == fallback_y) {
+	    } else if (fallback_y && c == fallback_y) {
 		result = YES;
-	    } else if (fallback_n && TOLOWER(c) == fallback_n) {
+	    } else if (fallback_n && c == fallback_n) {
 		result = NO;
 	    } else if (Dft != DFT_CONFIRM) {
 		result = Dft;
@@ -858,8 +858,7 @@ PUBLIC BOOL HTConfirmCookie ARGS4(
 	if(LYAcceptAllCookies) {
 	    ch = 'A';
 	} else {
-	    ch = LYgetch_for(FOR_SINGLEKEY);
-	    ch = TOUPPER(ch);
+	    ch = LYgetch_single();
 #if defined(LOCALE) && defined(HAVE_GETTEXT) && !defined(gettext)
 	    /*
 	     * Special-purpose workaround for gettext support (we should do
@@ -1033,8 +1032,8 @@ PUBLIC int HTConfirmPostRedirect ARGS2(
 	    case 1:
 		_statusline(show_POST_url);
 	}
-	c = LYgetch_for(FOR_SINGLEKEY);
-	switch (TOUPPER(c)) {
+	c = LYgetch_single();
+	switch (c) {
 	    case 'P':
 		/*
 		**  Proceed with 301 or 307 redirect of POST
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index 64172a7f..6ea0dea1 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -749,8 +749,8 @@ PUBLIC HTStream* HTSaveToFile ARGS3(
 	    _statusline(CANNOT_DISPLAY_FILE_D_OR_C);
 	}
 
-	while(TOUPPER(c)!='C' && TOUPPER(c)!='D' && c!=7) {
-	    c=LYgetch();
+	while(c != 'D') {
+	    c = LYgetch_single();
 #ifdef VMS
 	    /*
 	     *	'C'ancel on Control-C or Control-Y and
@@ -766,7 +766,7 @@ PUBLIC HTStream* HTSaveToFile ARGS3(
 	/*
 	 *  Cancel on 'C', 'c' or Control-G or Control-C.
 	 */
-	if (TOUPPER(c)=='C' || c==7 || c==3) {
+	if (c == 'C' || c == 7) {
 	    _statusline(CANCELLING_FILE);
 	    LYCancelDownload = TRUE;
 	    FREE(ret_obj);
diff --git a/src/HTML.c b/src/HTML.c
index e27ffd33..c0fcf621 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -6730,7 +6730,12 @@ PRIVATE int HTML_end_element ARGS3(
 	 *  Set to know that we are no longer in an anchor.
 	 */
 	me->inA = FALSE;
-
+#ifdef MARK_HIDDEN_LINKS
+	if (hidden_link_marker && *hidden_link_marker && 
+		HText_isAnchorBlank(me->text, me->CurrentANum) ) {	    
+	    HText_appendText(me->text,hidden_link_marker);	
+	}
+#endif	
 	UPDATE_STYLE;
 	if (me->inBoldA == TRUE && me->inBoldH == FALSE)
 	    HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
diff --git a/src/LYBookmark.c b/src/LYBookmark.c
index dfe82894..eb26456b 100644
--- a/src/LYBookmark.c
+++ b/src/LYBookmark.c
@@ -265,8 +265,8 @@ PUBLIC void save_bookmark_link ARGS2(
 	       (*BookmarkPage == '.' ?
 		    (BookmarkPage+1) : BookmarkPage)) != NULL) {
 	LYMBM_statusline(MULTIBOOKMARKS_SELF);
-	c = LYgetch();
-	if (TOUPPER(c) != 'L') {
+	c = LYgetch_single();
+	if (c != 'L') {
 	    FREE(bookmark_URL);
 	    return;
 	}
@@ -354,14 +354,14 @@ PUBLIC void save_bookmark_link ARGS2(
      *  Once and forever...
      */
     if (first_time) {
-	fprintf(fp,"<head>\n");
+	fprintf(fp, "<head>\n");
 #if defined(SH_EX) && !defined(_WINDOWS)	/* 1997/12/11 (Thu) 19:13:40 */
 	if (HTCJK != JAPANESE)
 	    LYAddMETAcharsetToFD(fp, -1);
 	else
 	    fprintf(fp, "<META %s %s>\n",
 		    "http-equiv=\"content-type\"",
-		    "conetnt=\"text/html;charset=iso-2022-jp\""); 
+		    "content=\"text/html;charset=iso-2022-jp\""); 
 #else
 	LYAddMETAcharsetToFD(fp, -1);
 #endif	/* !_WINDOWS */
diff --git a/src/LYCgi.c b/src/LYCgi.c
index 7e747377..97e4a93e 100644
--- a/src/LYCgi.c
+++ b/src/LYCgi.c
@@ -650,7 +650,8 @@ PRIVATE int LYLoadCGI ARGS4(
 			   format_out,
 			   sink, anAnchor);
 
-    HTSprintf0(&buf, "<head>\n<title>%s</title>\n</head>\n<body>\n", gettext("Good Advice"));
+    HTSprintf0(&buf, "<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n",
+	       gettext("Good Advice"));
     (*target->isa->put_block)(target, buf, strlen(buf));
 
     HTSprintf0(&buf, "<h1>%s</h1>\n", gettext("Good Advice"));
@@ -670,7 +671,7 @@ PRIVATE int LYLoadCGI ARGS4(
 	       gettext("It provides state of the art CGI script support.\n"));
     (*target->isa->put_block)(target, buf, strlen(buf));
 
-    HTSprintf0(&buf,"</body>\n");
+    HTSprintf0(&buf,"</body>\n</html>\n");
     (*target->isa->put_block)(target, buf, strlen(buf));
 
     (*target->isa->_free)(target);
diff --git a/src/LYCookie.c b/src/LYCookie.c
index b52f9907..edd492ed 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -2417,14 +2417,14 @@ PRIVATE int LYHandleCookies ARGS4 (
 		    }
 		    HTNoDataOK = 1;
 		    while (1) {
-			ch = LYgetch_for(FOR_SINGLEKEY);
+			ch = LYgetch_single();
 #ifdef VMS
 			if (HadVMSInterrupt) {
 			    HadVMSInterrupt = FALSE;
 			    ch = 'C';
 			}
 #endif /* VMS */
-			switch(TOUPPER(ch)) {
+			switch(ch) {
 			    case 'A':
 				/*
 				 *  Set to accept all cookies
@@ -2571,7 +2571,7 @@ Delete_all_cookies_in_domain:
 #define PUTS(buf)    (*target->isa->put_block)(target, buf, strlen(buf))
 
 
-    HTSprintf0(&buf, "<HEAD>\n<TITLE>%s</title>\n</HEAD>\n<BODY>\n",
+    HTSprintf0(&buf, "<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n",
 		 COOKIE_JAR_TITLE);
     PUTS(buf);
     HTSprintf0(&buf, "<h1>%s (%s)%s<a href=\"%s%s\">%s</a></h1>\n",
@@ -2580,12 +2580,12 @@ Delete_all_cookies_in_domain:
 	helpfilepath, COOKIE_JAR_HELP, COOKIE_JAR_TITLE);
     PUTS(buf);
 
-    HTSprintf0(&buf, "<NOTE>%s\n", ACTIVATE_TO_GOBBLE);
+    HTSprintf0(&buf, "<note>%s\n", ACTIVATE_TO_GOBBLE);
     PUTS(buf);
-    HTSprintf0(&buf, "%s</NOTE>\n", OR_CHANGE_ALLOW);
+    HTSprintf0(&buf, "%s</note>\n", OR_CHANGE_ALLOW);
     PUTS(buf);
 
-    HTSprintf0(&buf, "<DL COMPACT>\n");
+    HTSprintf0(&buf, "<dl compact>\n");
     PUTS(buf);
     for (dl = domain_list; dl != NULL; dl = dl->next) {
 	de = dl->object;
@@ -2598,7 +2598,7 @@ Delete_all_cookies_in_domain:
 	/*
 	 *  Show the domain link and 'allow' setting. - FM
 	 */
-	HTSprintf0(&buf, "<DT>%s<DD><A HREF=\"LYNXCOOKIE://%s/\">Domain=%s</A>\n",
+	HTSprintf0(&buf, "<dt>%s<dd><a href=\"LYNXCOOKIE://%s/\">Domain=%s</a>\n",
 		      de->domain, de->domain, de->domain);
 	PUTS(buf);
 	switch (de->bv) {
@@ -2641,7 +2641,7 @@ Delete_all_cookies_in_domain:
 	    } else {
 		StrAllocCopy(value, NO_VALUE);
 	    }
-	    HTSprintf0(&buf, "<DD><A HREF=\"LYNXCOOKIE://%s/%s\">%s=%s</A>\n",
+	    HTSprintf0(&buf, "<dd><a href=\"LYNXCOOKIE://%s/%s\">%s=%s</a>\n",
 			 de->domain, co->lynxID, name, value);
 	    FREE(name);
 	    FREE(value);
@@ -2661,7 +2661,7 @@ Delete_all_cookies_in_domain:
 	    } else {
 		StrAllocCopy(path, "/");
 	    }
-	    HTSprintf0(&buf, "<DD>Path=%s\n<DD>Port: %d Secure: %s Discard: %s\n",
+	    HTSprintf0(&buf, "<dd>Path=%s\n<dd>Port: %d Secure: %s Discard: %s\n",
 			 path, co->port,
 			 ((co->flags & COOKIE_FLAG_SECURE) ? "YES" : "NO"),
 			 ((co->flags & COOKIE_FLAG_DISCARD) ? "YES" : "NO"));
@@ -2672,7 +2672,7 @@ Delete_all_cookies_in_domain:
 	     *	Show the list of acceptable ports, if present. - FM
 	     */
 	    if (co->PortList) {
-		HTSprintf0(&buf, "<DD>PortList=\"%s\"\n", co->PortList);
+		HTSprintf0(&buf, "<dD>PortList=\"%s\"\n", co->PortList);
 		PUTS(buf);
 	    }
 
@@ -2685,7 +2685,7 @@ Delete_all_cookies_in_domain:
 		StrAllocCopy(Title, co->commentURL);
 		LYEntify(&Title, TRUE);
 		HTSprintf0(&buf,
-			"<DD>CommentURL: <A href=\"%s\">%s</A>\n",
+			"<dd>CommentURL: <a href=\"%s\">%s</a>\n",
 			Address,
 			Title);
 		FREE(Address);
@@ -2699,7 +2699,7 @@ Delete_all_cookies_in_domain:
 	    if (co->comment) {
 		StrAllocCopy(comment, co->comment);
 		LYEntify(&comment, TRUE);
-		HTSprintf0(&buf, "<DD>Comment: %s\n", comment);
+		HTSprintf0(&buf, "<dd>Comment: %s\n", comment);
 		FREE(comment);
 		PUTS(buf);
 	    }
@@ -2707,7 +2707,7 @@ Delete_all_cookies_in_domain:
 	    /*
 	     *	Show the Maximum Gobble Date. - FM
 	     */
-	    HTSprintf0(&buf, "<DD><EM>%s</EM> %s%s",
+	    HTSprintf0(&buf, "<dd><em>%s</em> %s%s",
 	    		 gettext("Maximum Gobble Date:"),
 			 ((co->flags & COOKIE_FLAG_EXPIRES_SET)
 					    ?
@@ -2717,10 +2717,10 @@ Delete_all_cookies_in_domain:
 					 "" : "\n"));
 	    PUTS(buf);
 	}
-	HTSprintf0(&buf, "</DT>\n");
+	HTSprintf0(&buf, "</dt>\n");
 	PUTS(buf);
     }
-    HTSprintf0(&buf, "</DL>\n</BODY>\n");
+    HTSprintf0(&buf, "</dl>\n</body>\n</html>\n");
     PUTS(buf);
 
     /*
diff --git a/src/LYCurses.c b/src/LYCurses.c
index 99799f74..d25d10c3 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -56,8 +56,7 @@ PRIVATE int dumbterm PARAMS((char *terminal));
 BOOLEAN LYCursesON = FALSE;
 
 #if USE_COLOR_TABLE || defined(USE_SLANG)
-PRIVATE int Current_Attr;
-PRIVATE int Masked_Attr;
+PUBLIC int Current_Attr, Masked_Attr;
 #endif
 
 #define OMIT_SCN_KEEPING 0 /* whether to omit keeping of Style_className
diff --git a/src/LYCurses.h b/src/LYCurses.h
index 98ad35cb..21934a56 100644
--- a/src/LYCurses.h
+++ b/src/LYCurses.h
@@ -50,6 +50,22 @@
 #define WINDOW void
 #define waddstr(w,s) addstr(s)
 
+#ifndef ACS_UARROW  
+#define ACS_UARROW  SLSMG_UARROW_CHAR
+#endif
+
+#ifndef ACS_DARROW
+#define ACS_DARROW  SLSMG_DARROW_CHAR
+#endif
+
+#ifndef ACS_CKBOARD
+#define ACS_CKBOARD SLSMG_CKBRD_CHAR
+#endif
+
+#ifndef ACS_BLOCK
+#define ACS_BLOCK   SLSMG_BLOCK_CHAR
+#endif
+
 #else /* Using curses: */
 
 #ifdef VMS
@@ -218,6 +234,11 @@ extern void LYbox PARAMS((WINDOW *win, BOOLEAN formfield));
 extern int LYlines;  /* replaces LINES */
 extern int LYcols;   /* replaces COLS */
 
+#if defined(USE_COLOR_TABLE) || defined(USE_SLANG)
+extern int Current_Attr;
+extern int Masked_Attr;
+#endif
+
 extern void start_curses NOPARAMS;
 extern void stop_curses NOPARAMS;
 extern BOOLEAN setup PARAMS((char *terminal));
@@ -316,9 +337,14 @@ extern void LY_SLerase NOPARAMS;
 #define scrollok(a,b) SLsmg_Newline_Moves = ((b) ? 1 : -1)
 #endif
 
-#define addch SLsmg_write_char
+#define addch(ch)     SLsmg_write_char(ch)
+#define addch_raw(ch) do {                                \
+                        SLsmg_Char_Type buf;              \
+                        buf = (ch) | (Current_Attr << 4); \
+                        SLsmg_write_raw (&buf, 1);        \
+                      } while (0)
 #define echo()
-#define printw SLsmg_printf
+#define printw        SLsmg_printf
 
 extern int curscr;
 extern BOOLEAN FullRefresh;
@@ -453,6 +479,9 @@ FANCY_CURSES.  Check your config.log to see why the FANCY_CURSES test failed.
 #define wstop_reverse(a)	wstandend(a)
 
 #endif /* FANCY_CURSES */
+
+#define addch_raw(ch)           addch(ch)
+
 #endif /* USE_SLANG */
 
 #ifdef USE_SLANG
diff --git a/src/LYExtern.c b/src/LYExtern.c
index 826c30f0..338cc42b 100644
--- a/src/LYExtern.c
+++ b/src/LYExtern.c
@@ -170,7 +170,9 @@ PRIVATE void format ARGS3(
     HTEndParam(result, fmt, 1);
 }
 
-void run_external ARGS1(char *, c)
+BOOL run_external ARGS2(
+    char *, 	c,
+    BOOL,	only_overriders)
 {
 #ifdef WIN_EX
     HANDLE handle;
@@ -182,9 +184,10 @@ void run_external ARGS1(char *, c)
 #endif
     char *cmdbuf = NULL;
     lynx_html_item_type *externals2 = 0;
+    int found = 0;
 
     if (externals == NULL)
-	return;
+	return 0;
 
 #ifdef WIN_EX			/* 1998/01/26 (Mon) 09:16:13 */
     if (c == NULL) {
@@ -201,12 +204,14 @@ void run_external ARGS1(char *, c)
 	CTRACE((tfp, "EXTERNAL: '%s' <==> '%s'\n", externals2->name, c));
 #endif
 	if (externals2->command != 0
-	  && !strncasecomp(externals2->name, c, strlen(externals2->name)))
+	  && !strncasecomp(externals2->name, c, strlen(externals2->name))
+	  && (only_overriders ? externals2->override_primary_action : 1))
 	{
-	    if (no_externals && !externals2->always_enabled) {
+	    if (no_externals && !externals2->always_enabled && !only_overriders) {
 		HTUserMsg(EXTERNALS_DISABLED);
 		break;
 	    }
+	    ++found;
 	    /*  Too dangerous to leave any URL that may come along unquoted.
 	     *  They often contain '&', ';', and '?' chars, and who knows
 	     *  what else may occur.
@@ -371,6 +376,6 @@ void run_external ARGS1(char *, c)
     } /* end-for */
 
     FREE(cmdbuf);
-    return;
+    return found;
 }
 #endif	/* USE_EXTERNALS */
diff --git a/src/LYExtern.h b/src/LYExtern.h
index c172800a..909c41cd 100644
--- a/src/LYExtern.h
+++ b/src/LYExtern.h
@@ -5,7 +5,8 @@
 #include <LYStructs.h>
 #endif /* LYSTRUCTS_H */
 
-void run_external PARAMS((char * c));
+/*returns TRUE if something matching was executed*/
+BOOL run_external PARAMS((char * c, BOOL only_overriders));
 char *string_short PARAMS((char * str, int cut_pos));
 
 #ifdef WIN_EX
diff --git a/src/LYForms.c b/src/LYForms.c
index 17c65d5d..11eb5125 100644
--- a/src/LYForms.c
+++ b/src/LYForms.c
@@ -443,7 +443,7 @@ again:
 	repeat = -1;
 	get_mouse_link();	/* Reset mouse_link. */
 
-	ch = LYgetch_for(FOR_INPUT);
+	ch = LYgetch_input();
 #ifdef SUPPORT_MULTIBYTE_EDIT
 #ifdef WIN_EX
 	if (!refresh_mb && (EditBinding(ch) != LYE_CHAR))
@@ -558,7 +558,7 @@ again:
 	}
 	if (action == LYE_LKCMD) {
 	    _statusline(ENTER_LYNX_COMMAND);
-	    ch = LYgetch_for(FOR_PANEL);
+	    ch = LYgetch();
 #ifdef VMS
 	    if (HadVMSInterrupt) {
 		HadVMSInterrupt = FALSE;
@@ -1166,8 +1166,8 @@ redraw:
 	wrefresh(form_window);
 #endif /* USE_SLANG  */
 
-	c = LYgetch_for(FOR_CHOICE);
-	if (c == 3 || c == 7) {	/* Control-C or Control-G */
+	c = LYgetch_choice();
+	if (c == 7) {		/* Control-C or Control-G */
 	    cmd = LYK_QUIT;
 #ifndef USE_SLANG
 	} else if (c == MOUSE_KEY) {
@@ -1851,7 +1851,6 @@ restore_popup_statusline:
 		cmd = LYK_ACTIVATE; /* to exit */
 		break;
 	}
-
     }
 #ifndef USE_SLANG
     delwin(form_window);
diff --git a/src/LYGetFile.c b/src/LYGetFile.c
index a1289c36..9807e870 100644
--- a/src/LYGetFile.c
+++ b/src/LYGetFile.c
@@ -505,7 +505,7 @@ Try_Redirected_URL:
 #endif /* !VMS */
 			    printf("\n%s", RETURN_TO_LYNX);
 			    fflush(stdout);
-			    LYgetch();
+			    (void) LYgetch();
 #ifdef VMS
 			    HadVMSInterrupt = FALSE;
 #endif /* VMS */
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index 44d4fda2..faa41a86 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -196,6 +196,8 @@ extern char *helpfilepath;
 extern char *jumpprompt;	/* The default jump statusline prompt */
 extern char *language;
 extern char *lynx_cfg_file;	/* location of active lynx.cfg file */
+extern char *lynx_cmd_logfile;	/* file to write keystroke commands, if any */
+extern char *lynx_cmd_script;	/* file to read keystroke commands, if any */
 extern char *lynx_save_space;
 extern char *lynx_temp_space;
 extern char *lynxjumpfile;
@@ -509,4 +511,8 @@ extern int LYsb_begin;
 extern int LYsb_end;
 #endif
 
+#ifdef MARK_HIDDEN_LINKS
+extern char* hidden_link_marker;
+#endif
+
 #endif /* LYGLOBALDEFS_H */
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index 75914bd5..11c6156e 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -120,8 +120,13 @@ LYK_8,               LYK_9,             0,          LYK_TRACE_LOG,
 LYK_UP_LINK,         LYK_INFO,     LYK_DOWN_LINK,   LYK_HELP,
 /* < */              /* = */         /* > */        /* ? */
 
+#ifndef SUPPORT_CHDIR
 LYK_RAW_TOGGLE,      LYK_ADDRLIST, LYK_PREV_PAGE,   LYK_COMMENT,
 /* @ */              /* A */         /* B */        /* C */
+#else
+LYK_RAW_TOGGLE,      LYK_ADDRLIST, LYK_PREV_PAGE,   LYK_CHDIR,
+/* @ */              /* A */         /* B */        /* C */
+#endif
 
 LYK_DOWNLOAD,        LYK_ELGOTO,  LYK_DIRED_MENU,   LYK_ECGOTO,
 /* D */              /* E */         /* F */        /* G */
@@ -411,9 +416,13 @@ LYKeymap_t key_override[KEYMAP_SIZE] = {
 
    0,                  0,              0,             0,
 /* < */             /* = */         /* > */        /* ? */
-
+#ifndef SUPPORT_CHDIR
    0,                  0,              0,         LYK_CREATE,
 /* @ */             /* A */         /* B */        /* C */
+#else
+   0,                  0,              0,         LYK_CHDIR,
+/* @ */             /* A */         /* B */        /* C */
+#endif
 
    0,                  0,        LYK_DIRED_MENU,       0,
 /* D */             /* E */         /* F */        /* G */
@@ -734,32 +743,42 @@ PRIVATE struct rmap revmap[] = {
 { "CHANGE_KCODE",	"Change Kanji code" },
 #endif
 #endif /* VMS */
+#ifdef SUPPORT_CHDIR
+ { "CHDIR",		"change current directory" },
+#endif
 { NULL,			"" }
 };
 
-PRIVATE CONST char *funckey[] = {
-  "Up Arrow",
-  "Down Arrow",
-  "Right Arrow",
-  "Left Arrow",
-  "Page Down",
-  "Page Up",
-  "Home",
-  "End",
-  "F1",
-  "Do key",
-  "Find key",
-  "Select key",
-  "Insert key",
-  "Remove key",
-  "(DO_NOTHING)",		/* should normally not appear in list */
-  "Back Tab",
-  0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0,
-  "mouse pseudo key",		/* normally not mapped to keymap[] action */
+PRIVATE CONST struct {
+    int key;
+    CONST char *name;
+} named_keys[] = {
+    { '\t',		"<tab>" },
+    { '\r',		"<return>" },
+    { CH_ESC,		"ESC" },
+    { ' ',		"<space>" },
+    { '<',		"<" },
+    { '>',		">" },
+    { 0177,		"<delete>" },
+    { UPARROW,		"Up Arrow" },
+    { DNARROW,		"Down Arrow" },
+    { RTARROW,		"Right Arrow" },
+    { LTARROW,		"Left Arrow" },
+    { PGDOWN,		"Page Down" },
+    { PGUP,		"Page Up" },
+    { HOME,		"Home" },
+    { END_KEY,		"End" },
+    { F1,		"F1" },
+    { DO_KEY,		"Do key" },
+    { FIND_KEY,		"Find key" },
+    { SELECT_KEY,	"Select key" },
+    { INSERT_KEY,	"Insert key" },
+    { REMOVE_KEY,	"Remove key" },
+    { DO_NOTHING,	"(DO_NOTHING)" },
+    { BACKTAB_KEY,	"Back Tab" },
+    { MOUSE_KEY,	"mouse pseudo key" },
 };
 
-
 struct emap {
 	CONST char *name;
 	CONST int   code;
@@ -818,74 +837,115 @@ PRIVATE struct emap ekmap[] = {
 #endif
 };
 
-PRIVATE char *pretty ARGS1 (int, c)
+PUBLIC char *LYKeycodeToString ARGS2 (
+	int,		c,
+	BOOLEAN,	upper8)
 {
-	static char buf[30];
+    static char buf[30];
+    unsigned n;
+    BOOLEAN named = FALSE;
+
+    for (n = 0; n < TABLESIZE(named_keys); n++) {
+	if (named_keys[n].key == c) {
+	    named = TRUE;
+	    strcpy(buf, named_keys[n].name);
+	    break;
+	}
+    }
 
-	if (c == '\t')
-		sprintf(buf, "<tab>");
-	else if (c == '\r')
-		sprintf(buf, "<return>");
-	else if (c == CH_ESC)
-		sprintf(buf, "ESC");
-	else if (c == ' ')
-		sprintf(buf, "<space>");
-	else if (c == '<')
-		sprintf(buf, "<");
-	else if (c == '>')
-		sprintf(buf, ">");
-	else if (c == 0177)
-		sprintf(buf, "<delete>");
-	else if (c > ' ' && c < 0177)
-		sprintf(buf, "%c", c);
-	else if (c > ' ' && c <= 0377 &&
-		 c <= LYlowest_eightbit[current_char_set])
-		sprintf(buf, "%c", c);
+    if (!named) {
+	if (c > ' '
+	 && c < 0177)
+	    sprintf(buf, "%c", c);
+	else if (upper8
+	 && c > ' '
+	 && c <= 0377
+	 && c <= LYlowest_eightbit[current_char_set])
+	    sprintf(buf, "%c", c);
 	else if (c < ' ')
-		sprintf(buf, "^%c", c|0100);
-	else if (c >= 0400 && (c - 0400) < (int) TABLESIZE(funckey)
-		 && funckey[c-0400])
-		sprintf(buf, "%.*s", (int)(sizeof(buf) - 1), funckey[c-0400]);
+	    sprintf(buf, "^%c", c|0100);
 	else if (c >= 0400)
-		sprintf(buf, "key-%#x", c);
+	    sprintf(buf, "key-%#x", c);
 	else
-		return 0;
+	    return 0;
+    }
+    return buf;
+}
 
-	return buf;
+PUBLIC int LYStringToKeycode ARGS1 (
+	char *,		src)
+{
+    unsigned n;
+    int key = -1;
+    int len = strlen(src);
+
+    if (len == 1)
+	key = *src;
+    else if (len == 2 && *src == '^')
+	key = src[1] & 0x1f;
+    else if (len > 6 && !strncasecomp(src, "key-", 4)) {
+	char *dst = 0;
+	key = strtol(src + 4, &dst, 0);
+	if (dst == 0 || *dst != 0)
+	    key = -1;
+    }
+    if (key < 0) {
+	for (n = 0; n < TABLESIZE(named_keys); n++) {
+	    if (!strcasecomp(named_keys[n].name, src)) {
+		key = named_keys[n].key;
+		break;
+	    }
+	}
+    }
+    return key;
 }
 
+#define PRETTY_LEN 11
+
 PRIVATE char *pretty_html ARGS1 (int, c)
 {
-	static char buf[30];
-
-	if (c == '\t')
-		sprintf(buf, "&lt;tab&gt;      ");
-	else if (c == '\r')
-		sprintf(buf, "&lt;return&gt;   ");
-	else if (c == ' ')
-		sprintf(buf, "&lt;space&gt;    ");
-	else if (c == '<')
-		sprintf(buf, "&lt;          ");
-	else if (c == '>')
-		sprintf(buf, "&gt;          ");
-	else if (c == 0177)
-		sprintf(buf, "&lt;delete&gt;   ");
-	else if (c > ' ' && c < 0177)
-		sprintf(buf, "%c", c);
-	else if (c > ' ' && c <= 0377 &&
-		 c <= LYlowest_eightbit[current_char_set])
-		sprintf(buf, "%c", c);
-	else if (c < ' ')
-		sprintf(buf, "^%c", c|0100);
-	else if (c >= 0400 && (c - 0400) < (int) TABLESIZE(funckey)
-		 && funckey[c-0400])
-		sprintf(buf, "%.*s", (int)(sizeof(buf) - 1), funckey[c-0400]);
-	else if (c >= 0400)
-		sprintf(buf, "%#x", c);
-	else
-		return 0;
+    char *src = LYKeycodeToString(c, TRUE);
+
+    if (src != 0) {
+	static CONST struct {
+	    int	code;
+	    CONST char *name;
+	} table[] = {
+	    { '<',	"&lt;" },
+	    { '>',	"&gt;" },
+	    { '"',	"&quot;" },
+	    { '&',	"&amp;" }
+	};
 
+	static char buf[30];
+	char *dst = buf;
+	int adj = 0;
+	unsigned n;
+	BOOLEAN found;
+
+	while ((c = *src++) != 0) {
+	    found = FALSE;
+	    for (n = 0; n < TABLESIZE(table); n++) {
+		if (c == table[n].code) {
+		    found = TRUE;
+		    strcpy(dst, table[n].name);
+		    adj += strlen(dst) - 1;
+		    dst += strlen(dst);
+		    break;
+		}
+	    }
+	    if (!found) {
+		*dst++ = c;
+	    }
+	}
+	adj -= (dst - buf) - PRETTY_LEN;
+	while (adj-- > 0)
+	    *dst++ = ' ';
+	*dst = 0;
 	return buf;
+    }
+
+    return 0;
 }
 
 PRIVATE char * format_binding ARGS2(
@@ -901,9 +961,10 @@ PRIVATE char * format_binding ARGS2(
      && revmap[the_key].name != 0
      && revmap[the_key].doc != 0
      && (formatted = pretty_html(i-1)) != 0) {
-	HTSprintf0(&buf, "%-11s %-13s %s\n", formatted,
-		revmap[the_key].name,
-		revmap[the_key].doc);
+	HTSprintf0(&buf, "%-*s %-13s %s\n",
+		   PRETTY_LEN, formatted,
+		   revmap[the_key].name,
+		   revmap[the_key].doc);
 	return buf;
     }
     return 0;
@@ -1059,18 +1120,9 @@ PRIVATE int LYLoadKeymap ARGS4 (
 
 #define PUTS(buf)    (*target->isa->put_block)(target, buf, strlen(buf))
 
-    HTSprintf0(&buf, "<head>\n<title>%s</title>\n</head>\n<body>\n",
+    HTSprintf0(&buf, "<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n",
 		     CURRENT_KEYMAP_TITLE);
     PUTS(buf);
-#if 0	/* There isn't really a help page *on* the current keymap.
-	   And we don't need a title and version info here, better
-	   make the page as compact as possible. - kw */
-    HTSprintf0(&buf, "<h1>%s (%s)%s<a href=\"%s%s\">%s</a></h1>\n",
-	LYNX_NAME, LYNX_VERSION,
-	HELP_ON_SEGMENT,
-	helpfilepath, CURRENT_KEYMAP_HELP, CURRENT_KEYMAP_TITLE);
-    PUTS(buf);
-#endif
     HTSprintf0(&buf, "<pre>\n");
     PUTS(buf);
 
@@ -1090,7 +1142,7 @@ PRIVATE int LYLoadKeymap ARGS4 (
 	}
     }
 
-    HTSprintf0(&buf,"</pre>\n</body>\n");
+    HTSprintf0(&buf,"</pre>\n</body>\n</html>\n");
     PUTS(buf);
 
     (*target->isa->_free)(target);
@@ -1301,7 +1353,7 @@ PUBLIC char *key_for_func ARGS1 (
     char *formatted;
 
     if ((i = LYReverseKeymap(func)) >= 0) {
-	formatted = pretty(i);
+	formatted = LYKeycodeToString(i, TRUE);
 	StrAllocCopy(buf, formatted != 0 ? formatted : "?");
     } else if (buf == 0) {
 	StrAllocCopy(buf, "");
@@ -1325,7 +1377,7 @@ PUBLIC char *fmt_keys ARGS2(
     char *fmt_second;
     if (lkc_first < 0)
 	return NULL;
-    fmt_first = pretty(lkc_first);
+    fmt_first = LYKeycodeToString(lkc_first, TRUE);
     if (fmt_first && strlen(fmt_first) == 1 && *fmt_first != '\'') {
 	quotes = TRUE;
     }
@@ -1340,7 +1392,7 @@ PUBLIC char *fmt_keys ARGS2(
 	StrAllocCopy(buf, fmt_first);
     }
     if (lkc_second >= 0) {
-	fmt_second = pretty(lkc_second);
+	fmt_second = LYKeycodeToString(lkc_second, TRUE);
 	if (!fmt_second) {
 	    FREE(buf);
 	    return NULL;
diff --git a/src/LYKeymap.h b/src/LYKeymap.h
index f58b54a9..c4f47672 100644
--- a/src/LYKeymap.h
+++ b/src/LYKeymap.h
@@ -6,14 +6,16 @@
 #endif
 
 extern BOOLEAN LYisNonAlnumKeyname PARAMS((int ch, int KeyName));
+extern char *LYKeycodeToString PARAMS((int c, BOOLEAN upper8));
+extern char *fmt_keys PARAMS((int lkc_first, int lkc_second));
 extern char *key_for_func PARAMS((int func));
 extern char *key_for_func_ext PARAMS((int lac, int context_code));
-extern char *fmt_keys PARAMS((int lkc_first, int lkc_second));
 extern int LYReverseKeymap PARAMS((int KeyName));
-extern int lookup_keymap PARAMS((int code));
+extern int LYStringToKeycode PARAMS((char *src));
 extern int lacname_to_lac PARAMS((CONST char *func));
 extern int lecname_to_lec PARAMS((CONST char *func));
 extern int lkcstring_to_lkc PARAMS((CONST char *src));
+extern int lookup_keymap PARAMS((int code));
 extern int remap PARAMS((char *key, char *func, BOOLEAN for_dired));
 extern void print_keymap PARAMS((char **newfile));
 extern void reset_emacs_keys NOPARAMS;
@@ -236,6 +238,9 @@ typedef enum {
 #ifdef KANJI_CODE_OVERRIDE
   , LYK_CHG_KCODE
 #endif
+#ifdef SUPPORT_CHDIR
+  , LYK_CHDIR
+#endif
 } LYKeymapCode;
 
 
diff --git a/src/LYLocal.c b/src/LYLocal.c
index b80c9a45..deb7f0be 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -68,6 +68,10 @@
 # endif
 #endif
 
+#ifdef SUPPORT_CHDIR
+#include <LYMainLoop.h>
+#endif
+
 #include <LYLeaks.h>
 
 #undef USE_COMPRESS
@@ -140,6 +144,10 @@ struct dired_menu {
  *  configuration file via DIRED_MENU lines, then these default entries
  *  are discarded entirely.
  */
+#ifdef SUPPORT_CHDIR
+{ 0,		      "", "Change directory",
+		      "", "LYNXDIRED://CHDIR",			NULL },
+#endif
 { 0,		      "", "New File",
 "(in current directory)", "LYNXDIRED://NEW_FILE%d",		NULL },
 
@@ -767,7 +775,7 @@ PUBLIC BOOLEAN local_modify ARGS2(
 	document *,	doc,
 	char **,	newpath)
 {
-    int c, ans;
+    int ans;
     char *cp;
     char testpath[DIRED_MAXBUF]; /* a bit ridiculous */
     int count;
@@ -800,8 +808,7 @@ PUBLIC BOOLEAN local_modify ARGS2(
 #else
     _statusline(gettext("Modify name or location (n or l): "));
 #endif /* OK_PERMIT */
-    c = LYgetch();
-    ans = TOUPPER(c);
+    ans = LYgetch_single();
 
     if (strchr("NLP", ans) != NULL) {
 	cp = HTfullURL_toFile(links[doc->link].lname);
@@ -935,7 +942,7 @@ PRIVATE BOOLEAN create_directory ARGS1(
 PUBLIC BOOLEAN local_create ARGS1(
 	document *,	doc)
 {
-    int c, ans;
+    int ans;
     char *cp;
     char testpath[DIRED_MAXBUF];
 
@@ -948,8 +955,7 @@ PUBLIC BOOLEAN local_create ARGS1(
     FREE(cp);
 
     _statusline(gettext("Create file or directory (f or d): "));
-    c = LYgetch();
-    ans = TOUPPER(c);
+    ans = LYgetch_single();
 
     if (ans == 'F') {
 	return(create_file(testpath));
@@ -1485,6 +1491,7 @@ PUBLIC int local_dired ARGS1(
     char *tmpbuf = NULL;
     char *buffer = NULL;
     char *dirname = NULL;
+    BOOL do_pop_doc = TRUE;
 
     line_url = doc->address;
     CTRACE((tfp, "local_dired: called for <%s>.\n",
@@ -1495,8 +1502,13 @@ PUBLIC int local_dired ARGS1(
     StrAllocCopy(line, line_url);
     HTUnEscape(line);	/* _file_ (not URL) syntax, for those functions
 			   that need it.  Don't forget to FREE it. */
-
-    if ((arg = match_op("NEW_FILE", line)) != 0) {
+    if ((arg = match_op("CHDIR", line)) != 0) {    
+#ifdef SUPPORT_CHDIR
+	handle_LYK_CHDIR();
+	do_pop_doc = FALSE;
+#endif
+	arg = "blah";	/* do something to avoid cc's complaints */
+    } else if ((arg = match_op("NEW_FILE", line)) != 0) {
 	if (create_file(arg) > 0)
 	    LYforce_no_cache = TRUE;
     } else if ((arg = match_op("NEW_FOLDER", line)) != 0) {
@@ -1713,7 +1725,8 @@ PUBLIC int local_dired ARGS1(
     FREE(buffer);
     FREE(line);
     FREE(tp);
-    LYpop(doc);
+    if (do_pop_doc)
+	LYpop(doc);
     return 0;
 }
 
diff --git a/src/LYMail.c b/src/LYMail.c
index 0b7d3b38..7dd55aef 100644
--- a/src/LYMail.c
+++ b/src/LYMail.c
@@ -836,7 +836,7 @@ PUBLIC void mailmsg ARGS4(
 	fprintf(fd, "Cc: %s\n", personal_mail_address);
     }
     fprintf(fd, "X-URL: %s\n", filename);
-    fprintf(fd, "X-Mailer: Lynx, Version %s\n\n", LYNX_VERSION);
+    fprintf(fd, "X-Mailer: %s, Version %s\n\n", LYNX_NAME, LYNX_VERSION);
 #else
     if ((fd = LYOpenTemp(my_tmpfile, ".txt", "w")) == NULL) {
 	CTRACE((tfp, "mailmsg: Could not fopen '%s'.\n", my_tmpfile));
@@ -855,7 +855,7 @@ PUBLIC void mailmsg ARGS4(
 	    fprintf(fd, "Cc: %s\n", personal_mail_address);
 	}
 	fprintf(fd, "X-URL: %s\n", filename);
-	fprintf(fd, "X-Mailer: Lynx, Version %s\n\n", LYNX_VERSION);
+	fprintf(fd, "X-Mailer: %s, Version %s\n\n", LYNX_NAME, LYNX_VERSION);
     }
 #else /* !VMS, e.g., DOSPATH */
     sprintf(subject, "Lynx Error in %.56s", filename);
@@ -871,7 +871,7 @@ PUBLIC void mailmsg ARGS4(
     fprintf(fd, "%s\n\n", gettext("Thought you might want to know."));
 
     fprintf(fd, "%s\n", gettext("This message was automatically generated by"));
-    fprintf(fd, gettext("Lynx ver. %s"), LYNX_VERSION);
+    fprintf(fd, "%s %s", LYNX_NAME, LYNX_VERSION);
     if ((LynxSigFile != NULL) &&
 	(fp = fopen(LynxSigFile, TXT_R)) != NULL) {
 	fputs("-- \n", fd);
@@ -1338,7 +1338,7 @@ PUBLIC void reply_by_mail ARGS4(
 		(filename && *filename) ? filename : "mailto:",
 		(filename && *filename) ? "" : address);
 	fprintf((isPMDF ? hfd : fd),
-		"X-Mailer: Lynx, Version %s\n",LYNX_VERSION);
+		"X-Mailer: %s, Version %s\n", LYNX_NAME, LYNX_VERSION);
 #ifdef NO_ANONYMOUS_EMAIL
 	if (!isPMDF) {
 	    fprintf(fd, "\n");
@@ -1390,7 +1390,7 @@ PUBLIC void reply_by_mail ARGS4(
 	StrAllocCat(header, address);
     }
     StrAllocCat(header, "\n");
-    HTSprintf(&header, "X-Mailer: Lynx, Version %s\n", LYNX_VERSION);
+    HTSprintf(&header, "X-Mailer: %s, Version %s\n", LYNX_NAME, LYNX_VERSION);
 
     if (refid && *refid) {
 	StrAllocCat(header, "In-Reply-To: <");
diff --git a/src/LYMain.c b/src/LYMain.c
index 1f3967f5..31179bf2 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -340,6 +340,8 @@ PUBLIC BOOLEAN LYNewsPosting = NEWS_POSTING; /* News posting supported? */
 PUBLIC char *LynxSigFile = NULL;    /* Signature file, in or off home */
 PUBLIC char *system_mail = NULL;	  /* The path for sending mail */
 PUBLIC char *system_mail_flags = NULL;	  /* Flags for sending mail */
+PUBLIC char *lynx_cmd_logfile;	/* file to write keystroke commands, if any */
+PUBLIC char *lynx_cmd_script;	/* file to read keystroke commands, if any */
 PUBLIC char *lynx_cfg_file = NULL;	  /* location of active lynx.cfg */
 PUBLIC char *lynx_temp_space = NULL; /* The prefix for temporary file paths */
 PUBLIC char *lynx_save_space = NULL; /* The prefix for save to disk paths */
@@ -461,6 +463,10 @@ PUBLIC BOOL textfields_need_activation = FALSE;
 
 PUBLIC BOOLEAN textfield_prompt_at_left_edge = FALSE;
 
+#ifdef MARK_HIDDEN_LINKS
+PUBLIC char* hidden_link_marker = NULL;
+#endif
+
 
 #ifdef DISP_PARTIAL
 PUBLIC BOOLEAN display_partial_flag = TRUE; /* Display document during download */
@@ -1211,6 +1217,23 @@ PUBLIC int main ARGS2(
 
     LYOpenTraceLog();
 
+#ifdef EXP_CMD_LOGGING
+    /*
+     *	Open command-script, if specified
+     */
+    if (lynx_cmd_script != 0) {
+	tildeExpand(&lynx_cmd_script, TRUE);
+	LYOpenCmdScript();
+    }
+    /*
+     *	Open command-logging, if specified
+     */
+    if (lynx_cmd_logfile != 0) {
+	tildeExpand(&lynx_cmd_logfile, TRUE);
+	LYOpenCmdLogfile(argc, argv);
+    }
+#endif
+
     /*
      *	Set up the default jump file stuff. - FM
      */
@@ -1445,6 +1468,7 @@ PUBLIC int main ARGS2(
 	    StrAllocCopy(startfile, result);
 	    while (GetStdin(&buf)) {
 		fputs(buf, fp);
+		fputc('\n', fp);
 	    }
 	    FREE(buf);
 	    LYCloseTempFP(fp);
@@ -2984,6 +3008,16 @@ PRIVATE Parse_Args_Type Arg_Table [] =
       "cfg",		2|NEED_LYSTRING_ARG,	&lynx_cfg_file,
       "=FILENAME\nspecifies a lynx.cfg file other than the default"
    ),
+#ifdef EXP_CMD_LOGGING
+   PARSE_STR(
+       "cmd_log",	2|NEED_LYSTRING_ARG,	&lynx_cmd_logfile,
+       "=FILENAME\nlog keystroke commands to the given file"
+   ),
+   PARSE_STR(
+       "cmd_script",	2|NEED_LYSTRING_ARG,	&lynx_cmd_script,
+       "=FILENAME\nread keystroke commands from the given file (see -cmd_log)"
+   ),
+#endif
    PARSE_FUN(
       "child",		4|FUNCTION_ARG,		child_fun,
       "exit on left-arrow in startfile, and disable save to disk"
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 3572942f..b7eaf53a 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -1300,6 +1300,10 @@ gettext("Enctype multipart/form-data not yet supported!  Cannot submit."));
 		    reloading = FALSE;
 		    return 0;
 		}
+
+	    if (run_external(links[curdoc.link].lname, TRUE))
+		return 0;
+
 	    /*
 	     *	Follow a normal link or anchor.
 	     */
@@ -1530,8 +1534,7 @@ PRIVATE void handle_LYK_ADD_BOOKMARK ARGS3(
 		 *  save either that or the link. - FM
 		 */
 		_statusline(BOOK_D_L_OR_CANCEL);
-		c = LYgetch_for(FOR_SINGLEKEY);
-		if (TOUPPER(c) == 'D') {
+		if ((c = LYgetch_single()) == 'D') {
 		    save_bookmark_link(curdoc.address, curdoc.title);
 		    *refresh_screen = TRUE; /* MultiBookmark support */
 		    goto check_add_bookmark_to_self;
@@ -1566,9 +1569,9 @@ PRIVATE void handle_LYK_ADD_BOOKMARK ARGS3(
 		     */
 		    _statusline(BOOK_L_OR_CANCEL);
 		}
-		c = LYgetch_for(FOR_SINGLEKEY);
+		c = LYgetch_single();
 	    }
-	    if (TOUPPER(c) == 'L') {
+	    if (c == 'L') {
 		if (curdoc.post_data != NULL &&
 		    links[curdoc.link].type == WWW_INTERN_LINK_TYPE) {
 		    /*
@@ -1606,8 +1609,7 @@ PRIVATE void handle_LYK_ADD_BOOKMARK ARGS3(
 	    return;
 	} else {
 	    _statusline(BOOK_D_OR_CANCEL);
-	    c = LYgetch_for(FOR_SINGLEKEY);
-	    if (TOUPPER(c) == 'D') {
+	    if (LYgetch_single() == 'D') {
 		save_bookmark_link(curdoc.address, curdoc.title);
 		*refresh_screen = TRUE; /* MultiBookmark support */
 	    } else {
@@ -2647,7 +2649,7 @@ PRIVATE void handle_LYK_EXTERN ARGS1(
 {
     if ((nlinks > 0) && (links[curdoc.link].lname != NULL))
     {
-	run_external(links[curdoc.link].lname);
+	run_external(links[curdoc.link].lname, FALSE);
 	*refresh_screen = TRUE;
     }
 }
@@ -2928,8 +2930,8 @@ PRIVATE BOOLEAN handle_LYK_HEAD ARGS1(
 	 * submit button.  - FM
 	 */
 	_statusline(HEAD_D_L_OR_CANCEL);
-	c = LYgetch_for(FOR_SINGLEKEY);
-	if (TOUPPER(c) == 'D') {
+	c = LYgetch_single();
+	if (c == 'D') {
 	    char *scheme = strncmp(curdoc.address, "LYNXIMGMAP:", 11) ?
 		curdoc.address : curdoc.address + 11;
 	    if (LYCanDoHEAD(scheme) != TRUE) {
@@ -2955,7 +2957,7 @@ PRIVATE BOOLEAN handle_LYK_HEAD ARGS1(
 		    }
 		}
 	    }
-	} else if (TOUPPER(c) == 'L') {
+	} else if (c == 'L') {
 	    if (links[curdoc.link].type != WWW_FORM_LINK_TYPE &&
 		strncmp(links[curdoc.link].lname, "http", 4) &&
 		strncmp(links[curdoc.link].lname,
@@ -3004,7 +3006,7 @@ PRIVATE BOOLEAN handle_LYK_HEAD ARGS1(
 		 * the current document, not the form link.  - FM
 		 */
 		_statusline(HEAD_D_OR_CANCEL);
-		c = LYgetch_for(FOR_SINGLEKEY);
+		c = LYgetch_single();
 	    } else {
 		/*
 		 * No links, so we can just assume that the user wants a HEAD
@@ -3012,7 +3014,7 @@ PRIVATE BOOLEAN handle_LYK_HEAD ARGS1(
 		 */
 		c = 'D';
 	    }
-	    if (TOUPPER(c) == 'D') {
+	    if (c == 'D') {
 		char *scheme = strncmp(curdoc.address, "LYNXIMGMAP:", 11) ?
 		    curdoc.address : curdoc.address + 11;
 		/*
@@ -5045,6 +5047,86 @@ PRIVATE void handle_LYK_digit ARGS6(
     return;
 }
 
+#ifdef SUPPORT_CHDIR
+
+/* original implementation by VH */
+PUBLIC void handle_LYK_CHDIR NOARGS
+{
+    static char buf[LY_MAXPATH];
+    char *p = NULL;
+
+    _statusline(gettext("cd to:"));
+    /* some people may prefer automatic clearing of the previous user input,
+       here, to do this, just uncomment next line - VH */
+    /* buf[0]='\0'; */
+    if (LYgetstr(buf, VISIBLE, sizeof(buf)-1, 0) < 0 || !*buf) {
+	HTInfoMsg(CANCELLED);
+	return;
+    }
+
+    if (*buf == '~' && !buf[1]) {
+	StrAllocCopy(p, Home_Dir());
+    } else if (*buf == '~') {
+	HTSprintf0(&p, "%s%s", Home_Dir(), buf+1);
+    } else {
+	StrAllocCopy(p, buf);
+    }
+
+    CTRACE((tfp, "changing directory to '%s'\n", p));
+    if (chdir(p)) {
+	switch (errno) {
+	case EACCES:
+	    HTInfoMsg(COULD_NOT_ACCESS_DIR);
+	    break;
+	case ENOENT:
+	    HTInfoMsg(gettext("No such directory"));
+	    break;
+	case ENOTDIR:
+	    HTInfoMsg(gettext("A component of path is not a directory"));
+	    break;
+	default:
+	    HTInfoMsg(gettext("failed to change directory"));
+	    break;
+	}
+    } else {
+#ifdef DIRED_SUPPORT
+	/*if in dired, load content of other directory*/
+	if (!no_dired_support
+	 && (lynx_edit_mode || (LYIsUIPage(curdoc.address, UIP_DIRED_MENU)))) {
+	    char buf2[LY_MAXPATH];
+	    char* tmp;
+	    char* addr = NULL;
+
+	    strcpy(buf2, p);
+	    Current_Dir(buf2);
+	    tmp = wwwName(buf2);
+
+	    StrAllocCopy(addr, "file://localhost");
+	    StrAllocCat(addr, tmp);
+	    if (tmp != buf2)
+	    /*since wwwName is nop on unix and allocates something on VMS and DOS*/
+		FREE(tmp);
+
+	    newdoc.address = addr;
+	    newdoc.isHEAD = FALSE;
+            StrAllocCopy(newdoc.title, gettext("A URL specified by the user"));
+	    FREE(newdoc.post_data);
+	    FREE(newdoc.post_content_type);
+	    FREE(newdoc.bookmark);
+	    newdoc.safe = FALSE;
+	    newdoc.internal_link = FALSE;
+	    /**force_load = TRUE;*/
+	    if (lynx_edit_mode) {
+		DIRED_UNCACHE_2;
+	    }
+	} else
+#endif
+	    HTInfoMsg(OPERATION_DONE);
+    }
+    FREE(p);
+}
+#endif
+
 /*
  *  Here's where we do all the work.
  *  mainloop is basically just a big switch dependent on the users input.
@@ -5144,7 +5226,7 @@ initialize:
 	refresh();
     }
 #endif /* USE_SLANG */
-    CTRACE((tfp,"Entering mainloop, startfile=%s\n",startfile));
+    CTRACE((tfp, "Entering mainloop, startfile=%s\n", startfile));
 
     if (form_post_data) {
 	StrAllocCopy(newdoc.post_data, form_post_data);
@@ -7168,7 +7250,11 @@ new_cmd:  /*
 
 	case LYK_DO_NOTHING:	/* pretty self explanatory */
 	    break;
-
+#ifdef SUPPORT_CHDIR
+	case LYK_CHDIR:
+	    handle_LYK_CHDIR();
+	    break;
+#endif
 	} /* end of BIG switch */
     }
 }
diff --git a/src/LYMainLoop.h b/src/LYMainLoop.h
index bb7dcf47..31804315 100644
--- a/src/LYMainLoop.h
+++ b/src/LYMainLoop.h
@@ -14,6 +14,9 @@ extern void LYMainLoop_pageDisplay PARAMS((int line_num));
 extern void LYSetNewline PARAMS((int value));
 extern void handle_LYK_TRACE_TOGGLE NOPARAMS;
 extern void handle_LYK_WHEREIS PARAMS((int cmd, BOOLEAN *refresh_screen));
+#ifdef SUPPORT_CHDIR
+extern void handle_LYK_CHDIR NOPARAMS; 
+#endif
 extern void repaint_main_statusline PARAMS((int for_what));
 
 #endif /* LYMAINLOOP_H */
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 745d7944..b126cd0f 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -520,7 +520,7 @@ draw_options:
     addstr("'");
     addstr(TO_RETURN_SEGMENT);
 
-    while (TOUPPER(response) != 'R' &&
+    while (response != 'R' &&
 	   !LYisNonAlnumKeyname(response, LYK_PREV_DOC) &&
 	   response != '>' && !term_options &&
 	   response != 7 &&  response != 3) {
@@ -534,7 +534,7 @@ draw_options:
 	lynx_stop_prompt_color ();
 
 	refresh();
-	response = LYgetch_for(FOR_SINGLEKEY);
+	response = LYgetch_single();
 	if (term_options || response == 7 || response == 3)
 	    response = 'R';
 	if (LYisNonAlnumKeyname(response, LYK_REFRESH)) {
@@ -542,8 +542,7 @@ draw_options:
 	    goto draw_options;
 	}
 	switch (response) {
-	    case 'e':	/* Change the editor. */
-	    case 'E':
+	    case 'E':	/* Change the editor. */
 		if (no_editor) {
 		    _statusline(EDIT_DISABLED);
 		} else if (system_editor ) {
@@ -584,8 +583,7 @@ draw_options:
 		response = ' ';
 		break;
 
-	    case 'd':	/* Change the display. */
-	    case 'D':
+	    case 'D':	/* Change the display. */
 		if (x_display && *x_display) {
 		    LYstrncpy(display_option, x_display, sizeof(display_option) - 1);
 		} else {  /* clear the NONE */
@@ -650,8 +648,7 @@ draw_options:
 		response = ' ';
 		break;
 
-	    case 'l':	/* Change multibookmarks option. */
-	    case 'L':
+	    case 'L':	/* Change multibookmarks option. */
 		if (LYMBMBlocked) {
 		    _statusline(MULTIBOOKMARKS_DISALLOWED);
 		    response = ' ';
@@ -712,8 +709,7 @@ draw_options:
 		}
 		break;
 
-	    case 'b':	/* Change the bookmark page location. */
-	    case 'B':
+	    case 'B':	/* Change the bookmark page location. */
 		/*
 		 *  Anonymous users should not be allowed to
 		 *  change the bookmark page.
@@ -769,8 +765,7 @@ draw_options:
 		response = ' ';
 		break;
 
-	    case 'f':	/* Change ftp directory sorting. */
-	    case 'F':	/*  (also local for non-DIRED)	 */
+	    case 'F':	/* Change ftp directory sorting. */
 		/*
 		 *  Copy strings into choice array.
 		 */
@@ -808,8 +803,7 @@ draw_options:
 		}
 		break;
 
-	    case 'p': /* Change personal mail address for From headers. */
-	    case 'P':
+	    case 'P': /* Change personal mail address for From headers. */
 		if (personal_mail_address && *personal_mail_address) {
 		    LYstrncpy(display_option, personal_mail_address, sizeof(display_option) - 1);
 		} else {  /* clear the NONE */
@@ -845,8 +839,7 @@ draw_options:
 		response = ' ';
 		break;
 
-	    case 's':	/* Change case sensitivity for searches. */
-	    case 'S':
+	    case 'S':	/* Change case sensitivity for searches. */
 		/*
 		 *  Copy strings into choice array.
 		 */
@@ -947,8 +940,7 @@ draw_options:
 		}
 		break;
 
-	    case 'c':	/* Change display charset setting. */
-	    case 'C':
+	    case 'C':	/* Change display charset setting. */
 		if (!LYSelectPopups) {
 #ifndef ALL_CHARSETS_IN_O_MENU_SCREEN
 		    displayed_display_charset_idx = LYChooseBoolean(displayed_display_charset_idx,
@@ -1004,8 +996,7 @@ draw_options:
 		}
 		break;
 
-	    case 'o':	/* Change raw mode setting. */
-	    case 'O':
+	    case 'O':	/* Change raw mode setting. */
 		/*
 		 *  Copy strings into choice array.
 		 */
@@ -1029,8 +1020,7 @@ draw_options:
 		response = ' ';
 		break;
 
-	    case 'g':	/* Change language preference. */
-	    case 'G':
+	    case 'G':	/* Change language preference. */
 		if (language && *language) {
 		    LYstrncpy(display_option, language, sizeof(display_option) - 1);
 		} else {  /* clear the NONE */
@@ -1065,8 +1055,7 @@ draw_options:
 		response = ' ';
 		break;
 
-	    case 'h':	/* Change charset preference. */
-	    case 'H':
+	    case 'H':	/* Change charset preference. */
 		if (pref_charset && *pref_charset) {
 		    LYstrncpy(display_option, pref_charset, sizeof(display_option) - 1);
 		} else {  /* clear the NONE */
@@ -1101,8 +1090,7 @@ draw_options:
 		response = ' ';
 		break;
 
-	    case 'v':	/* Change VI keys setting. */
-	    case 'V':
+	    case 'V':	/* Change VI keys setting. */
 		/*
 		 *  Copy strings into choice array.
 		 */
@@ -1125,7 +1113,6 @@ draw_options:
 		break;
 
 	    case 'M':	/* Change emacs keys setting. */
-	    case 'm':
 		/*
 		 *  Copy strings into choice array.
 		 */
@@ -1148,7 +1135,6 @@ draw_options:
 		break;
 
 	    case 'W':	/* Change show dotfiles setting. */
-	    case 'w':
 		if (no_dotfiles) {
 		    _statusline(DOTFILE_ACCESS_DISABLED);
 		} else {
@@ -1170,8 +1156,7 @@ draw_options:
 		response = ' ';
 		break;
 
-	    case 't':	/* Change select popups setting. */
-	    case 'T':
+	    case 'T':	/* Change select popups setting. */
 		/*
 		 *  Copy strings into choice array.
 		 */
@@ -1315,8 +1300,7 @@ draw_options:
 		response = ' ';
 		break;
 
-	    case 'k':	/* Change keypad mode. */
-	    case 'K':
+	    case 'K':	/* Change keypad mode. */
 		/*
 		 *  Copy strings into choice array.
 		 */
@@ -1359,8 +1343,7 @@ draw_options:
 		}
 		break;
 
-	    case 'n':	/* Change line editor key bindings. */
-	    case 'N':
+	    case 'N':	/* Change line editor key bindings. */
 		if (!LYSelectPopups) {
 		    current_lineedit = LYChooseBoolean(current_lineedit,
 						      L_Lineed, -1,
@@ -1383,8 +1366,7 @@ draw_options:
 		break;
 
 #ifdef EXP_KEYBOARD_LAYOUT
-	    case 'y':	/* Change keyboard layout */
-	    case 'Y':
+	    case 'Y':	/* Change keyboard layout */
 		if (!LYSelectPopups) {
 		    current_layout = LYChooseBoolean(current_layout,
 						      L_Layout, -1,
@@ -1408,8 +1390,7 @@ draw_options:
 #endif /* EXP_KEYBOARD_LAYOUT */
 
 #ifdef DIRED_SUPPORT
-	    case 'i':	/* Change local directory sorting. */
-	    case 'I':
+	    case 'I':	/* Change local directory sorting. */
 		/*
 		 *  Copy strings into choice array.
 		 */
@@ -1445,8 +1426,7 @@ draw_options:
 		break;
 #endif /* DIRED_SUPPORT */
 
-	    case 'u':	/* Change user mode. */
-	    case 'U':
+	    case 'U':	/* Change user mode. */
 		/*
 		 *  Copy strings into choice array.
 		 */
@@ -1519,8 +1499,7 @@ draw_options:
 		}
 		break;
 
-	    case 'a':	/* Change user agent string. */
-	    case 'A':
+	    case 'A':	/* Change user agent string. */
 		if (!no_useragent) {
 		    if (LYUserAgent && *LYUserAgent) {
 			LYstrncpy(display_option, LYUserAgent, sizeof(display_option) - 1);
@@ -1569,8 +1548,7 @@ draw_options:
 		break;
 
 #if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
-	    case 'x':	/* Change local exec restriction. */
-	    case 'X':
+	    case 'X':	/* Change local exec restriction. */
 		if (exec_frozen && !LYSelectPopups) {
 		    _statusline(CHANGE_OF_SETTING_DISALLOWED);
 		    response = ' ';
@@ -1665,8 +1643,7 @@ draw_options:
 		}
 		break;
 
-	    case 'r':	/* Return to document (quit options menu). */
-	    case 'R':
+	    case 'R':	/* Return to document (quit options menu). */
 		break;
 
 	    default:
@@ -1732,9 +1709,9 @@ PRIVATE int boolean_choice ARGS4(
     while (1) {
 	move(line, col);
 	if (term_options == FALSE) {
-	    response = LYgetch_for(FOR_SINGLEKEY);
+	    response = LYgetch_single();
 	}
-	if (term_options || response == 7 || response == 3) {
+	if (term_options || response == 7) {
 	     /*
 	      *  Control-C or Control-G.
 	      */
@@ -1972,7 +1949,7 @@ draw_bookmark_list:
 	lynx_stop_prompt_color ();
 
 	refresh();
-	response = (def_response ? def_response : LYgetch_for(FOR_SINGLEKEY));
+	response = (def_response ? def_response : LYgetch_single());
 	def_response = 0;
 
 	/*
@@ -2038,7 +2015,7 @@ draw_bookmark_list:
 	 *  that way.
 	 */
 	for (a = 0; a <= MBM_V_MAXFILES; a++) {
-	    if ((TOUPPER(response) - 'A') == a) {
+	    if ((response - 'A') == a) {
 		if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {
 		    if (MBM_current == 1 && a > (MBM_V_MAXFILES/2)) {
 			MBM_current = 2;
@@ -2519,8 +2496,8 @@ redraw:
 #endif /* USE_SLANG  */
 
 	term_options = FALSE;
-	c = LYgetch_for(FOR_CHOICE);
-	if (term_options || c == 3 || c == 7) {
+	c = LYgetch_choice();
+	if (term_options || c == 7) {
 	    cmd = LYK_QUIT;
 #ifndef USE_SLANG
 	} else if (c == MOUSE_KEY) {
diff --git a/src/LYPrint.c b/src/LYPrint.c
index cd7242ae..a7024688 100644
--- a/src/LYPrint.c
+++ b/src/LYPrint.c
@@ -1037,8 +1037,8 @@ PRIVATE void send_file_to_screen ARGS3(
 	Lpansi = FALSE;
     } else {
 	fprintf(stdout,"\n\n%s", PRESS_RETURN_TO_FINISH);
-	fflush(stdout);  /* refresh to screen */
-	LYgetch();  /* grab some user input to pause */
+	fflush(stdout);		/* refresh to screen */
+	(void) LYgetch();	/* grab some user input to pause */
 #ifdef VMS
 	HadVMSInterrupt = FALSE;
 #endif /* VMS */
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index d72c04bb..b23f0a28 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -165,6 +165,7 @@ PRIVATE void add_item_to_list ARGS2(
     cur_item->name = NULL;
     cur_item->command = NULL;
     cur_item->always_enabled = FALSE;
+    cur_item->override_primary_action = FALSE;
 
     /*
      *	Find first unescaped colon and process fields
@@ -196,7 +197,13 @@ PRIVATE void add_item_to_list ARGS2(
 	    remove_backslashes(cur_item->command);
 	}
 	if (*next_colon++) {
-	    cur_item->always_enabled = is_true(next_colon);
+	    colon = next_colon;
+	    if ((next_colon = strchr(colon,':')) != 0)
+		*next_colon++ = '\0';		
+	    cur_item->always_enabled = is_true(colon);
+	    if (next_colon) {
+		cur_item->override_primary_action = is_true(next_colon);
+	    }
 	}
     }
 }
@@ -1436,6 +1443,9 @@ static Config_Type Config_Table [] =
      PARSE_ENV("gopher_proxy", CONF_ENV, 0 ),
      PARSE_SET("gotobuffer", CONF_BOOL, &goto_buffer),
      PARSE_STR("helpfile", CONF_STR, &helpfile),
+#ifdef MARK_HIDDEN_LINKS
+     PARSE_STR("hidden_link_marker", CONF_STR, &hidden_link_marker),
+#endif     
      PARSE_SET("historical_comments", CONF_BOOL, &historical_comments),
 #ifdef USE_PRETTYSRC
      PARSE_FUN("htmlsrc_attrname_xform", CONF_FUN, read_htmlsrc_attrname_xform),
@@ -1731,7 +1741,7 @@ PRIVATE void do_read_cfg ARGS5(
 	cfg_filename = mypath;
     }
     if ((fp = fopen(cfg_filename, TXT_R)) == 0) {
-	CTRACE((tfp,"lynx.cfg file not found as %s\n",cfg_filename));
+	CTRACE((tfp, "lynx.cfg file not found as '%s'\n", cfg_filename));
 	return;
     }
     have_read_cfg = TRUE;
@@ -1743,7 +1753,7 @@ PRIVATE void do_read_cfg ARGS5(
     if (show_cfg) {
 	time_t t;
 	time(&t);
-	printf("### Lynx %s, at %s", LYNX_VERSION, ctime(&t));
+	printf("### %s %s, at %s", LYNX_NAME, LYNX_VERSION, ctime(&t));
     }
 #endif
     while (LYSafeGets(&buffer, fp) != 0) {
diff --git a/src/LYStrings.c b/src/LYStrings.c
index ecc6effe..723345d7 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -33,9 +33,9 @@
 #include <LYMainLoop.h>
 #endif
 
+#include <LYShowInfo.h>
 #include <LYLeaks.h>
 
-extern unsigned short *LYKbLayout;
 extern BOOL HTPassHighCtrlRaw;
 
 #if defined(WIN_EX)
@@ -1418,7 +1418,7 @@ PRIVATE int myGetChar NOARGS
     return i;
 }
 
-PUBLIC int LYgetch_for ARGS1(
+PRIVATE int LYgetch_for ARGS1(
 	int,	code)
 {
    SLang_Key_Type *key;
@@ -1463,7 +1463,7 @@ PUBLIC int LYgetch_for ARGS1(
  */
 #define found_CSI(first,second) ((second) == '[' || (first) == 155)
 
-PUBLIC int LYgetch_for ARGS1(
+PRIVATE int LYgetch_for ARGS1(
 	int,	code)
 {
     int a, b, c, d = -1;
@@ -1472,11 +1472,7 @@ PUBLIC int LYgetch_for ARGS1(
 
     have_levent = 0;
 
-#if defined(IGNORE_CTRL_C) || defined(USE_GETCHAR) || !defined(NCURSES) || \
-    (HAVE_KEYPAD && defined(KEY_RESIZE)) || \
-    (defined(NCURSES) && defined(USE_MOUSE) && !defined(DOSPATH))
 re_read:
-#endif /* IGNORE_CTRL_C || USE_GETCHAR etc. */
 #if !defined(UCX) || !defined(VAXC) /* errno not modifiable ? */
     if (errno == EINTR)
 	set_errno(0);		/* reset - kw */
@@ -2074,8 +2070,8 @@ re_read:
 #define HIST_CMD_2	12
 #define V_CMD_AREA	1
 
-		int left,right;
-		extern BOOLEAN system_is_NT;
+		int left = H_CMD_AREA;
+		int right = (LYcols - H_CMD_AREA);
 		/* yes, I am assuming that my screen will be a certain width. */
 
 		int tick_count;
@@ -2083,8 +2079,6 @@ re_read:
 		char mouse_info[128];
 		static int old_click = 0;	/* [m Sec] */
 
-		left = H_CMD_AREA;
-		right = (LYcols - H_CMD_AREA);
 		c = -1;
 		mouse_link = -1;
 
@@ -2295,7 +2289,43 @@ re_read:
 
 PUBLIC int LYgetch NOARGS
 {
-    return LYgetch_for(FOR_PANEL);
+    return LYReadCmdKey(FOR_PANEL);
+}
+
+/*
+ * Read a single keystroke, allows mouse-selection.
+ */
+PUBLIC int LYgetch_choice NOARGS
+{
+    int ch = LYReadCmdKey(FOR_CHOICE);
+    if (ch == 3)
+	ch = 7;			/* treat ^C the same as ^G */
+    return ch;
+}
+
+/*
+ * Read a single keystroke, allows mouse events.
+ */
+PUBLIC int LYgetch_input NOARGS
+{
+    int ch = LYReadCmdKey(FOR_INPUT);
+    if (ch == 3)
+	ch = 7;			/* treat ^C the same as ^G */
+    return ch;
+}
+
+/*
+ * Read a single keystroke, ignoring case by translating it to uppercase.
+ * Ignore mouse events, if any.
+ */
+PUBLIC int LYgetch_single NOARGS
+{
+    int ch = LYReadCmdKey(FOR_SINGLEKEY);
+    if (ch == 3)
+	ch = 7;			/* treat ^C the same as ^G */
+    else if (ch > 0 && ch < 256)
+	ch = TOUPPER(ch);	/* will ignore case of result */
+    return ch;
 }
 
 /*
@@ -3220,7 +3250,7 @@ again:
 	if (refresh_mb)
 	    LYRefreshEdit(&MyEdit);
 #endif /* SUPPORT_MULTIBYTE_EDIT */
-	ch = LYgetch_for(FOR_PROMPT);
+	ch = LYReadCmdKey(FOR_PROMPT);
 #ifdef SUPPORT_MULTIBYTE_EDIT
 #ifdef CJK_EX	/* for SJIS code */
 	if (!refresh_mb
@@ -4260,3 +4290,89 @@ PUBLIC void base64_encode ARGS3(
 }
 
 #endif /* EXP_FILE_UPLOAD */
+
+#ifdef EXP_CMD_LOGGING
+PRIVATE FILE *cmd_logfile;
+PRIVATE FILE *cmd_script;
+
+PUBLIC void LYOpenCmdLogfile ARGS2(
+	int,		argc,
+	char **,	argv)
+{
+    int n;
+
+    if (lynx_cmd_logfile != 0) {
+	cmd_logfile = LYNewTxtFile(lynx_cmd_logfile);
+	if (cmd_logfile != 0) {
+	    fprintf(cmd_logfile, "# Command logfile created by %s %s (%s)\n",
+		LYNX_NAME, LYNX_VERSION, LYVersionDate());
+	    for (n = 0; n < argc; n++) {
+		fprintf(cmd_logfile, "# Arg%d = %s\n", n, argv[n]);
+	    }
+	}
+    }
+}
+
+PUBLIC void LYOpenCmdScript NOARGS
+{
+    if (lynx_cmd_script != 0) {
+	cmd_script = fopen(lynx_cmd_script, "r");
+    }
+}
+
+PUBLIC int LYReadCmdKey ARGS1(
+	int,	mode)
+{
+    int ch = -1;
+
+    if (cmd_script != 0) {
+	char *buffer = 0;
+	char *src;
+	char *tmp;
+
+	while (LYSafeGets(&buffer, cmd_script) != 0) {
+	    LYTrimTrailing(buffer);
+	    src = LYSkipBlanks(buffer);
+	    tmp = LYSkipNonBlanks(src);
+	    if (tmp - src != 3
+	     || strncasecomp(src, "key", 3))
+		continue;
+	    src = LYSkipBlanks(tmp);
+	    if ((ch = LYStringToKeycode(src)) >= 0) {
+		refresh();
+		break;
+	    }
+	}
+	FREE(buffer);
+    } else {
+	ch = LYgetch_for(mode);
+    }
+    LYWriteCmdKey(ch);
+    return ch;
+}
+
+/*
+ * Write a LYKeymapCode 'ch' to the logfile.
+ */
+PUBLIC void LYWriteCmdKey ARGS1(
+	int,	ch)
+{
+    if (cmd_logfile != 0) {
+	fprintf(cmd_logfile, "key %s\n", LYKeycodeToString(ch, FALSE));
+    }
+}
+
+PUBLIC void LYCloseCmdLogfile NOARGS
+{
+    if (cmd_logfile != 0) {
+	fclose(cmd_logfile);
+	cmd_logfile = 0;
+    }
+    if (cmd_script != 0) {
+	fclose(cmd_script);
+	cmd_script = 0;
+    }
+    FREE(lynx_cmd_logfile);
+    FREE(lynx_cmd_script);
+}
+#endif /* EXP_CMD_LOGGING */
diff --git a/src/LYStrings.h b/src/LYStrings.h
index 79db1a0c..32aeed8c 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -19,8 +19,9 @@ extern char * LYstrncpy PARAMS((
 	int		n));
 extern void ena_csi PARAMS((BOOLEAN flag));
 extern int LYgetch NOPARAMS;
-extern int LYgetch_for PARAMS((
-	int		code));
+extern int LYgetch_choice NOPARAMS;
+extern int LYgetch_input NOPARAMS;
+extern int LYgetch_single NOPARAMS;
 extern int LYgetstr PARAMS((
 	char *		inputline,
 	int		hidden,
@@ -80,6 +81,17 @@ extern char * SNACat PARAMS((
 
 extern char *LYSafeGets PARAMS((char ** src, FILE * fp));
 
+#ifdef EXP_CMD_LOGGING
+extern int LYReadCmdKey PARAMS((int mode));
+extern void LYCloseCmdLogfile NOPARAMS;
+extern void LYOpenCmdLogfile PARAMS((int argc, char **argv));
+extern void LYOpenCmdScript NOPARAMS;
+extern void LYWriteCmdKey PARAMS((int ch));
+#else
+#define LYReadCmdKey(mode) LYgetch_for(mode)
+#define LYCloseCmdLogfile() /* nothing */
+#endif
+
 #ifdef EXP_FILE_UPLOAD
 extern void base64_encode PARAMS((char * dest, char * src, int len));
 #endif
@@ -105,7 +117,7 @@ extern void base64_encode PARAMS((char * dest, char * src, int len));
 #define REMOVE_KEY	269	/* 0x10D */
 #define DO_NOTHING	270	/* 0x10E */
 #define BACKTAB_KEY	271	/* 0x10F */
-#define MOUSE_KEY	0x11d	/* 0x11D */
+#define MOUSE_KEY	285	/* 0x11D */
 /*  ***** NOTES: *****
     If you add definitions for new lynxkeycodes to the above list that
     need to be mapped to LYK_* lynxactioncodes -
@@ -136,7 +148,6 @@ extern void base64_encode PARAMS((char * dest, char * src, int len));
     to be less than LKC_ISLKC (even if KEYMAP_SIZE is increased).
 */
 
-
 #  define FOR_PANEL	0	/* normal screen, also LYgetch default */
 #  define FOR_CHOICE	1	/* mouse menu */
 #  define FOR_INPUT	2	/* form input and textarea field */
diff --git a/src/LYStructs.h b/src/LYStructs.h
index 6e16e456..31b8afe5 100644
--- a/src/LYStructs.h
+++ b/src/LYStructs.h
@@ -88,6 +88,13 @@ typedef struct _lynx_html_item_type {
 					* not to disable the printer
 					* when the no_print option is on
 					*/
+    BOOL override_primary_action;	/* whether primary action will be
+					* overridden by this - e.g. this allows
+					* invoking user's MUA when mailto: link
+					* is activated using normal "activate"
+					* command. This field is only examined
+					* by code that handles EXTERNAL command.
+					*/
 } lynx_html_item_type;
 
 /* for printer commands */
diff --git a/src/LYStyle.c b/src/LYStyle.c
index 9292af8c..517e1832 100644
--- a/src/LYStyle.c
+++ b/src/LYStyle.c
@@ -1,6 +1,6 @@
 /* character level styles for Lynx
  * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-)
- * @Id: LYStyle.c 1.35 Tue, 30 Nov 1999 20:33:02 -0700 dickey @
+ * @Id: LYStyle.c 1.36 Fri, 23 Jun 2000 08:15:08 -0700 dickey @
  */
 #include <HTUtils.h>
 #include <HTML.h>
@@ -440,7 +440,7 @@ PRIVATE int style_readFromFileREC ARGS2(char*, file, int, toplevel)
     if (!fh)
     {
 	/* this should probably be an alert or something */
-	CTRACE((tfp, "CSS:Can't open style file %s, using defaults\n", file));
+	CTRACE((tfp, "CSS:Can't open style file '%s', using defaults\n", file));
 	return -1;
     }
 
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 1c545c75..5a298057 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -7088,9 +7088,16 @@ PUBLIC BOOLEAN LYValidateFilename ARGS2(
 #if defined(__DJGPP__) || defined(_WINDOWS)
     if (strchr(result, ':') != NULL)
 	cp = NULL;
-    else
+    else 
 #endif /*  __DJGPP__ || _WINDOWS */
-	cp = original_dir;
+	{
+#ifdef SUPPORT_CHDIR
+	    static char buf[LY_MAXPATH];
+	    cp = Current_Dir(buf);	    
+#else
+	    cp = original_dir;
+#endif
+	}
     }
     else
 #endif /* __EMX__*/
diff --git a/src/LYexit.c b/src/LYexit.c
index 3a1adacf..9eafb3da 100644
--- a/src/LYexit.c
+++ b/src/LYexit.c
@@ -10,6 +10,7 @@
 #include <LYSignal.h>
 #include <LYMainLoop.h>
 #endif /* !VMS */
+#include <LYStrings.h>
 #include <LYClean.h>
 
 /*
@@ -147,6 +148,8 @@ PUBLIC void LYexit ARGS1(
     LYCloselog();
 #endif /* !VMS && SYSLOG_REQUESTED_URLS */
 
+    LYCloseCmdLogfile();
+
 #ifdef exit
 /*  Make sure we use stdlib exit and not LYexit. - GAB
 */
diff --git a/userdefs.h b/userdefs.h
index d1364999..72979b4a 100644
--- a/userdefs.h
+++ b/userdefs.h
@@ -341,6 +341,12 @@
 #define TEMP_SPACE "/tmp/"
 
 /********************************
+ * Comment this line out to disable code that implements command logging
+ * and scripting.
+ */
+#define EXP_CMD_LOGGING 1
+
+/********************************
  * Comment this line out to disable code that randomizes the names given to
  * temporary files.
  */
@@ -1339,11 +1345,11 @@
  * the version definition with the Project Version on checkout.  Just
  * ignore it. - kw */
 /* $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$ */
-#define LYNX_VERSION "2.8.4dev.3"
+#define LYNX_VERSION "2.8.4dev.4"
 #define LYNX_WWW_HOME "http://lynx.browser.org/"
 #define LYNX_WWW_DIST "http://lynx.isc.org/current/"
 /* $Format: "#define LYNX_DATE \"$ProjectDate$\""$ */
-#define LYNX_DATE "Fri, 02 Jun 2000 18:01:05 -0700"
+#define LYNX_DATE "Fri, 23 Jun 2000 08:15:08 -0700"
 #define LYNX_DATE_OFF 5		/* truncate the automatically-generated date */
 #define LYNX_DATE_LEN 11	/* truncate the automatically-generated date */
 
@@ -1459,6 +1465,20 @@
  */
 #define SUPPORT_MULTIBYTE_EDIT
 
+/***************************** 
+ * SUPPORT_CHDIR provides CD command (bound to 'C' by default).  It allows
+ * changing directory to arbitrary location (if OS allows them).  If dired is
+ * enabled, user will be able to visit any directory and view any file allowed
+ * according to file permissions or ACLs.
+ */
+#define SUPPORT_CHDIR
+
+/***************************** 
+ * MARK_HIDDEN_LINKS controls whether hidden links are shown with the title
+ * set by the HIDDEN_LINK_MARKER string in lynx.cfg
+ */
+#define MARK_HIDDEN_LINKS
+
 /*****************************
  * USE_TH_JP_AUTO_DETECT, CONV_JISX0201KANA_JISX0208KANA,  
  * and KANJI_CODE_OVERRIDE are the macros for Japanese. - TH