Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ccl - Customizable Configuration Library

The current version of ccl is 0.1.1, released 25 Feb 2005

Introduction

ccl is the customizable configuration library, a collection of functions for application programmers wishing to interface with user-editable configuration files containing key/value pairs.

ccl is customizable because it allows the comment, key/value, and string literal delimiters to be programatically specified at runtime.

ccl is designed to be simple and portable; it has a small interface consisting of five functions and is written in ANSI/ISO C. ccl uses avl's implemenation of binary search trees for backend storage.

Download

ccl is available via ftp from sbooth.org.

Documentation

You can browse the library's contents by using the navigation bar at the top of this page. A good starting point is the globals page.

Example

An example is the best way to understand how ccl works. A configuration file named example.conf might contain:

## Sample configuration file 
Desktop-Picture = /usr/images/earth.jpg 
Position = Centered 
"Background Color" = Black 

The following code demonstrates how to parse and access this file using ccl:

#include "ccl/ccl.h"

struct ccl_t            config;
const struct ccl_pair_t *iter;

/* Set configuration file details */
config.comment_char = '#';
config.sep_char = '=';
config.str_char = '"';

/* Parse the file */
ccl_parse(&config, "example.conf");

/* Iterate through all key/value pairs */
while((iter = ccl_iterate(&config)) != 0) {
  printf("(%s,%s)\n", iter->key, iter->value);
}

/* Clean up */
ccl_release(&config);

When compiled, the snippet above produces the output

(Background Color,Black)
(Desktop-Picture,/usr/images/earth.jpg)
(Position,Centered)

Reporting Bugs

If you think you have found a bug in ccl, then you should send as complete a report as possible. Ideally, you should include the text you get by running config.guess and the text you see when you run configure.

If you think you have tracked down the source of the bug, please also send a patch made with diff -U 5 which fixes the problem.

Please send bug reports, questions, comments and suggestions to Stephen F. Booth.

License

Copyright © 2004 - 2005 Stephen F. Booth.

Permission to use, copy, modify, and distribute this software and its documentation under the terms of the GNU General Public License is hereby granted. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. See the GNU General Public License for more details.


Generated on Fri Feb 25 15:09:15 2005 for ccl by  doxygen 1.4.1