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>2002-10-07 01:07:23 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2002-10-07 01:07:23 -0400
commit0cb11571ef3a2820a888b47eaa0ea3083e3b9b0f (patch)
tree1e65bf4510e41320b9428058bb20f3f6d6fdd648 /WWW/Library/Implementation/HTNews.c
parentffc5ca31a759c93f4cb2af8aec4fe6e852161855 (diff)
downloadlynx-snapshots-0cb11571ef3a2820a888b47eaa0ea3083e3b9b0f.tar.gz
snapshot of project "lynx", label v2-8-5dev_9
Diffstat (limited to 'WWW/Library/Implementation/HTNews.c')
-rw-r--r--WWW/Library/Implementation/HTNews.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index 2d8a8f5d..ce7c16df 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -59,7 +59,8 @@ PRIVATE char HTNewsGetCharacter NOPARAMS;
 #include <LYGlobalDefs.h>
 #include <LYLeaks.h>
 
-#define SnipIn(d,fmt,len,s) sprintf(d, fmt, (int)sizeof(d)-len, s)
+#define SnipIn(d,fmt,len,s)      sprintf(d, fmt,      (int)sizeof(d)-len, s)
+#define SnipIn2(d,fmt,tag,len,s) sprintf(d, fmt, tag, (int)sizeof(d)-len, s)
 
 struct _HTStructured {
 	CONST HTStructuredClass *	isa;
@@ -203,8 +204,8 @@ PRIVATE BOOL initialize NOARGS
 	cp = NULL;
     }
 #else
-    if (getenv("NNTPSERVER")) {
-	StrAllocCopy(HTNewsHost, (char *)getenv("NNTPSERVER"));
+    if (LYGetEnv("NNTPSERVER")) {
+	StrAllocCopy(HTNewsHost, LYGetEnv("NNTPSERVER"));
 	CTRACE((tfp, "HTNews: NNTPSERVER defined as `%s'\n",
 		    HTNewsHost));
     } else {
@@ -845,7 +846,7 @@ PRIVATE void post_article ARGS1(
     **	Open the temporary file with the
     **	nntp headers and message body. - FM
     */
-    if ((fd = fopen((postfile ? postfile : ""), TXT_R)) == NULL) {
+    if ((fd = fopen(NonNull(postfile), TXT_R)) == NULL) {
 	HTAlert(FAILED_CANNOT_OPEN_POST);
 	return;
     }
@@ -941,8 +942,7 @@ PRIVATE void post_article ARGS1(
 }
 
 #ifdef SH_EX	/* for MIME */
-#define NEWS_DEBUG 0
-#if NEWS_DEBUG
+#ifdef NEWS_DEBUG
 /* for DEBUG 1997/11/07 (Fri) 17:20:16 */
 void debug_print(unsigned char *p)
 {
@@ -984,7 +984,7 @@ static char *decode_mime(char *str)
 	    q = p + 1;
 	}
     }
-#if NEWS_DEBUG
+#ifdef NEWS_DEBUG
     printf("new=[");
     debug_print(temp);
 #endif
@@ -1143,7 +1143,7 @@ PRIVATE int read_article ARGS1(
 	if (from || replyto) {
 	    char *temp = NULL;
 	    StrAllocCopy(temp, author_address(replyto ? replyto : from));
-	    StrAllocCopy(href,"mailto:");
+	    StrAllocCopy(href, STR_MAILTO_URL);
 	    if (strchr(temp, '%') || strchr(temp, '?')) {
 		cp = HTEscape(temp, URL_XPALPHAS);
 		StrAllocCat(href, cp);
@@ -1289,7 +1289,7 @@ PRIVATE int read_article ARGS1(
 	    **	so add a link for posting followups for
 	    **	this article. - FM
 	    */
-	    if (!strncasecomp(NewsHREF, "snews:", 6))
+	    if (!strncasecomp(NewsHREF, STR_SNEWS_URL, 6))
 		StrAllocCopy(href,"snewsreply://");
 	    else
 		StrAllocCopy(href,"newsreply://");
@@ -1388,7 +1388,7 @@ PRIVATE int read_article ARGS1(
 	if (((char)ich == LF) || (p == &line[LINE_LENGTH])) {
 	    *p++ = '\0';			/* Terminate the string */
 	    CTRACE((tfp, "B %s", line));
-#if 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] == '.') {
@@ -1438,7 +1438,7 @@ PRIVATE int read_article ARGS1(
 			    p2 += 7;
 			    *p2 = 0;
 			    while (*l) {
-				if (strncmp(l, "news:", 5) &&
+				if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
 				    strncmp(l, "snews://", 8) &&
 				    strncmp(l, "nntp://", 7) &&
 				    strncmp(l, "snewspost:", 10) &&
@@ -1451,7 +1451,7 @@ PRIVATE int read_article ARGS1(
 				    strncmp(l, "http://", 7) &&
 				    strncmp(l, "https://", 8) &&
 				    strncmp(l, "wais://", 7) &&
-				    strncmp(l, "mailto:", 7) &&
+				    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
 				    strncmp(l, "cso://", 6) &&
 				    strncmp(l, "gopher://", 9)) {
 				    PUTC (*l++);
@@ -1477,7 +1477,7 @@ PRIVATE int read_article ARGS1(
 			}
 		    }
 		    while (*l) {		/* Last bit of the line */
-			if (strncmp(l, "news:", 5) &&
+			if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
 			    strncmp(l, "snews://", 8) &&
 			    strncmp(l, "nntp://", 7) &&
 			    strncmp(l, "snewspost:", 10) &&
@@ -1490,7 +1490,7 @@ PRIVATE int read_article ARGS1(
 			    strncmp(l, "http://", 7) &&
 			    strncmp(l, "https://", 8) &&
 			    strncmp(l, "wais://", 7) &&
-			    strncmp(l, "mailto:", 7) &&
+			    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
 			    strncmp(l, "cso://", 6) &&
 			    strncmp(l, "gopher://", 9))
 			    PUTC (*l++);
@@ -2094,7 +2094,7 @@ add_post:
 
 	START(HTML_HR);
 	PUTC('\n');
-	if (!strncasecomp(NewsHREF, "snews:", 6))
+	if (!strncasecomp(NewsHREF, STR_SNEWS_URL, 6))
 	    StrAllocCopy(href,"snewspost://");
 	else
 	    StrAllocCopy(href,"newspost://");
@@ -2175,7 +2175,7 @@ PRIVATE int HTLoadNews ARGS4(
 	**	xxxxx			News group (no "@")
 	**	group/n1-n2		Articles n1 to n2 in group
 	*/
-	normal_url = (BOOL) (!strncmp(arg, "news:", 5) || !strncmp(arg, "nntp:", 5));
+	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);
@@ -2251,7 +2251,7 @@ PRIVATE int HTLoadNews ARGS4(
 	**  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 (!strncasecomp (arg, "nntp:", 5)) {
+	} else if (isNNTP_URL(arg)) {
 	    if (((*(arg + 5) == '\0') ||
 		 (!strcmp((arg + 5), "/") ||
 		  !strcmp((arg + 5), "//") ||
@@ -2282,10 +2282,10 @@ PRIVATE int HTLoadNews ARGS4(
 		StrAllocCopy(NewsHost, cp);
 	    }
 	    FREE(cp);
-	    SnipIn(command, "nntp://%.*s/", 9, NewsHost);
+	    SnipIn2(command, "%s//%.*s/", STR_NNTP_URL, 9, NewsHost);
 	    StrAllocCopy(NewsHREF, command);
 	}
-	else if (!strncasecomp(arg, "snews:", 6)) {
+	else if (!strncasecomp(arg, STR_SNEWS_URL, 6)) {
 #ifdef USE_SSL
 	    if (((*(arg + 6) == '\0') ||
 		 (!strcmp((arg + 6), "/") ||
@@ -2317,7 +2317,7 @@ PRIVATE int HTLoadNews ARGS4(
 	    StrAllocCopy(NewsHost, cp);
 	    }
 	    FREE(cp);
-	    sprintf(command, "snews://%.250s/", NewsHost);
+	    sprintf(command, "%s//%.250s/", STR_SNEWS_URL, NewsHost);
 	    StrAllocCopy(NewsHREF, command);
 #else
 	    HTAlert(gettext("This client does not contain support for SNEWS URLs."));
@@ -2366,7 +2366,7 @@ PRIVATE int HTLoadNews ARGS4(
 		s = -1;
 	    }
 	    StrAllocCopy(NewsHost, HTNewsHost);
-	    StrAllocCopy(NewsHREF, "news:");
+	    StrAllocCopy(NewsHREF, STR_NEWS_URL);
 	}
 
 	/*
@@ -2375,15 +2375,15 @@ PRIVATE int HTLoadNews ARGS4(
 	**  doing the conversion itself, and for handling posts
 	**  or followups.  - TZ & FM
 	*/
-	if (!strncasecomp(p1, "snews:", 6) ||
+	if (!strncasecomp(p1, STR_SNEWS_URL, 6) ||
 	    !strncasecomp(p1, "snewspost:", 10) ||
 	    !strncasecomp(p1, "snewsreply:", 11)) {
 	    StrAllocCopy(ProxyHost, NewsHost);
 	    if ((cp = HTParse(p1, "", PARSE_HOST)) != NULL && *cp != '\0') {
-		SnipIn(command, "snews://%.*s", 10, cp);
+		SnipIn2(command, "%s//%.*s", STR_SNEWS_URL, 10, cp);
 		StrAllocCopy(NewsHost, cp);
 	    } else {
-		SnipIn(command, "snews://%.*s", 10, NewsHost);
+		SnipIn2(command, "%s//%.*s", STR_SNEWS_URL, 10, NewsHost);
 	    }
 	    command[sizeof(command)-2] = '\0';
 	    FREE(cp);
@@ -2549,7 +2549,7 @@ PRIVATE int HTLoadNews ARGS4(
 	if (s < 0) {
 	    /* CONNECTING to news host */
 	    char url[260];
-	    if (!strcmp(NewsHREF, "news:")) {
+	    if (!strcmp(NewsHREF, STR_NEWS_URL)) {
 		SnipIn (url, "lose://%.*s/", 9, NewsHost);
 	    } else if (ProxyHREF) {
 		SnipIn (url, "%.*s", 1, ProxyHREF);
@@ -2562,7 +2562,7 @@ PRIVATE int HTLoadNews ARGS4(
 
 #ifdef USE_SSL
 	    if (!using_proxy &&
-		(!strncmp(arg, "snews:", 6) ||
+		(!strncmp(arg, STR_SNEWS_URL, 6) ||
 		 !strncmp(arg, "snewspost:", 10) ||
 		 !strncmp(arg, "snewsreply:", 11)))
 		status = HTDoConnect (url, "NNTPS", SNEWS_PORT, &s);