Does the POSIX standard or another C standard provide a way to recover a meaningful message from a signal number, in the same way that strerror() makes it possible to recover a message from errno? The Gnu C library has strsignal(), but if possible, I would like something portable to BSD and other Unix variants.
Does the POSIX standard or another C standard provide a way to recover a
Share
Yes, interestingly, there is a standard way to get a string message from a signal in POSIX. It is, quite coincidentally,
strsignal(). From POSIX.1-2008:An environment that does not provide you this function is not POSIX-compliant. Although relatively new (Issue 7 came out in 2008), I have a man page for
strsignal()on Mac OS X, so that’s a good sign.