From e79ea1263b41976cb53ebba155f6d0b541e69602 Mon Sep 17 00:00:00 2001 From: Christian Helbling Date: Thu, 8 Dec 2011 13:22:21 +0000 Subject: allow -0 as shortarg in getopt --- it.class | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index d28423d..1eafcea 100644 --- a/it.class +++ b/it.class @@ -612,7 +612,7 @@ static function getopt($helplines) if ($longoptname || $shortoptname) { - if ($longoptname && $shortoptname) + if ($longoptname && ($shortoptname || $shortoptname === "0")) $alias[$shortoptname] = $longoptname; $witharg[$longoptname ? $longoptname : $shortoptname] = $longoptarg || $shortoptarg; @@ -643,7 +643,7 @@ static function getopt($helplines) else $result[$optname] = $val ? substr($val, 1) : true; } - else if ($letters = it::match('^-(\w+)', $arg)) + else if (($letters = it::match('^-(\w+)', $arg)) || $letters === "0") { foreach (explode("\n", trim(chunk_split($letters, 1, "\n"))) as $letter) { -- cgit v1.2.3