confuse-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Confuse-devel] config file versions and partial parsing


From: Brett Russ
Subject: [Confuse-devel] config file versions and partial parsing
Date: Fri, 09 Jul 2004 23:17:07 -0400
User-agent: Mozilla Thunderbird 0.7 (X11/20040615)

Hi Martin,

First off, thank you for this excellent time saver you've written! It took a bit of searching to find but well worth it.

I am writing a program in which I've included a version number in my config file to allow me to change the format in the future if needed (add/move/remove options, etc). What I originally tried to do was similar to the following pseudo code:

opts {
   INT, "config-file-version"
   END
}

cfg = cfg_init()
cfg_parse(cfg, opts)
version = cfg_getint(cfg, "config-file-version")
cfg_free(cfg)

switch (version) {
case 1:
parse_v1();
break;
case 2:
....

and parse_v?() does a new parse, except this time with the complete list of options known to be in that version.

So basically, I was hoping for cfg_parse to only harvest the options I told it about in opts, which in this case was "config-file-version", and ignore everything else. I found that parse errors were given unless I identified everything beforehand.

I think for now I may have to parse for "config-file-version" myself, and once I have that number then switch on it and do only one libconfuse parse after I know what to expect.

Would this be a feature request you'd consider? A flag to allow for ignoring of all unlisted options? Or would this be leading down the answer given here:
http://lists.gnu.org/archive/html/confuse-devel/2003-09/msg00001.html ?

Either way, thanks again,
Brett




reply via email to

[Prev in Thread] Current Thread [Next in Thread]