From e59b9864eaa38accabebc7527b74a4dc34748bcd Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 2 May 2012 23:16:32 +0000 Subject: [PATCH] pkg: implement resolver-side support for some pkg-config clone's --env-only option --- pkg.c | 9 ++++++--- pkg.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg.c b/pkg.c index bbf8846..3bdc716 100644 --- a/pkg.c +++ b/pkg.c @@ -87,9 +87,12 @@ pkg_find(const char *name, unsigned int flags) free(path); } - snprintf(locbuf, sizeof locbuf, "%s/%s" PKG_CONFIG_EXT, PKG_DEFAULT_PATH, name); - if (f = fopen(locbuf, "r")) - return parse_file(locbuf, f); + if (!(flags & PKGF_ENV_ONLY)) + { + snprintf(locbuf, sizeof locbuf, "%s/%s" PKG_CONFIG_EXT, PKG_DEFAULT_PATH, name); + if (f = fopen(locbuf, "r")) + return parse_file(locbuf, f); + } return NULL; } diff --git a/pkg.h b/pkg.h index 5ea7440..e2e9f8f 100644 --- a/pkg.h +++ b/pkg.h @@ -102,6 +102,7 @@ struct pkg_ { #define PKGF_NONE 0x0 #define PKGF_SEARCH_PRIVATE 0x1 +#define PKGF_ENV_ONLY 0x2 pkg_t *pkg_find(const char *name, unsigned int flags); void pkg_traverse(pkg_t *root, void (*pkg_traverse_func)(pkg_t *package, void *data), void *data, int maxdepth, unsigned int flags);