summaryrefslogtreecommitdiff
path: root/legacy/evil/src/lib/evil_pwd.c
blob: 45d7380e6070ea1de394a7e7e43e85584733c18c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42


#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */

#include "pwd.h"


static struct passwd pw;


#ifndef __CEGCC__

struct passwd *
getpwuid (uid_t uid)
{
   static char user_name[PATH_MAX];
   DWORD  length;
   BOOL res;

   length = PATH_MAX;
   /* get from USERPROFILE for win 98 ? */
   res = GetUserName(user_name, &length);
   pw.pw_name = (res ? user_name : NULL);
   pw.pw_passwd = NULL;
   pw.pw_uid = uid;
   pw.pw_gid = 0;
   pw.pw_change = 0;
   pw.pw_class = NULL;
   pw.pw_gecos = (res ? user_name : NULL);
   pw.pw_dir = (char *)evil_homedir_get();
   pw.pw_shell = getenv("SHELL");
   if (pw.pw_shell == NULL)
     pw.pw_shell = "sh";
   pw.pw_expire = 0;
   pw.pw_fields = 0;

   return &pw;
}

#endif /* ! __CEGCC__ */