Commit | Line | Data |
85e6fe83 |
1 | ?RCS: $Id: sig_name.U,v 3.0 1993/08/18 12:09:47 ram Exp $ |
2 | ?RCS: |
3 | ?RCS: Copyright (c) 1991-1993, Raphael Manfredi |
4 | ?RCS: |
5 | ?RCS: You may redistribute only under the terms of the Artistic Licence, |
6 | ?RCS: as specified in the README file that comes with the distribution. |
7 | ?RCS: You may reuse parts of this distribution only within the terms of |
8 | ?RCS: that same Artistic Licence; a copy of which may be found at the root |
9 | ?RCS: of the source tree for dist 3.0. |
10 | ?RCS: |
11 | ?RCS: $Log: sig_name.U,v $ |
12 | ?RCS: Revision 3.0 1993/08/18 12:09:47 ram |
13 | ?RCS: Baseline for dist 3.0 netwide release. |
14 | ?RCS: |
15 | ?MAKE:sig_name: awk rm Findhdr |
16 | ?MAKE: -pick add $@ %< |
17 | ?S:sig_name: |
18 | ?S: This variable holds the signal names, space separated. The leading |
19 | ?S: SIG in signals name is removed. |
20 | ?S:. |
21 | ?C:SIG_NAME: |
22 | ?C: This symbol contains a list of signal names in order. This is intended |
23 | ?C: to be used as a static array initialization, like this: |
24 | ?C: char *sig_name[] = { SIG_NAME }; |
25 | ?C: The signals in the list are separated with commas, and each signal |
26 | ?C: is surrounded by double quotes. There is no leading SIG in the signal |
27 | ?C: name, i.e. SIGQUIT is known as "QUIT". |
28 | ?C:. |
29 | ?H:#define SIG_NAME "`echo $sig_name | sed 's/ /","/g'`" /**/ |
30 | ?H:. |
31 | ?T:xxx |
32 | : generate list of signal names |
33 | echo " " |
34 | case "$sig_name" in |
35 | '') |
36 | echo "Generating a list of signal names..." >&4 |
37 | xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h` |
38 | set X `cat $xxx 2>&1 | $awk ' |
39 | $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ { |
40 | sig[$3] = substr($2,4,20) |
41 | if (max < $3 && $3 < 60) { |
42 | max = $3 |
43 | } |
44 | } |
45 | |
46 | END { |
47 | for (i = 1; i <= max; i++) { |
48 | if (sig[i] == "") |
49 | printf "%d", i |
50 | else |
51 | printf "%s", sig[i] |
52 | if (i < max) |
53 | printf " " |
54 | } |
55 | printf "\n" |
56 | } |
57 | '` |
58 | shift |
59 | case $# in |
60 | 0) |
61 | echo 'kill -l' >/tmp/foo$$ |
62 | set X `csh -f </tmp/foo$$` |
63 | $rm -f /tmp/foo$$ |
64 | shift |
65 | case $# in |
66 | 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM |
67 | ;; |
68 | esac |
69 | ;; |
70 | esac |
71 | sig_name="ZERO $*" |
72 | ;; |
73 | esac |
74 | echo "The following signals are available:" |
75 | echo $sig_name | |
76 | $awk 'BEGIN { linelen = 0 } |
77 | { for (i = 1; i < NF; i++) |
78 | { |
79 | name = "SIG" $i " " |
80 | linelen = linelen + length(name) |
81 | if (linelen > 70) |
82 | { |
83 | printf "\n" |
84 | linelen = length(name) |
85 | } |
86 | printf "%s", name } }' |