From aebf2524909f0c0e3aec7f78fa01ad908f7da3a0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 30 Jan 2025 18:42:27 +0100 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libenv_vget_chosen_list.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 libenv_vget_chosen_list.c (limited to 'libenv_vget_chosen_list.c') 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 */ -- cgit v1.2.3-70-g09d2