bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] [Patch] fix bug #44516, -o- log to stdout


From: Darshit Shah
Subject: Re: [Bug-wget] [Patch] fix bug #44516, -o- log to stdout
Date: Sun, 15 Mar 2015 00:40:50 +0530
User-agent: Mutt/1.5.23 (2014-03-12)

I just had another question. When -o- is passed to Wget, should the progress bar still be printed to stderr? If not, we need to take care of that condition too.

On 03/15, Darshit Shah wrote:
Another good patch Miquel.

However, I must say, I support your first version more. It's okay that currently there is only one statement in that if condition. I believe it's a lot more clearer with the braces around.

On 03/13, Miquel Llobet wrote:
removed braces from the second if statement, as per GNU's coding standards

--- src/log.c.origin 2015-03-13 01:32:27.000000000 +0100
+++ src/log.c 2015-03-13 02:28:25.000000000 +0100
@@ -598,11 +598,16 @@
{
 if (file)
   {
-      logfp = fopen (file, appendp ? "a" : "w");
-      if (!logfp)
+      if (HYPHENP (file))
+        logfp = stdout;
+      else
       {
-          fprintf (stderr, "%s: %s: %s\n", exec_name, file, strerror
(errno));
-          exit (WGET_EXIT_GENERIC_ERROR);
+          logfp = fopen (file, appendp ? "a" : "w");
+          if (!logfp)
+            {
+              fprintf (stderr, "%s: %s: %s\n", exec_name, file, strerror
(errno));
+              exit (WGET_EXIT_GENERIC_ERROR);
+            }
       }
   }
 else


Miquel Llobet



On Fri, Mar 13, 2015 at 2:04 AM, Miquel Llobet <address@hidden> wrote:

wget now correctly reads that -o- means logging to stdout instead of the
file '-'.
I just checked for a hyphen at log_init, didn't see any caveats to this.

--- src/log.c.origin 2015-03-13 01:32:27.000000000 +0100
+++ src/log.c 2015-03-13 01:44:31.000000000 +0100
@@ -598,11 +598,18 @@
{
  if (file)
    {
-      logfp = fopen (file, appendp ? "a" : "w");
-      if (!logfp)
+      if (HYPHENP (file))
        {
-          fprintf (stderr, "%s: %s: %s\n", exec_name, file, strerror
(errno));
-          exit (WGET_EXIT_GENERIC_ERROR);
+            logfp = stdout;
+        }
+      else
+        {
+          logfp = fopen (file, appendp ? "a" : "w");
+          if (!logfp)
+            {
+              fprintf (stderr, "%s: %s: %s\n", exec_name, file, strerror
(errno));
+              exit (WGET_EXIT_GENERIC_ERROR);
+            }
        }
    }
  else

Miquel Llobet



--- end quoted text ---

--
Thanking You,
Darshit Shah


--- end quoted text ---

--
Thanking You,
Darshit Shah

Attachment: pgp209zM5_gOW.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]