about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1997-07-18 14:09:51 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1997-07-18 14:09:51 -0400
commit57bfc74ff4ec4c2980b2330f2badc54a8990842d (patch)
tree81bffba3be5c8037a5064ec5d49cf243130697fb /WWW/Library/Implementation
parentfb4db89ab1d82336978b68a66532da971702e2fb (diff)
downloadlynx-snapshots-57bfc74ff4ec4c2980b2330f2badc54a8990842d.tar.gz
snapshot of project "lynx", label v2-7-1ac_0-36
Diffstat (limited to 'WWW/Library/Implementation')
-rw-r--r--WWW/Library/Implementation/HTAABrow.c214
-rw-r--r--WWW/Library/Implementation/HTAABrow.h23
-rw-r--r--WWW/Library/Implementation/HTAlert.c5
-rw-r--r--WWW/Library/Implementation/HTAlert.h5
-rw-r--r--WWW/Library/Implementation/HTAnchor.c132
-rw-r--r--WWW/Library/Implementation/HTAnchor.h3
-rw-r--r--WWW/Library/Implementation/HTFTP.c42
-rw-r--r--WWW/Library/Implementation/HTFile.c131
-rw-r--r--WWW/Library/Implementation/HTMIME.c159
-rw-r--r--WWW/Library/Implementation/HTMIME.h10
-rw-r--r--WWW/Library/Implementation/HTML.h1
-rw-r--r--WWW/Library/Implementation/HTMLDTD.c93
-rw-r--r--WWW/Library/Implementation/HTMLDTD.h289
-rw-r--r--WWW/Library/Implementation/HTMLGen.c141
-rw-r--r--WWW/Library/Implementation/HTNews.c25
-rw-r--r--WWW/Library/Implementation/HTPlain.c131
-rw-r--r--WWW/Library/Implementation/HTTCP.c71
-rw-r--r--WWW/Library/Implementation/HTTP.c174
-rw-r--r--WWW/Library/Implementation/HTVMSUtils.c9
-rw-r--r--WWW/Library/Implementation/HText.h7
-rw-r--r--WWW/Library/Implementation/SGML.c412
-rw-r--r--WWW/Library/Implementation/SGML.h69
-rw-r--r--WWW/Library/Implementation/UCAux.h45
-rw-r--r--WWW/Library/Implementation/UCDefs.h29
-rw-r--r--WWW/Library/Implementation/UCMap.h42
25 files changed, 1487 insertions, 775 deletions
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c
index 3be7d229..aa8a19fd 100644
--- a/WWW/Library/Implementation/HTAABrow.c
+++ b/WWW/Library/Implementation/HTAABrow.c
@@ -64,7 +64,6 @@
 #include "LYLeaks.h"
 
 extern BOOL using_proxy;	/* Are we using an HTTP gateway? */
-extern BOOL auth_proxy;		/* Generate a proxy authorization - AJL */
 
 /*
 **  Local datatype definitions
@@ -75,6 +74,7 @@ typedef struct {
 
     char *	hostname;	/* Host's name			*/
     int		portnumber;	/* Port number			*/
+    BOOL	IsProxy;	/* Is it a proxy?		*/
     HTList *	setups;		/* List of protection setups	*/
                                 /* on this server; i.e. valid	*/
                                 /* authentication schemes and	*/
@@ -136,8 +136,9 @@ PRIVATE int proxy_portnumber	= 80;
 
 /*** HTAAForwardAuth for enabling gateway-httpds to forward Authorization ***/
 
-PUBLIC void HTAAForwardAuth_set ARGS2(CONST char *, scheme_name,
-				      CONST char *, scheme_specifics)
+PUBLIC void HTAAForwardAuth_set ARGS2(
+	CONST char *,	scheme_name,
+	CONST char *,	scheme_specifics)
 {
     int len = 20 + (scheme_name      ? strlen(scheme_name)      : 0) 
 	         + (scheme_specifics ? strlen(scheme_specifics) : 0);
@@ -173,6 +174,7 @@ PRIVATE void HTAASetup_delete PARAMS((HTAASetup * killme));	/* Forward */
 **	hostname	is the name of the host that the server
 **			is running in.
 **	portnumber	is the portnumber which the server listens.
+**	IsProxy		should be TRUE if this is a proxy.
 **
 ** ON EXIT:
 **	returns		the newly-allocated node with all the strings
@@ -181,8 +183,10 @@ PRIVATE void HTAASetup_delete PARAMS((HTAASetup * killme));	/* Forward */
 **			the function HTAAServer_delete(), which also
 **			frees the node itself.
 */
-PRIVATE HTAAServer *HTAAServer_new ARGS2(CONST char*,	hostname,
-					 int,		portnumber)
+PRIVATE HTAAServer *HTAAServer_new ARGS3(
+	CONST char*,	hostname,
+	int,		portnumber,
+	BOOL,		IsProxy)
 {
     HTAAServer *server;
 
@@ -191,6 +195,7 @@ PRIVATE HTAAServer *HTAAServer_new ARGS2(CONST char*,	hostname,
 
     server->hostname	= NULL;
     server->portnumber	= (portnumber > 0 ? portnumber : 80);
+    server->IsProxy	= IsProxy;
     server->setups	= HTList_new();
     server->realms	= HTList_new();
 
@@ -217,7 +222,8 @@ PRIVATE HTAAServer *HTAAServer_new ARGS2(CONST char*,	hostname,
 ** ON EXIT:
 **	returns		nothing.
 */
-PRIVATE void HTAAServer_delete ARGS1(HTAAServer *, killme)
+PRIVATE void HTAAServer_delete ARGS1(
+	HTAAServer *,	killme)
 {
     int n, i;
     HTAASetup *setup;
@@ -260,6 +266,7 @@ PRIVATE void HTAAServer_delete ARGS1(HTAAServer *, killme)
 ** ON ENTRY:
 **	hostname	obvious.
 **	portnumber	if non-positive defaults to 80.
+**	IsProxy		should be TRUE if this is a proxy.
 **
 **	Looks up the server in the module-global server_table.
 **
@@ -268,8 +275,10 @@ PRIVATE void HTAAServer_delete ARGS1(HTAAServer *, killme)
 **			representing the looked-up server.
 **			NULL, if not found.
 */
-PRIVATE HTAAServer *HTAAServer_lookup ARGS2(CONST char *, hostname,
-					    int,	  portnumber)
+PRIVATE HTAAServer *HTAAServer_lookup ARGS3(
+	CONST char *,	hostname,
+	int,		portnumber,
+	BOOL,		IsProxy)
 {
     if (hostname) {
 	HTList *cur = server_table;
@@ -280,7 +289,8 @@ PRIVATE HTAAServer *HTAAServer_lookup ARGS2(CONST char *, hostname,
 
 	while (NULL != (server = (HTAAServer*)HTList_nextObject(cur))) {
 	    if (server->portnumber == portnumber  &&
-		0==strcmp(server->hostname, hostname))
+		0==strcmp(server->hostname, hostname) &&
+		server->IsProxy == IsProxy)
 		return server;
 	}
     }
@@ -299,6 +309,7 @@ PRIVATE HTAAServer *HTAAServer_lookup ARGS2(CONST char *, hostname,
 **	portnumber	is the port that the server is running in.
 **	docname		is the (URL-)pathname of the document we
 **			are trying to access.
+**	IsProxy		should be TRUE if this is a proxy.
 **
 ** 	This function goes through the information known about
 **	all the setups of the server, and finds out if the given
@@ -311,9 +322,11 @@ PRIVATE HTAAServer *HTAAServer_lookup ARGS2(CONST char *, hostname,
 **			document tree.
 **			
 */
-PRIVATE HTAASetup *HTAASetup_lookup ARGS3(CONST char *, hostname,
-					  int,		portnumber,
-					  CONST char *, docname)
+PRIVATE HTAASetup *HTAASetup_lookup ARGS4(
+	CONST char *,	hostname,
+	int,		portnumber,
+	CONST char *,	docname,
+	BOOL,		IsProxy)
 {
     HTAAServer *server;
     HTAASetup *setup;
@@ -322,13 +335,16 @@ PRIVATE HTAASetup *HTAASetup_lookup ARGS3(CONST char *, hostname,
         portnumber = 80;
 
     if (hostname && docname && *hostname && *docname &&
-	NULL != (server = HTAAServer_lookup(hostname, portnumber))) {
+	NULL != (server = HTAAServer_lookup(hostname,
+					    portnumber,
+					    IsProxy))) {
 
 	HTList *cur = server->setups;
 
 	if (TRACE)
-	    fprintf(stderr, "%s (%s:%d:%s)\n",
+	    fprintf(stderr, "%s %s (%s:%d:%s)\n",
 			    "HTAASetup_lookup: resolving setup for",
+			    (IsProxy ? "proxy" : "server"),
 			    hostname, portnumber, docname);
 
 	while (NULL != (setup = (HTAASetup*)HTList_nextObject(cur))) {
@@ -374,10 +390,11 @@ PRIVATE HTAASetup *HTAASetup_lookup ARGS3(CONST char *, hostname,
 **	returns		a new HTAASetup node, and also adds it as
 **			part of the HTAAServer given as parameter.
 */
-PRIVATE HTAASetup *HTAASetup_new ARGS4(HTAAServer *,	server,
-				       char *,		template,
-				       HTList *,	valid_schemes,
-				       HTAssocList **,	scheme_specifics)
+PRIVATE HTAASetup *HTAASetup_new ARGS4(
+	HTAAServer *,	server,
+	char *,		template,
+	HTList *,	valid_schemes,
+	HTAssocList **,	scheme_specifics)
 {
     HTAASetup *setup;
 
@@ -408,7 +425,8 @@ PRIVATE HTAASetup *HTAASetup_new ARGS4(HTAAServer *,	server,
 ** ON EXIT:
 **	returns		nothing.
 */
-PRIVATE void HTAASetup_delete ARGS1(HTAASetup *, killme)
+PRIVATE void HTAASetup_delete ARGS1(
+	HTAASetup *,	killme)
 {
     int scheme;
 
@@ -438,14 +456,15 @@ PRIVATE void HTAASetup_delete ARGS1(HTAASetup *, killme)
 ** ON EXIT:
 **	returns		nothing.
 */
-PRIVATE void HTAASetup_updateSpecifics ARGS2(HTAASetup *,	setup,
-					     HTAssocList **,	specifics)
+PRIVATE void HTAASetup_updateSpecifics ARGS2(
+	HTAASetup *,	setup,
+	HTAssocList **,	specifics)
 {
     int scheme;
 
     if (setup) {
 	if (setup->scheme_specifics) {
-	    for (scheme=0; scheme < HTAA_MAX_SCHEMES; scheme++) {
+	    for (scheme = 0; scheme < HTAA_MAX_SCHEMES; scheme++) {
 		if (setup->scheme_specifics[scheme])
 		    HTAssocList_delete(setup->scheme_specifics[scheme]);
 	    }
@@ -467,8 +486,9 @@ PRIVATE void HTAASetup_updateSpecifics ARGS2(HTAASetup *,	setup,
 ** ON EXIT:
 **	returns		the realm.  NULL, if not found.
 */
-PRIVATE HTAARealm *HTAARealm_lookup ARGS2(HTList *,	realm_table,
-					  CONST char *, realmname)
+PRIVATE HTAARealm *HTAARealm_lookup ARGS2(
+	HTList *,	realm_table,
+	CONST char *,	realmname)
 {
     if (realm_table && realmname) {
 	HTList *cur = realm_table;
@@ -497,10 +517,11 @@ PRIVATE HTAARealm *HTAARealm_lookup ARGS2(HTList *,	realm_table,
 ** ON EXIT:
 **	returns		the created realm.
 */
-PRIVATE HTAARealm *HTAARealm_new ARGS4(HTList *,	realm_table,
-				       CONST char *,	realmname,
-				       CONST char *,	username,
-				       CONST char *,	password)
+PRIVATE HTAARealm *HTAARealm_new ARGS4(
+	HTList *,	realm_table,
+	CONST char *,	realmname,
+	CONST char *,	username,
+	CONST char *,	password)
 {
     HTAARealm *realm;
 
@@ -534,7 +555,8 @@ PRIVATE HTAARealm *HTAARealm_new ARGS4(HTList *,	realm_table,
 **
 ** ON ENTRY:
 **	scheme		is either HTAA_BASIC or HTAA_PUBKEY.
-**	realmname	is the password domain name.
+**	setup		is the current server setup.
+**	IsProxy		should be TRUE if this is a proxy.
 **
 ** ON EXIT:
 **	returns		a newly composed authorization string,
@@ -547,8 +569,10 @@ PRIVATE HTAARealm *HTAARealm_new ARGS4(HTList *,	realm_table,
 **	returned by AA package needs to (or should) be freed.
 **
 */
-PRIVATE char *compose_auth_string ARGS2(HTAAScheme,	scheme,
-					HTAASetup *,	setup)
+PRIVATE char *compose_auth_string ARGS3(
+	HTAAScheme,	scheme,
+	HTAASetup *,	setup,
+	BOOL,		IsProxy)
 {
     char *cleartext = NULL;	/* Cleartext presentation */
     char *ciphertext = NULL;	/* Encrypted presentation */
@@ -559,6 +583,7 @@ PRIVATE char *compose_auth_string ARGS2(HTAAScheme,	scheme,
     char *realmname = NULL;
     char *theHost = NULL;
     char *proxiedHost = NULL;
+    char *thePort = NULL;
     HTAARealm *realm;
     char *inet_addr = "0.0.0.0";	/* Change... @@@@ */
     char *timestamp = "42";		/* ... these @@@@ */
@@ -584,28 +609,60 @@ PRIVATE char *compose_auth_string ARGS2(HTAAScheme,	scheme,
 	        fprintf(stderr, "%s `%s' %s\n",
 			        "compose_auth_string: realm:", realmname,
 			        "not found -- creating");
-	    realm = HTAARealm_new(setup->server->realms, realmname, NULL,NULL);
+	    realm = HTAARealm_new(setup->server->realms,
+				  realmname, NULL, NULL);
 	}
-	len = strlen(realm->realmname) +
-	      strlen(setup->server->hostname ?
-	      	     setup->server->hostname : "??") + 40;
-	if (!(msg = (char*)calloc(1, sizeof(char) * len)))
-	    outofmem(__FILE__, "compose_auth_string");
-	if ((!auth_proxy) && using_proxy && setup->template) {
+	/*
+	 *  The template should be either the '*' global
+	 *  for everthing on the server (always true for
+	 *  proxy authorization setups), or a path for
+	 *  the start of a protected limb, with no host
+	 *  field, but we'll check for a host anyway in
+	 *  case a WWW-Protection-Template header set an
+	 *  absolute URL instead of a path.  If we do get
+	 *  a host from this, it will include the port. - FM
+	 */
+	if ((!IsProxy) && using_proxy && setup->template) {
 	    proxiedHost = HTParse(setup->template, "", PARSE_HOST);
 	    if (proxiedHost && *proxiedHost != '\0') {
 	        theHost = proxiedHost;
 	    }
 	}
+	/*
+	 *  If we didn't get a host field from the
+	 *  template, set up the host name and port
+	 *  from the setup->server elements. - FM
+	 */
 	if (!theHost)
 	    theHost = setup->server->hostname;
-	sprintf(msg, "Enter username for %s at %s:",
+	    if (setup->server->portnumber > 0 &&
+		setup->server->portnumber != 80) {
+		if (!(thePort = (char *)calloc(1, sizeof(char) * 40)))
+		    outofmem(__FILE__, "compose_auth_string");
+		sprintf(thePort, ":%d", setup->server->portnumber);
+	    }
+	/*
+	 *  Set up the message for the username prompt,
+	 *  and then issue the prompt.  The default
+	 *  username is included in the call to the
+	 *  prompting function, but the password is
+	 *  NULL-ed and always replaced. - FM
+	 */
+	len = strlen(realm->realmname) +
+	      strlen(theHost ?
+	      	     theHost : "??") + 50;
+	if (!(msg = (char *)calloc(1, sizeof(char) * len)))
+	    outofmem(__FILE__, "compose_auth_string");
+	sprintf(msg, "Username for '%s' at %s '%s%s':",
 		     realm->realmname,
-		     theHost ? theHost : "??");
+		     (IsProxy ? "proxy" : "server"),
+		     (theHost ? theHost : "??"),
+		     (thePort ? thePort : ""));
 	FREE(proxiedHost);
+	FREE(thePort);
 	username = realm->username;
 	password = NULL;
-	HTPromptUsernameAndPassword(msg, &username, &password);
+	HTPromptUsernameAndPassword(msg, &username, &password, IsProxy);
 
 	FREE(msg);
 	FREE(realm->username);
@@ -704,12 +761,13 @@ PRIVATE char *compose_auth_string ARGS2(HTAAScheme,	scheme,
 ** ON EXIT:
 **	returns	the authentication scheme to use.
 */
-PRIVATE HTAAScheme HTAA_selectScheme ARGS1(HTAASetup *, setup)
+PRIVATE HTAAScheme HTAA_selectScheme ARGS1(
+	HTAASetup *,	setup)
 {
     HTAAScheme scheme;
 
     if (setup && setup->valid_schemes) {
-	for (scheme=HTAA_BASIC; scheme < HTAA_MAX_SCHEMES; scheme++)
+	for (scheme = HTAA_BASIC; scheme < HTAA_MAX_SCHEMES; scheme++)
 	    if (-1 < HTList_indexOf(setup->valid_schemes, (void*)scheme))
 		return scheme;
     }
@@ -763,6 +821,7 @@ PRIVATE void free_HTAAGlobals NOARGS
 **	hostname	is the hostname of the server.
 **	portnumber	is the portnumber in which the server runs.
 **	docname		is the pathname of the document (as in URL)
+**	IsProxy		should be TRUE if this is a proxy.
 **
 ** ON EXIT:
 **	returns	NULL, if no authorization seems to be needed, or
@@ -772,9 +831,11 @@ PRIVATE void free_HTAAGlobals NOARGS
 **
 **		As usual, this string is automatically freed.
 */
-PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
-				    CONST int,		portnumber,
-				    CONST char *,	docname)
+PUBLIC char *HTAA_composeAuth ARGS4(
+	CONST char *,	hostname,
+	CONST int,	portnumber,
+	CONST char *,	docname,
+	BOOL,		IsProxy)
 {
     char *auth_string;
     BOOL retry;
@@ -809,7 +870,7 @@ PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
 
     FREE(HTAA_composeAuthResult);	/* From previous call */
 
-    if (auth_proxy) {
+    if (IsProxy) {
         /*
 	**  Proxy Authorization required. - AJL
 	*/
@@ -843,7 +904,8 @@ PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
 	}
 
 	if (!proxy_setup || !retry)
-	    proxy_setup = HTAASetup_lookup(hostname, portnumber, docname);
+	    proxy_setup = HTAASetup_lookup(hostname, portnumber,
+					   docname, IsProxy);
 
 	if (!proxy_setup)
 	    return NULL;
@@ -851,7 +913,7 @@ PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
     	switch (scheme = HTAA_selectScheme(proxy_setup)) {
 	  case HTAA_BASIC:
 	  case HTAA_PUBKEY:
-	    auth_string = compose_auth_string(scheme, proxy_setup);
+	    auth_string = compose_auth_string(scheme, proxy_setup, IsProxy);
 	    break;
 	  case HTAA_KERBEROS_V4:
 	    /* OTHER AUTHENTICATION ROUTINES ARE CALLED HERE */
@@ -859,8 +921,9 @@ PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
 	    {
 		char msg[100];
 		sprintf(msg, "%s %s `%s'",
-			"This client doesn't know how to compose proxy authentication",
-			"information for scheme", HTAAScheme_name(scheme));
+			     "This client doesn't know how to compose proxy",
+			     "authorization information for scheme",
+			     HTAAScheme_name(scheme));
 		HTAlert(msg);
 		auth_string = NULL;
 	    }
@@ -918,7 +981,8 @@ PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
 	}
 
 	if (!current_setup || !retry)
-	    current_setup = HTAASetup_lookup(hostname, portnumber, docname);
+	    current_setup = HTAASetup_lookup(hostname, portnumber,
+					     docname, IsProxy);
 
 	if (!current_setup)
 	    return NULL;
@@ -926,7 +990,7 @@ PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
 	switch (scheme = HTAA_selectScheme(current_setup)) {
 	  case HTAA_BASIC:
 	  case HTAA_PUBKEY:
-	    auth_string = compose_auth_string(scheme, current_setup);
+	    auth_string = compose_auth_string(scheme, current_setup, IsProxy);
 	    break;
 	  case HTAA_KERBEROS_V4:
 	    /* OTHER AUTHENTICATION ROUTINES ARE CALLED HERE */
@@ -934,8 +998,9 @@ PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
 	    {
 		char msg[100];
 		sprintf(msg, "%s %s `%s'",
-			"This client doesn't know how to compose authentication",
-			"information for scheme", HTAAScheme_name(scheme));
+			"This client doesn't know how to compose",
+			"authoritzation information for scheme",
+			HTAAScheme_name(scheme));
 		HTAlert(msg);
 		auth_string = NULL;
 	    }
@@ -980,6 +1045,7 @@ PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
 **			start of the header section.
 **	length		is the remaining length of the first block.
 **	soc		is the socket to read the rest of server reply.
+**	IsProxy		should be TRUE if this is a proxy.
 **
 **			This function should only be called when
 **			server has replied with a 401 (Unauthorized)
@@ -995,10 +1061,12 @@ PUBLIC char *HTAA_composeAuth ARGS3(CONST char *,	hostname,
 **				  field (in function HTAA_composeAuth()).
 **			NO, otherwise.
 */
-PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
-					   int,	   length,
-					   void *, handle,
-					   int,	   soc)
+PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS5(
+	char *,		start_of_headers,
+	int,		length,
+	void *,		handle,
+	int,		soc,
+	BOOL,		IsProxy)
 {
     HTAAScheme scheme;
     char *line = NULL;
@@ -1034,9 +1102,9 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
 	    char *arg1 = HTNextField(&p);
 	    char *args = p;
 
-	    if ((auth_proxy &&
+	    if ((IsProxy &&
 		 0==strcasecomp(fieldname, "Proxy-Authenticate:")) ||
-	        (!auth_proxy &&
+	        (!IsProxy &&
 		 0==strcasecomp(fieldname, "WWW-Authenticate:"))) {
 	        if (!(arg1 && *arg1 && args && *args)) {
 		    temp = (char *)calloc(1, strlen(line) +
@@ -1069,13 +1137,13 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
 		else if (TRACE) {
 		    fprintf(stderr, "Unknown scheme `%s' %s\n",
 			    (arg1 ? arg1 : "(null)"),
-			    (auth_proxy ?
+			    (IsProxy ?
 			     "in Proxy-Authenticate: field" :
 			     "in WWW-Authenticate: field"));
 		}
 	    }
 
-	    else if (!auth_proxy &&
+	    else if (!IsProxy &&
 		     0==strcasecomp(fieldname, "WWW-Protection-Template:")) {
 		if (TRACE)
 		    fprintf(stderr, "Protection template set to `%s'\n", arg1);
@@ -1095,10 +1163,10 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
     /*
     **  So should we retry with authorization?
     */
-    if (auth_proxy) {
+    if (IsProxy) {
 	if (num_schemes == 0) {
 	    /*
-	    **  No proxy authentication valid
+	    **  No proxy authorization valid
 	    */
 	    proxy_setup = NULL;
 	    return NO;
@@ -1135,10 +1203,12 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
 	    **  than we expected so far.
 	    */
 	    HTAAServer *server = HTAAServer_lookup(proxy_hostname,
-						   proxy_portnumber);
+						   proxy_portnumber,
+						   IsProxy);
 	    if (!server) {
 		server = HTAAServer_new(proxy_hostname,
-					proxy_portnumber);
+					proxy_portnumber,
+					IsProxy);
 	    }
 	    if (!template)	/* Proxy matches everything  -AJL */
 		StrAllocCopy(template, "*");
@@ -1148,7 +1218,7 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
 					  scheme_specifics);
 	    FREE(template);
 
-	    HTAlert("Proxy authentication required -- retrying");
+	    HTAlert("Proxy authorization required -- retrying");
 	    return YES;
 	}
 	/* Never reached */
@@ -1158,7 +1228,7 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
     */
     if (num_schemes == 0) {
 	/*
-	**  No authentication valid.
+	**  No authorization valid.
 	*/
 	current_setup = NULL;
 	return NO;
@@ -1192,10 +1262,12 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(char *, start_of_headers,
 	**  than we expected so far.
 	*/
 	HTAAServer *server = HTAAServer_lookup(current_hostname,
-					       current_portnumber);
+					       current_portnumber,
+					       IsProxy);
 	if (!server) {
 	    server = HTAAServer_new(current_hostname,
-				    current_portnumber);
+				    current_portnumber,
+				    IsProxy);
 	}
 	if (!template)
 	    template = HTAA_makeProtectionTemplate(current_docname);
diff --git a/WWW/Library/Implementation/HTAABrow.h b/WWW/Library/Implementation/HTAABrow.h
index cfe155dc..2674ae6b 100644
--- a/WWW/Library/Implementation/HTAABrow.h
+++ b/WWW/Library/Implementation/HTAABrow.h
@@ -78,9 +78,11 @@ Routines for Browser Side Recording of AA Info
 **
 **              As usual, this string is automatically freed.
 */
-PUBLIC char *HTAA_composeAuth PARAMS((CONST char * hostname,
-                                      CONST int   portnumber,
-                                      CONST char * docname));
+PUBLIC char *HTAA_composeAuth PARAMS((
+	CONST char *	hostname,
+	CONST int	portnumber,
+	CONST char *	docname,
+	BOOL		IsProxy));
 
 
 /* BROWSER PUBLIC                               HTAA_shouldRetryWithAuth()
@@ -110,10 +112,12 @@ PUBLIC char *HTAA_composeAuth PARAMS((CONST char * hostname,
 **                                field (in function HTAA_composeAuth()).
 **                      NO, otherwise.
 */
-PUBLIC BOOL HTAA_shouldRetryWithAuth PARAMS((char *     start_of_headers,
-                                             int        length,
-					     void *	handle,
-                                             int        soc));
+PUBLIC BOOL HTAA_shouldRetryWithAuth PARAMS((
+	char *		start_of_headers,
+	int		length,
+	void *		handle,
+	int		soc,
+	BOOL		IsProxy));
 /*
 
 Enabling Gateway httpds to Forward Authorization
@@ -125,8 +129,9 @@ Enabling Gateway httpds to Forward Authorization
    
  */
 
-PUBLIC void HTAAForwardAuth_set PARAMS((CONST char * scheme_name,
-                                        CONST char * scheme_specifics));
+PUBLIC void HTAAForwardAuth_set PARAMS((
+	CONST char *	scheme_name,
+	CONST char *	scheme_specifics));
 PUBLIC void HTAAForwardAuth_reset NOPARAMS;
 /*
 
diff --git a/WWW/Library/Implementation/HTAlert.c b/WWW/Library/Implementation/HTAlert.c
index 769db178..799db6cb 100644
--- a/WWW/Library/Implementation/HTAlert.c
+++ b/WWW/Library/Implementation/HTAlert.c
@@ -113,9 +113,10 @@ PUBLIC char * HTPromptPassword ARGS1(CONST char *, Msg)
 **	are NOT freed.
 **	
 */
-PUBLIC void HTPromptUsernameAndPassword ARGS3(CONST char *,	Msg,
+PUBLIC void HTPromptUsernameAndPassword ARGS4(CONST char *,	Msg,
 					      char **,		username,
-					      char **,		password)
+					      char **,		password,
+					      BOOL,		IsProxy)
 {
     if (Msg)
 	fprintf(stderr, "WWW: %s\n", Msg);
diff --git a/WWW/Library/Implementation/HTAlert.h b/WWW/Library/Implementation/HTAlert.h
index 73013918..ec1d2397 100644
--- a/WWW/Library/Implementation/HTAlert.h
+++ b/WWW/Library/Implementation/HTAlert.h
@@ -64,6 +64,8 @@ extern char * HTPromptPassword PARAMS((CONST char * Msg));
 **      *username and
 **      *password       are char pointers; they are changed
 **                      to point to result strings.
+**	IsProxy		should be TRUE if this is for
+**			proxy authentication.
 **
 **                      If *username is not NULL, it is taken
 **                      to point to  a default value.
@@ -79,7 +81,8 @@ extern char * HTPromptPassword PARAMS((CONST char * Msg));
 extern void HTPromptUsernameAndPassword PARAMS((
 	CONST char *	Msg,
 	char **		username,
-	char **		password));
+	char **		password,
+	BOOL		IsProxy));
 
 
 /*	Confirm a cookie operation.			HTConfirmCookie()
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c
index 304e55c6..2ce3042c 100644
--- a/WWW/Library/Implementation/HTAnchor.c
+++ b/WWW/Library/Implementation/HTAnchor.c
@@ -13,18 +13,23 @@
 **	(c) Copyright CERN 1991 - See Copyright.html
 */
 
-#define HASH_SIZE 8193		/* Arbitrary prime. Memory/speed tradeoff */
+#define HASH_SIZE 101		/* Arbitrary prime. Memory/speed tradeoff */
 
 #include "HTUtils.h"
 #include "tcp.h"
 #include <ctype.h>
 #include "HTAnchor.h"
 #include "HTParse.h"
+#ifdef EXP_CHARTRANS
+#include "UCMap.h"
+#endif /* EXP_CHARTRANS */
 
 #include "LYLeaks.h"
 
 #define FREE(x) if (x) {free(x); x = NULL;}
 
+extern LYUCcharset LYCharSet_UC[];
+
 #ifdef NOT_DEFINED
 /*
  *	This is the hashing function used to determine which list in the
@@ -37,7 +42,7 @@
 /*
  *	This is the original function.  We'll use it again. - FM
  */ 
-PUBLIC int HASH_FUNCTION ARGS1(
+PRIVATE int HASH_FUNCTION ARGS1(
 	CONST char *,	cp_address)
 {
     int hash;
@@ -173,7 +178,10 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2(
 	    fprintf(stderr, "HTAnchor_findChild called with NULL parent.\n");
         return NULL;
     }
-    if ((kids = parent->children) != 0) {  /* parent has children : search them */
+    if ((kids = parent->children) != 0) {
+	/*
+	**  Parent has children.  Search them.
+	*/
         if (tag && *tag) {		/* TBL */
 	    while (NULL != (child=(HTChildAnchor *)HTList_nextObject(kids))) {
 #ifdef CASE_INSENSITIVE_ANCHORS
@@ -633,7 +641,7 @@ PUBLIC BOOL HTAnchor_delete ARGS1(
     FREE(me->RevTitle);
     if (me->FileCache) {
 	FILE *fd;
-	if ((fd = fopen(me->FileCache, "r")) != 0) {
+	if ((fd = fopen(me->FileCache, "r")) != NULL) {
 	    fclose(fd);
 	    remove(me->FileCache);
 	}
@@ -1132,44 +1140,42 @@ PUBLIC void HTAnchor_setPhysical ARGS2(
 
 #ifdef EXP_CHARTRANS
 
-#include "UCMap.h"
-extern LYUCcharset LYCharSet_UC[];
-
-/* We store charset info in the HTParentAnchor object, for several
-** "stages".  (See UCDefs.h)
-** A stream method is supposed to know what stage in the model it is.
+/*
+**  We store charset info in the HTParentAnchor object, for several
+**  "stages".  (See UCDefs.h)
+**  A stream method is supposed to know what stage in the model it is.
 ** 
-** General model       MIME     ->  parser  ->  structured  ->  HText
-** e.g. text/html
-**     from HTTP:      HTMIME.c ->  SGML.c  ->  HTML.c      ->  GridText.c
-**   text/plain  
-**     from file:      HTFile.c ->  HTPlain.c               ->  GridText.c
+**  General model       MIME     ->  parser  ->  structured  ->  HText
+**  e.g., text/html
+**      from HTTP:      HTMIME.c ->  SGML.c  ->  HTML.c      ->  GridText.c
+**     text/plain  
+**      from file:      HTFile.c ->  HTPlain.c               ->  GridText.c
 **
-** The lock/set_by is used to lock e.g. a charset set by an explicit
-** HTTP MIME header against overriding by a HTML META tag - the MIME 
-** header has higher priority.  Defaults (from -assume_.. options etc.) 
-** will not override charset explicitly given by server.
+**  The lock/set_by is used to lock e.g. a charset set by an explicit
+**  HTTP MIME header against overriding by a HTML META tag - the MIME 
+**  header has higher priority.  Defaults (from -assume_.. options etc.) 
+**  will not override charset explicitly given by server.
 **
-** Some advantages of keeping this in the HTAnchor:
-** - Global variables are bad.
-** - Can remember a charset given by META tag when toggling to SOURCE view.
-** - Can remember a charset given by <A CHARSET=...> href in another doc.
+**  Some advantages of keeping this in the HTAnchor:
+**  - Global variables are bad.
+**  - Can remember a charset given by META tag when toggling to SOURCE view.
+**  - Can remember a charset given by <A CHARSET=...> href in another doc.
 **
-** We don't modify the HTParentAnchor's charset element
-** here, that one will only be set when explicitly given.
+**  We don't modify the HTParentAnchor's charset element
+**  here, that one will only be set when explicitly given.
 */
 PUBLIC LYUCcharset * HTAnchor_getUCInfoStage ARGS2(
-    HTParentAnchor *, me,
-    int, 	which_stage)
+	HTParentAnchor *,	me,
+	int,			which_stage)
 {
     if (me && !me->UCStages) {
 	int i;
 	int chndl = UCLYhndl_for_unspec;
-	UCAnchorInfo * stages =
-	    (UCAnchorInfo*) calloc(1, sizeof(UCAnchorInfo));
+	UCAnchorInfo * stages = (UCAnchorInfo*)calloc(1,
+						      sizeof(UCAnchorInfo));
 	if (stages == NULL)
             outofmem(__FILE__, "HTAnchor_getUCInfoStage");
-	for(i = 0; i < UCT_STAGEMAX; i++) {
+	for (i = 0; i < UCT_STAGEMAX; i++) {
 	    stages->s[i].C.MIMEname = "";
 	    stages->s[i].LYhndl = -1;
 	}
@@ -1183,8 +1189,10 @@ PUBLIC LYUCcharset * HTAnchor_getUCInfoStage ARGS2(
 	    memcpy(&stages->s[UCT_STAGE_MIME].C, &LYCharSet_UC[chndl],
 		   sizeof(LYUCcharset));
 	    stages->s[UCT_STAGE_MIME].lock = UCT_SETBY_DEFAULT;
-	}
-	else {			/* should not happen... */
+	} else {
+	    /*
+	     *  Should not happen...
+	     */
 	    stages->s[UCT_STAGE_MIME].C.UChndl = -1;
 	    stages->s[UCT_STAGE_MIME].lock = UCT_SETBY_NONE;
 	}
@@ -1198,36 +1206,42 @@ PUBLIC LYUCcharset * HTAnchor_getUCInfoStage ARGS2(
 }
 
 PUBLIC int HTAnchor_getUCLYhndl ARGS2(
-    HTParentAnchor *, me,
-    int,	 which_stage)
+	HTParentAnchor *,	me,
+	int, 			which_stage)
 {
     if (me) {
 	if (!me->UCStages) {
-	    /* this will allocate and initialize, if not yet done */
+	    /*
+	     *  This will allocate and initialize, if not yet done.
+	     */
 	    (void) HTAnchor_getUCInfoStage(me, which_stage);
 	}
-	if (me->UCStages->s[which_stage].lock > UCT_SETBY_NONE)
+	if (me->UCStages->s[which_stage].lock > UCT_SETBY_NONE) {
 	    return me->UCStages->s[which_stage].LYhndl;
+	}
     }
     return -1;
 }
 
 PUBLIC LYUCcharset * HTAnchor_setUCInfoStage ARGS4(
-    HTParentAnchor *, me,
-    int,	 LYhndl,
-    int,	 which_stage,
-    int,	 set_by)
+	HTParentAnchor *,	me,
+	int,			LYhndl,
+	int,			which_stage,
+	int,			set_by)
 {
     if (me) {
-	/* this will allocate and initialize, if not yet done */
+	/*
+	 *  This will allocate and initialize, if not yet done.
+	 */
 	LYUCcharset * p = HTAnchor_getUCInfoStage(me, which_stage);
-	/* Can we override? */
+	/*
+	 *  Can we override?
+	 */
 	if (set_by >= me->UCStages->s[which_stage].lock) {
 	    me->UCStages->s[which_stage].lock = set_by;
 	    me->UCStages->s[which_stage].LYhndl = LYhndl;
 	    if (LYhndl >= 0) {
-		memcpy(p, &LYCharSet_UC[LYhndl],
-		       sizeof(LYUCcharset));
+		memcpy(p, &LYCharSet_UC[LYhndl], sizeof(LYUCcharset));
 	    }
 	    else {
 		p->UChndl = -1;
@@ -1237,11 +1251,12 @@ PUBLIC LYUCcharset * HTAnchor_setUCInfoStage ARGS4(
     }
     return NULL;
 }
+
 PUBLIC LYUCcharset * HTAnchor_resetUCInfoStage ARGS4(
-    HTParentAnchor *, me,
-    int,	 LYhndl,
-    int,	 which_stage,
-    int,	 set_by)
+	HTParentAnchor *,	me,
+	int,			LYhndl,
+	int,			which_stage,
+	int,			set_by)
 {
     if (!me || !me->UCStages)
 	return NULL;
@@ -1250,18 +1265,24 @@ PUBLIC LYUCcharset * HTAnchor_resetUCInfoStage ARGS4(
     return &me->UCStages->s[which_stage].C;
 }
 
-/* A set_by of (-1) means use the lock value from the from_stage */
+/*
+**  A set_by of (-1) means use the lock value from the from_stage.
+*/
 PUBLIC LYUCcharset * HTAnchor_copyUCInfoStage ARGS4(
-    HTParentAnchor *, me,
-    int,	 to_stage,
-    int,	 from_stage,
-    int,	 set_by)
+	HTParentAnchor *,	me,
+	int,			to_stage,
+	int,			from_stage,
+	int,			set_by)
 {
     if (me) {
-	/* this will allocate and initialize, if not yet done */
+	/*
+	 *  This will allocate and initialize, if not yet done.
+	 */
 	LYUCcharset * p_from = HTAnchor_getUCInfoStage(me, from_stage);
 	LYUCcharset * p_to = HTAnchor_getUCInfoStage(me, to_stage);
-	/* Can we override? */
+	/*
+	 *  Can we override?
+	 */
 	if (set_by == -1)
 	    set_by = me->UCStages->s[from_stage].lock;
 	if (set_by == UCT_SETBY_NONE)
@@ -1279,5 +1300,4 @@ PUBLIC LYUCcharset * HTAnchor_copyUCInfoStage ARGS4(
     }
     return NULL;
 }
-
 #endif /* EXP_CHARTRANS */
diff --git a/WWW/Library/Implementation/HTAnchor.h b/WWW/Library/Implementation/HTAnchor.h
index db875cac..052290cf 100644
--- a/WWW/Library/Implementation/HTAnchor.h
+++ b/WWW/Library/Implementation/HTAnchor.h
@@ -159,9 +159,6 @@ typedef struct _DocAddress {
 
 #define LINK_INTERNAL HTAtom_for("internal link")
 
-extern int HASH_FUNCTION PARAMS((
-	CONST char * 	cp_address));
-
 /*      Create new or find old sub-anchor
 **      ---------------------------------
 **
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index dfca3a4f..f7a9a74f 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -177,6 +177,7 @@ PRIVATE int data_soc = -1;		/* Socket for data transfer =invalid */
 #define WINDOWS_NT_SERVER  9
 #define MS_WINDOWS_SERVER 10
 #define MSDOS_SERVER      11
+#define APPLESHARE_SERVER 12
 
 PRIVATE int     server_type = GENERIC_SERVER;   /* the type of ftp host */
 PRIVATE int     unsure_type = FALSE;            /* sure about the type? */
@@ -499,12 +500,22 @@ PRIVATE int response ARGS1(
     return result/100;
 }
 
-/* this function should try to set the macintosh server into binary mode
+/*
+ *  This function should try to set the macintosh server into binary mode.
+ *  Some servers need an additional letter after the MACB command.
  */
-PRIVATE int set_mac_binary NOARGS
+PRIVATE int set_mac_binary ARGS1(
+        int,		server_type)
 {
     /* try to set mac binary mode */
-    return(2 == response("MACB\r\n"));
+    if (server_type == APPLESHARE_SERVER) {
+	/*
+	 *  Presumably E means "Enable"  - kw
+	 */
+	return(2 == response("MACB E\r\n"));
+    } else {
+	return(2 == response("MACB\r\n"));
+    }
 }
 
 /* This function gets the current working directory to help
@@ -536,7 +547,7 @@ PRIVATE void get_ftp_pwd ARGS2(
             /* path names beginning with / imply Unix,
 	     * right? 
 	     */
-	    if (set_mac_binary()) {
+	    if (set_mac_binary(*server_type)) {
 		*server_type = NCSA_SERVER;
 		if (TRACE)
 	            fprintf(stderr, "HTFTP: Treating as NCSA server.\n");
@@ -562,7 +573,7 @@ PRIVATE void get_ftp_pwd ARGS2(
         if ((*server_type == NCSA_SERVER) ||
             (*server_type == TCPC_SERVER) ||
             (*server_type == PETER_LEWIS_SERVER))
-            set_mac_binary();
+            set_mac_binary(*server_type);
     }
 }
 
@@ -878,7 +889,7 @@ PRIVATE int get_connection ARGS1(
         } else if (strncmp(response_text+4, "MACOS Peter's Server", 20) == 0) {
             server_type = PETER_LEWIS_SERVER;
             use_list = TRUE;
-            set_mac_binary();
+            set_mac_binary(server_type);
 	    if (TRACE)
 	        fprintf(stderr,
 	 	 	"HTFTP: Treating as Peter Lewis (MACOS) server.\n");
@@ -895,6 +906,15 @@ PRIVATE int get_connection ARGS1(
 	    if (TRACE)
 	        fprintf(stderr, "HTFTP: Treating as MS Windows server.\n");
 
+        } else if (strncmp(response_text+4,
+			   "MACOS AppleShare IP FTP Server", 30) == 0) {
+            server_type = APPLESHARE_SERVER;
+            use_list = TRUE;
+            set_mac_binary(server_type);
+	    if (TRACE)
+	        fprintf(stderr,
+	 	 	"HTFTP: Treating as AppleShare server.\n");
+
 	} else  {
 	    server_type = GENERIC_SERVER;
 	    if (TRACE)
@@ -1902,6 +1922,7 @@ PRIVATE EntryInfo * parse_dir_entry ARGS2(
         case MACHTEN_SERVER:
 	case MSDOS_SERVER:
         case WINDOWS_NT_SERVER:
+        case APPLESHARE_SERVER:
 	    /*
 	    **  Check for EPLF output (local times).
 	    */
@@ -2513,6 +2534,15 @@ unload_btree:
     }
 
     FREE(lastpath);
+
+    if (server_type == APPLESHARE_SERVER) {
+	/*
+	 *  Without closing the data socket first,
+	 *  the response(NIL) below hangs... - kw
+	 */
+	NETCLOSE(data_soc);
+    }
+
     if (WasInterrupted || HTCheckForInterrupt()) {
         if (server_type != CMS_SERVER)
             response(NIL);
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 1565e629..2b8b61b8 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -791,40 +791,38 @@ PUBLIC HTFormat HTCharsetFormat ARGS3(
 	while (*cp2 == ' ' || *cp2 == '=')
 	    cp2++;
 #ifdef EXP_CHARTRANS
-			    StrAllocCopy(cp3, cp2); /* copy to mutilate more */
-			    for (cp4=cp3; (*cp4 != '\0' && *cp4 != '"' &&
-					   *cp4 != ';'  && *cp4 != ':' &&
-					   !WHITE(*cp4));	cp4++)
-				/* nothing */ ;
-			    *cp4 = '\0';
-			    cp4 = cp3;
-			    chndl = UCGetLYhndl_byMIME(cp3);
-			    if (chndl < 0) {
-				if (0==strcmp(cp4, "cn-big5")) {
-				    cp4 += 3;
-				    chndl = UCGetLYhndl_byMIME(cp4);
-				}
-				else if (0==strncmp(cp4, "cn-gb", 5)) {
-				    StrAllocCopy(cp3, "gb2312");
-				    cp4 = cp3;
-				    chndl = UCGetLYhndl_byMIME(cp4);
-				}
-			    }
-			    if (UCCanTranslateFromTo(chndl, current_char_set))
-			    {
+	StrAllocCopy(cp3, cp2); /* copy to mutilate more */
+	for (cp4=cp3; (*cp4 != '\0' && *cp4 != '"' &&
+		       *cp4 != ';'  && *cp4 != ':' &&
+		       !WHITE(*cp4)); cp4++) {
+	    ; /* do nothing */
+	}
+	*cp4 = '\0';
+	cp4 = cp3;
+	chndl = UCGetLYhndl_byMIME(cp3);
+	if (chndl < 0) {
+	    if (!strcmp(cp4, "cn-big5")) {
+		cp4 += 3;
+		chndl = UCGetLYhndl_byMIME(cp4);
+	    } else if (!strncmp(cp4, "cn-gb", 5)) {
+		StrAllocCopy(cp3, "gb2312");
+		cp4 = cp3;
+		chndl = UCGetLYhndl_byMIME(cp4);
+	    }
+	}
+	if (UCCanTranslateFromTo(chndl, current_char_set)) {
 				chartrans_ok = YES;
 				*cp1 = '\0';
 				format = HTAtom_for(cp);
 				StrAllocCopy(anchor->charset, cp4);
 				HTAnchor_setUCInfoStage(anchor, chndl,
 				   UCT_STAGE_MIME, UCT_SETBY_MIME);
-			    }
-			    else if (chndl < 0)	{/* got something but we don't
-						 recognize it */
+	} else if (chndl < 0) {
+	    /*
+	    **  Got something but we don't recognize it.
+	    */
 				chndl = UCLYhndl_for_unrec;
-				if (UCCanTranslateFromTo(chndl,
-							 current_char_set))
-				{
+	    if (UCCanTranslateFromTo(chndl, current_char_set)) {
 				    chartrans_ok = YES;
 				    HTAnchor_setUCInfoStage(anchor, chndl,
 				       UCT_STAGE_MIME, UCT_SETBY_DEFAULT);
@@ -832,43 +830,46 @@ PUBLIC HTFormat HTCharsetFormat ARGS3(
 			    }
 			    FREE(cp3);
 			    if (chartrans_ok) {
-				LYUCcharset * p_in =
-				    HTAnchor_getUCInfoStage(anchor,
+	    LYUCcharset *p_in = HTAnchor_getUCInfoStage(anchor,
 							     UCT_STAGE_MIME);
-				LYUCcharset * p_out =
-				    HTAnchor_setUCInfoStage(anchor,
+	    LYUCcharset *p_out = HTAnchor_setUCInfoStage(anchor,
 							    current_char_set,
-					 UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT);
-				if (!p_out) /* try again */
-				    p_out =
-				      HTAnchor_getUCInfoStage(anchor,
-							     UCT_STAGE_HTEXT);
-
-				if (0==strcmp(p_in->MIMEname,"x-transparent"))
-				{
-				    HTPassEightBitRaw = TRUE;
-				    HTAnchor_setUCInfoStage(anchor,
-				       HTAnchor_getUCLYhndl(anchor,
-							    UCT_STAGE_HTEXT),
-				       UCT_STAGE_MIME, UCT_SETBY_DEFAULT);
-				}
-				if (0==strcmp(p_out->MIMEname,"x-transparent"))
-				{
-				    HTPassEightBitRaw = TRUE;
-				    HTAnchor_setUCInfoStage(anchor,
-				       HTAnchor_getUCLYhndl(anchor,
-							    UCT_STAGE_MIME),
-				       UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT);
-				}
-				if (!(p_in->enc & UCT_ENC_CJK) &&
-				    (p_in->codepoints & UCT_CP_SUBSETOF_LAT1)){
-				    HTCJK = NOCJK;
-				} else if (chndl == current_char_set) {
-				HTPassEightBitRaw = TRUE;
-				}
-			} else  /* Fall through to old behavior */
+							 UCT_STAGE_HTEXT,
+							 UCT_SETBY_DEFAULT);
+	    if (!p_out) {
+		/*
+		**  Try again.
+		*/
+		p_out = HTAnchor_getUCInfoStage(anchor, UCT_STAGE_HTEXT);
+	    }
+	    if (!strcmp(p_in->MIMEname, "x-transparent")) {
+		HTPassEightBitRaw = TRUE;
+		HTAnchor_setUCInfoStage(anchor,
+					HTAnchor_getUCLYhndl(anchor,
+							     UCT_STAGE_HTEXT),
+					UCT_STAGE_MIME,
+					UCT_SETBY_DEFAULT);
+	    }
+	    if (!strcmp(p_out->MIMEname, "x-transparent")) {
+		HTPassEightBitRaw = TRUE;
+		HTAnchor_setUCInfoStage(anchor,
+					HTAnchor_getUCLYhndl(anchor,
+							     UCT_STAGE_MIME),
+					UCT_STAGE_HTEXT,
+					UCT_SETBY_DEFAULT);
+	    }
+	    if (!(p_in->enc & UCT_ENC_CJK) &&
+		(p_in->codepoints & UCT_CP_SUBSETOF_LAT1)){
+		HTCJK = NOCJK;
+	    } else if (chndl == current_char_set) {
+		HTPassEightBitRaw = TRUE;
+	    }
+	/*
+	**  Fall through to old behavior.
+	*/
+	} else
 #endif /* EXP_CHARTRANS */
-	if (!strncmp(cp2, "us-ascii", 8) ||
+	    if (!strncmp(cp2, "us-ascii", 8) ||
 	    !strncmp(cp2, "iso-8859-1", 10)) {
 	    *cp1 = '\0';
 	    format = HTAtom_for(cp);
@@ -953,6 +954,14 @@ PUBLIC HTFormat HTCharsetFormat ARGS3(
 	    format = HTAtom_for(cp);
 	    StrAllocCopy(anchor->charset, "iso-2022-cn");
 	}
+    } else if (cp1 != NULL) {
+	/*
+	**  No charset parameter is present.
+	**  Ignore all other parameters, as
+	**  we do when charset is present. - FM
+	*/
+	*cp1 = '\0';
+	format = HTAtom_for(cp);
     }
     FREE(cp);
 
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index 59d0313b..6e34c16b 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -30,8 +30,11 @@ extern char *LYchar_set_names[];
 extern BOOL HTPassEightBitRaw;
 extern HTCJKlang HTCJK;
 
-extern void LYSetCookie PARAMS((CONST char *header, CONST char *address));
-extern time_t LYmktime PARAMS((char *string));
+extern void LYSetCookie PARAMS((
+	CONST char *	SetCookie,
+	CONST char *	SetCookie2,
+	CONST char *	address));
+extern time_t LYmktime PARAMS((char *string, BOOL absolute));
 
 
 /*		MIME Object
@@ -88,6 +91,8 @@ typedef enum _MIME_state {
 	miSE,
 	miSERVER,
 	miSET_COOKIE,
+	miSET_COOKIE1,
+	miSET_COOKIE2,
 	miT,
 	miTITLE,
 	miTRANSFER_ENCODING,
@@ -128,6 +133,8 @@ struct _HTStream {
 	HTStream *		sink;		/* Given on creation */
 	
 	char *			boundary;	/* For multipart */
+	char *			set_cookie;	/* Set-Cookie */
+	char *			set_cookie2;	/* Set-Cookie2 */
 	
 	HTFormat		encoding;	/* Content-Transfer-Encoding */
 	char *			compression_encoding;
@@ -139,13 +146,13 @@ struct _HTStream {
 };
 
 /*
-**  This function if for trimming off any paired
+**  This function is for trimming off any paired
 **  open- and close-double quotes from header values.
 **  It does not parse the string for embedded quotes,
 **  and will not modify the string unless both the
 **  first and last characters are double-quotes. - FM
 */
-PRIVATE void HTMIME_TrimDoubleQuotes ARGS1(
+PUBLIC void HTMIME_TrimDoubleQuotes ARGS1(
 	char *,		value)
 {
     int i;
@@ -187,9 +194,10 @@ PRIVATE void HTMIME_put_character ARGS2(
 	return;
     }
 
-    /* This slightly simple conversion just strips CR and turns LF to
-    ** newline. On unix LF is \n but on Mac \n is CR for example.
-    ** See NetToText for an implementation which preserves single CR or LF.
+    /*
+    **  This slightly simple conversion just strips CR and turns LF to
+    **  newline.  On unix LF is \n but on Mac \n is CR for example.
+    **  See NetToText for an implementation which preserves single CR or LF.
     */
     if (me->net_ascii) {
         c = FROMASCII(c);
@@ -355,10 +363,11 @@ PRIVATE void HTMIME_put_character ARGS2(
 		    */
 		    for (i = 0; cp[i]; i++)
 		        cp[i] = TOLOWER(cp[i]);
-		    if ((cp1=strchr(cp, ';')) != NULL) {
+		    if ((cp1 = strchr(cp, ';')) != NULL) {
 			BOOL chartrans_ok = NO;
-		        if ((cp2=strstr(cp1, "charset")) != NULL) {
+		        if ((cp2 = strstr(cp1, "charset")) != NULL) {
 			    int chndl;
+
 			    cp2 += 7;
 			    while (*cp2 == ' ' || *cp2 == '=' || *cp2 == '\"')
 			        cp2++;
@@ -554,10 +563,50 @@ PRIVATE void HTMIME_put_character ARGS2(
 				StrAllocCopy(me->anchor->charset,
 					     "iso-2022-cn");
 			    }
+			} else {
+			    /*
+			    **  No charset parameter is present.
+			    **  Ignore all other parameters, as
+			    **  we do when charset is present. - FM
+			    */
+			    *cp1 = '\0';
+			    me->format = HTAtom_for(cp);
 			}
 		    }
 		    FREE(cp);
 		}
+		/*
+		**  If we have an Expires header and haven't
+		**  already set the no_cache element for the
+		**  anchor, check if we should set it based
+		**  on that header. - FM
+		*/
+		if (me->anchor->no_cache == FALSE &&
+		    me->anchor->expires != NULL) {
+		    if (!strcmp(me->anchor->expires, "0")) {
+			/*
+			 *  The value is zero, which we treat as
+			 *  an absolute no-cache directive. - FM
+			 */
+			me->anchor->no_cache = TRUE;
+		    } else if (me->anchor->date != NULL) {
+		        /*
+			**  We have a Date header, so check if
+			**  the value is less than or equal to
+			**  that. - FM
+			*/
+			if (LYmktime(me->anchor->expires, TRUE) <=
+			    LYmktime(me->anchor->date, TRUE)) {
+			    me->anchor->no_cache = TRUE;
+			}
+		    } else if (LYmktime(me->anchor->expires, FALSE) <= 0) {
+		        /*
+			**  We don't have a Date header, and
+			**  the value is in past for us. - FM
+			*/
+			me->anchor->no_cache = TRUE;
+		    }
+		}
 		StrAllocCopy(me->anchor->content_type,
 			     HTAtom_name(me->format));
 		if (!me->compression_encoding) {
@@ -582,6 +631,13 @@ PRIVATE void HTMIME_put_character ARGS2(
 			 HTAtom_name(me->format), HTAtom_name(me->targetRep));
 		    }
 		}
+		if (me->set_cookie != NULL || me->set_cookie2 != NULL) {
+		    LYSetCookie(me->set_cookie,
+				me->set_cookie2,
+				me->anchor->address);
+		    FREE(me->set_cookie);
+		    FREE(me->set_cookie2);
+		}
 		me->target = HTStreamStack(me->format, me->targetRep,
 	 				   me->sink , me->anchor);
 		if (!me->target) {
@@ -958,7 +1014,7 @@ PRIVATE void HTMIME_put_character ARGS2(
 
 	case 't':
 	case 'T':
-	    me->check_pointer = "-cookie:";
+	    me->check_pointer = "-cookie";
 	    me->if_ok = miSET_COOKIE;
 	    me->state = miCHECK;
 	    if (TRACE)
@@ -977,6 +1033,36 @@ PRIVATE void HTMIME_put_character ARGS2(
 	} /* switch on character */
 	break;
 
+    case miSET_COOKIE:			/* Check for ':' or '2' */
+        switch (c) {
+	case ':':
+	    me->field = miSET_COOKIE1;		/* remember it */
+	    me->state = miSKIP_GET_VALUE;
+	    if (TRACE)
+	        fprintf(stderr,
+			"HTMIME: Was SET_COOKIE, found :, processing\n");
+	    break;
+
+	case '2':
+	    me->check_pointer = ":";
+	    me->if_ok = miSET_COOKIE2;
+	    me->state = miCHECK;
+	    if (TRACE)
+	        fprintf(stderr,
+		 "HTMIME: Was SET_COOKIE, found 2, checking for ':'\n");
+	    break;
+
+	default:
+	    if (TRACE)
+	        fprintf(stderr,
+		   "HTMIME: Bad character `%c' found where `%s' expected\n",
+		        c, "':' or '2'");
+	    goto bad_field_name;
+	    break;
+
+	} /* switch on character */
+	break;
+
     case miT:				/* Check for 'i' or 'r' */
         switch (c) {
  	case 'i':
@@ -1314,7 +1400,8 @@ PRIVATE void HTMIME_put_character ARGS2(
     case miRETRY_AFTER:
     case miSAFE:
     case miSERVER:
-    case miSET_COOKIE:
+    case miSET_COOKIE1:
+    case miSET_COOKIE2:
     case miTITLE:
     case miTRANSFER_ENCODING:
     case miUPGRADE:
@@ -1397,8 +1484,8 @@ PRIVATE void HTMIME_put_character ARGS2(
 		    me->value[i] = TOLOWER(me->value[i]);
 		StrAllocCopy(me->anchor->cache_control, me->value);
 		/*
-		 *  Check whether to set no_cache for the anchor. - FM
-		 */
+		**  Check whether to set no_cache for the anchor. - FM
+		*/
 		{
 		    char *cp, *cp0 = me->value;
 
@@ -1692,12 +1779,6 @@ PRIVATE void HTMIME_put_character ARGS2(
 		**  Indicate in anchor. - FM
 		*/
 		StrAllocCopy(me->anchor->expires, me->value);
-		/*
-		**  Check whether to set no_cache for the anchor. - FM
-		*/
-		if ((me->value[0] == '0' && me->value[1] == '\0') ||
-		    LYmktime(me->value) <= 0)
-		    me->anchor->no_cache = TRUE;
                 break;
 	    case miKEEP_ALIVE:
 	        HTMIME_TrimDoubleQuotes(me->value);
@@ -1742,8 +1823,8 @@ PRIVATE void HTMIME_put_character ARGS2(
 		if (!(me->value && *me->value))
 		    break;
 		/*
-		 *  Check whether to set no_cache for the anchor. - FM
-		 */
+		**  Check whether to set no_cache for the anchor. - FM
+		*/
 		if (!strcmp(me->value, "no-cache"))
 		    me->anchor->no_cache = TRUE;
                 break;
@@ -1797,13 +1878,31 @@ PRIVATE void HTMIME_put_character ARGS2(
 		*/
 		StrAllocCopy(me->anchor->server, me->value);
                 break;
-	    case miSET_COOKIE:
+	    case miSET_COOKIE1:
 	        HTMIME_TrimDoubleQuotes(me->value);
                 if (TRACE)
                     fprintf(stderr,
                             "HTMIME: PICKED UP Set-Cookie: '%s'\n",
 			    me->value);
-		LYSetCookie(me->value, me->anchor->address);
+		if (me->set_cookie == NULL) {
+		    StrAllocCopy(me->set_cookie, me->value);
+		} else {
+		    StrAllocCat(me->set_cookie, ", ");
+		    StrAllocCat(me->set_cookie, me->value);
+		}
+                break;
+	    case miSET_COOKIE2:
+	        HTMIME_TrimDoubleQuotes(me->value);
+                if (TRACE)
+                    fprintf(stderr,
+                            "HTMIME: PICKED UP Set-Cookie2: '%s'\n",
+			    me->value);
+		if (me->set_cookie2 == NULL) {
+		    StrAllocCopy(me->set_cookie2, me->value);
+		} else {
+		    StrAllocCat(me->set_cookie2, ", ");
+		    StrAllocCat(me->set_cookie2, me->value);
+		}
                 break;
 	    case miTITLE:
 	        HTMIME_TrimDoubleQuotes(me->value);
@@ -1959,7 +2058,6 @@ PRIVATE void HTMIME_free ARGS1(
 
 /*	End writing
 */
-
 PRIVATE void HTMIME_abort ARGS2(
 	HTStream *,	me,
 	HTError,	e)
@@ -1987,7 +2085,6 @@ PRIVATE CONST HTStreamClass HTMIME =
 /*	Subclass-specific Methods
 **	-------------------------
 */
-
 PUBLIC HTStream* HTMIMEConvert ARGS3(
 	HTPresentation *,	pres,
 	HTParentAnchor *,	anchor,
@@ -2042,6 +2139,8 @@ PUBLIC HTStream* HTMIMEConvert ARGS3(
     me->format	  =	WWW_HTML;
     me->targetRep =	pres->rep_out;
     me->boundary  =	NULL;		/* Not set yet */
+    me->set_cookie  =	NULL;		/* Not set yet */
+    me->set_cookie2  =	NULL;		/* Not set yet */
     me->encoding  =	0;		/* Not set yet */
     me->compression_encoding = NULL;	/* Not set yet */
     me->net_ascii =	NO;		/* Local character set */
@@ -2102,11 +2201,11 @@ PUBLIC HTStream* HTNetMIME ARGS3(
 /* #include <string.h> */	/* Included via previous headers. - FM */
 
 /*
- *  MIME decoding routines
- *
- *	Written by S. Ichikawa,
- *	partially inspired by encdec.c of <jh@efd.lth.se>.
- */
+**  MIME decoding routines
+**
+**	Written by S. Ichikawa,
+**	partially inspired by encdec.c of <jh@efd.lth.se>.
+*/
 #define	BUFLEN	1024
 #ifdef ESC
 #undef ESC
diff --git a/WWW/Library/Implementation/HTMIME.h b/WWW/Library/Implementation/HTMIME.h
index 94b9665c..823f6c76 100644
--- a/WWW/Library/Implementation/HTMIME.h
+++ b/WWW/Library/Implementation/HTMIME.h
@@ -27,6 +27,16 @@
 #include "HTAnchor.h"
 
 /*
+**  This function is for trimming off any paired
+**  open- and close-double quotes from header values.
+**  It does not parse the string for embedded quotes,
+**  and will not modify the string unless both the
+**  first and last characters are double-quotes. - FM
+*/
+extern void HTMIME_TrimDoubleQuotes PARAMS((
+	char *		value));
+
+/*
 
   INPUT: LOCAL TEXT
   
diff --git a/WWW/Library/Implementation/HTML.h b/WWW/Library/Implementation/HTML.h
index 6cdcc828..2aaa8c0f 100644
--- a/WWW/Library/Implementation/HTML.h
+++ b/WWW/Library/Implementation/HTML.h
@@ -50,6 +50,7 @@ struct _HTStructured {
     HTStreamClass		targetClass;		/* Output routines */
 
     HTChildAnchor *		CurrentA;	/* current HTML_A anchor */
+    int				CurrentANum;	/* current HTML_A number */
     char *			base_href;	/* current HTML_BASE href */
     char *			map_address;	/* current HTML_MAP address */
 
diff --git a/WWW/Library/Implementation/HTMLDTD.c b/WWW/Library/Implementation/HTMLDTD.c
index 54f14681..d8594d0a 100644
--- a/WWW/Library/Implementation/HTMLDTD.c
+++ b/WWW/Library/Implementation/HTMLDTD.c
@@ -338,6 +338,7 @@ static attr address_attr[] = {			/* ADDRESS attributes */
 	{ "LANG" },
 	{ "NOWRAP" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -387,6 +388,7 @@ static attr area_attr[] = {			/* AREA attributes */
 static attr base_attr[] = {			/* BASE attributes */
 	{ "HREF" },
 	{ "TARGET" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };	
 
@@ -399,6 +401,7 @@ static attr bgsound_attr[] = {			/* BGSOUND attributes */
 	{ "LOOP" },
 	{ "SRC" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -415,6 +418,7 @@ static attr body_attr[] = {			/* BODY attributes */
 	{ "ONLOAD" },
 	{ "ONUNLOAD" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "TEXT" },
 	{ "VLINK" },
 	{ 0 } /* Terminate list */
@@ -431,6 +435,7 @@ static attr bodytext_attr[] = {			/* BODYTEXT attributes */
 	{ "OBJECT" },
 	{ "REF" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "TYPE" },
 	{ "VALUE" },
 	{ "VALUETYPE" },
@@ -445,6 +450,25 @@ static attr bq_attr[] = {			/* BQ (BLOCKQUOTE) attributes */
 	{ "LANG" },
 	{ "NOWRAP" },
 	{ "STYLE" },
+	{ "TITLE" },
+	{ 0 }	/* Terminate list */
+};
+
+static attr button_attr[] = {			/* BUTTON attributes */
+	{ "CLASS" },
+	{ "CLEAR" },
+	{ "DIR" },
+	{ "DISABLED" },
+	{ "ID" },
+	{ "LANG" },
+	{ "NAME" },
+	{ "ONFOCUS" },
+	{ "ONBLUR" },
+	{ "STYLE" },
+	{ "TABINDEX" },
+	{ "TITLE" },
+	{ "TYPE" },
+	{ "VALUE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -457,6 +481,7 @@ static attr caption_attr[] = {			/* CAPTION attributes */
 	{ "ID" },
 	{ "LANG" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -471,6 +496,7 @@ static attr col_attr[] = {		/* COL and COLGROUP attributes */
 	{ "LANG" },
 	{ "SPAN" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "VALIGN" },
 	{ "WIDTH" },
 	{ 0 }	/* Terminate list */
@@ -483,6 +509,7 @@ static attr credit_attr[] = {			/* CREDIT attributes */
 	{ "ID" },
 	{ "LANG" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -494,6 +521,7 @@ static attr div_attr[] = {			/* DIV attribures */
 	{ "ID" },
 	{ "LANG" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -515,6 +543,7 @@ static attr embed_attr[] = {			/* EMBED attributes */
 	{ "PARAMS" },
 	{ "SRC" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "UNITS" },
 	{ "USEMAP" },
 	{ "WIDTH" },
@@ -536,6 +565,7 @@ static attr fig_attr[] = {			/* FIG attributes */
 	{ "NOFLOW" },
 	{ "SRC" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "UNITS" },
 	{ "WIDTH" },
 	{ 0 }	/* Terminate list */
@@ -559,6 +589,7 @@ static attr fn_attr[] = {			/* FN attributes */
 	{ "ID" },
 	{ "LANG" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -595,6 +626,7 @@ static attr form_attr[] = {			/* FORM attributes */
 };
 
 static attr frame_attr[] = {			/* FRAME attributes */
+	{ "ID" },
 	{ "MARGINHEIGHT"},
 	{ "MARGINWIDTH" },
 	{ "NAME" },
@@ -617,6 +649,7 @@ static attr gen_attr[] = {			/* Minimum HTML 3.0 */
 	{ "ID" },
 	{ "LANG" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -628,6 +661,7 @@ static attr glossary_attr[] = {			/* DL (and DLC) attributes */
 	{ "ID" },
 	{ "LANG" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -645,6 +679,7 @@ static attr h_attr[] = {			/* H1 - H6 attributes */
 	{ "SKIP" },
 	{ "SRC" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -659,6 +694,22 @@ static attr hr_attr[] = {			/* HR attributes */
 	{ "SIZE" },
 	{ "SRC" },
 	{ "STYLE" },
+	{ "TITLE" },
+	{ "WIDTH" },
+	{ 0 }	/* Terminate list */
+};
+
+static attr iframe_attr[] = {			/* IFRAME attributes */
+	{ "ALIGN" },
+	{ "FRAMEBORDER" },
+	{ "HEIGHT" },
+	{ "ID" },
+	{ "MARGINHEIGHT"},
+	{ "MARGINWIDTH" },
+	{ "NAME" },
+	{ "SCROLLING" },
+	{ "SRC" },
+	{ "STYLE" },
 	{ "WIDTH" },
 	{ 0 }	/* Terminate list */
 };
@@ -724,8 +775,10 @@ static attr isindex_attr[] = {			/* ISINDEX attributes */
 	{ "ACTION" },	/* Not in spec.  Lynx treats it as HREF. - FM */
 	{ "DIR" },
 	{ "HREF" },	/* HTML 3.0 attritute for search action. - FM */ 
+	{ "ID" },
 	{ "LANG" },
 	{ "PROMPT" },	/* HTML 3.0 attribute for prompt string. - FM */
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };	
 
@@ -737,6 +790,7 @@ static attr keygen_attr[] = {			/* KEYGEN attributes */
 	{ "LANG" },
 	{ "NAME" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -754,10 +808,24 @@ static attr label_attr[] = {			/* LABEL attributes */
 	{ 0 }	/* Terminate list */
 };
 
+static attr legend_attr[] = {			/* LEGEND attributes */
+	{ "ACCESSKEY" },
+	{ "ALIGN" },
+	{ "CLASS" },
+	{ "CLEAR" },
+	{ "DIR" },
+	{ "ID" },
+	{ "LANG" },
+	{ "STYLE" },
+	{ "TITLE" },
+	{ 0 }	/* Terminate list */
+};
+
 static attr link_attr[] = {			/* LINK attributes */
 	{ "CLASS" },
 	{ "HREF" },
 	{ "ID" },
+	{ "MEDIA" },
 	{ "REL" },
 	{ "REV" },
 	{ "STYLE" },
@@ -778,6 +846,7 @@ static attr list_attr[] = {			/* LI attributes */
 	{ "SKIP" },
 	{ "SRC" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "TYPE" },
 	{ "VALUE" },
 	{ 0 }	/* Terminate list */
@@ -803,6 +872,7 @@ static attr math_attr[] = {			/* MATH attributes */
 	{ "ID" },
 	{ "LANG" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -827,6 +897,7 @@ static attr note_attr[]	= {			/* NOTE attributes */
 	{ "ROLE" },
 	{ "SRC" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -870,6 +941,7 @@ static attr olist_attr[] = {			/* OL attributes */
 	{ "SEQNUM" },
 	{ "START" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "TYPE" },
 	{ 0 }	/* Terminate list */
 };
@@ -885,6 +957,7 @@ static attr option_attr[] = {			/* OPTION attributes */
 	{ "SELECTED" },
 	{ "SHAPE" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "VALUE" },
 	{ 0 }	/* Terminate list */
 };
@@ -897,6 +970,7 @@ static attr overlay_attr[] = {			/* OVERLAY attributes */
 	{ "MD" },
 	{ "SRC" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "UNITS" },
 	{ "WIDTH" },
 	{ "X" },
@@ -913,6 +987,7 @@ static attr p_attr[] = {			/* P attributes */
 	{ "LANG" },
 	{ "NOWRAP" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ 0 }	/* Terminate list */
 };
 
@@ -930,6 +1005,7 @@ static attr param_attr[] = {			/* PARAM attribures */
 	{ "OBJECT" },
 	{ "REF" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "TYPE" },
 	{ "VALUE" },
 	{ "VALUEREF" },
@@ -950,6 +1026,7 @@ static attr script_attr[] = {			/* SCRIPT attribures */
 	{ "SCRIPTENGINE" },
 	{ "SRC" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "TYPE" },
 	{ 0 }	/* Terminate list */
 };
@@ -998,6 +1075,7 @@ static attr tab_attr[] = {			/* TAB attributes */
 	{ "INDENT" },
 	{ "LANG" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "TO" },
 	{ 0 }	/* Terminate list */
 };
@@ -1020,6 +1098,7 @@ static attr table_attr[] = {			/* TABLE attributes */
 	{ "NOWRAP" },
 	{ "RULES" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "UNITS" },
 	{ "WIDTH" },
 	{ 0 }	/* Terminate list */
@@ -1041,6 +1120,7 @@ static attr td_attr[] = {			/* TD and TH attributes */
 	{ "NOWRAP" },
 	{ "ROWSPAN" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "VALIGN" },
 	{ 0 }	/* Terminate list */
 };
@@ -1080,6 +1160,7 @@ static attr tr_attr[] = {	/* TR, THEAD, TFOOT, and TBODY attributes */
 	{ "LANG" },
 	{ "NOWRAP" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "VALIGN" },
 	{ 0 }	/* Terminate list */
 };
@@ -1096,6 +1177,7 @@ static attr ulist_attr[] = {			/* UL attributes */
 	{ "PLAIN" },
 	{ "SRC" },
 	{ "STYLE" },
+	{ "TITLE" },
 	{ "TYPE" },
 	{ "WRAP" },
 	{ 0 }	/* Terminate list */
@@ -1200,6 +1282,7 @@ static attr ulist_attr[] = {			/* UL attributes */
 #define T_BQ		0x0200,	0xAFBCF,0xAFFFF,0xB6680,0xB6FAF,0x8031F,0x00000
  /* { "BR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY }, */
 #define T_BR		0x1000, 0x00000,0x00000,0x377BF,0x77FBF,0x8101F,0x00001
+#define T_BUTTON	0x0200, 0x0BB0B,0x0FF3B,0x0378F,0x37FAF,0x8035F,0x00000
  /* { "CAPTION"	, caption_attr,	HTML_CAPTION_ATTRIBUTES, SGML_MIXED }, */
 #define	T_CAPTION	0x0100,	0x0B04F,0x8FFFF,0x06A00,0xB6FA7,0x8035F,0x00000
  /* { "CENTER"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED }, */
@@ -1237,7 +1320,7 @@ static attr ulist_attr[] = {			/* UL attributes */
  /* { "EMBED"	, embed_attr,	HTML_EMBED_ATTRIBUTES,	SGML_EMPTY }, */
 #define T_EMBED		0x2000, 0x8F107,0x8FFF7,0xB6FBF,0xB7FBF,0x1FF7F,0x00001
  /* { "FIELDSET", fieldset_attr,HTML_FIELDSET_ATTRIBUTES, SGML_MIXED }, */
-#define T_FIELDSET	0x0200,	0x0FB40,0x0FF5F,0x07787,0x37FF7,0x8805F,0x00000
+#define T_FIELDSET	0x0200,	0x0FB42,0x0FF5F,0x07787,0x37FF7,0x8805F,0x00000
  /* { "FIG"	, fig_attr,	HTML_FIG_ATTRIBUTES,	SGML_MIXED }, */
 #define T_FIG		0x0200, 0x0FB00,0x8FFFF,0x36680,0xB6FBF,0x8834F,0x00000
  /* { "FN"	, fn_attr,	HTML_FN_ATTRIBUTES,	SGML_MIXED }, */
@@ -1271,6 +1354,7 @@ static attr ulist_attr[] = {			/* UL attributes */
 #define T_HY		0x1000, 0x00000,0x00000,0x3779F,0x77FBF,0x8101F,0x00001
  /* { "I"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
 #define T_I		0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004
+#define T_IFRAME	0x2000,	0x8FBCF,0x8FFFF,0xB679F,0xB6FBF,0xD335F,0x00000
  /* { "IMG"     , img_attr,	HTML_IMG_ATTRIBUTES,	SGML_EMPTY }, */
 #define T_IMG		0x1000,	0x00000,0x00000,0x3779F,0x37FBF,0x80000,0x00001
  /* { "INPUT"   , input_attr,	HTML_INPUT_ATTRIBUTES,	SGML_EMPTY }, */
@@ -1285,6 +1369,7 @@ static attr ulist_attr[] = {			/* UL attributes */
 #define T_KEYGEN	0x0040,	0x00000,0x00000,0x07FB7,0x37FB7,0x80070,0x00001
  /* { "LABEL"	, label_attr,	HTML_LABEL_ATTRIBUTES,	SGML_MIXED }, */
 #define T_LABEL		0x0020, 0x9FFFF,0x9FFFF,0x9FFFF,0x9FFFF,0x00007,0x00000
+#define T_LEGEND	0x0002, 0x0B04F,0x0FF7F,0x00200,0x37FA7,0x00003,0x00000
  /* { "LH"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY }, */
 #define T_LH		0x0400,	0x0BB7F,0x8FFFF,0x00800,0x97FFF,0x8071F,0x00001
  /* { "LI"	, list_attr,	HTML_LI_ATTRIBUTES,	SGML_EMPTY }, */
@@ -1421,6 +1506,7 @@ static HTTag tags_old[HTML_ELEMENTS] = {
     { "BODYTEXT", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED,T_BODYTEXT},
     { "BQ"	, bq_attr,	HTML_BQ_ATTRIBUTES,	SGML_MIXED,T_BQ},
     { "BR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_BR},
+    { "BUTTON"	, button_attr,	HTML_BUTTON_ATTRIBUTES,	SGML_MIXED,T_BUTTON},
     { "CAPTION"	, caption_attr,	HTML_CAPTION_ATTRIBUTES, SGML_MIXED,T_CAPTION},
     { "CENTER"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED,T_CENTER},
     { "CITE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_CITE},
@@ -1457,6 +1543,7 @@ static HTTag tags_old[HTML_ELEMENTS] = {
     { "HTML"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_HTML},
     { "HY"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_HY},
     { "I"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_I},
+    { "IFRAME"	, iframe_attr,	HTML_IFRAME_ATTRIBUTES,	SGML_MIXED,T_IFRAME},
     { "IMG"     , img_attr,	HTML_IMG_ATTRIBUTES,	SGML_EMPTY,T_IMG},
     { "INPUT"   , input_attr,	HTML_INPUT_ATTRIBUTES,	SGML_EMPTY,T_INPUT},
     { "INS"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_INS},
@@ -1464,6 +1551,7 @@ static HTTag tags_old[HTML_ELEMENTS] = {
     { "KBD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_KBD},
     { "KEYGEN"	, keygen_attr,	HTML_KEYGEN_ATTRIBUTES,	SGML_EMPTY,T_KEYGEN},
     { "LABEL"	, label_attr,	HTML_LABEL_ATTRIBUTES,	SGML_MIXED,T_LABEL},
+    { "LEGEND"	, legend_attr,	HTML_LEGEND_ATTRIBUTES,	SGML_MIXED,T_LEGEND},
     { "LH"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_LH},
     { "LI"	, list_attr,	HTML_LI_ATTRIBUTES,	SGML_EMPTY,T_LI},
     { "LINK"	, link_attr,	HTML_LINK_ATTRIBUTES,	SGML_EMPTY,T_LINK},
@@ -1539,6 +1627,7 @@ static HTTag tags_new[HTML_ELEMENTS] = {
     { "BODYTEXT", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED,T_BODYTEXT},
     { "BQ"	, bq_attr,	HTML_BQ_ATTRIBUTES,	SGML_MIXED,T_BQ},
     { "BR"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_BR},
+    { "BUTTON"	, button_attr,	HTML_BUTTON_ATTRIBUTES,	SGML_MIXED,T_BUTTON},
     { "CAPTION"	, caption_attr,	HTML_CAPTION_ATTRIBUTES, SGML_MIXED,T_CAPTION},
     { "CENTER"	, div_attr,	HTML_DIV_ATTRIBUTES,	SGML_MIXED,T_CENTER},
     { "CITE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_CITE},
@@ -1575,6 +1664,7 @@ static HTTag tags_new[HTML_ELEMENTS] = {
     { "HTML"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_HTML},
     { "HY"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_EMPTY,T_HY},
     { "I"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_I},
+    { "IFRAME"	, iframe_attr,	HTML_IFRAME_ATTRIBUTES,	SGML_MIXED,T_IFRAME},
     { "IMG"     , img_attr,	HTML_IMG_ATTRIBUTES,	SGML_EMPTY,T_IMG},
     { "INPUT"   , input_attr,	HTML_INPUT_ATTRIBUTES,	SGML_EMPTY,T_INPUT},
     { "INS"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_INS},
@@ -1582,6 +1672,7 @@ static HTTag tags_new[HTML_ELEMENTS] = {
     { "KBD"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_KBD},
     { "KEYGEN"	, keygen_attr,	HTML_KEYGEN_ATTRIBUTES,	SGML_EMPTY,T_KEYGEN},
     { "LABEL"	, label_attr,	HTML_LABEL_ATTRIBUTES,	SGML_MIXED,T_LABEL},
+    { "LEGEND"	, legend_attr,	HTML_LEGEND_ATTRIBUTES,	SGML_MIXED,T_LEGEND},
     { "LH"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED,T_LH},
     { "LI"	, list_attr,	HTML_LI_ATTRIBUTES,	SGML_MIXED,T_LI},
     { "LINK"	, link_attr,	HTML_LINK_ATTRIBUTES,	SGML_EMPTY,T_LINK},
diff --git a/WWW/Library/Implementation/HTMLDTD.h b/WWW/Library/Implementation/HTMLDTD.h
index 09b6936a..8c273d0d 100644
--- a/WWW/Library/Implementation/HTMLDTD.h
+++ b/WWW/Library/Implementation/HTMLDTD.h
@@ -51,6 +51,7 @@ typedef enum _HTMLElement {
 	HTML_BODYTEXT,
 	HTML_BQ,
 	HTML_BR,
+	HTML_BUTTON,
         HTML_CAPTION,
 	HTML_CENTER,
 	HTML_CITE,
@@ -87,6 +88,7 @@ typedef enum _HTMLElement {
 	HTML_HTML,
 	HTML_HY,
         HTML_I,
+        HTML_IFRAME,
 	HTML_IMG,
 	HTML_INPUT,
         HTML_INS,
@@ -94,6 +96,7 @@ typedef enum _HTMLElement {
         HTML_KBD,
         HTML_KEYGEN,
 	HTML_LABEL,
+	HTML_LEGEND,
 	HTML_LH,
 	HTML_LI,
 	HTML_LINK,
@@ -146,7 +149,7 @@ typedef enum _HTMLElement {
         HTML_WBR,
 	HTML_XMP } HTMLElement;
 
-#define HTML_ELEMENTS 115
+#define HTML_ELEMENTS 118
 
 /*
 
@@ -194,7 +197,8 @@ Attribute numbers
 #define HTML_ADDRESS_LANG       4
 #define HTML_ADDRESS_NOWRAP     5
 #define HTML_ADDRESS_STYLE      6
-#define HTML_ADDRESS_ATTRIBUTES 7
+#define HTML_ADDRESS_TITLE      7
+#define HTML_ADDRESS_ATTRIBUTES 8
 
 #define	HTML_APPLET_ALIGN       0
 #define	HTML_APPLET_ALT         1
@@ -237,7 +241,8 @@ Attribute numbers
 
 #define HTML_BASE_HREF          0
 #define	HTML_BASE_TARGET        1
-#define HTML_BASE_ATTRIBUTES    2
+#define HTML_BASE_TITLE         2
+#define HTML_BASE_ATTRIBUTES    3
 
 #define HTML_BGSOUND_CLASS      0
 #define HTML_BGSOUND_CLEAR      1
@@ -247,31 +252,8 @@ Attribute numbers
 #define HTML_BGSOUND_LOOP       5
 #define HTML_BGSOUND_SRC        6
 #define HTML_BGSOUND_STYLE      7
-#define HTML_BGSOUND_ATTRIBUTES 8
-
-#define HTML_BQ_CLASS           0
-#define HTML_BQ_CLEAR           1
-#define HTML_BQ_DIR             2
-#define HTML_BQ_ID              3
-#define HTML_BQ_LANG            4
-#define HTML_BQ_NOWRAP          5
-#define HTML_BQ_STYLE           6
-#define HTML_BQ_ATTRIBUTES      7
-
-#define HTML_BODYTEXT_CLASS     0
-#define HTML_BODYTEXT_CLEAR     1
-#define HTML_BODYTEXT_DATA      2
-#define HTML_BODYTEXT_DIR       3
-#define HTML_BODYTEXT_ID        4
-#define HTML_BODYTEXT_LANG      5
-#define HTML_BODYTEXT_NAME      6
-#define HTML_BODYTEXT_OBJECT    7
-#define HTML_BODYTEXT_REF       8
-#define HTML_BODYTEXT_STYLE     9
-#define HTML_BODYTEXT_TYPE     10
-#define HTML_BODYTEXT_VALUE    11
-#define HTML_BODYTEXT_VALUETYPE  12
-#define HTML_BODYTEXT_ATTRIBUTES 13
+#define HTML_BGSOUND_TITLE      8
+#define HTML_BGSOUND_ATTRIBUTES 9
 
 #define HTML_BODY_ALINK         0
 #define HTML_BODY_BACKGROUND    1
@@ -286,8 +268,51 @@ Attribute numbers
 #define HTML_BODY_ONUNLOAD     10
 #define HTML_BODY_STYLE        11
 #define HTML_BODY_TEXT         12
-#define HTML_BODY_VLINK        13
-#define HTML_BODY_ATTRIBUTES   14
+#define HTML_BODY_TITLE        13
+#define HTML_BODY_VLINK        14
+#define HTML_BODY_ATTRIBUTES   15
+
+#define HTML_BODYTEXT_CLASS     0
+#define HTML_BODYTEXT_CLEAR     1
+#define HTML_BODYTEXT_DATA      2
+#define HTML_BODYTEXT_DIR       3
+#define HTML_BODYTEXT_ID        4
+#define HTML_BODYTEXT_LANG      5
+#define HTML_BODYTEXT_NAME      6
+#define HTML_BODYTEXT_OBJECT    7
+#define HTML_BODYTEXT_REF       8
+#define HTML_BODYTEXT_STYLE     9
+#define HTML_BODYTEXT_TITLE    10
+#define HTML_BODYTEXT_TYPE     11
+#define HTML_BODYTEXT_VALUE    12
+#define HTML_BODYTEXT_VALUETYPE  13
+#define HTML_BODYTEXT_ATTRIBUTES 14
+
+#define HTML_BQ_CLASS           0
+#define HTML_BQ_CLEAR           1
+#define HTML_BQ_DIR             2
+#define HTML_BQ_ID              3
+#define HTML_BQ_LANG            4
+#define HTML_BQ_NOWRAP          5
+#define HTML_BQ_STYLE           6
+#define HTML_BQ_TITLE           7
+#define HTML_BQ_ATTRIBUTES      8
+
+#define HTML_BUTTON_CLASS      0
+#define HTML_BUTTON_CLEAR      1
+#define HTML_BUTTON_DIR        2
+#define HTML_BUTTON_DISABLED   3
+#define HTML_BUTTON_ID         4
+#define HTML_BUTTON_LANG       5
+#define HTML_BUTTON_NAME       6
+#define HTML_BUTTON_ONFOCUS    7
+#define HTML_BUTTON_ONBLUR     8
+#define HTML_BUTTON_STYLE      9
+#define HTML_BUTTON_TABINDEX  10
+#define HTML_BUTTON_TITLE     11
+#define HTML_BUTTON_TYPE      12
+#define HTML_BUTTON_VALUE     13
+#define HTML_BUTTON_ATTRIBUTES 14
 
 #define HTML_CAPTION_ACCESSKEY  0
 #define HTML_CAPTION_ALIGN      1
@@ -297,7 +322,8 @@ Attribute numbers
 #define HTML_CAPTION_ID         5
 #define HTML_CAPTION_LANG       6
 #define HTML_CAPTION_STYLE      7
-#define HTML_CAPTION_ATTRIBUTES 8
+#define HTML_CAPTION_TITLE      8
+#define HTML_CAPTION_ATTRIBUTES 9
 
 #define HTML_COL_ALIGN          0
 #define HTML_COL_CHAR           1
@@ -309,9 +335,10 @@ Attribute numbers
 #define HTML_COL_LANG           7
 #define HTML_COL_SPAN           8
 #define HTML_COL_STYLE          9
-#define HTML_COL_VALIGN        10
-#define HTML_COL_WIDTH         11
-#define HTML_COL_ATTRIBUTES    12
+#define HTML_COL_TITLE         10
+#define HTML_COL_VALIGN        11
+#define HTML_COL_WIDTH         12
+#define HTML_COL_ATTRIBUTES    13
 
 #define HTML_CREDIT_CLASS       0
 #define HTML_CREDIT_CLEAR       1
@@ -319,7 +346,8 @@ Attribute numbers
 #define HTML_CREDIT_ID          3
 #define HTML_CREDIT_LANG        4
 #define HTML_CREDIT_STYLE       5
-#define HTML_CREDIT_ATTRIBUTES  6
+#define HTML_CREDIT_TITLE       6
+#define HTML_CREDIT_ATTRIBUTES  7
 
 #define HTML_DIV_ALIGN          0
 #define HTML_DIV_CLASS          1
@@ -328,7 +356,8 @@ Attribute numbers
 #define HTML_DIV_ID             4
 #define HTML_DIV_LANG           5
 #define HTML_DIV_STYLE          6
-#define HTML_DIV_ATTRIBUTES     7
+#define HTML_DIV_TITLE          7
+#define HTML_DIV_ATTRIBUTES     8
 
 #define HTML_DL_CLASS           0
 #define HTML_DL_CLEAR           1
@@ -337,7 +366,8 @@ Attribute numbers
 #define HTML_DL_ID              4
 #define HTML_DL_LANG            5
 #define HTML_DL_STYLE           6
-#define HTML_DL_ATTRIBUTES      7
+#define HTML_DL_TITLE           7
+#define HTML_DL_ATTRIBUTES      8
 
 #define HTML_EMBED_ALIGN        0
 #define HTML_EMBED_ALT          1
@@ -356,10 +386,11 @@ Attribute numbers
 #define HTML_EMBED_PARAMS      14
 #define HTML_EMBED_SRC         15
 #define HTML_EMBED_STYLE       16
-#define HTML_EMBED_UNITS       17
-#define HTML_EMBED_USEMAP      18
-#define HTML_EMBED_WIDTH       19
-#define HTML_EMBED_ATTRIBUTES  20
+#define HTML_EMBED_TITLE       17
+#define HTML_EMBED_UNITS       18
+#define HTML_EMBED_USEMAP      19
+#define HTML_EMBED_WIDTH       20
+#define HTML_EMBED_ATTRIBUTES  21
 
 #define HTML_FIELDSET_CLASS     0
 #define HTML_FIELDSET_CLEAR     1
@@ -384,9 +415,10 @@ Attribute numbers
 #define HTML_FIG_NOFLOW        11
 #define HTML_FIG_SRC           12
 #define HTML_FIG_STYLE         13
-#define HTML_FIG_UNITS         14
-#define HTML_FIG_WIDTH         15
-#define HTML_FIG_ATTRIBUTES    16
+#define HTML_FIG_TITLE         14
+#define HTML_FIG_UNITS         15
+#define HTML_FIG_WIDTH         16
+#define HTML_FIG_ATTRIBUTES    17
 
 #define HTML_FN_CLASS           0
 #define HTML_FN_CLEAR           1
@@ -394,7 +426,8 @@ Attribute numbers
 #define HTML_FN_ID              3
 #define HTML_FN_LANG            4
 #define HTML_FN_STYLE           5
-#define HTML_FN_ATTRIBUTES      6
+#define HTML_FN_TITLE           6
+#define HTML_FN_ATTRIBUTES      7
 
 #define HTML_FONT_CLASS         0
 #define HTML_FONT_CLEAR         1
@@ -424,13 +457,14 @@ Attribute numbers
 #define HTML_FORM_TITLE        13
 #define HTML_FORM_ATTRIBUTES   14
 
-#define HTML_FRAME_MARGINHEIGHT 0
-#define HTML_FRAME_MARGINWIDTH  1
-#define HTML_FRAME_NAME         2
-#define HTML_FRAME_NORESIZE     3
-#define HTML_FRAME_SCROLLING    4
-#define HTML_FRAME_SRC          5
-#define HTML_FRAME_ATTRIBUTES   6
+#define HTML_FRAME_ID           0
+#define HTML_FRAME_MARGINHEIGHT 1
+#define HTML_FRAME_MARGINWIDTH  2
+#define HTML_FRAME_NAME         3
+#define HTML_FRAME_NORESIZE     4
+#define HTML_FRAME_SCROLLING    5
+#define HTML_FRAME_SRC          6
+#define HTML_FRAME_ATTRIBUTES   7
 
 #define HTML_FRAMESET_COLS      0
 #define HTML_FRAMESET_ROWS      1
@@ -442,7 +476,8 @@ Attribute numbers
 #define HTML_GEN_ID             3
 #define HTML_GEN_LANG           4
 #define HTML_GEN_STYLE          5
-#define HTML_GEN_ATTRIBUTES     6
+#define HTML_GEN_TITLE          6
+#define HTML_GEN_ATTRIBUTES     7
 
 #define HTML_H_ALIGN            0
 #define HTML_H_CLASS            1
@@ -457,7 +492,8 @@ Attribute numbers
 #define HTML_H_SKIP            10
 #define HTML_H_SRC             11
 #define HTML_H_STYLE           12
-#define HTML_H_ATTRIBUTES      13
+#define HTML_H_TITLE           13
+#define HTML_H_ATTRIBUTES      14
 
 #define HTML_HR_ALIGN           0
 #define HTML_HR_CLASS           1
@@ -469,8 +505,22 @@ Attribute numbers
 #define HTML_HR_SIZE            7
 #define HTML_HR_SRC             8
 #define HTML_HR_STYLE           9
-#define HTML_HR_WIDTH          10
-#define HTML_HR_ATTRIBUTES     11
+#define HTML_HR_TITLE          10
+#define HTML_HR_WIDTH          11
+#define HTML_HR_ATTRIBUTES     12
+
+#define HTML_IFRAME_ALIGN       0
+#define HTML_IFRAME_FRAMEBORDER 1
+#define HTML_IFRAME_HEIGHT      2
+#define HTML_IFRAME_ID          3
+#define HTML_IFRAME_MARGINHEIGHT 4
+#define HTML_IFRAME_MARGINWIDTH  5
+#define HTML_IFRAME_NAME        6
+#define HTML_IFRAME_SCROLLING   7
+#define HTML_IFRAME_SRC         8
+#define HTML_IFRAME_STYLE       9
+#define HTML_IFRAME_WIDTH      10
+#define HTML_IFRAME_ATTRIBUTES 11
 
 #define HTML_IMG_ALIGN          0
 #define HTML_IMG_ALT            1
@@ -528,9 +578,11 @@ Attribute numbers
 #define HTML_ISINDEX_ACTION     0  /* Treat as synonym for HREF. - FM */
 #define HTML_ISINDEX_DIR        1
 #define HTML_ISINDEX_HREF       2  /* HTML 3.0 "action". - FM */
-#define HTML_ISINDEX_LANG       3
-#define HTML_ISINDEX_PROMPT     4  /* HTML 3.0 "prompt". - FM */
-#define HTML_ISINDEX_ATTRIBUTES 5
+#define HTML_ISINDEX_ID         3
+#define HTML_ISINDEX_LANG       4
+#define HTML_ISINDEX_PROMPT     5  /* HTML 3.0 "prompt". - FM */
+#define HTML_ISINDEX_TITLE      6
+#define HTML_ISINDEX_ATTRIBUTES 7
 
 #define HTML_KEYGEN_CHALLENGE   0
 #define HTML_KEYGEN_CLASS       1
@@ -539,18 +591,8 @@ Attribute numbers
 #define HTML_KEYGEN_LANG        4
 #define HTML_KEYGEN_NAME        5
 #define HTML_KEYGEN_STYLE       6
-#define HTML_KEYGEN_ATTRIBUTES  7
-
-#define HTML_LINK_CLASS         0
-#define HTML_LINK_HREF          1
-#define HTML_LINK_ID            2
-#define HTML_LINK_REL           3
-#define HTML_LINK_REV           4
-#define HTML_LINK_STYLE         5
-#define	HTML_LINK_TARGET        6
-#define HTML_LINK_TITLE         7
-#define HTML_LINK_TYPE          8
-#define HTML_LINK_ATTRIBUTES    9
+#define HTML_KEYGEN_TITLE       7
+#define HTML_KEYGEN_ATTRIBUTES  8
 
 #define HTML_LABEL_ACCESSKEY    0
 #define HTML_LABEL_CLASS        1
@@ -564,6 +606,17 @@ Attribute numbers
 #define HTML_LABEL_TITLE        9
 #define HTML_LABEL_ATTRIBUTES  10
 
+#define HTML_LEGEND_ACCESSKEY   0
+#define HTML_LEGEND_ALIGN       1
+#define HTML_LEGEND_CLASS       2
+#define HTML_LEGEND_CLEAR       3
+#define HTML_LEGEND_DIR         4
+#define HTML_LEGEND_ID          5
+#define HTML_LEGEND_LANG        6
+#define HTML_LEGEND_STYLE       7
+#define HTML_LEGEND_TITLE       8
+#define HTML_LEGEND_ATTRIBUTES  9
+
 #define HTML_LI_CLASS           0
 #define HTML_LI_CLEAR           1
 #define HTML_LI_DINGBAT         2
@@ -574,9 +627,22 @@ Attribute numbers
 #define HTML_LI_SKIP            7
 #define HTML_LI_SRC             8
 #define HTML_LI_STYLE           9
-#define HTML_LI_TYPE           10
-#define HTML_LI_VALUE          11
-#define HTML_LI_ATTRIBUTES     12
+#define HTML_LI_TITLE          10
+#define HTML_LI_TYPE           11
+#define HTML_LI_VALUE          12
+#define HTML_LI_ATTRIBUTES     13
+
+#define HTML_LINK_CLASS         0
+#define HTML_LINK_HREF          1
+#define HTML_LINK_ID            2
+#define HTML_LINK_MEDIA         3
+#define HTML_LINK_REL           4
+#define HTML_LINK_REV           5
+#define HTML_LINK_STYLE         6
+#define	HTML_LINK_TARGET        7
+#define HTML_LINK_TITLE         8
+#define HTML_LINK_TYPE          9
+#define HTML_LINK_ATTRIBUTES   10
 
 #define HTML_MAP_CLASS          0
 #define HTML_MAP_CLEAR          1
@@ -595,7 +661,8 @@ Attribute numbers
 #define HTML_MATH_ID            4
 #define HTML_MATH_LANG          5
 #define HTML_MATH_STYLE         6
-#define HTML_MATH_ATTRIBUTES    7
+#define HTML_MATH_TITLE         7
+#define HTML_MATH_ATTRIBUTES    8
 
 #define HTML_META_CONTENT       0
 #define HTML_META_HTTP_EQUIV    1  /* For parsing in HTML.c - FM */
@@ -613,7 +680,8 @@ Attribute numbers
 #define HTML_NOTE_ROLE          6 /* Old name for CLASS - FM */
 #define HTML_NOTE_SRC           7
 #define HTML_NOTE_STYLE         8
-#define HTML_NOTE_ATTRIBUTES    9
+#define HTML_NOTE_TITLE         9
+#define HTML_NOTE_ATTRIBUTES   10
 
 #define HTML_OBJECT_ALIGN       0
 #define HTML_OBJECT_BORDER      1
@@ -652,8 +720,9 @@ Attribute numbers
 #define HTML_OL_SEQNUM          7
 #define HTML_OL_START           8
 #define HTML_OL_STYLE           9
-#define HTML_OL_TYPE           10
-#define HTML_OL_ATTRIBUTES     11
+#define HTML_OL_TITLE          10
+#define HTML_OL_TYPE           11
+#define HTML_OL_ATTRIBUTES     12
 
 #define HTML_OPTION_CLASS       0
 #define HTML_OPTION_CLEAR       1
@@ -665,8 +734,9 @@ Attribute numbers
 #define HTML_OPTION_SELECTED    7
 #define HTML_OPTION_SHAPE       8
 #define HTML_OPTION_STYLE       9
-#define HTML_OPTION_VALUE      10
-#define HTML_OPTION_ATTRIBUTES 11
+#define HTML_OPTION_TITLE      10
+#define HTML_OPTION_VALUE      11
+#define HTML_OPTION_ATTRIBUTES 12
 
 #define HTML_OVERLAY_CLASS      0
 #define HTML_OVERLAY_HEIGHT     1
@@ -675,11 +745,12 @@ Attribute numbers
 #define HTML_OVERLAY_MD         4
 #define HTML_OVERLAY_SRC        5
 #define HTML_OVERLAY_STYLE      6
-#define HTML_OVERLAY_UNITS      7
-#define HTML_OVERLAY_WIDTH      8
-#define HTML_OVERLAY_X          9
-#define HTML_OVERLAY_Y         10
-#define HTML_OVERLAY_ATTRIBUTES 11
+#define HTML_OVERLAY_TITLE      7
+#define HTML_OVERLAY_UNITS      8
+#define HTML_OVERLAY_WIDTH      9
+#define HTML_OVERLAY_X         10
+#define HTML_OVERLAY_Y         11
+#define HTML_OVERLAY_ATTRIBUTES 12
 
 #define HTML_P_ALIGN            0
 #define HTML_P_CLASS            1
@@ -689,7 +760,8 @@ Attribute numbers
 #define HTML_P_LANG             5
 #define HTML_P_NOWRAP           6
 #define HTML_P_STYLE            7
-#define HTML_P_ATTRIBUTES       8
+#define HTML_P_TITLE            8
+#define HTML_P_ATTRIBUTES       9
 
 #define HTML_PARAM_ACCEPT       0
 #define HTML_PARAM_ACCEPT_CHARSET  1
@@ -704,11 +776,12 @@ Attribute numbers
 #define HTML_PARAM_OBJECT      10
 #define HTML_PARAM_REF         11
 #define HTML_PARAM_STYLE       12
-#define HTML_PARAM_TYPE        13
-#define HTML_PARAM_VALUE       14
-#define HTML_PARAM_VALUEREF    15  /* Use VALUETYPE (DATA|REF|OBJECT). - FM */
-#define HTML_PARAM_VALUETYPE   16
-#define HTML_PARAM_ATTRIBUTES  17
+#define HTML_PARAM_TITLE       13
+#define HTML_PARAM_TYPE        14
+#define HTML_PARAM_VALUE       15
+#define HTML_PARAM_VALUEREF    16  /* Use VALUETYPE (DATA|REF|OBJECT). - FM */
+#define HTML_PARAM_VALUETYPE   17
+#define HTML_PARAM_ATTRIBUTES  18
 
 #define HTML_SCRIPT_CLASS       0
 #define HTML_SCRIPT_CLEAR       1
@@ -722,8 +795,9 @@ Attribute numbers
 #define HTML_SCRIPT_SCRIPTENGINE 9
 #define HTML_SCRIPT_SRC        10
 #define HTML_SCRIPT_STYLE      11
-#define HTML_SCRIPT_TYPE       12
-#define HTML_SCRIPT_ATTRIBUTES 13
+#define HTML_SCRIPT_TITLE      12
+#define HTML_SCRIPT_TYPE       13
+#define HTML_SCRIPT_ATTRIBUTES 14
 
 #define HTML_SELECT_ALIGN       0
 #define HTML_SELECT_CLASS       1
@@ -764,8 +838,9 @@ Attribute numbers
 #define HTML_TAB_INDENT         6
 #define HTML_TAB_LANG           7
 #define HTML_TAB_STYLE          8
-#define HTML_TAB_TO             9
-#define HTML_TAB_ATTRIBUTES    10
+#define HTML_TAB_TITLE          9
+#define HTML_TAB_TO            10
+#define HTML_TAB_ATTRIBUTES    11
 
 #define HTML_TABLE_ALIGN        0
 #define HTML_TABLE_BORDER       1
@@ -784,9 +859,10 @@ Attribute numbers
 #define HTML_TABLE_NOWRAP      14
 #define HTML_TABLE_RULES       15
 #define HTML_TABLE_STYLE       16
-#define HTML_TABLE_UNITS       17
-#define HTML_TABLE_WIDTH       18
-#define HTML_TABLE_ATTRIBUTES  19
+#define HTML_TABLE_TITLE       17
+#define HTML_TABLE_UNITS       18
+#define HTML_TABLE_WIDTH       19
+#define HTML_TABLE_ATTRIBUTES  20
 
 #define HTML_TD_ALIGN           0
 #define HTML_TD_AXES            1
@@ -803,8 +879,9 @@ Attribute numbers
 #define HTML_TD_NOWRAP         12
 #define HTML_TD_ROWSPAN        13
 #define HTML_TD_STYLE          14
-#define HTML_TD_VALIGN         15
-#define HTML_TD_ATTRIBUTES     16
+#define HTML_TD_TITLE          15
+#define HTML_TD_VALIGN         16
+#define HTML_TD_ATTRIBUTES     17
 
 #define HTML_TEXTAREA_ALIGN     0
 #define HTML_TEXTAREA_CLASS     1
@@ -838,8 +915,9 @@ Attribute numbers
 #define HTML_TR_LANG            8
 #define HTML_TR_NOWRAP          9
 #define HTML_TR_STYLE          10
-#define HTML_TR_VALIGN         11
-#define HTML_TR_ATTRIBUTES     12
+#define HTML_TR_TITLE          11
+#define HTML_TR_VALIGN         12
+#define HTML_TR_ATTRIBUTES     13
 
 #define HTML_UL_CLASS           0
 #define HTML_UL_CLEAR           1
@@ -852,9 +930,10 @@ Attribute numbers
 #define HTML_UL_PLAIN           8
 #define HTML_UL_SRC             9
 #define HTML_UL_STYLE          10
-#define HTML_UL_TYPE           11
-#define HTML_UL_WRAP           12
-#define HTML_UL_ATTRIBUTES     13
+#define HTML_UL_TITLE          11
+#define HTML_UL_TYPE           12
+#define HTML_UL_WRAP           13
+#define HTML_UL_ATTRIBUTES     14
 
 extern CONST SGML_dtd HTML_dtd;
 
diff --git a/WWW/Library/Implementation/HTMLGen.c b/WWW/Library/Implementation/HTMLGen.c
index af6794fc..55679ef3 100644
--- a/WWW/Library/Implementation/HTMLGen.c
+++ b/WWW/Library/Implementation/HTMLGen.c
@@ -38,7 +38,6 @@
 /*		HTML Object
 **		-----------
 */
-
 struct _HTStream {
 	CONST HTStreamClass *		isa;	
 	HTStream * 			target;
@@ -58,22 +57,21 @@ struct _HTStructured {
 	BOOL				preformatted;
 };
 
-
 /*	Flush Buffer
 **	------------
 */
-PRIVATE void HTMLGen_flush ARGS1(HTStructured *, me)
+PRIVATE void HTMLGen_flush ARGS1(
+	HTStructured *,		me)
 {
     (*me->targetClass.put_block)(me->target, 
-    				me->buffer,
-				me->write_pointer - me->buffer);
+				 me->buffer,
+				 me->write_pointer - me->buffer);
     me->write_pointer = me->buffer;
     me->line_break = me->buffer;
     me->cleanness = 0;
     me->delete_line_break_char = NO;
 }
 
-
 /*	Character handling
 **	------------------
 **
@@ -87,17 +85,18 @@ PRIVATE void HTMLGen_flush ARGS1(HTStructured *, me)
 **	   This should make the source files easier to read and modify
 **	by hand, too, though this is not a primary design consideration.
 */
-PRIVATE void HTMLGen_put_character ARGS2(HTStructured *, me, char, c)
+PRIVATE void HTMLGen_put_character ARGS2(
+	HTStructured *,		me,
+	char,			c)
 {
-
     *me->write_pointer++ = c;
     
-    if (c=='\n') {
+    if (c == '\n') {
         HTMLGen_flush(me);
 	return;
     }
     
-    if ((!me->preformatted  && c==' ')) {
+    if ((!me->preformatted && c == ' ')) {
         int new_cleanness = 1;
 	if (me->write_pointer > (me->buffer + 1)) {
 	    char delims[5];
@@ -113,7 +112,9 @@ PRIVATE void HTMLGen_put_character ARGS2(HTStructured *, me, char, c)
 	}
     }
     
-    /* Flush buffer out when full */
+    /*
+     *  Flush buffer out when full.
+     */
     if (me->write_pointer == me->buffer + BUFFER_SIZE) {
     	if (me->cleanness) {
 	    char line_break_char = me->line_break[0];
@@ -122,14 +123,14 @@ PRIVATE void HTMLGen_put_character ARGS2(HTStructured *, me, char, c)
 	    if (me->delete_line_break_char) saved++; 
 	    me->line_break[0] = '\n'; 
 	    (*me->targetClass.put_block)(me->target,
-	    				me->buffer,
-					me->line_break - me->buffer + 1);
+     					 me->buffer,
+					 me->line_break - me->buffer + 1);
 	    me->line_break[0] = line_break_char;
 	    {  /* move next line in */
-	    	char * p=saved;
+	    	char * p = saved;
 		char *q;
-		for(q=me->buffer; p < me->write_pointer; )
-			*q++ = *p++;
+		for (q = me->buffer; p < me->write_pointer; )
+		    *q++ = *p++;
 	    }
 	    me->cleanness = 0;
 	    me->delete_line_break_char = 0;
@@ -137,31 +138,37 @@ PRIVATE void HTMLGen_put_character ARGS2(HTStructured *, me, char, c)
 
 	} else {
 	    (*me->targetClass.put_block)(me->target,
-	    	me->buffer,
-		BUFFER_SIZE);
+					 me->buffer,
+					 BUFFER_SIZE);
 	    me->write_pointer = me->buffer;
 	}
 	me->line_break = me->buffer;
     }
 }
 
-
-
 /*	String handling
 **	---------------
 */
-PRIVATE void HTMLGen_put_string ARGS2(HTStructured *, me, CONST char*, s)
+PRIVATE void HTMLGen_put_string ARGS2(
+	HTStructured *,		me,
+	CONST char *,		s)
 {
     CONST char * p;
-    for(p=s; *p; p++) HTMLGen_put_character(me, *p);
+
+    for (p = s; *p; p++)
+	HTMLGen_put_character(me, *p);
 }
 
-PRIVATE void HTMLGen_write ARGS3(HTStructured *, me, CONST char*, s, int, l)
+PRIVATE void HTMLGen_write ARGS3(
+	HTStructured *,		me,
+	CONST char *,		s,
+	int,			l)
 {
     CONST char * p;
-    for(p=s; p<s+l; p++) HTMLGen_put_character(me, *p);
-}
 
+    for (p = s; p < (s + l); p++)
+	HTMLGen_put_character(me, *p);
+}
 
 /*	Start Element
 **	-------------
@@ -177,31 +184,35 @@ PRIVATE void HTMLGen_start_element ARGS5(
 	char **,		insert)
 {
     int i;
-    
     BOOL was_preformatted = me->preformatted;
     HTTag * tag = &HTML_dtd.tags[element_number];
 
     me->preformatted = NO;	/* free text within tags */
     HTMLGen_put_character(me, '<');
     HTMLGen_put_string(me, tag->name);
-    if (present) for (i=0; i< tag->number_of_attributes; i++) {
-        if (present[i]) {
-	    HTMLGen_put_character(me, ' ');
-	    HTMLGen_put_string(me, tag->attributes[i].name);
-	    if (value[i]) {
-	 	HTMLGen_put_string(me, "=\"");
-		HTMLGen_put_string(me, value[i]);
-		HTMLGen_put_character(me, '"');
+    if (present) {
+	for (i = 0; i < tag->number_of_attributes; i++) {
+	    if (present[i]) {
+		HTMLGen_put_character(me, ' ');
+		HTMLGen_put_string(me, tag->attributes[i].name);
+		if (value[i]) {
+		    HTMLGen_put_string(me, "=\"");
+		    HTMLGen_put_string(me, value[i]);
+		    HTMLGen_put_character(me, '"');
+		}
 	    }
 	}
     }
     HTMLGen_put_string(me, ">"); /* got rid of \n LJM */
     
-    /* Make very specific HTML assumption that PRE can't be
-       nested! */
+    /*
+     *  Make very specific HTML assumption that PRE can't be nested!
+     */
     me->preformatted = (element_number == HTML_PRE)  ? YES : was_preformatted;
 
-	/* can break after element start */ 
+    /*
+     *  Can break after element start.
+     */ 
     if (!me->preformatted && tag->contents != SGML_EMPTY) {  
     	me->line_break = me->write_pointer;	/* Don't you hate SGML?  */
 	me->cleanness = 1;
@@ -209,7 +220,6 @@ PRIVATE void HTMLGen_start_element ARGS5(
     }
 }
 
-
 /*		End Element
 **		-----------
 **
@@ -221,12 +231,16 @@ PRIVATE void HTMLGen_start_element ARGS5(
 **	should be linked to the whole stack not just the top one.)
 **	TBL 921119
 */
-PRIVATE void HTMLGen_end_element ARGS3(HTStructured *, me,
-			int , element_number, char **, insert)
+PRIVATE void HTMLGen_end_element ARGS3(
+	HTStructured *,		me,
+	int,			element_number,
+	char **,		insert)
 {
     if (!me->preformatted && 
-		HTML_dtd.tags[element_number].contents != SGML_EMPTY) {
-    				/* can break before element end */ 
+	HTML_dtd.tags[element_number].contents != SGML_EMPTY) {
+    	/*
+	 *  Can break before element end.
+	 */ 
     	me->line_break = me->write_pointer;	/* Don't you hate SGML?  */
 	me->cleanness = 1;
 	me->delete_line_break_char = NO;
@@ -234,16 +248,18 @@ PRIVATE void HTMLGen_end_element ARGS3(HTStructured *, me,
     HTMLGen_put_string(me, "</");
     HTMLGen_put_string(me, HTML_dtd.tags[element_number].name);
     HTMLGen_put_character(me, '>');
-    if (element_number == HTML_PRE) me->preformatted = NO;
+    if (element_number == HTML_PRE) {
+	me->preformatted = NO;
+    }
 }
 
-
 /*		Expanding entities
 **		------------------
 **
 */
-
-PRIVATE int HTMLGen_put_entity ARGS2(HTStructured *, me, int, entity_number)
+PRIVATE int HTMLGen_put_entity ARGS2(
+	HTStructured *,		me,
+	int,			entity_number)
 {
     int nent = HTML_dtd.number_of_entities;
   
@@ -259,13 +275,12 @@ PRIVATE int HTMLGen_put_entity ARGS2(HTStructured *, me, int, entity_number)
     return HT_OK;
 }
 
-
-
 /*	Free an HTML object
 **	-------------------
 **
 */
-PRIVATE void HTMLGen_free ARGS1(HTStructured *, me)
+PRIVATE void HTMLGen_free ARGS1(
+	HTStructured *,		me)
 {
     (*me->targetClass.put_character)(me->target, '\n');
     HTMLGen_flush(me);
@@ -273,28 +288,27 @@ PRIVATE void HTMLGen_free ARGS1(HTStructured *, me)
     FREE(me);
 }
 
-
-PRIVATE void PlainToHTML_free ARGS1(HTStructured *, me)
+PRIVATE void PlainToHTML_free ARGS1(
+	HTStructured *,		me)
 {
     HTMLGen_end_element(me, HTML_PRE, 0);
     HTMLGen_free(me);
 }
 
-
-
-PRIVATE void HTMLGen_abort ARGS2(HTStructured *, me, HTError, e)
+PRIVATE void HTMLGen_abort ARGS2(
+	HTStructured *,		me,
+	HTError,		e)
 {
     HTMLGen_free(me);
 }
 
-
-PRIVATE void PlainToHTML_abort ARGS2(HTStructured *, me, HTError, e)
+PRIVATE void PlainToHTML_abort ARGS2(
+	HTStructured *,		me,
+	HTError,		e)
 {
     PlainToHTML_free(me);
 }
 
-
-
 /*	Structured Object Class
 **	-----------------------
 */
@@ -308,12 +322,11 @@ PRIVATE CONST HTStructuredClass HTMLGeneration = /* As opposed to print etc */
 	HTMLGen_put_entity
 }; 
 
-
 /*	Subclass-specific Methods
 **	-------------------------
 */
-
-PUBLIC HTStructured * HTMLGenerator ARGS1(HTStream *, output)
+PUBLIC HTStructured * HTMLGenerator ARGS1(
+	HTStream *,		output)
 {
     HTStructured* me = (HTStructured*)malloc(sizeof(*me));
     if (me == NULL)
@@ -351,11 +364,9 @@ PRIVATE CONST HTStructuredClass PlainToHTMLConversion =
 	NULL
 }; 
 
-
 /*	HTConverter from plain text to HTML Stream
 **	------------------------------------------
 */
-
 PUBLIC HTStream* HTPlainToHTML ARGS3(
 	HTPresentation *,	pres,
 	HTParentAnchor *,	anchor,	
@@ -366,9 +377,11 @@ PUBLIC HTStream* HTPlainToHTML ARGS3(
         outofmem(__FILE__, "PlainToHTML");
     me->isa = (HTStructuredClass*) &PlainToHTMLConversion;       
 
+    /*
+     *  Copy pointers to routines for speed.
+     */
     me->target = sink;
     me->targetClass = *me->target->isa;
-    	/* Copy pointers to routines for speed*/
 	
     HTMLGen_put_string(me, "<HTML>\n<BODY>\n<PRE>\n");
     me->preformatted = YES;
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index b915e1e3..21da80d8 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -30,7 +30,7 @@ PUBLIC int HTNewsMaxChunk = 40;	/* Largest number of articles in one window */
 
 #ifndef DEFAULT_NEWS_HOST
 #define DEFAULT_NEWS_HOST "news"
-#endif /* DEFAULE_NEWS_HOST */
+#endif /* DEFAULT_NEWS_HOST */
 #ifndef SERVER_FILE
 #define SERVER_FILE "/usr/local/lib/rn/server"
 #endif /* SERVER_FILE */
@@ -1478,17 +1478,22 @@ PRIVATE int read_group ARGS3(
 			if (TRACE)
 			    fprintf(stderr, "G %s\n", line);
 			switch(line[0]) {
-    
+
 			case '.':
 			    done = (line[1] < ' ');	/* End of article? */
 			    break;
-    
+
 			case 'S':
 			case 's':
-			    if (match(line, "SUBJECT:"))
+			    if (match(line, "SUBJECT:")) {
 				strcpy(subject, line+9);/* Save subject */
+			 	if (HTCJK == JAPANESE) {
+				    HTmmdecode(subject, subject);
+				    HTrjis(subject, subject);
+				}
+			    }
 			    break;
-    
+
 			case 'M':
 			case 'm':
 			    if (match(line, "MESSAGE-ID:")) {
@@ -1497,19 +1502,23 @@ PRIVATE int read_group ARGS3(
 				StrAllocCopy(reference, addr);
 			    }
 			    break;
-    
+
 			case 'f':
 			case 'F':
 			    if (match(line, "FROM:")) {
 				char * p;
 				strcpy(author,
 					author_name(strchr(line,':')+1));
+				if (HTCJK == JAPANESE) {
+				    HTmmdecode(author, author);
+				    HTrjis(author, author);
+				}
 				p = author + strlen(author) - 1;
 				if (*p==LF)
 				    *p = '\0';	/* Chop off newline */
 			    }
 			    break;
-				    
+
 			case 'd':
 			case 'D':
 			    if (LYListNewsDates && match(line, "DATE:")) {
@@ -1517,7 +1526,7 @@ PRIVATE int read_group ARGS3(
 					     HTStrip(strchr(line,':')+1));
 			    }
 			    break;
-				    
+
 			} /* end switch on first character */
 		    } /* if end of line */
 		} /* Loop over characters */
diff --git a/WWW/Library/Implementation/HTPlain.c b/WWW/Library/Implementation/HTPlain.c
index b23ec0f7..58f81e62 100644
--- a/WWW/Library/Implementation/HTPlain.c
+++ b/WWW/Library/Implementation/HTPlain.c
@@ -65,27 +65,27 @@ struct _HTStream {
 
 PRIVATE char replace_buf [61];        /* buffer for replacement strings */
 
-PRIVATE void htplain_get_chartrans_info ARGS2(HTStream *, me,
-					      HTParentAnchor *, anchor)
+PRIVATE void HTPlain_getChartransInfo ARGS2(
+	HTStream *,		me,
+	HTParentAnchor *,	anchor)
 {
     if (me->in_char_set < 0) {
 	HTAnchor_copyUCInfoStage(anchor, UCT_STAGE_PARSER, UCT_STAGE_MIME,
-				 	UCT_SETBY_PARSER);
-	me->in_char_set = HTAnchor_getUCLYhndl(anchor,UCT_STAGE_PARSER);
+				 	 UCT_SETBY_PARSER);
+	me->in_char_set = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER);
     }
     if (me->htext_char_set < 0) {
 	int chndl = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_HTEXT);
 	if (chndl < 0) {
 	    chndl = current_char_set;
-	    HTAnchor_setUCInfoStage(anchor, chndl, UCT_STAGE_HTEXT,
-			    UCT_SETBY_DEFAULT);
+	    HTAnchor_setUCInfoStage(anchor, chndl,
+				    UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT);
 	}
-	HTAnchor_setUCInfoStage(anchor, chndl, UCT_STAGE_HTEXT,
-			    UCT_SETBY_DEFAULT);
-	me->htext_char_set = HTAnchor_getUCLYhndl(anchor,
-					    UCT_STAGE_HTEXT);
+	HTAnchor_setUCInfoStage(anchor, chndl,
+				UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT);
+	me->htext_char_set = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_HTEXT);
     }
-    me->UCI = HTAnchor_getUCInfoStage(anchor,UCT_STAGE_PARSER);
+    me->UCI = HTAnchor_getUCInfoStage(anchor, UCT_STAGE_PARSER);
 }
 #endif /* EXP_CHARTRANS */
 
@@ -93,7 +93,6 @@ PRIVATE void htplain_get_chartrans_info ARGS2(HTStream *, me,
 **	----------------------------------
 */
 
-
 /*_________________________________________________________________________
 **
 **			A C T I O N 	R O U T I N E S
@@ -104,17 +103,24 @@ PRIVATE void htplain_get_chartrans_info ARGS2(HTStream *, me,
 #ifdef _WINDOWS
 PRIVATE void HTPlain_write (HTStream * me, CONST char* s, int l);
 #else
-PRIVATE void HTPlain_write PARAMS((HTStream * me, CONST char* s, int l));
+PRIVATE void HTPlain_write PARAMS((
+	HTStream *		me,
+	CONST char *		s,
+	int			l));
 #endif /* _WINDOWS */
 #endif /* EXP_CHARTRANS */
 
 /*	Character handling
 **	------------------
 */
-PRIVATE void HTPlain_put_character ARGS2(HTStream *, me, char, c)
+PRIVATE void HTPlain_put_character ARGS2(
+	HTStream *,		me,
+	char,			c)
 {
 #ifdef REMOVE_CR_ONLY
-    /* throw away \r's */
+    /*
+    **  Throw away \r's.
+    */
     if (c != '\r') {
        HText_appendCharacter(me->text, c);
     }
@@ -153,18 +159,19 @@ PRIVATE void HTPlain_put_character ARGS2(HTStream *, me, char, c)
     } else if ((unsigned char)c > 160) {
 	if (!HTPassEightBitRaw &&
 	    strncmp(LYchar_set_names[current_char_set], "ISO Latin 1", 11)) {
-	    int len, high, low, i, diff=1;
+	    int len, high, low, i, diff = 1;
 	    CONST char * name;
 	    int value = (int)((unsigned char)c - 160);
+
 	    name = HTMLGetEntityName(value);
 	    len =  strlen(name);
-	    for(low=0, high = HTML_dtd.number_of_entities;
+	    for (low = 0, high = HTML_dtd.number_of_entities;
 		high > low;
 		diff < 0 ? (low = i+1) : (high = i)) {
 		/* Binary search */
 		i = (low + (high-low)/2);
 		diff = strncmp(HTML_dtd.entity_names[i], name, len);
-		if (diff==0) {
+		if (diff == 0) {
 		    HText_appendText(me->text,
 		    		     LYCharSets[current_char_set][i]);
 		    break;
@@ -244,10 +251,12 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l)
 	c_p = *p;
 
 	if (me->T.decode_utf8) {
-      		    /* Combine UTF-8 into Unicode */
-		    /* Incomplete characters silently ignored */
-                    /* from Linux kernel's console.c */
-	    if((unsigned char)(*p) > 0x7f) {
+	    /*
+	    **  Combine UTF-8 into Unicode.
+	    **  Incomplete characters silently ignored.
+	    **  from Linux kernel's console.c
+	    */
+	    if ((unsigned char)(*p) > 0x7f) {
 		if (me->utf_count > 0 && (*p & 0xc0) == 0x80) {
 		    me->utf_char = (me->utf_char << 6) | (*p & 0x3f);
 		    me->utf_count--;
@@ -290,7 +299,6 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l)
 	    }
 	}
 	
-	
 	if (me->T.trans_to_uni && unsign_c >= 127) {
 	    unsign_c = UCTransToUni(c_p, me->in_char_set);
 	    if (unsign_c > 0) {
@@ -299,10 +307,11 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l)
 		}
 	    }
 	}
-
-    /* At this point we have either unsign_c in Unicode
-       (and c in latin1 if unsign_c is in the latin1 range),
-       or unsign_c and c will have to be passed raw. */
+	/*
+	**  At this point we have either unsign_c in Unicode
+	**  (and c in latin1 if unsign_c is in the latin1 range),
+	**  or unsign_c and c will have to be passed raw.
+	*/
 
 #else
 #define unsign_c (unsigned char)*p	
@@ -321,9 +330,11 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l)
 #define PASS8859SPECL HTPassHighCtrlRaw
 #define PASSHI8BIT HTPassEightBitRaw
 #else
-#define PASSHICTRL (me->T.transp || unsign_c >= LYlowest_eightbit[me->in_char_set])
+#define PASSHICTRL (me->T.transp || \
+		    unsign_c >= LYlowest_eightbit[me->in_char_set])
 #define PASS8859SPECL me->T.pass_160_173_raw
-#define PASSHI8BIT (HTPassEightBitRaw || (me->T.do_8bitraw && !me->T.trans_from_uni))
+#define PASSHI8BIT (HTPassEightBitRaw || \
+		    (me->T.do_8bitraw && !me->T.trans_from_uni))
 #endif /* EXP_CHARTRANS */
 
 	/*
@@ -332,7 +343,7 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l)
 	**  doesn't match, the user should toggle raw/CJK mode off. - FM
 	*/
 	} else if (unsign_c >= 127 && unsign_c < 161 &&
-		    PASSHICTRL && PASS8859SPECL) {
+		   PASSHICTRL && PASS8859SPECL) {
 	    HText_appendCharacter(me->text, *p);
 	} else if (unsign_c == 173 && PASS8859SPECL) {
 	    HText_appendCharacter(me->text, *p);
@@ -352,7 +363,10 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l)
 	} else if (me->T.strip_raw_char_in &&
 		   (unsigned char)*p >= 0xc0 &&
 		   (unsigned char)*p < 255) {
-	    /* KOI special: strip high bit, gives (somewhat) readable ASCII */
+	    /*
+	    **  KOI special: strip high bit, gives
+	    **  (somewhat) readable ASCII.
+	    */
 	    HText_appendCharacter(me->text, (char)(*p & 0x7f));
 #endif /* EXP_CHARTRANS */
 	/*
@@ -372,33 +386,37 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l)
  *   I. LATIN-1 OR UCS2  TO  DISPLAY CHARSET
  ******************************************************************/  
 	} else if ((chk = (me->T.trans_from_uni && unsign_c >= 160)) &&
-		   (uck = UCTransUniChar(unsign_c, me->htext_char_set)) >= 32 &&
+		   (uck = UCTransUniChar(unsign_c,
+					 me->htext_char_set)) >= 32 &&
 		   uck < 256) {
-	    if (TRACE)
-	      fprintf(stderr,"UCTransUniChar returned 0x%lx:'%c'.\n",uck,(char)uck);
+	    if (TRACE) {
+		fprintf(stderr,
+			"UCTransUniChar returned 0x%lx:'%c'.\n",
+			uck, (char)uck);
+	    }
 	    HText_appendCharacter(me->text, (char)(uck & 0xff));
 	} else if (chk && (uck == -4) &&
-		                 /* Not found; look for replacement string */
-		(uck = UCTransUniCharStr(replace_buf,60, unsign_c,
-					 me->htext_char_set, 0) >= 0 ) ) { 
-	      /* No further tests for valididy - assume that whoever
-		 defined replacement strings knew what she was doing. */
-
-	      HText_appendText(me->text, replace_buf);
-
+		   /*
+		   **  Not found; look for replacement string.
+		   */
+		   (uck = UCTransUniCharStr(replace_buf,60, unsign_c,
+					    me->htext_char_set, 0) >= 0)) { 
+	    /*
+	    **  No further tests for valididy - assume that whoever
+	    **  defined replacement strings knew what she was doing.
+	    */
+	    HText_appendText(me->text, replace_buf);
 	/*
-	**  If we get to here, and should have translated, translation has
-	**  failed so far.  
+	**  If we get to here, and should have translated,
+	**  translation has failed so far.  
 	*/
 	} else if (chk && unsign_c > 127 && me->T.output_utf8 &&
-	    *me->utf_buf) {
+		   *me->utf_buf) {
 	    HText_appendText(me->text, me->utf_buf);
 	    me->utf_buf_p = me->utf_buf;
 	    *(me->utf_buf_p) = '\0';
-
-	    
 	} else if (me->T.trans_from_uni && unsign_c > 255) {
-	    sprintf(replace_buf,"U%.2lx",unsign_c);
+	    sprintf(replace_buf, "U%.2lx", unsign_c);
 	    HText_appendText(me->text, replace_buf);
 #endif /* EXP_CHARTRANS */
 
@@ -420,13 +438,13 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l)
 		int value = (int)(unsign_c - 160);
 		name = HTMLGetEntityName(value);
 		len =  strlen(name);
-		for(low=0, high = HTML_dtd.number_of_entities;
+		for(low = 0, high = HTML_dtd.number_of_entities;
 		    high > low;
 		    diff < 0 ? (low = i+1) : (high = i)) {
 		    /* Binary search */
 		    i = (low + (high-low)/2);
 		    diff = strncmp(HTML_dtd.entity_names[i], name, len);
-		    if (diff==0) {
+		    if (diff == 0) {
 			HText_appendText(me->text,
 					 LYCharSets[current_char_set][i]);
 			break;
@@ -483,27 +501,27 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l)
     }
 }
 
-
 /*	Free an HTML object
 **	-------------------
 **
 **	Note that the SGML parsing context is freed, but the created object is
 **	not, as it takes on an existence of its own unless explicitly freed.
 */
-PRIVATE void HTPlain_free ARGS1(HTStream *, me)
+PRIVATE void HTPlain_free ARGS1(
+	HTStream *,	me)
 {
     FREE(me);
 }
 
-
 /*	End writing
 */
-PRIVATE void HTPlain_abort ARGS2(HTStream *, me, HTError, e)
+PRIVATE void HTPlain_abort ARGS2(
+	HTStream *,	me,
+	HTError,	e)
 {
     HTPlain_free(me);
 }
 
-
 /*		Structured Object Class
 **		-----------------------
 */
@@ -515,7 +533,6 @@ PUBLIC CONST HTStreamClass HTPlain =
 	HTPlain_put_character, 	HTPlain_put_string, HTPlain_write,
 }; 
 
-
 /*		New object
 **		----------
 */
@@ -540,7 +557,7 @@ PUBLIC HTStream* HTPlainPresent ARGS3(
     me->htext_char_set =
 		      HTAnchor_getUCLYhndl(anchor,UCT_STAGE_HTEXT);
     me->in_char_set = HTAnchor_getUCLYhndl(anchor,UCT_STAGE_PARSER);
-    htplain_get_chartrans_info(me, anchor);
+    HTPlain_getChartransInfo(me, anchor);
     UCSetTransParams(&me->T,
 		     me->in_char_set, me->UCI,
 		     me->htext_char_set,
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index b3c3b16e..62c38095 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -627,8 +627,9 @@ PUBLIC CONST char * HTHostName NOARGS
 }
 
 /*
-**  Interruptable connect as implemented by Marc Andreesen and
-**  hacked in by Lou Montulli.
+**  Interruptable connect as implemented for Mosaic by Marc Andreesen
+**  and hacked in for Lynx years ago by Lou Montulli, and further
+**  modified over the years by numerous Lynx lovers. - FM
 */ 
 PUBLIC int HTDoConnect ARGS4(
 	CONST char *,	url,
@@ -640,6 +641,9 @@ PUBLIC int HTDoConnect ARGS4(
     struct sockaddr_in *sin = &soc_address;
     int status;
     char *line = NULL;
+    char *p1 = NULL;
+    char *at_sign = NULL;
+    char *host = NULL;
 
     /*
     **  Set up defaults.
@@ -650,49 +654,42 @@ PUBLIC int HTDoConnect ARGS4(
     /*
     **  Get node name and optional port number.
     */
-    {
-        char *p1 = HTParse(url, "", PARSE_HOST);
-        char *at_sign;
-        char *host = NULL;
-        int status;
-
-        /*
+    p1 = HTParse(url, "", PARSE_HOST);
+    if ((at_sign = strchr(p1, '@')) != NULL) {
+	/*
 	**  If there's an @ then use the stuff after it as a hostname.
 	*/
-        if ((at_sign = strchr(p1, '@')) != NULL)
-	    StrAllocCopy(host, (at_sign + 1));
-        else
-	    StrAllocCopy(host, p1);
-	FREE(p1);
-
-        line = (char *)malloc(strlen(host) + strlen(protocol) + 128);
-        if (line == NULL)
-            outofmem(__FILE__, "HTDoConnect");
-        sprintf (line, "Looking up %s.", host);
-        _HTProgress (line);
-
-        status = HTParseInet(sin, host);
-        if (status) {
-	    if (status != HT_INTERRUPTED) {
-		sprintf (line, "Unable to locate remote host %s.", host);
-		_HTProgress(line);
-		status = HT_NO_DATA;
-	    }
-	    FREE(host);
-	    FREE(line);
-            return status;
-        }
-
-        sprintf (line, "Making %s connection to %s.", protocol, host);
-        _HTProgress (line);
-        FREE(host);
+	StrAllocCopy(host, (at_sign + 1));
+    } else {
+	StrAllocCopy(host, p1);
+    }
+    FREE(p1);
+
+    line = (char *)malloc(strlen(host) + strlen(protocol) + 128);
+    if (line == NULL)
+	outofmem(__FILE__, "HTDoConnect");
+    sprintf (line, "Looking up %s.", host);
+    _HTProgress (line);
+    status = HTParseInet(sin, host);
+    if (status) {
+	if (status != HT_INTERRUPTED) {
+	    sprintf (line, "Unable to locate remote host %s.", host);
+	    _HTProgress(line);
+	    status = HT_NO_DATA;
+	}
+	FREE(host);
+	FREE(line);
+        return status;
     }
 
+    sprintf (line, "Making %s connection to %s.", protocol, host);
+    _HTProgress (line);
+    FREE(host);
+
     /*
     **  Now, let's get a socket set up from the server for the data.
     */
     *s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-   
     if (*s == -1) {
 	HTAlert("socket failed.");
 	FREE(line);
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index e617b9c8..980b8f6e 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -51,7 +51,6 @@ extern BOOL LYNoFromHeader;	/* Never send From header? */
 extern BOOL LYSetCookies;	/* Act on Set-Cookie headers? */
 
 extern BOOL using_proxy;	/* Are we using an HTTP gateway? */
-PUBLIC BOOL auth_proxy = NO;	/* Generate a proxy authentication. - AJL */
 PUBLIC BOOL reloading = FALSE;	/* Reloading => send no-cache pragma to proxy */
 PUBLIC char * redirecting_url = NULL;	    /* Location: value. */
 PUBLIC BOOL permanent_redirection = FALSE;  /* Got 301 status? */
@@ -68,7 +67,8 @@ extern BOOL dump_output_immediately;  /* TRUE if no interactive user */
 extern char * HTLoadedDocumentURL NOPARAMS;
 extern int HTCheckForInterrupt NOPARAMS;
 extern void LYSetCookie PARAMS((
-	CONST char *	header,
+	CONST char *	SetCookie,
+	CONST char *	SetCookie2,
 	CONST char *	address));
 extern char * LYCookie PARAMS((
 	CONST char *	hostname,
@@ -106,7 +106,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
 {
   int s;			/* Socket number for returned data */
   char *url = (char *)arg;	/* The URL which get_physical() returned */
-  char *command=NULL;		/* The whole command */
+  char *command = NULL;		/* The whole command */
   char *eol;			/* End of line if found */
   char *start_of_data;		/* Start of body of reply */
   int status;			/* tcp return */
@@ -126,6 +126,8 @@ PUBLIC int HTLoadHTTP ARGS4 (
   char temp[80];
   BOOL first_Accept = TRUE;
   BOOL show_401 = FALSE;
+  BOOL show_407 = FALSE;
+  BOOL auth_proxy = NO;		/* Generate a proxy authorization. - AJL */
 
   int length, rv;
   BOOL doing_redirect, already_retrying = FALSE;
@@ -421,7 +423,8 @@ try_again:
 	    **  the ultimate target of the request. - AJL
 	    */
 	    auth_proxy = NO;
-	    if ((auth = HTAA_composeAuth(host2, port2, path2)) != NULL &&
+	    if ((auth = HTAA_composeAuth(host2, port2, path2,
+					 auth_proxy)) != NULL &&
 		*auth != '\0') {
 		/*
 		**  If auth is not NULL nor zero-length, it's
@@ -501,7 +504,9 @@ try_again:
 	**  Authorization header. - FM & AJL
 	*/
         if ((auth = HTAA_composeAuth(hostname,
-				     portnumber, docname)) != NULL &&
+				     portnumber,
+				     docname,
+				     auth_proxy)) != NULL &&
 	    *auth != '\0') {
 	    /*
 	    **  If auth is not NULL nor zero-length, it's
@@ -512,7 +517,7 @@ try_again:
             StrAllocCat(command, line);
 	    if (TRACE)
                 fprintf(stderr,
-			(using_proxy ?
+			(auth_proxy ?
 			 "HTTP: Sending proxy authorization: %s\n" :
 			 "HTTP: Sending authorization: %s\n"),
 			auth);
@@ -524,7 +529,11 @@ try_again:
 	    */
 	    if (!(traversal || dump_output_immediately) &&
 	    	HTConfirm("Proceed without a username and password?")) {
-	        show_401 = TRUE;
+		if (auth_proxy == TRUE) {
+		    show_407 = TRUE;
+		} else {
+		    show_401 = TRUE;
+		}
 	    } else {
 	        if (traversal || dump_output_immediately)
 		    HTAlert("Can't proceed without a username and password.");
@@ -537,13 +546,14 @@ try_again:
         } else {
 	    if (TRACE)
                 fprintf(stderr,
-			(using_proxy ?
+			(auth_proxy ?
 			 "HTTP: Not sending proxy authorization (yet).\n" :
 			 "HTTP: Not sending authorization (yet).\n"));
         }
         FREE(hostname);
         FREE(docname);
       }
+      auth_proxy = NO;
   }
 
   if (do_post)
@@ -1062,10 +1072,12 @@ try_again:
 	      }
 
 	      /*
-	      **  Look for "Set-Cookie:" headers. - FM
+	      **  Look for "Set-Cookie:" and "Set-Cookie2:" headers. - FM
 	      */
 	      if (LYSetCookies == TRUE) {
 	          char *value = NULL;
+		  char *SetCookie = NULL;
+		  char *SetCookie2 = NULL;
 	          cp = line_kept_clean;
 		  while (*cp) {
 		      /*
@@ -1087,7 +1099,7 @@ Cookie_continuation:
 			  /*
 			   *  Trim leading spaces. - FM
 			   */
-			  while (*cp == ' ')
+			  while (isspace((unsigned char)*cp))
 			      cp++;
 			  /*
 			  **  Accept CRLF, LF, or CR as end of line. - FM
@@ -1108,7 +1120,13 @@ Cookie_continuation:
 			      if (cp2)
 				  *cp2 = CR;
 			      if (value != NULL) {
-			          LYSetCookie(value, anAnchor->address);
+				  HTMIME_TrimDoubleQuotes(value);
+				  if (SetCookie == NULL) {
+				      StrAllocCopy(SetCookie, value);
+				  } else {
+				      StrAllocCat(SetCookie, ", ");
+				      StrAllocCat(SetCookie, value);
+				  }
 				  FREE(value);
 			      }
 			      break;
@@ -1121,20 +1139,107 @@ Cookie_continuation:
 			  }
 			  if (cp2) {
 			      *cp2 = CR;
-			      cp1 = NULL;
+			      cp2 = NULL;
 			  }
-			  if (*cp == ' ' || *cp == '\t') {
+			  cp1 = cp;
+			  if (*cp1 == CR)
+			     cp1++;
+			  if (*cp1 == LF)
+			     cp1++;
+			  if (*cp1 == ' ' || *cp1 == '\t') {
 			      StrAllocCat(value, " ");
+			      cp = cp1;
 			      cp++;
+			      cp1 = NULL;
 			      goto Cookie_continuation;
 			  }
-			  LYSetCookie(value, anAnchor->address);
+			  HTMIME_TrimDoubleQuotes(value);
+			  if (SetCookie == NULL) {
+			      StrAllocCopy(SetCookie, value);
+			  } else {
+			      StrAllocCat(SetCookie, ", ");
+			      StrAllocCat(SetCookie, value);
+			  }
+			  FREE(value);
+		      } else if (!strncasecomp(cp, "Set-Cookie2:", 12))  {
+		          char *cp1 = NULL, *cp2 = NULL;
+			  cp += 12;
+Cookie2_continuation:
+			  /*
+			   *  Trim leading spaces. - FM
+			   */
+			  while (isspace((unsigned char)*cp))
+			      cp++;
+			  /*
+			  **  Accept CRLF, LF, or CR as end of line. - FM
+			  */
+			  if (((cp1 = strchr(cp, LF)) != NULL) ||
+			      (cp2 = strchr(cp, CR)) != NULL) {
+			      if (*cp1) {
+			          *cp1 = '\0';
+				  if ((cp2 = strchr(cp, CR)) != NULL)
+				      *cp2 = '\0';
+			      } else {
+			          *cp2 = '\0';
+			      }
+			  }
+			  if (*cp == '\0') {
+			      if (cp1)
+				  *cp1 = LF;
+			      if (cp2)
+				  *cp2 = CR;
+			      if (value != NULL) {
+			          HTMIME_TrimDoubleQuotes(value);
+				  if (SetCookie2 == NULL) {
+				      StrAllocCopy(SetCookie2, value);
+				  } else {
+				      StrAllocCat(SetCookie2, ", ");
+				      StrAllocCat(SetCookie2, value);
+				  }
+				  FREE(value);
+			      }
+			      break;
+			  }
+			  StrAllocCat(value, cp);
+			  cp += strlen(cp);
+			  if (cp1) {
+			      *cp1 = LF;
+			      cp1 = NULL;
+			  }
+			  if (cp2) {
+			      *cp2 = CR;
+			      cp2 = NULL;
+			  }
+			  cp1 = cp;
+			  if (*cp1 == CR)
+			     cp1++;
+			  if (*cp1 == LF)
+			     cp1++;
+			  if (*cp1 == ' ' || *cp1 == '\t') {
+			      StrAllocCat(value, " ");
+			      cp = cp1;
+			      cp++;
+			      cp1 = NULL;
+			      goto Cookie2_continuation;
+			  }
+			  HTMIME_TrimDoubleQuotes(value);
+			  if (SetCookie2 == NULL) {
+			      StrAllocCopy(SetCookie2, value);
+			  } else {
+			      StrAllocCat(SetCookie2, ", ");
+			      StrAllocCat(SetCookie2, value);
+			  }
 			  FREE(value);
 		      } else {
 		          cp++;
 		      }
 		  }
 		  FREE(value);
+		  if (SetCookie != NULL || SetCookie2 != NULL) {
+		      LYSetCookie(SetCookie, SetCookie2, anAnchor->address);
+		      FREE(SetCookie);
+		      FREE(SetCookie2);
+		  }
 	      }
 
 	      /*
@@ -1145,12 +1250,13 @@ Cookie_continuation:
 	        if (TOUPPER(*cp) != 'L') {
 		    cp++;
 	        } else if (!strncasecomp(cp, "Location:", 9)) {
+		    char *value = NULL;
 	            char *cp1 = NULL, *cp2 = NULL;
 	            cp += 9;
 		    /*
 		     *  Trim leading spaces. - FM
 		     */
-		    while (*cp == ' ')
+		    while (isspace((unsigned char)*cp))
 		        cp++;
 		    /*
 		     *  Accept CRLF, LF, or CR as end of header. - FM
@@ -1164,7 +1270,13 @@ Cookie_continuation:
 			} else {
 			    *cp2 = '\0';
 			}
-			if (*cp == '\0') {
+			/*
+			 *  Load the new URL into redirecting_url,
+			 *  and make sure it's not zero-length. - FM
+			 */
+			StrAllocCopy(redirecting_url, cp);
+			HTMIME_TrimDoubleQuotes(redirecting_url);
+			if (*redirecting_url == '\0') {
 			    /*
 			     *  The "Location:" value is zero-length, and
 			     *  thus is probably something in the body, so
@@ -1177,6 +1289,7 @@ Cookie_continuation:
 			        *cp1 = LF;
 			    if (cp2)
 			        *cp2 = CR;
+			    FREE(redirecting_url);
 			    doing_redirect = FALSE;
 			    permanent_redirection = FALSE;
 			    start_of_data = line_kept_clean;
@@ -1188,16 +1301,15 @@ Cookie_continuation:
 			}
 
 			/*
-			 *  Load the new URL into redirecting_url,
-			 *  which will be checked in LYGetFile.c
-			 *  for restrictions before seeking the
-			 *  document at that Location. - FM
+			 *  Set up for checking redirecting_url in
+			 *  LYGetFile.c for restrictions before we
+			 *  seek the document at that Location. - FM
 			 */
-		        StrAllocCopy(redirecting_url, cp);
 			HTProgress(line_buffer);
                         if (TRACE)
                             fprintf(stderr,
-			    	    "HTTP: Picked up location '%s'\n", cp);
+			    	    "HTTP: Picked up location '%s'\n",
+				    redirecting_url);
 			if (cp1)
 		            *cp1 = LF;
 		        if (cp2)
@@ -1304,11 +1416,10 @@ Cookie_continuation:
 		 *  to show the 401 body or restore the current
 		 *  document. - FM
 		 */
-		auth_proxy = NO;
 		if (show_401)
 		    break;
 		if (HTAA_shouldRetryWithAuth(start_of_data, length,
-					     (void *)handle, s)) {
+					     (void *)handle, s, NO)) {
  		    extern char *authentication_info[2];
 
                     HTTP_NETCLOSE(s, handle);
@@ -1349,7 +1460,7 @@ Cookie_continuation:
 	        /*
 		 *  Authorization for proxy server required.
 		 *  If we are not in fact using a proxy, or
-		 *  show_401 is set, proceed to showing the
+		 *  show_407 is set, proceed to showing the
 		 *  407 body.  Otherwise, if we can set up
 		 *  authorization based on the Proxy-Authenticate
 		 *  header, and the user provides a username and
@@ -1357,19 +1468,18 @@ Cookie_continuation:
 		 *  to show the 401 body or restore the current
 		 *  document. - FM & AJL
 		 */
-		if (!using_proxy || show_401)
+		if (!using_proxy || show_407)
 		    break;
-		auth_proxy = YES;
 		if (HTAA_shouldRetryWithAuth(start_of_data, length,
-					     (void *)handle, s)) {
- 		    extern char *authentication_info[2];
+					     (void *)handle, s, YES)) {
+ 		    extern char *proxyauth_info[2];
 
                     HTTP_NETCLOSE(s, handle);
-                    if (dump_output_immediately && !authentication_info[0]) {
+                    if (dump_output_immediately && !proxyauth_info[0]) {
                         fprintf(stderr,
 		      		"HTTP: Proxy authorization required.\n");
                         fprintf(stderr,
-		      		"       Use the -auth=id:pw parameter.\n");
+		      		"       Use the -pauth=id:pw parameter.\n");
                         status = HT_NO_DATA;
                         goto clean_up;
                     }
@@ -1391,7 +1501,7 @@ Cookie_continuation:
                 } else {
 		    if (traversal || dump_output_immediately)
 		        HTAlert(
-	"Can't retry with proxy authorization!  Contact the server's WebMaster.");
+    "Can't retry with proxy authorization!  Contact the server's WebMaster.");
 		    HTTP_NETCLOSE(s, handle);
                     status = -1;
                     goto clean_up;
diff --git a/WWW/Library/Implementation/HTVMSUtils.c b/WWW/Library/Implementation/HTVMSUtils.c
index a71da6e4..495c71ca 100644
--- a/WWW/Library/Implementation/HTVMSUtils.c
+++ b/WWW/Library/Implementation/HTVMSUtils.c
@@ -17,6 +17,9 @@
 #include "tcp.h"
 #include "HTFormat.h"
 #include "HTStream.h"
+#include "UCDefs.h"
+#include "UCMap.h"
+#include "UCAux.h"
 #include "HTVMSUtils.h"
 /*#include <stdio.h> included by HTUtils.h -- FM */
 /*#include <unixlib.h> included by HTUtils.h -- FM */
@@ -918,6 +921,12 @@ PUBLIC int HTVMSBrowseDir ARGS4(
      *  Set up the output stream.
      */
     _HTProgress ("Building directory listing...");
+    if (UCLYhndl_HTFile_for_unspec >= 0) {
+	HTAnchor_setUCInfoStage(anchor,
+				UCLYhndl_HTFile_for_unspec,
+				UCT_STAGE_PARSER,
+				UCT_SETBY_DEFAULT);
+    }
     target = HTML_new(anchor, format_out, sink);
     targetClass = *(target->isa);
 
diff --git a/WWW/Library/Implementation/HText.h b/WWW/Library/Implementation/HText.h
index 7b65751a..64000eab 100644
--- a/WWW/Library/Implementation/HText.h
+++ b/WWW/Library/Implementation/HText.h
@@ -151,8 +151,11 @@ extern void HText_appendHorizontalRule PARAMS((HText * text));
    nested.
    
  */
-extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
-extern void HText_endAnchor PARAMS((HText * text));
+extern int HText_beginAnchor PARAMS((
+	HText *		text,
+	BOOL		underline,
+	HTChildAnchor *	anc));
+extern void HText_endAnchor PARAMS((HText * text, int number));
 
 
 /*
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index 1ae3a8b1..6e8edf75 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -21,6 +21,12 @@
 #include "SGML.h"
 #include "HTMLDTD.h"
 #include "HTCJK.h"
+#ifdef EXP_CHARTRANS
+#include "UCMap.h"
+#include "UCDefs.h"
+#include "UCAux.h"
+#endif
+
 
 #include <ctype.h>
 /*#include <stdio.h> included in HTUtils.h -- FM */
@@ -28,12 +34,6 @@
 
 #include "LYLeaks.h"
 
-#ifdef EXP_CHARTRANS
-#include "UCMap.h"
-#include "UCDefs.h"
-#include "UCAux.h"
-#endif
-
 #define INVALID (-1)
 
 #define FREE(x) if (x) {free(x); x = NULL;}
@@ -85,7 +85,7 @@ struct _HTStream {
     HTElement			*element_stack;
     enum sgml_state { S_text, S_litteral,
     		S_tag, S_tag_gap, S_attr, S_attr_gap, S_equals, S_value,
-		S_ero, S_cro,
+		S_ero, S_cro, S_incro,
 		S_exclamation, S_comment, S_doctype, S_marked,
 		S_sgmlent, S_sgmlele, S_sgmlatt,
 		S_squoted, S_dquoted, S_end, S_entity,
@@ -108,6 +108,20 @@ struct _HTStream {
     BOOL			doctype_bracket;
     BOOL			first_bracket;
     BOOL			second_bracket;
+    BOOL			isHex;
+
+#ifdef EXP_CHARTRANS
+    HTParentAnchor *		node_anchor;
+    LYUCcharset	*		UCI;		/* anchor UCInfo	    */
+    int				in_char_set;	/* charset we are fed	    */
+    LYUCcharset	*		htmlUCI;	/* anchor UCInfo for target */
+    int				html_char_set;	/* feed it to target stream */
+    char			utf_count;
+    long			utf_char;
+    char 			utf_buf[7];
+    char *			utf_buf_p;
+    UCTransParams		T;
+#endif /* EXP_CHARTRANS */
 
     char *			recover;
     int				recover_index;
@@ -116,18 +130,6 @@ struct _HTStream {
     char *			url;
     char *			csi;
     int				csi_index;
-#ifdef EXP_CHARTRANS
-    HTParentAnchor * node_anchor;
-    LYUCcharset	* UCI;	/* pointer into anchor's UCInfo */
-    int	in_char_set;		/* tells us what charset we are fed */
-    LYUCcharset	* htmlUCI; /* pointer into anchor's UCInfo for target*/
-    int	html_char_set;		/* tells us what we feed to target stream */
-    char                utf_count;
-    long                utf_char;
-    char	utf_buf[7];
-    char *	utf_buf_p;
-    UCTransParams T;
-#endif /* EXP_CHARTRANS */
 } ;
 
 #ifdef EXP_CHARTRANS
@@ -149,10 +151,10 @@ PRIVATE void set_chartrans_handling ARGS3(
 			    UCT_SETBY_DEFAULT);
 	HTAnchor_setUCInfoStage(anchor, chndl, UCT_STAGE_STRUCTURED,
 			    UCT_SETBY_DEFAULT);
-	context->htmlUCI = HTAnchor_getUCInfoStage(
-		                              anchor,UCT_STAGE_STRUCTURED);
-	context->html_char_set = HTAnchor_getUCLYhndl(
-		                context->node_anchor,UCT_STAGE_STRUCTURED);
+	context->htmlUCI = HTAnchor_getUCInfoStage(anchor,
+						   UCT_STAGE_STRUCTURED);
+	context->html_char_set = HTAnchor_getUCLYhndl(context->node_anchor,
+						      UCT_STAGE_STRUCTURED);
     }
     UCSetTransParams(&context->T,
 		     context->in_char_set, context->UCI,
@@ -165,20 +167,25 @@ PRIVATE void change_chartrans_handling ARGS1(
     int new_LYhndl = HTAnchor_getUCLYhndl(context->node_anchor,
 					  UCT_STAGE_PARSER);
     if (new_LYhndl != context->in_char_set &&
-	new_LYhndl >= 0) {	/* something changed. but ignore if a META
-				 wants an unknown charset. */
+	new_LYhndl >= 0) {
+	/*
+	 *  Something changed. but ignore if a META wants an unknown charset.
+	 */
 	LYUCcharset * new_UCI = HTAnchor_getUCInfoStage(context->node_anchor,
 							UCT_STAGE_PARSER);
 	if (new_UCI) {
             LYUCcharset * next_UCI = HTAnchor_getUCInfoStage(
-		                context->node_anchor,UCT_STAGE_STRUCTURED);
+				    context->node_anchor, UCT_STAGE_STRUCTURED
+							    );
 	    int next_LYhndl = HTAnchor_getUCLYhndl(
-                                context->node_anchor,UCT_STAGE_STRUCTURED);
+				    context->node_anchor, UCT_STAGE_STRUCTURED
+						  );
 	    context->UCI = new_UCI;
 	    context->in_char_set = new_LYhndl;
 	    context->htmlUCI = next_UCI;
 	    context->html_char_set = next_LYhndl;
-	    set_chartrans_handling(context, context->node_anchor, next_LYhndl);
+	    set_chartrans_handling(context,
+				   context->node_anchor, next_LYhndl);
 	}
     }
 }
@@ -291,9 +298,15 @@ PRIVATE BOOL put_special_unicodes ARGS2(
 			*/
 			PUTC('-');
     } else {
-	return NO;		/* return NO if nothing done */
+	/*
+	**  Return NO if nothing done.
+	*/
+	return NO;
     }
-    return YES;			/* we have handled it */
+    /*
+    **  We have handled it.
+    */
+    return YES;
 }
 #endif
 
@@ -370,7 +383,8 @@ PRIVATE void handle_entity ARGS2(
 #ifdef EXP_CHARTRANS
     /* repeat for extra entities if not found... hack... -kw */
     if (TRACE)
-       fprintf(stderr, "SGML: Unknown entity %s so far, checking extra...\n", s); 
+	fprintf(stderr,
+		"SGML: Unknown entity %s so far, checking extra...\n", s); 
     for (low = 0, high = context->dtd->number_of_extra_entities;
     	 high > low;
 	 diff < 0 ? (low = i+1) : (high = i)) {  /* Binary serach */
@@ -385,12 +399,16 @@ PRIVATE void handle_entity ARGS2(
 	    FoundEntity = TRUE;
 	    return;
 	  }
-	  if ((rc = UCTransUniChar(extra_entities[i].code,current_char_set))
-	      > 0) {   /* Could do further checks here... -kw */
+	    if ((rc = UCTransUniChar(extra_entities[i].code,
+				     current_char_set)) > 0) {
+		/*
+		 *  Could do further checks here... - KW
+		 */
 	    PUTC(rc);
 	    FoundEntity = TRUE;
 	    return;
-	  } else if ((rc == -4) && /* Not found; look for replacement string */
+	    } else if ((rc == -4) &&
+		       /* Not found; look for replacement string */
 		     (rc = UCTransUniCharStr(replace_buf,60,
 					     extra_entities[i].code,
 					     current_char_set, 0)   >= 0 ) ) { 
@@ -910,7 +928,7 @@ PUBLIC void SGML_abort ARGS2(
     FREE(context->csi);
 
     /*
-    **  Free stack memory if any elements were left open. - kw
+    **  Free stack memory if any elements were left open. - KW
     */
     while (context->element_stack) {
         cur = context->element_stack;
@@ -965,15 +983,15 @@ PUBLIC void SGML_character ARGS2(
 #ifdef EXP_CHARTRANS
     extern int LYlowest_eightbit[];
     char * p;
-    BOOLEAN chk;  /* helps (?) walk through all the else ifs... */
-    long clong,uck;			/* enough bits for UCS4 ... */
+    BOOLEAN chk;	/* Helps (?) walk through all the else ifs... */
+    long clong, uck;	/* Enough bits for UCS4 ... */
     char c;
     char saved_char_in = '\0';
-
-    /* Now some fun with the preprocessor...
-       for EXP_CHARTRANS, use copies for c an unsign_c==clong, so that we
-       can revert back to the unchanged c_in.
-       if EXP_CHARTRANS is undefined, these all are the same variable. */
+    /*
+    **  Now some fun with the preprocessor...
+    **  use copies for c an unsign_c == clong, so that we
+    **  can revert back to the unchanged c_in.
+    */
 #define unsign_c clong
 
 #else
@@ -986,53 +1004,70 @@ PUBLIC void SGML_character ARGS2(
     clong = (unsigned char)c;	/* a.k.a. unsign_c */
 
     if (context->T.decode_utf8) {
-      		    /* Combine UTF-8 into Unicode */
-		    /* Incomplete characters silently ignored */
-                    /* from Linux kernel's console.c */
-		    if((unsigned char)c > 0x7f) {
-			if (context->utf_count > 0 && (c & 0xc0) == 0x80) {
-				context->utf_char = (context->utf_char << 6) | (c & 0x3f);
-				context->utf_count--;
-				*(context->utf_buf_p++) = c;
-				if (context->utf_count == 0) {
-				  *(context->utf_buf_p) = '\0';
-				  clong = context->utf_char;
-				  if (clong<256) c = (char)clong;
-				  goto top1;
-				}
-				else return;  /* wait for more */
-			} else {
-				context->utf_buf_p = context->utf_buf;
-				*(context->utf_buf_p++) = c;
-				if ((c & 0xe0) == 0xc0) {
-				    context->utf_count = 1;
-				    context->utf_char = (c & 0x1f);
-				} else if ((c & 0xf0) == 0xe0) {
-				    context->utf_count = 2;
-				    context->utf_char = (c & 0x0f);
-				} else if ((c & 0xf8) == 0xf0) {
-				    context->utf_count = 3;
-				    context->utf_char = (c & 0x07);
-				} else if ((c & 0xfc) == 0xf8) {
-				    context->utf_count = 4;
-				    context->utf_char = (c & 0x03);
-				} else if ((c & 0xfe) == 0xfc) {
-				    context->utf_count = 5;
-				    context->utf_char = (c & 0x01);
-				} else { /* garbage */
-				    context->utf_count = 0;
-				    context->utf_buf_p = context->utf_buf;
-				    *(context->utf_buf_p) = '\0';
-				}
-				return; /* wait for more */
-			      }
-		    } else {	/* got an ASCII char */
-		      context->utf_count = 0;
-		      context->utf_buf_p = context->utf_buf;
-		      *(context->utf_buf_p) = '\0';
-		    /*  goto top;  */
+	/*
+	**  Combine UTF-8 into Unicode.
+	**  Incomplete characters silently ignored.
+	**  From Linux kernel's console.c.
+	*/
+	if((unsigned char)c > 0x7f) {
+	    if (context->utf_count > 0 && (c & 0xc0) == 0x80) {
+		context->utf_char = (context->utf_char << 6) | (c & 0x3f);
+		context->utf_count--;
+		*(context->utf_buf_p++) = c;
+		if (context->utf_count == 0) {
+		    *(context->utf_buf_p) = '\0';
+		    clong = context->utf_char;
+		    if (clong < 256) {
+			c = (char)clong;
 		    }
-		  }
+		    goto top1;
+		} else {
+		    /*
+		    **  Wait for more.
+		    */
+		    return;
+		}
+	    } else {
+		context->utf_buf_p = context->utf_buf;
+		*(context->utf_buf_p++) = c;
+		if ((c & 0xe0) == 0xc0) {
+		    context->utf_count = 1;
+		    context->utf_char = (c & 0x1f);
+		} else if ((c & 0xf0) == 0xe0) {
+		    context->utf_count = 2;
+		    context->utf_char = (c & 0x0f);
+		} else if ((c & 0xf8) == 0xf0) {
+		    context->utf_count = 3;
+		    context->utf_char = (c & 0x07);
+		} else if ((c & 0xfc) == 0xf8) {
+		    context->utf_count = 4;
+		    context->utf_char = (c & 0x03);
+		} else if ((c & 0xfe) == 0xfc) {
+		    context->utf_count = 5;
+		    context->utf_char = (c & 0x01);
+		} else {
+		    /*
+		    **  Garbage.
+		    */
+		    context->utf_count = 0;
+		    context->utf_buf_p = context->utf_buf;
+		    *(context->utf_buf_p) = '\0';
+		}
+		/*
+		**  Wait for more.
+		*/
+		return;
+	    }
+	} else {
+	    /*
+	    **  Got an ASCII char.
+	    */
+	    context->utf_count = 0;
+	    context->utf_buf_p = context->utf_buf;
+	    *(context->utf_buf_p) = '\0';
+		    /*  goto top;  */
+	}
+    }
 
     if (context->T.strip_raw_char_in)
 	saved_char_in = c;
@@ -1123,14 +1158,12 @@ top1:
 	    PUTC(c);
 	    break;
 	}
-	if (c == '&' && unsign_c < 127 && (!context->element_stack ||
+	if (c == '&' && unsign_c < 127  &&
+	    (!context->element_stack ||
 			 (context->element_stack->tag  &&
-	    		  (context->element_stack->tag->contents ==
-			  		SGML_MIXED ||
-			   context->element_stack->tag->contents ==
-			  		SGML_PCDATA ||
-			   context->element_stack->tag->contents ==
-			      		SGML_RCDATA)))) {
+	      (context->element_stack->tag->contents == SGML_MIXED ||
+	       context->element_stack->tag->contents == SGML_PCDATA ||
+	       context->element_stack->tag->contents == SGML_RCDATA)))) {
 	    /*
 	    **  Setting up for possible entity, without the leading '&'. - FM
 	    */
@@ -1168,28 +1201,37 @@ top1:
 
 #ifdef EXP_CHARTRANS
 	} else if (context->T.use_raw_char_in && saved_char_in) {
-	    /* only if the original character is still in saved_char_in,
-	       otherwise we may be iterating from a goto top */
+	    /*
+	    **  Only if the original character is still in saved_char_in,
+	    **  otherwise we may be iterating from a goto top
+	    */
 	    PUTC(saved_char_in);
 	    saved_char_in = '\0';
 /******************************************************************
  *   I. LATIN-1 OR UCS2  TO  DISPLAY CHARSET
  ******************************************************************/  
 	} else if ((chk = (context->T.trans_from_uni && unsign_c >= 160)) &&
-		   (uck = UCTransUniChar(unsign_c, context->html_char_set)) >= 32 &&
+		   (uck = UCTransUniChar(unsign_c,
+					 context->html_char_set)) >= 32 &&
 		   uck < 256) {
-	    if (TRACE)
-	      fprintf(stderr,"UCTransUniChar returned 0x%lx:'%c'.\n",uck,(char)uck);
+	    if (TRACE) {
+		fprintf(stderr,
+			"UCTransUniChar returned 0x%lx:'%c'.\n",
+			uck, (char)uck);
+	    }
 	    c = (char)(uck & 0xff);
 	    PUTC(c);
 	} else if (chk && (uck == -4) &&
-		                 /* Not found; look for replacement string */
+		/*
+		**  Not found; look for replacement string.
+		*/
 		(uck = UCTransUniCharStr(replace_buf,60, clong,
 					 context->html_char_set, 0) >= 0 ) ) { 
 	      CONST char *p;
-	      /* No further tests for valididy - assume that whoever
-		 defined replacement strings knew what she was doing. */
-		 
+	    /*
+	    **  No further tests for valididy - assume that whoever
+	    **  defined replacement strings knew what she was doing.
+	    */
 	      for (p=replace_buf; *p; p++)
 		PUTC(*p);
 #endif /* EXP_CHARTRANS */
@@ -1229,11 +1271,10 @@ top1:
 	} else if (unsign_c < 127 && unsign_c > 0) {
 	    PUTC(c);
 	/*
-	**  If we get to here, and should have translated, translation has
-	**  failed so far.  
+	**  If we get to here, and should have translated,
+	**  translation has failed so far.  
 	*/
-	} else if (context->T.output_utf8 &&
-	    *context->utf_buf) {
+	} else if (context->T.output_utf8 && *context->utf_buf) {
 	    for (p=context->utf_buf; *p; p++)
 		PUTC(*p);
 	    context->utf_buf_p = context->utf_buf;
@@ -1242,13 +1283,15 @@ top1:
 	} else if (context->T.strip_raw_char_in && saved_char_in &&
 		   ((unsigned char)saved_char_in >= 0xc0) &&
 		   ((unsigned char)saved_char_in < 255)) {
-	    /* KOI8 special: strip high bit, gives (somewhat) readable ASCII
-	     or KOI7 - it was constructed that way! */
+	    /*
+	    **  KOI8 special: strip high bit, gives (somewhat) readable
+	    **  ASCII or KOI7 - it was constructed that way!
+	    */
 	    PUTC((char)(saved_char_in & 0x7f));
 	    saved_char_in = '\0';
-	    
-	} else if ((unsigned char)c<LYlowest_eightbit[context->html_char_set]
-		   || (context->T.trans_from_uni && !HTPassEightBitRaw)) {
+	} else if ((unsigned char)c <
+			LYlowest_eightbit[context->html_char_set] ||
+		   (context->T.trans_from_uni && !HTPassEightBitRaw)) {
 	    sprintf(replace_buf,"U%.2lx",unsign_c);
 	    for (p=replace_buf; *p; p++)
 		PUTC(*p);
@@ -1344,40 +1387,79 @@ top1:
 	break;
 
     /*
-    **  Handle possible numeric entity.
+    **  Check for a numeric entity.
     */
     case S_cro:
-	if (unsign_c < 127 && isdigit((unsigned char)c)) {
+	if (unsign_c < 127 && (unsigned char)c == 'x') {
+	    context->isHex = TRUE;
+	    context->state = S_incro;
+	} else if (unsign_c < 127 && isdigit((unsigned char)c)) {
 	    /*
 	    **  Accept only valid ASCII digits. - FM
 	    */
 	    HTChunkPutc(string, c);	/* accumulate a character NUMBER */
+	    context->isHex = FALSE;
+	    context->state = S_incro;
 	} else if (string->size == 0) {
 	    /*
-	    **  No digits following the "&#" so recover
+	    **  No 'x' or digit following the "&#" so recover
 	    **  them and recycle the character. - FM
 	    */
 	    PUTC('&');
 	    PUTC('#');
 	    context->state = S_text;
 	    goto top1;
+	}
+	break;
+
+    /*
+    **  Handle a numeric entity.
+    */
+    case S_incro:
+	if ((unsign_c < 127) &&
+	    (context->isHex ? isxdigit((unsigned char)c) :
+			      isdigit((unsigned char)c))) {
+	    /*
+	    **  Accept only valid hex or ASCII digits. - FM
+	    */
+	    HTChunkPutc(string, c);	/* accumulate a character NUMBER */
+	} else if (string->size == 0) {
+	    /*
+	    **  No hex digit following the "&#x" so recover
+	    **  them and recycle the character. - FM
+	    */
+	    PUTC('&');
+	    PUTC('#');
+	    PUTC('x');
+	    context->isHex = FALSE;
+	    context->state = S_text;
+	    goto top1;
 	} else {
 	    /*
 	    **  Terminate the numeric entity and try to handle it. - FM
 	    */
 	    int value, i;
 	    HTChunkTerminate(string);
-	    if (sscanf(string->data, "%d", &value) == 1) {
+	    if ((context->isHex ? sscanf(string->data, "%x", &value) :
+				  sscanf(string->data, "%d", &value)) == 1) {
 #ifdef EXP_CHARTRANS
-	      if (value==160) {
-		    /* we *always* should interpret this as Latin1 here! */
-		PUTC(1);
-		string->size = 0;
-		context->state = S_text;
-		if (c != ';')
-		    goto top1;
-		break;
-	      }
+		if (value == 160) {
+		    /*
+		    **  We *always* should interpret this as Latin1 here!
+		    **  Output the Lynx special character for nbsp and
+		    **  then recycle the terminator or break. - FM
+		    */
+		    PUTC(1);
+		    string->size = 0;
+		    context->isHex = FALSE;
+		    context->state = S_text;
+		    if (c != ';')
+			goto top1;
+		    break;
+		}
+		/*
+		 *  Seek a translation from the chartrans tables.
+		 */
 	      if ((uck = UCTransUniChar(value,current_char_set)) >= 32 &&
 		    uck < 256 &&
 		      (uck < 127 ||
@@ -1389,14 +1471,18 @@ top1:
 		  else if (uck==173 && current_char_set==0) 
 		      PUTC(7); /* would only happen if some other unicode
 				  is mapped to Latin-1 173 */
-		  else
+		  else {
 		      PUTC(FROMASCII((char)uck));
-	      } else
-	      if ((uck == -4) && /* Not found; look for replacement string */
+		  }
+	      } else if ((uck == -4) &&
+			   /*
+			   **  Not found; look for replacement string.
+			   */
 		(uck = UCTransUniCharStr(replace_buf,60,value,
 				      current_char_set, 0)   >= 0 ) ) { 
-		for (p=replace_buf; *p; p++)
-		  PUTC(*p);
+		    for (p = replace_buf; *p; p++) {
+			PUTC(*p);
+		    }
 	      } else if (context->T.output_utf8 &&
 			 PUTUTF8(value)) {
 		  /* do nothing more */ ;
@@ -1412,12 +1498,14 @@ top1:
 		    HTChunkPutc(string, 'a');
 		    HTChunkPutc(string, 'd');
 		    HTChunkPutc(string, 'e');
+		    context->isHex = FALSE;
 		    context->state = S_entity;
 		    goto top1;
-		} else
 	        /*
-		** Show the numeric entity if the value:
-		**  (1) Is greater than 255 (until we support Unicode).
+		**  Show the numeric entity if we get to here
+		**  and the value:
+		**   (1) Is greater than 255 (but use ASCII characters
+		**	 for spaces or dashes).
 		**  (2) Is less than 32, and not valid or we don't
 		**	have HTCJK set.
 		**  (3) Is 127 and we don't have HTPassHighCtrlRaw or
@@ -1426,7 +1514,7 @@ top1:
 		**	set.
 		** - FM
 		*/
-	        if ((value > 255) ||
+		} else if ((value > 255) ||
 		    (value < 32 &&
 		     value != 9 && value != 10 && value != 13 &&
 		     HTCJK == NOCJK) ||
@@ -1446,15 +1534,21 @@ top1:
 			PUTC('-');
 		    } else {
 			/*
-			**  Unhandled or llegal value.  Recover the "&#"
-			**  and digit(s), and recycle the terminator. - FM
+			**  Unhandled or illegal value.  Recover the
+			**  "&#" or "&#x" and digit(s), and recycle
+			**  the terminator. - FM
 			*/
 			PUTC('&');
 			PUTC('#');
+			if (context->isHex) {
+			    PUTC('x');
+			    context->isHex = FALSE;
+			}
 			string->size--;
 			for (i = 0; i < string->size; i++)	/* recover */
 			    PUTC(string->data[i]);
 			string->size = 0;
+			context->isHex = FALSE;
 			context->state = S_text;
 			goto top1;
 		    }
@@ -1501,10 +1595,15 @@ top1:
 			*/
 			PUTC('&');
 			PUTC('#');
+			if (context->isHex) {
+			    PUTC('x');
+			    context->isHex = FALSE;
+			}
 			string->size--;
 			for (i = 0; i < string->size; i++)	/* recover */
 			    PUTC(string->data[i]);
 			string->size = 0;
+			context->isHex = FALSE;
 			context->state = S_text;
 			goto top1;
 		    }
@@ -1513,6 +1612,7 @@ top1:
 		**  If we get to here, we succeeded.  Hoorah!!! - FM
 		*/
 		string->size = 0;
+		context->isHex = FALSE;
 		context->state = S_text;
 		/*
 		**  Don't eat the terminator if it's not
@@ -1522,15 +1622,20 @@ top1:
 		    goto top1;
 	    } else {
 	        /*
-		**  Not an entity, and don't know why not, so add the
-		**  terminator to the string, output the "&#", and
-		**  process the string via the recover element. - FM
+		**  Not an entity, and don't know why not, so add
+		**  the terminator to the string, output the "&#"
+		**  or "&#x", and process the string via the recover
+		**  element. - FM
 		*/
 		string->size--;
 		HTChunkPutc(string, c);
 		HTChunkTerminate(string);
 	        PUTC('&');
 	        PUTC('#');
+		if (context->isHex) {
+		    PUTC('x');
+		    context->isHex = FALSE;
+		}
 		if (context->recover == NULL) {
 		    StrAllocCopy(context->recover, string->data);
 		    context->recover_index = 0;
@@ -1538,6 +1643,7 @@ top1:
 		    StrAllocCat(context->recover, string->data);
 		}
 		string->size = 0;
+		context->isHex = FALSE;
 		context->state = S_text;
 		break;
 	    }
@@ -2438,14 +2544,8 @@ PUBLIC HTStream* SGML_new  ARGS3(
     context->doctype_bracket = FALSE;
     context->first_bracket = FALSE;
     context->second_bracket = FALSE;
-    context->recover = NULL;
+    context->isHex = FALSE;
 
-    context->recover_index = 0;
-    context->include = NULL;
-    context->include_index = 0;
-    context->url = NULL;
-    context->csi = NULL;
-    context->csi_index = 0;
 #ifdef EXP_CHARTRANS
     context->node_anchor = anchor; /*only for chartrans info. could be NULL? */
 
@@ -2455,18 +2555,24 @@ PUBLIC HTStream* SGML_new  ARGS3(
     context->utf_buf_p = context->utf_buf;
 
     UCTransParams_clear(&context->T);
-    context->in_char_set =
-	HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER);
+    context->in_char_set = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER);
     if (context->in_char_set < 0) {
-	HTAnchor_copyUCInfoStage(anchor, UCT_STAGE_PARSER, UCT_STAGE_MIME,
-				         -1);
-	context->in_char_set =
-	    HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER);
+	HTAnchor_copyUCInfoStage(anchor,
+				 UCT_STAGE_PARSER, UCT_STAGE_MIME, -1);
+	context->in_char_set = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER);
     }
     context->UCI=HTAnchor_getUCInfoStage(anchor, UCT_STAGE_PARSER);
     set_chartrans_handling(context, anchor, -1);
 #endif /* EXP_CHARTRANS */
 
+    context->recover = NULL;
+    context->recover_index = 0;
+    context->include = NULL;
+    context->include_index = 0;
+    context->url = NULL;
+    context->csi = NULL;
+    context->csi_index = 0;
+
     return context;
 }
 
diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h
index 2a9f985c..42524cbe 100644
--- a/WWW/Library/Implementation/SGML.h
+++ b/WWW/Library/Implementation/SGML.h
@@ -31,16 +31,17 @@
 SGML content types
 
  */
-typedef enum _SGMLContent{
-  SGML_EMPTY,    /* no content */
-  SGML_LITTERAL, /* character data. Recognised excat close tag only. litteral
-                    Old www server compatibility only! Not SGML */
-  SGML_CDATA,    /* character data. recognize </ only */
-  SGML_RCDATA,   /* replaceable character data. recognize </ and &ref; */
-  SGML_MIXED,    /* elements and parsed character data. recognize all markup */
-  SGML_ELEMENT,  /* any data found will be returned as an error*/
-  SGML_PCDATA    /* added - kw */
-  } SGMLContent;
+typedef enum _SGMLContent {
+    SGML_EMPTY,    /* No content. */
+    SGML_LITTERAL, /* Literal character data.  Recognize exact close tag only.
+		      Old www server compatibility only!  Not SGML */
+    SGML_CDATA,    /* Character data.  Recognize </ only. */
+    SGML_RCDATA,   /* Replaceable character data.  Recognize </ and &ref; */
+    SGML_MIXED,    /* Elements and parsed character data.
+		      Recognize all markup. */
+    SGML_ELEMENT,  /* Any data found will be returned as an error. */
+    SGML_PCDATA    /* Added by KW. */
+} SGMLContent;
 
 
 typedef struct {
@@ -124,17 +125,15 @@ struct _tag{
 };
 
 
-
-
 /*              DTD Information
 **              ---------------
 **
-** Not the whole DTD, but all this parser usues of it.
+**  Not the whole DTD, but all this parser uses of it.
 */
 #ifdef EXP_CHARTRANS
 typedef struct {
-  char* name;
-  long code;
+    char* name;
+    long code;
 } UC_entity_info;
 #endif
 
@@ -162,18 +161,19 @@ typedef struct _HTSGMLContext *HTSGMLContext;   /* Hidden */
 
 Structured Object definition
 
-   A structured object is something which can reasonably be represented in SGML.  I'll
-   rephrase that.  A structured object is am ordered tree-structured arrangement of data
-   which is representable as text.The SGML parer outputs to a Structured object. A
-   Structured object can output its contents to another Structured Object. It's a kind of
-   typed stream. The architecure is largely Dan Conolly's. Elements and entities are
-   passed to the sob by number, implying a knowledge of the DTD. Knowledge of the SGML
-   syntax is not here, though.
+   A structured object is something which can reasonably be represented
+   in SGML.  I'll rephrase that.  A structured object is am ordered
+   tree-structured arrangement of data which is representable as text.
+   The SGML parer outputs to a Structured object.  A Structured object
+   can output its contents to another Structured Object. It's a kind of
+   typed stream. The architecure is largely Dan Conolly's. Elements and
+   entities are passed to the sob by number, implying a knowledge of the
+   DTD.  Knowledge of the SGML syntax is not here, though.
    
    Superclass: HTStream
    
-   The creation methods will vary on the type of Structured Object.Maybe the callerData is
-   enough info to pass along.
+   The creation methods will vary on the type of Structured Object.
+   Maybe the callerData is enough info to pass along.
    
  */
 typedef struct _HTStructured HTStructured;
@@ -227,7 +227,9 @@ Find a Tag by Name
    Returns a pointer to the tag within the DTD.
    
  */
-extern HTTag * SGMLFindTag PARAMS((CONST SGML_dtd* dtd, CONST char * string));
+extern HTTag * SGMLFindTag PARAMS((
+	CONST SGML_dtd *	dtd,
+	CONST char *		string));
 
 
 /*
@@ -243,26 +245,15 @@ Create an SGML parser
 ** On exit,
 **              The default tag starter has been processed.
 */
-
-
-extern HTStream* SGML_new PARAMS((
-        CONST SGML_dtd *                dtd,
+extern HTStream * SGML_new PARAMS((
+	CONST SGML_dtd *	dtd,
 	HTParentAnchor *	anchor,
-        HTStructured *          target));
+	HTStructured *		target));
 
 extern CONST HTStreamClass SGMLParser;
 
-
 #endif  /* SGML_H */
 
-
-
-
-
-
-
-
-
 /*
 
     */
diff --git a/WWW/Library/Implementation/UCAux.h b/WWW/Library/Implementation/UCAux.h
index 0094595d..fd4b4618 100644
--- a/WWW/Library/Implementation/UCAux.h
+++ b/WWW/Library/Implementation/UCAux.h
@@ -7,35 +7,44 @@ extern BOOL UCCanTranslateFromTo PARAMS((int from, int to));
 
 struct _UCTransParams
 {
-    BOOL transp, do_cjk, decode_utf8, output_utf8,
-	use_raw_char_in, strip_raw_char_in,
-	pass_160_173_raw, do_8bitraw,
-	trans_to_uni, trans_from_uni;
+    BOOL transp;
+    BOOL do_cjk;
+    BOOL decode_utf8;
+    BOOL output_utf8;
+    BOOL use_raw_char_in;
+    BOOL strip_raw_char_in;
+    BOOL pass_160_173_raw;
+    BOOL do_8bitraw;
+    BOOL trans_to_uni;
+    BOOL trans_from_uni;
 };
 typedef struct _UCTransParams UCTransParams;
 
+#ifndef UCDEFS_H
+#include "UCDefs.h"
+#endif /* UCDEFS_H */
+
 extern void UCSetTransParams PARAMS((
-    UCTransParams * 	pT,
-    int			cs_in,
-    CONST LYUCcharset *	p_in,
-    int			cs_out,
-    CONST LYUCcharset *	p_out));
+	UCTransParams * 	pT,
+	int			cs_in,
+	CONST LYUCcharset *	p_in,
+	int			cs_out,
+	CONST LYUCcharset *	p_out));
 
 extern void UCTransParams_clear PARAMS((
-    UCTransParams * 	pT));
+	UCTransParams *		pT));
 
 #ifndef HTSTREAM_H
 #include "HTStream.h"
-#endif
+#endif /* HTSTREAM_H */
 
-typedef void 
-    putc_func_t PARAMS((
-                HTStream*   me,
-                char            ch));
+typedef void putc_func_t PARAMS((
+	HTStream *	me,
+	char		ch));
 
 extern BOOL UCPutUtf8_charstring PARAMS((
-    HTStream *	target,
-    putc_func_t *	actions,
-    long	code));
+	HTStream *	target,
+	putc_func_t *	actions,
+	long	code));
     
 #endif /* UCAUX_H */
diff --git a/WWW/Library/Implementation/UCDefs.h b/WWW/Library/Implementation/UCDefs.h
index 0c8966ea..a43088b7 100644
--- a/WWW/Library/Implementation/UCDefs.h
+++ b/WWW/Library/Implementation/UCDefs.h
@@ -4,14 +4,14 @@
 #define UCDEFS_H
 
 typedef struct _LYUCcharset {
-  int UChndl;
-  char *MIMEname;
+    int UChndl;
+    char * MIMEname;
     int enc;
     int repertoire;
     int codepoints;
-    int cpranges;		/* which ranges have valid displayable chars
-				 (including nbsp and shy) */
-    int like8859;		/* for which ranges is it like 8859-1 */
+    int cpranges;	/* which ranges have valid displayable chars
+			   (including nbsp and shy) */
+    int like8859;	/* for which ranges is it like 8859-1 */
 } LYUCcharset;
 
 #define UCT_ENC_7BIT 0
@@ -27,17 +27,23 @@ typedef struct _LYUCcharset {
 #define UCT_REP_SUBSETOF_LAT1 0x01
 #define UCT_REP_SUPERSETOF_LAT1 0x02
 #define UCT_REP_IS_LAT1 UCT_REP_SUBSETOF_LAT1 | UCT_REP_SUPERSETOF_LAT1
-/* assume everything we deal with is included in the UCS2 reperoire,
-   so a flag for _REP_SUBSETOF_UCS2 would be redundant */
+/*
+ *  Assume everything we deal with is included in the UCS2 reperoire,
+ *  so a flag for _REP_SUBSETOF_UCS2 would be redundant.
+ */
 
-/* more general description how the code points relate to 8859-1 and UCS: */
+/*
+ *  More general description how the code points relate to 8859-1 and UCS:
+ */
 #define UCT_CP_SUBSETOF_LAT1 0x01 /* implies UCT_CP_SUBSETOF_UCS2 */
 #define UCT_CP_SUPERSETOF_LAT1 0x02
 #define UCT_CP_SUBSETOF_UCS2 0x04
 
 #define UCT_CP_IS_LAT1 UCT_CP_SUBSETOF_LAT1 | UCT_CP_SUPERSETOF_LAT1
 
-/* more specific bitflags for practically important code point ranges: */
+/*
+ *  More specific bitflags for practically important code point ranges:
+ */
 #define UCT_R_LOWCTRL 0x08	/* 0x00-0x1F, for completeness */
 #define UCT_R_7BITINV 0x10	/* invariant, displayable 7bit chars */
 #define UCT_R_7BITNAT 0x20	/* displayable 7bit, national */
@@ -50,8 +56,9 @@ typedef struct _LYUCcharset {
 #define UCT_R_8859S UCT_R_ASCII | UCT_R_8859SPECL
 #define UCT_R_8BIT UCT_R_LAT1 | UCT_R_HIGHCTRL /* full 8bit range */
 
-/* For the following some coments are in HTAnchor.c. */
-
+/*
+ *  For the following some coments are in HTAnchor.c.
+ */
 #define UCT_STAGE_MIME 0
 #define UCT_STAGE_PARSER 1	/* What the parser (SGML.c) gets to see */
 #define UCT_STAGE_STRUCTURED 2	/* What the structured stream (HTML) gets fed*/
diff --git a/WWW/Library/Implementation/UCMap.h b/WWW/Library/Implementation/UCMap.h
index 93351ed4..7c615be8 100644
--- a/WWW/Library/Implementation/UCMap.h
+++ b/WWW/Library/Implementation/UCMap.h
@@ -1,14 +1,36 @@
+
+#ifndef UCMAP_H
+#define UCMAP_H
+
 typedef long UCode_t;
 
-PUBLIC int UCTransUniChar PARAMS((UCode_t unicode, int charset_out));
-PUBLIC int UCTransUniCharStr PARAMS((char *outbuf, int buflen, UCode_t unicode,
-			     int charset_out, int chk_single_flag));
-PUBLIC int UCTransChar PARAMS((char ch_in, int charset_in, int charset_out));
-PUBLIC int UCTransCharStr PARAMS((char *outbuf, int buflen, char ch_in,
-			int charset_in, int charset_out, int chk_single_flag));
-PUBLIC UCode_t UCTransToUni PARAMS((char ch_in, int charset_in));
-PUBLIC int UCGetLYhndl_byMIME PARAMS((CONST char *p));
-PUBLIC int UCGetRawUniMode_byLYhndl PARAMS((int i));
+extern int UCTransUniChar PARAMS((
+	UCode_t		unicode,
+	int		charset_out));
+extern int UCTransUniCharStr PARAMS((
+	char *		outbuf,
+	int		buflen,
+	UCode_t		unicode,
+	int		charset_out,
+	int		chk_single_flag));
+extern int UCTransChar PARAMS((
+	char		ch_in,
+	int		charset_in,
+	int		charset_out));
+extern int UCTransCharStr PARAMS((
+	char *		outbuf,
+	int		buflen,
+	char		ch_in,
+	int		charset_in,
+	int		charset_out,
+	int		chk_single_flag));
+extern UCode_t UCTransToUni PARAMS((
+	char		ch_in,
+	int		charset_in));
+extern int UCGetLYhndl_byMIME PARAMS((
+	CONST char *	p));
+extern int UCGetRawUniMode_byLYhndl PARAMS((
+	int		i));
 
 PUBLIC int UCLYhndl_for_unspec;
 PUBLIC int UCLYhndl_for_unrec;
@@ -18,3 +40,5 @@ PUBLIC int UCLYhndl_HTFile_for_unrec;
 #define UCTRANS_NOTFOUND (-4)
 
 #define HT_CANNOT_TRANSLATE -4	/* could go into HTUtils.h */
+
+#endif /* UCMAP_H */