Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 5abd999d51
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (35 sloc) 0.768 kB
uses
Unix, BaseUnix;
procedure GetUserNamesOnSystem(List: TStrings);
begin
GetUserNamesOnSystem(List, False);
end;
procedure GetUserNamesOnSystem(List: TStrings; WithDisabledUsers: Boolean);
var
sl: TStringList;
sa: TStrArray;
sb: TStrArray;
i: Integer;
begin
if (List is TStringList) then
sl := TStringList(List)
else
sl := TStringList.Create;
sl.Clear;
sl.LoadFromFile('/etc/passwd');
for i := sl.Count - 1 downto 0 do
begin
Explode(sl[i], ':', sa);
Explode(sa[High(sa)], '/', sb);
if (Pos('sh', sb[High(sb)]) > 0) then
sl[i] := sa[0]
else
sl.Delete(i);
end; // i := sl.Count - 1 downto 0
sl.Sort;
if (sl <> List) then
begin
List.Assign(sl);
sl.Free;
end; // if (sl <> List)
end;
Jump to Line
Something went wrong with that request. Please try again.