From 408126aae0277e5c9e995a32bd942f4fa5cd7a9d Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 23 Feb 2012 11:56:44 +0100 Subject: [PATCH] Print some diagnostic messages to stderr not to stdout. --- NEWS | 2 ++ src/ChangeLog | 2 ++ src/main.c | 11 ++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 61a4983a..3a6aca0d 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,8 @@ Please send GNU Wget bug reports to . ** Fix a memory leak problem in the GNU TLS backend. ** Autoreconf works again for distributed tarballs. + +** Print some diagnostic messages to stderr not to stdout. * Changes in Wget 1.13.4 diff --git a/src/ChangeLog b/src/ChangeLog index 13ab1ae7..e5def2a8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2012-02-23 Giuseppe Scrivano + * main.c (main): Write diagnostic messages to `stderr' not to `stdout'. + * main.c (main): Fail gracefully if `malloc' fails. * gnutls.c (wgnutls_read): Remove unused variables `timer' and `flags'. diff --git a/src/main.c b/src/main.c index 9eefc98f..352715a0 100644 --- a/src/main.c +++ b/src/main.c @@ -1034,7 +1034,7 @@ main (int argc, char **argv) } if (!userrc_ret) { - printf ("Exiting due to error in %s\n", optarg); + fprintf (stderr, "Exiting due to error in %s\n", optarg); exit (2); } else @@ -1062,9 +1062,10 @@ main (int argc, char **argv) { if (ret == '?') { - print_usage (0); - printf ("\n"); - printf (_("Try `%s --help' for more options.\n"), exec_name); + print_usage (1); + fprintf (stderr, "\n"); + fprintf (stderr, _("Try `%s --help' for more options.\n"), + exec_name); exit (2); } /* Find the short option character in the mapping. */ @@ -1307,7 +1308,7 @@ for details.\n\n")); /* No URL specified. */ fprintf (stderr, _("%s: missing URL\n"), exec_name); print_usage (1); - printf ("\n"); + fprintf (stderr, "\n"); /* #### Something nicer should be printed here -- similar to the pre-1.5 `--help' page. */ fprintf (stderr, _("Try `%s --help' for more options.\n"), exec_name);