Contents | < Browse | Browse >

TITLE

Config

VERSION

Version 1.01 (Released 28th June, 96)

AUTHOR

Adam Dawes

E-Mail: Adam@beachyhd.demon.co.uk
        ad32@brighton.ac.uk
Fidonet: 2:441/93.5

DESCRIPTION

Config is a piece of C sourcecode designed to make access to configuration
files as easy as possible.

All the hard work is taken away, and replaced with just 4 functions:

    WriteConfig()
    WriteConfigNumber()
    ReadConfig()
    ReadConfigNumber()

The config files are in a standard format: they are divided into "sections"
(each of which has a unique name).  In each section is any number of
keywords, each of which has an associated data item.

To write data to a config file, a single call to WriteConfig() is required,
telling it the name of the config file, the section and keyword the data is
to be added with, and the data itself.  Config will then create the config
file (if necessary), create the section (if necessary) and add or modify
(as appropriate) the entry in the config file.

Reading from the config file is just as easy.  You specify the filename,
section and keyword and Config returns you the data.  However, when calling
the ReadConfig() function, you also supply a default value.  If the data
cannot be returned for any reason (config file doesn't exist, section or
keyword doesn't exist), you will be returned your default value.  This
means that absolutely no extra handling is necessary for new config files,
etc.

WriteConfigNumber() and ReadConfigNumber() work in exactly the same way,
but with numbers instead of strings.

Full documentation and examples are included within the archive.

NEW FEATURES

Fixed a nasty memory allocation bug.  Any programs compiled with Config
v1.0 should be recompiled with v1.01 (which *is* stable).

TO DO

I would ideally like to make Config in to a shared library.  This would
mean it could be accessed from any language, not just C.  I currently have
no idea how to do this, though, so that may not happen just yet.

I also have plans to add full caching to Config to speed things up a
little, aswell as adding a few more functions.

SPECIAL REQUIREMENTS

Any Amiga running a C compiler (tested with DICE and SAS/C).  Whilst the
code is potentially ANSI-compliant, it currently uses several functions
from exec.library for linked-list manipulation.  I will consider making the
code fully ANSI compatible if there is any demand for it.

AVAILABILITY

From Aminet, for example:

  ftp://ftp.wustl.edu/pub/aminet/dev/c/Config101.lha (9k)

PRICE

Free.

DISTRIBUTION

Config is freely distributable as long as it is not modified in any way.
You are perfectly welcome to use it in your own programs (that's why I've
written it, after all) without any permission; I won't complain if you feel
like giving me a mention in the documentation, but that's by no means
compulsory.