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>2010-09-26 14:26:23 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2010-09-26 14:26:23 -0400
commitbf9ea0cbb0562934c45170f94ebfe2ac609a44a8 (patch)
treef4bde48763d66ed00b176397aee2b3fd6e9fc7f5 /WWW/Library/Implementation/HTNews.c
parent69a1a751cb798556c786e3ef66d473bf8a88abdc (diff)
downloadlynx-snapshots-bf9ea0cbb0562934c45170f94ebfe2ac609a44a8.tar.gz
snapshot of project "lynx", label v2-8-8dev_5e
Diffstat (limited to 'WWW/Library/Implementation/HTNews.c')
-rw-r--r--WWW/Library/Implementation/HTNews.c112
1 files changed, 56 insertions, 56 deletions
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index c12196c0..ab4a6cb5 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTNews.c,v 1.64 2010/09/22 00:51:25 tom Exp $
+ * $LynxId: HTNews.c,v 1.66 2010/09/25 00:42:40 tom Exp $
  *
  *			NEWS ACCESS				HTNews.c
  *			===========
@@ -173,7 +173,7 @@ static void load_NNTP_AuthInfo(void)
     LYAddPathToHome(fname, sizeof(fname), NEWS_AUTH_FILE);
 
     if ((fp = fopen(fname, "r")) != 0) {
-	while (fgets(buffer, sizeof(buffer), fp) != 0) {
+	while (fgets(buffer, (int) sizeof(buffer), fp) != 0) {
 	    char the_host[LINE_LENGTH + 1];
 	    char the_pass[LINE_LENGTH + 1];
 	    char the_user[LINE_LENGTH + 1];
@@ -256,7 +256,7 @@ static BOOL initialize(void)
 	if (fp) {
 	    char server_name[MAXHOSTNAMELEN + 1];
 
-	    if (fgets(server_name, sizeof server_name, fp) != NULL) {
+	    if (fgets(server_name, (int) sizeof server_name, fp) != NULL) {
 		char *p = strchr(server_name, '\n');
 
 		if (p != NULL)
@@ -774,7 +774,7 @@ static void write_anchor(const char *text, const char *addr)
 	q = href;
 	strcpy(q, NewsHREF);
 	/* Make complete hypertext reference */
-	strncat(q, addr, (size_t) (p - addr));
+	StrNCat(q, addr, (size_t) (p - addr));
     } else {
 	q = NULL;
 	HTSprintf0(&q, "%s%.*s", NewsHREF, (int) (p - addr), addr);
@@ -905,7 +905,7 @@ static void post_article(char *postfile)
      */
     buf[0] = '\0';
     sprintf(crlf, "%c%c", CR, LF);
-    while (fgets(line, sizeof(line) - 2, fd) != NULL) {
+    while (fgets(line, (int) sizeof(line) - 2, fd) != NULL) {
 	if ((cp = strchr(line, '\n')) != NULL)
 	    *cp = '\0';
 	if (line[0] == '.') {
@@ -1458,22 +1458,22 @@ static int read_article(HTParentAnchor *thisanchor)
 			    p2 += 7;
 			    *p2 = 0;
 			    while (*l) {
-				if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
-				    strncmp(l, "snews://", 8) &&
-				    strncmp(l, "nntp://", 7) &&
-				    strncmp(l, "snewspost:", 10) &&
-				    strncmp(l, "snewsreply:", 11) &&
-				    strncmp(l, "newspost:", 9) &&
-				    strncmp(l, "newsreply:", 10) &&
-				    strncmp(l, "ftp://", 6) &&
-				    strncmp(l, "file:/", 6) &&
-				    strncmp(l, "finger://", 9) &&
-				    strncmp(l, "http://", 7) &&
-				    strncmp(l, "https://", 8) &&
-				    strncmp(l, "wais://", 7) &&
-				    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
-				    strncmp(l, "cso://", 6) &&
-				    strncmp(l, "gopher://", 9)) {
+				if (StrNCmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
+				    StrNCmp(l, "snews://", 8) &&
+				    StrNCmp(l, "nntp://", 7) &&
+				    StrNCmp(l, "snewspost:", 10) &&
+				    StrNCmp(l, "snewsreply:", 11) &&
+				    StrNCmp(l, "newspost:", 9) &&
+				    StrNCmp(l, "newsreply:", 10) &&
+				    StrNCmp(l, "ftp://", 6) &&
+				    StrNCmp(l, "file:/", 6) &&
+				    StrNCmp(l, "finger://", 9) &&
+				    StrNCmp(l, "http://", 7) &&
+				    StrNCmp(l, "https://", 8) &&
+				    StrNCmp(l, "wais://", 7) &&
+				    StrNCmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
+				    StrNCmp(l, "cso://", 6) &&
+				    StrNCmp(l, "gopher://", 9)) {
 				    PUTC(*l++);
 				} else {
 				    StrAllocCopy(href, l);
@@ -1497,22 +1497,22 @@ static int read_article(HTParentAnchor *thisanchor)
 			}
 		    }
 		    while (*l) {	/* Last bit of the line */
-			if (strncmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
-			    strncmp(l, "snews://", 8) &&
-			    strncmp(l, "nntp://", 7) &&
-			    strncmp(l, "snewspost:", 10) &&
-			    strncmp(l, "snewsreply:", 11) &&
-			    strncmp(l, "newspost:", 9) &&
-			    strncmp(l, "newsreply:", 10) &&
-			    strncmp(l, "ftp://", 6) &&
-			    strncmp(l, "file:/", 6) &&
-			    strncmp(l, "finger://", 9) &&
-			    strncmp(l, "http://", 7) &&
-			    strncmp(l, "https://", 8) &&
-			    strncmp(l, "wais://", 7) &&
-			    strncmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
-			    strncmp(l, "cso://", 6) &&
-			    strncmp(l, "gopher://", 9))
+			if (StrNCmp(l, STR_NEWS_URL, LEN_NEWS_URL) &&
+			    StrNCmp(l, "snews://", 8) &&
+			    StrNCmp(l, "nntp://", 7) &&
+			    StrNCmp(l, "snewspost:", 10) &&
+			    StrNCmp(l, "snewsreply:", 11) &&
+			    StrNCmp(l, "newspost:", 9) &&
+			    StrNCmp(l, "newsreply:", 10) &&
+			    StrNCmp(l, "ftp://", 6) &&
+			    StrNCmp(l, "file:/", 6) &&
+			    StrNCmp(l, "finger://", 9) &&
+			    StrNCmp(l, "http://", 7) &&
+			    StrNCmp(l, "https://", 8) &&
+			    StrNCmp(l, "wais://", 7) &&
+			    StrNCmp(l, STR_MAILTO_URL, LEN_MAILTO_URL) &&
+			    StrNCmp(l, "cso://", 6) &&
+			    StrNCmp(l, "gopher://", 9))
 			    PUTC(*l++);
 			else {
 			    StrAllocCopy(href, l);
@@ -2060,7 +2060,7 @@ static int read_group(const char *groupName,
 		START(HTML_LI);
 		START(HTML_I);
 		if (LYListNewsNumbers)
-		    LYstrncpy(buffer, "Status:", sizeof(buffer) - 1);
+		    LYStrNCpy(buffer, "Status:", sizeof(buffer) - 1);
 		else
 		    sprintf(buffer, "Status (ARTICLE %d):", art);
 		PUTS(buffer);
@@ -2191,8 +2191,8 @@ static int HTLoadNews(const char *arg,
 	 * 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));
+	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);
@@ -2276,7 +2276,7 @@ static int HTLoadNews(const char *arg,
 		 (!strcmp((arg + 5), "/") ||
 		  !strcmp((arg + 5), "//") ||
 		  !strcmp((arg + 5), "///"))) ||
-		((!strncmp((arg + 5), "//", 2)) &&
+		((!StrNCmp((arg + 5), "//", 2)) &&
 		 (!(cp = strchr((arg + 7), '/')) || *(cp + 1) == '\0'))) {
 		p1 = "*";
 		group_wanted = FALSE;
@@ -2310,7 +2310,7 @@ static int HTLoadNews(const char *arg,
 		 (!strcmp((arg + 6), "/") ||
 		  !strcmp((arg + 6), "//") ||
 		  !strcmp((arg + 6), "///"))) ||
-		((!strncmp((arg + 6), "//", 2)) &&
+		((!StrNCmp((arg + 6), "//", 2)) &&
 		 (!(cp = strchr((arg + 8), '/')) || *(cp + 1) == '\0'))) {
 		p1 = "*";
 		group_wanted = FALSE;
@@ -2462,7 +2462,7 @@ static int HTLoadNews(const char *arg,
 		    HTAlert(URL_TOO_LONG);
 		    return -400;
 		}
-		LYstrncpy(groupName, p1, sizeof(groupName) - 1);
+		LYStrNCpy(groupName, p1, sizeof(groupName) - 1);
 		*slash = '/';
 		(void) sscanf(slash + 1, "%d-%d", &first, &last);
 		if ((first > 0) && (isdigit(UCH(*(slash + 1)))) &&
@@ -2483,7 +2483,7 @@ static int HTLoadNews(const char *arg,
 		    HTAlert(URL_TOO_LONG);
 		    return -400;
 		}
-		LYstrncpy(groupName, p1, sizeof(groupName) - 1);
+		LYStrNCpy(groupName, p1, sizeof(groupName) - 1);
 	    }
 	    SnipIn(command, "GROUP %.*s", 9, groupName);
 	} else {
@@ -2527,7 +2527,7 @@ static int HTLoadNews(const char *arg,
     if (!(post_wanted || reply_wanted || spost_wanted || sreply_wanted ||
 	  (group_wanted && last != -1) || list_wanted)) {
 	head_wanted = anAnchor->isHEAD;
-	if (head_wanted && !strncmp(command, "ARTICLE ", 8)) {
+	if (head_wanted && !StrNCmp(command, "ARTICLE ", 8)) {
 	    /* overwrite "ARTICLE" - hack... */
 	    strcpy(command, "HEAD ");
 	    for (cp = command + 5;; cp++)
@@ -2580,9 +2580,9 @@ static int HTLoadNews(const char *arg,
 
 #ifdef USE_SSL
 	    if (!using_proxy &&
-		(!strncmp(arg, STR_SNEWS_URL, 6) ||
-		 !strncmp(arg, "snewspost:", 10) ||
-		 !strncmp(arg, "snewsreply:", 11)))
+		(!StrNCmp(arg, STR_SNEWS_URL, 6) ||
+		 !StrNCmp(arg, "snewspost:", 10) ||
+		 !StrNCmp(arg, "snewsreply:", 11)))
 		status = HTDoConnect(url, "NNTPS", SNEWS_PORT, &s);
 	    else
 		status = HTDoConnect(url, "NNTP", NEWS_PORT, &s);
@@ -2647,9 +2647,9 @@ static int HTLoadNews(const char *arg,
 		 * If this is an snews url, then do the SSL stuff here
 		 */
 		if (!using_proxy &&
-		    (!strncmp(url, "snews", 5) ||
-		     !strncmp(url, "snewspost:", 10) ||
-		     !strncmp(url, "snewsreply:", 11))) {
+		    (!StrNCmp(url, "snews", 5) ||
+		     !StrNCmp(url, "snewspost:", 10) ||
+		     !StrNCmp(url, "snewsreply:", 11))) {
 		    Handle = HTGetSSLHandle();
 		    SSL_set_fd(Handle, s);
 		    HTSSLInitPRNG();
@@ -2786,7 +2786,7 @@ static int HTLoadNews(const char *arg,
 	    }
 	    if (postfile == NULL) {
 		postfile = LYNewsPost(ListArg,
-				      (BOOLEAN) (reply_wanted || sreply_wanted));
+				      (reply_wanted || sreply_wanted));
 	    }
 	    if (postfile == NULL) {
 		HTProgress(CANCELLED);
@@ -2860,14 +2860,14 @@ static int HTLoadNews(const char *arg,
 	 * anything else when automatically retried.  - kw
 	 */
 	if (status == 411 && group_wanted &&
-	    !strncmp(command, "GROUP ", 6) &&
+	    !StrNCmp(command, "GROUP ", 6) &&
 	    !strncasecomp(response_text + 3, " No such group ", 15) &&
 	    !strcmp(response_text + 18, groupName)) {
 
 	    HTAlert(response_text);
 	    break;
 	} else if (status == 430 && !group_wanted && !list_wanted &&
-		   !strncmp(command, "ARTICLE <", 9) &&
+		   !StrNCmp(command, "ARTICLE <", 9) &&
 		   !strcasecomp(response_text + 3, " No such article")) {
 
 	    HTAlert(response_text);
@@ -2877,7 +2877,7 @@ static int HTLoadNews(const char *arg,
 	    status != 340 &&
 	    status != 480) {
 	    if (retries) {
-		if (list_wanted && !strncmp(command, "XGTITLE", 7)) {
+		if (list_wanted && !StrNCmp(command, "XGTITLE", 7)) {
 		    sprintf(command, "LIST NEWSGROUPS%c%c", CR, LF);
 		    goto Send_NNTP_command;
 		}
@@ -2903,7 +2903,7 @@ static int HTLoadNews(const char *arg,
 	    /*
 	     * Some servers return 480 for a failed XGTITLE.  - FM
 	     */
-	    if (list_wanted && !strncmp(command, "XGTITLE", 7) &&
+	    if (list_wanted && !StrNCmp(command, "XGTITLE", 7) &&
 		strstr(response_text, "uthenticat") == NULL &&
 		strstr(response_text, "uthor") == NULL) {
 		sprintf(command, "LIST NEWSGROUPS%c%c", CR, LF);