...
[xonotic/netradiant.git] / tools / quake3 / q3map2 / listen.pl
index 200013606e5c3b3da8939e7496916c4013de513e..6101a76723d85d8296de475f1cc44e8169c282bc 100644 (file)
@@ -1,46 +1,46 @@
-#!/usr/bin/perl -w \r
-\r
-use IO::Socket;  \r
-use Net::hostent; \r
-\r
-my $port = shift || 13131; \r
-\r
-my $server = IO::Socket::INET->new(\r
-       Proto => 'tcp', \r
-       LocalPort => $port, \r
-       Listen => SOMAXCONN, \r
-       Reuse => 1 )\r
-       || die "can't setup server"; \r
-print "[Q3Map2 listener $0 is now active on port $port]\n"; \r
-\r
-while( $client = $server->accept() )\r
-{ \r
-\r
-       $client->autoflush( 1 ); \r
-       \r
-       $hostinfo = gethostbyaddr( $client->peeraddr );\r
-       printf "[Connect from %s]\n\n", $hostinfo ? $hostinfo->name : $client->peerhost; \r
-       \r
-       #ask the client for a command \r
-       print $client "[server]\$";\r
-       my $text = "";\r
-       while( <$client> )\r
-       {\r
-               $text .= $_;\r
-               while( $text =~ s|<message[^>]*>([^<]+)</message>|| )\r
-               {\r
-                       my $msg = $1;\r
-                       \r
-                       # fix xml ents\r
-                       $msg =~ s|&lt;|<|g;\r
-                       $msg =~ s|&gt;|>|g;\r
-                       $msg =~ s|&quot;|"|g;#"\r
-                       $msg =~ s|&apos;|'|g;#'\r
-               \r
-                       print $msg;\r
-               }\r
-       }\r
-       \r
-       printf "\n[Disconnected: %s]\n\n", $hostinfo ? $hostinfo->name : $client->peerhost; \r
-       close $client;\r
-} \r
+#!/usr/bin/perl -w 
+
+use IO::Socket;  
+use Net::hostent; 
+
+my $port = shift || 13131; 
+
+my $server = IO::Socket::INET->new(
+       Proto => 'tcp', 
+       LocalPort => $port, 
+       Listen => SOMAXCONN, 
+       Reuse => 1 )
+       || die "can't setup server"; 
+print "[Q3Map2 listener $0 is now active on port $port]\n"; 
+
+while( $client = $server->accept() )
+{ 
+
+       $client->autoflush( 1 ); 
+       
+       $hostinfo = gethostbyaddr( $client->peeraddr );
+       printf "[Connect from %s]\n\n", $hostinfo ? $hostinfo->name : $client->peerhost; 
+       
+       #ask the client for a command 
+       print $client "[server]\$";
+       my $text = "";
+       while( <$client> )
+       {
+               $text .= $_;
+               while( $text =~ s|<message[^>]*>([^<]+)</message>|| )
+               {
+                       my $msg = $1;
+                       
+                       # fix xml ents
+                       $msg =~ s|&lt;|<|g;
+                       $msg =~ s|&gt;|>|g;
+                       $msg =~ s|&quot;|"|g;#"
+                       $msg =~ s|&apos;|'|g;#'
+               
+                       print $msg;
+               }
+       }
+       
+       printf "\n[Disconnected: %s]\n\n", $hostinfo ? $hostinfo->name : $client->peerhost; 
+       close $client;
+}