libXDGdirs v1.1.2-8-gc53e5c3
An implementation of XDG Base Directory Specification
Loading...
Searching...
No Matches
lists.c
Go to the documentation of this file.
1
16#include <stdio.h>
17#include <xdgdirs.h>
18
19int main()
20{
21 // XDG_DATA_DIRS ---------------------------------------
22 xdgDirsList foo = *xdgDataDirs();
23 puts(foo.raw);
24 printf("%zd\n", foo.size);
25 for (int i = 0; foo.list[i] != NULL; ++i) {
26 puts(foo.list[i]);
27 }
28
29 // XDG_CONFIG_DIRS -------------------------------------
31 printf("\n%s\n%zd\n", bar->raw, bar->size);
32 for (int i = 0; bar->list[i] != NULL; ++i) {
33 puts(bar->list[i]);
34 }
35
36 // free memory -----------------------------------------
38
39 return 0;
40}
void xdgDirs_clear(void)
Clear cached data.
xdgDirsList * xdgConfigDirs(void)
Value of $XDG_CONFIG_DIRS.
xdgDirsList * xdgDataDirs(void)
Value of $XDG_DATA_DIRS.
Container for environment variables which are colon separated lists.
Definition xdgdirs.h:25
const char ** list
Null terminated array containing entries from environment variable.
Definition xdgdirs.h:27
size_t size
Number of entries in environment variable.
Definition xdgdirs.h:28
const char * raw
Raw value of environment variable.
Definition xdgdirs.h:26
int main()
Definition test.c:4