#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "segCommon.h"
#include "segStdLib.h"
#include "segConfig.h"
Functions | |
static char * | allocString (char *cStr) |
Allocate memory space for the given string, and copy the string to the space. | |
static void | setDefaultConfig (SEG_CONFIG *configData) |
Set default values to configuration parameters in structure segConfig. | |
void | segFreeConfig (SEG_CONFIG *configData) |
Free memory space for a structure variable with configuration parameters. | |
int | segReadConfig (SEG_CONFIG **configData, char *cFile) |
Read a configuration file of the given file name. |
static char * allocString | ( | char * | cStr | ) | [static] |
Allocate memory space for the given string, and copy the string to the space.
[in] | cStr | String to be stored in the allocated memory |
NULL | Memory allocation error | |
otherwise | Pointer to the allocated memory space |
void segFreeConfig | ( | SEG_CONFIG * | configData | ) |
Free memory space for a structure variable with configuration parameters.
[in] | configData | Structure variable containing configuration parameters |
int segReadConfig | ( | SEG_CONFIG ** | configData, | |
char * | cFile | |||
) |
Read a configuration file of the given file name.
The function reads values of different parameters written in the configuration file.
[in,out] | configData | Structure variable containing configuration parameters |
[in] | cFile | Name of the configuration file |
ERROR_ALLOC | Memory allocation error | |
ERROR_FOPEN | Opening the configuration file failed | |
RTN_ERROR | Illegal configuration was found | |
otherwise | Number of configuration parameters loaded |
static void setDefaultConfig | ( | SEG_CONFIG * | configData | ) | [static] |
Set default values to configuration parameters in structure segConfig.
[in,out] | configData | Structure variable containing configuration parameters |