aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-14 06:57:44 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-10 18:40:01 +1000
commit9f4e87b2e7c18243341707a2d2df3957105139e5 (patch)
tree95c4168c10a703fd3168d781f040686e4650b4f7
parent4e52a794ba999c0de0a166ae5e8dac2e67b93964 (diff)
downloadbusybox-w32-9f4e87b2e7c18243341707a2d2df3957105139e5.tar.gz
busybox-w32-9f4e87b2e7c18243341707a2d2df3957105139e5.tar.bz2
busybox-w32-9f4e87b2e7c18243341707a2d2df3957105139e5.zip
win32: add getpwuid()
-rw-r--r--include/mingw.h2
-rw-r--r--win32/mingw.c14
2 files changed, 15 insertions, 1 deletions
diff --git a/include/mingw.h b/include/mingw.h
index 9bca3cf35..c5f72837b 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -75,7 +75,7 @@ struct passwd {
75}; 75};
76 76
77IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM); 77IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM);
78IMPL(getpwuid,struct passwd *,NULL,int uid UNUSED_PARAM); 78struct passwd *getpwuid(int uid);
79 79
80/* 80/*
81 * signal.h 81 * signal.h
diff --git a/win32/mingw.c b/win32/mingw.c
index 9ce7bc3ff..2b9776175 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -76,3 +76,17 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
76 memcpy(result, localtime(timep), sizeof(struct tm)); 76 memcpy(result, localtime(timep), sizeof(struct tm));
77 return result; 77 return result;
78} 78}
79
80struct passwd *getpwuid(int uid)
81{
82 static char user_name[100];
83 static struct passwd p;
84
85 DWORD len = sizeof(user_name);
86 if (!GetUserName(user_name, &len))
87 return NULL;
88 p.pw_name = user_name;
89 p.pw_gecos = "unknown";
90 p.pw_dir = NULL;
91 return &p;
92}