Mercurial > noffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
207:79f845db4897 | 208:61a0f1e13916 |
---|---|
8 not as server. If noffle runs as server, locking is performed while | 8 not as server. If noffle runs as server, locking is performed while |
9 executing NNTP commands, but temporarily released if no new command is | 9 executing NNTP commands, but temporarily released if no new command is |
10 received for some seconds (to allow multiple clients connect at the same | 10 received for some seconds (to allow multiple clients connect at the same |
11 time). | 11 time). |
12 | 12 |
13 $Id: noffle.c 311 2001-10-21 11:00:12Z bears $ | 13 $Id: noffle.c 327 2001-11-14 20:22:22Z mirkol $ |
14 */ | 14 */ |
15 | 15 |
16 #if HAVE_CONFIG_H | 16 #if HAVE_CONFIG_H |
17 #include <config.h> | 17 #include <config.h> |
18 #endif | 18 #endif |
43 #include "util.h" | 43 #include "util.h" |
44 #include "server.h" | 44 #include "server.h" |
45 #include "request.h" | 45 #include "request.h" |
46 #include "lock.h" | 46 #include "lock.h" |
47 #include "portable.h" | 47 #include "portable.h" |
48 #include "wildmat.h" | |
48 | 49 |
49 struct Noffle | 50 struct Noffle |
50 { | 51 { |
51 Bool queryGrps; | 52 Bool queryGrps; |
52 Bool queryDsc; | 53 Bool queryDsc; |
53 Bool queryTimes; | 54 Bool queryTimes; |
54 Bool lockAtStartup; | 55 Bool lockAtStartup; |
55 } noffle = { FALSE, FALSE, FALSE, TRUE }; | 56 char *serverPattern; |
57 } noffle = { FALSE, FALSE, FALSE, TRUE, NULL }; | |
56 | 58 |
57 static void | 59 static void |
58 doArt( const char *msgId ) | 60 doArt( const char *msgId ) |
59 { | 61 { |
60 const char *id; | 62 const char *id; |
158 return; | 160 return; |
159 } | 161 } |
160 | 162 |
161 Cfg_beginServEnum(); | 163 Cfg_beginServEnum(); |
162 while ( Cfg_nextServ( serv ) ) | 164 while ( Cfg_nextServ( serv ) ) |
163 if ( Fetch_init( serv ) ) | 165 if ( ! noffle.serverPattern |
164 { | 166 || Wld_match( serv, noffle.serverPattern ) ) |
165 Bool connOK; | 167 if ( Fetch_init( serv ) ) |
168 { | |
169 Bool connOK; | |
166 | 170 |
167 connOK = Fetch_postArts(); | 171 connOK = Fetch_postArts(); |
168 | 172 |
169 connOK = connOK && Fetch_getNewGrps(); | 173 connOK = connOK && Fetch_getNewGrps(); |
170 | 174 |
171 /* Get overviews of new articles and store IDs of new articles | 175 /* Get overviews of new articles and store IDs of new articles |
172 that are to be fetched becase of FULL or THREAD mode in the | 176 that are to be fetched becase of FULL or THREAD mode in the |
173 request database. */ | 177 request database. */ |
174 connOK = connOK && Fetch_updateGrps(); | 178 connOK = connOK && Fetch_updateGrps(); |
175 | 179 |
176 /* get requested articles */ | 180 /* get requested articles */ |
177 connOK = connOK && Fetch_getReq_(); | 181 connOK = connOK && Fetch_getReq_(); |
178 | 182 |
179 Fetch_close(); | 183 Fetch_close(); |
180 } | 184 } |
181 | 185 |
182 Lock_releaseFetchLock(); | 186 Lock_releaseFetchLock(); |
183 } | 187 } |
184 | 188 |
185 static Bool | 189 static Bool |
213 { | 217 { |
214 Str serv; | 218 Str serv; |
215 | 219 |
216 Cfg_beginServEnum(); | 220 Cfg_beginServEnum(); |
217 while ( Cfg_nextServ( serv ) ) | 221 while ( Cfg_nextServ( serv ) ) |
218 if ( Fetch_init( serv ) ) | 222 if ( ! noffle.serverPattern |
219 { | 223 || Wld_match( serv, noffle.serverPattern ) ) |
220 int stat = STAT_OK; | 224 if ( Fetch_init( serv ) ) |
225 { | |
226 int stat = STAT_OK; | |
221 | 227 |
222 if ( noffle.queryGrps ) | 228 if ( noffle.queryGrps ) |
223 stat = Client_getGrps(); | 229 stat = Client_getGrps(); |
224 if ( stat == STAT_OK && noffle.queryDsc ) | 230 if ( stat == STAT_OK && noffle.queryDsc ) |
225 Client_getDsc(); | 231 Client_getDsc(); |
226 Fetch_close(); | 232 Fetch_close(); |
227 } | 233 } |
228 } | 234 } |
229 | 235 |
230 /* Expire all overviews not in database */ | 236 /* Expire all overviews not in database */ |
231 static void | 237 static void |
232 expireContents( void ) | 238 expireContents( void ) |
540 " -c | --cancel <msg id> Remove article from database\n" | 546 " -c | --cancel <msg id> Remove article from database\n" |
541 " -C | --create <grp> Create a local group\n" | 547 " -C | --create <grp> Create a local group\n" |
542 " -d | --database Show content of article database\n" | 548 " -d | --database Show content of article database\n" |
543 " -D | --delete <grp> Delete a group\n" | 549 " -D | --delete <grp> Delete a group\n" |
544 " -e | --expire Expire articles\n" | 550 " -e | --expire Expire articles\n" |
545 " -f | --fetch Get newsfeed from server/post articles\n" | 551 " -f | --fetch [server] Get newsfeed from server/post articles\n" |
546 " -g | --groups Show all groups available at server\n" | 552 " -g | --groups Show all groups available at server\n" |
547 " -h | --help Show this text\n" | 553 " -h | --help Show this text\n" |
548 " -l | --list List groups on fetch list\n" | 554 " -l | --list List groups on fetch list\n" |
549 " -m | --modify desc <grp> <desc> Modify a group description\n" | 555 " -m | --modify desc <grp> <desc> Modify a group description\n" |
550 " -m | --modify post <grp> (y|n) Modify posting status of a local group\n" | 556 " -m | --modify post <grp> (y|n) Modify posting status of a local group\n" |
551 " -n | --online Switch to online mode\n" | 557 " -n | --online Switch to online mode\n" |
552 " -o | --offline Switch to offline mode\n" | 558 " -o | --offline Switch to offline mode\n" |
553 " -p | --post Post article on stdin\n" | 559 " -p | --post Post article on stdin\n" |
554 " -q | --query groups Get group list from server\n" | 560 " -q | --query groups [server] Get group list from server\n" |
555 " -q | --query desc Get group descriptions from server\n" | 561 " -q | --query desc [server] Get group descriptions from server\n" |
556 " -r | --server Run as server on stdin/stdout\n" | 562 " -r | --server Run as server on stdin/stdout\n" |
557 " -R | --requested List articles marked for download\n" | 563 " -R | --requested List articles marked for download\n" |
558 " -s | --subscribe-over <grp> Add group to fetch list (overview)\n" | 564 " -s | --subscribe-over <grp> Add group to fetch list (overview)\n" |
559 " -S | --subscribe-full <grp> Add group to fetch list (full)\n" | 565 " -S | --subscribe-full <grp> Add group to fetch list (full)\n" |
560 " -t | --subscribe-thread <grp> Add group to fetch list (thread)\n" | 566 " -t | --subscribe-thread <grp> Add group to fetch list (thread)\n" |
874 break; | 880 break; |
875 case 'e': | 881 case 'e': |
876 doExpire(); | 882 doExpire(); |
877 break; | 883 break; |
878 case 'f': | 884 case 'f': |
885 noffle.serverPattern = *argv; | |
879 doFetch(); | 886 doFetch(); |
880 break; | 887 break; |
881 case 'g': | 888 case 'g': |
882 doGrps(); | 889 doGrps(); |
883 break; | 890 break; |
929 else | 936 else |
930 { | 937 { |
931 fprintf( stderr, "Unknown argument -q %s\n", *argv ); | 938 fprintf( stderr, "Unknown argument -q %s\n", *argv ); |
932 result = EXIT_FAILURE; | 939 result = EXIT_FAILURE; |
933 } | 940 } |
941 argv++; | |
942 argc--; | |
943 noffle.serverPattern = *argv; | |
934 doQuery(); | 944 doQuery(); |
935 } | 945 } |
936 break; | 946 break; |
937 case 'r': | 947 case 'r': |
938 Log_inf( "Starting as server" ); | 948 Log_inf( "Starting as server" ); |