home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / unix / unixlib_1 / !UnixLib37_src_c_psignal < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-09  |  1.1 KB  |  40 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /unixb/home/unixlib/source/unixlib37/src/c/RCS/psignal,v $
  4.  * $Date: 1996/05/06 09:03:13 $
  5.  * $Revision: 1.1 $
  6.  * $State: Rel $
  7.  * $Author: unixlib $
  8.  *
  9.  * $Log: psignal,v $
  10.  * Revision 1.1  1996/05/06 09:03:13  unixlib
  11.  * Initial revision
  12.  *
  13.  ***************************************************************************/
  14.  
  15. static const char rcs_id[] = "$Id: psignal,v 1.1 1996/05/06 09:03:13 unixlib Rel $";
  16.  
  17. #include <stdio.h>
  18. #include <signal.h>
  19. #include <string.h>
  20.  
  21. /* Print out on stderr a line consisting of the test in S, a colon, a space,
  22.    a message describing the meaning of the signal number SIG and a newline.
  23.    If S is NULL or "", the colon and space are omitted.  */
  24.  
  25. void
  26. psignal (int sig, register const char *s)
  27. {
  28.   const char *colon;
  29.  
  30.   if (s == NULL || s == '\0')
  31.     s = colon = "";
  32.   else
  33.     colon = ": ";
  34.  
  35.   if (sig >= 0 && sig < NSIG)
  36.     fprintf (stderr, "%s%s%s\n", s, colon, sys_siglist[sig]);
  37.   else
  38.     fprintf (stderr, "%s%sUnknown signal %d\n", s, colon, sig);
  39. }
  40.