main: add --modversion option

pull/1/merge
William Pitcock 2011-07-25 00:21:54 -05:00
parent f79c6780c3
commit b0c762f3b9
1 changed files with 11 additions and 0 deletions

11
main.c
View File

@ -27,6 +27,7 @@
static int want_cflags = 0; static int want_cflags = 0;
static int want_libs = 0; static int want_libs = 0;
static int want_modversion = 0;
static void static void
print_cflags(pkg_t *pkg, void *unused) print_cflags(pkg_t *pkg, void *unused)
@ -73,6 +74,15 @@ pkg_queue_walk(pkg_queue_t *head)
pkg = pkg_find(pkgq->package); pkg = pkg_find(pkgq->package);
if (pkg) if (pkg)
{ {
if (want_modversion)
{
wanted_something = 0;
want_cflags = 0;
want_libs = 0;
printf("%s\n", pkg->version);
}
if (want_cflags) if (want_cflags)
{ {
wanted_something++; wanted_something++;
@ -109,6 +119,7 @@ main(int argc, const char *argv[])
struct poptOption options[] = { struct poptOption options[] = {
{ "libs", 0, POPT_ARG_NONE, &want_libs, 0, "output all linker flags" }, { "libs", 0, POPT_ARG_NONE, &want_libs, 0, "output all linker flags" },
{ "cflags", 0, POPT_ARG_NONE, &want_cflags, 0, "output all compiler flags" }, { "cflags", 0, POPT_ARG_NONE, &want_cflags, 0, "output all compiler flags" },
{ "modversion", 0, POPT_ARG_NONE, &want_modversion, 0, "output package version" },
POPT_AUTOHELP POPT_AUTOHELP
{ NULL, 0, 0, NULL, 0 } { NULL, 0, 0, NULL, 0 }
}; };