diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2014-08-08 12:40:27 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2014-08-08 12:40:27 +0000 |
commit | 26c8a5b9400ede1f5a50a48775fba1ef95242fea (patch) | |
tree | cfda4a252709906180071b64ecd99f22dd3678be /libexec/tradcpp/output.c | |
parent | e6d7aed62b9a87a525765433671ce2dc6405233d (diff) |
Add support for using - as shorthand for stdin/stdout in tradcpp.
When looking into switching the /usr/bin/cpp wrapper to
tradcpp I came across "| ${CPP} ${CPPFLAGS} -" in usr.bin/which.
gcc documents this behaviour for cpp here:
https://gcc.gnu.org/onlinedocs/cpp/Invocation.html
Versions of the John F. Reiser derived cpp in 32V and CSRG SCCS
accept this usage as well, as does the cpp in PCC.
Diffstat (limited to 'libexec/tradcpp/output.c')
-rw-r--r-- | libexec/tradcpp/output.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libexec/tradcpp/output.c b/libexec/tradcpp/output.c index d1d1f2d4d94..5cc7165892c 100644 --- a/libexec/tradcpp/output.c +++ b/libexec/tradcpp/output.c @@ -47,7 +47,7 @@ static void output_open(void) { - if (mode.output_file == NULL) { + if ((mode.output_file == NULL) || !strcmp(mode.output_file, "-")) { outputfd = STDOUT_FILENO; } else { outputfd = open(mode.output_file, O_WRONLY|O_CREAT|O_TRUNC, |