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 * getpwnam(const char * name)11getpwnam(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 } 30