[hackers] [sbase] Do not modify curln with w commands || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 14 Dec 2015 15:52:58 +0100 (CET)

commit 13e0b6c60596cbcbc83fc99a330044d310878f69
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Dec 14 15:18:33 2015 +0100
Commit: sin <sin_AT_2f30.org>
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
_AT_@ -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);
 
_AT_@ -574,6 +575,7 @@ dowrite(char *fname, int trunc)
                 error("input/output error");
         strcpy(savfname, fname);
         modflag = 0;
+ curln = line;
 }
 
 static void
Received on Mon Dec 14 2015 - 15:52:58 CET

This archive was generated by hypermail 2.3.0 : Mon Dec 14 2015 - 16:00:15 CET