aboutsummaryrefslogtreecommitdiffstats
path: root/libenv_vget_chosen_list.c
blob: 2a5e1e6d83582bcd328131da9df4de1b6a9445b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 */