Hello gnulib folks,

Please consider placing extern "C" around the sig2str and str2sig declarations inside sig2str.h similar to the attached diff/changeset. We're looking at using the sig2str routine in Octave and removing some code from that project that is similar to what sig2str but not up-to-date with all the Unix SIG definitions that might exist.

I would also like you to consider the issue of duplicate signal definitions (i.e., different SIGxxxx using the same number such as SIGCHLD and SIGCLD). Right now, sig2str will return only one string associated with the signal number (first appearance) even though internally the structure numname[] contains a complete list. If someone wants to know all definitions, then sig2str doesn't really indicate that. What do people think? Should there be a routine that provides a complete listing?

Thank you,

Dan
# HG changeset patch
# User Daniel J Sebald <daniel.seb...@ieee.org>
# Date 1370141569 18000
# Node ID 85cfad3e0902907533006eaca24034c06ddbc13e
# Parent  5a51fb7777a9950502965a043a70bd6ca5e0498b
Encase signal information functions inside extern "C" qualifier.

* sig2str.h: Place extern "C" around sig2str() and str2sig() declarations
conditioned on __cplusplus being defined.

diff --git a/lib/sig2str.h b/lib/sig2str.h
--- a/lib/sig2str.h
+++ b/lib/sig2str.h
@@ -27,8 +27,14 @@
 /* Size of a buffer needed to hold a signal name like "HUP".  */
 # define SIG2STR_MAX (sizeof "SIGRTMAX" + INT_STRLEN_BOUND (int) - 1)
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
 int sig2str (int, char *);
 int str2sig (char const *, int *);
+#ifdef  __cplusplus
+}
+#endif
 
 #endif
 

Reply via email to