db4362
--- pkg-config-0.18.1/main.c.reqprov	2005-07-07 15:38:55.597133000 -0400
db4362
+++ pkg-config-0.18.1/main.c	2005-07-07 15:40:19.400246000 -0400
db4362
@@ -187,6 +187,8 @@
db4362
   int want_uninstalled = 0;
db4362
   char *variable_name = NULL;
db4362
   int want_exists = 0;
db4362
+  int want_prov = 0;
db4362
+  int want_req = 0;
db4362
   char *required_atleast_version = NULL;
db4362
   char *required_exact_version = NULL;
db4362
   char *required_max_version = NULL;
db4362
@@ -254,6 +256,10 @@
db4362
       "show verbose information about missing or conflicting packages" },
db4362
     { "errors-to-stdout", 0, POPT_ARG_NONE, &want_stdout_errors, 0,
db4362
       "print errors from --print-errors to stdout not stderr" },
c6aaee
+    { "print-provides", 0, POPT_ARG_NONE, &want_prov, 0,
c6aaee
+      "print which packages the package provides" },
c6aaee
+    { "print-requires", 0, POPT_ARG_NONE, &want_req, 0,
c6aaee
+      "print which packages the package requires" },
db4362
 #ifdef G_OS_WIN32
db4362
     { "dont-define-prefix", 0, POPT_ARG_NONE, &dont_define_prefix, 0,
db4362
       "don't try to override the value of prefix for each .pc file found with "
db4362
@@ -545,6 +551,47 @@
c6aaee
         }
c6aaee
     }
c6aaee
 
db4362
+ if (want_prov)
db4362
+   {
db4362
+     GSList *tmp;
db4362
+     tmp = packages;
db4362
+     while (tmp != NULL)
db4362
+       {
db4362
+         Package *pkg = tmp->data;
db4362
+         char *key;
db4362
+         key = pkg->key;
db4362
+         while (*key == '/')
db4362
+           key++;
db4362
+         if (strlen(key) > 0)
db4362
+           printf ("%s = %s\n", key, pkg->version);
db4362
+         tmp = g_slist_next (tmp);
db4362
+       }
db4362
+   }
c6aaee
+
db4362
+ if (want_req)
db4362
+   {
db4362
+     GSList *pkgtmp = packages;
db4362
+     while (pkgtmp != NULL)
db4362
+       {
db4362
+         Package *pkg = pkgtmp->data;
db4362
+         GSList *reqtmp = pkg->requires;
db4362
+         while (reqtmp != NULL)
db4362
+           {
db4362
+             Package *deppkg = reqtmp->data;
db4362
+             RequiredVersion *req;
db4362
+             req = g_hash_table_lookup(pkg->required_versions, deppkg->key);
db4362
+             if ((req == NULL) || (req->comparison == ALWAYS_MATCH))
db4362
+               printf ("%s\n", deppkg->key);
db4362
+             else
db4362
+               printf ("%s %s %s\n", deppkg->key,
db4362
+                       comparison_to_str(req->comparison),
db4362
+                       req->version);
db4362
+             reqtmp = g_slist_next (reqtmp);
db4362
+           }
db4362
+         pkgtmp = g_slist_next (pkgtmp);
db4362
+       }
db4362
+   }
c6aaee
+
c6aaee
   if (required_exact_version)
c6aaee
     {
c6aaee
       Package *pkg = packages->data;