treeconf - C语言树型配置文件库


GPLv2
Windows
C/C++

软件简介

配置信息必须是树型结构的, 这是本项目的出发点. 但显然, 使用XML, JSON或者Lua/Python脚本语言, 都是没有必要的.
本项目开发的配置文件, 通过TAB缩进来表示树型关系. 看起来有点像Python的意思. 源码很简单, 代码量不多, 希望对你有帮助.

Configurations should be in the form of tree, that’s what I started from. In
many cases, XML/JSON, even script languages like Lua/Python are not necessary.
This project develop a C/C++ library that reads configuration files which
grammar uses TAB to indicate parent-child relation. I may say, it is Pythonic.
The source code is quit simple and small, hope it helps you, enjoy it.
配置文件示例/Configuration file example

this is a comment

author : ideawu
url: http://www.ideawu.net

proxy :
php =
host = 127.0.0.1
port = 8088
py :
host = 127.0.0.1
port = 8080

cgi =
pl = /usr/bin/perl

C 语言使用示例/C program example that uses treeconf

cfg = cfg_load_file(“cfg_test.conf”);
printf(“proxy.php.host = %s\n”, cfg_getstr(cfg, “proxy.php.host”));