Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_fixcpp/sys/src/ape/lib/ap/plan9/getpwnam.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include "lib.h"
2
#include <stddef.h>
3
#include <pwd.h>
4
#include <string.h>
5
 
6
static struct passwd holdpw;
7
static char dirbuf[40] = "/usr/";
8
static char *rc = "/bin/rc";
9
 
10
struct passwd *
11
getpwnam(const char *name)
12
{
13
	int num;
14
	char *nam, *mem;
15
 
16
	num = 0;
17
	nam = (char *)name;
18
	mem = 0;
19
	if(_getpw(&num, &nam, &mem)){
20
		holdpw.pw_name = nam;
21
		holdpw.pw_uid = num;
22
		holdpw.pw_gid = num;
23
		strncpy(dirbuf+5, nam, sizeof(dirbuf)-6);
24
		holdpw.pw_dir = dirbuf;
25
		holdpw.pw_shell = rc;
26
		return &holdpw;
27
	}
28
	return NULL;
29
}