about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTFormat.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-04-23 12:35:00 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1998-04-23 12:35:00 -0400
commit2a94396ccd9cf5ade728c53e02cba28e06af4378 (patch)
tree0ee1558f3e81f97725d83250f944aafa4eb43d54 /WWW/Library/Implementation/HTFormat.c
parent84271e583d80f546251ea914a33f8c537fddbac7 (diff)
downloadlynx-snapshots-2a94396ccd9cf5ade728c53e02cba28e06af4378.tar.gz
snapshot of project "lynx", label v2-8-1dev_7
Diffstat (limited to 'WWW/Library/Implementation/HTFormat.c')
-rw-r--r--WWW/Library/Implementation/HTFormat.c74
1 files changed, 22 insertions, 52 deletions
diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c
index baffca71..cdd2fa9b 100644
--- a/WWW/Library/Implementation/HTFormat.c
+++ b/WWW/Library/Implementation/HTFormat.c
@@ -235,14 +235,11 @@ PUBLIC char HTGetCharacter NOARGS
 		if (status == 0)
 		    return (char)EOF;
 		if (status == HT_INTERRUPTED) {
-		    if (TRACE)
-			fprintf(stderr,
-				"HTFormat: Interrupted in HTGetCharacter\n");
+		    CTRACE(tfp, "HTFormat: Interrupted in HTGetCharacter\n");
 		    interrupted_in_htgetcharacter = 1;
 		    return (char)EOF;
 		}
-		if (TRACE)
-		    fprintf(stderr, "HTFormat: File read error %d\n", status);
+		CTRACE(tfp, "HTFormat: File read error %d\n", status);
 		return (char)EOF; /* -1 is returned by UCX
 				     at end of HTTP link */
 	    }
@@ -266,9 +263,8 @@ PRIVATE int half_match ARGS2(char *,trial_type, char *,target)
     if (!cp || *(cp+1) != '*')
 	return 0;
 
-    if (TRACE)
-	fprintf(stderr,"HTFormat: comparing %s and %s for half match\n",
-						      trial_type, target);
+    CTRACE(tfp, "HTFormat: comparing %s and %s for half match\n",
+	        trial_type, target);
 
 	/* main type matches */
     if (!strncmp(trial_type, target, (cp-trial_type)-1))
@@ -295,9 +291,7 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3(
 {
     HTAtom * wildcard = HTAtom_for("*");
 
-    if (TRACE)
-	fprintf(stderr,
-		"HTFormat: Looking up presentation for %s to %s\n",
+    CTRACE(tfp, "HTFormat: Looking up presentation for %s to %s\n",
 		HTAtom_name(rep_in), HTAtom_name(rep_out));
 
     /* don't do anymore do it in the Lynx code at startup LJM */
@@ -316,9 +310,7 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3(
 	    pres = (HTPresentation *)HTList_objectAt(HTPresentations, i);
 	    if (pres->rep == rep_in) {
 		if (pres->rep_out == rep_out) {
-		    if (TRACE)
-			fprintf(stderr,
-				"FindPresentation: found exact match: %s\n",
+		    CTRACE(tfp, "FindPresentation: found exact match: %s\n",
 				HTAtom_name(pres->rep));
 		    return pres;
 
@@ -328,9 +320,7 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3(
 		    if (!strong_wildcard_match)
 			strong_wildcard_match = pres;
 		    /* otherwise use the first one */
-		    if (TRACE)
-			fprintf(stderr,
-			     "StreamStack: found strong wildcard match: %s\n",
+		    CTRACE(tfp, "StreamStack: found strong wildcard match: %s\n",
 				HTAtom_name(pres->rep));
 		}
 
@@ -343,9 +333,7 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3(
 		    if (!strong_subtype_wildcard_match)
 			strong_subtype_wildcard_match = pres;
 		    /* otherwise use the first one */
-		    if (TRACE)
-			fprintf(stderr,
-		     "StreamStack: found strong subtype wildcard match: %s\n",
+		    CTRACE(tfp, "StreamStack: found strong subtype wildcard match: %s\n",
 				HTAtom_name(pres->rep));
 		}
 	    }
@@ -355,9 +343,7 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3(
 		    if (!weak_wildcard_match)
 			weak_wildcard_match = pres;
 		    /* otherwise use the first one */
-		    if (TRACE)
-			fprintf(stderr,
-			    "StreamStack: found weak wildcard match: %s\n",
+		    CTRACE(tfp, "StreamStack: found weak wildcard match: %s\n",
 				HTAtom_name(pres->rep_out));
 		}
 		if (pres->rep_out == wildcard) {
@@ -403,9 +389,7 @@ PUBLIC HTStream * HTStreamStack ARGS4(
     HTPresentation temp;
     HTPresentation *match;
 
-    if (TRACE)
-	fprintf(stderr,
-		"HTFormat: Constructing stream stack for %s to %s\n",
+    CTRACE(tfp, "HTFormat: Constructing stream stack for %s to %s\n",
 		HTAtom_name(rep_in), HTAtom_name(rep_out));
 
     /* don't return on WWW_SOURCE some people might like
@@ -419,13 +403,9 @@ PUBLIC HTStream * HTStreamStack ARGS4(
 
     if ((match = HTFindPresentation(rep_in, rep_out, &temp))) {
 	if (match == &temp) {
-	    if (TRACE)
-		fprintf(stderr,
-			"StreamStack: Using %s\n", HTAtom_name(temp.rep_out));
+	    CTRACE(tfp, "StreamStack: Using %s\n", HTAtom_name(temp.rep_out));
 	} else {
-	    if (TRACE)
-		fprintf(stderr,
-			"StreamStack: found exact match: %s\n",
+	    CTRACE(tfp, "StreamStack: found exact match: %s\n",
 			HTAtom_name(match->rep));
 	}
 	return (*match->converter)(match, anchor, sink);
@@ -466,9 +446,7 @@ PUBLIC float HTStackValue ARGS4(
 {
     HTAtom * wildcard = HTAtom_for("*");
 
-    if (TRACE)
-	fprintf(stderr,
-		"HTFormat: Evaluating stream stack for %s worth %.3f to %s\n",
+    CTRACE(tfp, "HTFormat: Evaluating stream stack for %s worth %.3f to %s\n",
 		HTAtom_name(rep_in), initial_value, HTAtom_name(rep_out));
 
     if (rep_out == WWW_SOURCE || rep_out == rep_in)
@@ -579,8 +557,7 @@ PUBLIC int HTCopy ARGS4(
 		    *  Treat what we've gotten already
 		    *  as the complete transmission. - FM
 		    */
-		   if (TRACE)
-		       fprintf(stderr,
+		   CTRACE(tfp,
 	    "HTCopy: Unexpected server disconnect. Treating as completed.\n");
 		   status = 0;
 		   break;
@@ -649,9 +626,7 @@ PUBLIC int HTFileCopy ARGS2(
 		rv = HT_LOADED;
 		break;
 	    }
-	    if (TRACE)
-		fprintf(stderr,
-			"HTFormat: Read error, read returns %d\n",
+	    CTRACE(tfp, "HTFormat: Read error, read returns %d\n",
 			ferror(fp));
 	    if (bytes) {
 		rv = HT_PARTIAL_CONTENT;
@@ -734,13 +709,11 @@ PRIVATE int HTGzFileCopy ARGS2(
 		rv = HT_LOADED;
 		break;
 	    }
-	    if (TRACE) {
-		fprintf(stderr,
-			"HTGzFileCopy: Read error, gzread returns %d\n",
+	    CTRACE(tfp, "HTGzFileCopy: Read error, gzread returns %d\n",
 			status);
-		fprintf(stderr,
-			"gzerror   : %s\n",
+	    CTRACE(tfp, "gzerror   : %s\n",
 			gzerror(gzfp, &gzerrnum));
+	    if (TRACE) {
 		if (gzerrnum == Z_ERRNO)
 		    perror("gzerror   ");
 	    }
@@ -862,8 +835,7 @@ PUBLIC int HTParseSocket ARGS5(
 	}
 	sprintf(buffer, "Sorry, can't convert from %s to %s.",
 		HTAtom_name(rep_in), HTAtom_name(format_out));
-	if (TRACE)
-	    fprintf(stderr, "HTFormat: %s\n", buffer);
+	CTRACE(tfp, "HTFormat: %s\n", buffer);
 	return HTLoadError(sink, 501, buffer); /* returns -501 */
     }
 
@@ -911,8 +883,7 @@ PUBLIC int HTParseFile ARGS5(
 	}
 	sprintf(buffer, "Sorry, can't convert from %s to %s.",
 		HTAtom_name(rep_in), HTAtom_name(format_out));
-	if (TRACE)
-	    fprintf(stderr, "HTFormat(in HTParseFile): %s\n", buffer);
+	CTRACE(tfp, "HTFormat(in HTParseFile): %s\n", buffer);
 	return HTLoadError(sink, 501, buffer);
     }
 
@@ -950,7 +921,7 @@ PRIVATE int HTCloseGzFile ARGS1(
 	if (gzres == Z_ERRNO) {
 	    perror("gzclose   ");
 	} else if (gzres != Z_OK) {
-	    fprintf(stderr, "gzclose   : error number %d\n", gzres);
+	    CTRACE(tfp, "gzclose   : error number %d\n", gzres);
 	}
     }
     return(gzres);
@@ -981,8 +952,7 @@ PUBLIC int HTParseGzFile ARGS5(
 	}
 	sprintf(buffer, "Sorry, can't convert from %s to %s.",
 		HTAtom_name(rep_in), HTAtom_name(format_out));
-	if (TRACE)
-	    fprintf(stderr, "HTFormat(in HTParseGzFile): %s\n", buffer);
+	CTRACE(tfp, "HTFormat(in HTParseGzFile): %s\n", buffer);
 	return HTLoadError(sink, 501, buffer);
     }