If col(1) is called with -f in a simple test case, the last line of the input gets cut off:
$ printf 'hello\nworld' | col -f hello
as opposed to:
$ printf 'hello\nworld' | col hello world
This is caused by the code not calculating the correct number of half-line feeds to add to the end of the file. This patch fixes this issue, and also changes an incorrect comment regarding the calculations.
Additionally fixes https://bugs.freebsd.org/249308:
col(1) segfaults with this simple test case:
$ printf 'hello\vworld\n' | col world Segmentation fault
This issue is caused near the end of main() (line 344), when flush_lines() is called without setting the local variable pointing at the allocated lines to a valid value afterwards. The fix is quite simple, and its reasoning is described in the comment.
I understand that revisions are intended to contain only one change, but I thought that these two issues are small enough, and close enough together, that it would be more reasonable to put them into one revision.