cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit fcf3d3d44ba4b8cc41f81615c2a14e76b383127e
parent 2deac8fa0c95d5c07b344e1ee966ea818c0b578b
Author: Michael Forney <mforney@mforney.org>
Date:   Sun, 24 Feb 2019 16:09:17 -0800

driver: Fix -E with no output specified

Diffstat:
Mdriver.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/driver.c b/driver.c @@ -201,7 +201,10 @@ buildobj(struct input *input, char *output, enum phaseid last) if (fd < 0) fatal("mkstemp:"); close(fd); - } else if (!output && last != PREPROCESS) { + } else if (output) { + if (strcmp(output, "-") == 0) + output = NULL; + } else if (last != PREPROCESS) { switch (last) { case COMPILE: ext = "qbe"; break; case CODEGEN: ext = "s"; break; @@ -211,8 +214,6 @@ buildobj(struct input *input, char *output, enum phaseid last) } if (strcmp(input->name, "-") == 0) input->name = NULL; - if (strcmp(output, "-") == 0) - output = NULL; npids = 0; for (i = first, fd = -1, phaseoutput = NULL; i <= last; ++i, ++npids) {