From: joey <> Date: Thu, 25 Aug 2005 06:47:41 +0000 (+0000) Subject: Don't spit out Python love when wrong arguments are given, better X-Git-Tag: userdir-ldap-0.3.11~4 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=commitdiff_plain;h=f481ecca42227ebaed502ee895066d456ab9ad41 Don't spit out Python love when wrong arguments are given, better detect this and exit with a proper error message --- diff --git a/ud-host b/ud-host index 319227b..0fa035a 100755 --- a/ud-host +++ b/ud-host @@ -215,7 +215,12 @@ ListMode = 0 FingerPrints = 0 Host = None # Process options -(options, arguments) = getopt.getopt(sys.argv[1:], "nh:a:rlf") +try: + (options, arguments) = getopt.getopt(sys.argv[1:], "nh:a:rlf") +except getopt.GetoptError, data: + print data + sys.exit(1) + for (switch, val) in options: if (switch == '-h'): Host = val; diff --git a/ud-info b/ud-info index 5f144bd..3591161 100755 --- a/ud-info +++ b/ud-info @@ -244,7 +244,12 @@ def MultiChangeAttr(Attrs,Attr): User = pwd.getpwuid(os.getuid())[0]; BindUser = User; # Process options -(options, arguments) = getopt.getopt(sys.argv[1:], "nu:c:a:r") +try: + (options, arguments) = getopt.getopt(sys.argv[1:], "nu:c:a:r") +except getopt.GetoptError, data: + print data + sys.exit(1) + for (switch, val) in options: if (switch == '-u'): User = val;