gbranden pushed a commit to branch branden-2023-07-05 in repository groff. commit d9064e9acd301a97248f3aef69692f086b8fe0f3 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Wed Apr 26 04:25:16 2023 -0500
[troff]: Drop `POPEN_MISSING` preprocessor macro. 3 source files test this macro but nothing appears to define it. It dates back to (at least) 1994. I suspect this of being bitrot. Reasons include: (1) We test for a declaration of `popen` in our "configure.ac" file; (2) our gxditview command uses `popen` _without_ #ifdef-guarding it (perhaps the assumption was that any system that supported X11 also had a working `popen`); (3) our "nonposix.h" header file defines a macro aliasing `popen` to `_popen`, which is its typical name on Windows systems, and is the most likely build host candidate for which support might have been missing as late as 1994. Microsoft end-of-lifed MS-DOS in 2000. If someone wants to start up a FreeDOS port, talk to us. Maybe even that has a functional `popen()`. Here's hopin'. * src/roff/troff/input.cpp ([global], file_iterator::close, pipe_source, pipe_output, init_input_requests): * src/roff/troff/node.cpp (class real_output_file, output_file::real_output_file, output_file::~real_output_file): * src/roff/troff/node.h: Do it. --- ChangeLog | 24 ++++++++++++++++++++++++ src/roff/troff/input.cpp | 16 ---------------- src/roff/troff/node.cpp | 6 ------ src/roff/troff/node.h | 2 -- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 66eadd873..8559bfc7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2023-04-25 G. Branden Robinson <g.branden.robin...@gmail.com> + + [troff]: Drop `POPEN_MISSING` preprocessor macro. + + 3 source files test this macro but nothing appears to define it. + It dates back to (at least) 1994. I suspect this of being + bitrot. Reasons include: (1) We test for a declaration of + `popen` in our "configure.ac" file; (2) our gxditview command + uses `popen` _without_ #ifdef-guarding it (perhaps the + assumption was that any system that supported X11 also had a + working `popen`); (3) our "nonposix.h" header file defines a + macro aliasing `popen` to `_popen`, which is its typical name on + Windows systems, and is the most likely build host candidate for + which support might have been missing as late as 1994. + Microsoft end-of-lifed MS-DOS in 2000. If someone wants to + start up a FreeDOS port, talk to us. Maybe even that has a + functional `popen()`. Here's hopin'. + + * src/roff/troff/input.cpp ([global], file_iterator::close) + (pipe_source, pipe_output, init_input_requests): + * src/roff/troff/node.cpp (class real_output_file) + (output_file::real_output_file, output_file::~real_output_file): + * src/roff/troff/node.h: Do it. + 2023-04-14 G. Branden Robinson <g.branden.robin...@gmail.com> [eqn]: Implement new "gifont" primitive. diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index d8f77ff23..cd4638c81 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -82,9 +82,7 @@ int break_flag = 0; int class_flag = 0; int color_flag = 1; // colors are on by default static int backtrace_flag = 0; -#ifndef POPEN_MISSING char *pipe_command = 0 /* nullptr */; -#endif charinfo *charset_table[256]; unsigned char hpf_code_table[256]; @@ -310,10 +308,8 @@ void file_iterator::close() { if (fp == stdin) clearerr(stdin); -#ifndef POPEN_MISSING else if (popened) pclose(fp); -#endif /* not POPEN_MISSING */ else fclose(fp); } @@ -6064,10 +6060,6 @@ void pipe_source() skip_line(); } else { -#ifdef POPEN_MISSING - error("pipes not available on this system"); - skip_line(); -#else /* not POPEN_MISSING */ if (tok.is_newline() || tok.is_eof()) error("missing command"); else { @@ -6101,7 +6093,6 @@ void pipe_source() delete[] buf; } tok.next(); -#endif /* not POPEN_MISSING */ } } @@ -7626,10 +7617,6 @@ void pipe_output() skip_line(); } else { -#ifdef POPEN_MISSING - error("pipes not available on this system"); - skip_line(); -#else /* not POPEN_MISSING */ if (the_output) { error("can't pipe: output already started"); skip_line(); @@ -7650,7 +7637,6 @@ void pipe_output() else pipe_command = pc; } -#endif /* not POPEN_MISSING */ } } @@ -8422,9 +8408,7 @@ void init_input_requests() init_request("pi", pipe_output); init_request("pm", print_macros); init_request("psbb", ps_bbox_request); -#ifndef POPEN_MISSING init_request("pso", pipe_source); -#endif /* not POPEN_MISSING */ init_request("rchar", remove_character); init_request("rd", read_request); init_request("return", return_macro_request); diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index d17198db8..dcc6aefbe 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -721,9 +721,7 @@ tfont::tfont(tfont_spec &spec) : tfont_spec(spec) /* output_file */ class real_output_file : public output_file { -#ifndef POPEN_MISSING int piped; -#endif int printing; // decision via optional page list int output_on; // \O[0] or \O[1] escape sequences virtual void really_transparent_char(unsigned char) = 0; @@ -1651,7 +1649,6 @@ void output_file::off() real_output_file::real_output_file() : printing(0), output_on(1) { -#ifndef POPEN_MISSING if (pipe_command) { if ((fp = popen(pipe_command, POPEN_WT)) != 0) { piped = 1; @@ -1660,7 +1657,6 @@ real_output_file::real_output_file() error("pipe open failed: %1", strerror(errno)); } piped = 0; -#endif /* not POPEN_MISSING */ fp = stdout; } @@ -1679,7 +1675,6 @@ real_output_file::~real_output_file() fp = 0; fatal("unable to flush output file: %1", strerror(errno)); } -#ifndef POPEN_MISSING if (piped) { int result = pclose(fp); fp = 0; @@ -1697,7 +1692,6 @@ real_output_file::~real_output_file() } } else -#endif /* not POPEN MISSING */ if (fclose(fp) < 0) { fp = 0; fatal("unable to close output file: %1", strerror(errno)); diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h index de82753d0..b63f79cb3 100644 --- a/src/roff/troff/node.h +++ b/src/roff/troff/node.h @@ -645,9 +645,7 @@ public: mtsm state; }; -#ifndef POPEN_MISSING extern char *pipe_command; -#endif extern output_file *the_output; extern void init_output(); _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit