[fpc-pascal] libc unit and FreeBSD

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Jan 14 08:23:55 CET 2008


Hi,

As far as I understand the 'libc' unit is a compatibility unit from
the Kylix days and is only meant for linux/x86, so isn't portable.

I'm trying to get fpGUI working under FreeBSD but hit a snag in my
File Grid component. The File Grid component displays a directory in a
grid (think File Dialog here) and shows the file permissions, file
group name and file user name.  The code to get the group name and
user name uses methods & types from the libc unit, so I'm not able to
compile it under FreeBSD.

Anybody know if there is a generic set of methods that supports all
(or most) unix style OS's?  I looked in 'baseunix', but there the
group and name methods relate to a process id's, not to file
attributes...

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;



Many thanks in advance.


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-pascal mailing list