Fix POSIX comformance issues in sort(1).
Fix -C disabling checking rather than checking quietly. Fix sort(1) exiting 1 on certain errors, as POSIX requires sort(1) to only exit if the input wasn't sorted when -c. Fix -o opening the output file for truncation before all the input has been read, as POSIX requires allowing -o to be an input file. POSIX requires sort(1) to handle input errors by either erroring with no output, or by erroring and sorting the input read so far. Change the current behavior of continuing to the next file to simply failing hard on the first input error. Don't increment the last line number on the end of the standard input. Report -c/-C as incompatible with -o. Exit unsuccessfully on any output errors. Update to current coding conventions and add documentation while here.
Showing with 155 additions and 0 deletions