+2008-03-23 Tollef Fog Heen <tfheen@err.no>
+
+ * main.c (main): Add logging support from NetBSD. Thanks to Julio
+ M. Merino Vidal for forwarding the patch from ages ago.
+
2008-03-23 Stepan Kasal <skasal@redhat.com>
* pkg-config.1: Document "Requires.private" and recommend it
char **search_dirs;
char **iter;
gboolean need_newline;
-
+ FILE *log;
const char *pkgname;
Package *pkg;
g_strstrip (str->str);
+ if (getenv("PKG_CONFIG_LOG") != NULL)
+ {
+ log = fopen (getenv ("PKG_CONFIG_LOG"), "a");
+ if (log == NULL)
+ {
+ fprintf (stderr, "Cannot open log file: %s\n",
+ getenv ("PKG_CONFIG_LOG"));
+ exit (1);
+ }
+ }
+
{
gboolean failed = FALSE;
GSList *reqs;
else
req = get_package (ver->name);
+ if (log != NULL)
+ {
+ if (req == NULL)
+ fprintf (log, "%s NOT-FOUND", ver->name);
+ else
+ fprintf (log, "%s %s %s", ver->name,
+ comparison_to_str (ver->comparison),
+ (ver->version == NULL) ? "(null)" : ver->version);
+ fprintf (log, "\n");
+ }
+
if (req == NULL)
{
failed = TRUE;
iter = g_slist_next (iter);
}
+ if (log != NULL)
+ {
+ fclose (log);
+ }
+
if (failed) {
return 1;
}