OSDN Git Service

* global.c (compute_regsets): Move declatation of "i" inside of
[pf3gnuchains/gcc-fork.git] / libiberty / strsignal.c
index 2533adc..4ca9e21 100644 (file)
@@ -2,15 +2,14 @@
    Written by Fred Fish.  fnf@cygnus.com
    This file is in the public domain.  */
 
+#include "config.h"
 #include "ansidecl.h"
 #include "libiberty.h"
 
-#include "config.h"
-
 /* We need to declare sys_siglist, because even if the system provides
    it we can't assume that it is declared in <signal.h> (for example,
    SunOS provides sys_siglist, but it does not declare it in any
-   header file).  fHowever, we can't declare sys_siglist portably,
+   header file).  However, we can't declare sys_siglist portably,
    because on some systems it is declared with const and on some
    systems it is declared without const.  If we were using autoconf,
    we could work out the right declaration.  Until, then we just
@@ -42,18 +41,14 @@ extern PTR memset ();
 #undef sys_nsig
 
 #ifndef NULL
-#  ifdef __STDC__
-#    define NULL (void *) 0
-#  else
-#    define NULL 0
-#  endif
+#  define NULL (void *) 0
 #endif
 
 #ifndef MAX
 #  define MAX(a,b) ((a) > (b) ? (a) : (b))
 #endif
 
-static void init_signal_tables PARAMS ((void));
+static void init_signal_tables (void);
 
 /* Translation table for signal values.
 
@@ -67,10 +62,10 @@ static void init_signal_tables PARAMS ((void));
 
 struct signal_info
 {
-  int value;           /* The numeric value from <signal.h> */
-  const char *name;    /* The equivalent symbolic value */
+  const int value;             /* The numeric value from <signal.h> */
+  const char *const name;      /* The equivalent symbolic value */
 #ifndef HAVE_SYS_SIGLIST
-  const char *msg;     /* Short message about this value */
+  const char *const msg;       /* Short message about this value */
 #endif
 };
 
@@ -289,7 +284,7 @@ BUGS
 */
 
 static void
-init_signal_tables ()
+init_signal_tables (void)
 {
   const struct signal_info *eip;
   int nbytes;
@@ -350,33 +345,27 @@ init_signal_tables ()
 
 /*
 
-NAME
-
-       signo_max -- return the max signo value
+@deftypefn Extension int signo_max (void)
 
-SYNOPSIS
-
-       int signo_max ();
-
-DESCRIPTION
+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>}.
 
-       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
 
 */
 
 int
-signo_max ()
+signo_max (void)
 {
   int maxsize;
 
@@ -391,39 +380,32 @@ signo_max ()
 
 /*
 
-NAME
-
-       strsignal -- map a signal number to a signal message string
+@deftypefn Supplemental {const char *} strsignal (int @var{signo})
 
-SYNOPSIS
+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()}.
 
-       const char *strsignal (int signo)
-
-DESCRIPTION
+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.
 
-       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 not a valid index into
+@code{sys_siglist}, returns @code{NULL}.
 
-       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.
+The returned string is only guaranteed to be valid only until the next
+call to @code{strsignal}.
 
-       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 strsignal.
+@end deftypefn
 
 */
 
 #ifndef HAVE_STRSIGNAL
 
 const char *
-strsignal (signo)
-  int signo;
+strsignal (int signo)
 {
   const char *msg;
   static char buf[32];
@@ -461,37 +443,28 @@ strsignal (signo)
 
 /*
 
-NAME
-
-       strsigno -- map an signal number to a symbolic name string
+@deftypefn Extension {const char*} strsigno (int @var{signo})
 
-SYNOPSIS
-
-       const char *strsigno (int signo)
+Given an signal number, returns a pointer to a string containing the
+symbolic name of that signal number, as found in @code{<signal.h>}.
 
-DESCRIPTION
+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.
 
-       Given an signal number, returns a pointer to a string containing
-       the symbolic name of that signal number, as found in <signal.h>.
+If the supplied signal number is not within the range of valid
+indices, then returns @code{NULL}.
 
-       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.
+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 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
 
 */
 
 const char *
-strsigno (signo)
-  int signo;
+strsigno (int signo)
 {
   const char *name;
   static char buf[32];
@@ -524,24 +497,17 @@ strsigno (signo)
 
 /*
 
-NAME
-
-       strtosigno -- map a symbolic signal name to a numeric value
+@deftypefn Extension int strtosigno (const char *@var{name})
 
-SYNOPSIS
-
-       int strtosigno (char *name)
+Given the symbolic name of a signal, map it to a signal number.  If no
+translation is found, returns 0.
 
-DESCRIPTION
-
-       Given the symbolic name of a signal, map it to a signal number.
-       If no translation is found, returns 0.
+@end deftypefn
 
 */
 
 int
-strtosigno (name)
-     const char *name;
+strtosigno (const char *name)
 {
   int signo = 0;
 
@@ -570,27 +536,20 @@ strtosigno (name)
 
 /*
 
-NAME
+@deftypefn Supplemental void psignal (int @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
 
 void
-psignal (signo, message)
-  unsigned signo;
-  char *message;
+psignal (int signo, char *message)
 {
   if (signal_names == NULL)
     {
@@ -617,7 +576,7 @@ psignal (signo, message)
 #include <stdio.h>
 
 int
-main ()
+main (void)
 {
   int signo;
   int maxsigno;