----- Original Message ----- From: "James McDonald" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 30, 2003 5:57 AM Subject: Re: username / id
> Vu Pham wrote: > > Hi all, > > > > Is there any function to get the user name if uid is known, and vice versa ? > > Similar for group. > > > > Thanks, > > > > cat /etc/passwd | grep ^.*:x:500: | awk -F: '{print $1}' > cat /etc/passwd | grep ^.*:x:[0-9]*:500 | awk -F: '{print $1}' > > This is probably not what you want but it does return a name from uid or > gid... Oh, that works. I would like to know if there is an API so that I can use it in my C app, or do I need to run some commands like your suggestion and capture the output. Thanks, James. Vu _______________________________________________ Linux-users mailing list [EMAIL PROTECTED] Unsubscribe/Suspend/Etc -> http://smtp.linux-sxs.org/mailman/listinfo/linux-users