dshconfig API Reference  0.20.13
Macros | Functions
libdshconfig.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "libdshconfig.h"
#include "config.h"

Macros

#define _GNU_SOURCE
 

Functions

static void * rpl_malloc (size_t n)
 A GNU-compatible malloc, Code to work with autoconf AC_FUNC_MALLOC. More...
 
const char * dshconfig_searchdata (const dshconfig *d, const char *index)
 Function to search member. More...
 
dshconfig_internaldshconfig_splitline (const char *original, char delimiter)
 The function used to split a line. More...
 
static dshconfig_internalread_oneline (FILE *f, int delimiter)
 The ugly function to do the config file reading. More...
 
dshconfigopen_dshconfig (FILE *file, char delimiter)
 reads a dsh config file, and load it up in memory More...
 
void free_dshconfig_internal (dshconfig_internal *i)
 Frees up memory for dshconfig_internal. More...
 
void free_dshconfig (dshconfig *d)
 Frees up memory allocated by open_dshconfig. More...
 

Macro Definition Documentation

#define _GNU_SOURCE

Function Documentation

const char* dshconfig_searchdata ( const dshconfig d,
const char *  index 
)

Function to search member.

References dshconfig::config, dshconfig_internal::data, and dshconfig_internal::title.

Referenced by main().

dshconfig_internal* dshconfig_splitline ( const char *  original,
char  delimiter 
)

The function used to split a line.

Returns
NULL on failure.

References dshconfig_internal::data, dshconfig_internal::next, and dshconfig_internal::title.

Referenced by read_oneline().

void free_dshconfig ( dshconfig d)

Frees up memory allocated by open_dshconfig.

References dshconfig::config, free_dshconfig_internal(), and dshconfig_internal::next.

void free_dshconfig_internal ( dshconfig_internal i)

Frees up memory for dshconfig_internal.

It is allocated by dshconfig_splitline.

soname 1 adds this feature

References dshconfig_internal::data, and dshconfig_internal::title.

Referenced by free_dshconfig().

dshconfig* open_dshconfig ( FILE *  file,
char  delimiter 
)

reads a dsh config file, and load it up in memory

Returns
NULL when error.

References dshconfig::config, dshconfig_internal::next, and read_oneline().

Referenced by main().

static dshconfig_internal* read_oneline ( FILE *  f,
int  delimiter 
)
static

The ugly function to do the config file reading.

It will read one non-commentline and return to the caller.

Return value of NULL indicates termination and/or error.

References dshconfig_splitline().

Referenced by open_dshconfig().

static void * rpl_malloc ( size_t  n)
static

A GNU-compatible malloc, Code to work with autoconf AC_FUNC_MALLOC.