From: Giuseppe Scrivano Date: Thu, 23 Feb 2012 10:56:44 +0000 (+0100) Subject: Print some diagnostic messages to stderr not to stdout. X-Git-Tag: v1.14~57 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=408126aae0277e5c9e995a32bd942f4fa5cd7a9d Print some diagnostic messages to stderr not to stdout. --- 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);