Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

conftable.c File Reference

Module containing the configuration functions. More...

#include "common.h"
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <regex.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "logger.h"
#include "conftable.h"
#include "keypvalplist.h"
#include "misc.h"
#include "xmalloc.h"

Include dependency graph for conftable.c:

Include dependency graph

Go to the source code of this file.

Functions

int initConftable ()
 inits the Conftable.

int terminateConftable ()
 terminates the Conftable and frees the allocated memory.

int setEntry (const int priority, char *const pkey, char *const pvalue)
 Adds or sets a new key-value-pair. More...

int setEntryL (const int priority, char *const key, const long value)
 set a long int value. More...

const char * getEntry (const char *const key)
 Returns a value to a given key. More...

const char * getEntryDefl (const char *const key, const char *const defl_data)
 returns a value to a given key or defl_data of the key cannot be found. More...

long getEntryL (const char *const key)
 Returns a value to a given key as 'long int'. More...

long int getEntryDeflL (const char *const key, long int defl_data)
 same as getEntryL, but if no value is found the defl_data is returned. More...

int getEntryI (const char *const key)
 Returns a value to a given key as 'int'. More...

int getEntryDeflI (const char *const key, int defl_data)
 same as getEntryI, but if no value is found the defl_data is returned. More...

unsigned int getEntryDeflUI (const char *const key, unsigned int defl_data)
 same as getEntryDeflI, but if value < 0 defl_data is returned. More...

int readConfigFile ()
 reads a given config file. More...


Variables

KeypValpList list
  the internal key_value_list.


Detailed Description

Module containing the configuration functions.

Definition in file conftable.c.


Function Documentation

const char* getEntry const char *const    key
 

Returns a value to a given key.

Null is returned when key is not found, else the key-value is returned

Parameters:
key  The key to which an entry is requested
Return values:
NULL  Key not found.

Definition at line 140 of file conftable.c.

const char* getEntryDefl const char *const    key,
const char *const    defl_data
 

returns a value to a given key or defl_data of the key cannot be found.

Parameters:
key  the key to which an entry is requested
Returns:
the data corresponding to the given key or defl_data if the key could not be found

Definition at line 154 of file conftable.c.

int getEntryDeflI const char *const    key,
int    defl_data
 

same as getEntryI, but if no value is found the defl_data is returned.

Parameters:
key  the key, to which the entry is looked up
defl_data  the data returned, if no entry is found
Returns:
entry, if none, defl_data

Definition at line 204 of file conftable.c.

long int getEntryDeflL const char *const    key,
long int    defl_data
 

same as getEntryL, but if no value is found the defl_data is returned.

Parameters:
key  the key, to which the entry is looked up
defl_data  the data returned, if no entry is found
Returns:
entry, if none, defl_data

Definition at line 180 of file conftable.c.

unsigned int getEntryDeflUI const char *const    key,
unsigned int    defl_data
 

same as getEntryDeflI, but if value < 0 defl_data is returned.

Parameters:
key  the key, to which the entry is looked up
defl_data  the data returned, if no entry is found or entry < 0
Returns:
entry, if none or entry < 0, defl_data

Definition at line 211 of file conftable.c.

int getEntryI const char *const    key
 

Returns a value to a given key as 'int'.

0 is returned when key is not found, else the key-value is returned

Parameters:
key  The key to which an entry is wanted
Return values:
0  Key not found. Errno gives further information.

Definition at line 190 of file conftable.c.

long getEntryL const char *const    key
 

Returns a value to a given key as 'long int'.

0 is returned when key is not found, else the key-value is returned

Parameters:
key  The key to which an entry is wanted
Return values:
0  Key not found. Errno gives further information.

Definition at line 162 of file conftable.c.

int readConfigFile  
 

reads a given config file.

the config file given by "configfile" is parsed and inserted to the internal conftable - structure

Returns:
0 on success -1 otherwise

Definition at line 219 of file conftable.c.

Referenced by main().

int setEntry const int    priority,
char *const    key,
char *const    value
 

Adds or sets a new key-value-pair.

Parameters:
priority  Sets the priority of the passed value. A commandline value has a higher priority than a config file value!
key  Sets the 'key'
value  Sets the value corresponding to 'key'

Definition at line 72 of file conftable.c.

int setEntryL const int    priority,
char *const    key,
const long    value
 

set a long int value.

Parameters:
priority  Sets the priority of the passed value. A commandline value has a higher priority than a config file value!
key  Sets the 'key'
value  Sets the value as 'long int' corresponding to 'key'
Return values:
-1  An error occured while passing the value
0  Everything worked fine

Definition at line 125 of file conftable.c.


Generated on Fri Jan 25 22:40:42 2002 for PDepp Webserver by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001