function rcfile_read(source: ansistring): pRCfile;
var lines: TAnsiStringArray;
var ctr: gInt;
begin
getmem(rcfile_read, sizeof(tRCfile));
source := str_replace(#13, '', source);
lines := explode(#10, source);
for ctr := 0 to high(lines) do
begin
if (lines[ctr][1] = '[') and (strrev(lines[ctr])[1] = ']') then
begin
// we found a section, so add it
setlength(rcfile_read^.sections, high(rcfile_read^.sections) + 2);
rcfile_read^.sections[high(rcfile_read^.sections)].name := pgChar(substr(lines[ctr], 1, strlen(lines[ctr]) - 2));
continue;
end;
if strpos(lines[ctr], '=') <> 0 then
begin
// we found an entry, so add it to the current (e.g. last) section
setlength(rcfile_read^.sections[high(rcfile_read^.sections)].entries, high(rcfile_read^.sections[high(rcfile_read^.sections)].entries) + 2);
rcfile_read^.sections[high(rcfile_read^.sections)].entries[high(rcfile_read^.sections[high(rcfile_read^.sections)].entries)].name := pgChar(substr(lines[ctr], 0, strpos(lines[ctr], '=')));
rcfile_read^.sections[high(rcfile_read^.sections)].entries[high(rcfile_read^.sections[high(rcfile_read^.sections)].entries)].value := pgChar(substr(lines[ctr], strpos(lines[ctr], '=') + 1));
end;
end;
end;