strsignal.c revision 1.1
11.1Sjtc/*
21.1Sjtc * Copyright (c) 1988 Regents of the University of California.
31.1Sjtc * All rights reserved.
41.1Sjtc *
51.1Sjtc * Redistribution and use in source and binary forms, with or without
61.1Sjtc * modification, are permitted provided that the following conditions
71.1Sjtc * are met:
81.1Sjtc * 1. Redistributions of source code must retain the above copyright
91.1Sjtc *    notice, this list of conditions and the following disclaimer.
101.1Sjtc * 2. Redistributions in binary form must reproduce the above copyright
111.1Sjtc *    notice, this list of conditions and the following disclaimer in the
121.1Sjtc *    documentation and/or other materials provided with the distribution.
131.1Sjtc * 3. All advertising materials mentioning features or use of this software
141.1Sjtc *    must display the following acknowledgement:
151.1Sjtc *	This product includes software developed by the University of
161.1Sjtc *	California, Berkeley and its contributors.
171.1Sjtc * 4. Neither the name of the University nor the names of its contributors
181.1Sjtc *    may be used to endorse or promote products derived from this software
191.1Sjtc *    without specific prior written permission.
201.1Sjtc *
211.1Sjtc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221.1Sjtc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231.1Sjtc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241.1Sjtc * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251.1Sjtc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261.1Sjtc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271.1Sjtc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281.1Sjtc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291.1Sjtc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301.1Sjtc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311.1Sjtc * SUCH DAMAGE.
321.1Sjtc */
331.1Sjtc
341.1Sjtc#if defined(LIBC_SCCS) && !defined(lint)
351.1Sjtc/*static char *sccsid = "from: @(#)strerror.c	5.6 (Berkeley) 5/4/91";*/
361.1Sjtcstatic char *rcsid = "$Id: strsignal.c,v 1.1 1994/08/02 05:01:23 jtc Exp $";
371.1Sjtc#endif /* LIBC_SCCS and not lint */
381.1Sjtc
391.1Sjtc#include <string.h>
401.1Sjtc#include <signal.h>
411.1Sjtc
421.1Sjtcchar *
431.1Sjtcstrsignal(sig)
441.1Sjtc	int sig;
451.1Sjtc{
461.1Sjtc	unsigned int signum = sig;
471.1Sjtc	static char buf[40];
481.1Sjtc
491.1Sjtc	if (signum < NSIG) {
501.1Sjtc		return(sys_siglist[signum]);
511.1Sjtc	}
521.1Sjtc
531.1Sjtc	sprintf(buf, "Unknown signal: %d", signum);
541.1Sjtc	return buf;
551.1Sjtc}
56