aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-12-27 21:46:10 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-12-27 21:48:19 +0100
commit4755ad22cdfa2c7414cc66e068b884f90f2cc639 (patch)
tree3023fb98195d447dec0d4f3696d61fdd8a428138 /src
parent5359e0ca10669b08eebd1beaaa2e9fb05cf9ac52 (diff)
downloadblogc-4755ad22cdfa2c7414cc66e068b884f90f2cc639.tar.gz
blogc-4755ad22cdfa2c7414cc66e068b884f90f2cc639.tar.bz2
blogc-4755ad22cdfa2c7414cc66e068b884f90f2cc639.zip
runserver: exit cleanly on ^C
Diffstat (limited to 'src')
-rw-r--r--src/blogc-runserver/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/blogc-runserver/main.c b/src/blogc-runserver/main.c
index 3b6f2c2..6ac638d 100644
--- a/src/blogc-runserver/main.c
+++ b/src/blogc-runserver/main.c
@@ -44,10 +44,17 @@ print_usage(void)
}
+void sigint_handler(int sig) {
+ printf("\n");
+ exit(0);
+}
+
+
int
main(int argc, char **argv)
{
signal(SIGPIPE, SIG_IGN);
+ signal(SIGINT, sigint_handler);
int rv = 0;
char *host = NULL;