about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTParse.c
diff options
context:
space:
mode:
Diffstat (limited to 'WWW/Library/Implementation/HTParse.c')
-rw-r--r--WWW/Library/Implementation/HTParse.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index 7362a59a..97d3f5ea 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -3,10 +3,13 @@
 */
 
 #include <HTUtils.h>
+#include <tcp.h>
 #include <HTParse.h>
 
 #include <LYLeaks.h>
 
+#define FREE(x) if (x) {free(x); x = NULL;}
+
 #define HEX_ESCAPE '%'
 
 struct struct_parts {
@@ -187,7 +190,9 @@ PUBLIC char * HTParse ARGS3(
     char * acc_method;
     struct struct_parts given, related;
 
-    CTRACE(tfp, "HTParse: aName:%s   relatedName:%s\n", aName, relatedName);
+    if (TRACE)
+	fprintf(stderr,
+		"HTParse: aName:%s   relatedName:%s\n", aName, relatedName);
 
     /*
     **	Allocate the output string.
@@ -245,7 +250,7 @@ PUBLIC char * HTParse ARGS3(
     **	this is back to inheriting for identical
     **	schemes whether or not they are "file".
     **	If you want to try it again yourself,
-    **	uncomment the strcasecomp() below. - FM
+    **	uncomment the strncasecomp() below. - FM
     */
     if ((given.access && related.access) &&
 	(/* strcasecomp(given.access, "file") || */
@@ -360,7 +365,8 @@ PUBLIC char * HTParse ARGS3(
 	    if (wanted & PARSE_PUNCTUATION)
 		strcat(result, "/");
 	    strcat(result, given.absolute);
-	    CTRACE(tfp, "1\n");
+	    if (TRACE)
+		fprintf(stderr, "1\n");
 	} else if (related.absolute) {		/* Adopt path not name */
 	    strcat(result, "/");
 	    strcat(result, related.absolute);
@@ -374,13 +380,16 @@ PUBLIC char * HTParse ARGS3(
 		strcat(result, given.relative); /* Add given one */
 		HTSimplify (result);
 	    }
-	    CTRACE(tfp, "2\n");
+	    if (TRACE)
+		fprintf(stderr, "2\n");
 	} else if (given.relative) {
 	    strcat(result, given.relative);		/* what we've got */
-	    CTRACE(tfp, "3\n");
+	    if (TRACE)
+		fprintf(stderr, "3\n");
 	} else if (related.relative) {
 	    strcat(result, related.relative);
-	    CTRACE(tfp, "4\n");
+	    if (TRACE)
+		fprintf(stderr, "4\n");
 	} else {  /* No inheritance */
 	    if (strncasecomp(aName, "lynxcgi:", 8) &&
 		strncasecomp(aName, "lynxexec:", 9) &&
@@ -389,7 +398,8 @@ PUBLIC char * HTParse ARGS3(
 	    }
 	    if (!strcmp(result, "news:/"))
 		result[5] = '*';
-	    CTRACE(tfp, "5\n");
+	    if (TRACE)
+		fprintf(stderr, "5\n");
 	}
     }
 
@@ -404,7 +414,8 @@ PUBLIC char * HTParse ARGS3(
 	    strcat(result, (given.anchor) ?
 			     given.anchor : related.anchor);
 	}
-    CTRACE(tfp, "HTParse: result:%s\n", result);
+    if (TRACE)
+	fprintf(stderr, "HTParse: result:%s\n", result);
     FREE(rel);
     FREE(name);
 
@@ -636,7 +647,8 @@ PUBLIC char * HTRelative ARGS2(
 	    strcat(result, "../");
 	strcat(result, last_slash+1);
     }
-    CTRACE(tfp, "HT: `%s' expressed relative to\n    `%s' is\n   `%s'.",
+    if (TRACE)
+	fprintf(stderr, "HT: `%s' expressed relative to\n    `%s' is\n   `%s'.",
 		aName, relatedName, result);
     return result;
 }