summaryrefslogtreecommitdiff
path: root/src/unistd/confstr.c
blob: 99320b6b7cbce3baa337abb79936d70a5ae958d2 (plain)
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
#if 0

#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "_assert.h"

size_t confstr(int name, char *buf, size_t len)
{
	char *value = NULL;

	if (len > 0) {
		ASSERT_NONNULL(buf);
	}

	switch (name) {
	#include "_confstr.h"
	default:
		value = NULL;
		break;
	}

	if (value == NULL) {
		errno = EINVAL;
		return 0;
	}

	if (len > 0) {
		strncpy(buf, value, len);
	}

	return strlen(value);
}

/*
POSIX(2)
*/


#endif