Table of Contents

Name

libconfigtbl - configuration strings database manipulation

Description

libconfigtbl is a collection of functions for managing an ASCII based configuration table. Entries in the configuration file consist of name and value strings. Each line in the file is one entry. Entries are terminated with a linefeed.

The file containing the information may exist when the program using the libconfigtbl facility is started or may be created from information contained in the calling program.

The program using the facility creates an array of CONFIG_TBL records. The CONFIG_TBL.Name fields should be initialized with the desired names. The CONFIG_TBL.Value field may be a null string.

When the program is started an existing table may be loaded from a file by calling LoadCONFIG_TBL(3cf) . LoadCONFIG_TBL(3cf) will read from the file copying the value string into the array for each name field match it finds.

A new file may be created by calling CreateCONFIG_TBL(3cf) . This causes all of the information in the CONFIG_TBL array to be written to the file.

Information may be saved into an existing configuration file by calling SaveCONFIG_TBL(3cf) .

A program wanting use this facility should include configtbl.h when compiling.

Structures

This is the data structure used by configlib. An array of these structures should be created and initialized by the program using libconfigtbl.

#define ConfigNameSize     31            /* 30+eos */
#define ConfigValueSize    121            /* 120+eos */

typedef struct ConfigTbl {         /* */
   char Name[ConfigNameSize];        /* */

   char Value[ConfigValueSize];        /* */

} CONFIG_TBL;

Functions

Here is a list of the functions contained in the library. See the manual page for each function for a description and argument usage.

CONFIG_TBL *FindCONFIG_TBL(CONFIG_TBL CFTpnt[], int Size, char *sN);

int CreateCONFIG_TBL(CONFIG_TBL CFTpnt[], int Size, char *FN);

void ClearCONFIG_TBL(CONFIG_TBL CFTpnt[], int Size);

void CopyCONFIG_TBL(CONFIG_TBL CFTpntI[], CONFIG_TBL CFTpntO[], int Isize, int Osize);

int LoadCONFIG_TBL(CONFIG_TBL CFTpnt[], int Size, char *FN, char *PN);

void PrintCONFIG_TBL(FILE *fd, CONFIG_TBL CFTpnt[], int Size);

int SaveCONFIG_TBL(CONFIG_TBL CFTpnt[], int Size, char *FNold, char *FNnew, char *PN);

int BldCONFIG_TBLfn(char *base_path, char *base_name, char **dat_name, char **tmp_name);

See Also

BldCONFIG_TBLfn(3cf) , ClearCONFIG_TBL(3cf) , CopyCONFIG_TBL(3cf) , CreateCONFIG_TBL(3cf) , FindCONFIG_TBL(3cf) , LoadCONFIG_TBL(3cf) , PrintCONFIG_TBL(3cf) , SaveCONFIG_TBL(3cf)

Manual page revision

$Id: libconfigtbl.3,v 1.4 2002/09/11 11:59:35 kitchen Exp $


Table of Contents