Re: Patch to Net_Ping

From: Date: Thu, 08 Aug 2002 11:39:12 +0000
Subject: Re: Patch to Net_Ping
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-8239@lists.php.net to get a copy of this message
Hi, On Thu, Aug 08, 2002 at 01:12:52PM +0300, Mika Tuupola wrote: > > Tested the patched class with Solaris 8 and bc with a Linux. > If no-one objects I'll commit this one later. > > > -- > Mika Tuupola > http://www.appelsiini.net/~tuupola/ > Index: Ping.php > =================================================================== > RCS file: /repository/pear/Net_Ping/Ping.php,v > retrieving revision 1.14 > diff -u -r1.14 Ping.php > --- Ping.php 27 May 2002 19:07:38 -0000 1.14 > +++ Ping.php 8 Aug 2002 09:53:44 -0000 > @@ -193,26 +193,48 @@ > > switch($this->_sysname) { > > + case "sunos": > + if ($size || $count) { > + /* $size and $count must be _both_ defined */ > + $seq = " -s "; > + if ($size == "") { > + $size = " 56 "; > + } > + if ($count == "") { > + $count = " 5 "; > + } > + } > + $retval[0] = $seq.$ttl; > + $retval[1] = $size.$count; > + break; > + > case "freebsd": > - return $quiet.$count.$ttl.$timeout; > + $retval[0] = $quiet.$count.$ttl.$timeout; > + $retval[1] = ""; > break; > > case "netbsd": > - return $quiet.$count.$iface.$size.$ttl.$timeout; > + $retval[0] = $quiet.$count.$iface.$size.$ttl.$timeout; > + $retval[1] = ""; > break; > > case "linux": > - return $quiet.$count.$ttl.$size.$timeout; > + $retval[0] = $quiet.$count.$ttl.$size.$timeout; > + $retval[1] = ""; > break; > > case "windows": > - return $count.$ttl.$timeout; > + $retval[0] = $count.$ttl.$timeout; > + $retval[1] = ""; > break; > > default: > - return ""; > + $retval[0] = ""; > + $retval[1] = ""; > break; > } > + > + return($retval); > } > > /** > @@ -226,7 +248,8 @@ > { > > $argList = $this->_createArgList(); > - $cmd = $this->_ping_path." ".$argList." ".$host; > + $cmd = $this->_ping_path." ".$argList[0]." ".$host." > ".$argList[1]; > + print "$cmd"; > exec($cmd, $this->_result); > > if (!is_array($this->_result)) { > @@ -292,6 +315,14 @@ > function _initArgRelation() > { > $this->_argRelation = array( > + "sunos" => array ( > + "timeout" => NULL, > + "ttl" => > "-t", > + "count" => " > ", > + "quiet" => > "-q", > + "size" => " > ", > + "iface" => > "-i" > + ), > "freebsd" => array ( > "timeout" => > "-t", > "ttl" => > "-m", looks fine to me. The only catch I found is that you do not initialize $retval and don't got rid of the $ret initialisation. Jan -- Q: Thank Jan? A: http://geschenke.an.dasmoped.net/ Got an old and spare laptop? Please send me a mail.

« previous php.pear.dev (#8239) next »