leafnode  1.12.0
About: Leafnode is a store & forward NNTP proxy for small (dialup) sites.
  Fossies Dox: leafnode-1.12.0.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

newsq.pl
Go to the documentation of this file.
1#!/usr/bin/perl
2
3$spooldir = "/var/spool/news";
4
5undef $/;
6if ( chdir "$spooldir/out.going" && opendir( DIR, "." ) ) {
7 @files = readdir( DIR );
8 closedir( DIR );
9
10 foreach (@files) {
11 if ( open(F, "< $_") ) {
12 undef $subject, $newsgroups, $from;
13 $_ = <F>;
14 close F;
15 s/\n\n.*//s;
16 s/\r//gs;
17 s/\n\s+/ /sg;
18 foreach ( split( /\n/, $_ ) ) {
19 $subject = $1 if ( /^Subject:\s+(.*)/i );
20 $newsgroups = $1 if ( /^Newsgroups:\s+(.*)/i );
21 $from = $1 if ( /^From:\s+(.*)/i );
22 }
23 print $from, " in ", $newsgroups, "\n\t", $subject, "\n",
24 if ( $subject ne "" && $from ne "" && $newsgroups ne "" );
25 }
26 }
27}