🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
4 messages
4 total messages Started by Steve Rawlinson Wed, 17 Dec 2003 15:43
INN: script to tell you which feeds will get a group?
#67456
Author: Steve Rawlinson
Date: Wed, 17 Dec 2003 15:43
11 lines
1396 bytes
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'm going to write one if there isnt, but thought I'd ask first.

The reason I'm asking is that we split our spool by hierarchy onto
multiple reader boxes and I want to check we're not duplicating
any part of the feed by passing the active file through such a 
script.

steve
Re: INN: script to tell you which feeds will get a group?
#67463
Author: Steve Rawlinson
Date: Thu, 18 Dec 2003 13:51
6 lines
1301 bytes
>  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 ;)

steve
Re: INN: script to tell you which feeds will get a group?
#67464
Author: Russ Allbery
Date: Thu, 18 Dec 2003 18:11
14 lines
1742 bytes
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.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: INN: script to tell you which feeds will get a group?
#67514
Author: Kai Henningsen
Date: Mon, 22 Dec 2003 11:37
73 lines
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)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads