This patch adds the ability to use Include filenames containing wildcards and also expands the tilde to the homedirectory of the executing user. Signed-off-by: Marc-A. Dahlhaus <mad@wol.de> --- diff -Nurp pacman-3.3.0.orig/src/pacman/pacman.c pacman-3.3.0/src/pacman/pacman.c --- pacman-3.3.0.orig/src/pacman/pacman.c 2009-08-01 20:07:42.000000000 +0200 +++ pacman-3.3.0/src/pacman/pacman.c 2009-09-10 21:11:03.000000000 +0200 @@ -38,6 +38,7 @@ #include <locale.h> /* setlocale */ #include <time.h> /* time_t */ #include <errno.h> +#include <glob.h> #if defined(PACMAN_DEBUG) && defined(HAVE_MCHECK_H) #include <mcheck.h> /* debug tracing (mtrace) */ #endif @@ -814,8 +815,23 @@ static int _parseconfig(const char *file } else { /* directives with settings */ if(strcmp(key, "Include") == 0) { - pm_printf(PM_LOG_DEBUG, "config: including %s\n", ptr); - _parseconfig(ptr, section, db); + int globret; + glob_t globbuf; + globret = glob(ptr, GLOB_TILDE_CHECK, NULL, &globbuf); + switch(globret) { + case GLOB_NOSPACE: + pm_printf(PM_LOG_DEBUG, "config: include globing out of space\n"); + break; + case GLOB_ABORTED: + pm_printf(PM_LOG_DEBUG, "config: include globing read error for %s\n", ptr); + break; + default: + for(int gindex = 0; gindex < globbuf.gl_pathc; gindex++) { + pm_printf(PM_LOG_DEBUG, "config: including %s\n", globbuf.gl_pathv[gindex]); + _parseconfig(globbuf.gl_pathv[gindex], section, db); + } + break; + } /* Ignore include failures... assume non-critical */ } else if(strcmp(section, "options") == 0) { if(strcmp(key, "NoUpgrade") == 0) { This patch addes the ability to use Include filenames containing wildcards and also expands the tilde to the homedir of the executing user. Signed-off-by: Marc-A. Dahlhaus <mad@wol.de> --- diff -Nurp pacman-3.3.0.orig/src/pacman/pacman.c pacman-3.3.0/src/pacman/pacman.c --- pacman-3.3.0.orig/src/pacman/pacman.c 2009-08-01 20:07:42.000000000 +0200 +++ pacman-3.3.0/src/pacman/pacman.c 2009-09-10 21:11:03.000000000 +0200 @@ -38,6 +38,7 @@ #include <locale.h> /* setlocale */ #include <time.h> /* time_t */ #include <errno.h> +#include <glob.h> #if defined(PACMAN_DEBUG) && defined(HAVE_MCHECK_H) #include <mcheck.h> /* debug tracing (mtrace) */ #endif @@ -814,8 +815,23 @@ static int _parseconfig(const char *file } else { /* directives with settings */ if(strcmp(key, "Include") == 0) { - pm_printf(PM_LOG_DEBUG, "config: including %s\n", ptr); - _parseconfig(ptr, section, db); + int globret; + glob_t globbuf; + globret = glob(ptr, GLOB_TILDE_CHECK, NULL, &globbuf); + switch(globret) { + case GLOB_NOSPACE: + pm_printf(PM_LOG_DEBUG, "config: include globing out of space\n"); + break; + case GLOB_ABORTED: + pm_printf(PM_LOG_DEBUG, "config: include globing read error for %s\n", ptr); + break; + default: + for(int gindex = 0; gindex < globbuf.gl_pathc; gindex++) { + pm_printf(PM_LOG_DEBUG, "config: including %s\n", globbuf.gl_pathv[gindex]); + _parseconfig(globbuf.gl_pathv[gindex], section, db); + } + break; + } /* Ignore include failures... assume non-critical */ } else if(strcmp(section, "options") == 0) { if(strcmp(key, "NoUpgrade") == 0) {