cvs: php4 /pear/Console Getopt.php

From: Date: Mon, 10 Dec 2001 16:38:44 +0000
Subject: cvs: php4 /pear/Console Getopt.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1500@lists.php.net to get a copy of this message
ssb Mon Dec 10 11:38:44 2001 EDT Modified files: /php4/pear/Console Getopt.php Log: * stop parsing arguments when encoutering the first non-option arg Index: php4/pear/Console/Getopt.php diff -u php4/pear/Console/Getopt.php:1.6 php4/pear/Console/Getopt.php:1.7 --- php4/pear/Console/Getopt.php:1.6 Sat Nov 10 23:09:08 2001 +++ php4/pear/Console/Getopt.php Mon Dec 10 11:38:44 2001 @@ -17,7 +17,7 @@ // | Authors: Andrei Zmievski <andrei@ispi.net> | // +----------------------------------------------------------------------+ // -// $Id: Getopt.php,v 1.6 2001/11/11 04:09:08 mfischer Exp $ +// $Id: Getopt.php,v 1.7 2001/12/10 16:38:44 ssb Exp $ require_once 'PEAR.php'; @@ -77,15 +77,18 @@ reset($args); while (list($i, $arg) = each($args)) { - /* The special element '--' means explicit end of options. Treat the - rest of the arguments as non-options and end the loop. */ + /* The special element '--' means explicit end of + options. Treat the rest of the arguments as non-options + and end the loop. */ if ($arg == '--') { $non_opts = array_merge($non_opts, array_slice($args, $i + 1)); break; } if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) { - $non_opts[] = $arg; + //$non_opts[] = $arg; + $non_opts = array_merge($non_opts, array_slice($args, $i)); + break; } else if (strlen($arg) > 1 && $arg{1} == '-') { $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args); if (PEAR::isError($error))

« previous php.pear.cvs (#1500) next »