diff options
author | Matthias Clasen <mclasen@redhat.com> | 2008-02-05 18:35:54 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2008-02-05 18:35:54 +0000 |
commit | c4be17ba1ba26833a3429f1c22a20969c6a9e199 (patch) | |
tree | 3916a5a31cdd6c61a7c4cfd959feacf414b17982 /gtk/updateiconcache.c | |
parent | db58254c5ce8a11c94df356b7bf7947f389bcbb6 (diff) | |
download | gtk+-c4be17ba1ba26833a3429f1c22a20969c6a9e199.tar.gz |
Install a printerr handler that prepends the program name, since
2008-02-05 Matthias Clasen <mclasen@redhat.com>
* gtk/updateiconcache.c: Install a printerr handler that
prepends the program name, since gtk-update-icon-cache output
often appears in the middle of other output, e.g. rpm update logs.
svn path=/trunk/; revision=19464
Diffstat (limited to 'gtk/updateiconcache.c')
-rw-r--r-- | gtk/updateiconcache.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gtk/updateiconcache.c b/gtk/updateiconcache.c index 14462fb6fd..fee8fa6975 100644 --- a/gtk/updateiconcache.c +++ b/gtk/updateiconcache.c @@ -1575,6 +1575,26 @@ static GOptionEntry args[] = { { NULL } }; +static void +printerr_handler (const gchar *string) +{ + const gchar *charset; + + fputs (g_get_prgname (), stderr); + fputs (": ", stderr); + if (g_get_charset (&charset)) + fputs (string, stderr); /* charset is UTF-8 already */ + else + { + gchar *lstring = strdup_convert (string, charset); + fputs (lstring, stderr); + g_free (lstring); + + fflush (stderr); + } +} + + int main (int argc, char **argv) { @@ -1583,6 +1603,8 @@ main (int argc, char **argv) if (argc < 2) return 0; + + g_set_printerr_handler (printerr_handler); setlocale (LC_ALL, ""); |