[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 70/74: [troff]: Drop `POPEN_MISSING` preprocessor macro.
From: |
G. Branden Robinson |
Subject: |
[groff] 70/74: [troff]: Drop `POPEN_MISSING` preprocessor macro. |
Date: |
Fri, 28 Apr 2023 15:10:53 -0400 (EDT) |
gbranden pushed a commit to branch branden-2023-04-28
in repository groff.
commit a762771dad932fd96a549e10befc5f1ce6359dbd
Author: G. Branden Robinson <g.branden.robinson@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 445cd86d8..89e00be93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2023-04-25 G. Branden Robinson <g.branden.robinson@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.robinson@gmail.com>
[eqn]: Implement new "gifont" primitive.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 8c7531597..825bac066 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();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 70/74: [troff]: Drop `POPEN_MISSING` preprocessor macro.,
G. Branden Robinson <=