shithub: libini

ref: 61a400cc2f9b50b4a39537eb9d0981df77347929
dir: /README/

View raw version

     INI(2)                                                     INI(2)

     NAME
          parseini - parse ini files

     SYNOPSIS
          #include <ini.h>

          int    parseini(char *file, void (*f)(char*, char*, char*),
          int forcelower)

          int    iniconfig(char *file, int forcelower)

          char*  getinivalue(int config, char *section, char *key)
          char** getiniarray(int config, char *section, char *key, int
          *num)

     DESCRIPTION
          This library function provides simple parsing of INI files
          using bio(2). For each key-value pair within the INI file it
          calls the provided callback function f.

          The callback function gets the section, key and value as
          parameters.

          The forcelower flag tells the function to return all strings
          as lowercase strings, which can be helpful for some cases.
          Otherwise, all strings are returned as entered in the INI
          file.

          Iniconfig parses the given file into a convenient config
          database.  It returns the id of the parsed config file
          that's needed for future lookups.  It is possible to parse
          multiple INI files within one program this way.

          The functions getinivalue and getiniarray can be used to
          fetch the parsed config values.  Both functions expect the
          configuration id received by the previous iniconfig call, as
          well as strings for section and key.

          Getinivalue returns the string value for the given combina-
          tion.

          Getiniarray returns an array of all value strings for the
          given combination.  It sets num to the number of elements
          within this list.

     SOURCE
          /sys/src/libini

     SEE ALSO
          bio(2)

     DIAGNOSTICS
          Parseini returns 0 on failure and sets errstr.

     BUGS
          Sure.