diff options
Diffstat (limited to 'libiberty/strsignal.c')
-rw-r--r-- | libiberty/strsignal.c | 127 |
1 files changed, 48 insertions, 79 deletions
diff --git a/libiberty/strsignal.c b/libiberty/strsignal.c index 85639f9..521a2a8 100644 --- a/libiberty/strsignal.c +++ b/libiberty/strsignal.c @@ -350,28 +350,22 @@ init_signal_tables () /* -NAME - - signo_max -- return the max signo value - -SYNOPSIS +@deftypefn Extension int signo_max () - int signo_max (); +Returns the maximum signal value for which a corresponding symbolic +name or message is available. Note that in the case where we use the +@code{sys_siglist} supplied by the system, it is possible for there to +be more symbolic names than messages, or vice versa. In fact, the +manual page for @code{psignal(3b)} explicitly warns that one should +check the size of the table (@code{NSIG}) before indexing it, since +new signal codes may be added to the system before they are added to +the table. Thus @code{NSIG} might be smaller than value implied by +the largest signo value defined in @code{<signal.h>}. -DESCRIPTION - - Returns the maximum signo value for which a corresponding symbolic - name or message is available. Note that in the case where - we use the sys_siglist supplied by the system, it is possible for - there to be more symbolic names than messages, or vice versa. - In fact, the manual page for psignal(3b) explicitly warns that one - should check the size of the table (NSIG) before indexing it, - since new signal codes may be added to the system before they are - added to the table. Thus NSIG might be smaller than value - implied by the largest signo value defined in <signal.h>. +We return the maximum value that can be used to obtain a meaningful +symbolic name or message. - We return the maximum value that can be used to obtain a meaningful - symbolic name or message. +@end deftypefn */ @@ -391,31 +385,25 @@ signo_max () /* -NAME - - strsignal -- map a signal number to a signal message string +@deftypefn Supplemental {const char *} strsignal (int @var{signo}) -SYNOPSIS - - const char *strsignal (int signo) - -DESCRIPTION +Maps an signal number to an signal message string, the contents of +which are implementation defined. On systems which have the external +variable @code{sys_siglist}, these strings will be the same as the +ones used by @code{psignal()}. - Maps an signal number to an signal message string, the contents of - which are implementation defined. On systems which have the external - variable sys_siglist, these strings will be the same as the ones used - by psignal(). +If the supplied signal number is within the valid range of indices for +the @code{sys_siglist}, but no message is available for the particular +signal number, then returns the string @samp{Signal @var{num}}, where +@var{num} is the signal number. - If the supplied signal number is within the valid range of indices - for the sys_siglist, but no message is available for the particular - signal number, then returns the string "Signal NUM", where NUM is the - signal number. +If the supplied signal number is not a valid index into +@code{sys_siglist}, returns @code{NULL}. - If the supplied signal number is not a valid index into sys_siglist, - returns NULL. +The returned string is only guaranteed to be valid only until the next +call to @code{strsignal}. - The returned string is only guaranteed to be valid only until the - next call to strsignal. +@end deftypefn */ @@ -461,31 +449,23 @@ strsignal (signo) /* -NAME - - strsigno -- map an signal number to a symbolic name string +@deftypefn Extension {const char*} strsigno (int @var{signo}) -SYNOPSIS +Given an signal number, returns a pointer to a string containing the +symbolic name of that signal number, as found in @code{<signal.h>}. - const char *strsigno (int signo) +If the supplied signal number is within the valid range of indices for +symbolic names, but no name is available for the particular signal +number, then returns the string @samp{Signal @var{num}}, where +@var{num} is the signal number. -DESCRIPTION +If the supplied signal number is not within the range of valid +indices, then returns @code{NULL}. - Given an signal number, returns a pointer to a string containing - the symbolic name of that signal number, as found in <signal.h>. +The contents of the location pointed to are only guaranteed to be +valid until the next call to @code{strsigno}. - If the supplied signal number is within the valid range of indices - for symbolic names, but no name is available for the particular - signal number, then returns the string "Signal NUM", where NUM is - the signal number. - - If the supplied signal number is not within the range of valid - indices, then returns NULL. - -BUGS - - The contents of the location pointed to are only guaranteed to be - valid until the next call to strsigno. +@end deftypefn */ @@ -524,18 +504,12 @@ strsigno (signo) /* -NAME - - strtosigno -- map a symbolic signal name to a numeric value +@deftypefn Extension int strtosigno (const char *@var{name}) -SYNOPSIS +Given the symbolic name of a signal, map it to a signal number. If no +translation is found, returns 0. - int strtosigno (char *name) - -DESCRIPTION - - Given the symbolic name of a signal, map it to a signal number. - If no translation is found, returns 0. +@end deftypefn */ @@ -570,19 +544,14 @@ strtosigno (name) /* -NAME +@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message}) - psignal -- print message about signal to stderr +Print @var{message} to the standard error, followed by a colon, +followed by the description of the signal specified by @var{signo}, +followed by a newline. -SYNOPSIS - - void psignal (unsigned signo, char *message); - -DESCRIPTION +@end deftypefn - Print to the standard error the message, followed by a colon, - followed by the description of the signal specified by signo, - followed by a newline. */ #ifndef HAVE_PSIGNAL |