summaryrefslogtreecommitdiff
path: root/usr.bin/fmt
diff options
context:
space:
mode:
authorSujal Patel <smpatel@FreeBSD.org>1996-04-22 18:37:22 +0000
committerSujal Patel <smpatel@FreeBSD.org>1996-04-22 18:37:22 +0000
commit003aaef883db5f18fd43cfb6cc019383d681221b (patch)
tree305213cdcdd602048e836ae848baa5129250f65c /usr.bin/fmt
parent91e2481238c68481b1104e4e74f4259651c56ff5 (diff)
downloadsrc-test2-003aaef883db5f18fd43cfb6cc019383d681221b.tar.gz
src-test2-003aaef883db5f18fd43cfb6cc019383d681221b.zip
Notes
Diffstat (limited to 'usr.bin/fmt')
-rw-r--r--usr.bin/fmt/fmt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c
index cba6456131bd..4bd1a7f76b27 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.
*/