groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/06: src/roff/groff/pipeline.c: Use strsignal().


From: G. Branden Robinson
Subject: [groff] 01/06: src/roff/groff/pipeline.c: Use strsignal().
Date: Thu, 14 Jan 2021 03:42:57 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit e59589a4cb7c2b5fafad36ddecf12dda92cc5b33
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Jan 10 19:18:25 2021 +1100

    src/roff/groff/pipeline.c: Use strsignal().
    
    POSIX.1-2008 added strsignal() to the C library and recommended its use
    over sys_siglist[], but groff's pipeline management hadn't been updated
    in that respect since that time.
    
    * configure.ac: Check for strsignal().
    * src/roff/groff/pipeline.c (xstrsignal): Use return value of
      strsignal() if it is available.
    
    Thanks to an anonymous contributor for the report and the patch.
    
    Fixes <https://savannah.gnu.org/bugs/?59835>.
---
 ChangeLog                 | 16 ++++++++++++++++
 configure.ac              |  1 +
 src/roff/groff/pipeline.c |  5 +++++
 3 files changed, 22 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index e3704cf..493909e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2021-01-10  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       Add support for strsignal().
+
+       POSIX.1-2008 added strsignal() to the C library and recommended
+       its use over sys_siglist[], but groff's pipeline management
+       hadn't been updated in that respect since that time.
+
+       * configure.ac: Check for strsignal().
+       * src/roff/groff/pipeline.c (xstrsignal): Return strsignal() if
+       it is defined.
+
+       Thanks to an anonymous contributor for the report and the patch.
+
+       Fixes <https://savannah.gnu.org/bugs/?59835>.
+
 2021-01-06  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/libs/libgroff/relocate.cpp (relocatep): Add assertion to
diff --git a/configure.ac b/configure.ac
index abb485f..f3e393b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -138,6 +138,7 @@ AC_REPLACE_FUNCS([fmod getcwd putenv strcasecmp \
 LIBS="$saved_libs"
 AC_CHECK_FUNCS([gettimeofday isatty kill rename setlocale strsep])
 GROFF_MKSTEMP
+AC_CHECK_DECLS([strsignal, getc_unlocked])
 AC_CHECK_DECLS([sys_siglist, getc_unlocked])
 AM_LANGINFO_CODESET
 
diff --git a/src/roff/groff/pipeline.c b/src/roff/groff/pipeline.c
index e0cff68..154918b 100644
--- a/src/roff/groff/pipeline.c
+++ b/src/roff/groff/pipeline.c
@@ -570,10 +570,15 @@ 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;



reply via email to

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