Retro68/gcc/newlib/libc/signal/psignal.c

45 lines
1.1 KiB
C
Raw Normal View History

2017-04-11 21:13:36 +00:00
/* Copyright 2002, 2011 Red Hat Inc. */
/*
FUNCTION
<<psignal>>---print a signal message on standard error
INDEX
psignal
2018-12-28 15:30:48 +00:00
SYNOPSIS
2017-04-11 21:13:36 +00:00
#include <stdio.h>
void psignal(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>
2018-12-28 15:30:48 +00:00
void
psignal (int sig,
const char *s)
2017-04-11 21:13:36 +00:00
{
if (s != NULL && *s != '\0')
fprintf (stderr, "%s: %s\n", s, strsignal (sig));
else
fprintf (stderr, "%s\n", strsignal (sig));
}