Kouhei Sutou
kous****@users*****
Wed Apr 5 22:56:15 JST 2006
Index: kazehakase/ext/ruby/kz-rb-ext.c diff -u kazehakase/ext/ruby/kz-rb-ext.c:1.9 kazehakase/ext/ruby/kz-rb-ext.c:1.10 --- kazehakase/ext/ruby/kz-rb-ext.c:1.9 Tue Apr 4 23:41:59 2006 +++ kazehakase/ext/ruby/kz-rb-ext.c Wed Apr 5 22:56:15 2006 @@ -59,17 +59,53 @@ rb_define_module_function(mKz, "gettext", rb_kz_gettext, 1); } +static void +kz_ext_ruby_init(void) +{ + RETSIGTYPE (*sigint_handler)_((int)); +#ifdef SIGHUP + RETSIGTYPE (*sighup_handler)_((int)); +#endif +#ifdef SIGQUIT + RETSIGTYPE (*sigquit_handler)_((int)); +#endif +#ifdef SIGTERM + RETSIGTYPE (*sigterm_handler)_((int)); +#endif + + sigint_handler = signal(SIGINT, SIG_DFL); +#ifdef SIGHUP + sighup_handler = signal(SIGHUP, SIG_DFL); +#endif +#ifdef SIGQUIT + sigquit_handler = signal(SIGQUIT, SIG_DFL); +#endif +#ifdef SIGTERM + sigterm_handler = signal(SIGTERM, SIG_DFL); +#endif + + ruby_init(); + + ruby_signal(SIGINT, sigint_handler); +#ifdef SIGHUP + ruby_signal(SIGHUP, sighup_handler); +#endif +#ifdef SIGQUIT + ruby_signal(SIGQUIT, sigquit_handler); +#endif +#ifdef SIGTERM + ruby_signal(SIGTERM, sigterm_handler); +#endif +} + void kz_ext_init () { VALUE stack_start; gchar *dirname; char *argv[] = {"kazehakase"}; - RETSIGTYPE (*sigint_handler)_((int)); - sigint_handler = signal(SIGINT, SIG_DFL); - ruby_init(); - ruby_signal(SIGINT, sigint_handler); + kz_ext_ruby_init(); Init_stack(&stack_start);