From: Arch Librarian Date: Thu, 14 Jul 2005 13:05:41 +0000 (+0000) Subject: 2003-02-15 Havoc Pennington X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7207c289d8727ca2182bf0939f46b0e083736784;p=pkg-config 2003-02-15 Havoc Pennington Author: hp Date: 2003-02-15 15:04:07 GMT 2003-02-15 Havoc Pennington Fixes suggested by Werner Trobin * main.c (verbose_error): honor --errors-to-stdout and flush the same stream we write to * parse.c (parse_url): support an "url" field so if someone has a .pc file they can figure out where to go for newer versions and such --- diff --git a/ChangeLog b/ChangeLog index 8f1aa0e..648cd1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2003-02-15 Havoc Pennington + + Fixes suggested by Werner Trobin + + * main.c (verbose_error): honor --errors-to-stdout and flush + the same stream we write to + + * parse.c (parse_url): support an "url" field so if someone + has a .pc file they can figure out where to go for newer + versions and such + 2003-01-16 Havoc Pennington * configure.in: 0.15 diff --git a/main.c b/main.c index 7f40703..3506299 100644 --- a/main.c +++ b/main.c @@ -72,7 +72,8 @@ verbose_error (const char *format, ...) { va_list args; gchar *str; - + FILE* stream; + g_return_if_fail (format != NULL); if (!want_verbose_errors) @@ -82,8 +83,13 @@ verbose_error (const char *format, ...) str = g_strdup_vprintf (format, args); va_end (args); - fputs (str, stderr); - fflush (stdout); + if (want_stdout_errors) + stream = stdout; + else + stream = stderr; + + fputs (str, stream); + fflush (stream); g_free (str); } diff --git a/parse.c b/parse.c index 33337b1..5110925 100644 --- a/parse.c +++ b/parse.c @@ -768,7 +768,20 @@ parse_cflags (Package *pkg, const char *str, const char *path) pkg->I_cflags = g_slist_reverse (pkg->I_cflags); pkg->other_cflags = g_slist_reverse (pkg->other_cflags); } - + +static void +parse_url (Package *pkg, const char *str, const char *path) +{ + if (pkg->url != NULL) + { + verbose_error ("URL field occurs twice in '%s'\n", path); + + exit (1); + } + + pkg->url = trim_and_sub (pkg, str, path); +} + static void parse_line (Package *pkg, const char *untrimmed, const char *path) { @@ -819,6 +832,8 @@ parse_line (Package *pkg, const char *untrimmed, const char *path) parse_cflags (pkg, p, path); else if (strcmp (tag, "Conflicts") == 0) parse_conflicts (pkg, p, path); + else if (strcmp (tag, "URL") == 0) + parse_url (pkg, p, path); else { verbose_error ("Unknown keyword '%s' in '%s'\n", diff --git a/pkg-config.1 b/pkg-config.1 index 6efca10..b7e43b3 100644 --- a/pkg-config.1 +++ b/pkg-config.1 @@ -291,7 +291,8 @@ includedir=${prefix}/include Name: GObject # human-readable name Description: Object/type system for GLib # human-readable description -Version: 1.3.1 +Version: 1.3.1 +URL: http://www.gtk.org Requires: glib-2.0 = 1.3.1 Conflicts: foobar <= 4.5 Libs: -L${libdir} -lgobject-1.3 @@ -322,6 +323,9 @@ it is not the name passed as an argument to \fIpkg-config\fP. .I "Description:" This should be a brief description of the package .TP +.I "URL:" +An URL where people can get more information about and download the package +.TP .I "Version:" This should be the most-specific-possible package version string. .TP diff --git a/pkg.c b/pkg.c index 300e924..3314891 100644 --- a/pkg.c +++ b/pkg.c @@ -730,6 +730,9 @@ verify_package (Package *pkg) ver->version, req->name, req->version); + if (req->url) + verbose_error ("You may find new versions of %s at %s\n", + req->name, req->url); exit (1); } diff --git a/pkg.h b/pkg.h index 2ab9f56..6c8cae0 100644 --- a/pkg.h +++ b/pkg.h @@ -54,6 +54,7 @@ struct _Package char *name; /* human-readable name */ char *version; char *description; + char *url; char *pcfiledir; /* directory it was loaded from */ GSList *requires; GSList *l_libs;