{"id":19983038,"url":"https://github.com/madmurphy/libconfini","last_synced_at":"2025-07-03T01:32:55.080Z","repository":{"id":47461185,"uuid":"70017374","full_name":"madmurphy/libconfini","owner":"madmurphy","description":"Yet another INI parser","archived":false,"fork":false,"pushed_at":"2022-07-21T04:16:03.000Z","size":2822,"stargazers_count":172,"open_issues_count":3,"forks_count":23,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-04T05:33:13.207Z","etag":null,"topics":["bare-metal","c","conf","conf-file","conf-library","config","configuration","configuration-file","configuration-management","gnu","ini","ini-config","ini-file","ini-library","ini-parser","ini-reader","library","parser","shared-library","unix"],"latest_commit_sha":null,"homepage":"https://madmurphy.github.io/libconfini/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/madmurphy.png","metadata":{"files":{"readme":"README","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-05T00:16:55.000Z","updated_at":"2025-04-28T12:19:03.000Z","dependencies_parsed_at":"2022-09-04T19:30:38.362Z","dependency_job_id":null,"html_url":"https://github.com/madmurphy/libconfini","commit_stats":null,"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"purl":"pkg:github/madmurphy/libconfini","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madmurphy%2Flibconfini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madmurphy%2Flibconfini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madmurphy%2Flibconfini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madmurphy%2Flibconfini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madmurphy","download_url":"https://codeload.github.com/madmurphy/libconfini/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madmurphy%2Flibconfini/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263244206,"owners_count":23436444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bare-metal","c","conf","conf-file","conf-library","config","configuration","configuration-file","configuration-management","gnu","ini","ini-config","ini-file","ini-library","ini-parser","ini-reader","library","parser","shared-library","unix"],"created_at":"2024-11-13T04:13:57.695Z","updated_at":"2025-07-03T01:32:55.052Z","avatar_url":"https://github.com/madmurphy.png","language":"C","funding_links":[],"categories":["Parsers ##"],"sub_categories":["Web Frameworks ###"],"readme":"libconfini {#readme}\n====================\n\n**libconfini** is the ultimate and most consistent INI file parser library\nwritten in C. Originally designed for parsing configuration files written by\nother programs, it focuses on standardization and parsing exactness and is at\nease with almost every type of file containing key/value pairs.\n\nThe library is fast and suitable for embedded systems. Its algorithms are\nwritten from scratch and do not depend on any external library, except for the\nC standard headers **stdio.h**, **stdlib.h**, **stdbool.h** and **stdint.h**\n(and for extreme platforms the code [can be also compiled as “bare metal”][1],\nwith few or no strings attached to the C Standard Library).\n\nRather than storing the parsed data, **libconfini** gives the developer the\nfreedom to choose what to do with them through a custom callback invoked for\neach INI node read. The API has been designed to be powerful, flexible and\nsimple to use.\n\nWith **libconfini** you will find in INI files the same serialization power\nthat you would normally find in other heavily structured formats (such as JSON,\nYAML, TOML), but with the advantage of using the most human-friendly\nconfiguration format ever invented (thanks to their informal status, INI files\nare indeed more fluid, expressive and human-friendly than formats explicitly\ndesigned with the same purpose, such as YAML and TOML). The library's main goal\nis to be uncommonly powerful in the most tedious and error-prone task when\nparsing a text file in C: string handling. Thanks to this, the programmer is\nleft free to organize the content parsed as (s)he pleases, assisted by a rich\nset of fine-tuning tools.\n\n\nFeatures\n--------\n\n* Typed data support (each value can be parsed as a boolean, a number, a\n  string, an array)\n* Single/double quotes support in _Bash style_ (i.e. quotes can be opened and\n  closed multiple times within the same value)\n* Multi-line support\n* Comment support\n* Disabled entry support\n* INI sectioning support (single-level sectioning, as in `[foo]`; absolute\n  nesting, as in `[foo.bar]`; relative nesting, as in `[.bar]`)\n* Automatic sanitization of values, key names and section paths\n* Comparison functions designed just for INI source code (capable, for example,\n  to recognize the equality between \u003ccode\u003e\"Hello world\"\u003c/code\u003e and\n  \u003ccode\u003e\"He\"l'lo' world\u003c/code\u003e, or between \u003ccode\u003efoo bar\u003c/code\u003e and\n  \u003ccode\u003efoo\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;bar\u003c/code\u003e)\n* Callback pattern\n* Thread-safety (each parsing process is fully reentrant)\n* Highly optimized code (single memory allocation for each parsing, heuristic\n  programming, optimization flags)\n* Function modularity (each public function is independent from all other\n  public functions)\n* K.I.S.S. (no public functions are automatically invoked during the parsing --\n  for example, not even single/double quotes are automatically removed from\n  values unless the developer explicitly decides to use the formatting\n  functions provided by the API)\n* Robust and cross-platform file access (UTF-8 support; protection against null\n  byte injection; support of all code representations of new lines -- i.e.\n  ubiquitous support of Classic Mac OS' `CR`, Unix' `LF`, Windows' `CR`+`LF`,\n  RISC OS Open's `LF`+`CR`)\n\n\nSample usage\n------------\n\nlog.ini:\n\n`````````````````````````````````````` ini\n[users]\nhave_visited = ronnie, lilly82, robrob\n\n[last_update]\ndate = 12.03.2017\n``````````````````````````````````````\n\nexample.c:\n\n``````````````````````````````````````````````````````````````````````````` c\n#include \u003cconfini.h\u003e\n\nstatic int callback (IniDispatch * disp, void * v_other) {\n\n  #define IS_KEY(SECTION, KEY) \\\n    (ini_array_match(SECTION, disp-\u003eappend_to, '.', disp-\u003eformat) \u0026\u0026 \\\n    ini_string_match_ii(KEY, disp-\u003edata, disp-\u003eformat))\n\n  if (disp-\u003etype == INI_KEY) {\n\n    if (IS_KEY(\"users\", \"have_visited\")) {\n\n      /* No need to parse this field as an array right now */\n      printf(\"People who have visited: %s\\n\", disp-\u003evalue);\n\n    } else if (IS_KEY(\"last_update\", \"date\")) {\n\n      printf(\"Last update: %s\\n\", disp-\u003evalue);\n\n    }\n\n  }\n\n  #undef IS_KEY\n\n  return 0;\n\n}\n\nint main () {\n\n  if (load_ini_path(\"log.ini\", INI_DEFAULT_FORMAT, NULL, callback, NULL)) {\n\n    fprintf(stderr, \"Sorry, something went wrong :-(\\n\");\n    return 1;\n\n  }\n\n  return 0;\n\n}\n```````````````````````````````````````````````````````````````````````````\n\nOutput:\n\n````````````````````````````````````````````````\nPeople who have visited: ronnie, lilly82, robrob\nLast update: 12.03.2017\n````````````````````````````````````````````````\n\nIf you are using C++, under `examples/cplusplus/map.cpp` you can find a snippet\nfor storing an INI file into a class that relies on a `std::unordered_map`\nobject.\n\nFor more details, please read the [Library Functions Manual][2] (`man\nlibconfini`) -- a standalone HTML version is available [here][3] -- and the\nmanual of the header file (`man confini.h`). The code is available on\n[GitHub][4] under [madmurphy/libconfini][5]).\n\n\nInstallation\n------------\n\nDespite the small footprint, **libconfini** has been conceived as a shared\nlibrary (but it can be used as a static library as well). An automatic list of\nthe distributions that ship the library already compiled is available [here][6].\n\nIf a pre-compiled package for your platform is not available, on most Unix-like\nsystems it is possible to install **libconfini** using the following common\nsteps:\n\n`````````````````` sh\n./configure\nmake\nmake install-strip\n``````````````````\n\nIf the `strip` utility is not available on your machine, use `make install`\ninstead (it will produce larger binaries)\n\nFor a minimum installation without development files (i.e. static libraries,\nheaders, documentation, examples, etc.) use `./configure --disable-devel`.\n\nIf the `configure` script is missing you need to generate it by running the\n`bootstrap` script. By default, `bootstrap` will also run the `configure`\nscript immediately after having generated it, so you may type the `make`\ncommand directly after `bootstrap`. To list different options use `./bootstrap\n--help`.\n\nIf you are using **Microsoft Windows**, a batch script for compiling\n**libconfini** with [**MinGW**][7] without **Bash** is available\n(`mgwmake.bat`). If you are interested in using **GNU Make** for compiling\n**libconfini**, you can integrate **MinGW** with [**MSYS**][8], or you can\ndirectly use [**MSYS2**][9] and [its official port][10] of the library.\nAlternatively, [an unofficial port][11] of **libconfini** for [**Cygwin**][12]\nis available.\n\nFor further information, see [INSTALL][13].\n\n\nBindings\n--------\n\n[Danilo Spinella][14] maintains [a D binding package][15] of **libconfini**.\n\n\nFree software\n-------------\n\nThis library is free software. You can redistribute it and/or modify it under\nthe terms of the GPL license version 3 or any later version. See [COPYING][16]\nfor details.\n\n\n  [1]: https://madmurphy.github.io/libconfini/html/baremetal.html\n  [2]: https://madmurphy.github.io/libconfini/html/libconfini.html\n  [3]: https://madmurphy.github.io/libconfini/manual.html\n  [4]: https://github.com/\n  [5]: https://github.com/madmurphy/libconfini\n  [6]: https://repology.org/project/libconfini/versions\n  [7]: http://www.mingw.org/\n  [8]: http://www.mingw.org/wiki/MSYS\n  [9]: https://www.msys2.org/\n  [10]: https://packages.msys2.org/base/mingw-w64-libconfini\n  [11]: https://github.com/fd00/yacp/tree/master/libconfini\n  [12]: https://www.cygwin.com/\n  [13]: https://madmurphy.github.io/libconfini/html/install.html\n  [14]: https://danyspin97.org/\n  [15]: https://github.com/DanySpin97/libconfini-d\n  [16]: https://github.com/madmurphy/libconfini/blob/master/COPYING\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadmurphy%2Flibconfini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadmurphy%2Flibconfini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadmurphy%2Flibconfini/lists"}