• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UID <-> Login name <-> Full name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UID <-> Login name <-> Full name


  • Subject: Re: UID <-> Login name <-> Full name
  • From: Jeffrey J Barbose <email@hidden>
  • Date: Tue, 6 Aug 2002 14:30:42 -0700

You could also, in Cocoa-overkill for this case, query the NetInfo database inside of an NSTask, and grab the thread's dictionary on its way out...


On Tuesday, Aug 6, 2002, at 10:43 US/Pacific, Hasan Diwan wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

#include <pwd.h>
#include <stdlib.h>
char *getFullName (uid_t t) {
static struct pw *p;
if (p) {
free(p);
p = malloc(sizeof(struct pw));
}
p = getpwuid(t);
return &(p->pw_gecos);
}
char *getLoginName (uid_t t) {
static struct pw *p;
if (p) {
free(p);
p = malloc(sizeof(struct pw));
}
p = getpwuid(t);
return &(p -> pw_name);
}
The two functions written above will return the "short name" (eg hdiwan instead of "Hasan Diwan"). Also, getFullName(uid_t) will return the whole gecos field, possibly more than the full name.
On Tuesday, August 6, 2002, at 04:23 PM, Pierre-Olivier Latour wrote:

Hi,

Is there any Cocoa, CoreFoundation or Unix function to map a UID to a login
name, a login name to full name, etc?

I didn't find anything, and looking at the code of UNIX utilities like "ps",
it seems the method to do this is quite complicated...


_____________________________________________________________

Pierre-Olivier Latour email@hidden
Lausanne, Switzerland http://www.pol-online.net
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Hasan Diwan
OpenPGP KeyID: 0xBE42DCA6
Fingerprint: 1CB0 47E3 0A24 DAC1 DCCA 4225 F166 40C2 BE42 DCA6
http://hasandiwan.net/~hdiwan/gpg.key
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)

iD8DBQE9UArE8WZAwr5C3KYRAgvnAJ9DU80M2xCndsLqH/QaG7vbl/snmACfULZH
Pm1OkgA3doQ4yCAYuk9bP58=
=KIUc
-----END PGP SIGNATURE-----
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: UID <-> Login name <-> Full name (From: Hasan Diwan <email@hidden>)

  • Prev by Date: Re: NSURL problems on the Internet
  • Next by Date: Re: NSWindow setMiniwindowImage seems to do nothing
  • Previous by thread: Re: UID <-> Login name <-> Full name
  • Next by thread: Progress bar in sheet?
  • Index(es):
    • Date
    • Thread