All of lore.kernel.org
 help / color / mirror / Atom feed
From: Isaac Jurado <diptongo@gmail.com>
Subject: [PATCH] [BUILTIN] Allow SIG* signal names.
Date: Sun, 1 Jul 2012 12:12:20 +0200	[thread overview]
Message-ID: <4ff0274f.c54fb40a.47e2.6814@mx.google.com> (raw)

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;
+
 	for (signo = minsig; signo < NSIG; signo++) {
 		if (!strcasecmp(string, signal_names[signo])) {
 			return signo;
-- 
1.7.10.4

             reply	other threads:[~2012-07-01 10:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-01 10:12 Isaac Jurado [this message]
2012-07-02 13:51 ` [PATCH] [BUILTIN] Allow SIG* signal names Eric Blake
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=4ff0274f.c54fb40a.47e2.6814@mx.google.com \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.