Configuration file routines

    #include <mplib1/cfg_file.h>


get_private_string

    char *get_private_string( const char *list_name,
				const char *key );

    #define get_config_string(key) get_private_string( NULL, key )
This function returns a pointer to the value field if the keyword was found, or NULL if it was not found.

Note: The pointer returned is actually that of a static buffer, not to the real item stored on the list. If the value is required to be maintained then please ensure that the string is copied into your own buffer before calling this or any other routines in this suite.


get_private_int

    int get_private_int( const char *list_name,
			 const char *key );

    #define get_config_int(key) get_private_int( NULL, key )
This function returns an atoi() of the value if the keyword is found, and 0 if it is not found.


get_private_double

    double get_private_double( const char *list_name,
				const char *key );

    #define get_config_double(key) get_private_double( NULL, key )
This function returns an atof() of the value if the keyword is found, and 0.0 if it is not found.


get_private_flag

    int get_private_flag( const char *list_name,
			    const char *key );

    #define get_config_flag(key) get_private_flag( NULL, key )
This function returns an TRUE if the value of the keyword is "TRUE" or "1", and FALSE if the the string is not or if it is not found.


raw_private_string

    int raw_private_string( const char *list_name,
			    const char *key,
			    const char *output );

    #define raw_config_string(key,val) raw_private_string( NULL, key, val )
This function takes three parameters. The first is the list name, the second is the keyword to search for, and the third is a return buffer for the value against that keyword.

The function returns 1 if the keyword is found, and 0 if it was not found. In addition, if the keyword was found the current value will be copied into the output buffer provided. If the keyword was not found the output buffer will not be modified.