DASH Shell discussions
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Isaac Jurado <diptongo@gmail.com>
Cc: dash <dash@vger.kernel.org>
Subject: Re: [PATCH] [BUILTIN] Allow SIG* signal names.
Date: Mon, 02 Jul 2012 07:51:43 -0600	[thread overview]
Message-ID: <4FF1A76F.6020307@redhat.com> (raw)
In-Reply-To: <4ff0274f.c54fb40a.47e2.6814@mx.google.com>

[-- Attachment #1: Type: text/plain, Size: 1187 bytes --]

On 07/01/2012 04:12 AM, Isaac Jurado wrote:
> In other shells, both trap and kill builtins accept two form of signal names,
> i.e., TERM and SIGTERM.  Even /bin/kill allows the SIG* form.  Having dash fail
> by not recognizing the SIG prefix introduces some confusion among users.
> ---
>  src/trap.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/trap.c b/src/trap.c
> index 17316c9..a64133c 100644
> --- a/src/trap.c
> +++ b/src/trap.c
> @@ -408,6 +408,9 @@ int decode_signal(const char *string, int minsig)
>  		return signo;
>  	}
>  
> +	if (string[0] == 'S' && string[1] == 'I' && string[2] == 'G')
> +		string += 3;
> +

POSIX says:

"Implementations may permit names with the SIG prefix or ignore case in
signal names as an extension."

>  	for (signo = minsig; signo < NSIG; signo++) {
>  		if (!strcasecmp(string, signal_names[signo])) {

And since we're already ignoring case in the rest of the name, you
should also ignore case for the SIG, if we decide to accept the
non-required bloat this patch provides.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

  reply	other threads:[~2012-07-02 13:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-01 10:12 [PATCH] [BUILTIN] Allow SIG* signal names Isaac Jurado
2012-07-02 13:51 ` Eric Blake [this message]
2012-07-02 14:11   ` Paul Gilmartin
2012-07-02 14:22     ` Eric Blake
2012-07-02 18:53       ` Isaac Jurado
2012-07-02 18:57         ` Isaac Jurado
2012-07-02 19:07         ` Eric Blake
2012-07-02 19:21           ` Isaac Jurado
2012-07-03 20:13       ` Jilles Tjoelker
2012-07-05  7:43         ` Herbert Xu
2012-07-05 21:01           ` Isaac Jurado

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=4FF1A76F.6020307@redhat.com \
    --to=eblake@redhat.com \
    --cc=dash@vger.kernel.org \
    --cc=diptongo@gmail.com \
    /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