sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit e90a049450b4214e2aaf6cfa48636766e1020167
parent 15fa4e3b1fbd081d86f77c16e9be1e63c51a2dbb
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon Dec 14 15:18:33 +0100

Do not modify curln with w commands

POSIX declares that dot is not modified by w commands

Diffstat:
ed.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git 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