Commit 3e6d9257 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/libwr: fix changing verbosity level from cmd

Fix specifying verbosity level by setting WRS_MSG_LEVEL env variable
and fix changing verbosity with -v/-q
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent c23a80e9
......@@ -44,12 +44,14 @@ void wrs_msg_init(int argc, char **argv)
{
int i;
int max = ARRAY_SIZE(wrs_msg_used_levels) - 1;
char *e;
prgname = argv[0];
wrs_msg_f = stderr;
if (getenv("WRS_MSG_LEVEL")) {
i = atoi("WRS_MSG_LEVEL");
e = getenv("WRS_MSG_LEVEL");
if (e) {
i = atoi(e);
if (i) /* not 0 (EMERG) as atoi returns 0 on error */
wrs_msg_level = i;
}
......@@ -65,6 +67,8 @@ void wrs_msg_init(int argc, char **argv)
wrs_msg_pos++;
}
wrs_msg_level = wrs_msg_used_levels[wrs_msg_pos];
/* Prepare for run-time changes */
signal(SIGUSR1, wrs_msg_sighandler);
signal(SIGUSR2, wrs_msg_sighandler);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment