search for: environ_t_append

Displaying 3 results from an estimated 3 matches for "environ_t_append".

2020 Apr 15
0
[PATCH nbdkit 6/9] common/utils: Add a copy_environ utility function.
...r; + size_t i, len; + char *s; + va_list argp; + const char *key, *value; + + /* Copy the existing keys into the new vector. */ + for (i = 0; env[i] != NULL; ++i) { + s = strdup (env[i]); + if (s == NULL) { + nbdkit_error ("strdup: %m"); + goto error; + } + if (environ_t_append (&ret, s) == -1) { + nbdkit_error ("realloc: %m"); + goto error; + } + } + + /* Add the new keys. */ + va_start (argp, env); + while ((key = va_arg (argp, const char *)) != NULL) { + value = va_arg (argp, const char *); + if (asprintf (&s, "%s=%s",...
2020 Apr 15
2
Re: [PATCH nbdkit 6/9] common/utils: Add a copy_environ utility function.
...> + const char *key, *value; > + > + /* Copy the existing keys into the new vector. */ > + for (i = 0; env[i] != NULL; ++i) { > + s = strdup (env[i]); > + if (s == NULL) { > + nbdkit_error ("strdup: %m"); > + goto error; > + } > + if (environ_t_append (&ret, s) == -1) { > + nbdkit_error ("realloc: %m"); > + goto error; > + } > + } > + > + /* Add the new keys. */ > + va_start (argp, env); > + while ((key = va_arg (argp, const char *)) != NULL) { > + value = va_arg (argp, const char *);...
2020 Apr 15
18
[PATCH nbdkit 0/9] Generic vector, and pass $nbdkit_stdio_safe to shell scripts.
This was a rather longer trip around the houses than I anticipated! The basic purpose of the patch series is to set $nbdkit_stdio_safe to "0" or "1" in sh and eval plugin scripts. To do that, I ended up adding a nicer way to manipulate environ lists, and to do that, I ended up adding a whole generic vector implementation which is applicable in a lot of different places.