From: Tadayoshi Funaba Date: 1999-06-27T20:56:14+09:00 Subject: [ruby-dev:7234] exit! ふなばです。 exit! の引数 (status) が正しく解釈されないようです。また、マニュアルで は exit と同様に引数を省くことができることになっていますが、実際にはで きません。とりあえずは、exit に合せる方向で修正してみました。 --- process.c.orig Thu Jun 24 13:24:00 1999 +++ process.c Sun Jun 27 19:50:11 1999 @@ -539,23 +539,27 @@ } static VALUE -rb_f_exit_bang(obj, status) - VALUE obj, status; +rb_f_exit_bang(argc, argv, obj) + int argc; + VALUE *argv; + VALUE obj; { - int code = -1; + VALUE status; + int istatus; rb_secure(4); - if (FIXNUM_P(status)) { - code = INT2FIX(status); + if (rb_scan_args(argc, argv, "01", &status) == 1) { + istatus = NUM2INT(status); + } + else { + istatus = -1; } - #ifdef USE_CWGUSI - exit(code); + exit(istatus); #else - _exit(code); + _exit(istatus); #endif - - /* not reached */ + return Qnil; /* not reached */ } void @@ -1007,7 +1011,7 @@ rb_define_global_function("exec", rb_f_exec, -1); #endif rb_define_global_function("fork", rb_f_fork, 0); - rb_define_global_function("exit!", rb_f_exit_bang, 1); + rb_define_global_function("exit!", rb_f_exit_bang, -1); rb_define_global_function("system", rb_f_system, -1); rb_define_global_function("sleep", rb_f_sleep, -1); @@ -1029,7 +1033,7 @@ #if !defined(NT) rb_define_singleton_method(rb_mProcess, "fork", rb_f_fork, 0); #endif - rb_define_singleton_method(rb_mProcess, "exit!", rb_f_exit_bang, 1); + rb_define_singleton_method(rb_mProcess, "exit!", rb_f_exit_bang, -1); #ifndef USE_CWGUSI rb_define_module_function(rb_mProcess, "kill", rb_f_kill, -1); #endif --- eval.c.orig Fri Jun 25 18:02:34 1999 +++ eval.c Sun Jun 27 19:50:11 1999 @@ -2935,15 +2935,16 @@ VALUE obj; { VALUE status; + int istatus; rb_secure(4); if (rb_scan_args(argc, argv, "01", &status) == 1) { - status = NUM2INT(status); + istatus = NUM2INT(status); } else { - status = 0; + istatus = 0; } - rb_exit(status); + rb_exit(istatus); return Qnil; /* not reached */ } あと、ついでに近頃気になったことです。 o マニュアルにある Dir.dir は実際には存在しない。 o FileTest?.size? は整数か false を返すが、これは、どなたかが提案した 規則に合っていないかも (Numeric#nonzero? などと異なる)。 o マニュアルによると、IO.select の timeout は Time でもよいとされてい るが、それは違うように思う。 'Jluisptf lainpoftlhieprf lRiupbfyl ihpafclkiepr,'.gsub(/[flip]/,'flap'*0).display ふなば ただよし