diff options
author | dbaker <dbaker@FreeBSD.org> | 1999-09-01 23:07:29 +0000 |
---|---|---|
committer | dbaker <dbaker@FreeBSD.org> | 1999-09-01 23:07:29 +0000 |
commit | e15986424e786c96acef47e2f1557d4ef3eab840 (patch) | |
tree | a775f21b4d5edf54caa43de8d81aade4f85f4bbb /usr.bin/wall | |
parent | 17831c333ce88be39b8657259ebbcd0a780e4d0a (diff) | |
download | FreeBSD-src-e15986424e786c96acef47e2f1557d4ef3eab840.zip FreeBSD-src-e15986424e786c96acef47e2f1557d4ef3eab840.tar.gz |
column counter (cnt) not reset to 0 on display of '\r' which could cause
unnecessary forced linewraps on some terminals.
Submitted by: David McNett <nugget@slacker.com>
Diffstat (limited to 'usr.bin/wall')
-rw-r--r-- | usr.bin/wall/wall.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/wall/wall.c b/usr.bin/wall/wall.c index c853e1c..9412119 100644 --- a/usr.bin/wall/wall.c +++ b/usr.bin/wall/wall.c @@ -182,7 +182,9 @@ makemsg(fname) errx(1, "can't read %s", fname); while (fgets(lbuf, sizeof(lbuf), stdin)) for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) { - if (cnt == 79 || ch == '\n') { + if (ch == '\r') { + cnt = 0; + } else if (cnt == 79 || ch == '\n') { for (; cnt < 79; ++cnt) putc(' ', fp); putc('\r', fp); @@ -217,6 +219,7 @@ makemsg(fname) cnt = 0; } } + putc(ch, fp); } else { putc(ch, fp); } |