项目作者: slayers-git

项目描述 :
Unix configuration file parser
高级语言: C
项目地址: git://github.com/slayers-git/slconfig.git
创建时间: 2021-07-12T10:51:16Z
项目社区:https://github.com/slayers-git/slconfig

开源协议:GNU General Public License v2.0

下载


SLConfig

SLConfig is a simple config parser library written in C89, it can be used to parse standart UNIX configuration files with some additional functionality added (optionally).

Features

  • Optionally enviromental variables can be obtained and set to a key
  • Optional variables inside of the configuration files

Example configuration file syntax

  1. # standart UNIX configuration syntax:
  2. # comment
  3. key1 = value
  4. key2 = "value within quotes"
  5. # optional functionality:
  6. shell_of_choice = ${SHELL} # example usage of enviromental variables
  7. # example usage of variables
  8. $prefix = "[myprefix]"
  9. error = $(prefix)" error: "
  10. warn = $(prefix)" warning: "

Example C implementation can be found in example.c file

Building

To build and install SLConfig library on a *nix system, in your shell type

  1. mkdir build && cd build\
  2. cmake && make && sudo make install

If you also want to compile example.c, add -DSLC_EXAMPLES=1 to the cmake command.