- return;
- }
-
- my $NewsConnection = Net::NNTP->new($Config{'NNTPServer'}, Reader => 1) or die "$0: E: Can't connect to news server '$Config{'NNTPServer'}'!\n";
- $NewsConnection->authinfo ($Config{'NNTPUser'}, $Config{'NNTPPass'}) if (defined($Config{'NNTPUser'}));
- $NewsConnection->post();
- $NewsConnection->datasend (@$ArticleR);
- $NewsConnection->dataend();
-
- # Posting failed? Save to ERROR.dat
- if (!$NewsConnection->ok()) {
- open FH, ">>ERROR.dat";
- print FH "\nPosting failed! Saving to ERROR.dat. Response from news server:\n";
- print FH $NewsConnection->code();
- print FH $NewsConnection->message();
- print FH "\n";
- print FH @$ArticleR;
- print FH "-" x 80, "\n";
- close FH;
+ if ($? == 0) {
+ $failure = 0;
+ } else {
+ warn "$0: W: $Options{'s'} exited with status ", ($? >> 8), "\n";
+ $failure = $?;
+ }
+ # post article
+ } else {
+ my $NewsConnection = Net::NNTP->new($Config{'NNTPServer'}, Reader => 1) or die "$0: E: Can't connect to news server '$Config{'NNTPServer'}'!\n";
+ $NewsConnection->authinfo ($Config{'NNTPUser'}, $Config{'NNTPPass'}) if (defined($Config{'NNTPUser'}));
+ $NewsConnection->post();
+ $NewsConnection->datasend (@$ArticleR);
+ $NewsConnection->dataend();
+
+ if ($NewsConnection->ok()) {
+ $failure = 0;
+ # Posting failed? Save to ERROR.dat
+ } else {
+ warn "$0: W: Posting failed!\n";
+ open FH, ">>ERROR.dat";
+ print FH "\nPosting failed! Saving to ERROR.dat. Response from news server:\n";
+ print FH $NewsConnection->code();
+ print FH $NewsConnection->message();
+ print FH "\n";
+ print FH @$ArticleR;
+ print FH "-" x 80, "\n";
+ close FH;
+ }
+ $NewsConnection->quit();