[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[leafnode-list] patch to get rid of "Reading new newsgroups failed" message



Hi!

I use news.gnus.org to fetch gnus.ding newsgroup.  The later server is
misconfigured as I've mentioned earlier here (AFAIR :)

So, tired from seeing 
        Reading new newsgroups failed
message in my mail and logs, I've managed to produce such rude patch
(below).  It adds -q switch which makes fetchnews quiet about such server
misconfiguration.

Hope this will helps someone else.

--- fetchnews.c.orig	Thu Nov 30 20:08:30 2000
+++ fetchnews.c	Wed Sep  5 00:38:47 2001
@@ -56,6 +56,7 @@
 int noexpire = 0;	/* if 1, don't automatically unsubscribe newsgroups */
 int forceactive = 0;	/* if 1, reread complete active file */
 int headerbody = 0;	/* if 1, get headers only; if 2, get bodies only */
+int quiet = 0;          /* if 1, don't give Reading new newsgroups failed msg */
 
 static jmp_buf jmpbuffer ;
 
@@ -116,13 +117,14 @@
 #endif
 
 static void usage( void ) {
-   fprintf( stderr, "Usage: fetchnews [-v] [-x #] [-l] [-n] [-f] [-P]\n"
+   fprintf( stderr, "Usage: fetchnews [-v] [-x #] [-l] [-n] [-f] [-P] [-q]\n"
                     "  -v: more verbose (may be repeated)\n"
                     "  -x: check for # extra articles in each group\n"
                     "  -l: do not use supplementary servers\n"
                     "  -n: do not automatically expire unread groups\n"
 		    "  -f: force reload of groupinfo file\n"
 		    "  -P: only post outgoing articles, don't fetch any\n"
+		    "  -q: do not give Reading new newsgroups failed message\n"
 		    );
 }
 
@@ -1088,8 +1090,10 @@
 	sprintf( lineout, "NEWGROUPS %s GMT\r\n", timestr );
 	putaline();
 	if ( nntpreply() != 231 ) {
-	    printf( "Reading new newsgroups failed.\n" );
-	    syslog( LOG_ERR, "Reading new newsgroups failed" );
+            if (! quiet) {
+               printf( "Reading new newsgroups failed.\n" );
+               syslog( LOG_ERR, "Reading new newsgroups failed" );
+            }
 	    return;
 	}
 	while ( (l=getaline(nntpin)) && ( *l != '.' ) ) {
@@ -1528,7 +1532,7 @@
     openlog( "fetchnews", LOG_PID|LOG_CONS, LOG_NEWS );
 #endif
 
-    while ( (option=getopt( argc, argv, "Pflnvx:" )) != -1 ) {
+    while ( (option=getopt( argc, argv, "qPflnvx:" )) != -1 ) {
 	if ( option == 'v' ) {
 	    verbose++;
 	} else if ( option == 'x' ) {
@@ -1548,7 +1552,9 @@
 	    forceactive = 1;
 	} else if ( option == 'P' ) {
 	    postonly = 1;
-	} else {
+	} else if (option == 'q' ) {
+          quiet = 1;
+        } else {
 	    usage();
 	    exit( 1 );
 	}


-- 
Andrey V Khavryuchenko          http://kds.com.ua/
Offshore Software Development   http://kds.com.ua/akhavr

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list