aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-04-02 13:17:34 +0200
committerMarkus Armbruster <armbru@redhat.com>2015-05-14 18:39:34 +0200
commitb45409683e829770000a4560ed21e704f87df74c (patch)
tree425537c3c7b447d700123a81491a149f3369a39b /scripts
parent2114f5a98d0d80774306279e1694de074ca86aa0 (diff)
qapi: Fix generators to report command line errors decently
Report to stderr, prefix with the program name. Also reject extra arguments. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index b97dd0b14a..df6e5aa381 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -989,7 +989,7 @@ def parse_command_line(extra_options = "", extra_long_options = []):
"input-file=", "output-dir="]
+ extra_long_options)
except getopt.GetoptError, err:
- print str(err)
+ print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err))
sys.exit(1)
output_dir = ""
@@ -1017,4 +1017,8 @@ def parse_command_line(extra_options = "", extra_long_options = []):
do_c = True
do_h = True
+ if len(args) != 0:
+ print >>sys.stderr, "%s: too many arguments" % sys.argv[0]
+ sys.exit(1)
+
return (input_file, output_dir, do_c, do_h, prefix, extra_opts)