about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTWSRC.c
diff options
context:
space:
mode:
Diffstat (limited to 'WWW/Library/Implementation/HTWSRC.c')
-rw-r--r--WWW/Library/Implementation/HTWSRC.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/WWW/Library/Implementation/HTWSRC.c b/WWW/Library/Implementation/HTWSRC.c
index d26a86ac..56608ac3 100644
--- a/WWW/Library/Implementation/HTWSRC.c
+++ b/WWW/Library/Implementation/HTWSRC.c
@@ -15,7 +15,7 @@
 
 
 /* #include <sys/types.h>	already in tcp.h */
-/* #include <sys/stat.h>  	this too         */
+/* #include <sys/stat.h>	this too	 */
 /* #include <stdio.h> included in HTUtils.h -- FM */
 #include "HTML.h"
 #include "HTParse.h"
@@ -40,31 +40,31 @@ struct _HTStructured {
 #define START(e) (*me->target->isa->start_element)(me->target, e, 0, 0, -1, 0)
 #define END(e) (*me->target->isa->end_element)(me->target, e, 0)
 #define MAYBE_END(e) if (HTML_dtd.tags[e].contents != SGML_EMPTY) \
-                        (*me->target->isa->end_element)(me->target, e, 0)
+			(*me->target->isa->end_element)(me->target, e, 0)
 
 
 /*	Here are the parameters which can be specified in a  source file
 */
 PRIVATE CONST char* par_name[] = {
-	"version", 
+	"version",
 	"ip-address",
 #define PAR_IP_NAME 2
-	"ip-name", 
+	"ip-name",
 #define PAR_TCP_PORT 3
-	"tcp-port", 
+	"tcp-port",
 #define PAR_DATABASE_NAME 4
 	"database-name",
 #define PAR_COST 5
-	"cost", 
+	"cost",
 #define PAR_COST_UNIT 6
-	"cost-unit", 
+	"cost-unit",
 #define PAR_FREE 7
-	"free",	
+	"free",
 #define PAR_MAINTAINER 8
-	"maintainer", 	
+	"maintainer",
 #define PAR_DESCRIPTION 9
 	"description",
-	"keyword-list", 	
+	"keyword-list",
 	"source",
 	"window-geometry",
 	"configuration",
@@ -101,7 +101,7 @@ struct _HTStream {
 	HTStructured *		target;
 	char *			par_value[PAR_COUNT];
 	enum tokenstate 	state;
-	char 			param[BIG+1];
+	char			param[BIG+1];
 	int			param_number;
 	int			param_count;
 };
@@ -116,7 +116,7 @@ PUBLIC CONST char * hex = "0123456789ABCDEF";
 
 PUBLIC char from_hex ARGS1(char, c)
 {
-    return 		  (c>='0')&&(c<='9') ? c-'0'
+    return		  (c>='0')&&(c<='9') ? c-'0'
 			: (c>='A')&&(c<='F') ? c-'A'+10
 			: (c>='a')&&(c<='f') ? c-'a'+10
 			:		       0;
@@ -130,7 +130,7 @@ PUBLIC char from_hex ARGS1(char, c)
 **	me->state	is a valid state (see WSRC_init)
 **	c		is the next character
 ** On exit,
-** 	returns	1	Done with file
+**	returns 1	Done with file
 **		0	Continue. me->state is updated if necessary.
 **		-1	Syntax error error
 */
@@ -143,11 +143,11 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
 {
     switch (me->state) {
     case beginning:
-        if (c=='(') me->state = before_tag;
+	if (c=='(') me->state = before_tag;
 	break;
-	
+
     case before_tag:
-        if (c==')') {
+	if (c==')') {
 	    me->state = done;
 	    return;			/* Done with input file */
 	} else if (c==':') {
@@ -157,7 +157,7 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
 	break;
 
     case colon:
-        if (WHITE(c)) {
+	if (WHITE(c)) {
 	    me->param[me->param_count++] = 0;	/* Terminate */
 	    for(me->param_number = 0; par_name[me->param_number]; me->param_number++) {
 		if (0==strcmp(par_name[me->param_number], me->param)) {
@@ -165,7 +165,7 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
 		}
 	    }
 	    if (!par_name[me->param_number]) {	/* Unknown field */
-	        if (TRACE) fprintf(stderr,
+		if (TRACE) fprintf(stderr,
 		    "HTWSRC: Unknown field `%s' in source file\n",
 		    me->param);
 		me->param_number = PAR_UNKNOWN;
@@ -177,9 +177,9 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
 	    if (me->param_count < PARAM_MAX)  me->param[me->param_count++] = c;
 	}
 	break;
-	
+
     case before_value:
-        if (c==')') {
+	if (c==')') {
 	    me->state = done;
 	    return;			/* Done with input file */
 	}
@@ -189,13 +189,13 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
 	    me->state = quoted_value;
 	    break;
 	}
-	me->state = (c=='"') ? quoted_value : 
+	me->state = (c=='"') ? quoted_value :
 		    (c=='(') ? bracketed_value : value;
 	me->param[me->param_count++] = c;	/* Don't miss first character */
 	break;
 
     case value:
-        if (WHITE(c)) {
+	if (WHITE(c)) {
 	    me->param[me->param_count] = 0;
 	    StrAllocCopy(me->par_value[me->param_number], me->param);
 	    me->state = before_tag;
@@ -205,23 +205,23 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
 	break;
 
     case bracketed_value:
-        if (c==')') {
+	if (c==')') {
 	    me->param[me->param_count] = 0;
 	    StrAllocCopy(me->par_value[me->param_number], me->param);
 	    me->state = before_tag;
 	    break;
 	}
-        if (me->param_count < PARAM_MAX)  me->param[me->param_count++] = c;
+	if (me->param_count < PARAM_MAX)  me->param[me->param_count++] = c;
 	break;
-	
+
     case quoted_value:
-        if (c=='"') {
+	if (c=='"') {
 	    me->param[me->param_count] = 0;
 	    StrAllocCopy(me->par_value[me->param_number], me->param);
 	    me->state = before_tag;
 	    break;
 	}
-	
+
 	if (c=='\\') {		/* Ignore escape but switch state */
 	    me->state = escape_in_quoted;
 	    break;
@@ -229,10 +229,10 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
 	/* Fall through! */
 
     case escape_in_quoted:
-        if (me->param_count < PARAM_MAX)  me->param[me->param_count++] = c;
+	if (me->param_count < PARAM_MAX)  me->param[me->param_count++] = c;
 	me->state = quoted_value;
 	break;
-	
+
     case done:				/* Ignore anything after EOF */
 	return;
 
@@ -254,23 +254,23 @@ PRIVATE BOOL write_cache ARGS1(HTStream *, me)
     char cache_file_name[256];
     char * www_database;
     if (!me->par_value[PAR_DATABASE_NAME]
-    	|| !me->par_value[PAR_IP_NAME]
+	|| !me->par_value[PAR_IP_NAME]
 	) return NO;
-    
+
     www_database = HTEscape(me->par_value[PAR_DATABASE_NAME], URL_XALPHAS);
     sprintf(cache_file_name, "%sWSRC-%s:%s:%.100s.txt",
-    	CACHE_FILE_PREFIX,
+	CACHE_FILE_PREFIX,
 	me->par_value[PAR_IP_NAME],
 	me->par_value[PAR_TCP_PORT] ? me->par_value[PAR_TCP_PORT] : "210",
 	www_database);
     FREE(www_database);
     fp = fopen(cache_file_name, "w");
     if (!fp) return NO;
-    
+
     if (me->par_value[PAR_DESCRIPTION])
-        fputs(me->par_value[PAR_DESCRIPTION], fp);
-    else 
-        fputs("Description not available\n", fp);
+	fputs(me->par_value[PAR_DESCRIPTION], fp);
+    else
+	fputs("Description not available\n", fp);
     fclose(fp);
     return YES;
 }
@@ -289,7 +289,7 @@ PRIVATE void give_parameter ARGS2(HTStream *, me, int, p)
 	PUTS(me->par_value[p]);
 	PUTS("; ");
     } else {
-        PUTS(" NOT GIVEN in source file; ");
+	PUTS(" NOT GIVEN in source file; ");
     }
 }
 
@@ -306,9 +306,9 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
 	StrAllocCopy(shortname, me->par_value[PAR_DATABASE_NAME]);
 	l = strlen(shortname);
 	if ( l > 4 && !strcasecomp(shortname + l -4, ".src")) {
-	    shortname[l-4] = 0;	/* Chop of .src -- boring! */
+	    shortname[l-4] = 0; /* Chop of .src -- boring! */
 	}
-	
+
 	START(HTML_HEAD);
 	PUTS("\n");
 	START(HTML_TITLE);
@@ -317,7 +317,7 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
 	END(HTML_TITLE);
 	PUTS("\n");
 	END(HTML_HEAD);
-    
+
 	START(HTML_H1);
 	PUTS(shortname);
 	PUTS(source_file ? " description" : " index");
@@ -325,9 +325,9 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
 	PUTS("\n");
 	FREE(shortname);
     }
-    
+
     START(HTML_DL);		/* Definition list of details */
-    
+
     if (source_file) {
 	START(HTML_DT);
 	PUTS("Access links");
@@ -335,17 +335,17 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
 	START(HTML_DD);
 	if (me->par_value[PAR_IP_NAME] &&
 	    me->par_value[PAR_DATABASE_NAME]) {
-    
+
 	    char WSRC_address[256];
 	    char * www_database;
 	    www_database = HTEscape(me->par_value[PAR_DATABASE_NAME],
-	    	URL_XALPHAS);
+		URL_XALPHAS);
 	    sprintf(WSRC_address, "wais://%s%s%s/%s",
 		me->par_value[PAR_IP_NAME],
 		me->par_value[PAR_TCP_PORT] ? ":" : "",
 		me->par_value[PAR_TCP_PORT] ? me->par_value[PAR_TCP_PORT] :"",
 		www_database);
-	
+
 	    HTStartAnchor(me->target, NULL, WSRC_address);
 	    PUTS("Direct access");
 	    END(HTML_A);
@@ -353,15 +353,15 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
 	    PUTS(" (or via proxy server, if defined)");
 
 	    FREE(www_database);
-	    
+
 	} else {
 	    give_parameter(me, PAR_IP_NAME);
 	    give_parameter(me, PAR_DATABASE_NAME);
 	}
 	MAYBE_END(HTML_DD);
-    
+
     } /* end if source_file */
-    
+
     if (me->par_value[PAR_MAINTAINER]) {
 	START(HTML_DT);
 	PUTS("Maintainer");
@@ -371,11 +371,11 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
 	MAYBE_END(HTML_DD);
     }
     if (me->par_value[PAR_IP_NAME]) {
-    	START(HTML_DT);
-    	PUTS("Host");
+	START(HTML_DT);
+	PUTS("Host");
 	MAYBE_END(HTML_DT);
-    	START(HTML_DD);
-    	PUTS(me->par_value[PAR_IP_NAME]);
+	START(HTML_DD);
+	PUTS(me->par_value[PAR_IP_NAME]);
 	MAYBE_END(HTML_DD);
     }
 
@@ -386,9 +386,9 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
 	PUTS(me->par_value[PAR_DESCRIPTION]);
 	END(HTML_PRE);
     }
-    
+
     (*me->target->isa->_free)(me->target);
-    
+
     return;
 } /* generate html */
 
@@ -397,19 +397,19 @@ PRIVATE void WSRCParser_put_string ARGS2(HTStream *, context, CONST char*, str)
 {
     CONST char *p;
     for(p=str; *p; p++)
-        WSRCParser_put_character(context, *p);
+	WSRCParser_put_character(context, *p);
 }
 
 
 PRIVATE void WSRCParser_write ARGS3(
-		HTStream *, 	context,
-		CONST char*, 	str,
-		int, 		l)
+		HTStream *,	context,
+		CONST char*,	str,
+		int,		l)
 {
     CONST char *p;
     CONST char *e = str+l;
     for(p=str; p<e; p++)
-        WSRCParser_put_character(context, *p);
+	WSRCParser_put_character(context, *p);
 }
 
 
@@ -421,7 +421,7 @@ PRIVATE void WSRCParser_free ARGS1(HTStream *, me)
 #endif
     {
 	int p;
-	for (p = 0; par_name[p]; p++) {	/* Clear out old values */
+	for (p = 0; par_name[p]; p++) { /* Clear out old values */
 	    FREE(me->par_value[p]);
 	}
     }
@@ -434,7 +434,7 @@ PRIVATE void WSRCParser_abort ARGS2(HTStream *, me, HTError, e)
 }
 
 
-/*		Stream subclass		-- method routines
+/*		Stream subclass 	-- method routines
 **		---------------
 */
 
@@ -443,7 +443,7 @@ HTStreamClass WSRCParserClass = {
 	WSRCParser_free,
 	WSRCParser_abort,
 	WSRCParser_put_character,
- 	WSRCParser_put_string,
+	WSRCParser_put_string,
 	WSRCParser_write
 
 };
@@ -454,7 +454,7 @@ HTStreamClass WSRCParserClass = {
 */
 PUBLIC HTStream* HTWSRCConvert ARGS3(
 	HTPresentation *,	pres,
-	HTParentAnchor *,	anchor,	
+	HTParentAnchor *,	anchor,
 	HTStream *,		sink)
 {
     HTStream * me = (HTStream*) malloc(sizeof(*me));