source: trunk/minix/lib/other/cuserid.c@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 565 bytes
Line 
1/* cuserid(3)
2 *
3 * Author: Terrence W. Holm Sept. 1987
4 */
5
6#include <lib.h>
7#include <pwd.h>
8#include <string.h>
9#include <unistd.h>
10#include <stdio.h>
11
12#ifndef L_cuserid
13#define L_cuserid 9
14#endif
15
16char *cuserid(user_name)
17char *user_name;
18{
19 PRIVATE char userid[L_cuserid];
20 struct passwd *pw_entry;
21
22 if (user_name == (char *)NULL) user_name = userid;
23
24 pw_entry = getpwuid(geteuid());
25
26 if (pw_entry == (struct passwd *)NULL) {
27 *user_name = '\0';
28 return((char *)NULL);
29 }
30 strcpy(user_name, pw_entry->pw_name);
31
32 return(user_name);
33}
Note: See TracBrowser for help on using the repository browser.