Read debugging environment variable when initializing the library

This commit is contained in:
Thomas Graf 2007-12-18 12:42:06 +01:00
parent 865bbb464a
commit 3c56ed5787
2 changed files with 9 additions and 13 deletions

View file

@ -28,8 +28,16 @@ struct nl_dump_params nl_debug_dp = {
.dp_type = NL_DUMP_FULL,
};
static void __init nl_debug_dp_init(void)
static void __init nl_debug_init(void)
{
char *nldbg, *end;
if ((nldbg = getenv("NLDBG"))) {
long level = strtol(nldbg, &end, 0);
if (nldbg != end)
nl_debug = level;
}
nl_debug_dp.dp_fd = stderr;
}

View file

@ -18,7 +18,6 @@ static struct nl_cb *nltool_cb;
int nltool_init(int argc, char *argv[])
{
char *nlcb = getenv("NLCB");
char *nldbg = getenv("NLDBG");
int cbset = NL_CB_VERBOSE;
if (nlcb) {
@ -41,17 +40,6 @@ int nltool_init(int argc, char *argv[])
goto errout;
}
if (nldbg) {
long dbg = strtol(nldbg, NULL, 0);
if (dbg == LONG_MIN || dbg == LONG_MAX) {
fprintf(stderr, "Invalid value for NLDBG.\n");
goto errout;
}
nl_debug = dbg;
}
return 0;
errout: