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.
#define ConfigNameSize 31 /* 30+eos */
#define ConfigValueSize 121 /* 120+eos */
typedef struct ConfigTbl { /*
*/
char Name[ConfigNameSize]; /* */
char Value[ConfigValueSize]; /* */
} CONFIG_TBL;
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);