$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;