commit 13e0b6c60596cbcbc83fc99a330044d310878f69
Author: Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Mon Dec 14 15:18:33 2015 +0100
Commit: sin <[email protected]>
CommitDate: Mon Dec 14 14:52:53 2015 +0000
Do not modify curln with w commands
POSIX declares that dot is not modified by w commands
diff --git a/ed.c b/ed.c
index 4878654..b6b74a2 100644
--- a/ed.c
+++ b/ed.c
@@ -561,11 +561,12 @@ static void
dowrite(char *fname, int trunc)
{
FILE *fp;
- int i;
+ int i, line;
if (!(fp = fopen(fname, (trunc) ? "w" : "a")))
error("input/output error");
+ line = curln;
for (i = line1; i <= line2; ++i)
fputs(gettxt(i), fp);
@@ -574,6 +575,7 @@ dowrite(char *fname, int trunc)
error("input/output error");
strcpy(savfname, fname);
modflag = 0;
+ curln = line;
}
static void