. service tells you which device it couldn't stat
[minix3.git] / lib / other / cuserid.c
blob47640e75133eb6245bed9d7f8fee229511cd3f25
1 /* cuserid(3)
3 * Author: Terrence W. Holm Sept. 1987
4 */
6 #include <lib.h>
7 #include <pwd.h>
8 #include <string.h>
9 #include <unistd.h>
10 #include <stdio.h>
12 #ifndef L_cuserid
13 #define L_cuserid 9
14 #endif
16 char *cuserid(user_name)
17 char *user_name;
19 PRIVATE char userid[L_cuserid];
20 struct passwd *pw_entry;
22 if (user_name == (char *)NULL) user_name = userid;
24 pw_entry = getpwuid(geteuid());
26 if (pw_entry == (struct passwd *)NULL) {
27 *user_name = '\0';
28 return((char *)NULL);
30 strcpy(user_name, pw_entry->pw_name);
32 return(user_name);