add exit and emergency-exit
This commit is contained in:
parent
db1f977600
commit
6c8dd50ab8
18
src/system.c
18
src/system.c
|
@ -21,6 +21,22 @@ pic_system_cmdline(pic_state *pic)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static pic_value
|
||||||
|
pic_system_exit(pic_state *pic)
|
||||||
|
{
|
||||||
|
pic_get_args(pic, "");
|
||||||
|
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static pic_value
|
||||||
|
pic_system_emergency_exit(pic_state *pic)
|
||||||
|
{
|
||||||
|
pic_get_args(pic, "");
|
||||||
|
|
||||||
|
_Exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
pic_system_getenv(pic_state *pic)
|
pic_system_getenv(pic_state *pic)
|
||||||
{
|
{
|
||||||
|
@ -70,6 +86,8 @@ void
|
||||||
pic_init_system(pic_state *pic)
|
pic_init_system(pic_state *pic)
|
||||||
{
|
{
|
||||||
pic_defun(pic, "command-line", pic_system_cmdline);
|
pic_defun(pic, "command-line", pic_system_cmdline);
|
||||||
|
pic_defun(pic, "exit", pic_system_exit);
|
||||||
|
pic_defun(pic, "emergency-exit", pic_system_emergency_exit);
|
||||||
pic_defun(pic, "get-environment-variable", pic_system_getenv);
|
pic_defun(pic, "get-environment-variable", pic_system_getenv);
|
||||||
pic_defun(pic, "get-environment-variables", pic_system_getenvs);
|
pic_defun(pic, "get-environment-variables", pic_system_getenvs);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue