home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Unix / Shells / zsh / Source / src / config / bz.signals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-07  |  2.9 KB  |  148 lines

  1. # --- ${BLDDIR}signals.h
  2.  
  3. if test -n "$B_signals_h"
  4. then
  5.  
  6. F_define=yep
  7.  
  8. echo
  9. echo Building ${BLDDIR}signals.h... | tr -d '\012'
  10. if test -n "$LINUX" -o -n "$UNICOS" -o -n "$AIX" -o -n "$SCO"
  11. # Awk script taken from Larry Wall's perl Configure script
  12. then 
  13. if test -n "$LINUX"
  14. then sigfile=/usr/include/linux/signal.h
  15. else sigfile=/usr/include/sys/signal.h
  16. fi
  17. echo `cat $sigfile 2>&1 | awk '
  18. $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
  19.     if (sig[$3] == "") {
  20.     sig[$3] = substr($2,4,20)
  21.     if (max < $3 && $3 < 60) {
  22.     max = $3
  23.     }
  24.     }
  25. }
  26. # next case handles "# define SIGx y"
  27. $1 ~ /^#$/ && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $4 ~ /^[1-9][0-9]*$/ {
  28.     if (sig[$4] == "") {
  29.     sig[$4] = substr($3,4,20)
  30.     if (max < $4 && $4 < 60) {
  31.     max = $4
  32.     }
  33.     }
  34. }
  35. END {
  36.     for (i=1; i<=max; i++) {
  37.     if (sig[i] == "")
  38.         printf "%d", i
  39.     else
  40.         printf "%s", sig[i]
  41.     if (i < max)
  42.         printf " "
  43.     }
  44.     printf "\n"
  45. }
  46. '` | tr ' ' '\012' > ${BLDDIR}signals.h
  47. else echo `csh -fc 'kill -l'` | tr ' ' '\012' >${BLDDIR}signals.h
  48. fi
  49. lct=`wc -l < ${BLDDIR}signals.h`
  50. cp ${BLDDIR}signals.h ${BLDDIR}signams.h
  51. (
  52. cat <<foo
  53. /* signals.h */
  54. /* architecture-customized signals.h for $VERSION
  55.  * for architecture "$arch",
  56.  * automagically generated by buildzsh -- do not edit */
  57. /* if all this is wrong, blame csh ;-) */
  58.  
  59. #define SIGCOUNT $lct
  60.  
  61. #ifdef GLOBALS
  62.  
  63. char *sigmsg[SIGCOUNT+2] = {
  64.     "done",
  65. foo
  66.  
  67. sed -e 's/^/SIG/' -e '/SIGHUP/s//hangup/
  68. /SIGINT/s//interrupt/
  69. /SIGQUIT/s//quit/
  70. /SIGILL/s//illegal instruction/
  71. /SIGTRAP/s//trace trap/
  72. /SIGIOT/s//IOT instruction/
  73. /SIGABRT/s//abort/
  74. /SIGEMT/s//EMT instruction/
  75. /SIGFPE/s//floating point exception/
  76. /SIGKILL/s//killed/
  77. /SIGBUS/s//bus error/
  78. /SIGSEGV/s//segmentation fault/
  79. /SIGSYS/s//bad system call/
  80. /SIGPIPE/s//broken pipe/
  81. /SIGTERM/s//terminated/
  82. /SIGPWR/s//power fail/
  83. /SIGVTALRM/s//virtual time alarm/
  84. /SIGCONT/s//continued/
  85. /SIGALRM/s//alarm/
  86. /SIGUSR1/s//user signal 1/
  87. /SIGUSR2/s//user signal 2/
  88. /SIGCHLD/s//death of child/
  89. /SIGIO/s//i\/o ready/
  90. /SIGPROF/s//profile signal/
  91. /SIGWINCH/s//window size changed/
  92. /SIGXCPU/s//cpu limit exceeded/
  93. /SIGXFSZ/s//filesize limit exceeded/' -e 's/.*/    "&",/' ${BLDDIR}signals.h
  94. echo '    NULL
  95. };
  96.  
  97. char *sigs[SIGCOUNT+4] = {
  98.     "EXIT",' ) >${BLDDIR}sigtmp.h
  99. mv ${BLDDIR}sigtmp.h ${BLDDIR}signals.h
  100. if grep SIGSTOP ${BLDDIR}signals.h >/dev/null
  101. then ed ${BLDDIR}signals.h <<'foo' >/dev/null 2>&1
  102. /SIGSTOP/c
  103. #ifdef USE_SUSPENDED
  104.     "suspended (signal)",
  105. #else
  106.     "stopped (signal)",
  107. #endif
  108. .
  109. /SIGTSTP/c
  110. #ifdef USE_SUSPENDED
  111.     "suspended",
  112. #else
  113.     "stopped",
  114. #endif
  115. .
  116. /SIGTTIN/c
  117. #ifdef USE_SUSPENDED
  118.     "suspended (tty input)",
  119. #else
  120.     "stopped (tty input)",
  121. #endif
  122. .
  123. /SIGTTOU/c
  124. #ifdef USE_SUSPENDED
  125.     "suspended (tty output)",
  126. #else
  127.     "stopped (tty output)",
  128. #endif
  129. .
  130. w
  131. q
  132. foo
  133. fi
  134. (sed 's/.*/    "&",/' ${BLDDIR}signams.h
  135. echo '    "ZERR",'
  136. echo '    "DEBUG",
  137.     NULL
  138. };
  139.  
  140. #else
  141.  
  142. extern char *sigs[SIGCOUNT+4],*sigmsg[SIGCOUNT+2];
  143.  
  144. #endif') >>${BLDDIR}signals.h
  145. rm ${BLDDIR}signams.h
  146. echo done
  147. fi
  148.