groff-commit
[Top][All Lists]
Advanced

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

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


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

gbranden pushed a commit to branch master
in repository groff.

commit 20e16ba652ed212fef74c26f32a23524f006a9d2
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Nov 30 00:06:11 2024 -0600

    Rely on gnulib for `strsignal()` if necessary.
    
    * bootstrap.conf: Add "strsignal" to `gnulib_modules`.
    
    * configure.ac: Drop "strsignal" and "sys_siglist" from
      `AC_CHECK_DECLS`; we don't need Autoconf's tests for these if we've
      got gnulib's replacements.
    
    * src/preproc/html/pre-html.cpp: Include "<string.h>" standard header
      file to ensure visibility of `strsignal` (and `strerror`)
      declarations.
    
    * src/roff/groff/pipeline.c: Drop declaration of `xstrsignal`, our own
      replacement for `strsignal`.
    
      (strsignal): Drop.
    
      (run_pipeline): Update call site.
---
 ChangeLog                     | 16 ++++++++++++++++
 bootstrap.conf                |  1 +
 configure.ac                  |  3 +--
 src/preproc/html/pre-html.cpp |  1 +
 src/roff/groff/pipeline.c     | 23 +----------------------
 5 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 748c5a59d..6cef39d7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2024-11-30  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       Rely on gnulib for `strsignal()` if necessary.
+
+       * bootstrap.conf: Add "strsignal" to `gnulib_modules`.
+       * configure.ac: Drop "strsignal" and "sys_siglist" from
+       `AC_CHECK_DECLS`; we don't need Autoconf's tests for these if
+       we've got gnulib's replacements.
+       * src/preproc/html/pre-html.cpp: Include "<string.h>" standard
+       header file to ensure visibility of `strsignal` (and `strerror`)
+       declarations.
+       * src/roff/groff/pipeline.c: Drop declaration of `xstrsignal`,
+       our own replacement for `strsignal`.
+       (strsignal): Drop.
+       (run_pipeline): Update call site.
+
 2024-11-29  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        Rely on gnulib for `strerror()` if necessary.
diff --git a/bootstrap.conf b/bootstrap.conf
index b4652f4ff..201a905bd 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -50,6 +50,7 @@ gnulib_modules="
     stdckdint
     stdint
     strerror
+    strsignal
     sys_wait
 "
 
diff --git a/configure.ac b/configure.ac
index 5002eeb33..8563dbc84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,8 +135,7 @@ LIBS="$saved_libs"
 AC_CHECK_FUNCS([gettimeofday isatty kill rename setlocale strdup \
                 strsep])
 GROFF_MKSTEMP
-AC_CHECK_DECLS([strsignal, getc_unlocked])
-AC_CHECK_DECLS([sys_siglist, getc_unlocked])
+AC_CHECK_DECLS([getc_unlocked])
 AM_LANGINFO_CODESET
 
 # checks for compiler characteristics
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index db2ac37e9..409c63efd 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -28,6 +28,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <string.h> // strerror(), strsignal()
 
 #define PREHTMLC
 
diff --git a/src/roff/groff/pipeline.c b/src/roff/groff/pipeline.c
index 502a37e34..27bec29b2 100644
--- a/src/roff/groff/pipeline.c
+++ b/src/roff/groff/pipeline.c
@@ -90,8 +90,6 @@ extern const char *i_to_a(int);               /* from 
libgroff */
 #endif
 
 static void sys_fatal(const char *);
-static const char *xstrsignal(int);
-
 
 #if defined(__MSDOS__) \
     || (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__)) \
@@ -531,7 +529,7 @@ int run_pipeline(int ncommands, char ***commands, bool 
no_pipe)
          {
            c_error("%1: %2%3",
                    commands[i][0],
-                   xstrsignal(sig),
+                   strsignal(sig),
                    WCOREDUMP(status) ? " (core dumped)" : "");
            ret |= 2;
          }
@@ -560,25 +558,6 @@ static void sys_fatal(const char *s)
   c_fatal("%1: %2", s, strerror(errno), (char *)0);
 }
 
-static const char *xstrsignal(int n)
-{
-  static char buf[sizeof("Signal ") + 1 + sizeof(int) * 3];
-
-#ifdef NSIG
-#if HAVE_DECL_STRSIGNAL
-  if (n >= 0 && n < NSIG && strsignal(n) != 0)
-    return strsignal(n);
-#else
-#if HAVE_DECL_SYS_SIGLIST
-  if (n >= 0 && n < NSIG && sys_siglist[n] != 0)
-    return sys_siglist[n];
-#endif /* HAVE_DECL_SYS_SIGLIST */
-#endif /* HAVE_DECL_STRSIGNAL */
-#endif /* NSIG */
-  sprintf(buf, "Signal %d", n);
-  return buf;
-}
-
 // Local Variables:
 // fill-column: 72
 // mode: C



reply via email to

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