db43622
--- pkg-config-0.18.1/main.c.reqprov	2005-07-07 15:38:55.597133000 -0400
db43622
+++ pkg-config-0.18.1/main.c	2005-07-07 15:40:19.400246000 -0400
db43622
@@ -187,6 +187,8 @@
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;
db43622
@@ -254,6 +256,10 @@
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 "
db43622
@@ -545,6 +551,47 @@
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;
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
+           }
db43622
+         pkgtmp = g_slist_next (pkgtmp);
db43622
+       }
db43622
+   }
c6aaee1
+
c6aaee1
   if (required_exact_version)
c6aaee1
     {
c6aaee1
       Package *pkg = packages->data;