mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
First lot of compatability fixes
This commit is contained in:
@@ -104,7 +104,7 @@ class Console_Getopt {
|
||||
* erroneous POSIX fix.
|
||||
*/
|
||||
if ($version < 2) {
|
||||
if (isset($args[0]{0}) && $args[0]{0} != '-') {
|
||||
if (isset($args[0][0]) && $args[0][0] != '-') {
|
||||
array_shift($args);
|
||||
}
|
||||
}
|
||||
@@ -120,10 +120,10 @@ class Console_Getopt {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
|
||||
if ($arg[0] != '-' || (strlen($arg) > 1 && $arg[1] == '-' && !$long_options)) {
|
||||
$non_opts = array_merge($non_opts, array_slice($args, $i));
|
||||
break;
|
||||
} elseif (strlen($arg) > 1 && $arg{1} == '-') {
|
||||
} elseif (strlen($arg) > 1 && $arg[1] == '-') {
|
||||
$error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
|
||||
if (PEAR::isError($error))
|
||||
return $error;
|
||||
@@ -144,17 +144,17 @@ class Console_Getopt {
|
||||
function _parseShortOption($arg, $short_options, &$opts, &$args)
|
||||
{
|
||||
for ($i = 0; $i < strlen($arg); $i++) {
|
||||
$opt = $arg{$i};
|
||||
$opt = $arg[$i];
|
||||
$opt_arg = null;
|
||||
|
||||
/* Try to find the short option in the specifier string. */
|
||||
if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':')
|
||||
if (($spec = strstr($short_options, $opt)) === false || $arg[$i] == ':')
|
||||
{
|
||||
return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt");
|
||||
}
|
||||
|
||||
if (strlen($spec) > 1 && $spec{1} == ':') {
|
||||
if (strlen($spec) > 2 && $spec{2} == ':') {
|
||||
if (strlen($spec) > 1 && $spec[1] == ':') {
|
||||
if (strlen($spec) > 2 && $spec[2] == ':') {
|
||||
if ($i + 1 < strlen($arg)) {
|
||||
/* Option takes an optional argument. Use the remainder of
|
||||
the arg string if there is anything left. */
|
||||
@@ -199,7 +199,7 @@ class Console_Getopt {
|
||||
|
||||
/* Check that the options uniquely matches one of the allowed
|
||||
options. */
|
||||
if ($opt_rest != '' && $opt{0} != '=' &&
|
||||
if ($opt_rest != '' && $opt[0] != '=' &&
|
||||
$i + 1 < count($long_options) &&
|
||||
$opt == substr($long_options[$i+1], 0, $opt_len)) {
|
||||
return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous");
|
||||
|
||||
Reference in New Issue
Block a user