Implemented NSFullUserName()

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4071 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-04-13 20:37:04 +00:00
parent 8607046df3
commit 0ba5eae3a1
2 changed files with 13 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Tue Apr 13 21:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSUser.m: Implemented NSFullUserName()
Mon Apr 12 13:15:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk> Mon Apr 12 13:15:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSCountedSet.m: Make copying behavior be same as OPENSTEP * Source/NSCountedSet.m: Make copying behavior be same as OPENSTEP

View file

@ -37,6 +37,8 @@
#include <stdlib.h> // for getenv() #include <stdlib.h> // for getenv()
#if !defined(__WIN32__) && !defined(_WIN32) #if !defined(__WIN32__) && !defined(_WIN32)
#include <unistd.h> // for getlogin() #include <unistd.h> // for getlogin()
#endif
#if HAVE_PWD_H
#include <pwd.h> // for getpwnam() #include <pwd.h> // for getpwnam()
#endif #endif
#include <sys/types.h> #include <sys/types.h>
@ -143,8 +145,15 @@ NSHomeDirectoryForUser (NSString *login_name)
NSString *NSFullUserName(void) NSString *NSFullUserName(void)
{ {
#if HAVE_PWD_H
struct passwd *pw;
pw = getpwnam([NSUserName() cString]);
return [NSString stringWithCString: pw->pw_gecos];
#else
NSLog(@"Warning: NSFullUserName not implemented\n"); NSLog(@"Warning: NSFullUserName not implemented\n");
return NSUserName(); return NSUserName();
#endif
} }
NSArray *NSStandardApplicationPaths(void) NSArray *NSStandardApplicationPaths(void)