Home | History | Annotate | Line # | Download | only in gen
      1  1.1  kre /* $NetBSD: signalname.c,v 1.1 2017/05/09 11:14:16 kre Exp $ */
      2  1.1  kre 
      3  1.1  kre /*
      4  1.1  kre  * Software available to all and sundry without limitations
      5  1.1  kre  * but without warranty of fitness for any purpose whatever.
      6  1.1  kre  *
      7  1.1  kre  * Licensed for any use, including redistribution in source
      8  1.1  kre  * and binary forms, with or without modifications, subject
      9  1.1  kre  * the following agreement:
     10  1.1  kre  *
     11  1.1  kre  * Licensee agrees to indemnify licensor, and distributor, for
     12  1.1  kre  * the full amount of any any claim made by the licensee against
     13  1.1  kre  * the licensor or distributor, for any action that results from
     14  1.1  kre  * any use or redistribution of this software, plus any costs
     15  1.1  kre  * incurred by licensor or distributor resulting from that claim.
     16  1.1  kre  *
     17  1.1  kre  * This licence must be retained with the software.
     18  1.1  kre  */
     19  1.1  kre 
     20  1.1  kre #include <sys/types.h>
     21  1.1  kre 
     22  1.1  kre #include <signal.h>
     23  1.1  kre #include <string.h>
     24  1.1  kre 
     25  1.1  kre /*
     26  1.1  kre  * signalname()
     27  1.1  kre  *
     28  1.1  kre  *	Converts the signal number "sig" to its
     29  1.1  kre  *	signal name (without the "SIG" prefix).
     30  1.1  kre  *
     31  1.1  kre  * Returns:
     32  1.1  kre  *	NULL on error (invalid signal number)
     33  1.1  kre  *	otherwise the (abbreviated) signal name (no "SIG").
     34  1.1  kre  */
     35  1.1  kre 
     36  1.1  kre const char *
     37  1.1  kre signalname(int sig)
     38  1.1  kre {
     39  1.1  kre 
     40  1.1  kre 	if (sig <= 0 || sig >= NSIG)
     41  1.1  kre 		return NULL;
     42  1.1  kre 
     43  1.1  kre 	return sys_signame[sig];
     44  1.1  kre }
     45