]> granicus.if.org Git - php/commitdiff
MFH
authorGreg Beaver <cellog@php.net>
Tue, 8 Jun 2004 17:56:45 +0000 (17:56 +0000)
committerGreg Beaver <cellog@php.net>
Tue, 8 Jun 2004 17:56:45 +0000 (17:56 +0000)
fix bug #1158
fix bug #1153

pear/scripts/pear.bat
pear/scripts/pearcmd.php

index 21605eee9796f4b3dc779a607d00f111edec818d..2b30f8162a985b38ffef8df322287f60c4db6e33 100755 (executable)
@@ -64,6 +64,6 @@ ECHO The current value is:
 ECHO %PHP_PEAR_PHP_BIN%\r
 GOTO END\r
 :RUN\r
-"%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\r
+"%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\r
 :END\r
 @ECHO ON\r
index af3e447bcf1bd7cc63bf0de5800d4d005d8f3220..b1938378191302eb925cf67fe4565de3f90e19e6 100644 (file)
@@ -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'";
 }
 
 // }}}