]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - extlib/System.php
whitespace switch for code layout
[quix0rs-gnu-social.git] / extlib / System.php
index db7c3a60b89968c91d4393bfca0a46f81ebbdb05..c27d44658e3eed375e5e3763b753fe2024b2235f 100644 (file)
@@ -9,7 +9,7 @@
  * @author     Tomas V.V.Cox <cox@idecnet.com>
  * @copyright  1997-2009 The Authors
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
- * @version    CVS: $Id: System.php 307683 2011-01-23 21:56:12Z dufuz $
+ * @version    CVS: $Id: System.php 313024 2011-07-06 19:51:24Z dufuz $
  * @link       http://pear.php.net/package/PEAR
  * @since      File available since Release 0.1
  */
@@ -51,7 +51,7 @@ $GLOBALS['_System_temp_files'] = array();
 * @author     Tomas V.V. Cox <cox@idecnet.com>
 * @copyright  1997-2006 The PHP Group
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
-* @version    Release: 1.9.2
+* @version    Release: 1.9.4
 * @link       http://pear.php.net/package/PEAR
 * @since      Class available since Release 0.1
 * @static
@@ -71,9 +71,17 @@ class System
     function _parseArgs($argv, $short_options, $long_options = null)
     {
         if (!is_array($argv) && $argv !== null) {
-            $argv = preg_split('/\s+/', $argv, -1, PREG_SPLIT_NO_EMPTY);
+            // Find all items, quoted or otherwise
+            preg_match_all("/(?:[\"'])(.*?)(?:['\"])|([^\s]+)/", $argv, $av);
+            $argv = $av[1];
+            foreach ($av[2] as $k => $a) {
+                if (empty($a)) {
+                    continue;
+                }
+                $argv[$k] = trim($a) ;
+            }
         }
-        return Console_Getopt::getopt2($argv, $short_options);
+        return Console_Getopt::getopt2($argv, $short_options, $long_options);
     }
 
     /**