From 95a5aa61f38487d11a089ae2e9cadb5240201685 Mon Sep 17 00:00:00 2001 From: Christian Helbling Date: Mon, 29 Oct 2018 13:52:51 +0100 Subject: warn when using the same short option twice --- it.class | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'it.class') 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; } -- cgit v1.2.3