[news.newusers.questions] Need to send articles to a new site

dcox@tweety.ssd.kodak.com (Don Cox (253-7121)) (12/15/90)

How do I send all of the articles available in a select newsgroup to
a new site that I just agreed to be a newsfeed for?  I made the
necessary entries in /usr/lib/news/sys, added the nntpsend.sh to
the crontab, but now I want to send all 200 articles in a local
newsgroup to them.  I can (and did) create a file called 
machinename.abc.def.com in /var/spool/news/out.going
and added a line for each article ...  such as:

/usr/spool/news/ours/general/1
/usr/spool/news/ours/general/2
/usr/spool/news/ours/general/3
/usr/spool/news/ours/general/4
/usr/spool/news/ours/general/5
/usr/spool/news/ours/general/6
/usr/spool/news/ours/general/7
/usr/spool/news/ours/general/8
etc.

I tried a wildcard (*) instead of an article number, but it didn't
work.  How does one send hundreds of articles to a site without
typing in hundreds of entries?

Going one step further, I will be supplying all of the Usenet articles
to another site sometime in the near future.  How do I dump everything
that I have down to this site?

Thanks very much.
-- 
                  Don Cox
Phone (716) 253-7121      KMX (716) 253-7998
INTERNET    dcox@ssd.kodak.com
When an eel bites your leg, and the pain makes you beg, that's a moray!

rickert@mp.cs.niu.edu (Neil Rickert) (12/15/90)

In article <1990Dec14.162617.5428@ssd.kodak.com> dcox@tweety.ssd.kodak.com (Don Cox (253-7121)) writes:
>How do I send all of the articles available in a select newsgroup to
>...
>newsgroup to them.  I can (and did) create a file called 
>machinename.abc.def.com in /var/spool/news/out.going
>and added a line for each article ...  such as:
>
>/usr/spool/news/ours/general/1
>/usr/spool/news/ours/general/2
>...
>/usr/spool/news/ours/general/8
>etc.
>
>I tried a wildcard (*) instead of an article number, but it didn't
>work.  How does one send hundreds of articles to a site without
>typing in hundreds of entries?
>
 Using the cshell, I would just do something like:

  foreach article ( [0-9]* )
  echo $cwd/$article >> $batchfile
  end

 Similar command sequences exist for other reasonable shells.

 Combining this with find, and a relatively simple sed filter
you should be able to do the whole news spooling directory with
very little effort.
-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115.                                  +1-815-753-6940

blarson@blars (12/18/90)

In article <1990Dec14.162617.5428@ssd.kodak.com> dcox@tweety.ssd.kodak.com (Don Cox (253-7121)) writes:
>How do I send all of the articles available in a select newsgroup to
>a new site that I just agreed to be a newsfeed for?

Here's a quick & dirty program I wrote to generate a file for use by
the C-News batcher from a "sendgroups" file.  "sendgroups" is like a
simplified .newsrc, each line is newsgroup: <last-article-seen> .
Just put newsgroup: on a new line to add another group.  Crossposted
articles will be sent multiple times, but C news handles this fine.
This does require a couple of routines from the C news library.


#include <stdio.h>
char *index();
char *strsave();

char *progname;

main(argc, argv)
int argc;
char **argv;
{
    FILE *act, *f, *fn;
    int i, l, first, last;
    char line[1024], actline[1024];
    char *cp, *group, *gd;

    progname = argv[0];
    if((act = fopen("/usr/lib/news/active", "r")) == NULL) {
	fprintf(stderr, "Can't open active\n");
	exit(1);
    }
    if((f = fopen("sendgroups", "r")) == NULL) {
	fprintf(stderr, "Can't open sendgroups\n");
	exit(1);
    }
    if((fn = fopen("sendgroups.new", "w")) == NULL) {
	fprintf(stderr, "Can't open sendgroups.new\n");
	exit(1);
    }
    while(fgets(line, 1024, f) != NULL) {
	if((cp = index(line, ':')) != NULL) {
	    l = cp - line;
	    *cp++ = '\0';
	    group = strsave(line);
	    i = atoi(cp) + 1;
	    fseek(act, 0, 0);
	    while(fgets(line, 1024, act) != NULL) {
		if(strncmp(line, group, l) == 0 &&
			(line[l]==' ' || line[l]=='\t')) {
		    sscanf(line, "%*s %d %d\n", &last, &first);
		    if(i <= last) {
		        gd = strsave(group);
			cp = gd;
			while(cp = index(cp, '.')) *cp++ = '/';
			if(i < first) i = first;
		    	for(; i <= last; i++) {
		    	    printf("/usr/spool/news/%s/%d\n", gd, i);
		    	}
			free(gd);
		    }
		    fprintf(fn, "%s: %d\n", group, last);
		    break;
		}
	    }
	    free(group);
	}
    }
    fclose(f);
    fclose(fn);
    rename("sendgroups", "sendgroups.old");
    rename("sendgroups.new", "sendgroups");
}

errunlock()
{
}

-- 
blarson@usc.edu
		C news and rn for os9/68k!
-- 
Bob Larson (blars)	blarson@usc.edu			usc!blarson
	Hiding differences does not make them go away.  Accepting
	differences makes them unimportant.