main: add frontend implementation of --list-all

pull/36/head
William Pitcock 2012-07-25 23:55:53 -05:00
parent 6f5fbb80d4
commit 3e1858320c
1 changed files with 15 additions and 0 deletions

15
main.c
View File

@ -100,6 +100,12 @@ print_fragment(pkg_fragment_t *frag)
printf("%s ", frag->data);
}
static void
print_list_entry(const pkg_t *entry)
{
printf("-%30s %s - %s\n", entry->id, entry->realname, entry->description);
}
static void
print_cflags(pkg_fragment_t *list)
{
@ -438,6 +444,7 @@ usage(void)
printf(" with a specified pkg-config version\n");
printf(" --errors-to-stdout print all errors on stdout instead of stderr\n");
printf(" --silence-errors explicitly be silent about errors\n");
printf(" --list-all list all known packages\n");
printf("\nchecking specific pkg-config database entries:\n\n");
@ -489,6 +496,7 @@ main(int argc, char *argv[])
int want_libs_other = 0;
int want_cflags_I = 0;
int want_cflags_other = 0;
int want_list = 0;
struct pkg_option options[] = {
{ "version", no_argument, &want_version, 1, },
@ -524,6 +532,7 @@ main(int argc, char *argv[])
{ "ignore-conflicts", no_argument, &want_ignore_conflicts, 30, },
{ "errors-to-stdout", no_argument, &want_errors_on_stdout, 31, },
{ "silence-errors", no_argument, &want_silence_errors, 32, },
{ "list-all", no_argument, &want_list, 33, },
{ NULL, 0, NULL, 0 }
};
@ -627,6 +636,12 @@ main(int argc, char *argv[])
return EXIT_FAILURE;
}
if (want_list)
{
pkg_scan_all(print_list_entry);
return EXIT_SUCCESS;
}
if (required_module_version != NULL)
{
pkg_t *pkg;