summaryrefslogtreecommitdiffstats
path: root/libexec/tradcpp/files.c
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2014-08-08 12:40:26 +0000
committerjsg <jsg@openbsd.org>2014-08-08 12:40:26 +0000
commitdc9523b79494e25195311bff75491791f1d9a4a5 (patch)
tree516337c466d5655b440f055da577beb82ad16d2a /libexec/tradcpp/files.c
parentFix CVE-2014-3507, avoid allocating and then leaking a fresh fragment (diff)
downloadwireguard-openbsd-dc9523b79494e25195311bff75491791f1d9a4a5.tar.xz
wireguard-openbsd-dc9523b79494e25195311bff75491791f1d9a4a5.zip
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/files.c')
-rw-r--r--libexec/tradcpp/files.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libexec/tradcpp/files.c b/libexec/tradcpp/files.c
index f0ee45eee55..ea151b23286 100644
--- a/libexec/tradcpp/files.c
+++ b/libexec/tradcpp/files.c
@@ -400,7 +400,7 @@ file_readabsolute(struct place *place, const char *name)
assert(place != NULL);
- if (name == NULL) {
+ if ((name == NULL) || !strcmp(name, "-")) {
fd = STDIN_FILENO;
pf = place_addfile(place, "<standard-input>", false);
} else {