X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fcommandline.inc;h=a475e11d01abba19ba7fb9ba8126f00f312388c7;hb=9a7c60a3e2160297c7fceaa5f535ce9e7085f61e;hp=bca09216d5842c872ccc7c9d61fcd33c6340762b;hpb=7a0d33ab5fa29993cc7e05e41a26a26ca3ffd1e8;p=quix0rs-gnu-social.git diff --git a/scripts/commandline.inc b/scripts/commandline.inc index bca09216d5..a475e11d01 100644 --- a/scripts/commandline.inc +++ b/scripts/commandline.inc @@ -1,7 +1,7 @@ 1 && 0 != strncmp($opt, '--', 2)) { @@ -142,6 +145,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 +163,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)) {