Skip to content

nutscanner: get debug level early (for nutscan_init()) and restore options#541

Merged
aquette merged 2 commits intomasterfrom
issue-500
Jul 31, 2018
Merged

nutscanner: get debug level early (for nutscan_init()) and restore options#541
aquette merged 2 commits intomasterfrom
issue-500

Conversation

@zykh
Copy link
Copy Markdown
Contributor

@zykh zykh commented Mar 16, 2018

As noted in #502 (#502 (comment)), that patch is a bit problematic and made some nut-scanner's options unavailable -- something like this should work, instead, without those side effects.

...or we could lower our smartness a notch or two and simply list and process all the options always and then only call the relative routine if really available.

zykh added 2 commits March 16, 2018 23:28
This reverts commit f613d45.

When parsing the command line (or showing help), many options rely on a nutscan_avail_* var already initialized by nutscan_init() -- moving that call after the parsing of opts renders those options unavailable.
In order to have early the value of the desired debug level (needed to correctly debug nutscan_init()), split the parsing of command line options into two loops:
- the first one, before the call to nutscan_init(), will only care about debug level,
- the second one, after the call to nutscan_init(), will consider the remaining (and possibly depending on a nutscan_avail_* var already initialized by nutscan_init()) arguments (and moan in case of errors).

Closes #500
@zykh zykh self-assigned this Mar 16, 2018
@zykh zykh added this to the 2.7.5 milestone Mar 16, 2018
@aquette aquette merged commit d16b508 into master Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants