MFC r200442:
Don't read the newline character to line buffer because lines are passed
to wcscoll(3). Newline characters could cause incorrect results when
comparing lines.
Also, if an input line didn't contain a newline character, it was
omitted from the output. According to my interpretation, SUSv3 requires
that the newline is always printed.
Add regression tests for the cases.
PR: bin/140976
MFC r200604:
- Prevent overflowing of the buffer length variable in getline() by
limiting its maximum value.
- Exit if reallocf(3) fails in getline(). Failure was silently
considered as end-of-file.
MFC r204896 by ache:
Rewrite input processing to not exit with error on the first EILSEQ found
in the input data but fallback to "binary comparison" instead.
POSIX says: "The input files shall be text files", nothing more,
so the text file with illegal sequence is valid input.
BTW, GNU sort does not fails on EILSEQ too.
MFC r204928 by ache:
Add SIZE_MAX overflow check
git-svn-id: svn://svn.freebsd.org/base/stable/8@211428
ccf9f872-aa2e-dd11-9fc8-
001c23d0bc1f