From f481ecca42227ebaed502ee895066d456ab9ad41 Mon Sep 17 00:00:00 2001 From: joey <> Date: Thu, 25 Aug 2005 06:47:41 +0000 Subject: [PATCH] Don't spit out Python love when wrong arguments are given, better detect this and exit with a proper error message --- ud-host | 7 ++++++- ud-info | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) 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; -- 2.20.1