search for: nbdkit_debug_environ

Displaying 1 result from an estimated 1 matches for "nbdkit_debug_environ".

2023 May 07
2
[PATCH nbdkit] server: Add -D nbdkit.environ=1 to dump the environment
...nge 0 (no logging) to 99. diff --git a/server/main.c b/server/main.c index 1df5d69ac..7b6adc3cc 100644 --- a/server/main.c +++ b/server/main.c @@ -210,6 +210,26 @@ dump_config (void) #endif } +#ifndef WIN32 + +/* -D nbdkit.environ=1 to dump the environment at start up. */ +NBDKIT_DLL_PUBLIC int nbdkit_debug_environ; + +#ifndef HAVE_ENVIRON_DECL +extern char **environ; +#endif + +static void +dump_environment (void) +{ + size_t i; + + for (i = 0; environ[i]; ++i) + nbdkit_debug ("%s", environ[i]); +} + +#endif /* !WIN32 */ + int main (int argc, char *argv[]) { @@ -662,6 +682,14 @@ main (int a...