Do not modify curln with w commands

POSIX declares that dot is not modified by w commands
This commit is contained in:
Roberto E. Vargas Caballero 2015-12-14 15:18:33 +01:00 committed by sin
parent 25f87bc360
commit 13e0b6c605

4
ed.c
View File

@ -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