From: Matthew Farwell <dylan@ibmpcug.co.uk>
To: rc@archone.tamu.edu
Subject: Re: an improvement(?) suggestion and a question
Date: Thu, 19 Mar 1992 07:25:09 -0600 [thread overview]
Message-ID: <9203191325.AA02380@ibmpcug.co.uk> (raw)
In-Reply-To: <9203191254.AA02417@dahlie.techfak.uni-bielefeld.de>
In article <9203191254.AA02417@dahlie.techfak.uni-bielefeld.de> malte@techfak.uni-bielefeld.de writes:
>in rc's man page it says that $0 is set to name of the function during its
>execution, so a naive thought came to my mind:
>
> fn sighup sigint {
> echo $progname was killed by $0 | mail somebody
> exit 2
> }
>
>But this does not work since $0 when catching a signal is the name of
>of the function rc was currently working on.
>
>To change this, I have two suggestions:
> 1) Change the signal handler to place the signals name in $0
> and allow $* to be referenced with negative indices, with
> $*(-1) evaluating to the name of the function the present
> function was called from, $*(-2) ...
>
>This is a more general solution, or
>
> 2) Introduce a new special variable $signal which evaluates to
> the name of the most current signal, so that the above example
> will read
> ...
> echo $progname was killed by $signal | mail somebody
> ...
Or set $1 inside a signal handler to the name of the signal sent to the
function, ie
fn sigint sighup {
echo $0 killed by signal $1
}
Dylan.
--
re-invented wheels are often square -- Henry Spencer
prev parent reply other threads:[~1992-03-19 13:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-03-19 12:54 malte
1992-03-19 13:25 ` Matthew Farwell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9203191325.AA02380@ibmpcug.co.uk \
--to=dylan@ibmpcug.co.uk \
--cc=rc@archone.tamu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).