[syslinux] TFTP progress indicator

WormFood syslinux-ml at wormfood.net
Fri Apr 24 06:53:17 PDT 2015


On Fri, 2015-04-24 at 11:22 +0200, Geert Stappers via Syslinux wrote:

> I think that these three lines
> 
> 
> > +                while (printed--) /* before we print the new percentage, backspace over what we printed previously. */
> > +		    printf("\b");
> > +                printed = printf("%3d.%.1d%% ", percentage/10, percentage%10);
> 
> 
> can be replaced with
> 
>                 printf("\r%3d.%.1d%% ", percentage/10, percentage%10);
> 
> 
> So start with a '\r',  carriage return.


   Sure, that'd work, if you want it to display 1000 lines per file
downloaded. The whole reason I did it that way, is so the percentage is
updated wherever it sits on the screen. It's small and compact. It takes
up very little screen real estate to print it the way I do it.



More information about the Syslinux mailing list