search for: environ_t

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

Did you mean: environ
2020 Apr 15
0
[PATCH nbdkit 6/9] common/utils: Add a copy_environ utility function.
...THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> + +#include <nbdkit-plugin.h> + +#include "utils.h" +#include "vector.h" + +DEFINE_VECTOR_TYPE(environ_t, char *); + +/* Copy an environ. Also this allows you to add (key, value) pairs to + * the environ through the varargs NULL-terminated list. Returns NULL + * if the copy or allocation failed. + */ +char ** +copy_environ (char **env, ...) +{ + environ_t ret = empty_vector; + size_t i, len; + ch...
2020 Apr 15
2
Re: [PATCH nbdkit 6/9] common/utils: Add a copy_environ utility function.
...rn int set_cloexec (int fd); > extern int set_nonblock (int fd); > +extern char **copy_environ (char **env, ...); Should use __attribute__((sentinel)), to let the compiler enforce that we don't forget a trailing NULL. > +++ b/common/utils/environ.c > + > +DEFINE_VECTOR_TYPE(environ_t, char *); > + > +/* Copy an environ. Also this allows you to add (key, value) pairs to > + * the environ through the varargs NULL-terminated list. Returns NULL > + * if the copy or allocation failed. > + */ > +char ** > +copy_environ (char **env, ...) > +{ > + environ_...
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.