# Synopsis

PDX_MSGT cfg_ParseFile(long option, const DDF *ddf, const char *file_ptr, const char *cmd_line, int *model)

# Purpose

Parse the configuration file.

# Description

This routine will parse a configuration file and will load the configuration entities specified in the DDF. The parameter file_ptr can either be a pointer to the name of the file or a pointer to a pre-formatted configuration buffer. The type of this field is specified by the option (see below). If file_ptr refers to the name of a configuration file, this file is opened, read and parsed. If file_ptr refers to a configuration buffer, this buffer is simply parsed (no file I/O occurrs). The user can also specify configuration parameters on a command line which will override any configuration parameters in the configuration file. For example, if the configuration file ( file_ptr ) contained the lines:

.nf int_value = 3; float_value = 3.14; .fi

And the cmd_line contained:

.nf int_value = 4; float_value = .1234; .fi

The parameters values specified in file_ptr would be overwritten by the parameters specified in cmd_line. If cmd_line is NULL, it is ignored and no file parameters will be overwritten.

This routine will create a configuration model and make it current. The corresponding model number will be returned. The configuration model conatins all of the DB number of the configuration entities that were created as the configuration file was parsed. The user can obtain the DB number of a specific entity using the routine cfg_GetConfigEntity.

# Input

## option

### CFG_FILE_NAME

The field file_ptr specifies the name of the file which is to be parsed. This file will be opened and loaded into a file buffer. This file must contain some sort of line delimiter and these line delimiters cannot be in the middle of a character string parameter value.

### CFG_FILE_BUFFER

The field file_ptr specifies a buffer into which the file has already been read. In this case, no file I/O will be performed. As in the above option, this buffer must contain some sort of line delimiter and these delimiters can not be in the middle of a character string parameter value.

## ddf

Configuration DDF to use.

## file_ptr

Either the name of the configuration file or the configuration file buffer, depending on the option.

## cmd_line

User-specified configuration parameters

# Output

## model

Configuration model number

# Return

CFG error code