cvs: pear /Net_Ping Ping.php

From: Date: Sat, 25 May 2002 13:37:29 +0000
Subject: cvs: pear /Net_Ping Ping.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4083@lists.php.net to get a copy of this message
jan Sat May 25 09:37:29 2002 EDT Modified files: /pear/Net_Ping Ping.php Log: - adjust $cmd to the differences ping has on different platforms - for now this is FreeBSD, HP-UX and others, but more to come. # a rework of Net_Ping is on my todo now. Index: pear/Net_Ping/Ping.php diff -u pear/Net_Ping/Ping.php:1.9 pear/Net_Ping/Ping.php:1.10 --- pear/Net_Ping/Ping.php:1.9 Wed Apr 10 23:25:57 2002 +++ pear/Net_Ping/Ping.php Sat May 25 09:37:29 2002 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Ping.php,v 1.9 2002/04/11 03:25:57 jon Exp $ +// $Id: Ping.php,v 1.10 2002/05/25 13:37:29 jan Exp $ define('PING_FAILED', 'execution of ping failed'); define('PING_HOST_NOT_FOUND', 'unknown host'); @@ -35,7 +35,7 @@ * ?> * * @author Martin Jansen <mj@php.net> -* @version $Revision: 1.9 $ +* @version $Revision: 1.10 $ * @package Net * @access public */ @@ -68,7 +68,20 @@ function ping($host, $counts = 5, $packet_size = 32, $quiet = false, $maxwait = 10) { $q = $quiet ? '-q' : ''; - $cmd = $this->ping_path." $q -c $counts -s $packet_size -w $maxwait $host"; + switch(exec("uname")) { + + case "FreeBSD": + $cmd = $this->ping_path." $q -c $counts -t $maxwait $host"; + break; + + case "HP-UX": + $cmd = $this->ping_path." $host $packet_size $counts"; + break; + + default: + $cmd = $this->ping_path." $q -c $counts -s $packet_size -w $maxwait $host"; + break; + } exec($cmd, $result);

« previous php.pear.cvs (#4083) next »