40 lines
1.5 KiB
Text
40 lines
1.5 KiB
Text
|
--- dsirc.orig 1998-03-10 04:55:50.000000000 -0800
|
||
|
+++ dsirc 2009-03-06 00:15:29.000000000 -0800
|
||
|
@@ -162,7 +162,7 @@
|
||
|
local($fh, $host, $port)=@_;
|
||
|
local($adr, $otherend)=&resolve($host);
|
||
|
&tell("*\cbE\cb* Hostname `$host' not found"), return 0 unless $adr;
|
||
|
- $otherend=pack("S n a4 x8", &AF_INET, $port, $adr);
|
||
|
+ $otherend=pack_sockaddr_in($port, $adr);
|
||
|
&print("*\cbE\cb* Out of file descriptors"), return 0
|
||
|
unless socket($fh, &PF_INET, &SOCK_STREAM, 0);
|
||
|
if ($set{"LOCALHOST"}) {
|
||
|
@@ -174,7 +174,7 @@
|
||
|
&print("*\cbE\cb* Can't connect to host: $!"), close $fh,
|
||
|
$SIG{'QUIT'}='IGNORE', return 0 unless connect($fh, $otherend);
|
||
|
$SIG{'QUIT'}='IGNORE';
|
||
|
- $bindaddr=(unpack("S n a4", getsockname($fh)))[2] if !$bindaddr;
|
||
|
+ $bindaddr=(unpack_sockaddr_in(getsockname($fh)))[2] if !$bindaddr;
|
||
|
select($fh); $|=1; select(STDOUT);
|
||
|
return 1;
|
||
|
}
|
||
|
@@ -183,15 +183,15 @@
|
||
|
$_[0]=&newfh;
|
||
|
local($fh, $port)=@_;
|
||
|
local($thisend);
|
||
|
- $bindaddr=pack("x4", 0) unless $bindaddr;
|
||
|
- $thisend=pack("S n a4 x8", &AF_INET, $port+0, $bindaddr);
|
||
|
+ $bindaddr=pack_sockaddr_in(0, 0) unless $bindaddr;
|
||
|
+ $thisend=pack_sockaddr_in($port+0, $bindaddr);
|
||
|
&tell("*\cbE\cb* Out of file descriptors"), return 0
|
||
|
unless socket($fh, &PF_INET, &SOCK_STREAM, 0);
|
||
|
&tell("*\cbE\cb* Can't bind local socket!"), close $fh, return 0
|
||
|
unless bind($fh, $thisend);
|
||
|
&tell("*\cbE\cb* Can't listen to socket!"), close $fh, return
|
||
|
unless listen($fh, 5);
|
||
|
- return (unpack("S n", getsockname($fh)))[1];
|
||
|
+ return (unpack_sockaddr_in(getsockname($fh)))[1];
|
||
|
}
|
||
|
|
||
|
sub accept {
|