ed

simple ed
git clone git://git.2f30.org/ed
Log | Files | Refs | LICENSE

commit b9f37fb33e8f033180758335d8a4c02af9dae075
parent b9eaf38210bc9b98df0f36eeef7c15b9d4cf1dfd
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue,  1 Dec 2015 18:47:43 +0100

ed: print byte count instead of line count

Diffstat:
Med.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ed.c b/ed.c @@ -456,7 +456,8 @@ doread(char *fname) if (!(fp = fopen(fname, "r"))) error("input/output error"); curln = line2; - for (cnt = 0; (n = getline(&s, &len, fp)) > 0; ++cnt) { + for (cnt = 0; (n = getline(&s, &len, fp)) > 0;) { + cnt += (size_t)n; if (s[n-1] != '\n') { if (len == SIZE_MAX || !(p = realloc(s, ++len)))