[systemd-devel] Configuration file parser library

Chris Morgan chmorgan at gmail.com
Mon Nov 11 13:24:23 PST 2013


On Mon, Nov 11, 2013 at 4:09 PM, Mantas Mikulėnas <grawity at gmail.com> wrote:
> 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>


Ahh.

But:

[service.SomeService]
key=value

[client.SomeClient]
key=value


works? It would be fine to search through for things that started with
'service.' or 'client.' as a convention.

Chris


More information about the systemd-devel mailing list