[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Confuse-devel] Thanks for a very useful, efficient library.
From: |
Sean Burke |
Subject: |
[Confuse-devel] Thanks for a very useful, efficient library. |
Date: |
Thu, 4 Jul 2013 12:12:03 -0700 |
Hi All,
I just integrated libconfuse with my project, and I am very pleased with it.
It has a very nice balance of features and simplicity, and was very ease to use.
I did find it useful to change cfg_include, so that paths are constructed
relative to the file containing the include directive, see below.
-Sean
DLLIMPORT int cfg_include(cfg_t *cfg, cfg_opt_t *opt, int argc,
const char **argv)
{
opt = NULL;
if (argc == 1)
{
const char * arg = argv[0];
int res = 0;
#ifndef WIN32
// If the argument does not begin with / or ~ (not an absolute path),
// construct a path relative to the current filename.
if (!strspn(arg, "~/") && strchr(cfg->filename, '/'))
{
char * tmp = malloc(strlen(cfg->filename) + strlen(arg));
strcpy(tmp, cfg->filename);
strcpy(strrchr(tmp, '/') + 1, arg);
arg = tmp;
}
#endif
res = cfg_lexer_include(cfg, arg);
if (arg != argv[0]) free(arg);
return res;
}
else
{
cfg_error(cfg, _("wrong number of arguments to cfg_include()"));
return 1;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Confuse-devel] Thanks for a very useful, efficient library.,
Sean Burke <=