[Flac] Annoying semi-bug in flac

Brian Willoughby brianw at sounds.wa.com
Sun Jul 15 15:11:24 PDT 2007


Hi Nicholas,

I agree that the multi-line output behavior is annoying.  I'm not  
sure how to fix it, because I have not looked at that part of the  
command-line code.

To answer your question, there is no "exact" mechanism for print  
output, because Unix supports many different types of terminal  
output, and, of course, flac runs on systems besides Unix.  At the  
most basic level, there is no way to remove lines of text from a  
terminal.  That because some terminals are printers, and they don't  
have white-out.  We're lucky that the "backspace" character can  
remove anything on the current line, but basic terminal standard do  
not allow for any manipulation besides adding characters or hoping  
that backspace will work.  If the flac command-line code is written  
to this standard, then there's nothing that can be done.  Most code  
is written this way for maximum compatibility (and simplicity of  
design).

There is a higher-level terminal API, but at this level you have less  
compatibility across systems.  There is the ability to move the  
cursor anywhere, clear the screen, clear a line, etc.  I'm not sure  
whether the flac command-line uses this API, but if it does not, then  
rewriting it to do so may not be a trivial undertaking.

Sorry for only half-way answering your question.  I have just enough  
experience with portable source code to know that there is not just  
one way to do this.  I hope that my comments at least explain why  
flac might not be the friendliest here.  In other words, it has more  
to do with the terminal and much less to do with printf().  You'll  
probably not find much documentation on printf() which discusses  
these things.  You probably want to read about Unix terminals and  
emulation.

Brian W.


On Jul 14, 2007, at 16:31, Nicholas Wilson wrote:
> PS.  What exactly is the mechanism for removing lines of text  
> already printed from stderr/stdout, using the printf-type functions?



More information about the Flac mailing list