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

thomas fossati tho at koanlogic.com
Mon Dec 21 09:13:49 EST 2009


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 ?

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

much appreciated :)

ciao, t.




More information about the klone-users mailing list