Re: unbreak ftp progressbar

2014-01-29 Thread David Coppa

> From: Antoine Jacoutot 
> Date: Wed, Jan 29, 2014 at 3:24 PM
> Subject: Re: unbreak ftp progressbar
> To: Jasper Lievisse Adriaanse 
> Cc: tech@openbsd.org
> 
> 
> On Wed, Jan 29, 2014 at 02:53:12PM +0100, Jasper Lievisse Adriaanse wrote:
> > Hi,
> >
> > At least with ftp -Vm the progressbar was messing up the display as it was
> > printing the output on the same line and would wrap around creating displays
> > such as  http://pbot.rmdir.de/gOeAYNv30HnQk-4I4xmKZg
> > Seems like typo from the introduction of the -D flag.
> >
> > OK?
> 
> There is already the same diff by David in bugs@

That diff was wrong.

What about this?

Index: util.c
===
RCS file: /cvs/src/usr.bin/ftp/util.c,v
retrieving revision 1.65
diff -u -p -u -p -r1.65 util.c
--- util.c  23 Jan 2014 00:39:15 -  1.65
+++ util.c  29 Jan 2014 14:28:41 -
@@ -811,7 +811,7 @@ progressmeter(int flag, const char *file
dotdot);
overhead += l + 1;
} else
-   snprintf(buf, sizeof(buf), "");
+   snprintf(buf, sizeof(buf), "\r");
 
if (!verbose && title != NULL) {
int l = strlen(title);



Re: unbreak ftp progressbar

2014-01-29 Thread Antoine Jacoutot
On Wed, Jan 29, 2014 at 02:53:12PM +0100, Jasper Lievisse Adriaanse wrote:
> Hi,
> 
> At least with ftp -Vm the progressbar was messing up the display as it was
> printing the output on the same line and would wrap around creating displays
> such as  http://pbot.rmdir.de/gOeAYNv30HnQk-4I4xmKZg
> Seems like typo from the introduction of the -D flag.
> 
> OK?

There is already the same diff by David in bugs@

> 
> Index: util.c
> ===
> RCS file: /cvs/src/usr.bin/ftp/util.c,v
> retrieving revision 1.65
> diff -u -p -r1.65 util.c
> --- util.c23 Jan 2014 00:39:15 -  1.65
> +++ util.c29 Jan 2014 13:52:07 -
> @@ -825,7 +825,7 @@ progressmeter(int flag, const char *file
>   overhead += 3;
>   }
>   snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
> - "%-*.*s%s %3d%% ", l, l, title,
> + "\r%-*.*s%s %3d%% ", l, l, title,
>   dotdot, ratio);
>   overhead += l + 1;
>   } else
> 

-- 
Antoine



Re: unbreak ftp progressbar

2014-01-29 Thread David Coppa
On Wed, Jan 29, 2014 at 2:53 PM, Jasper Lievisse Adriaanse
 wrote:
> Hi,
>
> At least with ftp -Vm the progressbar was messing up the display as it was
> printing the output on the same line and would wrap around creating displays
> such as  http://pbot.rmdir.de/gOeAYNv30HnQk-4I4xmKZg
> Seems like typo from the introduction of the -D flag.
>
> OK?

I had the same diff, but it breaks "ftp -D 'BlahBlah' -Vmo"

> Index: util.c
> ===
> RCS file: /cvs/src/usr.bin/ftp/util.c,v
> retrieving revision 1.65
> diff -u -p -r1.65 util.c
> --- util.c  23 Jan 2014 00:39:15 -  1.65
> +++ util.c  29 Jan 2014 13:52:07 -
> @@ -825,7 +825,7 @@ progressmeter(int flag, const char *file
> overhead += 3;
> }
> snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
> -   "%-*.*s%s %3d%% ", l, l, title,
> +   "\r%-*.*s%s %3d%% ", l, l, title,
> dotdot, ratio);
> overhead += l + 1;
> } else
>



unbreak ftp progressbar

2014-01-29 Thread Jasper Lievisse Adriaanse
Hi,

At least with ftp -Vm the progressbar was messing up the display as it was
printing the output on the same line and would wrap around creating displays
such as  http://pbot.rmdir.de/gOeAYNv30HnQk-4I4xmKZg
Seems like typo from the introduction of the -D flag.

OK?

Index: util.c
===
RCS file: /cvs/src/usr.bin/ftp/util.c,v
retrieving revision 1.65
diff -u -p -r1.65 util.c
--- util.c  23 Jan 2014 00:39:15 -  1.65
+++ util.c  29 Jan 2014 13:52:07 -
@@ -825,7 +825,7 @@ progressmeter(int flag, const char *file
overhead += 3;
}
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
-   "%-*.*s%s %3d%% ", l, l, title,
+   "\r%-*.*s%s %3d%% ", l, l, title,
dotdot, ratio);
overhead += l + 1;
} else