sort(1): Fix -m when only implicit stdin is used for input
authorkevans <kevans@FreeBSD.org>
Wed, 20 Jun 2018 03:31:19 +0000 (03:31 +0000)
committerkevans <kevans@FreeBSD.org>
Wed, 20 Jun 2018 03:31:19 +0000 (03:31 +0000)
commit4a742cbb82606b7873202f74c353d12a5c752f9e
tree26c1a689c9babbbf1ce5914c9c4f2aafe5521261
parentebe66850c95db323653112cc018633b7e30bd331
sort(1): Fix -m when only implicit stdin is used for input

Observe:

printf "a\nb\nc\n" > /tmp/foo
# Next command results in no output
cat /tmp/foo | sort -m
# Next command results in proper output
cat /tmp/foo | sort -m -
# Also works:
sort -m /tmp/foo

Some const'ification was done to simplify the actual solution of adding "-"
explicitly to the file list if we didn't have any file arguments left over.

PR: 190099
MFC after: 1 week
usr.bin/sort/file.c
usr.bin/sort/file.h
usr.bin/sort/sort.c