Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/signal/psignal.c')
-rw-r--r--newlib/libc/signal/psignal.c51
1 files changed, 51 insertions, 0 deletions
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
+<<psignal>>---print a signal message on standard error
+
+INDEX
+ psignal
+
+ANSI_SYNOPSIS
+ #include <stdio.h>
+ void psignal(int <[signal]>, const char *<[prefix]>);
+
+TRAD_SYNOPSIS
+ #include <stdio.h>
+ void psignal(<[signal]>, <[prefix]>)
+ int <[signal]>;
+ const char *<[prefix]>;
+
+DESCRIPTION
+Use <<psignal>> to print (on standard error) a signal message
+corresponding to the value of the signal number <[signal]>.
+Unless you use <<NULL>> 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 <<strsignal>>.
+
+RETURNS
+<<psignal>> returns no result.
+
+PORTABILITY
+POSIX.1-2008 requires <<psignal>>, but the strings issued vary from one
+implementation to another.
+
+Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
+<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
+*/
+
+#include <_ansi.h>
+#include <stdio.h>
+#include <string.h>
+
+_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));
+}