I may not fully understand the problem, but wouldn't it be just fine if fmt output anything it can already output? I.e., filled lines are output, on encountering '\n' the (generally unfilled) line is output... (Or what is the reason that fmt waits for EOF?)
R