12 Usage: $0 hostname newsgroup-name archive-directory
21 print STDERR "$msg\n";
25 my $host = shift or usage;
26 my $group = shift or usage;
27 my $archive = shift or usage;
30 opendir ARCHIVE, $archive or die "can't opendir $archive: $!";
31 my @list = grep m/^\d+$/, readdir ARCHIVE;
34 @list = sort { $a <=> $b } @list;
35 my $start = scalar @list ? $list[$#list] + 1 : 0;
37 $nntp = Net::NNTP->new($host);
38 # Bah, password in clear, oh well, it's only passworded to keep the
39 # howling masses out anyway ...
40 #$nntp->authinfo('afe', 'MyTest');
42 my ($narticles, $first, $last, $name) = $nntp->group($group);
43 (defined $first and defined $last) or bail "Couldn't set group to $group";
45 exit if $last <= $start;
46 $start = $first if $first > $start;
48 for my $index ($start..$last)
50 my $article = $nntp->article($index);
53 open ARTICLE, ">$archive/$index"
54 or die "can't open $archive/$index for writing: $!";
55 print ARTICLE join '', @$article;
58 #print STDERR "$group $index\n";