rev: fix new line regression
Commit 4b4eb34004
made output incorrect for
input lines that does not have new line. For example
$ printf "a b c\n1 2 3" | rev
c b a
2 13
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
050babd4e4
commit
d267fdb854
|
@ -163,7 +163,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
len = wcslen(buf);
|
||||
}
|
||||
reverse_str(buf, len - 1);
|
||||
if (buf[len - 1] == '\n')
|
||||
buf[len--] = '\0';
|
||||
reverse_str(buf, len);
|
||||
fputws(buf, stdout);
|
||||
}
|
||||
if (ferror(fp)) {
|
||||
|
|
Loading…
Reference in New Issue