(NSUserName): Make is work for SOLARIS.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1905 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1996-10-31 19:05:14 +00:00
parent e09ac871dd
commit c26ef3e3d0

View file

@ -35,16 +35,21 @@
NSString *
NSUserName ()
{
#ifndef __WIN32__
#if __WIN32__
return nil;
#elif __SOLARIS__
int uid = geteuid(); // get the effective user id
struct passwd *pwent = getpwuid (uid);
NSString* name = [NSString stringWithCString: pwent->pw_name];
return name;
#else
const char *login_name = getlogin ();
if (login_name)
return [NSString stringWithCString: login_name];
else
return nil;
#else
return nil;
#endif /* __WIN32__ */
#endif
}
/* Return the caller's home directory as an NSString object. */