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.
assert(place != NULL);
- if (name == NULL) {
+ if ((name == NULL) || !strcmp(name, "-")) {
fd = STDIN_FILENO;
pf = place_addfile(place, "<standard-input>", false);
} else {
init();
for (i=1; i<argc; i++) {
- if (argv[i][0] != '-') {
+ if ((argv[i][0] != '-') || !strcmp(argv[i], "-")) {
break;
}
place_setcommandline(&cmdplace, i, 1);
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,