Created
April 2, 2010 22:06
-
-
Save gnufied/353790 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define EXIT_FAILURE 1 | |
static VALUE | |
rb_f_exit_bang(argc, argv, obj) | |
int argc; | |
VALUE *argv; | |
VALUE obj; | |
{ | |
VALUE status; | |
int istatus; | |
rb_secure(4); | |
if (rb_scan_args(argc, argv, "01", &status) == 1) { | |
switch (status) { | |
case Qtrue: | |
istatus = EXIT_SUCCESS; | |
break; | |
case Qfalse: | |
istatus = EXIT_FAILURE; | |
break; | |
default: | |
istatus = NUM2INT(status); | |
break; | |
} | |
} | |
else { | |
istatus = EXIT_FAILURE; | |
} | |
_exit(istatus); | |
return Qnil; /* not reached */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment