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.
const char * | dshconfig_searchdata (const dshconfig *d, const char *index)
| Function to search member.
dshconfig_internal * | dshconfig_splitline (const char *original, char delimiter)
| The function used to split a line.
static dshconfig_internal * | read_oneline (FILE *f, int delimiter)
| The ugly function to do the config file reading.
dshconfig * | open_dshconfig (FILE *file, char delimiter)
| reads a dsh config file, and load it up in memory
void | free_dshconfig_internal (dshconfig_internal *i)
| Frees up memory for dshconfig_internal.
void | free_dshconfig (dshconfig *d)
| Frees up memory allocated by open_dshconfig.

## Macro Definition Documentation

## _GNU_SOURCE

#define _GNU_SOURCE

## Function Documentation

## dshconfig_searchdata()

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_splitline()

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().

## free_dshconfig()

void free_dshconfig | ( | dshconfig * | d | ) |

Frees up memory allocated by open_dshconfig.

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

## free_dshconfig_internal()

void free_dshconfig_internal | ( | dshconfig_internal * | i | ) |

Frees up memory for dshconfig_internal.

It is allocated by dshconfig_splitline.

@Version soname 1 adds this feature

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

Referenced by free_dshconfig().

## open_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().

## read_oneline()

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().

## rpl_malloc()

static void * rpl_malloc | ( | size_t | n | ) |

static

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