diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-06-28 17:02:31 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-06-28 17:02:31 -0400 |
commit | 3ac6b7d120dff2d2b1c35e65559aa1613f5b02dd (patch) | |
tree | be80e7beb126c90bf439a1d8250185f84eba1eb6 /scripts | |
parent | 7a0d33ab5fa29993cc7e05e41a26a26ca3ffd1e8 (diff) |
error in get_option_value wasn't returning a value
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/commandline.inc | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/scripts/commandline.inc b/scripts/commandline.inc index bca09216d..3b6ef6098 100644 --- a/scripts/commandline.inc +++ b/scripts/commandline.inc @@ -122,10 +122,8 @@ require_once INSTALLDIR . '/lib/common.php'; set_error_handler('common_error_handler'); -function have_option($opt, $alt=null) +function _make_matches($opt, $alt) { - global $options; - $matches = array(); if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) { @@ -142,6 +140,15 @@ function have_option($opt, $alt=null) } } + return $matches; +} + +function have_option($opt, $alt=null) +{ + global $options; + + $matches = _make_matches($opt, $alt); + foreach ($options as $option) { if (in_array($option[0], $matches)) { return true; @@ -151,25 +158,11 @@ function have_option($opt, $alt=null) return false; } -function get_option_value($str, $alt=null) +function get_option_value($opt, $alt=null) { global $options; - $matches = array(); - - if (strlen($opt) > 1 && 0 != strncmp($opt, '--', 2)) { - $matches[] = '--'.$opt; - } else { - $matches[] = $opt; - } - - if (!empty($alt)) { - if (strlen($alt) > 1 && 0 != strncmp($alt, '--', 2)) { - $matches[] = '--'.$alt; - } else { - $matches[] = $alt; - } - } + $matches = _make_matches($opt, $alt); foreach ($options as $option) { if (in_array($option[0], $matches)) { |