summary refs log tree commit diff
path: root/main.c
blob: 8a874420219e28f62791f83dde4b0ac65be5f55a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <string.h>
#include <errno.h>
#include <stdio.h>

#include "fdwatcher.h"
#include "logging.h"
#include "network.h"
#include "parent.h"
#include "child.h"

int
isChildProcess(int argc, char **argv)
{
	if (argc < 3) {
		return 0;
	}

	if (strcmp(argv[1], "childprocess") != 0) {
		return 0;
	}

	return 1;
}

int
main(int argc, char **argv)
{
	#ifdef __OpenBSD__
	aura_printf("hello, OpenBSD user. for paranoia's sake, pledge(3) will be run.\n");
	pledge("stdio inet", "stdio inet");
	aura_printf("yippie\n");
	#endif

	if (isChildProcess(argc, argv)) {
		aura_printf("child process\n");
		return childProcessMain(argc, argv);
	}

	return parentProcessMain();
}