diff --git a/ed.c b/ed.c
index cee9687..82b9c2c 100644
--- a/ed.c
+++ b/ed.c
@@ -623,14 +623,16 @@ static void
dowrite(const char *fname, int trunc)
{
FILE *fp;
- int i, line;
+ int i, line, bytecount;
if (!(fp = fopen(fname, (trunc) ? "w" : "a")))
error("input/output error");
line = curln;
- for (i = line1; i <= line2; ++i)
+ for (i = line1; i <= line2; ++i) {
+ bytecount += strlen(gettxt(i));
fputs(gettxt(i), fp);
+ }
curln = line2;
if (fclose(fp))
@@ -638,6 +640,7 @@ dowrite(const char *fname, int trunc)
strcpy(savfname, fname);
modflag = 0;
curln = line;
+ printf("%d\n", bytecount);
}
static void
diff --git a/TODO b/TODO
index 59c9440..92acfa3 100644
--- a/TODO
+++ b/TODO
@@ -55,7 +55,6 @@ ed
line
.
1g/^$/p
-* w command doesn't print byte count.
* Editing huge files doesn't work well.
printf