Message-ID: <39849DB9.EEE34410@home.com> From: Tom Fjellstrom X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.14-15mdk i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: [ANN]: CFG 1.2 References: <200007301401 DOT KAA01807 AT delorie DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 97 Date: Sun, 30 Jul 2000 21:26:46 GMT NNTP-Posting-Host: 24.65.142.130 X-Complaints-To: abuse AT home DOT net X-Trace: news1.rdc1.ab.home.com 964992406 24.65.142.130 (Sun, 30 Jul 2000 14:26:46 PDT) NNTP-Posting-Date: Sun, 30 Jul 2000 14:26:46 PDT Organization: Excite AT Home - The Leader in Broadband To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Tom Fjellstrom wrote: > > Version 1.2 of CFG brings some fairly > significant changes, so it is a recommended > update if you are already using it. > > And if you're not using CFG yet, I only have > one thing to say: check it out at > http://strangesoft.hypermart.net/ Sory about this... I fired it off late last night. So here is a description. CFG v1.2 -------- 1. What is it? 1.1. New... 1.2. Examples 2. Where can I get it? 3. How do I compile it? 4. Known Bugs... 1. What is CFG??? -------------- CFG is another config library that loads .ini 'like' files. But CFG has one major difference from all the others... Sections can be nested. 1.1. New... ------ o The parser now handles text using the default local.. o It is way more sane when handling different types of vars, ie: numbers are saved as a bare string (no quotes), single quoted strings are saved as single quoted strings. :) o Blank CFG_FILE structures may now be created via the new_cfg(void) func. o CFG_FILE's can be saved under a different name using the save_cfg(CFG_FILE *, char *) function. o Multiline options are alloud.. (kinda like the line continuation for the c preprocessor) check the test.cfg file to se exactly what they look like. o Redefined vars arn't a memory leak anymore and if the concat option is set before a cfg file is parsed it will join them together. 1.2. Examples. --------- example 1: CFG_FILE *cfg = load_cfg("somefile.cfg"); // load a .cfg file. char *get_cfg_string(cfg,"some.section","somevar","default value"); ... set_cfg_int(cfg,"some.section","somevar",123); close_cfg(cfg); exampe 2: CFG_FILE *cfg = new_cfg(); // create new blank cfgfile set_cfg_option(cfg, concat); // tell the parser that // you want strcat() redefined cfg vars together. set_cfg_int(cfg,"some.section","somevar",123); save_cfg(cfg, "somefile.cfg"); 2. Where can I get it? ------------------- http://strangesoft.hypermart.net/cfg.html 3. How do I compile it? -------------------- To compile CFG you must have DJGPP (http://www.delorie.com/djgpp/) or linux. Type 'make' into a command prompt to compile, and 'make install' to install. 4. Known Bugs... ------------- o multi-line options arn't saved as a multiline option o when a file is read in concat mode, the save function has no clue. o the save function is all wrong but it's not to high a priority... o nesting sections too deap may cause a crash (core dump) thank you. -- Top 10 reasons to procrastinate: 1. Tom Fjellstrom