about summary refs log tree commit diff stats
path: root/WWW
diff options
context:
space:
mode:
Diffstat (limited to 'WWW')
-rw-r--r--WWW/Library/Implementation/HTAABrow.c4
-rw-r--r--WWW/Library/Implementation/HTAAProt.c2
-rw-r--r--WWW/Library/Implementation/HTDOS.c40
-rw-r--r--WWW/Library/Implementation/HTFormat.c32
-rw-r--r--WWW/Library/Implementation/HTParse.c27
-rw-r--r--WWW/Library/Implementation/HTRules.c8
-rw-r--r--WWW/Library/Implementation/HTString.c19
-rw-r--r--WWW/Library/Implementation/HTTCP.c12
-rw-r--r--WWW/Library/Implementation/HTUtils.h6
-rw-r--r--WWW/Library/Implementation/www_tcp.h12
10 files changed, 100 insertions, 62 deletions
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c
index 8520e626..20ee00d1 100644
--- a/WWW/Library/Implementation/HTAABrow.c
+++ b/WWW/Library/Implementation/HTAABrow.c
@@ -361,7 +361,7 @@ PRIVATE HTAASetup *HTAASetup_lookup ARGS4(
 
     CTRACE((tfp, "%s `%s' %s\n",
 		 "HTAASetup_lookup: No template matched",
-		 (docname ? docname : "(null)"),
+		 NONNULL(docname),
 		 "(so probably not protected)"));
 
     return NULL;	/* NULL in parameters, or not found */
@@ -1117,7 +1117,7 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS4(
 		    num_schemes++;
 		} else {
 		    CTRACE((tfp, "Unknown scheme `%s' %s\n",
-			    (arg1 ? arg1 : "(null)"),
+			    NONNULL(arg1),
 			    (IsProxy ?
 			     "in Proxy-Authenticate: field" :
 			     "in WWW-Authenticate: field")));
diff --git a/WWW/Library/Implementation/HTAAProt.c b/WWW/Library/Implementation/HTAAProt.c
index b36dfd02..24907b84 100644
--- a/WWW/Library/Implementation/HTAAProt.c
+++ b/WWW/Library/Implementation/HTAAProt.c
@@ -408,7 +408,7 @@ PRIVATE HTAAProt *HTAAProt_new ARGS3(CONST char *,	cur_docname,
 	} else {
 	    CTRACE((tfp, "HTAAProt_new: %s `%s'\n",
 			"Unable to open protection setup file",
-			(prot_filename ? prot_filename : "(null)")));
+			NONNULL(prot_filename)));
 	}
     }
 
diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c
index 8ec1caf5..bbdd36e1 100644
--- a/WWW/Library/Implementation/HTDOS.c
+++ b/WWW/Library/Implementation/HTDOS.c
@@ -135,3 +135,43 @@ char * HTDOS_name ARGS1(char *, wwwname)
     return (ret);
 }
 
+#if defined(DJGPP) && defined(DJGPP_KEYHANDLER)
+/* PUBLIC       getxkey()
+**              Replaces libc's getxkey() with polling of tcp/ip
+**              library (WatTcp or Watt-32). This is required to
+**              be able to finish off dead sockets, answer pings etc.
+**
+** ON EXIT:
+**      returns extended keypress.
+*/
+
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+#include <dpmi.h>
+#include <libc/farptrgs.h>
+#include <go32.h>
+
+int getxkey (void)
+{
+    __dpmi_regs r;
+
+    /* poll tcp/ip lib and yield to DPMI-host while nothing in
+     * keyboard buffer (head = tail) (simpler than kbhit).
+     */
+    while (_farpeekw(_dos_ds, 0x41a) == _farpeekw(_dos_ds, 0x41c))
+    {
+	tcp_tick (NULL);
+	__dpmi_yield();
+    }
+
+    r.h.ah = 0x10;
+    __dpmi_int(0x16, &r);
+
+    if (r.h.al == 0x00)
+	return 0x0100 | r.h.ah;
+    if (r.h.al == 0xe0)
+	return 0x0200 | r.h.ah;
+    return r.h.al;
+}
+#endif /* DJGPP && DJGPP_KEYHANDLER */
+
diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c
index e71b12f4..1e86af35 100644
--- a/WWW/Library/Implementation/HTFormat.c
+++ b/WWW/Library/Implementation/HTFormat.c
@@ -49,6 +49,10 @@ PUBLIC long int HTMaxBytes  = 0;	/* No effective limit */
 #include <LYGlobalDefs.h>
 #include <LYLeaks.h>
 
+#ifdef DISP_PARTIAL
+#include <LYMainLoop.h>
+#endif
+
 PUBLIC	BOOL HTOutputSource = NO;	/* Flag: shortcut parser to stdout */
 /* extern  BOOL interactive; LJM */
 
@@ -513,11 +517,9 @@ PUBLIC void HTDisplayPartial NOARGS
 	**  HText_getNumOfLines() = "current" number of complete lines received
 	**  NumOfLines_partial = number of lines at the moment of last repaint.
 	**
-	**  We update NumOfLines_partial only when we repaint the display.
-	**  -1 is the special value:
-	**  This is a synchronization flag switched to 0 when HText_new()
-	**  starts a new HTMainText object - all HText_ functions use it,
-	**  lines counter in particular [we call it from HText_getNumOfLines()].
+	**  display_partial could only be enabled in HText_new()
+	**  so a new HTMainText object available - all HText_ functions use it,
+	**  lines counter HText_getNumOfLines() in particular.
 	**
 	**  Otherwise HTMainText holds info from the previous document
 	**  and we may repaint it instead of the new one:
@@ -526,9 +528,7 @@ PUBLIC void HTDisplayPartial NOARGS
 	**
 	**  So repaint the page only when necessary:
 	*/
-	if ((NumOfLines_partial != -1)
-		/* new HText object available  */
-	&& ((Newline_partial + display_lines) > NumOfLines_partial)
+	if (((Newline_partial + display_lines) > NumOfLines_partial)
 		/* current page not complete... */
 	&& (partial_threshold > 0 ?
 		((Newline_partial + partial_threshold) < HText_getNumOfLines()) :
@@ -541,7 +541,7 @@ PUBLIC void HTDisplayPartial NOARGS
 		 */
 	) {
 	    NumOfLines_partial = HText_getNumOfLines();
-	    HText_pageDisplay(Newline_partial);
+	    LYMainLoop_pageDisplay(Newline_partial);
 	}
     }
 #else /* nothing */
@@ -552,24 +552,10 @@ PUBLIC void HTDisplayPartial NOARGS
 PUBLIC void HTFinishDisplayPartial NOARGS
 {
 #ifdef DISP_PARTIAL
-		    if (display_partial) {
-			/*
-			 *  Override Newline with a new value if user
-			 *  scrolled the document while downloading.
-			 */
-			if (Newline_partial != Newline
-			 && NumOfLines_partial > 0)
-			    Newline = Newline_partial;
-		    }
-
 		    /*
 		     *  End of incremental rendering stage here.
 		     */
 		    display_partial = FALSE;
-		    NumOfLines_partial = -1;       /* initialize to -1 */
-				/* -1 restrict HTDisplayPartial()   */
-				/* until HText_new() start next HTMainText */
-				/* and set the flag to 0  */
 #endif /* DISP_PARTIAL */
 }
 
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index afbf2910..9363fa55 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -14,7 +14,7 @@ struct struct_parts {
 	char * host;
 	char * absolute;
 	char * relative;
-/*	char * search;		no - treated as part of path */
+	char * search;		/* treated normally as part of path */
 	char * anchor;
 };
 
@@ -68,6 +68,7 @@ PRIVATE void scan ARGS2(
     parts->host = NULL;
     parts->absolute = NULL;
     parts->relative = NULL;
+    parts->search = NULL;	/* normally not used - kw */
     parts->anchor = NULL;
 
     /*
@@ -111,6 +112,12 @@ PRIVATE void scan ARGS2(
 	    if (p != NULL) {
 		*p = '\0';			/* Terminate host */
 		parts->absolute = (p + 1);	/* Root has been found */
+	    } else {
+		p = strchr(parts->host, '?');
+		if (p != NULL) {
+		    *p = '\0';			/* Terminate host */
+		    parts->search = (p + 1);
+		}
 	    }
 	} else {
 	    parts->absolute = (p + 1);		/* Root found but no host */
@@ -261,6 +268,7 @@ PUBLIC char * HTParse ARGS3(
 	related.host = NULL;
 	related.absolute = NULL;
 	related.relative = NULL;
+	related.search = NULL;
 	related.anchor = NULL;
     }
 
@@ -337,6 +345,23 @@ PUBLIC char * HTParse ARGS3(
 	}
 
     /*
+    **	If host in given or related was ended directly with a '?' (no
+    **  slash), fake the search part into absolute.  This is the only
+    **  case search is returned from scan.  A host must have been present.
+    **  this restores the '?' at which the host part had been truncated in
+    **  scan, we have to do this after host part handling is done. - kw
+    **
+    */
+    if (given.search && *(given.search - 1) == '\0') {
+	given.absolute = given.search - 1;
+	given.absolute[0] = '?';
+    } else if (related.search && !related.absolute &&
+	       *(related.search - 1) == '\0') {
+	related.absolute = related.search - 1;
+	related.absolute[0] = '?';
+    }
+
+    /*
     **	If different hosts, inherit no path.
     */
     if (given.host && related.host)
diff --git a/WWW/Library/Implementation/HTRules.c b/WWW/Library/Implementation/HTRules.c
index 909a852c..48263a34 100644
--- a/WWW/Library/Implementation/HTRules.c
+++ b/WWW/Library/Implementation/HTRules.c
@@ -115,7 +115,7 @@ PUBLIC int HTAddRule ARGS5(
 	CTRACE((tfp, "Rule: For `%s' op %d", pattern, op));
     }
     if (cond_op) {
-	CTRACE((tfp, "\t%s %s\n", cond_op, cond ? cond : "<null>"));
+	CTRACE((tfp, "\t%s %s\n", cond_op, NONNULL(cond)));
     } else {
 	CTRACE((tfp, "\n"));
     }
@@ -182,7 +182,7 @@ PRIVATE BOOL rule_cond_ok ARGS1(
 	result = LYUserSpecifiedURL;
     else {
 	CTRACE((tfp, "....... rule ignored, unrecognized `%s %s'!\n",
-	       r->condition_op, r->condition ? r->condition : "<null>"));
+	       r->condition_op, NONNULL(r->condition)));
 	return NO;
     }
     if (!strcmp(r->condition_op, "if"))
@@ -388,14 +388,14 @@ char * HTTranslate ARGS1(
 		} else if (proxy_none_flag) {
 		    CTRACE((tfp, "For `%s' proxy server ignored: %s\n",
 			   current,
-			   r->equiv ? r->equiv : "<null>"));
+			   NONNULL(r->equiv)));
 		} else {
 		    char * temp = NULL;
 		    StrAllocCopy(temp, "Proxied=");
 		    StrAllocCat(temp, r->equiv);
 		    StrAllocCat(temp, current);
 		    CTRACE((tfp, "HTRule: proxy server found: %s\n",
-			   r->equiv ? r->equiv : "<null>"));
+			   NONNULL(r->equiv)));
 		    FREE(current);
 		    return temp;
 		}
diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c
index 85f9123f..e7e31218 100644
--- a/WWW/Library/Implementation/HTString.c
+++ b/WWW/Library/Implementation/HTString.c
@@ -501,8 +501,8 @@ PRIVATE char *HTAlloc ARGS2(char *, ptr, size_t, length)
  * in each invocation.  They only grow and never shrink, and won't be
  * cleaned up on exit. - kw
  */
-#if !(defined(_REENTRANT) || defined(_THREAD_SAFE))
-#define SAVE_TIME_NOT_SPACE
+#if defined(_REENTRANT) || defined(_THREAD_SAFE)
+#undef SAVE_TIME_NOT_SPACE
 #endif
 
 /*
@@ -559,22 +559,11 @@ PUBLIC_IF_FIND_LEAKS char * StrAllocVsprintf ARGS4(
 
     need = strlen(fmt) + 1;
 #ifdef SAVE_TIME_NOT_SPACE
-    /* the following assumes that 0 as first arg to realloc works
-       portably like malloc; if that isn't the case, change to use
-       HTAlloc. - kw */
     if (!fmt_ptr || fmt_len < need*NUM_WIDTH) {
-	if ((fmt_ptr = realloc(fmt_ptr, need*NUM_WIDTH)) == 0) {
-	    outofmem(__FILE__, "StrAllocVsprintf (fmt_ptr)");
-	} else {
-	    fmt_len = need*NUM_WIDTH;
-	}
+	fmt_ptr = HTAlloc(fmt_ptr, fmt_len = need*NUM_WIDTH);
     }
     if (!tmp_ptr || tmp_len < GROW_SIZE) {
-	if ((tmp_ptr = realloc(tmp_ptr, GROW_SIZE)) == 0) {
-	    outofmem(__FILE__, "StrAllocVsprintf (tmp_ptr)");
-	} else {
-	    tmp_len = GROW_SIZE;
-	}
+	tmp_ptr = HTAlloc(tmp_ptr, tmp_len = GROW_SIZE);
     }
 #else
     if ((fmt_ptr = malloc(need*NUM_WIDTH)) == 0
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index 18de1134..96cc2c2b 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -642,7 +642,7 @@ PUBLIC struct hostent * LYGetHostByName ARGS1(
 {
 #ifndef _WINDOWS_NSL
     CONST char *host = str;
-#endif /* _WINDOWS_NSL */
+#endif
 #ifdef NSL_FORK
     /* for transfer of result between from child to parent: */
     static struct {
@@ -693,6 +693,10 @@ PUBLIC struct hostent * LYGetHostByName ARGS1(
 	return NULL;
     }
 
+#ifdef _WINDOWS_NSL
+    strncpy(host, str, (size_t)512);
+#endif /*  _WINDOWS_NSL */
+
     if (!valid_hostname(host)) {
 	lynx_nsl_status = HT_NOT_ACCEPTABLE;
 #ifdef NO_RECOVERY
@@ -705,12 +709,6 @@ PUBLIC struct hostent * LYGetHostByName ARGS1(
 	return NULL;
     }
 
-#ifdef _WINDOWS_NSL
-    strncpy(host, str, (size_t)512);
-#else
-    host = str;
-#endif /*  _WINDOWS_NSL */
-
 #ifdef MVS	/* Outstanding problem with crash in MVS gethostbyname */
     CTRACE((tfp, "LYGetHostByName: Calling gethostbyname(%s)\n", host));
 #endif /* MVS */
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index 38710d77..f977a9d5 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -298,11 +298,13 @@ Macros for declarations
 #define NULL ((void *)0)
 #endif
 
+#define NONNULL(s) (((s) != 0) ? s : "(null)")
+
 /* array/table size */
 #define	TABLESIZE(v)	(sizeof(v)/sizeof(v[0]))
 
-#define	typecalloc(cast)		(cast *)calloc(sizeof(cast),1)
-#define	typecallocn(cast,ntypes)	(cast *)calloc(sizeof(cast),ntypes)
+#define	typecalloc(cast)		(cast *)calloc(1,sizeof(cast))
+#define	typecallocn(cast,ntypes)	(cast *)calloc(ntypes,sizeof(cast))
 
 /*
 
diff --git a/WWW/Library/Implementation/www_tcp.h b/WWW/Library/Implementation/www_tcp.h
index cf6557ff..4048d7cf 100644
--- a/WWW/Library/Implementation/www_tcp.h
+++ b/WWW/Library/Implementation/www_tcp.h
@@ -56,7 +56,9 @@ Default values
 #define INVSOC (-1)             /* Unix invalid socket */
 		/* NB: newer libwww has something different for Windows */
 
+#if !defined(__MINGW32__)
 typedef struct sockaddr_in SockA;  /* See netinet/in.h */
+#endif
 
 #ifndef VMS
 #include <sys/types.h>
@@ -181,7 +183,7 @@ IBM-PC running Windows NT
 #include <winsock.h>
 typedef struct sockaddr_in SockA;  /* See netinet/in.h */
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__)
 #undef EINTR
 #undef EAGAIN
 #endif /* _MSC_VER */
@@ -639,13 +641,9 @@ typedef int pid_t;
 
 #else
 
-#ifndef VM
-#ifndef VMS
-#ifndef THINK_C
+#if !(defined(VM) || defined(VMS) || defined(THINK_C) || defined(__MINGW32__))
 #define DECL_SYS_ERRLIST 1
-#endif /* !THINK_C */
-#endif /* !VMS */
-#endif /* !VM */
+#endif
 
 #endif /* !HAVE_CONFIG_H */
 
896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108