From: Greg Beaver Date: Tue, 8 Jun 2004 17:56:45 +0000 (+0000) Subject: MFH X-Git-Tag: php-4.3.9RC1~111 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8afde17995edce74890b4879a1884c461ef66e7;p=php MFH fix bug #1158 fix bug #1153 --- diff --git a/pear/scripts/pear.bat b/pear/scripts/pear.bat index 21605eee97..2b30f8162a 100755 --- a/pear/scripts/pear.bat +++ b/pear/scripts/pear.bat @@ -64,6 +64,6 @@ ECHO The current value is: ECHO %PHP_PEAR_PHP_BIN% GOTO END :RUN -"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d register_argc_argv=On -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 +"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 :END @ECHO ON diff --git a/pear/scripts/pearcmd.php b/pear/scripts/pearcmd.php index af3e447bcf..b193837819 100644 --- a/pear/scripts/pearcmd.php +++ b/pear/scripts/pearcmd.php @@ -48,9 +48,14 @@ PEAR_Command::setFrontendType('CLI'); $all_commands = PEAR_Command::getCommands(); $argv = Console_Getopt::readPHPArgv(); -$progname = basename($argv[0]); -array_shift($argv); -$options = Console_Getopt::getopt2($argv, "c:C:d:D:Gh?sSqu:vV"); +/* $progname = basename($argv[0]); */ +$progname = 'pear'; +if (in_array('getopt2', get_class_methods('Console_Getopt'))) { + array_shift($argv); + $options = Console_Getopt::getopt2($argv, "c:C:d:D:Gh?sSqu:vV"); +} else { + $options = Console_Getopt::getopt($argv, "c:C:d:D:Gh?sSqu:vV"); +} if (PEAR::isError($options)) { usage($options); } @@ -157,8 +162,13 @@ if ($fetype == 'Gtk') { $short_args = $long_args = null; PEAR_Command::getGetoptArgs($command, $short_args, $long_args); - array_shift($options[1]); - if (PEAR::isError($tmp = Console_Getopt::getopt2($options[1], $short_args, $long_args))) { + if (in_array('getopt2', get_class_methods('Console_Getopt'))) { + array_shift($options[1]); + $tmp = Console_Getopt::getopt2($options[1], $short_args, $long_args); + } else { + $tmp = Console_Getopt::getopt($options[1], $short_args, $long_args); + } + if (PEAR::isError($tmp)) { break; } list($tmpopt, $params) = $tmp; @@ -260,7 +270,7 @@ function cmdHelp($command) return "$progname $command [options] $help[0]\n$help[1]"; } } - return "No such command"; + return "Command '$command' is not valid, try 'pear help'"; } // }}}