make coprintf self-adapting according if its output be redirected.