about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTNews.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2004-05-07 01:13:29 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2004-05-07 01:13:29 -0400
commitd326f24d169154673717129098ff4554a673f178 (patch)
tree7229f817b10bcdb82f8df2b6af3a3acc792a762d /WWW/Library/Implementation/HTNews.c
parent2cd8e80bfe2792ce8999a26b34384598f58e3889 (diff)
downloadlynx-snapshots-d326f24d169154673717129098ff4554a673f178.tar.gz
snapshot of project "lynx", label v2-8-6dev_3
Diffstat (limited to 'WWW/Library/Implementation/HTNews.c')
-rw-r--r--WWW/Library/Implementation/HTNews.c1749
1 files changed, 888 insertions, 861 deletions
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index e214596e..791aee92 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -1,10 +1,10 @@
 /*			NEWS ACCESS				HTNews.c
-**			===========
-**
-** History:
-**	26 Sep 90	Written TBL
-**	29 Nov 91	Downgraded to C, for portable implementation.
-*/
+ *			===========
+ *
+ * History:
+ *	26 Sep 90	Written TBL
+ *	29 Nov 91	Downgraded to C, for portable implementation.
+ */
 
 #include <HTUtils.h>		/* Coding convention macros */
 
@@ -25,8 +25,8 @@
 #define NEWS_PORT 119		/* See rfc977 */
 #define SNEWS_PORT 563		/* See Lou Montulli */
 #define APPEND			/* Use append methods */
-int HTNewsChunkSize = 30;/* Number of articles for quick display */
-int HTNewsMaxChunk = 40; /* Largest number of articles in one window */
+int HTNewsChunkSize = 30;	/* Number of articles for quick display */
+int HTNewsMaxChunk = 40;	/* Largest number of articles in one window */
 
 #ifndef DEFAULT_NEWS_HOST
 #define DEFAULT_NEWS_HOST "news"
@@ -36,14 +36,16 @@ int HTNewsMaxChunk = 40; /* Largest number of articles in one window */
 #endif /* SERVER_FILE */
 
 #ifdef USE_SSL
-extern SSL_CTX * ssl_ctx;
-static SSL * Handle = NULL;
+extern SSL_CTX *ssl_ctx;
+static SSL *Handle = NULL;
 static int channel_s = 1;
+
 #define NEWS_NETWRITE(sock, buff, size) \
 	(Handle ? SSL_write(Handle, buff, size) : NETWRITE(sock, buff, size))
 #define NEWS_NETCLOSE(sock) \
 	{ (void)NETCLOSE(sock); if (Handle) SSL_free(Handle); Handle = NULL; }
-static char HTNewsGetCharacter (void);
+static char HTNewsGetCharacter(void);
+
 #define NEXT_CHAR HTNewsGetCharacter()
 #else
 #define NEWS_NETWRITE  NETWRITE
@@ -65,35 +67,35 @@ static char HTNewsGetCharacter (void);
 #define SnipIn2(d,fmt,tag,len,s) sprintf(d, fmt, tag, (int)sizeof(d)-len, s)
 
 struct _HTStructured {
-	const HTStructuredClass *	isa;
-	/* ... */
+    const HTStructuredClass *isa;
+    /* ... */
 };
-struct _HTStream
-{
-  HTStreamClass * isa;
+struct _HTStream {
+    HTStreamClass *isa;
 };
 
-#define LINE_LENGTH 512			/* Maximum length of line of ARTICLE etc */
+#define LINE_LENGTH 512		/* Maximum length of line of ARTICLE etc */
 #define GROUP_NAME_LENGTH	256	/* Maximum length of group name */
 
 /*
-**  Module-wide variables.
-*/
-char * HTNewsHost = NULL;		/* Default host */
-static char * NewsHost = NULL;			/* Current host */
-static char * NewsHREF = NULL;			/* Current HREF prefix */
-static int s;					/* Socket for NewsHost */
-static int HTCanPost = FALSE;			/* Current POST permission */
-static char response_text[LINE_LENGTH+1];	/* Last response */
-/* static HText *	HT;	*/		/* the new hypertext */
-static HTStructured * target;			/* The output sink */
-static HTStructuredClass targetClass;		/* Copy of fn addresses */
-static HTStream * rawtarget = NULL;		/* The output sink for rawtext */
-static HTStreamClass rawtargetClass;		/* Copy of fn addresses */
-static HTParentAnchor *node_anchor;		/* Its anchor */
-static int	diagnostic;			/* level: 0=none 2=source */
-static BOOL rawtext = NO;			/* Flag: HEAD or -mime_headers */
-static HTList *NNTP_AuthInfo = NULL;		/* AUTHINFO database */
+ *  Module-wide variables.
+ */
+char *HTNewsHost = NULL;	/* Default host */
+static char *NewsHost = NULL;	/* Current host */
+static char *NewsHREF = NULL;	/* Current HREF prefix */
+static int s;			/* Socket for NewsHost */
+static int HTCanPost = FALSE;	/* Current POST permission */
+static char response_text[LINE_LENGTH + 1];	/* Last response */
+
+/* static HText *	HT;	*//* the new hypertext */
+static HTStructured *target;	/* The output sink */
+static HTStructuredClass targetClass;	/* Copy of fn addresses */
+static HTStream *rawtarget = NULL;	/* The output sink for rawtext */
+static HTStreamClass rawtargetClass;	/* Copy of fn addresses */
+static HTParentAnchor *node_anchor;	/* Its anchor */
+static int diagnostic;		/* level: 0=none 2=source */
+static BOOL rawtext = NO;	/* Flag: HEAD or -mime_headers */
+static HTList *NNTP_AuthInfo = NULL;	/* AUTHINFO database */
 static char *name = NULL;
 static char *address = NULL;
 static char *dbuf = NULL;	/* dynamic buffer for long messages etc. */
@@ -111,13 +113,13 @@ static char *dbuf = NULL;	/* dynamic buffer for long messages etc. */
 			else (*targetClass._abort)(target, NULL)
 
 typedef struct _NNTPAuth {
-   char * host;
-   char * user;
-   char * pass;
+    char *host;
+    char *user;
+    char *pass;
 } NNTPAuth;
 
 #ifdef LY_FIND_LEAKS
-static void free_news_globals (void)
+static void free_news_globals(void)
 {
     if (s >= 0) {
 	NEWS_NETCLOSE(s);
@@ -132,7 +134,7 @@ static void free_news_globals (void)
 }
 #endif /* LY_FIND_LEAKS */
 
-static void free_NNTP_AuthInfo (void)
+static void free_NNTP_AuthInfo(void)
 {
     HTList *cur = NNTP_AuthInfo;
     NNTPAuth *auth = NULL;
@@ -140,7 +142,7 @@ static void free_NNTP_AuthInfo (void)
     if (!cur)
 	return;
 
-    while (NULL != (auth = (NNTPAuth *)HTList_nextObject(cur))) {
+    while (NULL != (auth = (NNTPAuth *) HTList_nextObject(cur))) {
 	FREE(auth->host);
 	FREE(auth->user);
 	FREE(auth->pass);
@@ -151,47 +153,47 @@ static void free_NNTP_AuthInfo (void)
     return;
 }
 
-const char * HTGetNewsHost (void)
+const char *HTGetNewsHost(void)
 {
-	return HTNewsHost;
+    return HTNewsHost;
 }
 
-void HTSetNewsHost (const char *  value)
+void HTSetNewsHost(const char *value)
 {
-	StrAllocCopy(HTNewsHost, value);
+    StrAllocCopy(HTNewsHost, value);
 }
 
 /*	Initialisation for this module
-**	------------------------------
-**
-**	Except on the NeXT, we pick up the NewsHost name from
-**
-**	1.	Environment variable NNTPSERVER
-**	2.	File SERVER_FILE
-**	3.	Compilation time macro DEFAULT_NEWS_HOST
-**	4.	Default to "news"
-**
-**	On the NeXT, we pick up the NewsHost name from, in order:
-**
-**	1.	WorldWideWeb default "NewsHost"
-**	2.	Global default "NewsHost"
-**	3.	News default "NewsHost"
-**	4.	Compilation time macro DEFAULT_NEWS_HOST
-**	5.	Default to "news"
-*/
+ *	------------------------------
+ *
+ *	Except on the NeXT, we pick up the NewsHost name from
+ *
+ *	1.	Environment variable NNTPSERVER
+ *	2.	File SERVER_FILE
+ *	3.	Compilation time macro DEFAULT_NEWS_HOST
+ *	4.	Default to "news"
+ *
+ *	On the NeXT, we pick up the NewsHost name from, in order:
+ *
+ *	1.	WorldWideWeb default "NewsHost"
+ *	2.	Global default "NewsHost"
+ *	3.	News default "NewsHost"
+ *	4.	Compilation time macro DEFAULT_NEWS_HOST
+ *	5.	Default to "news"
+ */
 static BOOL initialized = NO;
-static BOOL initialize (void)
+static BOOL initialize(void)
 {
 #ifdef NeXTStep
     char *cp = NULL;
 #endif
 
     /*
-    **	Get name of Host.
-    */
+     * Get name of Host.
+     */
 #ifdef NeXTStep
-    if ((cp = NXGetDefaultValue("WorldWideWeb","NewsHost"))==0) {
-	if ((cp = NXGetDefaultValue("News","NewsHost")) == 0) {
+    if ((cp = NXGetDefaultValue("WorldWideWeb", "NewsHost")) == 0) {
+	if ((cp = NXGetDefaultValue("News", "NewsHost")) == 0) {
 	    StrAllocCopy(HTNewsHost, DEFAULT_NEWS_HOST);
 	}
     }
@@ -203,18 +205,21 @@ static BOOL initialize (void)
     if (LYGetEnv("NNTPSERVER")) {
 	StrAllocCopy(HTNewsHost, LYGetEnv("NNTPSERVER"));
 	CTRACE((tfp, "HTNews: NNTPSERVER defined as `%s'\n",
-		    HTNewsHost));
+		HTNewsHost));
     } else {
-	FILE* fp = fopen(SERVER_FILE, TXT_R);
+	FILE *fp = fopen(SERVER_FILE, TXT_R);
+
 	if (fp) {
-	    char server_name[MAXHOSTNAMELEN+1];
+	    char server_name[MAXHOSTNAMELEN + 1];
+
 	    if (fgets(server_name, sizeof server_name, fp) != NULL) {
 		char *p = strchr(server_name, '\n');
+
 		if (p != NULL)
 		    *p = '\0';
 		StrAllocCopy(HTNewsHost, server_name);
 		CTRACE((tfp, "HTNews: File %s defines news host as `%s'\n",
-			    SERVER_FILE, HTNewsHost));
+			SERVER_FILE, HTNewsHost));
 	    }
 	    fclose(fp);
 	}
@@ -223,7 +228,7 @@ static BOOL initialize (void)
 	StrAllocCopy(HTNewsHost, DEFAULT_NEWS_HOST);
 #endif /* NeXTStep */
 
-    s = -1;		/* Disconnected */
+    s = -1;			/* Disconnected */
 #ifdef LY_FIND_LEAKS
     atexit(free_news_globals);
 #endif
@@ -231,102 +236,105 @@ static BOOL initialize (void)
 }
 
 /*	Send NNTP Command line to remote host & Check Response
-**	------------------------------------------------------
-**
-** On entry,
-**	command points to the command to be sent, including CRLF, or is null
-**		pointer if no command to be sent.
-** On exit,
-**	Negative status indicates transmission error, socket closed.
-**	Positive status is an NNTP status.
-*/
-static int response (char * command)
+ *	------------------------------------------------------
+ *
+ * On entry,
+ *	command points to the command to be sent, including CRLF, or is null
+ *		pointer if no command to be sent.
+ * On exit,
+ *	Negative status indicates transmission error, socket closed.
+ *	Positive status is an NNTP status.
+ */
+static int response(char *command)
 {
     int result;
-    char * p = response_text;
+    char *p = response_text;
     int ich;
 
     if (command) {
 	int status;
 	int length = strlen(command);
+
 	CTRACE((tfp, "NNTP command to be sent: %s", command));
 #ifdef NOT_ASCII
 	{
-	    const char	* p;
-	    char	* q;
-	    char ascii[LINE_LENGTH+1];
-	    for(p = command, q=ascii; *p; p++, q++) {
+	    const char *p;
+	    char *q;
+	    char ascii[LINE_LENGTH + 1];
+
+	    for (p = command, q = ascii; *p; p++, q++) {
 		*q = TOASCII(*p);
 	    }
 	    status = NEWS_NETWRITE(s, ascii, length);
 	}
 #else
-	status = NEWS_NETWRITE(s, (char *)command, length);
+	status = NEWS_NETWRITE(s, (char *) command, length);
 #endif /* NOT_ASCII */
-	if (status < 0){
+	if (status < 0) {
 	    CTRACE((tfp, "HTNews: Unable to send command. Disconnecting.\n"));
 	    NEWS_NETCLOSE(s);
 	    s = -1;
 	    return status;
-	} /* if bad status */
-    } /* if command to be sent */
-
+	}			/* if bad status */
+    }
+    /* if command to be sent */
     for (;;) {
 	ich = NEXT_CHAR;
 	if (((*p++ = (char) ich) == LF) ||
 	    (p == &response_text[LINE_LENGTH])) {
-	    *--p = '\0';			/* Terminate the string */
+	    *--p = '\0';	/* Terminate the string */
 	    CTRACE((tfp, "NNTP Response: %s\n", response_text));
 	    sscanf(response_text, "%d", &result);
 	    return result;
-	} /* if end of line */
-
+	}
+	/* if end of line */
 	if (ich == EOF) {
-	    *(p-1) = '\0';
+	    *(p - 1) = '\0';
 	    if (interrupted_in_htgetcharacter) {
-		CTRACE((tfp, "HTNews: Interrupted on read, closing socket %d\n",
-			    s));
+		CTRACE((tfp,
+			"HTNews: Interrupted on read, closing socket %d\n",
+			s));
 	    } else {
 		CTRACE((tfp, "HTNews: EOF on read, closing socket %d\n",
-			    s));
+			s));
 	    }
 	    NEWS_NETCLOSE(s);	/* End of file, close socket */
 	    s = -1;
 	    if (interrupted_in_htgetcharacter) {
 		interrupted_in_htgetcharacter = 0;
-		return(HT_INTERRUPTED);
+		return (HT_INTERRUPTED);
 	    }
-	    return((int)EOF);	/* End of file on response */
+	    return ((int) EOF);	/* End of file on response */
 	}
-    } /* Loop over characters */
+    }				/* Loop over characters */
 }
 
 /*	Case insensitive string comparisons
-**	-----------------------------------
-**
-** On entry,
-**	template must be already un upper case.
-**	unknown may be in upper or lower or mixed case to match.
-*/
-static BOOL match (const char * unknown, const char * template)
+ *	-----------------------------------
+ *
+ * On entry,
+ *	template must be already un upper case.
+ *	unknown may be in upper or lower or mixed case to match.
+ */
+static BOOL match(const char *unknown, const char *template)
 {
-    const char * u = unknown;
-    const char * t = template;
-    for (; *u && *t && (TOUPPER(*u) == *t); u++, t++)
-	; /* Find mismatch or end */
-    return (BOOL)(*t == 0);		/* OK if end of template */
+    const char *u = unknown;
+    const char *t = template;
+
+    for (; *u && *t && (TOUPPER(*u) == *t); u++, t++) ;		/* Find mismatch or end */
+    return (BOOL) (*t == 0);	/* OK if end of template */
 }
 
 typedef enum {
-    NNTPAUTH_ERROR =	  0,	/* general failure */
-    NNTPAUTH_OK =	281,	/* authenticated successfully */
-    NNTPAUTH_CLOSE =	502	/* server probably closed connection */
+    NNTPAUTH_ERROR = 0,		/* general failure */
+    NNTPAUTH_OK = 281,		/* authenticated successfully */
+    NNTPAUTH_CLOSE = 502	/* server probably closed connection */
 } NNTPAuthResult;
+
 /*
-**  This function handles nntp authentication. - FM
-*/
-static NNTPAuthResult HTHandleAuthInfo (
-	char *		host)
+ *  This function handles nntp authentication. - FM
+ */
+static NNTPAuthResult HTHandleAuthInfo(char *host)
 {
     HTList *cur = NULL;
     NNTPAuth *auth = NULL;
@@ -337,17 +345,17 @@ static NNTPAuthResult HTHandleAuthInfo (
     int status, tries;
 
     /*
-    **	Make sure we have an interactive user and a host. - FM
-    */
+     * Make sure we have an interactive user and a host.  - FM
+     */
     if (dump_output_immediately || !(host && *host))
 	return NNTPAUTH_ERROR;
 
     /*
-    **	Check for an existing authorization entry. - FM
-    */
+     * Check for an existing authorization entry.  - FM
+     */
     if (NNTP_AuthInfo != NULL) {
 	cur = NNTP_AuthInfo;
-	while (NULL != (auth = (NNTPAuth *)HTList_nextObject(cur))) {
+	while (NULL != (auth = (NNTPAuth *) HTList_nextObject(cur))) {
 	    if (!strcmp(auth->host, host)) {
 		UserName = auth->user;
 		PassWord = auth->pass;
@@ -362,9 +370,9 @@ static NNTPAuthResult HTHandleAuthInfo (
     }
 
     /*
-    **	Handle the username. - FM
-    */
-    buffer[sizeof(buffer)-1] = '\0';
+     * Handle the username.  - FM
+     */
+    buffer[sizeof(buffer) - 1] = '\0';
     tries = 3;
 
     while (tries) {
@@ -378,7 +386,7 @@ static NNTPAuthResult HTHandleAuthInfo (
 	    }
 	}
 	sprintf(buffer, "AUTHINFO USER %.*s%c%c",
-		(int) sizeof(buffer)-17, UserName, CR, LF);
+		(int) sizeof(buffer) - 17, UserName, CR, LF);
 	if ((status = response(buffer)) < 0) {
 	    if (status == HT_INTERRUPTED)
 		_HTProgress(CONNECTION_INTERRUPTED);
@@ -396,8 +404,8 @@ static NNTPAuthResult HTHandleAuthInfo (
 	}
 	if (status == 281) {
 	    /*
-	    **  Username is accepted and no password is required. - FM
-	    */
+	     * Username is accepted and no password is required.  - FM
+	     */
 	    if (auth) {
 		if (auth->user != UserName) {
 		    FREE(auth->user);
@@ -405,8 +413,8 @@ static NNTPAuthResult HTHandleAuthInfo (
 		}
 	    } else {
 		/*
-		**  Store the accepted username and no password. - FM
-		*/
+		 * Store the accepted username and no password.  - FM
+		 */
 		if ((auth = typecalloc(NNTPAuth)) != NULL) {
 		    StrAllocCopy(auth->host, host);
 		    auth->user = UserName;
@@ -417,16 +425,17 @@ static NNTPAuthResult HTHandleAuthInfo (
 	}
 	if (status != 381) {
 	    /*
-	    **  Not success, nor a request for the password,
-	    **  so it must be an error. - FM
-	    */
+	     * Not success, nor a request for the password, so it must be an
+	     * error.  - FM
+	     */
 	    HTAlert(response_text);
 	    tries--;
 	    if ((tries > 0) && HTConfirm(gettext("Change username?"))) {
 		if (!auth || auth->user != UserName) {
 		    FREE(UserName);
 		}
-		if ((UserName = HTPrompt(gettext("Username:"), UserName)) != NULL &&
+		if ((UserName = HTPrompt(gettext("Username:"), UserName))
+		    != NULL &&
 		    *UserName) {
 		    continue;
 		}
@@ -445,8 +454,8 @@ static NNTPAuthResult HTHandleAuthInfo (
 
     if (status == 381) {
 	/*
-	**  Handle the password. - FM
-	*/
+	 * Handle the password.  - FM
+	 */
 	tries = 3;
 	while (tries) {
 	    if (PassWord == NULL) {
@@ -459,7 +468,7 @@ static NNTPAuthResult HTHandleAuthInfo (
 		}
 	    }
 	    sprintf(buffer, "AUTHINFO PASS %.*s%c%c",
-		    (int) sizeof(buffer)-17, PassWord, CR, LF);
+		    (int) sizeof(buffer) - 17, PassWord, CR, LF);
 	    if ((status = response(buffer)) < 0) {
 		if (status == HT_INTERRUPTED) {
 		    _HTProgress(CONNECTION_INTERRUPTED);
@@ -483,8 +492,8 @@ static NNTPAuthResult HTHandleAuthInfo (
 	    }
 	    if (status == 502) {
 		/*
-		 *  That's what INN's nnrpd returns.
-		 *  It closes the connection after this. - kw
+		 * That's what INN's nnrpd returns.  It closes the connection
+		 * after this.  - kw
 		 */
 		HTAlert(response_text);
 		if (auth) {
@@ -500,10 +509,10 @@ static NNTPAuthResult HTHandleAuthInfo (
 		return NNTPAUTH_CLOSE;
 	    }
 	    if (status == 281) {
-	    /*
-	    **	Password also is accepted, and everything
-	    **	has been stored. - FM
-	    */
+		/*
+		 * Password also is accepted, and everything has been stored. 
+		 * - FM
+		 */
 		if (auth) {
 		    if (auth->user != UserName) {
 			FREE(auth->user);
@@ -524,8 +533,8 @@ static NNTPAuthResult HTHandleAuthInfo (
 		return NNTPAUTH_OK;
 	    }
 	    /*
-	    **	Not success, so it must be an error. - FM
-	    */
+	     * Not success, so it must be an error.  - FM
+	     */
 	    HTAlert(response_text);
 	    if (!auth || auth->pass != PassWord) {
 		FREE(PassWord);
@@ -551,28 +560,28 @@ static NNTPAuthResult HTHandleAuthInfo (
 }
 
 /*	Find Author's name in mail address
-**	----------------------------------
-**
-** On exit,
-**	Returns allocated string which cannot be freed by the
-**	calling function, and is reallocated on subsequent calls
-**	to this function.
-**
-** For example, returns "Tim Berners-Lee" if given any of
-**	" Tim Berners-Lee <tim@online.cern.ch> "
-**  or	" tim@online.cern.ch ( Tim Berners-Lee ) "
-*/
-static char * author_name (char * email)
+ *	----------------------------------
+ *
+ * On exit,
+ *	Returns allocated string which cannot be freed by the
+ *	calling function, and is reallocated on subsequent calls
+ *	to this function.
+ *
+ * For example, returns "Tim Berners-Lee" if given any of
+ *	" Tim Berners-Lee <tim@online.cern.ch> "
+ *  or	" tim@online.cern.ch ( Tim Berners-Lee ) "
+ */
+static char *author_name(char *email)
 {
     char *p, *e;
 
     StrAllocCopy(name, email);
-    CTRACE((tfp,"Trying to find name in: %s\n",name));
+    CTRACE((tfp, "Trying to find name in: %s\n", name));
 
     if ((p = strrchr(name, '(')) && (e = strrchr(name, ')'))) {
 	if (e > p) {
-	    *e = '\0';			/* Chop off everything after the ')'  */
-	    return HTStrip(p+1);	/* Remove leading and trailing spaces */
+	    *e = '\0';		/* Chop off everything after the ')'  */
+	    return HTStrip(p + 1);	/* Remove leading and trailing spaces */
 	}
     }
 
@@ -584,33 +593,33 @@ static char * author_name (char * email)
 	}
     }
 
-    return HTStrip(name);		/* Default to the whole thing */
+    return HTStrip(name);	/* Default to the whole thing */
 }
 
 /*	Find Author's mail address
-**	--------------------------
-**
-** On exit,
-**	Returns allocated string which cannot be freed by the
-**	calling function, and is reallocated on subsequent calls
-**	to this function.
-**
-** For example, returns "montulli@spaced.out.galaxy.net" if given any of
-**	" Lou Montulli <montulli@spaced.out.galaxy.net> "
-**  or	" montulli@spaced.out.galaxy.net ( Lou "The Stud" Montulli ) "
-*/
-static char * author_address (char * email)
+ *	--------------------------
+ *
+ * On exit,
+ *	Returns allocated string which cannot be freed by the
+ *	calling function, and is reallocated on subsequent calls
+ *	to this function.
+ *
+ * For example, returns "montulli@spaced.out.galaxy.net" if given any of
+ *	" Lou Montulli <montulli@spaced.out.galaxy.net> "
+ *  or	" montulli@spaced.out.galaxy.net ( Lou "The Stud" Montulli ) "
+ */
+static char *author_address(char *email)
 {
     char *p, *at, *e;
 
     StrAllocCopy(address, email);
-    CTRACE((tfp,"Trying to find address in: %s\n",address));
+    CTRACE((tfp, "Trying to find address in: %s\n", address));
 
     if ((p = strrchr(address, '<'))) {
 	if ((e = strrchr(p, '>')) && (at = strrchr(p, '@'))) {
 	    if (at < e) {
-		*e = '\0';		 /* Remove > */
-		return HTStrip(p+1);  /* Remove leading and trailing spaces */
+		*e = '\0';	/* Remove > */
+		return HTStrip(p + 1);	/* Remove leading and trailing spaces */
 	    }
 	}
     }
@@ -618,7 +627,7 @@ static char * author_address (char * email)
     if ((p = strrchr(address, '(')) &&
 	(e = strrchr(address, ')')) && (at = strchr(address, '@'))) {
 	if (e > p && at < e) {
-	    *p = '\0';			/* Chop off everything after the ')'  */
+	    *p = '\0';		/* Chop off everything after the ')'  */
 	    return HTStrip(address);	/* Remove leading and trailing spaces */
 	}
     }
@@ -635,57 +644,57 @@ static char * author_address (char * email)
     }
 
     /*
-    **	Default to the first word.
-    */
+     * Default to the first word.
+     */
     p = address;
     while (isspace(UCH(*p)))
-	p++; /* find first non-space */
+	p++;			/* find first non-space */
     e = p;
     while (!isspace(UCH(*e)) && *e != '\0')
-	e++; /* find next space or end */
-    *e = '\0'; /* terminate space */
+	e++;			/* find next space or end */
+    *e = '\0';			/* terminate space */
 
-    return(p);
+    return (p);
 }
 
 /*	Start anchor element
-**	--------------------
-*/
-static void start_anchor (const char *   href)
+ *	--------------------
+ */
+static void start_anchor(const char *href)
 {
-    BOOL		present[HTML_A_ATTRIBUTES];
-    const char*		value[HTML_A_ATTRIBUTES];
+    BOOL present[HTML_A_ATTRIBUTES];
+    const char *value[HTML_A_ATTRIBUTES];
     int i;
 
-    for(i=0; i < HTML_A_ATTRIBUTES; i++)
+    for (i = 0; i < HTML_A_ATTRIBUTES; i++)
 	present[i] = (BOOL) (i == HTML_A_HREF);
     value[HTML_A_HREF] = href;
-    (*targetClass.start_element)(target, HTML_A, present, value, -1, 0);
+    (*targetClass.start_element) (target, HTML_A, present, value, -1, 0);
 }
 
 /*	Start link element
-**	------------------
-*/
-static void start_link (const char *   href, const char *  rev)
+ *	------------------
+ */
+static void start_link(const char *href, const char *rev)
 {
-    BOOL		present[HTML_LINK_ATTRIBUTES];
-    const char*		value[HTML_LINK_ATTRIBUTES];
+    BOOL present[HTML_LINK_ATTRIBUTES];
+    const char *value[HTML_LINK_ATTRIBUTES];
     int i;
 
-    for(i=0; i < HTML_LINK_ATTRIBUTES; i++)
+    for (i = 0; i < HTML_LINK_ATTRIBUTES; i++)
 	present[i] = (BOOL) (i == HTML_LINK_HREF || i == HTML_LINK_REV);
     value[HTML_LINK_HREF] = href;
-    value[HTML_LINK_REV]  = rev;
-    (*targetClass.start_element)(target, HTML_LINK, present, value, -1, 0);
+    value[HTML_LINK_REV] = rev;
+    (*targetClass.start_element) (target, HTML_LINK, present, value, -1, 0);
 }
 
 /*	Start list element
-**	------------------
-*/
-static void start_list (int  seqnum)
+ *	------------------
+ */
+static void start_list(int seqnum)
 {
-    BOOL		present[HTML_OL_ATTRIBUTES];
-    const char*		value[HTML_OL_ATTRIBUTES];
+    BOOL present[HTML_OL_ATTRIBUTES];
+    const char *value[HTML_OL_ATTRIBUTES];
     char SeqNum[20];
     int i;
 
@@ -693,35 +702,34 @@ static void start_list (int  seqnum)
 	present[i] = (BOOL) (i == HTML_OL_SEQNUM || i == HTML_OL_START);
     sprintf(SeqNum, "%d", seqnum);
     value[HTML_OL_SEQNUM] = SeqNum;
-    value[HTML_OL_START]  = SeqNum;
-    (*targetClass.start_element)(target, HTML_OL, present, value, -1, 0);
+    value[HTML_OL_START] = SeqNum;
+    (*targetClass.start_element) (target, HTML_OL, present, value, -1, 0);
 }
 
 /*	Paste in an Anchor
-**	------------------
-**
-**
-** On entry,
-**	HT	has a selection of zero length at the end.
-**	text	points to the text to be put into the file, 0 terminated.
-**	addr	points to the hypertext reference address,
-**		terminated by white space, comma, NULL or '>'
-*/
-static void write_anchor (const char * text, const char * addr)
+ *	------------------
+ *
+ *
+ * On entry,
+ *	HT	has a selection of zero length at the end.
+ *	text	points to the text to be put into the file, 0 terminated.
+ *	addr	points to the hypertext reference address,
+ *		terminated by white space, comma, NULL or '>'
+ */
+static void write_anchor(const char *text, const char *addr)
 {
-    char href[LINE_LENGTH+1];
-    const char * p;
+    char href[LINE_LENGTH + 1];
+    const char *p;
     char *q;
 
-    for (p = addr; *p && (*p != '>') && !WHITE(*p) && (*p!=','); p++)
-	;
+    for (p = addr; *p && (*p != '>') && !WHITE(*p) && (*p != ','); p++) ;
     if (strlen(NewsHREF) + (p - addr) + 1 < sizeof(href)) {
 	q = href;
 	strcpy(q, NewsHREF);
-	strncat(q, addr, p-addr);	/* Make complete hypertext reference */
+	strncat(q, addr, p - addr);	/* Make complete hypertext reference */
     } else {
 	q = NULL;
-	HTSprintf0(&q, "%s%.*s", NewsHREF, p-addr, addr);
+	HTSprintf0(&q, "%s%.*s", NewsHREF, p - addr, addr);
     }
 
     start_anchor(q);
@@ -733,103 +741,99 @@ static void write_anchor (const char * text, const char * addr)
 }
 
 /*	Write list of anchors
-**	---------------------
-**
-**	We take a pointer to a list of objects, and write out each,
-**	generating an anchor for each.
-**
-** On entry,
-**	HT	has a selection of zero length at the end.
-**	text	points to a comma or space separated list of addresses.
-** On exit,
-**	*text	is NOT any more chopped up into substrings.
-*/
-static void write_anchors (char * text)
+ *	---------------------
+ *
+ *	We take a pointer to a list of objects, and write out each,
+ *	generating an anchor for each.
+ *
+ * On entry,
+ *	HT	has a selection of zero length at the end.
+ *	text	points to a comma or space separated list of addresses.
+ * On exit,
+ *	*text	is NOT any more chopped up into substrings.
+ */
+static void write_anchors(char *text)
 {
-    char * start = text;
-    char * end;
+    char *start = text;
+    char *end;
     char c;
+
     for (;;) {
-	for (; *start && (WHITE(*start)); start++)
-	    ;  /* Find start */
+	for (; *start && (WHITE(*start)); start++) ;	/* Find start */
 	if (!*start)
-	    return;			/* (Done) */
+	    return;		/* (Done) */
 	for (end = start;
-	     *end && (*end != ' ') && (*end != ','); end++)
-	    ;/* Find end */
+	     *end && (*end != ' ') && (*end != ','); end++) ;	/* Find end */
 	if (*end)
-	    end++;	/* Include comma or space but not NULL */
+	    end++;		/* Include comma or space but not NULL */
 	c = *end;
 	*end = '\0';
 	if (*start == '<')
-	    write_anchor(start, start+1);
+	    write_anchor(start, start + 1);
 	else
 	    write_anchor(start, start);
 	START(HTML_BR);
 	*end = c;
-	start = end;			/* Point to next one */
+	start = end;		/* Point to next one */
     }
 }
 
 /*	Abort the connection					abort_socket
-**	--------------------
-*/
-static void abort_socket (void)
+ *	--------------------
+ */
+static void abort_socket(void)
 {
     CTRACE((tfp, "HTNews: EOF on read, closing socket %d\n", s));
-    NEWS_NETCLOSE(s);	/* End of file, close socket */
+    NEWS_NETCLOSE(s);		/* End of file, close socket */
     if (rawtext) {
 	RAW_PUTS("Network Error: connection lost\n");
     } else {
 	PUTS("Network Error: connection lost");
 	PUTC('\n');
     }
-    s = -1;		/* End of file on response */
+    s = -1;			/* End of file on response */
 }
 
 /*
-**  Determine if a line is a valid header line.			valid_header
-**  -------------------------------------------
-*/
-static BOOLEAN valid_header (
-	char *		line)
+ *  Determine if a line is a valid header line.			valid_header
+ *  -------------------------------------------
+ */
+static BOOLEAN valid_header(char *line)
 {
     char *colon, *space;
 
     /*
-    **	Blank or tab in first position implies
-    **	this is a continuation header.
-    */
+     * Blank or tab in first position implies this is a continuation header.
+     */
     if (line[0] == ' ' || line[0] == '\t')
-	return(TRUE);
+	return (TRUE);
 
     /*
-    **	Just check for initial letter, colon, and space to make
-    **	sure we discard only invalid headers.
-    */
+     * Just check for initial letter, colon, and space to make sure we discard
+     * only invalid headers.
+     */
     colon = strchr(line, ':');
     space = strchr(line, ' ');
     if (isalpha(UCH(line[0])) && colon && space == colon + 1)
-	return(TRUE);
+	return (TRUE);
 
     /*
-    **	Anything else is a bad header -- it should be ignored.
-    */
-    return(FALSE);
+     * Anything else is a bad header -- it should be ignored.
+     */
+    return (FALSE);
 }
 
 /*	post in an Article					post_article
-**	------------------
-**			(added by FM, modeled on Lynx's previous mini inews)
-**
-**	Note the termination condition of a single dot on a line by itself.
-**
-**  On entry,
-**	s		Global socket number is OK
-**	postfile	file with header and article to post.
-*/
-static void post_article (
-	char *		postfile)
+ *	------------------
+ *			(added by FM, modeled on Lynx's previous mini inews)
+ *
+ *	Note the termination condition of a single dot on a line by itself.
+ *
+ *  On entry,
+ *	s		Global socket number is OK
+ *	postfile	file with header and article to post.
+ */
+static void post_article(char *postfile)
 {
     char line[512];
     char buf[512];
@@ -840,38 +844,31 @@ static void post_article (
     int in_header = 1, seen_header = 0, seen_fromline = 0;
     int blen = 0, llen = 0;
 
-
     /*
-    **	Open the temporary file with the
-    **	nntp headers and message body. - FM
-    */
+     * Open the temporary file with the nntp headers and message body.  - FM
+     */
     if ((fd = fopen(NonNull(postfile), TXT_R)) == NULL) {
 	HTAlert(FAILED_CANNOT_OPEN_POST);
 	return;
     }
 
     /*
-    **	Read the temporary file and post
-    **	in maximum 512 byte chunks. - FM
-    */
+     * Read the temporary file and post in maximum 512 byte chunks.  - FM
+     */
     buf[0] = '\0';
     sprintf(crlf, "%c%c", CR, LF);
-    while (fgets(line, sizeof(line)-2, fd) != NULL) {
+    while (fgets(line, sizeof(line) - 2, fd) != NULL) {
 	if ((cp = strchr(line, '\n')) != NULL)
 	    *cp = '\0';
 	if (line[0] == '.') {
 	    /*
-	    **	A single '.' means end of transmission
-	    **	for nntp.  Lead dots on lines normally
-	    **	are trimmed and the EOF is not registered
-	    **	if the dot was not followed by CRLF.
-	    **	We prepend an extra dot for any line
-	    **	beginning with one, to retain the one
-	    **	intended, as well as avoid a false EOF
-	    **	signal.  We know we have room for it in
-	    **	the buffer, because we normally send when
-	    **	it would exceed 510. - FM
-	    */
+	     * A single '.' means end of transmission for nntp.  Lead dots on
+	     * lines normally are trimmed and the EOF is not registered if the
+	     * dot was not followed by CRLF.  We prepend an extra dot for any
+	     * line beginning with one, to retain the one intended, as well as
+	     * avoid a false EOF signal.  We know we have room for it in the
+	     * buffer, because we normally send when it would exceed 510.  - FM
+	     */
 	    strcat(buf, ".");
 	    blen++;
 	}
@@ -892,7 +889,7 @@ static void post_article (
 		    strcat(buf, crlf);
 		    blen += 34;
 		}
-	     } else {
+	    } else {
 		continue;
 	    }
 	} else if (in_header) {
@@ -904,7 +901,7 @@ static void post_article (
 	}
 	strcat(line, crlf);
 	llen += 2;
-	if ((blen + llen) >= (int) sizeof(buf)-1) {
+	if ((blen + llen) >= (int) sizeof(buf) - 1) {
 	    NEWS_NETWRITE(s, buf, blen);
 	    buf[blen = 0] = 0;
 	}
@@ -915,9 +912,9 @@ static void post_article (
     HTSYS_remove(postfile);
 
     /*
-    **	Send the nntp EOF and get the server's response. - FM
-    */
-    if (blen >= (int) sizeof(buf)-4) {
+     * Send the nntp EOF and get the server's response.  - FM
+     */
+    if (blen >= (int) sizeof(buf) - 4) {
 	NEWS_NETWRITE(s, buf, blen);
 	buf[blen = 0] = 0;
     }
@@ -929,18 +926,18 @@ static void post_article (
     status = response(NULL);
     if (status == 240) {
 	/*
-	**  Successful post. - FM
-	*/
+	 * Successful post.  - FM
+	 */
 	HTProgress(response_text);
     } else {
 	/*
-	**  Shucks, something went wrong. - FM
-	*/
+	 * Shucks, something went wrong.  - FM
+	 */
 	HTAlert(response_text);
     }
 }
 
-#ifdef SH_EX	/* for MIME */
+#ifdef SH_EX			/* for MIME */
 #ifdef NEWS_DEBUG
 /* for DEBUG 1997/11/07 (Fri) 17:20:16 */
 void debug_print(unsigned char *p)
@@ -949,14 +946,14 @@ void debug_print(unsigned char *p)
 	if (*p == '\0')
 	    break;
 	if (*p == 0x1b)
-	   printf("[ESC]");
+	    printf("[ESC]");
 	else if (*p == '\n')
-	   printf("[NL]");
+	    printf("[NL]");
 	else if (*p < ' ' || *p >= 0x80)
-	   printf("(%02x)", *p);
+	    printf("(%02x)", *p);
 	else
-	   putchar(*p);
-       p++;
+	    putchar(*p);
+	p++;
     }
     printf("]\n");
 }
@@ -993,7 +990,7 @@ static char *decode_mime(char *str)
     return str;
 }
 #else /* !SH_EX */
-static char *decode_mime (char *  str)
+static char *decode_mime(char *str)
 {
     HTmmdecode(str, str);
     HTrjis(str, str);
@@ -1001,31 +998,29 @@ static char *decode_mime (char *  str)
 }
 #endif
 
-
 /*	Read in an Article					read_article
-**	------------------
-**
-**	Note the termination condition of a single dot on a line by itself.
-**	RFC 977 specifies that the line "folding" of RFC850 is not used, so we
-**	do not handle it here.
-**
-** On entry,
-**	s	Global socket number is OK
-**	HT	Global hypertext object is ready for appending text
-*/
-static int read_article (
-	HTParentAnchor *	thisanchor)
+ *	------------------
+ *
+ *	Note the termination condition of a single dot on a line by itself.
+ *	RFC 977 specifies that the line "folding" of RFC850 is not used, so we
+ *	do not handle it here.
+ *
+ * On entry,
+ *	s	Global socket number is OK
+ *	HT	Global hypertext object is ready for appending text
+ */
+static int read_article(HTParentAnchor *thisanchor)
 {
-    char line[LINE_LENGTH+1];
+    char line[LINE_LENGTH + 1];
     char *full_line = NULL;
-    char *subject = NULL;			/* Subject string	    */
-    char *from = NULL;				/* From string		    */
-    char *replyto = NULL;			/* Reply-to string	    */
-    char *date = NULL;				/* Date string		    */
-    char *organization = NULL;			/* Organization string	    */
-    char *references = NULL;			/* Hrefs for other articles */
-    char *newsgroups = NULL;			/* Newsgroups list	    */
-    char *followupto = NULL;			/* Followup list	    */
+    char *subject = NULL;	/* Subject string           */
+    char *from = NULL;		/* From string              */
+    char *replyto = NULL;	/* Reply-to string          */
+    char *date = NULL;		/* Date string              */
+    char *organization = NULL;	/* Organization string      */
+    char *references = NULL;	/* Hrefs for other articles */
+    char *newsgroups = NULL;	/* Newsgroups list          */
+    char *followupto = NULL;	/* Followup list            */
     char *href = NULL;
     char *p = line;
     char *cp;
@@ -1033,33 +1028,36 @@ static int read_article (
     BOOL done = NO;
 
     /*
-    **	Read in the HEADer of the article.
-    **
-    **	The header fields are either ignored,
-    **	or formatted and put into the text.
-    */
+     * Read in the HEADer of the article.
+     *
+     * The header fields are either ignored, or formatted and put into the
+     * text.
+     */
     if (!diagnostic && !rawtext) {
 	while (!done) {
 	    int ich = NEXT_CHAR;
+
 	    *p++ = (char) ich;
 	    if (ich == EOF) {
 		if (interrupted_in_htgetcharacter) {
 		    interrupted_in_htgetcharacter = 0;
-		    CTRACE((tfp, "HTNews: Interrupted on read, closing socket %d\n",
-				s));
+		    CTRACE((tfp,
+			    "HTNews: Interrupted on read, closing socket %d\n",
+			    s));
 		    NEWS_NETCLOSE(s);
 		    s = -1;
-		    return(HT_INTERRUPTED);
+		    return (HT_INTERRUPTED);
 		}
-		abort_socket();		/* End of file, close socket */
-		return(HT_LOADED);	/* End of file on response */
+		abort_socket();	/* End of file, close socket */
+		return (HT_LOADED);	/* End of file on response */
 	    }
-	    if (((char)ich == LF) || (p == &line[LINE_LENGTH])) {
-		*--p = '\0';			/* Terminate the string */
+	    if (((char) ich == LF) || (p == &line[LINE_LENGTH])) {
+		*--p = '\0';	/* Terminate the string */
 		CTRACE((tfp, "H %s\n", line));
 
 		if (line[0] == '\t' || line[0] == ' ') {
 		    int i = 0;
+
 		    while (line[i]) {
 			if (line[i] == '\t')
 			    line[i] = ' ';
@@ -1076,55 +1074,56 @@ static int read_article (
 
 		if (full_line[0] == '.') {
 		    /*
-		    **	End of article?
-		    */
+		     * End of article?
+		     */
 		    if (UCH(full_line[1]) < ' ') {
 			done = YES;
 			break;
 		    }
 		} else if (UCH(full_line[0]) < ' ') {
-		    break;		/* End of Header? */
+		    break;	/* End of Header? */
 
 		} else if (match(full_line, "SUBJECT:")) {
-		    StrAllocCopy(subject, HTStrip(strchr(full_line,':')+1));
+		    StrAllocCopy(subject, HTStrip(strchr(full_line, ':') + 1));
 		    decode_mime(subject);
 		} else if (match(full_line, "DATE:")) {
-		    StrAllocCopy(date, HTStrip(strchr(full_line,':')+1));
+		    StrAllocCopy(date, HTStrip(strchr(full_line, ':') + 1));
 
 		} else if (match(full_line, "ORGANIZATION:")) {
 		    StrAllocCopy(organization,
-				 HTStrip(strchr(full_line,':')+1));
+				 HTStrip(strchr(full_line, ':') + 1));
 		    decode_mime(organization);
 
 		} else if (match(full_line, "FROM:")) {
-		    StrAllocCopy(from, HTStrip(strchr(full_line,':')+1));
+		    StrAllocCopy(from, HTStrip(strchr(full_line, ':') + 1));
 		    decode_mime(from);
 
 		} else if (match(full_line, "REPLY-TO:")) {
-		    StrAllocCopy(replyto, HTStrip(strchr(full_line,':')+1));
+		    StrAllocCopy(replyto, HTStrip(strchr(full_line, ':') + 1));
 		    decode_mime(replyto);
 
 		} else if (match(full_line, "NEWSGROUPS:")) {
-		    StrAllocCopy(newsgroups, HTStrip(strchr(full_line,':')+1));
+		    StrAllocCopy(newsgroups, HTStrip(strchr(full_line, ':') + 1));
 
 		} else if (match(full_line, "REFERENCES:")) {
-		    StrAllocCopy(references, HTStrip(strchr(full_line,':')+1));
+		    StrAllocCopy(references, HTStrip(strchr(full_line, ':') + 1));
 
 		} else if (match(full_line, "FOLLOWUP-TO:")) {
-		    StrAllocCopy(followupto, HTStrip(strchr(full_line,':')+1));
+		    StrAllocCopy(followupto, HTStrip(strchr(full_line, ':') + 1));
 
 		} else if (match(full_line, "MESSAGE-ID:")) {
-		    char * msgid = HTStrip(full_line+11);
-		    if (msgid[0] == '<' && msgid[strlen(msgid)-1] == '>') {
-			msgid[strlen(msgid)-1] = '\0';	/* Chop > */
-			msgid++;			/* Chop < */
+		    char *msgid = HTStrip(full_line + 11);
+
+		    if (msgid[0] == '<' && msgid[strlen(msgid) - 1] == '>') {
+			msgid[strlen(msgid) - 1] = '\0';	/* Chop > */
+			msgid++;	/* Chop < */
 			HTAnchor_setMessageID(thisanchor, msgid);
 		    }
 
-		} /* end if match */
-		p = line;			/* Restart at beginning */
-	    } /* if end of line */
-	} /* Loop over characters */
+		}		/* end if match */
+		p = line;	/* Restart at beginning */
+	    }			/* if end of line */
+	}			/* Loop over characters */
 	FREE(full_line);
 
 	START(HTML_HEAD);
@@ -1137,10 +1136,11 @@ static int read_article (
 	END(HTML_TITLE);
 	PUTC('\n');
 	/*
-	**  Put in the owner as a link rel.
-	*/
+	 * Put in the owner as a link rel.
+	 */
 	if (from || replyto) {
 	    char *temp = NULL;
+
 	    StrAllocCopy(temp, author_address(replyto ? replyto : from));
 	    StrAllocCopy(href, STR_MAILTO_URL);
 	    if (strchr(temp, '%') || strchr(temp, '?')) {
@@ -1262,9 +1262,9 @@ static int read_article (
 
 	if (followupto && !strcasecomp(followupto, "poster")) {
 	    /*
-	    **	"Followup-To: poster" has special meaning.
-	    **  Don't use it to construct a newsreply link. -kw
-	    */
+	     * "Followup-To:  poster" has special meaning.  Don't use it to
+	     * construct a newsreply link.  -kw
+	     */
 	    START(HTML_DT);
 	    START(HTML_B);
 	    PUTS("Followup to:");
@@ -1284,14 +1284,13 @@ static int read_article (
 
 	if (newsgroups && HTCanPost) {
 	    /*
-	    **	We have permission to POST to this host,
-	    **	so add a link for posting followups for
-	    **	this article. - FM
-	    */
+	     * We have permission to POST to this host, so add a link for
+	     * posting followups for this article.  - FM
+	     */
 	    if (!strncasecomp(NewsHREF, STR_SNEWS_URL, 6))
-		StrAllocCopy(href,"snewsreply://");
+		StrAllocCopy(href, "snewsreply://");
 	    else
-		StrAllocCopy(href,"newsreply://");
+		StrAllocCopy(href, "newsreply://");
 	    StrAllocCat(href, NewsHost);
 	    StrAllocCat(href, "/");
 	    StrAllocCat(href, (followupto ? followupto : newsgroups));
@@ -1303,6 +1302,7 @@ static int read_article (
 		    strchr(ccp, '/') || strchr(ccp, '%') ||
 		    strchr(ccp, ';')) {
 		    char *cp1 = HTEscape(ccp, URL_XPALPHAS);
+
 		    StrAllocCat(href, cp1);
 		    FREE(cp1);
 		} else {
@@ -1349,21 +1349,20 @@ static int read_article (
 
     if (rawtext) {
 	/*
-	 *  No tags, and never do a PUTC. - kw
+	 * No tags, and never do a PUTC.  - kw
 	 */
 	;
     } else if (diagnostic) {
 	/*
-	**  Read in the HEAD and BODY of the Article
-	**  as XMP formatted text. - FM
-	*/
+	 * Read in the HEAD and BODY of the Article as XMP formatted text.  -
+	 * FM
+	 */
 	START(HTML_XMP);
 	PUTC('\n');
     } else {
 	/*
-	**  Read in the BODY of the Article
-	**  as PRE formatted text. - FM
-	*/
+	 * Read in the BODY of the Article as PRE formatted text.  - FM
+	 */
 	START(HTML_PRE);
 	PUTC('\n');
     }
@@ -1371,37 +1370,39 @@ static int read_article (
     p = line;
     while (!done) {
 	int ich = NEXT_CHAR;
+
 	*p++ = (char) ich;
 	if (ich == EOF) {
 	    if (interrupted_in_htgetcharacter) {
 		interrupted_in_htgetcharacter = 0;
-		CTRACE((tfp, "HTNews: Interrupted on read, closing socket %d\n",
-			    s));
+		CTRACE((tfp,
+			"HTNews: Interrupted on read, closing socket %d\n",
+			s));
 		NEWS_NETCLOSE(s);
 		s = -1;
-		return(HT_INTERRUPTED);
+		return (HT_INTERRUPTED);
 	    }
 	    abort_socket();	/* End of file, close socket */
-	    return(HT_LOADED);	/* End of file on response */
+	    return (HT_LOADED);	/* End of file on response */
 	}
-	if (((char)ich == LF) || (p == &line[LINE_LENGTH])) {
-	    *p++ = '\0';			/* Terminate the string */
+	if (((char) ich == LF) || (p == &line[LINE_LENGTH])) {
+	    *p++ = '\0';	/* Terminate the string */
 	    CTRACE((tfp, "B %s", line));
-#ifdef NEWS_DEBUG	/* 1997/11/09 (Sun) 15:56:11 */
+#ifdef NEWS_DEBUG		/* 1997/11/09 (Sun) 15:56:11 */
 	    debug_print(line);	/* @@@ */
 #endif
 	    if (line[0] == '.') {
 		/*
-		**  End of article?
-		*/
+		 * End of article?
+		 */
 		if (UCH(line[1]) < ' ') {
 		    done = YES;
 		    break;
-		} else {			/* Line starts with dot */
+		} else {	/* Line starts with dot */
 		    if (rawtext) {
 			RAW_PUTS(&line[1]);
 		    } else {
-			PUTS(&line[1]); /* Ignore first dot */
+			PUTS(&line[1]);		/* Ignore first dot */
 		    }
 		}
 	    } else {
@@ -1409,31 +1410,32 @@ static int read_article (
 		    RAW_PUTS(line);
 		} else if (diagnostic || !scan_for_buried_news_references) {
 		    /*
-		    **	All lines are passed as unmodified source. - FM
-		    */
+		     * All lines are passed as unmodified source.  - FM
+		     */
 		    PUTS(line);
 		} else {
 		    /*
-		    **	Normal lines are scanned for buried references
-		    **	to other articles.  Unfortunately, it could pick
-		    **	up mail addresses as well!  It also can corrupt
-		    **	uuencoded messages!  So we don't do this when
-		    **	fetching articles as WWW_SOURCE or when downloading
-		    **	(diagnostic is TRUE) or if the client has set
-		    **	scan_for_buried_news_references to FALSE.
-		    **	Otherwise, we convert all "<...@...>" strings
-		    **	preceded by "rticle " to "news:...@..." links,
-		    **	and any strings that look like URLs to links. - FM
-		    */
+		     * Normal lines are scanned for buried references to other
+		     * articles.  Unfortunately, it could pick up mail
+		     * addresses as well!  It also can corrupt uuencoded
+		     * messages!  So we don't do this when fetching articles as
+		     * WWW_SOURCE or when downloading (diagnostic is TRUE) or
+		     * if the client has set scan_for_buried_news_references to
+		     * FALSE.  Otherwise, we convert all "<...@...>" strings
+		     * preceded by "rticle " to "news:...@..." links, and any
+		     * strings that look like URLs to links.  - FM
+		     */
 		    char *l = line;
 		    char *p2;
 
 		    while ((p2 = strstr(l, "rticle <")) != NULL) {
-			char *q  = strrchr(p2,'>');
+			char *q = strrchr(p2, '>');
 			char *at = strrchr(p2, '@');
-			if (q && at && at<q) {
+
+			if (q && at && at < q) {
 			    char c = q[1];
-			    q[1] = 0;		/* chop up */
+
+			    q[1] = 0;	/* chop up */
 			    p2 += 7;
 			    *p2 = 0;
 			    while (*l) {
@@ -1453,7 +1455,7 @@ static int read_article (
 				    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
 				    strncmp(l, "cso://", 6) &&
 				    strncmp(l, "gopher://", 9)) {
-				    PUTC (*l++);
+				    PUTC(*l++);
 				} else {
 				    StrAllocCopy(href, l);
 				    start_anchor(strtok(href, " \r\n\t,>)\""));
@@ -1463,19 +1465,19 @@ static int read_article (
 				    FREE(href);
 				}
 			    }
-			    *p2 = '<';		/* again */
+			    *p2 = '<';	/* again */
 			    *q = 0;
-			    start_anchor(p2+1);
-			    *q = '>';		/* again */
+			    start_anchor(p2 + 1);
+			    *q = '>';	/* again */
 			    PUTS(p2);
 			    END(HTML_A);
-			    q[1] = c;		/* again */
+			    q[1] = c;	/* again */
 			    l = q + 1;
 			} else {
-			    break;		/* line has unmatched <> */
+			    break;	/* line has unmatched <> */
 			}
 		    }
-		    while (*l) {		/* Last bit of the line */
+		    while (*l) {	/* Last bit of the line */
 			if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
 			    strncmp(l, "snews://", 8) &&
 			    strncmp(l, "nntp://", 7) &&
@@ -1492,7 +1494,7 @@ static int read_article (
 			    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
 			    strncmp(l, "cso://", 6) &&
 			    strncmp(l, "gopher://", 9))
-			    PUTC (*l++);
+			    PUTC(*l++);
 			else {
 			    StrAllocCopy(href, l);
 			    start_anchor(strtok(href, " \r\n\t,>)\""));
@@ -1502,33 +1504,33 @@ static int read_article (
 			    FREE(href);
 			}
 		    }
-		} /* if diagnostic or not scan_for_buried_news_references */
-	    } /* if not dot */
-	    p = line;				/* Restart at beginning */
-	} /* if end of line */
-    } /* Loop over characters */
+		}		/* if diagnostic or not scan_for_buried_news_references */
+	    }			/* if not dot */
+	    p = line;		/* Restart at beginning */
+	}			/* if end of line */
+    }				/* Loop over characters */
 
     if (rawtext)
-	return(HT_LOADED);
+	return (HT_LOADED);
 
     if (diagnostic)
 	END(HTML_XMP);
     else
 	END(HTML_PRE);
     PUTC('\n');
-    return(HT_LOADED);
+    return (HT_LOADED);
 }
 
 /*	Read in a List of Newsgroups
-**	----------------------------
-**
-**  Note the termination condition of a single dot on a line by itself.
-**  RFC 977 specifies that the line "folding" of RFC850 is not used,
-**  so we do not handle it here.
-*/
-static int read_list (char *  arg)
+ *	----------------------------
+ *
+ *  Note the termination condition of a single dot on a line by itself.
+ *  RFC 977 specifies that the line "folding" of RFC850 is not used,
+ *  so we do not handle it here.
+ */
+static int read_list(char *arg)
 {
-    char line[LINE_LENGTH+1];
+    char line[LINE_LENGTH + 1];
     char *p;
     BOOL done = NO;
     BOOL head = NO;
@@ -1540,29 +1542,28 @@ static int read_list (char *  arg)
     int len = 0;
 
     /*
-    **	Support head or tail matches for groups to list. - FM
-    */
+     * Support head or tail matches for groups to list.  - FM
+     */
     if (arg && strlen(arg) > 1) {
 	if (*arg == '*') {
 	    tail = YES;
-	    StrAllocCopy(pattern, (arg+1));
-	} else if (arg[strlen(arg)-1] == '*') {
+	    StrAllocCopy(pattern, (arg + 1));
+	} else if (arg[strlen(arg) - 1] == '*') {
 	    head = YES;
 	    StrAllocCopy(pattern, arg);
-	    pattern[strlen(pattern)-1] = '\0';
+	    pattern[strlen(pattern) - 1] = '\0';
 	}
 	if (tail || head) {
-	   len = strlen(pattern);
+	    len = strlen(pattern);
 	}
 
     }
 
     /*
-    **	Read the server's reply.
-    **
-    **	The lines are scanned for newsgroup
-    **	names and descriptions.
-    */
+     * Read the server's reply.
+     *
+     * The lines are scanned for newsgroup names and descriptions.
+     */
     START(HTML_HEAD);
     PUTC('\n');
     START(HTML_TITLE);
@@ -1572,7 +1573,7 @@ static int read_list (char *  arg)
     END(HTML_HEAD);
     PUTC('\n');
     START(HTML_H1);
-    PUTS( "Newsgroups");
+    PUTS("Newsgroups");
     END(HTML_H1);
     PUTC('\n');
     p = line;
@@ -1581,18 +1582,20 @@ static int read_list (char *  arg)
     while (!done) {
 	int ich = NEXT_CHAR;
 	char ch = (char) ich;
+
 	if (ich == EOF) {
 	    if (interrupted_in_htgetcharacter) {
 		interrupted_in_htgetcharacter = 0;
-		CTRACE((tfp, "HTNews: Interrupted on read, closing socket %d\n",
-			    s));
+		CTRACE((tfp,
+			"HTNews: Interrupted on read, closing socket %d\n",
+			s));
 		NEWS_NETCLOSE(s);
 		s = -1;
-		return(HT_INTERRUPTED);
+		return (HT_INTERRUPTED);
 	    }
 	    abort_socket();	/* End of file, close socket */
 	    FREE(pattern);
-	    return(HT_LOADED);	/* End of file on response */
+	    return (HT_LOADED);	/* End of file on response */
 	} else if (skip_this_line) {
 	    if (ch == LF) {
 		skip_this_line = skip_rest_of_line = NO;
@@ -1610,47 +1613,46 @@ static int read_list (char *  arg)
 		;		/* Will be dealt with below */
 	    } else if (WHITE(ch)) {
 		ch = LF;	/* May treat as line without description */
-		skip_this_line = YES; /* ...and ignore until LF */
+		skip_this_line = YES;	/* ...and ignore until LF */
 	    } else if (strchr(line, ' ') == NULL &&
 		       strchr(line, '\t') == NULL) {
 		/* No separator found */
 		CTRACE((tfp, "HTNews..... group name too long, discarding.\n"));
-		skip_this_line = YES; /* ignore whole line */
+		skip_this_line = YES;	/* ignore whole line */
 		continue;
 	    } else {
-		skip_rest_of_line = YES; /* skip until ch == LF found */
+		skip_rest_of_line = YES;	/* skip until ch == LF found */
 	    }
 	} else {
 	    *p++ = ch;
 	}
 	if (ch == LF) {
 	    skip_rest_of_line = NO;	/* done, reset flag */
-	    *p = '\0';			/* Terminate the string */
+	    *p = '\0';		/* Terminate the string */
 	    CTRACE((tfp, "B %s", line));
 	    if (line[0] == '.') {
 		/*
-		**  End of article?
-		*/
+		 * End of article?
+		 */
 		if (UCH(line[1]) < ' ') {
 		    done = YES;
 		    break;
-		} else {			/* Line starts with dot */
+		} else {	/* Line starts with dot */
 		    START(HTML_DT);
 		    PUTS(&line[1]);
 		    MAYBE_END(HTML_DT);
 		}
 	    } else if (line[0] == '#') {	/* Comment? */
-		p = line;			/* Restart at beginning */
+		p = line;	/* Restart at beginning */
 		continue;
 	    } else {
 		/*
-		**  Normal lines are scanned for references to newsgroups.
-		*/
+		 * Normal lines are scanned for references to newsgroups.
+		 */
 		int i = 0;
 
 		/* find whitespace if it exits */
-		for (; line[i] != '\0' && !WHITE(line[i]); i++)
-		    ;  /* null body */
+		for (; line[i] != '\0' && !WHITE(line[i]); i++) ;	/* null body */
 
 		if (line[i] != '\0') {
 		    line[i] = '\0';
@@ -1666,7 +1668,7 @@ static int read_list (char *  arg)
 		    MAYBE_END(HTML_DT);
 		    PUTC('\n');
 		    START(HTML_DD);
-		    PUTS(&line[i+1]); /* put description */
+		    PUTS(&line[i + 1]);		/* put description */
 		    MAYBE_END(HTML_DD);
 		} else {
 		    if ((head && strncasecomp(line, pattern, len)) ||
@@ -1680,12 +1682,13 @@ static int read_list (char *  arg)
 		    MAYBE_END(HTML_DT);
 		    listing++;
 		}
-	    } /* if not dot */
-	    p = line;			/* Restart at beginning */
-	} /* if end of line */
-    } /* Loop over characters */
+	    }			/* if not dot */
+	    p = line;		/* Restart at beginning */
+	}			/* if end of line */
+    }				/* Loop over characters */
     if (!listing) {
 	char *msg = NULL;
+
 	START(HTML_DT);
 	HTSprintf0(&msg, gettext("No matches for: %s"), arg);
 	PUTS(msg);
@@ -1695,35 +1698,35 @@ static int read_list (char *  arg)
     END(HTML_DLC);
     PUTC('\n');
     FREE(pattern);
-    return(HT_LOADED);
+    return (HT_LOADED);
 }
 
 /*	Read in a Newsgroup
-**	-------------------
-**
-**  Unfortunately, we have to ask for each article one by one if we
-**  want more than one field.
-**
-*/
-static int read_group (
-	const char *	groupName,
-	int		first_required,
-	int		last_required)
+ *	-------------------
+ *
+ *  Unfortunately, we have to ask for each article one by one if we
+ *  want more than one field.
+ *
+ */
+static int read_group(const char *groupName,
+		      int first_required,
+		      int last_required)
 {
-    char line[LINE_LENGTH+1];
-    char author[LINE_LENGTH+1];
-    char subject[LINE_LENGTH+1];
+    char line[LINE_LENGTH + 1];
+    char author[LINE_LENGTH + 1];
+    char subject[LINE_LENGTH + 1];
     char *date = NULL;
     int i;
     char *p;
     BOOL done;
 
-    char buffer[LINE_LENGTH+1];
+    char buffer[LINE_LENGTH + 1];
     char *temp = NULL;
-    char *reference = NULL;		/* Href for article */
-    int art;				/* Article number WITHIN GROUP */
+    char *reference = NULL;	/* Href for article */
+    int art;			/* Article number WITHIN GROUP */
     int status, count, first, last;	/* Response fields */
-					/* count is only an upper limit */
+
+    /* count is only an upper limit */
 
     author[0] = '\0';
     START(HTML_HEAD);
@@ -1738,17 +1741,16 @@ static int read_group (
 
     sscanf(response_text, " %d %d %d %d", &status, &count, &first, &last);
     CTRACE((tfp, "Newsgroup status=%d, count=%d, (%d-%d) required:(%d-%d)\n",
-		status, count, first, last, first_required, last_required));
+	    status, count, first, last, first_required, last_required));
     if (last == 0) {
 	PUTS(gettext("\nNo articles in this group.\n"));
 	goto add_post;
     }
-
 #define FAST_THRESHOLD 100	/* Above this, read IDs fast */
 #define CHOP_THRESHOLD 50	/* Above this, chop off the rest */
 
     if (first_required < first)
-	first_required = first;		/* clip */
+	first_required = first;	/* clip */
     if ((last_required == 0) || (last_required > last))
 	last_required = last;
 
@@ -1757,17 +1759,17 @@ static int read_group (
 	goto add_post;
     }
 
-    if (last_required-first_required+1 > HTNewsMaxChunk) { /* Trim this block */
-	first_required = last_required-HTNewsChunkSize+1;
+    if (last_required - first_required + 1 > HTNewsMaxChunk) {	/* Trim this block */
+	first_required = last_required - HTNewsChunkSize + 1;
     }
     CTRACE((tfp, "    Chunk will be (%d-%d)\n",
-		first_required, last_required));
+	    first_required, last_required));
 
     /*
-    **	Set window title.
-    */
+     * Set window title.
+     */
     HTSprintf0(&temp, gettext("%s,  Articles %d-%d"),
-		    groupName, first_required, last_required);
+	       groupName, first_required, last_required);
     START(HTML_H1);
     PUTS(temp);
     FREE(temp);
@@ -1775,16 +1777,17 @@ static int read_group (
     PUTC('\n');
 
     /*
-    **	Link to earlier articles.
-    */
+     * Link to earlier articles.
+     */
     if (first_required > first) {
-	int before;			/* Start of one before */
-	if (first_required-HTNewsMaxChunk <= first)
+	int before;		/* Start of one before */
+
+	if (first_required - HTNewsMaxChunk <= first)
 	    before = first;
 	else
-	    before = first_required-HTNewsChunkSize;
+	    before = first_required - HTNewsChunkSize;
 	HTSprintf0(&dbuf, "%s%s/%d-%d", NewsHREF, groupName,
-				      before, first_required-1);
+		   before, first_required - 1);
 	CTRACE((tfp, "    Block before is %s\n", dbuf));
 	PUTC('(');
 	start_anchor(dbuf);
@@ -1799,10 +1802,10 @@ static int read_group (
 
 /*#define USE_XHDR*/
 #ifdef USE_XHDR
-    if (count > FAST_THRESHOLD)  {
+    if (count > FAST_THRESHOLD) {
 	HTSprintf0(&temp,
- gettext("\nThere are about %d articles currently available in %s, IDs as follows:\n\n"),
-		count, groupName);
+		   gettext("\nThere are about %d articles currently available in %s, IDs as follows:\n\n"),
+		   count, groupName);
 	PUTS(temp);
 	FREE(temp);
 	sprintf(buffer, "XHDR Message-ID %d-%d%c%c", first, last, CR, LF);
@@ -1811,53 +1814,55 @@ static int read_group (
 	    p = line;
 	    while (!done) {
 		int ich = NEXT_CHAR;
+
 		*p++ = ich;
 		if (ich == EOF) {
 		    if (interrupted_in_htgetcharacter) {
 			interrupted_in_htgetcharacter = 0;
-			CTRACE((tfp, "HTNews: Interrupted on read, closing socket %d\n",
-				    s));
+			CTRACE((tfp,
+				"HTNews: Interrupted on read, closing socket %d\n",
+				s));
 			NEWS_NETCLOSE(s);
 			s = -1;
-			return(HT_INTERRUPTED);
+			return (HT_INTERRUPTED);
 		    }
 		    abort_socket();	/* End of file, close socket */
-		    return(HT_LOADED);	/* End of file on response */
+		    return (HT_LOADED);		/* End of file on response */
 		}
-		if (((char)ich == '\n') || (p == &line[LINE_LENGTH])) {
-		    *p = '\0';		/* Terminate the string */
+		if (((char) ich == '\n') || (p == &line[LINE_LENGTH])) {
+		    *p = '\0';	/* Terminate the string */
 		    CTRACE((tfp, "X %s", line));
 		    if (line[0] == '.') {
 			/*
-			**  End of article?
-			*/
+			 * End of article?
+			 */
 			if (UCH(line[1]) < ' ') {
 			    done = YES;
 			    break;
-			} else {		/* Line starts with dot */
-				/* Ignore strange line */
+			} else {	/* Line starts with dot */
+			    /* Ignore strange line */
 			}
 		    } else {
 			/*
-			**  Normal lines are scanned for
-			**  references to articles.
-			*/
-			char * space = strchr(line, ' ');
+			 * Normal lines are scanned for references to articles.
+			 */
+			char *space = strchr(line, ' ');
+
 			if (space++)
 			    write_anchor(space, space);
-		    } /* if not dot */
-		    p = line;			/* Restart at beginning */
-		} /* if end of line */
-	    } /* Loop over characters */
+		    }		/* if not dot */
+		    p = line;	/* Restart at beginning */
+		}		/* if end of line */
+	    }			/* Loop over characters */
 
 	    /* leaving loop with "done" set */
-	} /* Good status */
+	}			/* Good status */
     }
 #endif /* USE_XHDR */
 
     /*
-    **	Read newsgroup using individual fields.
-    */
+     * Read newsgroup using individual fields.
+     */
     if (!done) {
 	START(HTML_B);
 	if (first == first_required && last == last_required)
@@ -1875,78 +1880,79 @@ static int read_group (
 /*#define OVERLAP*/
 #ifdef OVERLAP
 	    /*
-	    **	With this code we try to keep the server running flat out
-	    **	by queuing just one extra command ahead of time.
-	    **	We assume (1) that the server won't abort if it gets input
-	    **	during output, and (2) that TCP buffering is enough for the
-	    **	two commands.  Both these assumptions seem very reasonable.
-	    **	However, we HAVE had a hangup with a loaded server.
-	    */
+	     * With this code we try to keep the server running flat out by
+	     * queuing just one extra command ahead of time.  We assume (1)
+	     * that the server won't abort if it gets input during output, and
+	     * (2) that TCP buffering is enough for the two commands.  Both
+	     * these assumptions seem very reasonable.  However, we HAVE had a
+	     * hangup with a loaded server.
+	     */
 	    if (art == first_required) {
-		if (art == last_required) {		/* Only one */
+		if (art == last_required) {	/* Only one */
 		    sprintf(buffer, "HEAD %d%c%c",
-				    art, CR, LF);
+			    art, CR, LF);
 		    status = response(buffer);
-		} else {				/* First of many */
+		} else {	/* First of many */
 		    sprintf(buffer, "HEAD %d%c%cHEAD %d%c%c",
-				    art, CR, LF, art+1, CR, LF);
-			status = response(buffer);
+			    art, CR, LF, art + 1, CR, LF);
+		    status = response(buffer);
 		}
-	    } else if (art == last_required) {		/* Last of many */
+	    } else if (art == last_required) {	/* Last of many */
 		status = response(NULL);
-	    } else {					/* Middle of many */
-		sprintf(buffer, "HEAD %d%c%c", art+1, CR, LF);
+	    } else {		/* Middle of many */
+		sprintf(buffer, "HEAD %d%c%c", art + 1, CR, LF);
 		status = response(buffer);
 	    }
-#else	/* Not OVERLAP: */
+#else /* Not OVERLAP: */
 	    sprintf(buffer, "HEAD %d%c%c", art, CR, LF);
 	    status = response(buffer);
-#endif	/* OVERLAP */
+#endif /* OVERLAP */
 	    /*
-	    **	Check for a good response (221) for the HEAD request,
-	    **	and if so, parse it.  Otherwise, indicate the error
-	    **	so that the number of listings corresponds to what's
-	    **	claimed for the range, and if we are listing numbers
-	    **	via an ordered list, they stay in synchrony with the
-	    **	article numbers. - FM
-	    */
-	    if (status == 221) {	/* Head follows - parse it:*/
-		p = line;				/* Write pointer */
+	     * Check for a good response (221) for the HEAD request, and if so,
+	     * parse it.  Otherwise, indicate the error so that the number of
+	     * listings corresponds to what's claimed for the range, and if we
+	     * are listing numbers via an ordered list, they stay in synchrony
+	     * with the article numbers.  - FM
+	     */
+	    if (status == 221) {	/* Head follows - parse it: */
+		p = line;	/* Write pointer */
 		done = NO;
-		while( !done ) {
+		while (!done) {
 		    int ich = NEXT_CHAR;
+
 		    *p++ = (char) ich;
 		    if (ich == EOF) {
 			if (interrupted_in_htgetcharacter) {
 			    interrupted_in_htgetcharacter = 0;
-			    CTRACE((tfp, "HTNews: Interrupted on read, closing socket %d\n",
-					s));
+			    CTRACE((tfp,
+				    "HTNews: Interrupted on read, closing socket %d\n",
+				    s));
 			    NEWS_NETCLOSE(s);
 			    s = -1;
-			    return(HT_INTERRUPTED);
+			    return (HT_INTERRUPTED);
 			}
 			abort_socket();		/* End of file, close socket */
-			return(HT_LOADED);	/* End of file on response */
+			return (HT_LOADED);	/* End of file on response */
 		    }
-		    if (((char)ich == LF) ||
+		    if (((char) ich == LF) ||
 			(p == &line[LINE_LENGTH])) {
 
-			*--p = '\0';		/* Terminate  & chop LF*/
-			p = line;		/* Restart at beginning */
+			*--p = '\0';	/* Terminate  & chop LF */
+			p = line;	/* Restart at beginning */
 			CTRACE((tfp, "G %s\n", line));
-			switch(line[0]) {
+			switch (line[0]) {
 
 			case '.':
 			    /*
-			    **	End of article?
-			    */
+			     * End of article?
+			     */
 			    done = (BOOL) (UCH(line[1]) < ' ');
 			    break;
 
 			case 'S':
 			case 's':
 			    if (match(line, "SUBJECT:")) {
-				LYstrncpy(subject, line+9, sizeof(subject)-1);/* Save subject */
+				LYstrncpy(subject, line + 9, sizeof(subject) - 1);	/* Save subject */
 				decode_mime(subject);
 			    }
 			    break;
@@ -1954,8 +1960,9 @@ static int read_group (
 			case 'M':
 			case 'm':
 			    if (match(line, "MESSAGE-ID:")) {
-				char * addr = HTStrip(line+11) +1; /* Chop < */
-				addr[strlen(addr)-1] = '\0';	   /* Chop > */
+				char *addr = HTStrip(line + 11) + 1;	/* Chop < */
+
+				addr[strlen(addr) - 1] = '\0';	/* Chop > */
 				StrAllocCopy(reference, addr);
 			    }
 			    break;
@@ -1963,14 +1970,15 @@ static int read_group (
 			case 'f':
 			case 'F':
 			    if (match(line, "FROM:")) {
-				char * p2;
+				char *p2;
+
 				LYstrncpy(author,
-					author_name(strchr(line,':')+1),
-					sizeof(author)-1);
+					  author_name(strchr(line, ':') + 1),
+					  sizeof(author) - 1);
 				decode_mime(author);
 				p2 = author + strlen(author) - 1;
-				if (*p2==LF)
-				    *p2 = '\0'; /* Chop off newline */
+				if (*p2 == LF)
+				    *p2 = '\0';		/* Chop off newline */
 			    }
 			    break;
 
@@ -1978,17 +1986,17 @@ static int read_group (
 			case 'D':
 			    if (LYListNewsDates && match(line, "DATE:")) {
 				StrAllocCopy(date,
-					     HTStrip(strchr(line,':')+1));
+					     HTStrip(strchr(line, ':') + 1));
 			    }
 			    break;
 
-			} /* end switch on first character */
-		    } /* if end of line */
-		} /* Loop over characters */
+			}	/* end switch on first character */
+		    }		/* if end of line */
+		}		/* Loop over characters */
 
 		PUTC('\n');
 		START(HTML_LI);
-#ifdef SH_EX	/* for MIME */
+#ifdef SH_EX			/* for MIME */
 		HTSprintf0(&temp, "\"%s\"", decode_mime(subject));
 #else
 		HTSprintf0(&temp, "\"%s\"", subject);
@@ -2002,17 +2010,17 @@ static int read_group (
 		FREE(temp);
 
 		if (author[0] != '\0') {
-		     PUTS(" - ");
-		     if (LYListNewsDates)
-			 START(HTML_I);
-#ifdef SH_EX	/* for MIME */
-		     PUTS(decode_mime(author));
+		    PUTS(" - ");
+		    if (LYListNewsDates)
+			START(HTML_I);
+#ifdef SH_EX			/* for MIME */
+		    PUTS(decode_mime(author));
 #else
-		     PUTS(author);
+		    PUTS(author);
 #endif
-		     if (LYListNewsDates)
-			 END(HTML_I);
-		     author[0] = '\0';
+		    if (LYListNewsDates)
+			END(HTML_I);
+		    author[0] = '\0';
 		}
 		if (date) {
 		    if (!diagnostic) {
@@ -2022,25 +2030,26 @@ static int read_group (
 			    }
 			}
 		    }
-		    sprintf(buffer, " [%.*s]", (int)(sizeof(buffer) - 4), date);
+		    sprintf(buffer, " [%.*s]", (int) (sizeof(buffer) - 4), date);
 		    PUTS(buffer);
 		    FREE(date);
 		}
 		MAYBE_END(HTML_LI);
 		/*
-		**  Indicate progress!	 @@@@@@
-		*/
+		 * Indicate progress!  @@@@@@
+		 */
 	    } else if (status == HT_INTERRUPTED) {
 		interrupted_in_htgetcharacter = 0;
-		CTRACE((tfp, "HTNews: Interrupted on read, closing socket %d\n",
-			    s));
+		CTRACE((tfp,
+			"HTNews: Interrupted on read, closing socket %d\n",
+			s));
 		NEWS_NETCLOSE(s);
 		s = -1;
-		return(HT_INTERRUPTED);
+		return (HT_INTERRUPTED);
 	    } else {
 		/*
-		**  Use the response text on error. - FM
-		*/
+		 * Use the response text on error.  - FM
+		 */
 		PUTC('\n');
 		START(HTML_LI);
 		START(HTML_I);
@@ -2053,9 +2062,9 @@ static int read_group (
 		PUTC(' ');
 		PUTS(response_text);
 		MAYBE_END(HTML_LI);
-	    } /* Handle response to HEAD request */
-	} /* Loop over article */
-    } /* If read headers */
+	    }			/* Handle response to HEAD request */
+	}			/* Loop over article */
+    }				/* If read headers */
     PUTC('\n');
     if (LYListNewsNumbers)
 	END(HTML_OL);
@@ -2064,16 +2073,17 @@ static int read_group (
     PUTC('\n');
 
     /*
-    **	Link to later articles.
-    */
+     * Link to later articles.
+     */
     if (last_required < last) {
-	int after;			/* End of article after */
-	after = last_required+HTNewsChunkSize;
+	int after;		/* End of article after */
+
+	after = last_required + HTNewsChunkSize;
 	if (after == last)
-	    HTSprintf0(&dbuf, "%s%s", NewsHREF, groupName); /* original group */
+	    HTSprintf0(&dbuf, "%s%s", NewsHREF, groupName);	/* original group */
 	else
 	    HTSprintf0(&dbuf, "%s%s/%d-%d", NewsHREF, groupName,
-					  last_required+1, after);
+		       last_required + 1, after);
 	CTRACE((tfp, "    Block after is %s\n", dbuf));
 	PUTC('(');
 	start_anchor(dbuf);
@@ -2082,24 +2092,23 @@ static int read_group (
 	PUTS("...)\n");
     }
 
-add_post:
+  add_post:
     if (HTCanPost) {
 	/*
-	**  We have permission to POST to this host,
-	**  so add a link for posting messages to
-	**  this newsgroup. - FM
-	*/
+	 * We have permission to POST to this host, so add a link for posting
+	 * messages to this newsgroup.  - FM
+	 */
 	char *href = NULL;
 
 	START(HTML_HR);
 	PUTC('\n');
 	if (!strncasecomp(NewsHREF, STR_SNEWS_URL, 6))
-	    StrAllocCopy(href,"snewspost://");
+	    StrAllocCopy(href, "snewspost://");
 	else
-	    StrAllocCopy(href,"newspost://");
+	    StrAllocCopy(href, "newspost://");
 	StrAllocCat(href, NewsHost);
 	StrAllocCat(href, "/");
-	StrAllocCat(href,groupName);
+	StrAllocCat(href, groupName);
 	start_anchor(href);
 	PUTS(gettext("Post to "));
 	PUTS(groupName);
@@ -2109,23 +2118,22 @@ add_post:
 	START(HTML_HR);
     }
     PUTC('\n');
-    return(HT_LOADED);
+    return (HT_LOADED);
 }
 
 /*	Load by name.						HTLoadNews
-**	=============
-*/
-static int HTLoadNews (
-	const char *		arg,
-	HTParentAnchor *	anAnchor,
-	HTFormat		format_out,
-	HTStream*		stream)
+ *	=============
+ */
+static int HTLoadNews(const char *arg,
+		      HTParentAnchor *anAnchor,
+		      HTFormat format_out,
+		      HTStream *stream)
 {
-    char command[262];			/* The whole command */
-    char proxycmd[260];			/* The proxy command */
+    char command[262];		/* The whole command */
+    char proxycmd[260];		/* The proxy command */
     char groupName[GROUP_NAME_LENGTH];	/* Just the group name */
-    int status;				/* tcp return */
-    int retries;			/* A count of how hard we have tried */
+    int status;			/* tcp return */
+    int retries;		/* A count of how hard we have tried */
     BOOL normal_url;		/* Flag: "news:" or "nntp:" (physical) URL */
     BOOL group_wanted;		/* Flag: group was asked for, not article */
     BOOL list_wanted;		/* Flag: list was asked for, not article */
@@ -2140,6 +2148,7 @@ static int HTLoadNews (
     char *ProxyHost = NULL;
     char *ProxyHREF = NULL;
     char *postfile = NULL;
+
 #ifdef USE_SSL
     char SSLprogress[256];
 #endif /* USE_SSL */
@@ -2154,42 +2163,45 @@ static int HTLoadNews (
     if (!initialized)
 	initialized = initialize();
     if (!initialized)
-	return -1;	/* FAIL */
+	return -1;		/* FAIL */
 
     FREE(NewsHREF);
     command[0] = '\0';
-    command[sizeof(command)-1] = '\0';
+    command[sizeof(command) - 1] = '\0';
     proxycmd[0] = '\0';
-    proxycmd[sizeof(proxycmd)-1] = '\0';
+    proxycmd[sizeof(proxycmd) - 1] = '\0';
 
     {
-	const char * p1 = arg;
+	const char *p1 = arg;
 
 	/*
-	**  We will ask for the document, omitting the host name & anchor.
-	**
-	**  Syntax of address is
-	**	xxx@yyy			Article
-	**	<xxx@yyy>		Same article
-	**	xxxxx			News group (no "@")
-	**	group/n1-n2		Articles n1 to n2 in group
-	*/
-	normal_url = (BOOL) (!strncmp(arg, STR_NEWS_URL, LEN_NEWS_URL) || !strncmp(arg, "nntp:", 5));
+	 * We will ask for the document, omitting the host name & anchor.
+	 *
+	 * Syntax of address is
+	 * xxx@yyy                 Article
+	 * <xxx@yyy>               Same article
+	 * xxxxx                   News group (no "@")
+	 * group/n1-n2             Articles n1 to n2 in group
+	 */
+	normal_url = (BOOL) (!strncmp(arg, STR_NEWS_URL, LEN_NEWS_URL) ||
+			     !strncmp(arg, "nntp:", 5));
 	spost_wanted = (BOOL) (!normal_url && strstr(arg, "snewspost:") != NULL);
 	sreply_wanted = (BOOL) (!(normal_url || spost_wanted) &&
-			 strstr(arg, "snewsreply:") != NULL);
+				strstr(arg, "snewsreply:") != NULL);
 	post_wanted = (BOOL) (!(normal_url || spost_wanted || sreply_wanted) &&
-			strstr(arg, "newspost:") != NULL);
+			      strstr(arg, "newspost:") != NULL);
 	reply_wanted = (BOOL) (!(normal_url || spost_wanted || sreply_wanted ||
-			  post_wanted) &&
-			strstr(arg, "newsreply:") != NULL);
+				 post_wanted) &&
+			       strstr(arg, "newsreply:") != NULL);
 	group_wanted = (BOOL) ((!(spost_wanted || sreply_wanted ||
-			  post_wanted || reply_wanted) &&
-			strchr(arg, '@') == NULL) && (strchr(arg, '*') == NULL));
-	list_wanted  = (BOOL) ((!(spost_wanted || sreply_wanted ||
-			  post_wanted || reply_wanted ||
-			  group_wanted) &&
-			strchr(arg, '@') == NULL) && (strchr(arg, '*') != NULL));
+				  post_wanted || reply_wanted) &&
+				strchr(arg, '@') == NULL) &&
+			       (strchr(arg, '*') == NULL));
+	list_wanted = (BOOL) ((!(spost_wanted || sreply_wanted ||
+				 post_wanted || reply_wanted ||
+				 group_wanted) &&
+			       strchr(arg, '@') == NULL) &&
+			      (strchr(arg, '*') != NULL));
 
 #ifndef USE_SSL
 	if (!strncasecomp(arg, "snewspost:", 10) ||
@@ -2200,8 +2212,8 @@ static int HTLoadNews (
 #endif /* !USE_SSL */
 	if (post_wanted || reply_wanted || spost_wanted || sreply_wanted) {
 	    /*
-	    **	Make sure we have a non-zero path for the newsgroup(s). - FM
-	    */
+	     * Make sure we have a non-zero path for the newsgroup(s).  - FM
+	     */
 	    if ((p1 = strrchr(arg, '/')) != NULL) {
 		p1++;
 	    } else if ((p1 = strrchr(arg, ':')) != NULL) {
@@ -2209,7 +2221,7 @@ static int HTLoadNews (
 	    }
 	    if (!(p1 && *p1)) {
 		HTAlert(WWW_ILLEGAL_URL_MESSAGE);
-		return(HT_NO_DATA);
+		return (HT_NO_DATA);
 	    }
 	    if (!(cp = HTParse(arg, "", PARSE_HOST)) || *cp == '\0') {
 		if (s >= 0 && NewsHost && strcasecomp(NewsHost, HTNewsHost)) {
@@ -2226,30 +2238,31 @@ static int HTLoadNews (
 	    }
 	    FREE(cp);
 	    HTSprintf0(&NewsHREF, "%s://%.*s/",
-			     (post_wanted ?
-			       "newspost" :
-			    (reply_wanted ?
-			       "newreply" :
-			    (spost_wanted ?
-			      "snewspost" : "snewsreply"))),
-			    (int) sizeof(command) - 15, NewsHost);
+		       (post_wanted ?
+			"newspost" :
+			(reply_wanted ?
+			 "newreply" :
+			 (spost_wanted ?
+			  "snewspost" : "snewsreply"))),
+		       (int) sizeof(command) - 15, NewsHost);
 
 	    /*
-	    **	If the SSL daemon is being used as a proxy,
-	    **	reset p1 to the start of the proxied URL
-	    **	rather than to the start of the newsgroup(s). - FM
-	    */
+	     * If the SSL daemon is being used as a proxy, reset p1 to the
+	     * start of the proxied URL rather than to the start of the
+	     * newsgroup(s).  - FM
+	     */
 	    if (spost_wanted && strncasecomp(arg, "snewspost:", 10))
 		p1 = strstr(arg, "snewspost:");
 	    if (sreply_wanted && strncasecomp(arg, "snewsreply:", 11))
 		p1 = strstr(arg, "snewsreply:");
 
-	/* p1 = HTParse(arg, "", PARSE_PATH | PARSE_PUNCTUATION); */
-	/*
-	**  Don't use HTParse because news: access doesn't follow traditional
-	**  rules.  For instance, if the article reference contains a '#',
-	**  the rest of it is lost -- JFG 10/7/92, from a bug report
-	*/
+	    /* p1 = HTParse(arg, "", PARSE_PATH | PARSE_PUNCTUATION); */
+	    /*
+	     * Don't use HTParse because news:  access doesn't follow
+	     * traditional rules.  For instance, if the article reference
+	     * contains a '#', the rest of it is lost -- JFG 10/7/92, from a
+	     * bug report
+	     */
 	} else if (isNNTP_URL(arg)) {
 	    if (((*(arg + 5) == '\0') ||
 		 (!strcmp((arg + 5), "/") ||
@@ -2283,8 +2296,7 @@ static int HTLoadNews (
 	    FREE(cp);
 	    SnipIn2(command, "%s//%.*s/", STR_NNTP_URL, 9, NewsHost);
 	    StrAllocCopy(NewsHREF, command);
-	}
-	else if (!strncasecomp(arg, STR_SNEWS_URL, 6)) {
+	} else if (!strncasecomp(arg, STR_SNEWS_URL, 6)) {
 #ifdef USE_SSL
 	    if (((*(arg + 6) == '\0') ||
 		 (!strcmp((arg + 6), "/") ||
@@ -2322,8 +2334,7 @@ static int HTLoadNews (
 	    HTAlert(gettext("This client does not contain support for SNEWS URLs."));
 	    return HT_NOT_LOADED;
 #endif /* USE_SSL */
-	}
-	else if (!strncasecomp (arg, "news:/", 6)) {
+	} else if (!strncasecomp(arg, "news:/", 6)) {
 	    if (((*(arg + 6) == '\0') ||
 		 !strcmp((arg + 6), "/") ||
 		 !strcmp((arg + 6), "//")) ||
@@ -2354,7 +2365,7 @@ static int HTLoadNews (
 	    SnipIn(command, "news://%.*s/", 9, NewsHost);
 	    StrAllocCopy(NewsHREF, command);
 	} else {
-	    p1 = (arg + 5);  /* Skip "news:" prefix */
+	    p1 = (arg + 5);	/* Skip "news:" prefix */
 	    if (*p1 == '\0') {
 		p1 = "*";
 		group_wanted = FALSE;
@@ -2369,11 +2380,10 @@ static int HTLoadNews (
 	}
 
 	/*
-	**  Set up any proxy for snews URLs that returns NNTP
-	**  responses for Lynx to convert to HTML, instead of
-	**  doing the conversion itself, and for handling posts
-	**  or followups.  - TZ & FM
-	*/
+	 * Set up any proxy for snews URLs that returns NNTP responses for Lynx
+	 * to convert to HTML, instead of doing the conversion itself, and for
+	 * handling posts or followups.  - TZ & FM
+	 */
 	if (!strncasecomp(p1, STR_SNEWS_URL, 6) ||
 	    !strncasecomp(p1, "snewspost:", 10) ||
 	    !strncasecomp(p1, "snewsreply:", 11)) {
@@ -2384,20 +2394,20 @@ static int HTLoadNews (
 	    } else {
 		SnipIn2(command, "%s//%.*s", STR_SNEWS_URL, 10, NewsHost);
 	    }
-	    command[sizeof(command)-2] = '\0';
+	    command[sizeof(command) - 2] = '\0';
 	    FREE(cp);
 	    sprintf(proxycmd, "GET %.*s%c%c%c%c",
-		    (int) sizeof(proxycmd)-9, command,
+		    (int) sizeof(proxycmd) - 9, command,
 		    CR, LF, CR, LF);
 	    CTRACE((tfp, "HTNews: Proxy command is '%.*s'\n",
-			(int)(strlen(proxycmd) - 4), proxycmd));
+		    (int) (strlen(proxycmd) - 4), proxycmd));
 	    strcat(command, "/");
 	    StrAllocCopy(ProxyHREF, NewsHREF);
 	    StrAllocCopy(NewsHREF, command);
 	    if (spost_wanted || sreply_wanted) {
 		/*
-		**  Reset p1 so that it points to the newsgroup(s).
-		*/
+		 * Reset p1 so that it points to the newsgroup(s).
+		 */
 		if ((p1 = strrchr(arg, '/')) != NULL) {
 		    p1++;
 		} else {
@@ -2405,9 +2415,9 @@ static int HTLoadNews (
 		}
 	    } else {
 		/*
-		**  Reset p1 so that it points to the newsgroup
-		**  (or a wildcard), or the article.
-		*/
+		 * Reset p1 so that it points to the newsgroup (or a wildcard),
+		 * or the article.
+		 */
 		if (!(cp = strrchr((p1 + 6), '/')) || *(cp + 1) == '\0') {
 		    p1 = "*";
 		    group_wanted = FALSE;
@@ -2419,8 +2429,8 @@ static int HTLoadNews (
 	}
 
 	/*
-	**  Set up command for a post, listing, or article request. - FM
-	*/
+	 * Set up command for a post, listing, or article request.  - FM
+	 */
 	if (post_wanted || reply_wanted || spost_wanted || sreply_wanted) {
 	    strcpy(command, "POST");
 	} else if (list_wanted) {
@@ -2432,7 +2442,8 @@ static int HTLoadNews (
 	    }
 	    SnipIn(command, "XGTITLE %.*s", 11, p1);
 	} else if (group_wanted) {
-	    char * slash = strchr(p1, '/');
+	    char *slash = strchr(p1, '/');
+
 	    first = 0;
 	    last = 0;
 	    if (slash) {
@@ -2445,17 +2456,16 @@ static int HTLoadNews (
 		}
 		LYstrncpy(groupName, p1, sizeof(groupName) - 1);
 		*slash = '/';
-		(void)sscanf(slash+1, "%d-%d", &first, &last);
-		if ((first > 0) && (isdigit(UCH(*(slash+1)))) &&
-		    (strchr(slash+1, '-') == NULL || first == last)) {
+		(void) sscanf(slash + 1, "%d-%d", &first, &last);
+		if ((first > 0) && (isdigit(UCH(*(slash + 1)))) &&
+		    (strchr(slash + 1, '-') == NULL || first == last)) {
 		    /*
-		    **	We got a number greater than 0, which will be
-		    **	loaded as first, and either no range or the
-		    **	range computes to zero, so make last negative,
-		    **	as a flag to select the group and then fetch
-		    **	an article by number (first) instead of by
-		    **	messageID. - FM
-		    */
+		     * We got a number greater than 0, which will be loaded as
+		     * first, and either no range or the range computes to
+		     * zero, so make last negative, as a flag to select the
+		     * group and then fetch an article by number (first)
+		     * instead of by messageID.  - FM
+		     */
 		    last = -1;
 		}
 	    } else {
@@ -2469,8 +2479,9 @@ static int HTLoadNews (
 	    }
 	    SnipIn(command, "GROUP %.*s", 9, groupName);
 	} else {
-	    int add_open=(strchr(p1, '<') == 0);
-	    int add_close=(strchr(p1, '>') == 0);
+	    int add_open = (strchr(p1, '<') == 0);
+	    int add_close = (strchr(p1, '>') == 0);
+
 	    if (strlen(p1) + add_open + add_close >= 252) {
 		FREE(ProxyHost);
 		FREE(ProxyHREF);
@@ -2485,23 +2496,24 @@ static int HTLoadNews (
 	}
 
 	{
-	    char * p = command + strlen(command);
+	    char *p = command + strlen(command);
+
 	    /*
-	    **	Terminate command with CRLF, as in RFC 977.
-	    */
+	     * Terminate command with CRLF, as in RFC 977.
+	     */
 	    *p++ = CR;		/* Macros to be correct on Mac */
 	    *p++ = LF;
 	    *p++ = 0;
 	}
 	StrAllocCopy(ListArg, p1);
-    } /* scope of p1 */
+    }				/* scope of p1 */
 
     if (!*arg) {
 	FREE(NewsHREF);
 	FREE(ProxyHost);
 	FREE(ProxyHREF);
 	FREE(ListArg);
-	return NO;			/* Ignore if no name */
+	return NO;		/* Ignore if no name */
     }
 
     if (!(post_wanted || reply_wanted || spost_wanted || sreply_wanted ||
@@ -2510,7 +2522,7 @@ static int HTLoadNews (
 	if (head_wanted && !strncmp(command, "ARTICLE ", 8)) {
 	    /* overwrite "ARTICLE" - hack... */
 	    strcpy(command, "HEAD ");
-	    for (cp = command + 5; ; cp++)
+	    for (cp = command + 5;; cp++)
 		if ((*cp = *(cp + 3)) == '\0')
 		    break;
 	}
@@ -2528,13 +2540,13 @@ static int HTLoadNews (
 	    FREE(ProxyHREF);
 	    FREE(ListArg);
 	    HTAlert(gettext("No target for raw text!"));
-	    return(HT_NOT_LOADED);
-	}	/* Copy routine entry points */
+	    return (HT_NOT_LOADED);
+	}			/* Copy routine entry points */
 	rawtargetClass = *rawtarget->isa;
     } else
-    /*
-    **	Make a hypertext object with an anchor list.
-    */
+	/*
+	 * Make a hypertext object with an anchor list.
+	 */
     if (!(post_wanted || reply_wanted || spost_wanted || sreply_wanted)) {
 	node_anchor = anAnchor;
 	target = HTML_new(anAnchor, format_out, stream);
@@ -2542,18 +2554,19 @@ static int HTLoadNews (
     }
 
     /*
-    **	Now, let's get a stream setup up from the NewsHost.
-    */
+     * Now, let's get a stream setup up from the NewsHost.
+     */
     for (retries = 0; retries < 2; retries++) {
 	if (s < 0) {
 	    /* CONNECTING to news host */
 	    char url[260];
+
 	    if (!strcmp(NewsHREF, STR_NEWS_URL)) {
-		SnipIn (url, "lose://%.*s/", 9, NewsHost);
+		SnipIn(url, "lose://%.*s/", 9, NewsHost);
 	    } else if (ProxyHREF) {
-		SnipIn (url, "%.*s", 1, ProxyHREF);
+		SnipIn(url, "%.*s", 1, ProxyHREF);
 	    } else {
-		SnipIn (url, "%.*s", 1, NewsHREF);
+		SnipIn(url, "%.*s", 1, NewsHREF);
 	    }
 	    CTRACE((tfp, "News: doing HTDoConnect on '%s'\n", url));
 
@@ -2564,18 +2577,19 @@ static int HTLoadNews (
 		(!strncmp(arg, STR_SNEWS_URL, 6) ||
 		 !strncmp(arg, "snewspost:", 10) ||
 		 !strncmp(arg, "snewsreply:", 11)))
-		status = HTDoConnect (url, "NNTPS", SNEWS_PORT, &s);
+		status = HTDoConnect(url, "NNTPS", SNEWS_PORT, &s);
 	    else
-		status = HTDoConnect (url, "NNTP", NEWS_PORT, &s);
+		status = HTDoConnect(url, "NNTP", NEWS_PORT, &s);
 #else
-	    status = HTDoConnect (url, "NNTP", NEWS_PORT, &s);
+	    status = HTDoConnect(url, "NNTP", NEWS_PORT, &s);
 #endif /* USE_SSL */
 
 	    if (status == HT_INTERRUPTED) {
 		/*
-		**  Interrupt cleanly.
-		*/
-		CTRACE((tfp, "HTNews: Interrupted on connect; recovering cleanly.\n"));
+		 * Interrupt cleanly.
+		 */
+		CTRACE((tfp,
+			"HTNews: Interrupted on connect; recovering cleanly.\n"));
 		_HTProgress(CONNECTION_INTERRUPTED);
 		if (!(post_wanted || reply_wanted ||
 		      spost_wanted || sreply_wanted)) {
@@ -2621,12 +2635,11 @@ static int HTLoadNews (
 		return HTLoadError(stream, 500, dbuf);
 	    } else {
 		CTRACE((tfp, "HTNews: Connected to news host %s.\n",
-			    NewsHost));
+			NewsHost));
 #ifdef USE_SSL
 		/*
-		**  If this is an snews url,
-		**  then do the SSL stuff here
-		*/
+		 * If this is an snews url, then do the SSL stuff here
+		 */
 		if (!using_proxy &&
 		    (!strncmp(url, "snews", 5) ||
 		     !strncmp(url, "snewspost:", 10) ||
@@ -2638,18 +2651,21 @@ static int HTLoadNews (
 
 		    if (status <= 0) {
 			unsigned long SSLerror;
-			CTRACE((tfp,"HTNews: Unable to complete SSL handshake for '%s', SSL_connect=%d, SSL error stack dump follows\n",url, status));
+
+			CTRACE((tfp,
+				"HTNews: Unable to complete SSL handshake for '%s', SSL_connect=%d, SSL error stack dump follows\n",
+				url, status));
 			SSL_load_error_strings();
-			while((SSLerror = ERR_get_error()) != 0) {
-			    CTRACE((tfp,"HTNews: SSL: %s\n",ERR_error_string(SSLerror,NULL)));
+			while ((SSLerror = ERR_get_error()) != 0) {
+			    CTRACE((tfp, "HTNews: SSL: %s\n",
+				    ERR_error_string(SSLerror, NULL)));
 			}
-			HTAlert(
-			    "Unable to make secure connection to remote host.");
+			HTAlert("Unable to make secure connection to remote host.");
 			NEWS_NETCLOSE(s);
 			s = -1;
 			if (!(post_wanted || reply_wanted ||
 			      spost_wanted || sreply_wanted))
-			    (*targetClass._abort)(target, NULL);
+			    (*targetClass._abort) (target, NULL);
 			FREE(NewsHost);
 			FREE(NewsHREF);
 			FREE(ProxyHost);
@@ -2657,8 +2673,7 @@ static int HTLoadNews (
 			FREE(ListArg);
 			if (postfile) {
 #ifdef VMS
-			    while (remove(postfile) == 0)
-			    ; /* loop through all versions */
+			    while (remove(postfile) == 0) ;	/* loop through all versions */
 #else
 			    remove(postfile);
 #endif /* VMS */
@@ -2666,56 +2681,61 @@ static int HTLoadNews (
 			}
 			return HT_NOT_LOADED;
 		    }
-		    sprintf(SSLprogress,"Secure %d-bit %s (%s) NNTP connection",SSL_get_cipher_bits(Handle,NULL),SSL_get_cipher_version(Handle),SSL_get_cipher(Handle));
+		    sprintf(SSLprogress,
+			    "Secure %d-bit %s (%s) NNTP connection",
+			    SSL_get_cipher_bits(Handle, NULL),
+			    SSL_get_cipher_version(Handle),
+			    SSL_get_cipher(Handle));
 		    _HTProgress(SSLprogress);
 		}
 #endif /* USE_SSL */
-		HTInitInput(s);		/* set up buffering */
+		HTInitInput(s);	/* set up buffering */
 		if (proxycmd[0]) {
 		    status = NEWS_NETWRITE(s, proxycmd, strlen(proxycmd));
-		    CTRACE((tfp, "HTNews: Proxy command returned status '%d'.\n",
-				status));
+		    CTRACE((tfp,
+			    "HTNews: Proxy command returned status '%d'.\n",
+			    status));
 		}
 		if (((status = response(NULL)) / 100) != 2) {
-			NEWS_NETCLOSE(s);
-			s = -1;
-			if (status == HT_INTERRUPTED) {
-			    _HTProgress(CONNECTION_INTERRUPTED);
-			    if (!(post_wanted || reply_wanted ||
-				  spost_wanted || sreply_wanted)) {
-				ABORT_TARGET;
-			    }
-			    FREE(NewsHost);
-			    FREE(NewsHREF);
-			    FREE(ProxyHost);
-			    FREE(ProxyHREF);
-			    FREE(ListArg);
-			    if (postfile) {
-				HTSYS_remove(postfile);
-				FREE(postfile);
-			    }
-			    return(HT_NOT_LOADED);
-			}
-			if (retries < 1)
-			    continue;
-			FREE(ProxyHost);
-			FREE(ProxyHREF);
-			FREE(ListArg);
-			FREE(postfile);
+		    NEWS_NETCLOSE(s);
+		    s = -1;
+		    if (status == HT_INTERRUPTED) {
+			_HTProgress(CONNECTION_INTERRUPTED);
 			if (!(post_wanted || reply_wanted ||
 			      spost_wanted || sreply_wanted)) {
 			    ABORT_TARGET;
 			}
-			if (response_text[0]) {
-			    HTSprintf0(&dbuf,
-				gettext("Can't read news info.  News host %.20s responded: %.200s"),
-				NewsHost, response_text);
-			} else {
-			    HTSprintf0(&dbuf,
-				gettext("Can't read news info, empty response from host %s"),
-				NewsHost);
+			FREE(NewsHost);
+			FREE(NewsHREF);
+			FREE(ProxyHost);
+			FREE(ProxyHREF);
+			FREE(ListArg);
+			if (postfile) {
+			    HTSYS_remove(postfile);
+			    FREE(postfile);
 			}
-			return HTLoadError(stream, 500, dbuf);
+			return (HT_NOT_LOADED);
+		    }
+		    if (retries < 1)
+			continue;
+		    FREE(ProxyHost);
+		    FREE(ProxyHREF);
+		    FREE(ListArg);
+		    FREE(postfile);
+		    if (!(post_wanted || reply_wanted ||
+			  spost_wanted || sreply_wanted)) {
+			ABORT_TARGET;
+		    }
+		    if (response_text[0]) {
+			HTSprintf0(&dbuf,
+				   gettext("Can't read news info.  News host %.20s responded: %.200s"),
+				   NewsHost, response_text);
+		    } else {
+			HTSprintf0(&dbuf,
+				   gettext("Can't read news info, empty response from host %s"),
+				   NewsHost);
+		    }
+		    return HTLoadError(stream, 500, dbuf);
 		}
 		if (status == 200) {
 		    HTCanPost = TRUE;
@@ -2735,14 +2755,14 @@ static int HTLoadNews (
 			    HTSYS_remove(postfile);
 			    FREE(postfile);
 			}
-			return(HT_NOT_LOADED);
+			return (HT_NOT_LOADED);
 		    }
 		}
 	    }
-	} /* If needed opening */
-
+	}
+	/* If needed opening */
 	if (post_wanted || reply_wanted ||
-	     spost_wanted || sreply_wanted) {
+	    spost_wanted || sreply_wanted) {
 	    if (!HTCanPost) {
 		HTAlert(CANNOT_POST);
 		FREE(NewsHREF);
@@ -2756,11 +2776,11 @@ static int HTLoadNews (
 		    HTSYS_remove(postfile);
 		    FREE(postfile);
 		}
-		return(HT_NOT_LOADED);
+		return (HT_NOT_LOADED);
 	    }
 	    if (postfile == NULL) {
 		postfile = LYNewsPost(ListArg,
-				(BOOLEAN)(reply_wanted || sreply_wanted));
+				      (BOOLEAN) (reply_wanted || sreply_wanted));
 	    }
 	    if (postfile == NULL) {
 		HTProgress(CANCELLED);
@@ -2771,16 +2791,16 @@ static int HTLoadNews (
 		    FREE(ProxyHREF);
 		}
 		FREE(ListArg);
-		return(HT_NOT_LOADED);
+		return (HT_NOT_LOADED);
 	    }
 	} else {
 	    /*
-	    **	Ensure reader mode, but don't bother checking the
-	    **	status for anything but HT_INTERRUPTED or a 480
-	    **	Authorization request, because if the reader mode
-	    **	command is not needed, the server probably returned
-	    **	a 500, which is irrelevant at this point. - FM
-	    */
+	     * Ensure reader mode, but don't bother checking the status for
+	     * anything but HT_INTERRUPTED or a 480 Authorization request,
+	     * because if the reader mode command is not needed, the server
+	     * probably returned a 500, which is irrelevant at this point.  -
+	     * FM
+	     */
 	    char buffer[20];
 
 	    sprintf(buffer, "mode reader%c%c", CR, LF);
@@ -2790,6 +2810,7 @@ static int HTLoadNews (
 	    }
 	    if (status == 480) {
 		NNTPAuthResult auth_result = HTHandleAuthInfo(NewsHost);
+
 		if (auth_result == NNTPAUTH_CLOSE) {
 		    if (s != -1 && !(ProxyHost || ProxyHREF)) {
 			NEWS_NETCLOSE(s);
@@ -2806,7 +2827,7 @@ static int HTLoadNews (
 	    }
 	}
 
-Send_NNTP_command:
+      Send_NNTP_command:
 #ifdef NEWS_DEB
 	if (postfile)
 	    printf("postfile = %s, command = %s", postfile, command);
@@ -2825,13 +2846,12 @@ Send_NNTP_command:
 	    }
 	}
 	/*
-	 *  For some well known error responses which are expected
-	 *  to occur in normal use, break from the loop without retrying
-	 *  and without closing the connection.  It is unlikely that
-	 *  these are leftovers from a timed-out connection (but we do
-	 *  some checks to see whether the response corresponds to the
-	 *  last command), or that they will give anything else when
-	 *  automatically retried.  - kw
+	 * For some well known error responses which are expected to occur in
+	 * normal use, break from the loop without retrying and without closing
+	 * the connection.  It is unlikely that these are leftovers from a
+	 * timed-out connection (but we do some checks to see whether the
+	 * response corresponds to the last command), or that they will give
+	 * anything else when automatically retried.  - kw
 	 */
 	if (status == 411 && group_wanted &&
 	    !strncmp(command, "GROUP ", 6) &&
@@ -2841,13 +2861,13 @@ Send_NNTP_command:
 	    HTAlert(response_text);
 	    break;
 	} else if (status == 430 && !group_wanted && !list_wanted &&
-	    !strncmp(command, "ARTICLE <", 9) &&
-	    !strcasecomp(response_text + 3, " No such article")) {
+		   !strncmp(command, "ARTICLE <", 9) &&
+		   !strcasecomp(response_text + 3, " No such article")) {
 
 	    HTAlert(response_text);
 	    break;
 	}
-	if ((status/100) != 2 &&
+	if ((status / 100) != 2 &&
 	    status != 340 &&
 	    status != 480) {
 	    if (retries) {
@@ -2862,20 +2882,20 @@ Send_NNTP_command:
 	    NEWS_NETCLOSE(s);
 	    s = -1;
 	    /*
-	    **	Message might be a leftover "Timeout-disconnected",
-	    **	so try again if the retries maximum has not been
-	    **	reached.
-	    */
+	     * Message might be a leftover "Timeout-disconnected", so try again
+	     * if the retries maximum has not been reached.
+	     */
 	    continue;
 	}
 
 	/*
-	**  Post or load a group, article, etc
-	*/
+	 * Post or load a group, article, etc
+	 */
 	if (status == 480) {
 	    NNTPAuthResult auth_result;
+
 	    /*
-	     *	Some servers return 480 for a failed XGTITLE. - FM
+	     * Some servers return 480 for a failed XGTITLE.  - FM
 	     */
 	    if (list_wanted && !strncmp(command, "XGTITLE", 7) &&
 		strstr(response_text, "uthenticat") == NULL &&
@@ -2884,8 +2904,8 @@ Send_NNTP_command:
 		goto Send_NNTP_command;
 	    }
 	    /*
-	    **	Handle Authorization. - FM
-	    */
+	     * Handle Authorization.  - FM
+	     */
 	    if ((auth_result = HTHandleAuthInfo(NewsHost)) == NNTPAUTH_OK) {
 		goto Send_NNTP_command;
 	    } else if (auth_result == NNTPAUTH_CLOSE) {
@@ -2900,8 +2920,8 @@ Send_NNTP_command:
 	} else if (post_wanted || reply_wanted ||
 		   spost_wanted || sreply_wanted) {
 	    /*
-	    **	Handle posting of an article. - FM
-	    */
+	     * Handle posting of an article.  - FM
+	     */
 	    if (status != 340) {
 		HTAlert(CANNOT_POST);
 		if (postfile) {
@@ -2914,23 +2934,22 @@ Send_NNTP_command:
 	    status = HT_NOT_LOADED;
 	} else if (list_wanted) {
 	    /*
-	    **	List available newsgroups. - FM
-	    */
+	     * List available newsgroups.  - FM
+	     */
 	    _HTProgress(gettext("Reading list of available newsgroups."));
 	    status = read_list(ListArg);
 	} else if (group_wanted) {
 	    /*
-	    **	List articles in a news group. - FM
-	    */
+	     * List articles in a news group.  - FM
+	     */
 	    if (last < 0) {
 		/*
-		**  We got one article number rather than a range
-		**  following the slash which followed the group
-		**  name, or the range was zero, so now that we
-		**  have selected that group, load ARTICLE and the
-		**  the number (first) as the command and go back
-		**  to send it and check the response. - FM
-		*/
+		 * We got one article number rather than a range following the
+		 * slash which followed the group name, or the range was zero,
+		 * so now that we have selected that group, load ARTICLE and
+		 * the the number (first) as the command and go back to send it
+		 * and check the response.  - FM
+		 */
 		sprintf(command, "%s %d%c%c",
 			head_wanted ? "HEAD" : "ARTICLE",
 			first, CR, LF);
@@ -2942,8 +2961,8 @@ Send_NNTP_command:
 	    status = read_group(groupName, first, last);
 	} else {
 	    /*
-	    **	Get an article from a news group. - FM
-	    */
+	     * Get an article from a news group.  - FM
+	     */
 	    _HTProgress(gettext("Reading news article."));
 	    status = read_article(anAnchor);
 	}
@@ -2971,11 +2990,11 @@ Send_NNTP_command:
 	    FREE(postfile);
 	}
 	return status;
-    } /* Retry loop */
+    }				/* Retry loop */
 
 #if 0
     HTAlert(gettext("Sorry, could not load requested news."));
-    NXRunAlertPanel(NULL, "Sorry, could not load `%s'.", NULL,NULL,NULL, arg);
+    NXRunAlertPanel(NULL, "Sorry, could not load `%s'.", NULL, NULL, NULL, arg);
     /* No -- message earlier wil have covered it */
 #endif
 
@@ -2998,46 +3017,44 @@ Send_NNTP_command:
 }
 
 /*
-**  This function clears all authorization information by
-**  invoking the free_NNTP_AuthInfo() function, which normally
-**  is invoked at exit.  It allows a browser command to do
-**  this at any time, for example, if the user is leaving
-**  the terminal for a period of time, but does not want
-**  to end the current session.  - FM
-*/
-void HTClearNNTPAuthInfo (void)
+ *  This function clears all authorization information by
+ *  invoking the free_NNTP_AuthInfo() function, which normally
+ *  is invoked at exit.  It allows a browser command to do
+ *  this at any time, for example, if the user is leaving
+ *  the terminal for a period of time, but does not want
+ *  to end the current session.  - FM
+ */
+void HTClearNNTPAuthInfo(void)
 {
     /*
-    **	Need code to check cached documents and do
-    **	something to ensure that any protected
-    **	documents no longer can be accessed without
-    **	a new retrieval. - FM
-    */
+     * Need code to check cached documents and do something to ensure that any
+     * protected documents no longer can be accessed without a new retrieval. 
+     * - FM
+     */
 
     /*
-    **	Now free all of the authorization info. - FM
-    */
+     * Now free all of the authorization info.  - FM
+     */
     free_NNTP_AuthInfo();
 }
 
 #ifdef USE_SSL
-static char HTNewsGetCharacter (void)
+static char HTNewsGetCharacter(void)
 {
     if (!Handle)
 	return HTGetCharacter();
     else
-	return HTGetSSLCharacter((void *)Handle);
+	return HTGetSSLCharacter((void *) Handle);
 }
 
-int HTNewsProxyConnect (
-    int		sock,
-    const char *	url,
-    HTParentAnchor *	anAnchor,
-    HTFormat		format_out,
-    HTStream *		sink)
+int HTNewsProxyConnect(int sock,
+		       const char *url,
+		       HTParentAnchor *anAnchor,
+		       HTFormat format_out,
+		       HTStream *sink)
 {
     int status;
-    const char * arg = url;
+    const char *arg = url;
     char SSLprogress[256];
 
     s = channel_s = sock;
@@ -3048,19 +3065,22 @@ int HTNewsProxyConnect (
 
     if (status <= 0) {
 	unsigned long SSLerror;
+
 	channel_s = -1;
-	CTRACE((tfp,"HTNews: Unable to complete SSL handshake for '%s', SSL_connect=%d, SSL error stack dump follows\n",url, status));
+	CTRACE((tfp,
+		"HTNews: Unable to complete SSL handshake for '%s', SSL_connect=%d, SSL error stack dump follows\n",
+		url, status));
 	SSL_load_error_strings();
-	while((SSLerror = ERR_get_error()) != 0) {
-	    CTRACE((tfp,"HTNews: SSL: %s\n",ERR_error_string(SSLerror,NULL)));
+	while ((SSLerror = ERR_get_error()) != 0) {
+	    CTRACE((tfp, "HTNews: SSL: %s\n", ERR_error_string(SSLerror, NULL)));
 	}
 	HTAlert("Unable to make secure connection to remote host.");
 	NEWS_NETCLOSE(s);
 	s = -1;
 	return HT_NOT_LOADED;
     }
-    sprintf(SSLprogress,"Secure %d-bit %s (%s) NNTP connection",
-	    SSL_get_cipher_bits(Handle,NULL),
+    sprintf(SSLprogress, "Secure %d-bit %s (%s) NNTP connection",
+	    SSL_get_cipher_bits(Handle, NULL),
 	    SSL_get_cipher_version(Handle),
 	    SSL_get_cipher(Handle));
     _HTProgress(SSLprogress);
@@ -3072,27 +3092,34 @@ int HTNewsProxyConnect (
 
 #ifdef GLOBALDEF_IS_MACRO
 #define _HTNEWS_C_1_INIT { "news", HTLoadNews, NULL }
-GLOBALDEF (HTProtocol,HTNews,_HTNEWS_C_1_INIT);
+GLOBALDEF(HTProtocol, HTNews, _HTNEWS_C_1_INIT);
 #define _HTNEWS_C_2_INIT { "nntp", HTLoadNews, NULL }
-GLOBALDEF (HTProtocol,HTNNTP,_HTNEWS_C_2_INIT);
+GLOBALDEF(HTProtocol, HTNNTP, _HTNEWS_C_2_INIT);
 #define _HTNEWS_C_3_INIT { "newspost", HTLoadNews, NULL }
-GLOBALDEF (HTProtocol,HTNewsPost,_HTNEWS_C_3_INIT);
+GLOBALDEF(HTProtocol, HTNewsPost, _HTNEWS_C_3_INIT);
 #define _HTNEWS_C_4_INIT { "newsreply", HTLoadNews, NULL }
-GLOBALDEF (HTProtocol,HTNewsReply,_HTNEWS_C_4_INIT);
+GLOBALDEF(HTProtocol, HTNewsReply, _HTNEWS_C_4_INIT);
 #define _HTNEWS_C_5_INIT { "snews", HTLoadNews, NULL }
-GLOBALDEF (HTProtocol,HTSNews,_HTNEWS_C_5_INIT);
+GLOBALDEF(HTProtocol, HTSNews, _HTNEWS_C_5_INIT);
 #define _HTNEWS_C_6_INIT { "snewspost", HTLoadNews, NULL }
-GLOBALDEF (HTProtocol,HTSNewsPost,_HTNEWS_C_6_INIT);
+GLOBALDEF(HTProtocol, HTSNewsPost, _HTNEWS_C_6_INIT);
 #define _HTNEWS_C_7_INIT { "snewsreply", HTLoadNews, NULL }
-GLOBALDEF (HTProtocol,HTSNewsReply,_HTNEWS_C_7_INIT);
+GLOBALDEF(HTProtocol, HTSNewsReply, _HTNEWS_C_7_INIT);
 #else
-GLOBALDEF HTProtocol HTNews = { "news", HTLoadNews, NULL };
-GLOBALDEF HTProtocol HTNNTP = { "nntp", HTLoadNews, NULL };
-GLOBALDEF HTProtocol HTNewsPost = { "newspost", HTLoadNews, NULL };
-GLOBALDEF HTProtocol HTNewsReply = { "newsreply", HTLoadNews, NULL };
-GLOBALDEF HTProtocol HTSNews = { "snews", HTLoadNews, NULL };
-GLOBALDEF HTProtocol HTSNewsPost = { "snewspost", HTLoadNews, NULL };
-GLOBALDEF HTProtocol HTSNewsReply = { "snewsreply", HTLoadNews, NULL };
+GLOBALDEF HTProtocol HTNews =
+{"news", HTLoadNews, NULL};
+GLOBALDEF HTProtocol HTNNTP =
+{"nntp", HTLoadNews, NULL};
+GLOBALDEF HTProtocol HTNewsPost =
+{"newspost", HTLoadNews, NULL};
+GLOBALDEF HTProtocol HTNewsReply =
+{"newsreply", HTLoadNews, NULL};
+GLOBALDEF HTProtocol HTSNews =
+{"snews", HTLoadNews, NULL};
+GLOBALDEF HTProtocol HTSNewsPost =
+{"snewspost", HTLoadNews, NULL};
+GLOBALDEF HTProtocol HTSNewsReply =
+{"snewsreply", HTLoadNews, NULL};
 #endif /* GLOBALDEF_IS_MACRO */
 
 #endif /* not DISABLE_NEWS */