On Thu, 30 Oct 2003 06:25:39 -0600
"Vu Pham" <[EMAIL PROTECTED]> wrote:

> 
> ----- 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
Vu

   use exec and put the cat .... in a string. the exec will execute this from
code.

cheers

-- 
Rick Sivernell
Dallas, Texas  75287
972 306-2296
[EMAIL PROTECTED]
Gentoo Linux 
Registered Linux User

   .~.
  / v \
 /( _ )\
   ^ ^
In Linux we trust!
_______________________________________________
Linux-users mailing list
[EMAIL PROTECTED]
Unsubscribe/Suspend/Etc -> http://smtp.linux-sxs.org/mailman/listinfo/linux-users

Reply via email to