bug-gnulib
[Top][All Lists]
Advanced

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

Re: strsignal module


From: Bruno Haible
Subject: Re: strsignal module
Date: Tue, 15 Jan 2008 00:28:55 +0100
User-agent: KMail/1.5.4

Colin Watson wrote:
> I use strsignal in man-db, and would like a Gnulib module to cope with
> its portability problems.

You fixed the first portability problem: the function is missing on some
platforms. But there is another one.

I want to use the replacement in GNU clisp, so I did "man strsignal", and it
says:

       "On some systems (but not on Linux), a NULL pointer may be returned
        instead for an invalid signal number."

And it's even worse than that: for negative or out-of-range signal numbers,

  * Solaris strsignal returns NULL,
  * AIX 5.1 strsignal returns (char*)(-1) !

As a user of this function, I don't want to special case these return values.
The function should always return a reasonable pointer.

So I propose to change the module so that, on these two platforms, it
overrides the system function. Do you agree? May I do this? Do you want to
do it?

Bruno

======================= Small test program ====================
#define _GNU_SOURCE 1
#include <stdio.h>
#include <string.h>
int main ()
{
  printf ("%s\n", strsignal (3));
  printf ("%s\n", strsignal (-13));
  printf ("%s\n", strsignal (21381283));
  return 0;
}





reply via email to

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