X-Git-Url: https://code.th-h.de/?p=usenet%2Fyapfaq.git;a=blobdiff_plain;f=yapfaq.pl;h=c36be30b1bb81905fdc59eb2a4e3a8682b8a904d;hp=7313305b2c429a4de7404cf7bb06860c0d6b3aeb;hb=b855559ee3a4f17afc052fdb8edd1b022181eb67;hpb=b9550622451371fce69abe30e66cd338be5c7c1f diff --git a/yapfaq.pl b/yapfaq.pl index 7313305..c36be30 100644 --- a/yapfaq.pl +++ b/yapfaq.pl @@ -60,7 +60,7 @@ my ($TDY, $TDM, $TDD) = Today(); #TD: Today's date # read commandline options my %Options; -getopts('Vhvpdt:f:', \%Options); +getopts('Vhvpdt:f:s:', \%Options); # -V: print version / copyright information if ($Options{'V'}) { print "$0 v $Version\nCopyright (c) 2003 Marc Brockschmidt \nCopyright (c) 2010 Thomas Hochstein \n"; @@ -315,12 +315,20 @@ sub post { # Test mode? if(defined($Options{'t'}) and $Options{'t'} =~ /console/i) { - print "\n-----BEGIN--------------------------------------------------\n"; + print "-----BEGIN--------------------------------------------------\n"; print @$ArticleR; - print "\n------END---------------------------------------------------\n"; + print "------END---------------------------------------------------\n"; return; } + # pipe to script? + if(defined($Options{'s'})) { + open (POST, "| $Options{'s'}") or die "$0: E: Cannot fork $Options{'s'}: $!\n"; + print POST @$ArticleR; + close POST; + return; + } + my $NewsConnection = Net::NNTP->new($NNTPServer, Reader => 1) or die "$0: E: Can't connect to news server '$NNTPServer'!\n"; @@ -517,7 +525,7 @@ yapfaq - Post Usenet FAQs I<(yet another postfaq)> =head1 SYNOPSIS -B [B<-hvpd>] [B<-t> I | CONSOLE] [B<-f> I] +B [B<-hvpd>] [B<-t> I | CONSOLE] [B<-f> I] [B<-s> I] =head1 REQUIREMENTS @@ -760,6 +768,12 @@ will be posted unconditionally. That may not be what you want to achieve, so you can limit the operation of B to the named FAQ only. +=item B<-s> I (pipe to script) + +Instead of posting the article(s) to Usenet pipe them to the external +I on STDIN (which may post the article(s) then). A return +value of 0 will be considered success. + =back =head1 EXAMPLES