main: implement support for --env-only option.

pull/4/head
William Pitcock 2012-05-02 23:19:50 +00:00
parent e59b9864ea
commit d97853e49c
1 changed files with 6 additions and 0 deletions

6
main.c
View File

@ -47,6 +47,7 @@ static int want_static = 0;
static int want_requires = 0; static int want_requires = 0;
static int want_variables = 0; static int want_variables = 0;
static int want_digraph = 0; static int want_digraph = 0;
static int want_env_only = 0;
static int maximum_traverse_depth = 2; static int maximum_traverse_depth = 2;
static char *required_pkgconfig_version = NULL; static char *required_pkgconfig_version = NULL;
@ -269,6 +270,7 @@ usage(void)
printf(" --maximum-traverse-depth maximum allowed depth for dependency graph\n"); printf(" --maximum-traverse-depth maximum allowed depth for dependency graph\n");
printf(" --static be more aggressive when computing dependency graph\n"); printf(" --static be more aggressive when computing dependency graph\n");
printf(" (for static linking)\n"); printf(" (for static linking)\n");
printf(" --env-only look only for package entries in PKG_CONFIG_PATH\n");
printf("\nquerying specific pkg-config database fields:\n\n"); printf("\nquerying specific pkg-config database fields:\n\n");
@ -306,6 +308,7 @@ main(int argc, char *argv[])
{ "print-variables", no_argument, &want_variables, 14, }, { "print-variables", no_argument, &want_variables, 14, },
{ "digraph", no_argument, &want_digraph, 15, }, { "digraph", no_argument, &want_digraph, 15, },
{ "help", no_argument, &want_help, 16, }, { "help", no_argument, &want_help, 16, },
{ "env-only", no_argument, &want_env_only, 17, },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@ -345,6 +348,9 @@ main(int argc, char *argv[])
if (want_static) if (want_static)
maximum_traverse_depth++; maximum_traverse_depth++;
if (want_env_only)
global_traverse_flags |= PKGF_ENV_ONLY;
if (required_pkgconfig_version != NULL) if (required_pkgconfig_version != NULL)
{ {
if (pkg_compare_version(PKGCONFIG_VERSION_EQUIV, required_pkgconfig_version) >= 0) if (pkg_compare_version(PKGCONFIG_VERSION_EQUIV, required_pkgconfig_version) >= 0)