diff options
Diffstat (limited to 'supervise.c')
-rw-r--r-- | supervise.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/supervise.c b/supervise.c new file mode 100644 index 0000000..3bae8cf --- /dev/null +++ b/supervise.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <err.h> + +char *const run_path[] = { "./run", NULL }; + +int +main(int argc, char **argv) +{ + if (argc != 2) + errx(1, "Usage: %s <dir>\n", argv[0]); + + if (chdir(argv[1]) == -1) + err(1, "chdir()"); + + execv(run_path[0], run_path); + + return 0; +} |