[systemd-devel] Configuration file parser library

Mantas Mikulėnas grawity at gmail.com
Mon Nov 11 13:09:27 PST 2013


On Mon, Nov 11, 2013 at 10:29 PM, Chris Morgan <chmorgan at gmail.com> wrote:
> I don't see that GKeyFile supports nested groups. For my users I was
> hoping to present something like:
>
> [Clients]
>
>     [ObjectNameHere]
>     type='value'
>
>    [AnotherObjectHere]
>    type='value'
>
> [Services]
>     [ObjectNameHere]
>     ...
>
>
>
> with the hope that on the parsing side I could iterate over the
> entries under 'Services' and then repeat under 'Clients'.

No, INI does not work that way – it is not hierarchical. (Leading
spaces are almost always ignored.)

Git uses [foo "bar"] to implement two-level hierarchy. GNOME dconf
uses [foo/bar/baz] when exporting hierarchical configuration; sssd's
configuration is simpler, but it still has [foo/bar] in some places.
Similarly, Windows .reg files – exported Registry branches – use
[foo\bar\baz].

-- 
Mantas Mikulėnas <grawity at gmail.com>


More information about the systemd-devel mailing list