source: trunk/libs/newlib/src/newlib/libc/signal/psignal.c @ 543

Last change on this file since 543 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.1 KB
Line 
1/* Copyright 2002, 2011 Red Hat Inc. */
2/*
3FUNCTION
4<<psignal>>---print a signal message on standard error
5
6INDEX
7        psignal
8
9SYNOPSIS
10        #include <stdio.h>
11        void psignal(int <[signal]>, const char *<[prefix]>);
12
13DESCRIPTION
14Use <<psignal>> to print (on standard error) a signal message
15corresponding to the value of the signal number <[signal]>.
16Unless you use <<NULL>> as the value of the argument <[prefix]>, the
17signal message will begin with the string at <[prefix]>, followed by a
18colon and a space (<<: >>). The remainder of the signal message is one
19of the strings described for <<strsignal>>.
20
21RETURNS
22<<psignal>> returns no result.
23
24PORTABILITY
25POSIX.1-2008 requires <<psignal>>, but the strings issued vary from one
26implementation to another.
27
28Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
29<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
30*/
31
32#include <_ansi.h>
33#include <stdio.h>
34#include <string.h>
35
36void
37psignal (int sig,
38       const char *s)
39{
40  if (s != NULL && *s != '\0')
41    fprintf (stderr, "%s: %s\n", s, strsignal (sig));
42  else
43    fprintf (stderr, "%s\n", strsignal (sig));
44}
Note: See TracBrowser for help on using the repository browser.