[fpc-pascal] libc unit and FreeBSD

Marc Santhoff M.Santhoff at t-online.de
Mon Jan 14 12:29:43 CET 2008


Am Montag, den 14.01.2008, 09:23 +0200 schrieb Graeme Geldenhuys:

> The offending code is as follows...
> 
> function GetGroupName(gid: integer): string;
> var
>   p: PGroup;
> begin
>   p := getgrgid(gid);
>   if p <> nil then
>     result := p^.gr_name;
> end;
> 
> function GetUserName(uid: integer): string;
> var
>   p: PPasswd;
> begin
>   p := getpwuid(uid);
>   if p <> nil then
>     result := p^.pw_name
>   else
>     result := '';
> end;

The functions getlogin(2), getpwnam(3) and getgrnam(3) should be it.
Look at the man pages how to use them.
(this is on freebsd 4, should not have changed moving to 6 or 7)

I don't know if they are wrapped by fpc or what the names would be
(maybe fpXxxx as always).

HTH,
Marc





More information about the fpc-pascal mailing list