|
|
|
@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|
?>
|