summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Helbling2018-10-29 13:52:51 +0100
committerChristian Helbling2018-10-29 13:52:51 +0100
commit95a5aa61f38487d11a089ae2e9cadb5240201685 (patch)
tree7b74cde63aa74fcfc6d18403a51ba177df310f53
parentddbe04f2924cfc6e3a00fd8df57d3ed14cff71fa (diff)
downloaditools-95a5aa61f38487d11a089ae2e9cadb5240201685.tar.gz
itools-95a5aa61f38487d11a089ae2e9cadb5240201685.tar.bz2
itools-95a5aa61f38487d11a089ae2e9cadb5240201685.zip
warn when using the same short option twice
-rw-r--r--it.class4
1 files changed, 4 insertions, 0 deletions
diff --git a/it.class b/it.class
index 0a3fc18..f9c5846 100644
--- a/it.class
+++ b/it.class
@@ -839,7 +839,11 @@ static function getopt($usage, $p = array())
if ($longoptname || $shortoptname)
{
if ($longoptname && ($shortoptname || $shortoptname === "0"))
+ {
+ if ($alias[$shortoptname])
+ it::error("getopt: short option -$shortoptname is used twice: --{$alias[$shortoptname]} and --$longoptname!");
$alias[$shortoptname] = $longoptname;
+ }
$witharg[$longoptname ? $longoptname : $shortoptname] = $longoptarg || $shortoptarg;
}