about summary refs log tree commit diff stats
path: root/WWW
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1999-01-18 12:35:47 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1999-01-18 12:35:47 -0500
commitd97a65137382daf2f896a947ba680c095f7ab664 (patch)
tree6db3daec0d5c2f909ba586adff0ddc2ad96d84d9 /WWW
parenta2e9461739dd215db90a5cee2c22a74e5f57d151 (diff)
downloadlynx-snapshots-d97a65137382daf2f896a947ba680c095f7ab664.tar.gz
snapshot of project "lynx", label v2-8-2dev_14
Diffstat (limited to 'WWW')
-rw-r--r--WWW/Library/Implementation/HTAAUtil.c21
-rw-r--r--WWW/Library/Implementation/HTFile.c48
-rw-r--r--WWW/Library/Implementation/HTList.c46
-rw-r--r--WWW/Library/Implementation/HTList.h11
-rw-r--r--WWW/Library/Implementation/HTMIME.c52
-rw-r--r--WWW/Library/Implementation/HTMIME.h3
-rw-r--r--WWW/Library/Implementation/HTMLDTD.c4
-rw-r--r--WWW/Library/Implementation/HTTCP.c7
-rw-r--r--WWW/Library/Implementation/SGML.c3
-rw-r--r--WWW/Library/Implementation/UCDefs.h5
-rw-r--r--WWW/Library/Implementation/tcp.h1
-rw-r--r--WWW/Library/djgpp/makefile.sla3
12 files changed, 166 insertions, 38 deletions
diff --git a/WWW/Library/Implementation/HTAAUtil.c b/WWW/Library/Implementation/HTAAUtil.c
index 42515c02..0212cfeb 100644
--- a/WWW/Library/Implementation/HTAAUtil.c
+++ b/WWW/Library/Implementation/HTAAUtil.c
@@ -448,9 +448,10 @@ PUBLIC HTAssocList *HTAA_parseArgList ARGS1(char *, str)
 
 #define BUFFER_SIZE	1024
 
-PRIVATE char buffer[BUFFER_SIZE + 1];
-PRIVATE char *start_pointer = buffer;
-PRIVATE char *end_pointer = buffer;
+PRIVATE size_t buffer_length;
+PRIVATE char *buffer = 0;
+PRIVATE char *start_pointer;
+PRIVATE char *end_pointer;
 PRIVATE int in_soc = -1;
 
 /* PUBLIC						HTAA_setupReader()
@@ -476,6 +477,20 @@ PUBLIC void HTAA_setupReader ARGS3(char *,	start_of_headers,
 				   int, 	length,
 				   int, 	soc)
 {
+    if (!start_of_headers)
+	length = 0;	       /* initialize length (is this reached at all?) */
+    if (buffer == NULL) {				       /* first call? */
+	buffer_length = length;
+	if (buffer_length < BUFFER_SIZE)     /* would fall below BUFFER_SIZE? */
+	    buffer_length = BUFFER_SIZE;
+	buffer = (char*)malloc((size_t)(sizeof(char)*(buffer_length + 1)));
+    }
+    else if (length > (int)buffer_length) {		  /* need more space? */
+	buffer_length = length;
+	buffer = (char*)realloc((char*)buffer,
+				(size_t)(sizeof(char)*(buffer_length + 1)));
+    }
+    if (buffer == NULL) outofmem(__FILE__, "HTAA_setupReader");
     start_pointer = buffer;
     if (start_of_headers) {
 	strncpy(buffer, start_of_headers, length);
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index f20d744e..c4826feb 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -933,18 +933,44 @@ PUBLIC HTFormat HTCharsetFormat ARGS3(
 	    }
 	} else {
 	    /*
-	    **	Hope it's a match, for now. - FM
+	    **  Cannot translate.
+	    **  If according to some heuristic the given
+	    **  charset and the current display character
+	    **  both are likely to be like ISO-8859 in
+	    **  structure, pretend we have some kind
+	    **  of match.
 	    */
-	    *cp1 = '\0';
-	    format = HTAtom_for(cp);
-	    cp1 = &cp4[10];
-	    while (*cp1 &&
-		   isdigit((unsigned char)(*cp1)))
-		cp1++;
-	    *cp1 = '\0';
-	    StrAllocCopy(anchor->charset, cp4);
-	    HTPassEightBitRaw = TRUE;
-	    HTAlert(anchor->charset);
+	    BOOL given_is_8859
+		= (!strncmp(cp4, "iso-8859-", 9) &&
+		   isdigit((unsigned char)cp4[9]));
+	    BOOL given_is_8859like
+		= (given_is_8859 ||
+		   !strncmp(cp4, "windows-", 8) ||
+		   !strncmp(cp4, "cp12", 4) ||
+		   !strncmp(cp4, "cp-12", 5));
+	    BOOL given_and_display_8859like
+		= (given_is_8859like &&
+		   (strstr(LYchar_set_names[current_char_set],
+			   "ISO-8859") ||
+		    strstr(LYchar_set_names[current_char_set],
+			   "windows-")));
+
+	    if (given_and_display_8859like) {
+		*cp1 = '\0';
+		format = HTAtom_for(cp);
+	    }
+	    if (given_is_8859) {
+		cp1 = &cp4[10];
+		while (*cp1 &&
+		       isdigit((unsigned char)(*cp1)))
+		    cp1++;
+		*cp1 = '\0';
+	    }
+	    if (given_and_display_8859like) {
+		StrAllocCopy(anchor->charset, cp4);
+		HTPassEightBitRaw = TRUE;
+	    }
+	    HTAlert(*cp4 ? cp4 : anchor->charset);
 	}
 	FREE(cp3);
     } else if (cp1 != NULL) {
diff --git a/WWW/Library/Implementation/HTList.c b/WWW/Library/Implementation/HTList.c
index 939af95b..3ea53369 100644
--- a/WWW/Library/Implementation/HTList.c
+++ b/WWW/Library/Implementation/HTList.c
@@ -42,6 +42,50 @@ PUBLIC void HTList_delete ARGS1(
     return;
 }
 
+/*	Reverse order of elements in list.
+ */
+PUBLIC HTList * HTList_reverse ARGS1(
+    HTList *,		start)
+{
+    HTList *cur, *succ;
+    if (!(start && start->next && (cur = start->next->next)))
+	return start;
+    start->next->next = NULL;
+    while (cur) {
+	succ = cur->next;
+	cur->next = start->next;
+	start->next = cur;
+	cur = succ;
+    }
+    return start;
+}
+
+/*	Append a list to another.
+ *
+ *	If successful, the second list will become empty but not freed.
+ */
+PUBLIC HTList * HTList_appendList ARGS2(
+    HTList *,		start,
+    HTList *,		tail)
+{
+    HTList * temp = start;
+
+    if (!start) {
+        CTRACE(tfp, "HTList: Trying to append list %p to a nonexisting list\n",
+		    tail);
+        return NULL;
+    }
+    if (!(tail && tail->next))
+	return start;
+
+    while (temp->next)
+	temp = temp->next;
+
+    temp->next = tail->next;
+    tail->next = NULL;		/* tail is now an empty list */
+    return start;
+}
+
 
 /*      Add object to START of list (so it is pointed to by the head).
 */
@@ -121,7 +165,7 @@ PUBLIC void HTList_insertObjectAt ARGS3(
 	        prevNode->next = newNode;
 	    return;
 	}
-	prevNode = temp; 
+	prevNode = temp;
 	Pos--;
     }
     if (Pos >= 0)
diff --git a/WWW/Library/Implementation/HTList.h b/WWW/Library/Implementation/HTList.h
index c02c58af..653e87a5 100644
--- a/WWW/Library/Implementation/HTList.h
+++ b/WWW/Library/Implementation/HTList.h
@@ -60,6 +60,17 @@ extern HTList * HTList_new NOPARAMS;
 extern void HTList_delete PARAMS((
 	HTList *	me));
 
+/*	Reverse a list.
+*/
+extern HTList * HTList_reverse PARAMS((
+	HTList *	start));
+
+/*	Append two lists, making second list empty.
+*/
+extern HTList * HTList_appendList PARAMS((
+	HTList *	start,
+	HTList *	tail));
+
 
 /*      Add object to START of list (so it is pointed to by the head).
 */
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index 81226f66..4228b570 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -105,7 +105,7 @@ typedef enum _MIME_state {
 	/* TRANSPARENT and IGNORE are defined as stg else in _WINDOWS */
 } MIME_state;
 
-#define VALUE_SIZE 1024 	/* @@@@@@@ Arbitrary? */
+#define VALUE_SIZE 5120 	/* @@@@@@@ Arbitrary? */
 struct _HTStream {
 	CONST HTStreamClass *	isa;
 
@@ -380,7 +380,6 @@ PRIVATE void HTMIME_put_character ARGS2(
 							    UCT_SETBY_DEFAULT);
 				}
 			    }
-			    FREE(cp3);
 			    if (chartrans_ok) {
 				LYUCcharset * p_in =
 				    HTAnchor_getUCInfoStage(me->anchor,
@@ -428,18 +427,44 @@ PRIVATE void HTMIME_put_character ARGS2(
 				}
 			    } else {
 				/*
-				**  Hope it's a match, for now. - FM
+				**  Cannot translate.
+				**  If according to some heuristic the given
+				**  charset and the current display character
+				**  both are likely to be like ISO-8859 in
+				**  structure, pretend we have some kind
+				**  of match.
 				*/
-				*cp1 = '\0';
-				me->format = HTAtom_for(cp);
-				cp1 = &cp4[10];
-				while (*cp1 &&
-				       isdigit((unsigned char)(*cp1)))
-				    cp1++;
-				*cp1 = '\0';
-				StrAllocCopy(me->anchor->charset, cp4);
-				HTPassEightBitRaw = TRUE;
-				HTAlert(me->anchor->charset);
+				BOOL given_is_8859
+				    = (!strncmp(cp4, "iso-8859-", 9) &&
+				       isdigit((unsigned char)cp4[9]));
+				BOOL given_is_8859like
+				    = (given_is_8859 ||
+				       !strncmp(cp4, "windows-", 8) ||
+				       !strncmp(cp4, "cp12", 4) ||
+				       !strncmp(cp4, "cp-12", 5));
+				BOOL given_and_display_8859like
+				    = (given_is_8859like &&
+				       (strstr(LYchar_set_names[current_char_set],
+					       "ISO-8859") ||
+					strstr(LYchar_set_names[current_char_set],
+					       "windows-")));
+
+				if (given_and_display_8859like) {
+				    *cp1 = '\0';
+				    me->format = HTAtom_for(cp);
+				}
+				if (given_is_8859) {
+				    cp1 = &cp4[10];
+				    while (*cp1 &&
+					   isdigit((unsigned char)(*cp1)))
+					cp1++;
+				    *cp1 = '\0';
+				}
+				if (given_and_display_8859like) {
+				    StrAllocCopy(me->anchor->charset, cp4);
+				    HTPassEightBitRaw = TRUE;
+				}
+				HTAlert(*cp4 ? cp4 : me->anchor->charset);
 			    }
 			    FREE(cp3);
 			} else {
@@ -2281,4 +2306,3 @@ PUBLIC int HTmaybekanji ARGS2(
     }
     return 1;
 }
-
diff --git a/WWW/Library/Implementation/HTMIME.h b/WWW/Library/Implementation/HTMIME.h
index ac0a15c6..25c28660 100644
--- a/WWW/Library/Implementation/HTMIME.h
+++ b/WWW/Library/Implementation/HTMIME.h
@@ -75,11 +75,10 @@ extern int HTrjis PARAMS((
 	char *	t,
 	char *	s));
 
-PUBLIC int HTmaybekanji PARAMS((
+extern int HTmaybekanji PARAMS((
 	int	c1,
 	int	c2));
 
-
 #endif /* !HTMIME_H */
 
 /*
diff --git a/WWW/Library/Implementation/HTMLDTD.c b/WWW/Library/Implementation/HTMLDTD.c
index 84ac15ee..205f2e0c 100644
--- a/WWW/Library/Implementation/HTMLDTD.c
+++ b/WWW/Library/Implementation/HTMLDTD.c
@@ -1250,7 +1250,7 @@ static attr ulist_attr[] = {			/* UL attributes */
  /* { "P"	, p_attr,	HTML_P_ATTRIBUTES,	SGML_EMPTY }, */
 #define T_P		0x0100, 0x0B04F,0x8FFFF,0x36680,0xB6FA7,0x80117,0x00001
  /* { "PARAM"	, param_attr,	HTML_PARAM_ATTRIBUTES,	SGML_EMPTY }, */
-#define T_PARAM 	0x1000, 0x00000,0x00000,0x03000,0x17FFF,0x81777,0x00001
+#define T_PARAM 	0x1000, 0x00000,0x00000,0x33500,0x37FFF,0x81560,0x00001
  /* { "PLAINTEXT", gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_LITTERAL }, */
 #define T_PLAINTEXT	0x10000,0xFFFFF,0xFFFFF,0x90000,0x90000,0x3FFFF,0x00001
  /* { "PRE"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED }, */
@@ -1299,7 +1299,7 @@ static attr ulist_attr[] = {			/* UL attributes */
  /* { "TH"	, td_attr,	HTML_TD_ATTRIBUTES,	SGML_EMPTY }, */
 #define T_TH		0x0400, 0x0FBCF,0x0FFFF,0x00020,0xB7FB7,0x8CF5F,0x00001
  /* { "THEAD"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY }, */
-#define T_THEAD 	0x0020, 0x00020,0x8FFFF,0x00880,0xB7FB7,0x8CF5F,0x00001
+#define T_THEAD 	0x0020, 0x00020,0x8FFFF,0x00800,0xB7FB7,0x8CF5F,0x00001
  /* { "TITLE",	  gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_RCDATA }, */
 #define T_TITLE 	0x40000,0x00000,0x00000,0x50000,0x50000,0x0031F,0x00004
  /* { "TR"	, tr_attr,	HTML_TR_ATTRIBUTES,	SGML_EMPTY }, */
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index 8733e997..1bc8f36f 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -425,7 +425,14 @@ PUBLIC int HTParseInet ARGS2(
 #ifdef GUSI
 	soc_in->sin_addr = inet_addr(host);		/* See netinet/in.h */
 #else
+#ifdef HAVE_INET_ATON
+	if (!inet_aton(host, &(soc_in->sin_addr))) {
+	    CTRACE(tfp, "inet_aton(%s) returns error\n", host);
+	    return -1;
+	}
+#else
 	soc_in->sin_addr.s_addr = inet_addr(host);	/* See arpa/inet.h */
+#endif /* HAVE_INET_ATON */
 #endif /* GUSI */
 #endif /* DGUX_OLD */
 #endif /* DJGPP */
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index efd5fdba..d745cf72 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -2583,9 +2583,8 @@ top1:
 	    context->state = S_dquoted;
 	    break;
 	}
-	HTChunkPutc(string, c);
 	context->state = S_value;
-	break;
+	/*  no break!  fall through to S_value and proccess current `c`  */
 
     case S_value:
 	if (WHITE(c) || (c == '>')) {		/* End of word */
diff --git a/WWW/Library/Implementation/UCDefs.h b/WWW/Library/Implementation/UCDefs.h
index 0cfb383f..c4413a60 100644
--- a/WWW/Library/Implementation/UCDefs.h
+++ b/WWW/Library/Implementation/UCDefs.h
@@ -6,10 +6,11 @@
 #include <HTUtils.h>
 
 typedef struct _LYUCcharset {
-    int UChndl;
+    int UChndl;  	/* -1 for "old" charsets, >= 0 for chartrans tables */
+
     CONST char * MIMEname;
     int enc;
-    int codepage;	/* IBM specific number */
+    int codepage;	/* IBM OS/2 specific number */
 
     /* parameters below are not used by chartrans mechanism, */
     /* they describe some relationships against built-in Latin1 charset...*/
diff --git a/WWW/Library/Implementation/tcp.h b/WWW/Library/Implementation/tcp.h
index b4525416..8ecf282e 100644
--- a/WWW/Library/Implementation/tcp.h
+++ b/WWW/Library/Implementation/tcp.h
@@ -497,6 +497,7 @@ struct timeval {
 #undef NETCLOSE
 #define NETCLOSE close_s
 #define getsockname getsockname_s
+#define gettext gettext__
 #endif
 
 #ifdef HAVE_UNISTD_H
diff --git a/WWW/Library/djgpp/makefile.sla b/WWW/Library/djgpp/makefile.sla
index b3fe96e0..875ce37d 100644
--- a/WWW/Library/djgpp/makefile.sla
+++ b/WWW/Library/djgpp/makefile.sla
@@ -12,9 +12,10 @@ CFLAGS = -O3 -DUSE_SLANG -DUSE_ZLIB -DDOSPATH -DNOUSERS -DDEBUG -DDISP_PARTIAL \
 -I../../../djgpp/tcplib/include \
 -I../../../djgpp/tcplib/include/tcp \
 -I../../../src \
--I../../.. $(SLANGINC)
+-I../../.. $(SLANGINC) $(INTLFLAGS)
 LFLAGS =
 CC = gcc
+#INTLFLAGS = -DHAVE_GETTEXT -DHAVE_LIBINTL_H
 
 # Directory for installed binary:
 !BINDIR = /usr/local/bin