]> granicus.if.org Git - php/commitdiff
use the new Console_Getopt::readPHPArgv() function to read args
authorTomas V.V.Cox <cox@php.net>
Sun, 6 Jan 2002 20:19:41 +0000 (20:19 +0000)
committerTomas V.V.Cox <cox@php.net>
Sun, 6 Jan 2002 20:19:41 +0000 (20:19 +0000)
pear/scripts/pear-get.in
pear/scripts/pear.in

index 8d349376e1905caddb6048e27a63eb36efe64df8..49cd2840032f4e607e613794a1575350f9e003dc 100644 (file)
@@ -46,17 +46,17 @@ require_once 'Console/Getopt.php';
 
 error_reporting(E_ALL & ~E_NOTICE);
 
-PEAR::setErrorHandling(PEAR_ERROR_PRINT, "pear: %s\n");
-
-// {{{ config file and option parsing
-if (!isset($argv)) {
-    die("Could not read cmd args (register_argc_argv=Off?)\n");
+$argv = Console_Getopt::readPHPArgv();
+if (PEAR::isError($argv)) {
+    die($argv->getMessage());
 }
-$options = Console_Getopt::getopt($argv, "c:C:d:D:h?qu:v");
+$options = Console_Getopt::getopt($argv, "c:C:d:D:h?sSqu:v");
 if (PEAR::isError($options)) {
     usage($options);
 }
 
+PEAR::setErrorHandling(PEAR_ERROR_PRINT, "pear: %s\n");
+
 if (OS_WINDOWS) {
     $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pearsys.ini';
     $pear_user_config    = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.ini';
index e093709efd249704bde5e0b3a6262f5c2ea43059..0791419b3b98eb372d7a3a3630f43fe278ef6aab 100644 (file)
@@ -49,17 +49,17 @@ require_once 'Console/Getopt.php';
 
 error_reporting(E_ALL & ~E_NOTICE);
 
-PEAR::setErrorHandling(PEAR_ERROR_PRINT, "pear: %s\n");
-
-// {{{ config file and option parsing
-if (!isset($argv)) {
-    die("Could not read cmd args (register_argc_argv=Off?)\n");
+$argv = Console_Getopt::readPHPArgv();
+if (PEAR::isError($argv)) {
+    die($argv->getMessage());
 }
 $options = Console_Getopt::getopt($argv, "c:C:d:D:h?sSqu:v");
 if (PEAR::isError($options)) {
     usage($options);
 }
 
+PEAR::setErrorHandling(PEAR_ERROR_PRINT, "pear: %s\n");
+
 if (OS_WINDOWS) {
     $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pearsys.ini';
     $pear_user_config    = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.ini';