From 307b0a5d4b1801305ad4da3eb8447376d1260709 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 4 May 2011 11:26:22 +0000 Subject: * libc/include/signal.h (psignal): Declare. * libc/sys/linux/psignal.c: Move from here... * libc/signal/psignal.c: ... to here. Document. * libc/sys/linux/Makefile.am (GENERAL_SOURCES): Move psignal.c from here... * libc/signal/Makefile.am (LIB_SOURCES): ... to here. (CHEWOUT_FILES): Add psignal.def. * libc/sys/linux/Makefile.in: Regenerate. * libc/signal/Makefile.in: Ditto. * libc/signal/signal.tex: Add references to psignal. --- newlib/libc/signal/psignal.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 newlib/libc/signal/psignal.c (limited to 'newlib/libc/signal/psignal.c') diff --git a/newlib/libc/signal/psignal.c b/newlib/libc/signal/psignal.c new file mode 100644 index 000000000..4638518da --- /dev/null +++ b/newlib/libc/signal/psignal.c @@ -0,0 +1,51 @@ +/* Copyright 2002, 2011 Red Hat Inc. */ +/* +FUNCTION +<>---print a signal message on standard error + +INDEX + psignal + +ANSI_SYNOPSIS + #include + void psignal(int <[signal]>, const char *<[prefix]>); + +TRAD_SYNOPSIS + #include + void psignal(<[signal]>, <[prefix]>) + int <[signal]>; + const char *<[prefix]>; + +DESCRIPTION +Use <> to print (on standard error) a signal message +corresponding to the value of the signal number <[signal]>. +Unless you use <> as the value of the argument <[prefix]>, the +signal message will begin with the string at <[prefix]>, followed by a +colon and a space (<<: >>). The remainder of the signal message is one +of the strings described for <>. + +RETURNS +<> returns no result. + +PORTABILITY +POSIX.1-2008 requires <>, but the strings issued vary from one +implementation to another. + +Supporting OS subroutines required: <>, <>, <>, +<>, <>, <>, <>. +*/ + +#include <_ansi.h> +#include +#include + +_VOID +_DEFUN(psignal, (sig, s), + int sig _AND + _CONST char *s) +{ + if (s != NULL && *s != '\0') + fprintf (stderr, "%s: %s\n", s, strsignal (sig)); + else + fprintf (stderr, "%s\n", strsignal (sig)); +} -- cgit v1.2.3