From: Tomas V.V.Cox Date: Sun, 6 Jan 2002 20:19:41 +0000 (+0000) Subject: use the new Console_Getopt::readPHPArgv() function to read args X-Git-Tag: PRE_ISSET_PATCH~267 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce82f6261a37f1137c3595b18141f3335449a2fc;p=php use the new Console_Getopt::readPHPArgv() function to read args --- diff --git a/pear/scripts/pear-get.in b/pear/scripts/pear-get.in index 8d349376e1..49cd284003 100644 --- a/pear/scripts/pear-get.in +++ b/pear/scripts/pear-get.in @@ -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'; diff --git a/pear/scripts/pear.in b/pear/scripts/pear.in index e093709efd..0791419b3b 100644 --- a/pear/scripts/pear.in +++ b/pear/scripts/pear.in @@ -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';