cvs: pear /Net_Ping Ping.php
| From: | Mika Tuupola | Date: | Thu, 08 Aug 2002 20:05:19 +0000 |
| Subject: | cvs: pear /Net_Ping Ping.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5641@lists.php.net to get a copy of this message | ||
tuupola Thu Aug 8 16:05:19 2002 EDT
Modified files:
/pear/Net_Ping Ping.php
Log:
* support for native SunOS ping
Index: pear/Net_Ping/Ping.php
diff -u pear/Net_Ping/Ping.php:1.14 pear/Net_Ping/Ping.php:1.15
--- pear/Net_Ping/Ping.php:1.14 Mon May 27 15:07:38 2002
+++ pear/Net_Ping/Ping.php Thu Aug 8 16:05:19 2002
@@ -19,7 +19,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Ping.php,v 1.14 2002/05/27 19:07:38 jan Exp $
+// $Id: Ping.php,v 1.15 2002/08/08 20:05:19 tuupola Exp $
require_once "PEAR.php";
require_once "OS/Guess.php";
@@ -50,7 +50,7 @@
* ?>
*
* @author Martin Jansen <mj@php.net>
-* @version $Revision: 1.14 $
+* @version $Revision: 1.15 $
* @package Net
* @access public
*/
@@ -176,7 +176,7 @@
*/
function _createArgList()
{
- $ret = "";
+ $retval = "";
$timeout = "";
$iface = "";
@@ -184,6 +184,7 @@
$count = "";
$quiet = "";
$size = "";
+ $seq = "";
foreach($this->_args AS $option => $value) {
if(!empty($option) && NULL !=
$this->_argRelation[$this->_sysname][$option]) {
@@ -193,26 +194,48 @@
switch($this->_sysname) {
+ case "sunos":
+ if ($size || $count || $iface) {
+ /* $size and $count must be _both_ defined */
+ $seq = " -s ";
+ if ($size == "") {
+ $size = " 56 ";
+ }
+ if ($count == "") {
+ $count = " 5 ";
+ }
+ }
+ $retval[0] = $iface.$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 +249,7 @@
{
$argList = $this->_createArgList();
- $cmd = $this->_ping_path." ".$argList." ".$host;
+ $cmd = $this->_ping_path." ".$argList[0]." ".$host."
".$argList[1];
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",