[PATCH 1/1] wget: don't notify on download begin and end if quiet

Denys Vlasenko vda.linux at googlemail.com
Thu Jan 17 12:47:01 UTC 2019


Applied, thanks

On Thu, Jan 10, 2019 at 1:59 PM Martin Lewis <martin.lewis.x84 at gmail.com> wrote:
>
> When printing notification on download start and end,
> mistakenly, it didn't respect the quiet option
>
> Signed-off-by: Martin Lewis <martin.lewis.x84 at gmail.com>
> ---
>  networking/wget.c | 23 ++++++++++++++---------
>  1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/networking/wget.c b/networking/wget.c
> index 3a02de6..735746e 100644
> --- a/networking/wget.c
> +++ b/networking/wget.c
> @@ -876,10 +876,12 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
>         polldata.fd = fileno(dfp);
>         polldata.events = POLLIN | POLLPRI;
>  #endif
> -       if (G.output_fd == 1)
> -               fprintf(stderr, "writing to stdout\n");
> -       else
> -               fprintf(stderr, "saving to '%s'\n", G.fname_out);
> +       if (!(option_mask32 & WGET_OPT_QUIET)) {
> +               if (G.output_fd == 1)
> +                       fprintf(stderr, "writing to stdout\n");
> +               else
> +                       fprintf(stderr, "saving to '%s'\n", G.fname_out);
> +       }
>         progress_meter(PROGRESS_START);
>
>         if (G.chunked)
> @@ -1025,10 +1027,12 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
>         G.chunked = 0;  /* makes it show 100% even for chunked download */
>         G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */
>         progress_meter(PROGRESS_END);
> -       if (G.output_fd == 1)
> -               fprintf(stderr, "written to stdout\n");
> -       else
> -               fprintf(stderr, "'%s' saved\n", G.fname_out);
> +       if (!(option_mask32 & WGET_OPT_QUIET)) {
> +               if (G.output_fd == 1)
> +                       fprintf(stderr, "written to stdout\n");
> +               else
> +                       fprintf(stderr, "'%s' saved\n", G.fname_out);
> +       }
>  }
>
>  static void download_one_url(const char *url)
> @@ -1389,7 +1393,8 @@ However, in real world it was observed that some web servers
>                         G.output_fd = -1;
>                 }
>         } else {
> -               fprintf(stderr, "remote file exists\n");
> +               if (!(option_mask32 & WGET_OPT_QUIET))
> +                       fprintf(stderr, "remote file exists\n");
>         }
>
>         if (dfp != sfp) {
> --
> 1.9.1
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list