function init() { $sws = array('-v' => false, '-h' => false, '-ini' => false, '-D' => 2); $params = array('ini' => false); list($switches, $parameters) = jCmdUtils::getOptionsAndParams($_SERVER['argv'], $sws, $params); if (isset($parameters['ini'])) { ENV::addIni($parameters['ini']); } if (isset($switches['-D'])) { foreach ($switches['-D'] as $var) { if (preg_match("/^(\\w+)=(.*)\$/", $var, $m)) { ENV::set($m[1], $m[2]); } else { throw new Exception('bad syntax for -D option :' . $var . "\n"); } } } if (isset($switches['-v'])) { ENV::set('VERBOSE_MODE', true); } if (isset($switches['-h'])) { echo ENV::help(); exit(0); } if (!isset($parameters['ini'])) { throw new Exception("ini file name forgotten\n"); } if (isset($switches['-ini'])) { echo ENV::getIniContent(); exit(0); } }