diff options
author | Mattias Andrée <m@maandree.se> | 2025-01-30 18:42:27 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-01-30 18:42:27 +0100 |
commit | aebf2524909f0c0e3aec7f78fa01ad908f7da3a0 (patch) | |
tree | 86881e1b1b299990e6726eda5dde3f1f77c4f180 /libenv_vget_chosen_list.c | |
download | libenv-aebf2524909f0c0e3aec7f78fa01ad908f7da3a0.tar.gz libenv-aebf2524909f0c0e3aec7f78fa01ad908f7da3a0.tar.bz2 libenv-aebf2524909f0c0e3aec7f78fa01ad908f7da3a0.tar.xz |
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-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 */ |