home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR24 / BASH_112.ZIP / BASH-112.TAR / bash-1.12 / siglist.c < prev    next >
C/C++ Source or Header  |  1991-10-30  |  4KB  |  221 lines

  1. /* siglist.c -- signal list for those machines that don't have one. */
  2.  
  3. /* Copyright (C) 1989 Free Software Foundation, Inc.
  4.  
  5. This file is part of GNU Bash, the Bourne Again SHell.
  6.  
  7. Bash is free software; you can redistribute it and/or modify it under
  8. the terms of the GNU General Public License as published by the Free
  9. Software Foundation; either version 1, or (at your option) any later
  10. version.
  11.  
  12. Bash is distributed in the hope that it will be useful, but WITHOUT ANY
  13. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License along
  18. with Bash; see the file COPYING.  If not, write to the Free Software
  19. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  20.  
  21. #include <stdio.h>
  22. #include <sys/types.h>
  23. #include <signal.h>
  24.  
  25. #if !defined (NSIG)
  26. #  if defined (_NSIG)
  27. #    define NSIG _NSIG
  28. #  else
  29. #    define NSIG 64
  30. #  endif /* !_NSIG */
  31. #endif /* !NSIG */
  32.  
  33. char *sys_siglist[NSIG];
  34.  
  35. extern char *xmalloc (), *malloc ();
  36.  
  37. initialize_siglist ()
  38. {
  39.   register int i;
  40.  
  41.   for (i = 0; i < NSIG; i++)
  42.     sys_siglist[i] = (char *)0x0;
  43.  
  44.   sys_siglist[0] = "Bogus signal";
  45.  
  46. #if defined (SIGHUP)
  47.   sys_siglist[SIGHUP] = "Hangup";
  48. #endif
  49.  
  50. #if defined (SIGINT)
  51.   sys_siglist[SIGINT] = "Interrupt";
  52. #endif
  53.  
  54. #if defined (SIGQUIT)
  55.   sys_siglist[SIGQUIT] = "Quit";
  56. #endif
  57.  
  58. #if defined (SIGILL)
  59.   sys_siglist[SIGILL] = "Illegal instruction";
  60. #endif
  61.  
  62. #if defined (SIGTRAP)
  63.   sys_siglist[SIGTRAP] = "BPT trace/trap";
  64. #endif
  65.  
  66. #if defined (SIGIOT) && !defined (SIGABRT)
  67. #define SIGABRT SIGIOT
  68. #endif
  69.  
  70. #if defined (SIGABRT)
  71.   sys_siglist[SIGABRT] = "ABORT instruction";
  72. #endif
  73.  
  74. #if defined (SIGEMT)
  75.   sys_siglist[SIGEMT] = "EMT instruction";
  76. #endif
  77.  
  78. #if defined (SIGFPE)
  79.   sys_siglist[SIGFPE] = "Floating point exception";
  80. #endif
  81.  
  82. #if defined (SIGKILL)
  83.   sys_siglist[SIGKILL] = "Killed";
  84. #endif
  85.  
  86. #if defined (SIGBUS)
  87.   sys_siglist[SIGBUS] = "Bus error";
  88. #endif
  89.  
  90. #if defined (SIGSEGV)
  91.   sys_siglist[SIGSEGV] = "Segmentation fault";
  92. #endif
  93.  
  94. #if defined (SIGSYS)
  95.   sys_siglist[SIGSYS] = "Bad system call";
  96. #endif
  97.  
  98. #if defined (SIGPIPE)
  99.   sys_siglist[SIGPIPE] = "Broken pipe";
  100. #endif
  101.  
  102. #if defined (SIGALRM)
  103.   sys_siglist[SIGALRM] = "Alarm clock";
  104. #endif
  105.  
  106. #if defined (SIGTERM)
  107.   sys_siglist[SIGTERM] = "Terminated";
  108. #endif
  109.  
  110. #if defined (SIGURG)
  111.   sys_siglist[SIGURG] = "Urgent IO condition";
  112. #endif
  113.  
  114. #if defined (SIGSTOP)
  115.   sys_siglist[SIGSTOP] = "Stopped (signal)";
  116. #endif
  117.  
  118. #if defined (SIGTSTP)
  119.   sys_siglist[SIGTSTP] = "Stopped";
  120. #endif
  121.  
  122. #if defined (SIGCONT)
  123.   sys_siglist[SIGCONT] = "Continue";
  124. #endif
  125.  
  126. #if !defined (SIGCHLD) && defined (SIGCLD)
  127. #define SIGCHLD SIGCLD
  128. #endif
  129.  
  130. #if defined (SIGCHLD)
  131.   sys_siglist[SIGCHLD] = "Child death or stop";
  132. #endif
  133.  
  134. #if defined (SIGTTIN)
  135.   sys_siglist[SIGTTIN] = "Stopped (tty input)";
  136. #endif
  137.  
  138. #if defined (SIGTTOU)
  139.   sys_siglist[SIGTTOU] = "Stopped (tty output)";
  140. #endif
  141.  
  142. #if defined (SIGIO)
  143.   sys_siglist[SIGIO] = "I/O ready";
  144. #endif
  145.  
  146. #if defined (SIGXCPU)
  147.   sys_siglist[SIGXCPU] = "CPU limit";
  148. #endif
  149.  
  150. #if defined (SIGXFSZ)
  151.   sys_siglist[SIGXFSZ] = "File limit";
  152. #endif
  153.  
  154. #if defined (SIGVTALRM)
  155.   sys_siglist[SIGVTALRM] = "Alarm (virtual)";
  156. #endif
  157.  
  158. #if defined (SIGPROF)
  159.   sys_siglist[SIGPROF] = "Alarm (profile)";
  160. #endif
  161.  
  162. #if defined (SIGWINCH)
  163.   sys_siglist[SIGWINCH] = "Window changed";
  164. #endif
  165.  
  166. #if defined (SIGLOST)
  167.   sys_siglist[SIGLOST] = "Record lock";
  168. #endif
  169.  
  170. #if defined (SIGUSR1)
  171.   sys_siglist[SIGUSR1] = "User signal 1";
  172. #endif
  173.  
  174. #if defined (SIGUSR2)
  175.   sys_siglist[SIGUSR2] = "User signal 2";
  176. #endif
  177.  
  178. #if defined (SIGMSG)
  179.   sys_siglist[SIGMSG] = "HFT input data pending";
  180. #endif 
  181.  
  182. #if defined (SIGPWR)
  183.   sys_siglist[SIGPWR] = "power failure imminent";
  184. #endif 
  185.  
  186. #if defined (SIGDANGER)
  187.   sys_siglist[SIGDANGER] = "system crash imminent";
  188. #endif 
  189.  
  190. #if defined (SIGMIGRATE)
  191.   sys_siglist[SIGMIGRATE] = "migrate process to another CPU";
  192. #endif 
  193.  
  194. #if defined (SIGPRE)
  195.   sys_siglist[SIGPRE] = "programming error";
  196. #endif 
  197.  
  198. #if defined (SIGGRANT)
  199.   sys_siglist[SIGGRANT] = "HFT monitor mode granted";
  200. #endif 
  201.  
  202. #if defined (SIGRETRACT)
  203.   sys_siglist[SIGRETRACT] = "HFT monitor mode retracted";
  204. #endif 
  205.  
  206. #if defined (SIGSOUND)
  207.   sys_siglist[SIGSOUND] = "HFT sound sequence has completed";
  208. #endif 
  209.  
  210.   for (i = 0; i < NSIG; i++)
  211.     {
  212.       if (!sys_siglist[i])
  213.     {
  214.       sys_siglist[i] =
  215.         (char *)xmalloc (10 + strlen ("Unknown Signal #"));
  216.  
  217.       sprintf (sys_siglist[i], "Unknown Signal #%d", i);
  218.     }
  219.     }
  220. }
  221.