summaryrefslogtreecommitdiff
path: root/src/unistd/cuserid.c
blob: f075c5bf8015c9f64cafccb5a1e68c40898d007a (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
#if 0

#include <stddef.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <pwd.h>

char *cuserid(char *s)
{
	static char userid[L_cuserid];

	struct passwd *pwd = getpwuid(geteuid());

	if (s == NULL) {
		s = userid;
	}

	if (pwd == NULL) {
		s[0] = '\0';
	} else {
		strcpy(s, pwd->pw_name);
	}
	
	return s;
}

/*
TODO: verify
POSIX(1, 199506)
*/


#endif