[hackers] [sbase] cmp: fix line numbers || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Tue, 01 Apr 2014 17:20:32 +0200

commit a7954e8cabafb78027381f1e256337d3a650225d
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Tue Apr 1 15:13:30 2014 +0200

    cmp: fix line numbers
    
    test case:
            printf 'a

a' > t1
            printf 'a
a' > t2
            cmp t1 t2
    
    Signed-off-by: Hiltjo Posthuma <hiltjo_AT_codemadness.org>

diff --git a/cmp.c b/cmp.c
index d1cd0ff..fa88cc9 100644
--- a/cmp.c
+++ b/cmp.c
_AT_@ -52,6 +52,7 @@ main(int argc, char *argv[])
                 b[1] = getc(fp[1]);
                 if(b[0] == EOF && b[1] == EOF)
                         break;
+ if(b[0] == '
' && b[1] == '
')
                         line++;
                 if(b[0] == b[1])
                         continue;
Received on Tue Apr 01 2014 - 17:20:32 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 01 2014 - 17:24:18 CEST