From 972d001fd6dd332a0f28d77d272206e0fe80470a Mon Sep 17 00:00:00 2001 From: buffet <niclas@countingsort.com> Date: Sun, 30 Sep 2018 20:07:00 +0200 Subject: [PATCH] Execute config file --- lit/wmaffle.lit | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lit/wmaffle.lit b/lit/wmaffle.lit index 5362e94..e1f88d8 100644 --- a/lit/wmaffle.lit +++ b/lit/wmaffle.lit @@ -30,6 +30,8 @@ main(int argc, char *argv[]) @{open ipc connection} @{setup signal handlers} + + @{execute config} } --- @@ -254,3 +256,29 @@ Which of course requires this. #include <signal.h> #include <sys/wait.h> --- + +@s Execute config + +We'll do this in a function, so we can execute later on, when the user requests it. + +--- function definitions += +static void +exec_config(const char *path) +{ + switch (fork()) { + case -1: + fprintf(stderr, "%s: failed to execute config\n", argv0); + break; + case 0: + execl(path, path, NULL); + die("%s: failed to execute config\n", argv0); + break; + } +} +--- + +We need to invoke this once all the connections are open + +--- execute config +exec_config(config_path); +---