aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2021-07-22 14:42:58 +0200
committerWojtek Kosior <koszko@koszko.org>2021-07-22 14:42:58 +0200
commitb6ace6eda12140c29ee58ec9178b9212b21fa538 (patch)
tree61f278c90c4d96e9fe686230442d7993b1949890 /main.c
parent91d4ce9f14668a5a04b51158b1921e83d51ba9a0 (diff)
downloadhydrilla-b6ace6eda12140c29ee58ec9178b9212b21fa538.tar.gz
hydrilla-b6ace6eda12140c29ee58ec9178b9212b21fa538.zip
add option to wait for termination by SIGTERM instead of by stdin input
Diffstat (limited to 'main.c')
-rw-r--r--main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/main.c b/main.c
index 99769f2..b5619fe 100644
--- a/main.c
+++ b/main.c
@@ -13,6 +13,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
+#include <stdlib.h>
#include <cjson/cJSON.h>
@@ -155,7 +156,7 @@ static void print_component_name(const void *key, void *val, void *arg)
unfilled ? " (referenced only)" : "");
}
-int serve_scriptbase(struct scriptbase *base);
+int serve_scriptbase(struct scriptbase *base, bool);
int main(int argc, char *argv[])
{
@@ -174,7 +175,7 @@ int main(int argc, char *argv[])
puts("## LOADED PAGES:");
ht_map(&base.pages, (void*) 'p', print_component_name);
- if (serve_scriptbase(&base))
+ if (serve_scriptbase(&base, !!getenv("HYDRILLA_WAIT_SIGTERM")))
fprintf(stderr, "Error serving scriptbase.\n");
scriptbase_destroy(&base);