diff options
author | Michael Forney <mforney@mforney.org> | 2019-02-22 12:26:48 -0800 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-02-22 12:26:48 -0800 |
commit | e2a5e7e5f004fb9ac93d4118eb98ac040e10c897 (patch) | |
tree | 9988e290c0663fb2d1b8ddafe1904e6c0b1f3584 | |
parent | 2cbd75bbab472b6861dc0ae806e41cf139518fe6 (diff) |
Simplify handling of arguments to cc-qbe a bit
-rw-r--r-- | main.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -35,16 +35,12 @@ main(int argc, char *argv[]) usage(); } ARGEND - if (argc == 1) { - if (!freopen(argv[0], "r", stdin)) - fatal("open %s:", argv[0]); - } else if (argc) { + if (argc > 1) usage(); - } - if (output) { - if (!freopen(output, "w", stdout)) - fatal("open %s:", output); - } + if (argc == 1 && !freopen(argv[0], "r", stdin)) + fatal("open %s:", argv[0]); + if (output && !freopen(output, "w", stdout)) + fatal("open %s:", output); ppinit(argc ? argv[0] : "<stdin>"); if (pponly) { |