diff options
author | Markus Armbruster | 2015-04-02 13:32:16 +0200 |
---|---|---|
committer | Markus Armbruster | 2015-05-14 18:41:23 +0200 |
commit | 16d80f61814745bd3f5bb9f47ae3b00edf9e1e45 (patch) | |
tree | 257b60369e69b4f04d7412e92246e68be54fda0d /scripts | |
parent | qapi: Fix generators to report command line errors decently (diff) | |
download | qemu-16d80f61814745bd3f5bb9f47ae3b00edf9e1e45.tar.gz qemu-16d80f61814745bd3f5bb9f47ae3b00edf9e1e45.tar.xz qemu-16d80f61814745bd3f5bb9f47ae3b00edf9e1e45.zip |
qapi: Turn generators' mandatory option -i into an argument
Mandatory option is silly, and the error handling is missing: the
programs crash when -i isn't supplied. Make it an argument, and check
it properly.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qapi.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py index df6e5aa381..186ec3b39f 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -984,10 +984,9 @@ def parse_command_line(extra_options = "", extra_long_options = []): try: opts, args = getopt.gnu_getopt(sys.argv[1:], - "chp:i:o:" + extra_options, + "chp:o:" + extra_options, ["source", "header", "prefix=", - "input-file=", "output-dir="] - + extra_long_options) + "output-dir="] + extra_long_options) except getopt.GetoptError, err: print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err)) sys.exit(1) @@ -1002,8 +1001,6 @@ def parse_command_line(extra_options = "", extra_long_options = []): o, a = oa if o in ("-p", "--prefix"): prefix = a - elif o in ("-i", "--input-file"): - input_file = a elif o in ("-o", "--output-dir"): output_dir = a + "/" elif o in ("-c", "--source"): @@ -1017,8 +1014,9 @@ 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] + if len(args) != 1: + print >>sys.stderr, "%s: need exactly one argument" % sys.argv[0] sys.exit(1) + input_file = args[0] return (input_file, output_dir, do_c, do_h, prefix, extra_opts) |