You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
nut_debug_level starts out as 0, but the -D flags are not parsed until after nutscan_init() is called. Therefore, it is not possible to see the debug messages when searching for libraries.
Solution: Move the call to this stateless function to the point after we parse arguments and just before we'd start the actual scans. Later this can be extended to also consider which scans were requested and so which libs to load.
Thanks to @clepple for research in networkupstools#500
Signed-off-by: Jim Klimov <[email protected]>
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).
Closesnetworkupstools#500
…tions (#541)
* Revert "Problem: nutscan_init() called before debug is enabled"
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.
* nutscanner: parse debug level opts separately before anything else
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
nut_debug_level
starts out as 0, but the-D
flags are not parsed until afternutscan_init()
is called. Therefore, it is not possible to see the debug messages when searching for libraries.Tested with https://github.com/networkupstools/nut/tree/libusb-1.0%2B0.1 @ 80bc452.
Noticed while debugging #499.
The text was updated successfully, but these errors were encountered: