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.

Parameters:
  • FileName – File to read.

  • Unicode – Whether file shoul be treated like unicode.

  • result – Pointer where file will be read.

Returns:

Error code

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.

Parameters:
  • file_info – File data as returned by INI_ReadFile.

  • section – Section to scan.

  • Unicode – Whether file is unicode.

Returns:

Last entry in section.

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.

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.

Returns:

Entry value.

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.

Parameters:
  • cfg – File data as returned by INI_ReadFile.

  • section – Section to scan.

  • key – Name of key to read.

  • fallback – Fallback value.

Returns:

Key value or fallback in case of failure.

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.

Parameters:
  • cfg – File data as returned by INI_ReadFile.

  • section – Section to scan.

  • key – Name of key to read.

  • fallback – Fallback value.

Returns:

Key value or fallback in case of failure.

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.

Parameters:
  • value – String to parse.

Returns:

Boolean value, -1 on failure.

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.