summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-08-23 06:02:15 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-08-23 06:02:15 +0000
commit1289a7a11fe55a4e37d923fc6b0af2c228e83175 (patch)
treefe8a90542f77c78ecdaef684d155c6ea66a7dcef /signal.c
parente15efe7733f5e6e9377ae1bd2fc5f6029c919f1d (diff)
* eval.c (is_defined): should not dump core for "defined?(())".
* eval.c (umethod_bind): recv can be an instance of descender of oklass if oklass is a Module. * hash.c (rb_hash_equal): check identiry equality first. * file.c (group_member): should check real gid only. * file.c (eaccess): do not cache euid, since effective euid may be changed via Process.euid=(). * file.c (eaccess): return -1 unless every specified access mode is permitted. * eval.c (rb_eval): while/until returns the value which is given to break. * parse.y (value_expr): using while/until/class/def as an expression is now gives a warning, not an error. * range.c (range_eqq): should compare strings based on magical increment (using String#upto), not dictionary order. * enum.c (enum_sort_by): new method for Schewartzian transformed stable sort. * variable.c (mod_av_set): detect constant overriding for built-in classes/modules. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/signal.c b/signal.c
index bdfa321..57e7002 100644
--- a/signal.c
+++ b/signal.c
@@ -609,7 +609,7 @@ rb_trap_restore_mask()
}
static VALUE
-rb_f_trap(argc, argv)
+sig_trap(argc, argv)
int argc;
VALUE *argv;
{
@@ -643,11 +643,28 @@ rb_f_trap(argc, argv)
#endif
}
+static VALUE
+sig_list()
+{
+ VALUE h = rb_hash_new();
+ struct signals *sigs;
+
+ for (sigs = siglist; sigs->signm; sigs++) {
+ rb_hash_aset(h, rb_str_new2(sigs->signm), INT2FIX(sigs->signo));
+ }
+ return h;
+}
+
void
Init_signal()
{
#ifndef MACOS_UNUSE_SIGNAL
- rb_define_global_function("trap", rb_f_trap, -1);
+ VALUE mSignal = rb_define_module("Signal");
+
+ rb_define_global_function("trap", sig_trap, -1);
+ rb_define_module_function(mSignal, "trap", sig_trap, -1);
+ rb_define_module_function(mSignal, "list", sig_list, 0);
+
ruby_signal(SIGINT, sighandle);
#ifdef SIGHUP
ruby_signal(SIGHUP, sighandle);