X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=procd.c;h=8dcd924ebabbc1cba4996401b43e988743ac03f8;hp=a72912a7cec678cd49cbfff313099907dd8ee49b;hb=3ff99010e61a0299257ffc91467a16d278a7e774;hpb=916f95cb58604038695347ee41a430d8ca1f0556 diff --git a/procd.c b/procd.c index a72912a..8dcd924 100644 --- a/procd.c +++ b/procd.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,7 @@ static int usage(const char *prog) "Options:\n" "\t-s \tPath to ubus socket\n" "\t-h \trun as hotplug daemon\n" - "\td\t\tEnable debug messages\n" + "\t-d \tEnable debug messages\n" "\n", prog); return 1; } @@ -40,8 +41,14 @@ static int usage(const char *prog) int main(int argc, char **argv) { int ch; + char *dbglvl = getenv("DBGLVL"); - while ((ch = getopt(argc, argv, "ds:h:")) != -1) { + if (dbglvl) { + debug = atoi(dbglvl); + unsetenv("DBGLVL"); + } + + while ((ch = getopt(argc, argv, "d:s:h:")) != -1) { switch (ch) { case 'h': return hotplug_run(optarg); @@ -49,7 +56,7 @@ int main(int argc, char **argv) ubus_socket = optarg; break; case 'd': - debug++; + debug = atoi(optarg); break; default: return usage(argv[0]); @@ -63,6 +70,7 @@ int main(int argc, char **argv) else procd_state_next(); uloop_run(); + uloop_done(); return 0; }