diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-12-25 20:15:22 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-12-26 01:17:52 +0200 |
commit | add57c075c6f747a81c142ab48d59106de822664 (patch) | |
tree | c15f94acdf135954e2f63ac7657c57cdd134ed75 /doc | |
parent | d51e1365118ce87016a39bd94437e31b35b8d307 (diff) | |
download | grecs-add57c075c6f747a81c142ab48d59106de822664.tar.gz grecs-add57c075c6f747a81c142ab48d59106de822664.tar.bz2 |
Add globbing pattern support to #include and #include_once
* doc/grecs-syntax.texi: Document changes to the #include statement.
* doc/grecs_config.5: Likewise.
* src/preproc.c (include_glob, include_pos)
(include_once): New statics.
(pp_list_find): Return 0 if list is NULL.
(incl_copy): New statics.
(source_lookup): Use incl_copy as the copy function.
(pop_source): If more glob expansions are available, push next one
onto input stack.
(isglob): New static.
(parse_include): Support globbing patterns.
* tests/Makefile.am: Add new testes.
* tests/testsuite.at: Likewise.
* tests/incl00.at: New test case.
* tests/incl01.at: New test case.
* tests/incl02.at: New test case.
* tests/incl03.at: New test case.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/grecs-syntax.texi | 25 | ||||
-rw-r--r-- | doc/grecs_config.5 | 27 |
2 files changed, 37 insertions, 15 deletions
diff --git a/doc/grecs-syntax.texi b/doc/grecs-syntax.texi index c10cab6..da59d03 100644 --- a/doc/grecs-syntax.texi +++ b/doc/grecs-syntax.texi @@ -1,5 +1,5 @@ @c This file is part of grecs - Gray's Extensible Configuration System -@c Copyright (C) 2007, 2009-2012 Sergey Poznyakoff +@c Copyright (C) 2007, 2009-2014 Sergey Poznyakoff @c @c Grecs is free software; you can redistribute it and/or modify @c it under the terms of the GNU General Public License as published by @@ -82,12 +82,23 @@ next physical newline character. @kwindex #include @item #include <@var{file}> @itemx #include @var{file} -Include the contents of the file @var{file}. If @var{file} is an -absolute file name, both forms are equivalent. Otherwise, the form -with angle brackets searches for the file in the @dfn{include -search path}, while the second one looks for it in the current working -directory first, and, if not found there, in the include search -path. +Include the contents of the file @var{file}. There are three possible +use cases. + +If @var{file} is an absolute file name, the named file is included. +An error message will be issued if it does not exist. + +If @var{file} contains wildcard characters (@samp{*}, @samp{[}, +@samp{]} or @samp{?}), it is interpreted as shell globbing pattern and +all files matching that pattern are included, in lexicographical +order. If no files match the pattern, the statement is silently +ignored. + +Otherwise, the form with angle brackets searches for file in the +@dfn{include search path}, while the second one looks for it in the +current working directory first, and, if not found there, in the +include search path. If the file is not found, an error message will +be issued. The default include search path is: diff --git a/doc/grecs_config.5 b/doc/grecs_config.5 index 80f7bcc..82633d5 100644 --- a/doc/grecs_config.5 +++ b/doc/grecs_config.5 @@ -1,5 +1,5 @@ .\" This file is part of grecs -*- nroff -*- -.\" Copyright (C) 2007, 2009-2012 Sergey Poznyakoff +.\" Copyright (C) 2007, 2009-2014 Sergey Poznyakoff .\" .\" Grecs is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. .\" -.TH GRECS_CONFIG 3 "May 4, 2011" "GRECS" "Grecs User Reference" +.TH GRECS_CONFIG 3 "December 25, 2014" "GRECS" "Grecs User Reference" .SH NAME \fBGrecs\fR configuration file syntax .SH DESCRIPTION @@ -64,12 +64,23 @@ sign and end with the next physical newline character. .TP .BR "#include " "file" .PD -Include the contents of the file \fIfile\fR. If it is an -absolute file name, both forms are equivalent. Otherwise, the form -with angle brackets searches for the file in the \fIinclude -search path\fR, while the second one looks for it in the current working -directory first, and, if not found there, in the include search -path. +Include the contents of the file \fIfile\fR. There are three possible +use cases. + +If \fIfile\fR is an absolute file name, the named file is included. +An error message will be issued if it does not exist. + +If \fIfile\fR contains wildcard characters (\fB*\fR, \fB[\fR, +\fB]\fR or \fB?\fR), it is interpreted as shell globbing pattern and +all files matching that pattern are included, in lexicographical +order. If no files match the pattern, the statement is silently +ignored. + +Otherwise, the form with angle brackets searches for file in the +\fIinclude search path\fR, while the second one looks for it in the +current working directory first, and, if not found there, in the +include search path. If the file is not found, an error message will +be issued. .sp The default include search path is: .sp |