Commit 236423d3 authored by Jose Luis Tallon's avatar Jose Luis Tallon

Documentation & misc fixes:

 - Document the include_dir directive
 - Robustness: filter out non-files (where scandir supports it)
 - Add myself to the credits
parent a4c16f8c
......@@ -4,3 +4,4 @@ Daniel Marjamäki - Enhancements & bugfixes.
Andrew Tytula - Windows port.
Glenn Herteg - Enhancements, bugfixes, documentation corrections.
Matt Renaud - Enhancements & bugfixes.
JoseLuis Tallon - Enhacements
......@@ -36,7 +36,7 @@
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 2005-2014 Mark A Lindner
Copyright @copyright{} 2005-2015 Mark A Lindner
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
......@@ -640,6 +640,48 @@ info: @{
@end smallexample
@end cartouche
The resulting configuration will be equivalent to one in which the
contents of the ``quote.cfg`` file appeared at the point where the
@@include directive is placed.
@cindex include_dir directive
Additionally, a directory containing configuration snippets can be
processed using an @i{include_dir directive}. This directive has the
effect of inlining the contents of the files contained in the named
directory at the point of inclusion.
The files are ordered lexicographically and ``hidden`` files (those
having a name beginning with a dot) are excluded.
An include_dir directive must appear on its own line in the input:
@b{@@include_dir "}@i{dirname}@b{"}
The same quoting rules as for @i{@@include} apply.
@cartouche
@smallexample
# directory: myapp/conf.d
00prolog.cfg
01header.cfg
02body.cfg
03footer.cfg
99epilog.cfg
@end smallexample
@end cartouche
@cartouche
@smallexample
# file: test.cfg
docinfo: @{
name = "Some complex config";
@@include_dir "myapp/conf.d"
@};
@end smallexample
@end cartouche
Please keep in mind that the files will be included in lexicographical order.
Include files may be nested to a maximum of 10 levels; exceeding this
limit results in a parse error.
......
......@@ -87,6 +87,14 @@ static unsigned long long fromhex(const char *s)
static int filter_dotfiles(const struct dirent *de)
{
const char *fname = de->d_name;
#ifdef _DIRENT_HAVE_D_TYPE
/* filter out non-files and non-symlinks */
if( DT_REG!=de->d_type && DT_LNK!=de->d_type
&& DT_UNKNOWN!=de->d_type )
return 0;
#endif
return ( NULL != fname
&& '\0' != fname[0] /* can't really happen */
&& '.' != fname[0] ) ? 1 : 0 ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment