summaryrefslogtreecommitdiffstats
path: root/usr.bin/rs/rs.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-06-07 07:08:06 +0000
committertjr <tjr@FreeBSD.org>2002-06-07 07:08:06 +0000
commita98a42559d88c1293390a4d988a0d84337e2c3f7 (patch)
tree4de7c683beab11d32921fb7476239ccf28b74359 /usr.bin/rs/rs.c
parent4d905c83a4af0fca93f2247d61cb0ce51f01dfcd (diff)
downloadFreeBSD-src-a98a42559d88c1293390a4d988a0d84337e2c3f7.zip
FreeBSD-src-a98a42559d88c1293390a4d988a0d84337e2c3f7.tar.gz
Contrary to what the comments said, rs -H did not recycle storage, it just
kept writing past the end of the buffer. Correct the code so that it actually does recycle storage.
Diffstat (limited to 'usr.bin/rs/rs.c')
-rw-r--r--usr.bin/rs/rs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c
index a1c50c3..36d7c31 100644
--- a/usr.bin/rs/rs.c
+++ b/usr.bin/rs/rs.c
@@ -347,8 +347,10 @@ getline(void) /* get line; maintain curline, curlen; manage storage */
}
else if (skip <= 0) { /* don't waste storage */
curline += curlen + 1;
- if (putlength) /* print length, recycle storage */
+ if (putlength) { /* print length, recycle storage */
printf(" %d line %d\n", curlen, irows);
+ curline = ibuf;
+ }
}
if (!putlength && endblock - curline < BUFSIZ) { /* need storage */
/*ww = endblock-curline; tt += ww;*/
OpenPOWER on IntegriCloud