mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Changes from home. See ChangeLog Aug 5 through Aug 25
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1662 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f51cb41150
commit
960c6fa4c6
16 changed files with 125 additions and 96 deletions
|
@ -36,6 +36,7 @@
|
|||
|
||||
#ifdef NeXT
|
||||
#include <foundation/NSUserDefaults.h>
|
||||
#include <foundation/NSPathUtilities.h>
|
||||
#include <foundation/NSDictionary.h>
|
||||
#include <foundation/NSArray.h>
|
||||
#include <foundation/NSDate.h>
|
||||
|
@ -47,6 +48,7 @@
|
|||
#include <foundation/NSProcessInfo.h>
|
||||
#else
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDate.h>
|
||||
|
@ -93,47 +95,6 @@ NSString *NSCurrencyString = @"NSCurrencyString";
|
|||
NSString *NSDecimalDigits = @"NSDecimalDigits";
|
||||
NSString *NSAMPMDesignation = @"NSAMPMDesignation";
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*** Get Information about a User
|
||||
*************************************************************************/
|
||||
#ifndef NeXT
|
||||
// The functions used below showld work with /etc/passwd file,
|
||||
// YP and NetInfo. I have no idea how this should be implemented
|
||||
// for Win-NT and I know that this cannot be implemented fow Win95
|
||||
|
||||
NSString *NSUserName(void)
|
||||
{
|
||||
NSString* processOwner = [NSString stringWithCString: getlogin()];
|
||||
return processOwner;
|
||||
}
|
||||
|
||||
NSString *NSHomeDirectory(void)
|
||||
{
|
||||
return NSHomeDirectoryForUser (NSUserName());
|
||||
}
|
||||
|
||||
NSString *NSHomeDirectoryForUser (NSString * userName)
|
||||
{
|
||||
struct passwd *pwd;
|
||||
|
||||
if (!userName)
|
||||
return nil;
|
||||
|
||||
setpwent(); // Start scanning the password file
|
||||
while ((pwd = getpwent ()))
|
||||
{
|
||||
if (strcmp(pwd->pw_name,[userName cString]) == 0)
|
||||
break;
|
||||
}
|
||||
endpwent(); // Finish scanning the password file
|
||||
|
||||
if (!pwd)
|
||||
return nil;
|
||||
return [NSString stringWithCString:pwd->pw_dir];
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
*** Local method definitions
|
||||
*************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue