1. Added RCMD for clx
[spider.git] / perl / client.pl
index f59c5847c09be00f2cb481be4387331899a2a92d..1b6757b48c27c09c63ea7f19f1a4167a50c014d8 100755 (executable)
@@ -108,6 +108,7 @@ sub rec_socket
                        my $snl = $mynl;
                        my $newsavenl = "";
                        $snl = "" if $mode == 0;
+                       $snl = "\r\n" if $mode == 2;
                        if ($mode == 2 && $line =~ />$/) {
                                $newsavenl = $snl;
                                $snl = ' ';
@@ -177,8 +178,9 @@ sub rec_stdin
                cease(1);
        } elsif ($r > 0) {
                if ($mode) {
-                       $buf =~ s/\r/\n/og if $mode == 1;
-                       $buf =~ s/\r\n/\n/og if $mode == 2;
+                       $buf =~ s/\r/\n/g if $mode == 1;
+                       $buf =~ s/[\r\x00]//g if $mode == 2;
+                       
                        $dangle = !($buf =~ /\n$/);
                        if ($buf eq "\n") {
                                @lines = (" ");
@@ -273,16 +275,21 @@ sub dochat
                        if ($csort eq 'telnet') {
                                $line = $sock->get();
                                cease(11) unless $line;          # the socket has gone away?
-                               $line =~ s/\r\n/\n/og;
+                               if (length $line == 0) {
+                                       dbg('connect', "received 0 length line, aborting...");
+                                       cease(11);
+                               }
+                               $line =~ s/\r//g;
                                chomp;
                        } elsif ($csort eq 'ax25' || $csort eq 'prog') {
                                local $/ = "\r";
                                $line = <$rfh>;
-                               $line =~ s/\r//og;
-                       }
-                       if (length $line == 0) {
-                               dbg('connect', "received 0 length line, aborting...");
-                               cease(11);
+                               if (length $line == 0) {
+                                       dbg('connect', "received 0 length line, aborting...");
+                                       cease(11);
+                               }
+                               $line =~ s/\r/\n/g;
+                               chomp;
                        }
                        dbg('connect', "received \"$line\"");
                        if ($abort && $line =~ /$abort/i) {