blob: 54f045a9fb143d26d5fbcdf7e22ad340df7ba0b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
$NetBSD: patch-ac,v 1.6 2008/11/10 17:46:31 wiz Exp $
--- src/files.c.orig 2008-03-25 03:12:37.000000000 +0000
+++ src/files.c
@@ -18,6 +18,7 @@
#include <string.h>
#include <ctype.h>
+#include <glob.h>
#include <sys/stat.h>
#ifdef TM_IN_SYS_TIME
@@ -445,16 +446,28 @@ int DoInclude(ParsePtr p)
{
DynamicBuffer buf;
int r, e;
+ glob_t g;
+ char **gp;
DBufInit(&buf);
+ memset(&g, 0, sizeof(g));
+
if ( (r=ParseToken(p, &buf)) ) return r;
e = VerifyEoln(p);
if (e) Eprint("%s", ErrMsg[e]);
- if ( (r=IncludeFile(DBufValue(&buf))) ) {
- DBufFree(&buf);
- return r;
- }
+
+ glob(DBufValue(&buf), GLOB_NOCHECK|GLOB_BRACE|GLOB_TILDE, NULL, &g);
DBufFree(&buf);
+
+ for (gp = g.gl_pathv; gp && *gp; gp++) {
+ if ( (r=IncludeFile(*gp)) ) {
+ globfree(&g);
+ return r;
+ }
+ }
+
+ globfree(&g);
+
NumIfs = 0;
IfFlags = 0;
return OK;
|