commit a1394744868e05fed3df942feaa8f79b80918f19
Author: Michael Forney <[email protected]>
AuthorDate: Fri Sep 18 19:51:24 2020 -0700
Commit: Michael Forney <[email protected]>
CommitDate: Fri Sep 18 19:58:22 2020 -0700
ed: Use fwrite to write lines instead of fputs
We already have the length of the line, so there is no point in
recalculating it before printing.
diff --git a/ed.c b/ed.c
index 8e6fa9a..2ca4d6b 100644
--- a/ed.c
+++ b/ed.c
@@ -633,7 +633,7 @@ dowrite(const char *fname, int trunc)
for (i = line1; i <= line2; ++i) {
gettxt(i);
bytecount += text.siz - 1;
- fputs(text.str, fp);
+ fwrite(text.str, 1, text.siz - 1, fp);
}
curln = line2;