diff options
Diffstat (limited to 'usr.bin/fmt')
-rw-r--r-- | usr.bin/fmt/fmt.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c index cba6456..4bd1a7f 100644 --- a/usr.bin/fmt/fmt.c +++ b/usr.bin/fmt/fmt.c @@ -172,7 +172,6 @@ fmt(fi) *cp++ = c; c = getc(fi); } - *cp = '\0'; /* * Toss anything remaining on the input line. @@ -180,6 +179,14 @@ fmt(fi) while (c != '\n' && c != EOF) c = getc(fi); + if (cp != NULL) { + *cp = '\0'; + } else { + putchar('\n'); + c = getc(fi); + continue; + } + /* * Expand tabs on the way to canonb. */ |