addcr − add a CR before each LF
addcr inserts CR at the end of each line of input. It does not insert CR at the end of a partial final line.
Some vendors ship unix2dos or bsd2dos tools similar to addcr. Those tools often blow up on long lines and nulls. addcr has no trouble with long lines and nulls.