aboutsummaryrefslogtreecommitdiffstats
path: root/libenv_get_complete_list.3
blob: a55ca852d4f29f37cf79c6d2ad4652f1dbea77c0 (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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
.TH LIBENV_GET_COMPLETE_LIST 3 libenv
.SH NAME
libenv_get_complete_list - List all recognised environment variables

.SH SYNOPSIS
.nf
#include <libenv.h>

struct libenv_variable {
	const char *\fIname\fP;
	const uint64_t *\fIclasses\fP;
};

const struct libenv_variable *libenv_get_complete_list(size_t *\fInclasswords_out\fP, size_t *\fIcount_out\fP);
.fi
.PP
Link with
.IR -lenv .

.SH DESCRIPTION
The
.BR libenv_get_complete_list ()
function returns a list of all environment variables the library knows of,
regardless of whether they are set in the environment. The function returns
a list of
.I struct libenv_variable
elements, for each of them,
.I .name
will be set to the name of the environment variable and
.I .classes
will be set to a bit field of classes the environment variable
belongs to. If
.IR (.classes[i]>>b)&1 ,
then the
.BR "enum libenv_class" (3)
member with the value
.I i*64+b
describes a class the environment variable belongs to. (Make sure that you
do not compare against values greater than or equal to
.IR *nclasswords_out*64 .)
The bit corresponding to
.I LIBENV_END
will always be 0.
.PP
Unless
.I nclasswords_out
is
.IR NULL ,
.I *nclasswords_out
will be set to the number of elements
.RB ( uint64_t 's)
in each
.I .classes
for each returned
.IR "struct libenv_variable" .
.PP
Unless
.I count_out
is
.IR NULL ,
.I *count_out
will be set to the number of returned environment variables.

.SH RETURN VALUE
The
.BR libenv_get_complete_list (3)
function returns a statically allocated list of environment variables
along with the classifications; the list will contain
.I *count_out
(as set when the function returns) elements, plus one extra element,
at the end, having both its fields set to
.IR NULL .

.SH ERRORS
None.

.SH SEE ALSO
.BR libenv (7),
.BR enum_libenv_class (3),
.BR libenv_get_chosen_list (3),
.BR libenv_filter_variable_list (3),
.BR libenv_select_variable_list (3).