Article View: news.software.nntp
Article #67514Re: INN: script to tell you which feeds will get a group?
From: Kai Henningsen
Date: Mon, 22 Dec 2003 11:37
Date: Mon, 22 Dec 2003 11:37
73 lines
3147 bytes
3147 bytes
rra@stanford.edu (Russ Allbery) wrote on 18.12.03 in <87wu8uxafu.fsf@windlord.stanford.edu>:
> Steve Rawlinson <steve@clara.net> writes:
>
> >> Is there an easy (non-manual) way to determine which feeds will get
> >> an article in a particular group according to your newsfeeds file?
>
> > I guess not ;)
>
> Unfortunately, no.
It's trivial to do, though. I use the following "wfilter.c" in some GUP
support scripts (written for a previous INN version, but if there's any
incompatibility it's easy enough to fix).
You give it three arguments - one file of patterns (one per line), one
file of groups (one per line), and an output file for those groups that
matched. Or do your own logic instead - as you see, it's easy.
"wildmat.c" is, of course, from the INN sources.
Code is in the public domain.
#include "wildmat.c"
#include <assert.h>
#include <stdio.h>
#include <string.h>
FILE *pat, *lst, *out;
char buf[300];
char *pats[10000];
int nxt, i, ok;
main(int argc, char *argv[])
{
assert(argc == 4);
assert(pat = fopen(argv[1], "r"));
while ( !feof(pat) ) {
fgets(buf, sizeof(buf), pat);
if ( buf[strlen(buf)-1] == '\n' )
buf[strlen(buf)-1] = '\0';
pats[nxt++] = strdup(buf);
}
fclose(pat);
assert(lst = fopen(argv[2], "r"));
assert(out = fopen(argv[3], "w"));
while ( !feof(lst) ) {
fgets(buf, sizeof(buf), lst);
if ( buf[strlen(buf)-1] == '\n' )
buf[strlen(buf)-1] = '\0';
ok = 0;
for (i=0; i<nxt; i++) {
if (pats[i][0] == '!') {
if (ok) ok = ! wildmat(buf, pats[i]+1);
}
else {
if (!ok) ok = wildmat(buf, pats[i]);
}
}
if (ok)
fprintf(out, "%s\n", buf);
}
fclose(lst);
fclose(out);
}
Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
- Russ Allbery (rra@stanford.edu)
Technical Details
Message-ID:
<8-KAznZmw-B@khms.westfalen.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp-relay.ihug.net!ihug.co.nz!logbridge.uoregon.edu!hammer.uoregon.edu!news.litech.org!colo.khms.westfalen.de!news.khms.westfalen.de!khms.westfalen.de!kaihReferences:
<slrnbu0u5t.1bi.steve@hurricane.noc.clara.net> <slrnbu3c74.2o3.steve@hurricane.noc.clara.net> <87wu8uxafu.fsf@windlord.stanford.edu>Show Full Headers
Complete Article Headers
Message-ID: <8-KAznZmw-B@khms.westfalen.de> Subject: Re: INN: script to tell you which feeds will get a group? Date: Mon, 22 Dec 2003 11:37:00 +0000 From: kaih=8-KAznZmw-B@khms.westfalen.de (Kai Henningsen) References: <slrnbu0u5t.1bi.steve@hurricane.noc.clara.net> <slrnbu3c74.2o3.steve@hurricane.noc.clara.net> <87wu8uxafu.fsf@windlord.stanford.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp-relay.ihug.net!ihug.co.nz!logbridge.uoregon.edu!hammer.uoregon.edu!news.litech.org!colo.khms.westfalen.de!news.khms.westfalen.de!khms.westfalen.de!kaih Newsgroups: news.software.nntp X-Newsreader: CrossPoint v3.12d.kh12 R/C435 Organization: Organisation? Me?! Are you kidding? Lines: 73 X-No-Junk-Mail: I do not want to get *any* junk mail. Comment: Unsolicited commercial mail will incur an US$100 handling fee per received mail. X-Fix-Your-Modem: +++ATS2=255&WO1