[Klone-users] Re: Merge u_config_save_to_buf() and u_config_print_to_fp() ?

Mickael Auger mickael.auger at gmail.com
Mon Dec 21 09:29:00 EST 2009


Hi Thomas,

2009/12/21 thomas fossati <tho at koanlogic.com>

> Hi Mickael,
>
>
> On Dec 21, 2009, at 2:22 PM, Mickael Auger wrote:
>
>> Hi,
>>
>> I use the functions "u_config_..." to load, read and write configuration
>> file (like kloned.conf), but I have a problem to save.
>>
>> u_config_print_to_fp() save the contain of configuration file without
>> brace '{' and '}' but with tabulation such as :
>> ================
>> section1
>>  key1 value
>>  key2 value
>> section2
>>  key1 value
>>  key2 value
>> ================
>> And it's easy to read but the file isn't a configuration file.
>>
>> More over u_config_save_to_buf() get the config syntax wihout tabulation
>> but with brace such as :
>> ================
>> section1
>> {
>> key1 value
>> key2 value
>> }
>> section2
>> {
>> key1 value
>> key2 value
>> }
>> ================
>> And it's not easy to edit this file manually (with an text editor).
>>
>> As you might guess, my question is :
>>
>> Could we have a function that saves a file with braces?
>>
>> This function could be "u_config_save_to_fp(u_config_t *c, FILE *fp)" and
>> its result could be :
>> ================
>> section1
>> {
>>  key1 value
>>  key2 value
>> }
>> section2
>> {
>>  key1 value
>>  key2 value
>> }
>> ================
>>
>
> ok, I've fixed u_config_print_to_fp() to insert properly aligned braces
> where needed.  Thanks for the suggestion, do you want to try it out ?


Yes if you have a path :)


>
>  Bye.
>>
>> PS : I will complete the LibU Wiki on the Config section.
>>
>
> much appreciated :)
>

The page is created with two examples to load and read :
http://wiki.koanlogic.com/doku.php?id=libu_config


> ciao, t.
>
> _______________________________________________
> Klone-users mailing list
> Klone-users at koanlogic.com
> http://koanlogic.com/cgi-bin/mailman/listinfo/klone-users
>



-- 
Mickaël AUGER
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://koanlogic.com/pipermail/klone-users/attachments/20091221/45e135eb/attachment.htm


More information about the klone-users mailing list