add udevtrigger tool
[project/procd.git] / main.c
1 #include <getopt.h>
2 #include "procd.h"
3
4 int debug = 0;
5
6 static int usage(const char *prog)
7 {
8         fprintf(stderr, "Usage: %s [options]\n"
9                 "Options:\n"
10                 "    -s <path>:         Path to ubus socket\n"
11                 "    -d:                Enable debug messages\n"
12                 "\n", prog);
13         return 1;
14 }
15
16 int main(int argc, char **argv)
17 {
18         int ch;
19
20         while ((ch = getopt(argc, argv, "ds:")) != -1) {
21                 switch (ch) {
22                 case 's':
23                         ubus_socket = optarg;
24                         break;
25                 case 'd':
26                         debug++;
27                         break;
28                 default:
29                         return usage(argv[0]);
30                 }
31         }
32         uloop_init();
33         procd_connect_ubus();
34         uloop_run();
35
36         return 0;
37 }