Configuration file routines - Initialisation

    #include <mplib1/cfg_file.h>


Initialisation Routines

There are 3 initialisation routines, these either read the contents of a file, a single string, or an array of strings.

read_private_file

    int read_private_file(  const char *list_name,
			    const char *filename );

    #define read_config_file(filename) read_private_file( NULL, filename )
This function reads the contents of the specified file as a series of lines. After discarding comment lines (those starting with '#') and blank lines, the contents are parsed for two fields seperated by one of the following characters ' ',',','=',':','\t'. Thus the format is;
	KEYWORD=VALUE
These fields are stored on a configuration list and are available for interrogation at some later time.

Lines are read in order, and duplicate keywords will replace the previous values. All keywords are case insensitive.

This function returns 1 if the file was opened successfully and 0 if the open failed.


read_private_string

    int read_private_string( const char *list_name,
			     const char *config_string );

    #define read_config_string(line) read_private_string( NULL, line )
This function takes a single string conforming to the format described in read_private_string, parses it and adds/inserts the details into the configuration list.

This function returns TRUE if the details were added/inserted and FALSE if it failed.


read_config_string_array

    int read_private_string_array( const char *conf_array[] );

    #define config_string_array(cs) read_private_string_array( NULL, cs )
This function takes an array of string pointers and parses, adds/inserts each in turn into the configuration list.

The function returns the number of lines successfully processed.