summaryrefslogtreecommitdiffstats
path: root/main.c
blob: e081109c3b85943784c41425ba601f5b77fdae62 (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
#include <getopt.h>
#include "procd.h"

int debug = 0;

static int usage(const char *prog)
{
	fprintf(stderr, "Usage: %s [options]\n"
		"Options:\n"
		"    -s <path>:		Path to ubus socket\n"
		"    -d:		Enable debug messages\n"
		"\n", prog);
	return 1;
}

int main(int argc, char **argv)
{
	int ch;

	while ((ch = getopt(argc, argv, "ds:")) != -1) {
		switch (ch) {
		case 's':
			ubus_socket = optarg;
			break;
		case 'd':
			debug++;
			break;
		default:
			return usage(argv[0]);
		}
	}
	uloop_init();
	procd_connect_ubus();
	uloop_run();

	return 0;
}