INI files

void INI_Free(INI_Section *head)

Free INI data.

Parameters
  • head: INI section data.

GSM_Error INI_ReadFile(const char *FileName, gboolean Unicode, INI_Section **result)

Reads INI data.

Return

Error code

Parameters
  • FileName: File to read.

  • Unicode: Whether file shoul be treated like unicode.

  • result: Pointer where file will be read.

INI_Entry *INI_FindLastSectionEntry(INI_Section *file_info, const unsigned char *section, const gboolean Unicode)

Returns pointer to last INI entry of given section.

Bug:

Unicode should be part of file_info.

Return

Last entry in section.

Parameters
  • file_info: File data as returned by INI_ReadFile.

  • section: Section to scan.

  • Unicode: Whether file is unicode.

unsigned char *INI_GetValue(INI_Section *file_info, const unsigned char *section, const unsigned char *key, const gboolean Unicode)

Returns value of INI file entry.

Bug:

Unicode should be part of file_info.

Return

Entry value.

Parameters
  • file_info: File data as returned by INI_ReadFile.

  • section: Section to scan.

  • key: Name of key to read.

  • Unicode: Whether file is unicode.

int INI_GetInt(INI_Section *cfg, const unsigned char *section, const unsigned char *key, int fallback)

Returns integer value from configuration. The file is automatically handled as not unicode.

Return

Key value or fallback in case of failure.

Parameters
  • cfg: File data as returned by INI_ReadFile.

  • section: Section to scan.

  • key: Name of key to read.

  • fallback: Fallback value.

gboolean INI_GetBool(INI_Section *cfg, const unsigned char *section, const unsigned char *key, gboolean fallback)

Returns boolean value from configuration. The file is automatically handled as not unicode.

Return

Key value or fallback in case of failure.

Parameters
  • cfg: File data as returned by INI_ReadFile.

  • section: Section to scan.

  • key: Name of key to read.

  • fallback: Fallback value.

gboolean GSM_StringToBool(const char *value)

Converts value to boolean.

It just takes the string and checks whether there is true/yes/t/y/1 or false/no/f/n/0.

Return

Boolean value, -1 on failure.

Parameters
  • value: String to parse.

typedef struct _INI_Entry INI_Entry

Private structure holding information INI entry.

typedef struct _INI_Section INI_Section

Private structure holding information INI section.

struct _INI_Entry

Structure used to save value for single key in INI style file

Todo:

This should be probably private.

struct _INI_Section

Structure used to save section in INI style file

Todo:

This should be probably private.