From 413df054ad3235c59c24e897b616c569adc4f67b Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 12 Aug 2012 11:47:45 +0200 Subject: CS fixes (mostly tab -> spaces) --- program/include/clisetup.php | 49 +++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 23 deletions(-) (limited to 'program/include/clisetup.php') diff --git a/program/include/clisetup.php b/program/include/clisetup.php index 039020bdc..a9af90a6f 100644 --- a/program/include/clisetup.php +++ b/program/include/clisetup.php @@ -33,33 +33,36 @@ require_once INSTALL_PATH . 'program/include/iniset.php'; */ function get_opt($aliases = array()) { - $args = array(); - for ($i=1; $i < count($_SERVER['argv']); $i++) { - $arg = $_SERVER['argv'][$i]; - $value = true; - $key = null; + $args = array(); - if ($arg[0] == '-') { - $key = preg_replace('/^-+/', '', $arg); - $sp = strpos($arg, '='); - if ($sp > 0) { - $key = substr($key, 0, $sp - 2); - $value = substr($arg, $sp+1); - } - else if (strlen($_SERVER['argv'][$i+1]) && $_SERVER['argv'][$i+1][0] != '-') { - $value = $_SERVER['argv'][++$i]; - } + for ($i=1; $i < count($_SERVER['argv']); $i++) { + $arg = $_SERVER['argv'][$i]; + $value = true; + $key = null; - $args[$key] = is_string($value) ? preg_replace(array('/^["\']/', '/["\']$/'), '', $value) : $value; - } - else - $args[] = $arg; + if ($arg[0] == '-') { + $key = preg_replace('/^-+/', '', $arg); + $sp = strpos($arg, '='); + if ($sp > 0) { + $key = substr($key, 0, $sp - 2); + $value = substr($arg, $sp+1); + } + else if (strlen($_SERVER['argv'][$i+1]) && $_SERVER['argv'][$i+1][0] != '-') { + $value = $_SERVER['argv'][++$i]; + } - if ($alias = $aliases[$key]) - $args[$alias] = $args[$key]; - } + $args[$key] = is_string($value) ? preg_replace(array('/^["\']/', '/["\']$/'), '', $value) : $value; + } + else { + $args[] = $arg; + } - return $args; + if ($alias = $aliases[$key]) { + $args[$alias] = $args[$key]; + } + } + + return $args; } -- cgit v1.2.3