diff options
Diffstat (limited to 'U/sig_name.U')
-rw-r--r-- | U/sig_name.U | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/U/sig_name.U b/U/sig_name.U new file mode 100644 index 0000000000..9b3f9e3440 --- /dev/null +++ b/U/sig_name.U @@ -0,0 +1,86 @@ +?RCS: $Id: sig_name.U,v 3.0 1993/08/18 12:09:47 ram Exp $ +?RCS: +?RCS: Copyright (c) 1991-1993, Raphael Manfredi +?RCS: +?RCS: You may redistribute only under the terms of the Artistic Licence, +?RCS: as specified in the README file that comes with the distribution. +?RCS: You may reuse parts of this distribution only within the terms of +?RCS: that same Artistic Licence; a copy of which may be found at the root +?RCS: of the source tree for dist 3.0. +?RCS: +?RCS: $Log: sig_name.U,v $ +?RCS: Revision 3.0 1993/08/18 12:09:47 ram +?RCS: Baseline for dist 3.0 netwide release. +?RCS: +?MAKE:sig_name: awk rm Findhdr +?MAKE: -pick add $@ %< +?S:sig_name: +?S: This variable holds the signal names, space separated. The leading +?S: SIG in signals name is removed. +?S:. +?C:SIG_NAME: +?C: This symbol contains a list of signal names in order. This is intended +?C: to be used as a static array initialization, like this: +?C: char *sig_name[] = { SIG_NAME }; +?C: The signals in the list are separated with commas, and each signal +?C: is surrounded by double quotes. There is no leading SIG in the signal +?C: name, i.e. SIGQUIT is known as "QUIT". +?C:. +?H:#define SIG_NAME "`echo $sig_name | sed 's/ /","/g'`" /**/ +?H:. +?T:xxx +: generate list of signal names +echo " " +case "$sig_name" in +'') + echo "Generating a list of signal names..." >&4 + xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h` + set X `cat $xxx 2>&1 | $awk ' +$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ { + sig[$3] = substr($2,4,20) + if (max < $3 && $3 < 60) { + max = $3 + } +} + +END { + for (i = 1; i <= max; i++) { + if (sig[i] == "") + printf "%d", i + else + printf "%s", sig[i] + if (i < max) + printf " " + } + printf "\n" +} +'` + shift + case $# in + 0) + echo 'kill -l' >/tmp/foo$$ + set X `csh -f </tmp/foo$$` + $rm -f /tmp/foo$$ + shift + case $# in + 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM + ;; + esac + ;; + esac + sig_name="ZERO $*" + ;; +esac +echo "The following signals are available:" +echo $sig_name | + $awk 'BEGIN { linelen = 0 } + { for (i = 1; i < NF; i++) + { + name = "SIG" $i " " + linelen = linelen + length(name) + if (linelen > 70) + { + printf "\n" + linelen = length(name) + } + printf "%s", name } }' |