about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTWAIS.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1997-01-29 21:25:58 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1997-01-29 21:25:58 -0500
commitc3ec4181d988501e4d7116f32c669d5ca69e7060 (patch)
tree3a19fc17f13ca34edf02b209e19464f8041984cd /WWW/Library/Implementation/HTWAIS.c
parent6bd78b38830217fa268e678d9637116ec516bf0e (diff)
downloadlynx-snapshots-c3ec4181d988501e4d7116f32c669d5ca69e7060.tar.gz
snapshot of project "lynx", label v2_6fm_970129
Diffstat (limited to 'WWW/Library/Implementation/HTWAIS.c')
-rw-r--r--WWW/Library/Implementation/HTWAIS.c722
1 files changed, 356 insertions, 366 deletions
diff --git a/WWW/Library/Implementation/HTWAIS.c b/WWW/Library/Implementation/HTWAIS.c
index e0659f17..264ce263 100644
--- a/WWW/Library/Implementation/HTWAIS.c
+++ b/WWW/Library/Implementation/HTWAIS.c
@@ -7,19 +7,19 @@
 **  Source files, once retrieved, are stored and used to provide
 **  information about the index when that is acessed.
 **
-** Authors
+**  Authors
 **	BK	Brewster Kahle, Thinking Machines, <Brewster@think.com>
 **	TBL	Tim Berners-Lee, CERN <timbl@info.cern.ch>
 **	FM	Foteos Macrides, WFEB <macrides@sci.wfeb.edu>
 **
-** History
+**  History
 **	   Sep 91	TBL adapted shell-ui.c (BK) with HTRetrieve.c from WWW.
 **	   Feb 91	TBL Generated HTML cleaned up a bit (quotes, escaping)
 **			    Refers to lists of sources. 
 **	   Mar 93	TBL Lib 2.0 compatible module made.
 **	   May 94	FM  Added DIRECT_WAIS support for VMS.
 **
-** Bugs
+**  Bugs
 **	Uses C stream i/o to read and write sockets, which won't work
 **	on VMS TCP systems.
 **
@@ -27,15 +27,15 @@
 **
 **	ANSI C only as written
 **
-** Bugs fixed
+**  Bugs fixed
 **      NT Nathan Torkington (Nathan.Torkington@vuw.ac.nz)
 **
-** WAIS comments:
+**  WAIS comments:
 **
 **	1.	Separate directories for different system's .o would help
 **	2.	Document ids are rather long!
 **
-** WWW Address mapping convention:
+** W WW Address mapping convention:
 **
 **	/servername/database/type/length/document-id
 **
@@ -60,11 +60,9 @@
 /* #include "HTWSRC.h"	*/	/* Need some bits from here */
 /* #include "ParseWSRC.h" */
 
-
 /*			From WAIS
 **			---------
 */
-
 #ifdef VMS
 #include "HTVMS_WaisUI.h"
 #include "HTVMS_WaisProt.h"
@@ -77,7 +75,6 @@
 
 #define WAISSEARCH_DATE "Fri Jul 19 1991"
 
-
 /*			FROM WWW
 **			--------
 */
@@ -122,99 +119,93 @@ struct _HTStream {
 	/* ... */
 };
 
-
 /* ------------------------------------------------------------------------ */
 /* ---------------- Local copy of connect_to_server calls ----------------- */
 /* ------------------------------------------------------------------------ */
-
 /* Returns 1 on success, 0 on fail, -1 on interrupt. */
-static int fd_mosaic_connect_to_server ARGS3(char *, host_name, long, port,
-long *, fd)
+PRIVATE int fd_mosaic_connect_to_server ARGS3(
+	char *,		host_name,
+	long,		port,
+	long *,		fd)
 {
-  /* New version. */
-  char dummy[256];
-  int status;
+    /*
+    **  New version.
+    */
+    char dummy[256];
+    int status;
 
-  sprintf (dummy, "wais://%s:%d/", host_name, port);
+    sprintf (dummy, "wais://%s:%d/", host_name, port);
 
-  status = HTDoConnect (dummy, "WAIS", 210, (int *)fd);
-  if (status == HT_INTERRUPTED)
-    {
-      if (TRACE)
-        fprintf (stderr, "===WAIS=== interrupted in connect\n");
-      HTAlert ("Connection interrupted.");
-      return -1;
+    status = HTDoConnect (dummy, "WAIS", 210, (int *)fd);
+    if (status == HT_INTERRUPTED) {
+        return -1;
     }
-  if (status < 0)
-    return 0;
-  return 1;
+    if (status < 0)
+        return 0;
+    return 1;
 }
 
 /* Returns 1 on success, 0 on fail, -1 on interrupt. */
 #ifdef VMS
-static int mosaic_connect_to_server ARGS3(char *, host_name, long, port,
-					  long *, fdp)
+PRIVATE int mosaic_connect_to_server ARGS3(
+	char *,		host_name,
+	long,		port,
+	long *,		fdp)
 #else
-static int mosaic_connect_to_server ARGS3(char *, host_name, long, port,
-					  FILE **, fp)
+PRIVATE int mosaic_connect_to_server ARGS3(
+	char *,		host_name,
+	long,		port,
+	FILE **,	fp)
 #endif /* VMS */
 {
 #ifndef VMS
-  FILE* file;
+    FILE* file;
 #endif /* VMS */
-  long fd;
-  int rv;
+    long fd;
+    int rv;
   
-  rv = fd_mosaic_connect_to_server (host_name, port, &fd);
-  if(rv == 0) 
-    {
-      HTAlert ("Could not connect to WAIS server.");
-      return 0;
-    }
-  else if (rv == -1)
-    {
-      HTAlert ("Connection interrupted.");
-      return -1;
+    rv = fd_mosaic_connect_to_server (host_name, port, &fd);
+    if (rv == 0) {
+        HTAlert ("Could not connect to WAIS server.");
+        return 0;
+    } else if (rv == -1) {
+        HTAlert ("Connection interrupted.");
+        return -1;
     }
 
 #ifndef VMS
-  if ((file = fdopen(fd,"r+")) == NULL) 
-    {
-      HTAlert ("Could not open WAIS connection for reading.");
-      return 0;
+    if ((file = fdopen(fd,"r+")) == NULL) {
+        HTAlert ("Could not open WAIS connection for reading.");
+        return 0;
     }
 
-  *fp = file;
+    *fp = file;
 #else
-  *fdp = fd;
+    *fdp = fd;
 #endif /* VMS */
-  return 1;
+    return 1;
 }
-
-
 /* ------------------------------------------------------------------------ */
 /* ------------------------------------------------------------------------ */
 
-
 /*								showDiags
 */
 /* modified from Jonny G's version in ui/question.c */
-
-void showDiags ARGS2(
+PRIVATE void showDiags ARGS2(
 	HTStream *, 		target,
 	diagnosticRecord **, 	d)
 {
-  long i;
-
-  for (i = 0; d[i] != NULL; i++) {
-    if (d[i]->ADDINFO != NULL) {
-      PUTS("Diagnostic code is ");
-      PUTS(d[i]->DIAG);
-      PUTC(' ');
-      PUTS(d[i]->ADDINFO);
-      PUTC('\n'); ;
+    long i;
+
+    for (i = 0; d[i] != NULL; i++) {
+        if (d[i]->ADDINFO != NULL) {
+            PUTS("Diagnostic code is ");
+            PUTS(d[i]->DIAG);
+            PUTC(' ');
+            PUTS(d[i]->ADDINFO);
+            PUTC('\n'); ;
+        }
     }
-  }
 }
 
 /*	Matrix of allowed characters in filenames
@@ -242,7 +233,8 @@ PRIVATE void init_acceptable NOARGS
 **	returns		nil if error
 **			pointer to malloced string (must be freed) if ok
 */
-char * WWW_from_archie ARGS1 (char *, file)
+PRIVATE char * WWW_from_archie ARGS1(
+	char *,		file)
 {
     char * end;
     char * result;
@@ -262,18 +254,18 @@ char * WWW_from_archie ARGS1 (char *, file)
 /*	Transform document identifier into URL
 **	--------------------------------------
 **
-** Bugs: A static buffer of finite size is used!
+**  Bugs: A static buffer of finite size is used!
 **	The format of the docid MUST be good!
 **
-** On exit,
+**  On exit,
 **	returns		nil if error
 **			pointer to malloced string (must be freed) if ok
 */
 PRIVATE char hex [17] = "0123456789ABCDEF";
 extern char from_hex PARAMS((char a));			/* In HTWSRC @@ */
 
-PRIVATE char * WWW_from_WAIS ARGS1(any *, docid)
-
+PRIVATE char * WWW_from_WAIS ARGS1(
+	any *,		docid)
 {
     static char buf[BIG];
     char * q = buf;
@@ -282,7 +274,7 @@ PRIVATE char * WWW_from_WAIS ARGS1(any *, docid)
     if (TRACE) {
 	char *p;
 	fprintf(stderr, "WAIS id (%d bytes) is ", (int)docid->size);
-	for(p=docid->bytes; p<docid->bytes+docid->size; p++) {
+	for (p = docid->bytes; p < docid->bytes+docid->size; p++) {
 	    if ((*p >= ' ') && (*p<= '~')) /* Assume ASCII! */
 		fprintf(stderr, "%c", *p);
 	    else
@@ -290,11 +282,12 @@ PRIVATE char * WWW_from_WAIS ARGS1(any *, docid)
 	}
 	fprintf(stderr, "\n");
     }	 
-    for (p=docid->bytes; (p<docid->bytes+docid->size) && (q<&buf[BIG]);) {
-	if (TRACE) fprintf(stderr, "    Record type %d, length %d\n",
-		p[0], p[1]);
-        if (*p>10) {
-	    if(TRACE)
+    for (p = docid->bytes;
+         (p < docid->bytes+docid->size) && (q < &buf[BIG]);) {
+	if (TRACE)
+	    fprintf(stderr, "    Record type %d, length %d\n", p[0], p[1]);
+        if (*p > 10) {
+	    if (TRACE)
 	        fprintf(stderr, "Eh? DOCID record type of %d!\n", *p);
 	    return 0;
 	}
@@ -313,7 +306,7 @@ PRIVATE char * WWW_from_WAIS ARGS1(any *, docid)
 	}
 	*q++ = '=';		/* Separate */
 	l = *p++;		/* Length */
-	for(i=0; i<l; i++, p++){
+	for (i = 0; i < l; i++, p++){
 	    if (!acceptable[*p]) {
 		*q++ = HEX_ESCAPE;	/* Means hex commming */
 		*q++ = hex[(*p) >> 4];
@@ -324,7 +317,8 @@ PRIVATE char * WWW_from_WAIS ARGS1(any *, docid)
 	*q++= ';';		/* Terminate field */
     }
     *q++ = 0;			/* Terminate string */
-    if (TRACE) fprintf(stderr, "WWW form of id: %s\n", buf); 
+    if (TRACE)
+        fprintf(stderr, "WWW form of id: %s\n", buf); 
     {
         char * result = (char *)malloc(strlen(buf)+1);
 	if (!result)
@@ -334,18 +328,19 @@ PRIVATE char * WWW_from_WAIS ARGS1(any *, docid)
     }
 } /* WWW_from_WAIS */
 
-
 /*	Transform URL into WAIS document identifier
 **	-------------------------------------------
 **
-** On entry,
+**  On entry,
 **	docname		points to valid name produced originally by
 **			WWW_from_WAIS
-** On exit,
+**  On exit,
 **	docid->size	is valid
 **	docid->bytes	is malloced and must later be freed.
 */
-PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
+PRIVATE any * WAIS_from_WWW ARGS2(
+	any *,		docid,
+	char *,		docname)
 {
     char *z; 	/* Output pointer */
     char *sor;	/* Start of record - points to size field. */
@@ -353,11 +348,14 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
     char *q; 	/* Poisition of "=" */
     char *s; 	/* Position of semicolon */
     int n;	/* size */
-    if (TRACE) fprintf(stderr, "WWW id (to become WAIS id): %s\n", docname); 
-    for(n=0, p = docname; *p; p++) {	/* Count sizes of strings */
+    if (TRACE)
+        fprintf(stderr, "WWW id (to become WAIS id): %s\n", docname); 
+    for (n = 0, p = docname; *p; p++) {	/* Count sizes of strings */
         n++;
-	if (*p == ';')  n--;		/* Not converted */
-	else if (*p == HEX_ESCAPE) n=n-2;	/* Save two bytes */
+	if (*p == ';')
+	    n--;		/* Not converted */
+	else if (*p == HEX_ESCAPE)
+	    n = n-2;		/* Save two bytes */
         docid->size = n;
     }
     
@@ -365,7 +363,7 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
 	    outofmem(__FILE__, "WAIS_from_WWW");
     z = docid->bytes;
     
-    for(p = docname; *p; ) {	/* Convert of strings */
+    for (p = docname; *p; ) {	/* Convert of strings */
     				/* Record type */
 				
 	*z = 0;			/* Initialize record type */
@@ -373,7 +371,8 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
 	    *z = *z*10 + (*p++ - '0');	/* Decode decimal record type */
 	}
 	z++;
-	if (*p != '=') return 0;
+	if (*p != '=')
+	    return 0;
 	q = p;
 	
 /*        *z++ = *p++ - '0';
@@ -381,10 +380,11 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
 	if (!q) return 0;
 */
 	s = strchr(q, ';');	/* (Check only) */
-	if (!s) return 0;	/* Bad! No ';';	*/
+	if (!s)
+	    return 0;		/* Bad! No ';';	*/
         sor = z;		/* Remember where the size field was */
 	z++;			/* Skip record size for now	*/
-	for(p=q+1; *p!=';' ; ) {
+	for (p = q+1; *p != ';';) {
 	   if (*p == HEX_ESCAPE) {
 	        char c;
 		unsigned int b;
@@ -392,7 +392,8 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
 	        c = *p++;
 		b =   from_hex(c);
 		c = *p++;
-		if (!c) break;	/* Odd number of chars! */
+		if (!c)
+		    break;	/* Odd number of chars! */
 		*z++ = (b<<4) + from_hex(c);
 	    } else {
 	        *z++ = *p++;	/* Record */
@@ -405,7 +406,7 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
     if (TRACE) {
 	char *p;
 	fprintf(stderr, "WAIS id (%d bytes) is ", (int)docid->size);
-	for(p=docid->bytes; p<docid->bytes+docid->size; p++) {
+	for (p = docid->bytes; p < docid->bytes+docid->size; p++) {
 	    if ((*p >= ' ') && (*p<= '~')) /* Assume ASCII! */
 		fprintf(stderr, "%c", *p);
 	    else
@@ -417,11 +418,9 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
     
 } /* WAIS_from_WWW */
 
-
 /*	Send a plain text record to the client		output_text_record()
 **	--------------------------------------
 */
-
 PRIVATE void output_text_record ARGS4(
     HTStream *,			target,
     WAISDocumentText *,		record,
@@ -441,13 +440,12 @@ PRIVATE void output_text_record ARGS4(
     return;
   }
 
-  for(count = 0; count < record->DocumentText->size; count++){
+  for (count = 0; count < record->DocumentText->size; count++){
     long ch = (unsigned char)record->DocumentText->bytes[count];
     if (ch == 27) {	/* What is this in for? Tim */
-
 	    /* then we have an escape code */
 	    /* if the next letter is '(' or ')', then ignore two letters */
-	    if('(' == record->DocumentText->bytes[count + 1] ||
+	    if ('(' == record->DocumentText->bytes[count + 1] ||
 		')' == record->DocumentText->bytes[count + 1])
 	    count += 1;             /* it is a term marker */
 	    else count += 4;		/* it is a paragraph marker */
@@ -459,162 +457,162 @@ PRIVATE void output_text_record ARGS4(
   }
 } /* output text record */
 
-
-
 /*	Format A Search response for the client		display_search_response
 **	---------------------------------------
 */
 /* modified from tracy shen's version in wutil.c
  * displays either a text record or a set of headlines.
  */
-void
-display_search_response ARGS4(
+PRIVATE void display_search_response ARGS4(
     HTStructured *,		target,
     SearchResponseAPDU *,	response,
     char *,			database,
     char *,	 		keywords)
 {
-  WAISSearchResponse  *info;
-  long i, k;
+    WAISSearchResponse  *info;
+    long i, k;
   
-  BOOL archie =  strstr(database, "archie")!=0;	/* Specical handling */
+    BOOL archie =  strstr(database, "archie")!=0;	/* Specical handling */
   
-  if (TRACE) fprintf(stderr, "HTWAIS: Displaying search response\n");
-  PUTS("Index ");
-  START(HTML_EM);
-  PUTS(database);
-  END(HTML_EM);
-  sprintf(line, " contains the following %d item%s relevant to \"",
-	  (int)(response->NumberOfRecordsReturned),
-	  response->NumberOfRecordsReturned ==1 ? "" : "s");
-  PUTS(line);
-  START(HTML_EM);
-  PUTS(keywords);
-  END(HTML_EM);
-  PUTS("\".\n");
-  PUTS("The first figure after each entry is its relative score, ");
-  PUTS("the second is the number of lines in the item.");
-  START(HTML_BR);
-  START(HTML_BR);
-  PUTS("\n");
-  START(HTML_OL);
-
-  if ( response->DatabaseDiagnosticRecords != 0 ) {
-    info = (WAISSearchResponse *)response->DatabaseDiagnosticRecords;
-    i =0; 
-
-    if (info->Diagnostics != NULL)
-      showDiags((HTStream*)target, info->Diagnostics);
-
-    if ( info->DocHeaders != 0 ) {
-      for (k=0; info->DocHeaders[k] != 0; k++ ) {
-	WAISDocumentHeader* head = info->DocHeaders[k];
-	char * headline = trim_junk(head->Headline);
-	any * docid = head->DocumentID;
-	char * docname;			/* printable version of docid */
-	i++;
-
-/*	Make a printable string out of the document id.
-*/
-	if (TRACE) fprintf(stderr, 
-		"HTWAIS:  %2ld: Score: %4ld, lines:%4ld '%s'\n", 
-	       i,
-	       (long int)(info->DocHeaders[k]->Score),
-	       (long int)(info->DocHeaders[k]->Lines),
-	       headline);
-
-	START(HTML_LI);
-
-	if (archie) {
-	    char * www_name = WWW_from_archie(headline);
-	    if (www_name) {
-		HTStartAnchor(target, NULL, www_name);
-		PUTS(headline);
-		
-		END(HTML_A);
-		FREE(www_name);
-	    } else {
-		 PUTS(headline);
-		 PUTS(" (bad file name)");
-	    }
-	} else { /* Not archie */
-	    docname =  WWW_from_WAIS(docid);
-	    if (docname) {
-		char * dbname = HTEscape(database, URL_XPALPHAS);
-		sprintf(line, "/%s/%s/%d/%s",		/* W3 address */
-				    dbname,
-		    head->Types ? head->Types[0] : "TEXT",
-		    (int)(head->DocumentLength),
-		    docname);
-		HTStartAnchor(target, NULL, ( (head->Types) 
-		      && (!strcmp(head->Types[0], "URL"))) ? 
-			      headline : line); /* NT, Sep 93 */
-		PUTS(headline);
-		END(HTML_A);
-		FREE(dbname);
-		FREE(docname);
-	    } else {
-		 PUTS("(bad doc id)");
-	    }
-	  }
-
-	sprintf(line, "%5ld  %5ld  ",
-	    head->Score,
-	    head->Lines);
-	PUTS( line);
-      } /* next document header */
-    } /* if there were any document headers */
+    if (TRACE)
+        fprintf(stderr, "HTWAIS: Displaying search response\n");
+    PUTS("Index ");
+    START(HTML_EM);
+    PUTS(database);
+    END(HTML_EM);
+    sprintf(line, " contains the following %d item%s relevant to \"",
+	    (int)(response->NumberOfRecordsReturned),
+	    response->NumberOfRecordsReturned ==1 ? "" : "s");
+    PUTS(line);
+    START(HTML_EM);
+    PUTS(keywords);
+    END(HTML_EM);
+    PUTS("\".\n");
+    PUTS("The first figure after each entry is its relative score, ");
+    PUTS("the second is the number of lines in the item.");
+    START(HTML_BR);
+    START(HTML_BR);
+    PUTS("\n");
+    START(HTML_OL);
+
+    if (response->DatabaseDiagnosticRecords != 0) {
+        info = (WAISSearchResponse *)response->DatabaseDiagnosticRecords;
+        i =0; 
+
+        if (info->Diagnostics != NULL)
+            showDiags((HTStream*)target, info->Diagnostics);
+
+        if (info->DocHeaders != 0) {
+            for (k = 0; info->DocHeaders[k] != 0; k++ ) {
+	        WAISDocumentHeader* head = info->DocHeaders[k];
+	        char * headline = trim_junk(head->Headline);
+	        any * docid = head->DocumentID;
+	        char * docname;		/* printable version of docid */
+
+	        i++;
+	        /*
+	        **  Make a printable string out of the document id.
+	        */
+	        if (TRACE)
+		    fprintf(stderr, 
+		            "HTWAIS:  %2ld: Score: %4ld, lines:%4ld '%s'\n", 
+	                    i,
+	                    (long int)(info->DocHeaders[k]->Score),
+	                    (long int)(info->DocHeaders[k]->Lines),
+	                    headline);
+
+	        START(HTML_LI);
+
+	        if (archie) {
+	            char * www_name = WWW_from_archie(headline);
+	            if (www_name) {
+		        HTStartAnchor(target, NULL, www_name);
+		        PUTS(headline);
+		        END(HTML_A);
+		        FREE(www_name);
+	            } else {
+		        PUTS(headline);
+		        PUTS(" (bad file name)");
+	            }
+	        } else { /* Not archie */
+	            docname =  WWW_from_WAIS(docid);
+	            if (docname) {
+		        char * dbname = HTEscape(database, URL_XPALPHAS);
+		        sprintf(line,
+				"/%s/%s/%d/%s",		/* W3 address */
+				dbname,
+		    		head->Types ? head->Types[0] : "TEXT",
+		    		(int)(head->DocumentLength),
+		    		docname);
+			HTStartAnchor(target, NULL,
+				      ((head->Types) &&
+				       (!strcmp(head->Types[0], "URL")))
+				       		? 
+			      	       headline : line); /* NT, Sep 93 */
+			PUTS(headline);
+			END(HTML_A);
+			FREE(dbname);
+			FREE(docname);
+	    	    } else {
+		 	PUTS("(bad doc id)");
+	    	    }
+	  	}
+
+		sprintf(line, "%5ld  %5ld  ",
+	    		head->Score,
+	    		head->Lines);
+		PUTS( line);
+      	    } /* next document header */
+    	} /* if there were any document headers */
     
-    if ( info->ShortHeaders != 0 ) {
-      k =0;
-      while (info->ShortHeaders[k] != 0 ) {
-	i++;
-	PUTS( "(Short Header record, can't display)");
-      }
-    }
-    if ( info->LongHeaders != 0 ) {
-      k =0;
-      while (info->LongHeaders[k] != 0) {
-	i++;
-	PUTS( "\nLong Header record, can't display\n");
-      }
-    }
-    if ( info->Text != 0 ) {
-      k =0;
-      while (info->Text[k] != 0) {
-	i++;
-	PUTS( "\nText record\n");
-	output_text_record((HTStream*)target, info->Text[k++], false, false);
-      }
-    }
-    if ( info->Headlines != 0 ) {
-      k =0;
-      while (info->Headlines[k] != 0) {
-	i++;
-	PUTS( "\nHeadline record, can't display\n");
-	/* dsply_headline_record( info->Headlines[k++]); */
-      }
-    }
-    if ( info->Codes != 0 ) {
-      k =0;
-      while (info->Codes[k] != 0) {
-	i++;
-	PUTS( "\nCode record, can't display\n");
-	/* dsply_code_record( info->Codes[k++]); */
-      }
-    }
-  }				/* Loop: display user info */
-  END(HTML_OL);
-  PUTC('\n'); ;
+        if (info->ShortHeaders != 0) {
+            k = 0;
+            while (info->ShortHeaders[k] != 0) {
+	        i++;
+	        PUTS( "(Short Header record, can't display)");
+            }
+        }
+        if (info->LongHeaders != 0) {
+            k = 0;
+            while (info->LongHeaders[k] != 0) {
+	        i++;
+	        PUTS( "\nLong Header record, can't display\n");
+            }
+        }
+        if (info->Text != 0) {
+            k = 0;
+            while (info->Text[k] != 0) {
+	        i++;
+		PUTS( "\nText record\n");
+		output_text_record((HTStream*)target,
+				   info->Text[k++], false, false);
+            }
+        }
+        if (info->Headlines != 0) {
+      	    k = 0;
+            while (info->Headlines[k] != 0) {
+	        i++;
+		PUTS( "\nHeadline record, can't display\n");
+		/* dsply_headline_record( info->Headlines[k++]); */
+      	    }
+        }
+        if (info->Codes != 0) {
+      	    k = 0;
+            while (info->Codes[k] != 0) {
+		i++;
+		PUTS( "\nCode record, can't display\n");
+		/* dsply_code_record( info->Codes[k++]); */
+      	    }
+        }
+    }	/* Loop: display user info */
+    END(HTML_OL);
+    PUTC('\n'); ;
 }
 
-
-
-
 /*		Load by name					HTLoadWAIS
 **		============
 **
-**	This renders any object or search as required
+**  This renders any object or search as required.
 */
 PUBLIC int HTLoadWAIS ARGS4(
 	CONST char *,		arg,
@@ -657,14 +655,14 @@ PUBLIC int HTLoadWAIS ARGS4(
     
     extern FILE * connect_to_server();
     
-    if (!acceptable_inited) init_acceptable();
-    
-        
-/*	Decipher and check syntax of WWW address:
-**	----------------------------------------
-**
-**	First we remove the "wais:" if it was spcified.  920110
-*/  
+    if (!acceptable_inited)
+        init_acceptable();
+
+    /*	Decipher and check syntax of WWW address:
+    **	----------------------------------------
+    **
+    **	First we remove the "wais:" if it was spcified.  920110
+    */  
     names = HTParse(arg, "", PARSE_HOST | PARSE_PATH | PARSE_PUNCTUATION);
     key = strchr(names, '?');
     
@@ -674,7 +672,7 @@ PUBLIC int HTLoadWAIS ARGS4(
 	for (p=key; *p; p++) if (*p == '+') *p = ' ';
 	HTUnEscape(key);
     }
-    if (names[0]== '/') {
+    if (names[0] == '/') {
 	server_name = names+1;
 	if (as_gate =(*server_name == '/'))
 	    server_name++;	/* Accept one or two */
@@ -686,11 +684,11 @@ PUBLIC int HTLoadWAIS ARGS4(
 	    else if (doctype) {	/* If not search parse doc details */
 		*doctype++ = 0;	/* Separate rest of doc address */
 		doclength = strchr(doctype, '/');
-		if(doclength) {
+		if (doclength) {
 		    *doclength++ = 0;
 		    document_length = atol(doclength);
 		    if (document_length) {
-			docname=strchr(doclength, '/');
+			docname = strchr(doclength, '/');
 			if (docname) {
 			    *docname++ = 0;
 			    ok = YES;	/* To avoid a goto! */
@@ -698,55 +696,58 @@ PUBLIC int HTLoadWAIS ARGS4(
 		    } /* if document_length valid */
 		} /* if doclength */
 	    } else { /* no doctype?  Assume index required */
-	        if (!key) key = "";
+	        if (!key)
+		    key = "";
 		ok = YES;
 	    } /* if doctype */
 	} /* if database */
-     }
+    }
      
-     if (!ok)
-	 return HTLoadError(sink, 500, "Syntax error in WAIS URL");
+    if (!ok)
+	return HTLoadError(sink, 500, "Syntax error in WAIS URL");
 
-     if (TRACE) fprintf(stderr, "HTWAIS: Parsed OK\n");
+    if (TRACE)
+        fprintf(stderr, "HTWAIS: Parsed OK\n");
      
-     service = strchr(names, ':');
-     if (service)  *service++ = 0;
-     else service = "210";
+    service = strchr(names, ':');
+    if (service)
+        *service++ = 0;
+    else
+        service = "210";
      
-     if (server_name[0] == 0)
+    if (server_name[0] == 0) {
 #ifdef VMS
         connection = 0;
 #else
         connection = NULL;
 #endif /* VMS */
 
-     else if (!(key && !*key))
-    {
-      int status;
-      if (TRACE)
+    } else if (!(key && !*key)) {
+        int status;
+        if (TRACE)
         fprintf (stderr, "===WAIS=== calling mosaic_connect_to_server\n");
-      status = mosaic_connect_to_server
-        			(server_name, atoi(service), &connection);
-      if (status == 0)
-        {
-          if (TRACE)
-            fprintf (stderr, "===WAIS=== connection failed\n");
-          FREE(names);
-          return HT_NOT_LOADED;
-        }
-      else if (status == -1)
-        {
-          if (TRACE)
-            fprintf (stderr, "===WAIS=== connection interrupted\n");
-          FREE(names);
-          return HT_INTERRUPTED;
+        status = mosaic_connect_to_server(server_name,
+					  atoi(service),
+					  &connection);
+        if (status == 0) {
+            if (TRACE)
+                fprintf (stderr, "===WAIS=== connection failed\n");
+            FREE(names);
+            return HT_NOT_LOADED;
+        } else if (status == -1) {
+            if (TRACE)
+                fprintf (stderr, "===WAIS=== connection interrupted\n");
+            FREE(names);
+            return HT_NOT_LOADED;
         }
     }
 
     StrAllocCopy(wais_database,www_database);
     HTUnEscape(wais_database);
     
-	/* This below fixed size stuff is terrible */
+    /*
+    **  This below fixed size stuff is terrible.
+    */
 #ifdef VMS
     if (!(request_message =
     	  (char*)calloc((size_t)MAX_MESSAGE_LEN*sizeof(char),1)))
@@ -759,13 +760,12 @@ PUBLIC int HTLoadWAIS ARGS4(
     response_message = (char*)s_malloc((size_t)MAX_MESSAGE_LEN * sizeof(char));
 #endif /* VMS */
 
-/*	If keyword search is performed but there are no keywords,
-**	the user has followed a link to the index itself. It would be
-**	appropriate at this point to send him the .SRC file - how?
-*/
-
+    /*
+    **  If keyword search is performed but there are no keywords,
+    **  the user has followed a link to the index itself. It would be
+    **  appropriate at this point to send him the .SRC file - how?
+    */
     if (key && !*key) {				/* I N D E X */
-    
 #ifdef CACHE_FILE_PREFIX
 	char filename[256];
 	FILE * fp;
@@ -800,9 +800,9 @@ PUBLIC int HTLoadWAIS ARGS4(
 	    PUTS(" WAIS Index.\n"); 
 	    
 	}
-	/* If we have seen a source file for this database, use that:
+	/*
+	**  If we have seen a source file for this database, use that.
 	*/
-
 #ifdef CACHE_FILE_PREFIX
 	sprintf(filename, "%sWSRC-%s:%s:%.100s.txt",
 		CACHE_FILE_PREFIX,
@@ -826,7 +826,6 @@ PUBLIC int HTLoadWAIS ARGS4(
 	PUTS("\nEnter the 's'earch command and then specify search words.\n");
 	
 	FREE_TARGET;
-	
     } else if (key) {					/* S E A R C H */
 	char *p;
 	HTStructured * target;
@@ -834,8 +833,9 @@ PUBLIC int HTLoadWAIS ARGS4(
 	strncpy(keywords, key, MAX_KEYWORDS_LENGTH);
 	while(p=strchr(keywords, '+')) *p = ' ';
     
-        /* Send advance title to get something fast to the other end */
-	
+        /*
+	**  Send advance title to get something fast to the other end.
+	*/
 	target = HTML_new(anAnchor, format_out, sink);
 	
 	START(HTML_HEAD);
@@ -895,9 +895,7 @@ PUBLIC int HTLoadWAIS ARGS4(
 	    return_status = HT_INTERRUPTED;
 	    FREE_TARGET;
 	    goto CleanUp;
-	}
-
-	else if(!rv) {
+	} else if (!rv) {
 #ifdef VMS
 	    HTAlert ("HTWAIS: Return message too large.");
 	    return_status = HT_NOT_LOADED;
@@ -906,9 +904,7 @@ PUBLIC int HTLoadWAIS ARGS4(
 #else
 	    panic("returned message too large");
 #endif /* VMS */
-    
         } else {	/* returned message ok */
-	
 	    SearchResponseAPDU  *query_response = 0;
 	    readSearchResponseAPDU(&query_response,
 	    	response_message + HEADER_LENGTH);
@@ -919,17 +915,15 @@ PUBLIC int HTLoadWAIS ARGS4(
 			query_response->DatabaseDiagnosticRecords);         
 	    freeSearchResponseAPDU( query_response);
 	}	/* returned message not too large */
-    
 	FREE_TARGET;
-
     } else {			/* D O C U M E N T    F E T C H */
-    
 	HTFormat format_in;
 	boolean binary;     /* how to transfer stuff coming over */
 	HTStream * target;
 	long count;
 	any   doc_chunk;
 	any * docid = &doc_chunk;
+
 	if (TRACE) fprintf(stderr,
 		"HTWAIS: Retrieve document id `%s' type `%s' length %ld\n",
 		docname, doctype, document_length);
@@ -945,32 +939,33 @@ PUBLIC int HTLoadWAIS ARGS4(
 	  0 != strcmp(doctype, "TEXT") &&
 	  0 != strcmp(doctype, "HTML") ;
 
-
 	target = HTStreamStack(format_in, format_out, sink, anAnchor);
-	if (!target) return HTLoadError(sink, 500,
-		"Can't convert format of WAIS document");
-/*	Decode hex or litteral format for document ID
-*/	
+	if (!target)
+	    return HTLoadError(sink, 500,
+			       "Can't convert format of WAIS document");
+	/*
+	**  Decode hex or litteral format for document ID.
+	*/	
 	WAIS_from_WWW(docid, docname);
 
-	
-/*	Loop over slices of the document
-*/	
-	for(count = 0; 
-	    count * CHARS_PER_PAGE < document_length;
-	    count++){
+	/*
+	**  Loop over slices of the document.
+	*/	
+	for (count = 0; 
+	     count * CHARS_PER_PAGE < document_length;
+	     count++) {
 #ifdef VMS
-          char *type = NULL;
+            char *type = NULL;
 	  
-	  StrAllocCopy(type, doctype);
+	    StrAllocCopy(type, doctype);
 #else
-	  char *type = s_strdup(doctype);	/* Gets freed I guess */
+	    char *type = s_strdup(doctype);	/* Gets freed I guess */
 #endif /* VMS */
-	  request_buffer_length = MAX_MESSAGE_LEN; /* Amount left */
-	  if (TRACE) fprintf(stderr, "HTWAIS: Slice number %ld\n", count);
+	    request_buffer_length = MAX_MESSAGE_LEN; /* Amount left */
+	    if (TRACE)
+	        fprintf(stderr, "HTWAIS: Slice number %ld\n", count);
 
-            if(HTCheckForInterrupt())
-              {
+            if (HTCheckForInterrupt()) {
                 HTAlert ("Data transfer interrupted.");
                 (*target->isa->_abort)(target, NULL);
 #ifdef VMS
@@ -978,54 +973,50 @@ PUBLIC int HTLoadWAIS ARGS4(
 #endif /* VMS */
 		return_status = HT_NOT_LOADED;
 		goto CleanUp;
-              }
-
-	  if(0 ==
-	      generate_retrieval_apdu(request_message + HEADER_LENGTH,
-		    &request_buffer_length, 
-		    docid, 
-		    CT_byte,
-		    count * CHARS_PER_PAGE,
+            }
+
+	    if (0 ==
+	        generate_retrieval_apdu(request_message + HEADER_LENGTH,
+		    			&request_buffer_length, 
+		    			docid, 
+		    			CT_byte,
+		    			count * CHARS_PER_PAGE,
 		    ((count + 1) * CHARS_PER_PAGE <= document_length ?
-		             (count + 1) * CHARS_PER_PAGE :
-			     document_length),
-		    type,
-		    wais_database
-		    )) {
+		             		(count + 1) * CHARS_PER_PAGE :
+			     		document_length),
+		    			type,
+		    			wais_database)) {
 #ifdef VMS
-		    HTAlert ("HTWAIS: Request too long.");
-		    return_status = HT_NOT_LOADED;
-		    FREE_TARGET;
-		    FREE(type);
-		    FREE(docid->bytes);
-		    goto CleanUp;
+		HTAlert ("HTWAIS: Request too long.");
+		return_status = HT_NOT_LOADED;
+		FREE_TARGET;
+		FREE(type);
+		FREE(docid->bytes);
+		goto CleanUp;
 #else
-		    panic("request too long");
+		panic("request too long");
 #endif /* VMS */
-		}
+	    }
 	  
-	  /*	Actually do the transaction given by request_message */
-	  HTProgress("Fetching WAIS document...");
-	  rv = interpret_message (request_message, 
-				  MAX_MESSAGE_LEN - request_buffer_length, 
-				  response_message,
-				  MAX_MESSAGE_LEN,
-				  connection,
-				  false /* true verbose */	
-			         );
-
-	  if (rv == HT_INTERRUPTED)
-	    {
+	    /*
+	    **  Actually do the transaction given by request_message.
+	    */
+	    HTProgress("Fetching WAIS document...");
+	    rv = interpret_message(request_message, 
+				   MAX_MESSAGE_LEN - request_buffer_length, 
+				   response_message,
+				   MAX_MESSAGE_LEN,
+				   connection,
+				   false /* true verbose */	
+			          );
+	    if (rv == HT_INTERRUPTED) {
 		HTAlert ("Data transfer interrupted.");
 		return_status = HT_INTERRUPTED;
 		FREE_TARGET;
 		FREE(type);
 		FREE(docid->bytes);
 		goto CleanUp;
-	    }
-
-	  else if (!rv)
-	    {
+	    } else if (!rv) {
 #ifdef VMS
 		HTAlert ("HTWAIS: Return message too large.");
 		return_status = HT_NOT_LOADED;
@@ -1038,28 +1029,28 @@ PUBLIC int HTLoadWAIS ARGS4(
 #endif /* VMS */
 	    }
 
-	  /* 	Parse the result which came back into memory.
-	  */
-	  readSearchResponseAPDU(&retrieval_response, 
-				 response_message + HEADER_LENGTH);
+	    /*
+	    **  Parse the result which came back into memory.
+	    */
+	    readSearchResponseAPDU(&retrieval_response, 
+				   response_message + HEADER_LENGTH);
 
-	  if(NULL == ((WAISSearchResponse *)
-	  	retrieval_response->DatabaseDiagnosticRecords)->Text){
+	    if (NULL ==
+	        ((WAISSearchResponse *)
+	  	 retrieval_response->DatabaseDiagnosticRecords)->Text) {
 		/* display_search_response(target, retrieval_response,
 					wais_database, keywords); */
 		PUTS("No text was returned!\n");
 		/* panic("No text was returned"); */
-	  } else {
-	  
+	    } else {
 		output_text_record(target,
-		   ((WAISSearchResponse *)
+		   		   ((WAISSearchResponse *)
 		    retrieval_response->DatabaseDiagnosticRecords)->Text[0],
-		false, binary);
-	  
-	  } /* If text existed */
+				   false, binary);
+	    } /* If text existed */
 	  
 #ifdef VMS
-	  FREE(type);
+	    FREE(type);
 #endif /* VMS */
 	}	/* Loop over slices */
 
@@ -1071,11 +1062,10 @@ PUBLIC int HTLoadWAIS ARGS4(
 
     } /* If document rather than search */
 
-
-
 CleanUp:
-/*	(This postponed until later,  after a timeout:)
-*/
+    /*
+    **  (This postponed until later,  after a timeout:)
+    */
 #ifdef VMS
     if (connection)
         NETCLOSE((int)connection);