uniq: Correctly document the -D option.
The -D option takes an optional argument; modify the usage message
and the manual page's synopsis to correctly reflect this. Also
update the tests to exercise -D with and without an argument.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D47999
(cherry picked from commit b93791f5e7b0246b121dd98c10d6563298d6b2b0)
uniq: Fix off-by-one bug in -cD case.
When printing only duplicated lines, the first line of each set is not
printed until we encounter the second. When that happens, we need to
increment the repetition count between printing the first and the
second line, so that if we are also printing counts, we don't print the
same (pre-increment) count twice.
MFC after: 1 week
PR: 275764
Reported by: Yu-Sheng Ma <s110062131@m110.nthu.edu.tw>
Submitted by: Daniel Tameling <tamelingdaniel@gmail.com> (original patch)
Sponsored by: Klara, Inc.
Reviewed by: tamelingdaniel_gmail.com, asomers, emaste
Differential Revision: https://reviews.freebsd.org/D48000
(cherry picked from commit c3f8900e696998c410dc16f9bd9d45c24c413e6b)