X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fclient.pl;h=a5caec450e67b922eeeb7b9807fa8d56d92448da;hb=f77b59f4fcceb428142461972e94345419cbda28;hp=c508d942e90cab67e8d43cc02c599b4cd61a3799;hpb=2e16209416d1d189707935868a708b525c93097b;p=spider.git diff --git a/perl/client.pl b/perl/client.pl index c508d942..a5caec45 100755 --- a/perl/client.pl +++ b/perl/client.pl @@ -9,8 +9,14 @@ # # Copyright (c) 1998 Dirk Koopman G1TLH # +# $Id$ # +BEGIN { + unshift @INC, "/spider/local"; + unshift @INC, "/spider/perl"; +} + use Msg; use DXVars; @@ -19,6 +25,7 @@ $call = ""; # the callsign being used @stdoutq = (); # the queue of stuff to send out to the user $conn = 0; # the connection object for the cluster $lastbit = ""; # the last bit of an incomplete input line +$nl = "\r"; # cease communications sub cease @@ -44,13 +51,12 @@ sub rec_socket cease(1); } if (defined $msg) { - my ($sort, $call, $line) = $msg =~ /^(\w)(\S+)|(.*)$/; + my ($sort, $call, $line) = $msg =~ /^(\w)(\S+)\|(.*)$/; if ($sort eq 'D') { - my $nl = ($mode == 1) ? "\r" : "\n"; $nl = "" if $mode == 0; - $line =~ s/\n/\r/o if $mode == 1; - print $line, $nl; + $line =~ s/\n/\r/og if $mode == 1; + print $line; } elsif ($sort eq 'M') { $mode = $line; # set new mode from cluster } elsif ($sort eq 'Z') { # end, disconnect, go, away ..... @@ -72,7 +78,7 @@ sub rec_stdin # print "sys: $r $buf"; if ($r > 0) { if ($mode) { - $buf =~ s/\r/\n/o if $mode == 1; + $buf =~ s/\r/\n/og if $mode == 1; $dangle = !($buf =~ /\n$/); @lines = split /\n/, $buf; if ($dangle) { # pull off any dangly bits @@ -98,6 +104,11 @@ $call = uc $ARGV[0]; die "client.pl []\r\n" if (!$call); $mode = $ARGV[1] if (@ARGV > 1); +if ($mode != 1) { + $nl = "\n"; + $\ = $nl; +} + select STDOUT; $| = 1; $SIG{'INT'} = \&sig_term;