From 0ca4e5d00cff641ec1545835ed09bf33dd329d56 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Tue, 6 Aug 2024 10:42:18 -0700 Subject: [PATCH] cli: allow --env to work with --variable --- cli/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/main.c b/cli/main.c index 79beea7..bbbc2ac 100644 --- a/cli/main.c +++ b/cli/main.c @@ -549,6 +549,9 @@ apply_env_variables(pkgconf_client_t *client, pkgconf_pkg_t *world, const char * char havebuf[PKGCONF_ITEM_SIZE]; char *p; + if (want_variable != NULL && strcmp(want_variable, tuple->key)) + continue; + snprintf(havebuf, sizeof havebuf, "%s_%s", env_prefix, tuple->key); for (p = havebuf; *p; p++) @@ -589,7 +592,7 @@ apply_env(pkgconf_client_t *client, pkgconf_pkg_t *world, void *env_prefix_p, in if (!apply_env_var(workbuf, client, world, maxdepth, pkgconf_pkg_libs, filter_libs, NULL)) return false; - if ((want_flags & PKG_VARIABLES) == PKG_VARIABLES) + if ((want_flags & PKG_VARIABLES) == PKG_VARIABLES || want_variable != NULL) apply_env_variables(client, world, want_env_prefix); return true;