From 9155a365e1e0a7e9fec47447f86af09117b30edb Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Sun, 2 Mar 2014 13:53:33 -0500 Subject: Added support for building with GNU C (Linux, etc.). Fixed minor bugs in diff routine. --- fcomp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'fcomp.c') diff --git a/fcomp.c b/fcomp.c index 41c5694..4dc4a44 100644 --- a/fcomp.c +++ b/fcomp.c @@ -60,8 +60,9 @@ int lines = 0; buf = (char *)malloc(256*sizeof(char)); if(buf == NULL) return PRET_ERROR; - - while(fgets(buf,100,fp) != NULL) + memset(buf, 0, 256); + + while(fgets(buf,255,fp) != NULL) { if (lines >= MAXLINES) { fatal("file is to large for diff"); @@ -174,12 +175,14 @@ int compare_files(const char *fname1, const char *fname2) m = in_file(fname1,A); n = in_file(fname2,B); - for (row=0 ; row upper) { printf(" the files are identical\n"); @@ -237,4 +240,3 @@ int compare_files(const char *fname1, const char *fname2) exceed(d); return PRET_ERROR; } - -- cgit v1.2.3