xref: /plan9-contrib/sys/src/ape/lib/ap/plan9/cuserid.c (revision 3e12c5d1bb89fc02707907988834ef147769ddaf)
1 #include <unistd.h>
2 #include <stdio.h>
3 #include <string.h>
4 
5 /*
6  * BUG: supposed to be for effective uid,
7  * but plan9 doesn't have that concept
8  */
9 char *
cuserid(char * s)10 cuserid(char *s)
11 {
12 	char *logname;
13 	static char buf[L_cuserid];
14 
15 	if((logname = getlogin()) == NULL)
16 		return(NULL);
17 	if(s == 0)
18 		s = buf;
19 	strncpy(s, logname, sizeof buf);
20 	return(s);
21 }
22