summaryrefslogtreecommitdiff
path: root/pear
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2002-10-12 14:17:44 +0000
committerStig Bakken <ssb@php.net>2002-10-12 14:17:44 +0000
commit846ad56a1390805aff2a0105c4990f3baf27606e (patch)
tree80a19a347d8ba2a7889a1e28a948f0c0f828dfa4 /pear
parentc0c85a8c770916d00e98659503fc1bdf3c1fd70a (diff)
downloadphp-git-846ad56a1390805aff2a0105c4990f3baf27606e.tar.gz
* rename System::type to System::which
Diffstat (limited to 'pear')
-rw-r--r--pear/System.php8
-rw-r--r--pear/tests/pear_system.phpt10
2 files changed, 9 insertions, 9 deletions
diff --git a/pear/System.php b/pear/System.php
index 9808233cb9..712819d059 100644
--- a/pear/System.php
+++ b/pear/System.php
@@ -411,17 +411,17 @@ class System
}
/**
- * The "type" command (show the full path of a command)
+ * The "which" command (show the full path of a command)
*
* @param string $program The command to search for
* @return mixed A string with the full path or false if not found
* @author Stig Bakken <ssb@fast.no>
*/
- function type($program)
+ function which($program, $fallback = false)
{
// full path given
if (basename($program) != $program) {
- return (@is_executable($program)) ? $program : false;
+ return (@is_executable($program)) ? $program : $fallback;
}
// XXX FIXME honor safe mode
$path_delim = OS_WINDOWS ? ';' : ':';
@@ -433,7 +433,7 @@ class System
return $file;
}
}
- return false;
+ return $fallback;
}
}
?> \ No newline at end of file
diff --git a/pear/tests/pear_system.phpt b/pear/tests/pear_system.phpt
index 3c8e3371b5..eb73323d69 100644
--- a/pear/tests/pear_system.phpt
+++ b/pear/tests/pear_system.phpt
@@ -72,15 +72,15 @@ if (!@System::rm("-r $del")) {
}
/*******************
- type
+ which
********************/
if (OS_UNIX) {
- if (System::type('ls') != '/bin/ls') {
- print "System::type('ls') failed\n";
+ if (System::which('ls') != '/bin/ls') {
+ print "System::which('ls') failed\n";
}
- if (System::type('i_am_not_a_command')) {
- print "System::type('i_am_not_a_command') did not failed\n";
+ if (System::which('i_am_not_a_command')) {
+ print "System::which('i_am_not_a_command') did not failed\n";
}
} // XXX Windows test