132fa32
diff -pur pkg-config-0.23.orig/main.c pkg-config-0.23/main.c
132fa32
--- pkg-config-0.23.orig/main.c	2008-01-16 14:06:48.000000000 -0800
132fa32
+++ pkg-config-0.23/main.c	2008-10-24 14:18:51.000000000 -0700
132fa32
@@ -189,6 +189,8 @@ main (int argc, char **argv)
db43622
   int want_uninstalled = 0;
db43622
   char *variable_name = NULL;
db43622
   int want_exists = 0;
db43622
+  int want_prov = 0;
db43622
+  int want_req = 0;
db43622
   char *required_atleast_version = NULL;
db43622
   char *required_exact_version = NULL;
db43622
   char *required_max_version = NULL;
132fa32
@@ -258,6 +260,10 @@ main (int argc, char **argv)
db43622
       "show verbose information about missing or conflicting packages" },
db43622
     { "errors-to-stdout", 0, POPT_ARG_NONE, &want_stdout_errors, 0,
db43622
       "print errors from --print-errors to stdout not stderr" },
c6aaee1
+    { "print-provides", 0, POPT_ARG_NONE, &want_prov, 0,
c6aaee1
+      "print which packages the package provides" },
c6aaee1
+    { "print-requires", 0, POPT_ARG_NONE, &want_req, 0,
c6aaee1
+      "print which packages the package requires" },
db43622
 #ifdef G_OS_WIN32
db43622
     { "dont-define-prefix", 0, POPT_ARG_NONE, &dont_define_prefix, 0,
db43622
       "don't try to override the value of prefix for each .pc file found with "
132fa32
@@ -570,6 +576,66 @@ main (int argc, char **argv)
c6aaee1
         }
c6aaee1
     }
c6aaee1
 
db43622
+ if (want_prov)
db43622
+   {
db43622
+     GSList *tmp;
db43622
+     tmp = packages;
db43622
+     while (tmp != NULL)
db43622
+       {
db43622
+         Package *pkg = tmp->data;
db43622
+         char *key;
db43622
+         key = pkg->key;
db43622
+         while (*key == '/')
db43622
+           key++;
db43622
+         if (strlen(key) > 0)
db43622
+           printf ("%s = %s\n", key, pkg->version);
db43622
+         tmp = g_slist_next (tmp);
db43622
+       }
db43622
+   }
c6aaee1
+
db43622
+ if (want_req)
db43622
+   {
db43622
+     GSList *pkgtmp = packages;
db43622
+     while (pkgtmp != NULL)
db43622
+       {
db43622
+         Package *pkg = pkgtmp->data;
132fa32
+
132fa32
+         /* process Requires: */
db43622
+         GSList *reqtmp = pkg->requires;
db43622
+         while (reqtmp != NULL)
db43622
+           {
db43622
+             Package *deppkg = reqtmp->data;
db43622
+             RequiredVersion *req;
db43622
+             req = g_hash_table_lookup(pkg->required_versions, deppkg->key);
db43622
+             if ((req == NULL) || (req->comparison == ALWAYS_MATCH))
db43622
+               printf ("%s\n", deppkg->key);
db43622
+             else
db43622
+               printf ("%s %s %s\n", deppkg->key,
db43622
+                       comparison_to_str(req->comparison),
db43622
+                       req->version);
db43622
+             reqtmp = g_slist_next (reqtmp);
db43622
+           }
132fa32
+
132fa32
+         /* process Requires.private: */
132fa32
+         reqtmp = pkg->requires_private;
132fa32
+         while (reqtmp != NULL)
132fa32
+           {
132fa32
+             Package *deppkg = reqtmp->data;
132fa32
+             RequiredVersion *req;
132fa32
+             req = g_hash_table_lookup(pkg->required_versions, deppkg->key);
132fa32
+             if ((req == NULL) || (req->comparison == ALWAYS_MATCH))
132fa32
+               printf ("%s\n", deppkg->key);
132fa32
+             else
132fa32
+               printf ("%s %s %s\n", deppkg->key,
132fa32
+                       comparison_to_str(req->comparison),
132fa32
+                       req->version);
132fa32
+             reqtmp = g_slist_next (reqtmp);
132fa32
+           }
132fa32
+
db43622
+         pkgtmp = g_slist_next (pkgtmp);
db43622
+       }
db43622
+   }
c6aaee1
+
c6aaee1
   if (required_exact_version)
c6aaee1
     {
c6aaee1
       Package *pkg = packages->data;