aboutsummaryrefslogtreecommitdiffstats
path: root/supervise.c
blob: 3bae8cfd99bd4d48dc89c44a6bf997dad066b381 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}