diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-06-01 09:50:29 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-06-01 09:50:29 +0200 |
commit | ca808f5c335a873c87359ce024e1a14ebae706b9 (patch) | |
tree | bf6ca050eedf2b3f71d8698d370786174bf17cca /main.c | |
download | unitd-ca808f5c335a873c87359ce024e1a14ebae706b9.tar unitd-ca808f5c335a873c87359ce024e1a14ebae706b9.zip |
initial import: starts and connects to ubus
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -0,0 +1,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; +} |