function _parseShortOption($arg, $short_options, &$opts, &$args, $skip_unknown)
    {
        for ($i = 0; $i < strlen($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 ($skip_unknown === true) {
                    break;
                }

                $msg = "Console_Getopt: unrecognized option -- $opt";
                return PEAR::raiseError($msg);
            }

            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. */
                        $opts[] = array($opt, substr($arg, $i + 1));
                        break;
                    }
                } else {
                    /* Option requires an argument. Use the remainder of the arg
                       string if there is anything left. */
                    if ($i + 1 < strlen($arg)) {
                        $opts[] = array($opt,  substr($arg, $i + 1));
                        break;
                    } else if (list(, $opt_arg) = each($args)) {
                        /* Else use the next argument. */;
                        if (Console_Getopt::_isShortOpt($opt_arg)
                            || Console_Getopt::_isLongOpt($opt_arg)) {
                            $msg = "option requires an argument --$opt";
                            return PEAR::raiseError("Console_Getopt:" . $msg);
                        }
                    } else {
                        $msg = "option requires an argument --$opt";
                        return PEAR::raiseError("Console_Getopt:" . $msg);
                    }
                }
            }

            $opts[] = array($opt, $opt_arg);
        }
    }
function _parseShortOption($arg, $short_options, &$opts, &$args, $skip_unknown)
    {
        for ($i = 0; $i < strlen($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 ($skip_unknown === true) {
                    break;
                }

                $msg = "Console_Getopt: unrecognized option -- $opt";
                return PEAR::raiseError($msg);
            }

            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. */
                        $opts[] = array($opt, substr($arg, $i + 1));
                        break;
                    }
                } else {
                    /* Option requires an argument. Use the remainder of the arg
                       string if there is anything left. */
                    if ($i + 1 < strlen($arg)) {
                        $opts[] = array($opt,  substr($arg, $i + 1));
                        break;
                    } else if (list(, $opt_arg) = each($args)) {
                        /* Else use the next argument. */;
                        if (Console_Getopt::_isShortOpt($opt_arg)
                            || Console_Getopt::_isLongOpt($opt_arg)) {
                            $msg = "option requires an argument --$opt";
                            return PEAR::raiseError("Console_Getopt:" . $msg);
                        }
                    } else {
                        $msg = "option requires an argument --$opt";
                        return PEAR::raiseError("Console_Getopt:" . $msg);
                    }
                }
            }

            $opts[] = array($opt, $opt_arg);
        }
    }
function _parseShortOption ( $ arg , $ short_options , & $ opts , & $ args , $ skip_unknown ) { for ( $ i = 0 ; $ i < strlen ( $ 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 ( $ skip_unknown === true ) { break ; } $ msg = "Console_Getopt: unrecognized option -- $opt" ; return PEAR :: raiseError ( $ msg ) ; } 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. */ $ opts [ ] = array ( $ opt , substr ( $ arg , $ i + 1 ) ) ; break ; } } else { /* Option requires an argument. Use the remainder of the arg
                       string if there is anything left. */ if ( $ i + 1 < strlen ( $ arg ) ) { $ opts [ ] = array ( $ opt , substr ( $ arg , $ i + 1 ) ) ; break ; } else if ( list ( , $ opt_arg ) = each ( $ args ) ) { /* Else use the next argument. */ ; if ( Console_Getopt :: _isShortOpt ( $ opt_arg ) || Console_Getopt :: _isLongOpt ( $ opt_arg ) ) { $ msg = "option requires an argument --$opt" ; return PEAR :: raiseError ( "Console_Getopt:" . $ msg ) ; } } else { $ msg = "option requires an argument --$opt" ; return PEAR :: raiseError ( "Console_Getopt:" . $ msg ) ; } } } $ opts [ ] = array ( $ opt , $ opt_arg ) ; } }
Parse short option

@param string     $arg           Argument
@param string[]   $short_options Available short options
@param string[][] &$opts
@param string[]   &$args
@param boolean    $skip_unknown suppresses Console_Getopt: unrecognized option

@access private
@return void
Parse short option