X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fcommandline.inc;h=1573b569db604cc0ad491ee4089bad43f07fbdbd;hb=f2ecfd237007b8ffafd8c74a290549f5966c107e;hp=bca09216d5842c872ccc7c9d61fcd33c6340762b;hpb=7a0d33ab5fa29993cc7e05e41a26a26ca3ffd1e8;p=quix0rs-gnu-social.git diff --git a/scripts/commandline.inc b/scripts/commandline.inc index bca09216d5..1573b569db 100644 --- a/scripts/commandline.inc +++ b/scripts/commandline.inc @@ -1,7 +1,7 @@ 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)) {