warn $_[0];
}
+{
+ # If this is set to a defined value, ftp_abort will write the message
+ # here instead of using syslog.
+ our $AbortPipe = undef;
+ # This selects the default exit code, if no code is specified.
+ our $AbortExitCode = 1;
+}
+
sub ftp_abort($;$) {
my $msg = shift;
my $exitcode = shift;
- $exitcode ||= 1;
- ftp_syslog('err', $msg);
+
+ our $AbortExitCode;
+ $exitcode = (defined $exitcode ? $exitcode : $AbortExitCode);
+
+ our $AbortPipe;
+ if (defined $AbortPipe && defined fileno $AbortPipe)
+ { print $AbortPipe $msg, "\n" }
+ else
+ { ftp_syslog('err', $msg) }
+
exit $exitcode;
}