tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit 6d7c89f476fe0d270c7b59934b000da53ee57d55
parent 40756e4b5c8e5c32fcfffcad6af99b47c12925bf
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Tue, 29 Sep 2020 20:05:42 -0700

Use sigaction to handle signals

Diffstat:
main.c | 12++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/main.c b/main.c @@ -14,13 +14,6 @@ tsp_include_tib(string); #endif -/* stop program from being terminated with CTRL+C */ -void -handler_sigint(int sig) -{ - sig = sig; /* prevent compiler warnings */ -} - int main(int argc, char *argv[]) { @@ -37,7 +30,10 @@ main(int argc, char *argv[]) tisp_env_lib(st, libs_tsp); #endif - signal(SIGINT, handler_sigint); + /* TODO SIGTERM to handle garbage collection */ + struct sigaction sigint; + sigint.sa_handler = SIG_IGN; + sigaction(SIGINT, &sigint, NULL); if (argc == 1) { st->file = "(repl)";