diff src/noffle.c @ 208:61a0f1e13916 noffle

[svn] see Changelog Nov 14 2001, mirko liss
author mirkol
date Wed, 14 Nov 2001 20:22:22 +0000
parents b9ef99708d1c
children beb6525f8b44
line wrap: on
line diff
--- a/src/noffle.c	Wed Nov 14 11:14:09 2001 +0000
+++ b/src/noffle.c	Wed Nov 14 20:22:22 2001 +0000
@@ -10,7 +10,7 @@
   received for some seconds (to allow multiple clients connect at the same
   time).
 
-  $Id: noffle.c 311 2001-10-21 11:00:12Z bears $
+  $Id: noffle.c 327 2001-11-14 20:22:22Z mirkol $
 */
 
 #if HAVE_CONFIG_H
@@ -45,6 +45,7 @@
 #include "request.h"
 #include "lock.h"
 #include "portable.h"
+#include "wildmat.h"
 
 struct Noffle
 {
@@ -52,7 +53,8 @@
     Bool queryDsc;
     Bool queryTimes;
     Bool lockAtStartup;
-} noffle = { FALSE, FALSE, FALSE, TRUE };
+    char *serverPattern;
+} noffle = { FALSE, FALSE, FALSE, TRUE, NULL };
 
 static void
 doArt( const char *msgId )
@@ -160,24 +162,26 @@
     
     Cfg_beginServEnum();
     while ( Cfg_nextServ( serv ) )
-        if ( Fetch_init( serv ) )
-        {
-	    Bool connOK;
+        if ( ! noffle.serverPattern 
+                || Wld_match( serv, noffle.serverPattern ) )
+            if ( Fetch_init( serv ) )
+            {
+	        Bool connOK;
 	    
-            connOK = Fetch_postArts();
+                connOK = Fetch_postArts();
 
-            connOK = connOK && Fetch_getNewGrps();
+                connOK = connOK && Fetch_getNewGrps();
 
             /* Get overviews of new articles and store IDs of new articles
                that are to be fetched becase of FULL or THREAD mode in the
                request database. */
-            connOK = connOK && Fetch_updateGrps();         
+                connOK = connOK && Fetch_updateGrps();         
 
             /* get requested articles */
-            connOK = connOK && Fetch_getReq_();
+                connOK = connOK && Fetch_getReq_();
 
-            Fetch_close();
-        }
+                Fetch_close();
+            }
 
     Lock_releaseFetchLock();
 }
@@ -215,16 +219,18 @@
 
     Cfg_beginServEnum();
     while ( Cfg_nextServ( serv ) )
-        if ( Fetch_init( serv ) )
-        {
-	    int stat = STAT_OK;
+        if ( ! noffle.serverPattern 
+                || Wld_match( serv, noffle.serverPattern ) )
+            if ( Fetch_init( serv ) )
+            {
+	        int stat = STAT_OK;
 	    
-            if ( noffle.queryGrps )
-                stat = Client_getGrps();
-            if ( stat == STAT_OK && noffle.queryDsc )
-                Client_getDsc();
-            Fetch_close();
-        }
+                if ( noffle.queryGrps )
+                    stat = Client_getGrps();
+                if ( stat == STAT_OK && noffle.queryDsc )
+                    Client_getDsc();
+                Fetch_close();
+            }
 }
 
 /* Expire all overviews not in database */
@@ -542,7 +548,7 @@
       " -d | --database                  Show content of article database\n"
       " -D | --delete <grp>              Delete a group\n"
       " -e | --expire                    Expire articles\n"
-      " -f | --fetch                     Get newsfeed from server/post articles\n"
+      " -f | --fetch [server]            Get newsfeed from server/post articles\n"
       " -g | --groups                    Show all groups available at server\n"
       " -h | --help                      Show this text\n"
       " -l | --list                      List groups on fetch list\n"
@@ -551,8 +557,8 @@
       " -n | --online                    Switch to online mode\n"
       " -o | --offline                   Switch to offline mode\n"
       " -p | --post                      Post article on stdin\n"
-      " -q | --query groups              Get group list from server\n"
-      " -q | --query desc                Get group descriptions from server\n"
+      " -q | --query groups [server]     Get group list from server\n"
+      " -q | --query desc [server]       Get group descriptions from server\n"
       " -r | --server                    Run as server on stdin/stdout\n"
       " -R | --requested                 List articles marked for download\n"
       " -s | --subscribe-over <grp>      Add group to fetch list (overview)\n"
@@ -876,6 +882,7 @@
 	doExpire();
 	break;
     case 'f':
+        noffle.serverPattern = *argv;
         doFetch();
         break;
     case 'g':
@@ -931,6 +938,9 @@
                 fprintf( stderr, "Unknown argument -q %s\n", *argv );
                 result = EXIT_FAILURE;
             }
+            argv++;
+            argc--;
+            noffle.serverPattern = *argv;
             doQuery();
         }
         break;