summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarc-A. Dahlhaus <mad@wol.de>2010-05-18 14:32:02 +0200
committerDan McGee <dan@archlinux.org>2010-05-18 11:26:22 -0500
commit5752e276fb585d07bd0f8e8b2a1f2827afdf2799 (patch)
treef2f07a4ffb1df04c3edd2148d9dd65c6f2e0ff36 /src
parenta6ace987a913852af30bb5e3ae6bf145dc9c6157 (diff)
downloadpacman-5752e276fb585d07bd0f8e8b2a1f2827afdf2799.tar.xz
Allow to include a path containing wildcards
Dan: line wrapping and man page touchup. Signed-off-by: Marc-A. Dahlhaus <mad@wol.de> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/pacman.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 6ecda052..78407d67 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -39,6 +39,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
@@ -967,9 +968,35 @@ static int _parseconfig(const char *file, const char *givensection,
ret = 1;
goto cleanup;
}
- pm_printf(PM_LOG_DEBUG, "config: including %s\n", value);
/* Ignore include failures... assume non-critical */
- _parseconfig(value, section, db);
+ int globret;
+ glob_t globbuf;
+ globret = glob(value, GLOB_NOCHECK, NULL, &globbuf);
+ switch(globret) {
+ case GLOB_NOSPACE:
+ pm_printf(PM_LOG_DEBUG,
+ "config file %s, line %d: include globing out of space\n",
+ file, linenum);
+ break;
+ case GLOB_ABORTED:
+ pm_printf(PM_LOG_DEBUG,
+ "config file %s, line %d: include globing read error for %s\n",
+ file, linenum, value);
+ break;
+ case GLOB_NOMATCH:
+ pm_printf(PM_LOG_DEBUG,
+ "config file %s, line %d: no include found for %s\n",
+ file, linenum, value);
+ break;
+ default:
+ for(int gindex = 0; gindex < globbuf.gl_pathc; gindex++) {
+ pm_printf(PM_LOG_DEBUG, "config file %s, line %d: including %s\n",
+ file, linenum, globbuf.gl_pathv[gindex]);
+ _parseconfig(globbuf.gl_pathv[gindex], section, db);
+ }
+ break;
+ }
+ globfree(&globbuf);
continue;
}
if(strcmp(section, "options") == 0) {