Initial revision
This commit is contained in:
32
doc/programmer/ini.tex
Normal file
32
doc/programmer/ini.tex
Normal file
@@ -0,0 +1,32 @@
|
||||
\subsection{Initialisation file management}
|
||||
This module supports initialisation files with a simple structure.
|
||||
This is used to hold the internal SICS server options which are
|
||||
installed with the SicsOption initialisation commands. All the file
|
||||
handling stuff is dead code not used by SICS as of current. Any line
|
||||
is intended to
|
||||
contain one name value pair separated by an equlity sign. Lines beginning
|
||||
with a \verb+#+ are treated as comments, other lines not conforming to the name =
|
||||
value scheme are ignored. Another option (and the currently preferred one)
|
||||
to get values into the initialisation database is to use a special command
|
||||
SicsOption from the SICS initialisation file.
|
||||
These initialisation files are manipulated through
|
||||
the ifile module, implemented in ifile.h and ifile.c. The class in more
|
||||
detail:
|
||||
|
||||
|
||||
After reading the configuration options are stored in memory as a linked list with entries if the type shown below. \begin{verbatim}
|
||||
typedef struct __IFileE
|
||||
{
|
||||
char *name;
|
||||
char *value;
|
||||
struct __IFileE *pNext;
|
||||
} IPair;
|
||||
\end{verbatim}
|
||||
This datastructure is manipulated using the following functions:\begin{itemize}
|
||||
\item {\bf IPair *IFReadConfigFile(FILE *fp) }, expects as input a pointer to the configuration file. Than the function will read the file and initialise the configuration linked list from the data found in the file. On success a pointer to the head of the linked list is returned which is to be used in further calls to the configuration management functions. On failure NULL is returned.
|
||||
\item {\bf char *IFindOption(IPair *pList,char *name) }. Input is a pointer to a configuration list as returned by IFReadConfigFile and the name of the option requested (case sensitive). If this option exists a pointer to its value will be returned, else NULL. Never, ever, free the returned pointer as it belongs to this module.
|
||||
\item {\bf IPair *IFAddOption(IPair *pList,char *name, char *value) } Adds a name value pair to the list specified as first parameter. Returns a pointer to the new list including the new name value pair on succes, else the old pointer specified as input.
|
||||
\item {\bf int IFSaveOptions(IPair *pList,FILE *fp) }. Saves the options in the list to the file fp.
|
||||
\item {\bf void IFDeleteOptions(IPair *pList) }. Use this to delete the list after use. The list pList is no longer valid after this call. Omission of this call will result in wasted memory.
|
||||
\end{itemize}
|
||||
|
||||
Reference in New Issue
Block a user