Date: Mon, 25 Jun 2012 19:42:08 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r238280 - in soc2012/jhagewood/diff: . diff Message-ID: <20120625194208.D13BA1065674@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhagewood Date: Mon Jun 25 19:42:08 2012 New Revision: 238280 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238280 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 18:54:02 2012 (r238279) +++ soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 19:42:08 2012 (r238280) @@ -1355,8 +1355,15 @@ if (aflag || f == NULL) return (1); rewind(f); + /* + * Checks the first 4 bytes of a file to see if it's ELF format. + * If so, return 0. + */ fread(buf, 1, sizeof(buf), f); - if(buf[0] == 0x7F && buf[1] == 0x45) + if(buf[0] == 0x7F && + buf[1] == 0x45 && + buf[2] == 0x4C && + buf[3] == 0x46); return (0); return (1); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 18:54:02 2012 (r238279) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 19:42:08 2012 (r238280) @@ -537,7 +537,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-25 17:08:40.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-25 19:42:00.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -1042,7 +1042,7 @@ sum = 1; space = 0; -@@ -1305,19 +1344,19 @@ readhash(FILE *f) +@@ -1305,19 +1344,26 @@ readhash(FILE *f) return (sum == 0 ? 1 : sum); } @@ -1064,12 +1064,19 @@ - cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) ++ /* ++ * Checks the first 4 bytes of a file to see if it's ELF format. ++ * If so, return 0. ++ */ + fread(buf, 1, sizeof(buf), f); -+ if(buf[0] == 0x7F && buf[1] == 0x45) ++ if(buf[0] == 0x7F && ++ buf[1] == 0x45 && ++ buf[2] == 0x4C && ++ buf[3] == 0x46); return (0); return (1); } -@@ -1327,10 +1366,10 @@ asciifile(FILE *f) +@@ -1327,10 +1373,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1084,7 +1091,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1381,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1388,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1092,7 +1099,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1411,9 @@ static void +@@ -1373,9 +1418,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1105,7 +1112,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1428,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1435,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1116,7 +1123,7 @@ } } printf("\n*** "); -@@ -1478,9 +1516,9 @@ static void +@@ -1478,9 +1523,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1129,7 +1136,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1529,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1536,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1155,7 +1162,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1589,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1596,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120625194208.D13BA1065674>