summaryrefslogtreecommitdiff
path: root/time/remind/patches/patch-ac
blob: 3057ba84aa8e97d6af139a6c0d1ae26694d433fe (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
$NetBSD: patch-ac,v 1.5 2007/09/08 21:58:01 jlam Exp $

--- src/files.c.orig	2005-09-29 23:29:32.000000000 -0400
+++ src/files.c
@@ -19,6 +19,7 @@ static char const RCSID[] = "$Id: files.
 
 #include <string.h>
 #include <ctype.h>
+#include <glob.h>
 #include <sys/stat.h>
 
 #ifdef TM_IN_SYS_TIME
@@ -365,16 +366,27 @@ 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;