use Msg;
use DXVars;
+use Carp;
$mode = 2; # 1 - \n = \r as EOL, 2 - \n = \n, 0 - transparent
$call = ""; # the callsign being used
if (defined $conn && $sendz) {
$conn->send_now("Z$call|bye...\n");
}
+ STDOUT->flush;
+ sleep(2);
exit(0);
}
if ($mode) {
$buf =~ s/\r/\n/og if $mode == 1;
$dangle = !($buf =~ /\n$/);
- @lines = split /\n/, $buf;
+ if ($buf eq "\n") {
+ @lines = (" ");
+ } else {
+ @lines = split /\n/, $buf;
+ }
if ($dangle) { # pull off any dangly bits
$buf = pop @lines;
} else {
$SIG{'CHLD'} = \&sig_chld;
$conn = Msg->connect("$clusteraddr", $clusterport, \&rec_socket);
+if (! $conn) {
+ if (-r "$data/offline") {
+ open IN, "$data/offline" or die;
+ while (<IN>) {
+ s/\n/\r/og if $mode == 1;
+ print;
+ }
+ close IN;
+ } else {
+ print "Sorry, the cluster $mycall is currently off-line", $mynl;
+ }
+ cease(0);
+}
+
$conn->send_now("A$call|$connsort");
Msg->set_event_handler(\*STDIN, "read" => \&rec_stdin);