X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=procd.c;h=ad8028441d597b2c806074b242ee52fa89463605;hp=a72912a7cec678cd49cbfff313099907dd8ee49b;hb=2c8176385a4f62b536303912ba508b9dc7931fad;hpb=916f95cb58604038695347ee41a430d8ca1f0556 diff --git a/procd.c b/procd.c index a72912a..ad80284 100644 --- a/procd.c +++ b/procd.c @@ -32,7 +32,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 +40,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 +55,7 @@ int main(int argc, char **argv) ubus_socket = optarg; break; case 'd': - debug++; + debug = atoi(optarg); break; default: return usage(argv[0]);