groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 71/80: Rely on gnulib for `unlink()` if necessary.


From: G. Branden Robinson
Subject: [groff] 71/80: Rely on gnulib for `unlink()` if necessary.
Date: Sat, 30 Nov 2024 04:02:28 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 63ac074818c4a9f9d895a8d7e9723e1774413fc4
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Nov 30 00:19:50 2024 -0600

    Rely on gnulib for `unlink()` if necessary.
    
    * bootstrap.conf: Add "unlink" to `gnulib_modules`.
    
    * src/libs/libgroff/tmpfile.cpp:
    * src/preproc/html/pre-html.cpp: Include "<unistd.h>" standard header
      file to ensure visibility of `unlink` declaration.  Wrap this in
      `HAVE_UNISTD_H` preprocessor conditional (a symbol we direct the user
      to define in "Makefile.am" if necessary).
    
    I think gnulib obviates `HAVE_UNISTD_H`, but the idiom is widely used in
    the groff codebase for this header file so I leave an experimental
    scrub-out for another day.  (It would also help to have a good
    communication loop with someone building groff on a non-POSIX system
    like native Windows; I don't have one handy.)
---
 ChangeLog                     | 17 +++++++++++++++++
 bootstrap.conf                |  1 +
 src/libs/libgroff/tmpfile.cpp |  3 +++
 src/preproc/html/pre-html.cpp |  3 +++
 4 files changed, 24 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 6cef39d7b..fd3e0a797 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-11-30  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       Rely on gnulib for `unlink()` if necessary.
+
+       * bootstrap.conf: Add "unlink" to `gnulib_modules`.
+
+       * src/libs/libgroff/tmpfile.cpp:
+       * src/preproc/html/pre-html.cpp: Include "<unistd.h>" standard
+       header file to ensure visibility of `unlink` declaration.  Wrap
+       this in `HAVE_UNISTD_H` preprocessor conditional (a symbol we
+       direct the user to define in "Makefile.am" if necessary).  I
+       think gnulib obviates this, but the idiom is widely used in the
+       groff codebase for this header file so I leave an experimental
+       scrub-out for another day.  (It would also help to have a good
+       communication loop with someone building groff on a non-POSIX
+       system like native Windows; I don't have one handy.)
+
 2024-11-30  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        Rely on gnulib for `strsignal()` if necessary.
diff --git a/bootstrap.conf b/bootstrap.conf
index 201a905bd..8a5a69267 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -52,6 +52,7 @@ gnulib_modules="
     strerror
     strsignal
     sys_wait
+    unlink
 "
 
 # Name of the Makefile.am
diff --git a/src/libs/libgroff/tmpfile.cpp b/src/libs/libgroff/tmpfile.cpp
index 18eed2738..927c7bd66 100644
--- a/src/libs/libgroff/tmpfile.cpp
+++ b/src/libs/libgroff/tmpfile.cpp
@@ -22,6 +22,9 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 
 #include <errno.h>
 #include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h> // unlink()
+#endif
 
 #include "lib.h"
 
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 409c63efd..b25be380d 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -29,6 +29,9 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <string.h> // strerror(), strsignal()
+#ifdef HAVE_UNISTD_H
+#include <unistd.h> // unlink()
+#endif
 
 #define PREHTMLC
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]