Date:        Fri, 28 Apr 2017 15:31:10 +0000 (UTC)
    From:        [email protected] (Christos Zoulas)
    Message-ID:  <[email protected]>

  | Fine, return NULL for no signal number / and -1 for no such signal name.

I think 0 for no name is better, we know there is not (and cannot be) a
signal 0, but -1 ?   Unlikely, but...   (and besides, people often assume
that funcs that return -1 to indicate error also set errno, and this does not.)

  | I would just leave __pure out of the man page for now.

Yes, that's what I have done

The proposal is now to put ...

        const char *signalname(int) __pure;
        int signalnumber(const char *);

in <signal.h> (somewhere in a _NETBSD_SOURCE proctected area), and
the man page will be as below.

The tgz file at ftp://munnari.oz.au/kre/signame.tgz has been updated
to reflect all of this.

More comments/suggestions ?

kre

SIGNALNAME(3)              Library Functions Manual              SIGNALNAME(3)

NAME
     signalname signalnumber -- convert between signal numbers and names

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <signal.h>

     const char *
     signalname(int sig);

     int
     signalnumber(const char *name);

DESCRIPTION
     The signalname() function takes a signal number sig, and returns the name
     of that signal.  Signal names returned do not contain a leading ``SIG''
     prefix.

     The return value of signalname() is NULL if sig does not represent a
     valid signal number.

     The signalnumber() function converts the signal name name to the number
     corresponding to that signal.  The name is handled in a case-insensitive
     manner.  Any leading ``SIG'' prefix in name is ignored.

     The signalnumber() function returns the signal number, or zero (0) if the
     name given does not represent a valid signal.

SEE ALSO
     intro(2), psignal(3), strsignal(3)

HISTORY
     The signalname() and signalnumber() functions first appeared in
     NetBSD 8.0.



Reply via email to