From 6c8dd50ab8767b7feebe88f3526a8ee38806de5a Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 21 Oct 2013 12:08:46 +0900 Subject: [PATCH] add exit and emergency-exit --- src/system.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/system.c b/src/system.c index 4b1ed99e..471ba565 100644 --- a/src/system.c +++ b/src/system.c @@ -21,6 +21,22 @@ pic_system_cmdline(pic_state *pic) 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 pic_system_getenv(pic_state *pic) { @@ -70,6 +86,8 @@ void pic_init_system(pic_state *pic) { 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-variables", pic_system_getenvs); }