uniq: dont use count format if empty

This commit is contained in:
Hiltjo Posthuma 2015-03-07 14:04:04 +01:00
parent 695940d50c
commit b2e73936bf
1 changed files with 2 additions and 1 deletions

3
uniq.c
View File

@ -49,7 +49,8 @@ uniqline(FILE *ofp, char *l)
if (prevline) {
if ((prevlinecount == 1 && !dflag) ||
(prevlinecount != 1 && !uflag)) {
fprintf(ofp, countfmt, prevlinecount);
if (*countfmt)
fprintf(ofp, countfmt, prevlinecount);
fputs(prevline, ofp);
}
free(prevline);