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