Re: [PATCH] [BUILTIN] Allow SIG* signal names.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux