status = (*stream->put_block)(stream, (char*)key.data, key.size);
escaped = NET_EscapeDoubleQuote((char*)key.data); PUT_PART(escaped); XP_FREE(escaped);
NET_DisplayGlobalHistoryInfoAsHTML(MWContext *context,								   URL_Struct *URL_s,								   int format_out){	char *buffer = (char*)XP_ALLOC(256);   	NET_StreamClass * stream;	DBT key, data;	Bool long_form = FALSE;	time_t entry_date;	int status = MK_NO_DATA;	int32 count=0;	static char LINK_START[] = "<A href=\"";	static char LINK_END[] = "\">";	static char END_LINK[] = "</A>";	if(!buffer)	  {		return(MK_UNABLE_TO_CONVERT);	  }	if(strcasestr(URL_s->address, "?long"))		long_form = TRUE;	StrAllocCopy(URL_s->content_type, TEXT_HTML);	format_out = CLEAR_CACHE_BIT(format_out);	stream = NET_StreamBuilder(format_out,							   URL_s,							   context);	if(!stream)	  {		return(MK_UNABLE_TO_CONVERT);	  }	/* define a macro to push a string up the stream	 * and handle errors	 */#define PUT_PART(part)													\status = (*stream->put_block)(stream,			\										part ? part : XP_GetString(XP_GLHIST_UNKNOWN),	 \										part ? XP_STRLEN(part) : 7);	\if(status < 0)												\  goto END;	XP_SPRINTF(buffer, XP_GetString(XP_GLHIST_INFO_HTML));	PUT_PART(buffer);	if(!gh_database)	  {		XP_STRCPY(buffer, XP_GetString(XP_GLHIST_DATABASE_CLOSED));		PUT_PART(buffer);		goto END;	  }    if(0 != (*gh_database->seq)(gh_database, &key, &data, R_FIRST))	  {		XP_STRCPY(buffer, XP_GetString(XP_GLHIST_DATABASE_EMPTY));		PUT_PART(buffer);		goto END;	  }	/* define some macros to help us output HTML tables	 */#define TABLE_TOP(arg1)				\	XP_SPRINTF(buffer, 				\"<TR><TD ALIGN=RIGHT><b>%s</TD>\n"	\"<TD>", arg1);						\PUT_PART(buffer);#define TABLE_BOTTOM				\	XP_SPRINTF(buffer, 				\"</TD></TR>");						\PUT_PART(buffer);    do      {		count++;		COPY_INT32(&entry_date, data.data);		/* print url */		XP_STRCPY(buffer, "<TT>&nbsp;URL:</TT> ");		PUT_PART(buffer);		/* make the URL a link */		PUT_PART(LINK_START);		if(status < 0)  			goto END;		/* push the key special since we know the size */		status = (*stream->put_block)(stream,									  (char*)key.data, key.size);		if(status < 0)  			goto END;		PUT_PART(LINK_END);		if(status < 0)  			goto END;		/* push the key special since we know the size */		status = (*stream->put_block)(stream,									  (char*)key.data, key.size);		if(status < 0)  			goto END;		PUT_PART(END_LINK);		if(status < 0)  			goto END;		XP_SPRINTF(buffer, XP_GetString(XP_GLHIST_HTML_DATE), ctime(&entry_date));		PUT_PART(buffer);      }    while(0 == (*gh_database->seq)(gh_database, &key, &data, R_NEXT));		XP_SPRINTF(buffer, XP_GetString(XP_GLHIST_HTML_TOTAL_ENTRIES), count);	PUT_PART(buffer);END:	XP_FREE(buffer);		if(status < 0)		(*stream->abort)(stream, status);	else		(*stream->complete)(stream);	XP_FREE(stream);	return(status);}