diff options
Diffstat (limited to 'libenv_vget_chosen_list.c')
-rw-r--r-- | libenv_vget_chosen_list.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libenv_vget_chosen_list.c b/libenv_vget_chosen_list.c new file mode 100644 index 0000000..2a5e1e6 --- /dev/null +++ b/libenv_vget_chosen_list.c @@ -0,0 +1,23 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +const char ** +libenv_vget_chosen_list(enum libenv_class classes_head, va_list classes_tail) +{ + size_t count; + const struct libenv_variable *vars; + const char **names; + size_t i; + vars = libenv_get_complete_list(NULL, &count); + names = malloc((count + 1U) * sizeof(*names)); + if (!names) + return NULL; + for (i = 0; i < count; i++) + names[i] = vars[i].name; + libenv_vprocess_list_without_dealloc__(names, classes_head, classes_tail, HAVE_HEAD, NAMES, SELECT); + return names; +} + + +/* TODO test */ |