socsvn commit: r238273 - in soc2012/jhagewood/diff: . diff

jhagewood at FreeBSD.org jhagewood at FreeBSD.org
Mon Jun 25 17:10:38 UTC 2012


Author: jhagewood
Date: Mon Jun 25 17:10:34 2012
New Revision: 238273
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238273

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 16:52:27 2012	(r238272)
+++ soc2012/jhagewood/diff/diff/diffreg.c	Mon Jun 25 17:10:34 2012	(r238273)
@@ -1344,19 +1344,20 @@
 	return (sum == 0 ? 1 : sum);
 }
 
+/* 
+ * Checks to see if a file appears to be a text file. 
+ */ 
 static int
 istextfile(FILE *f)
 {
 	char buf[BUFSIZ];
-	int	i, cnt;
 
 	if (aflag || f == NULL)
 		return (1);
 	rewind(f);
-	cnt = fread(buf, 1, sizeof(buf), f);
-	for (i = 0; i < cnt || i <= 30; i++) 
-		if (!isprint(buf[i]) && !isspace(buf[i]))
-			return (1);
+	fread(buf, 1, sizeof(buf), f);
+		if(buf[0] == 0x7F && buf[1] == 0x45)
+			return (0);
 	return (1);
 }
 

Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch	Mon Jun 25 16:52:27 2012	(r238272)
+++ soc2012/jhagewood/diff/hagewood-diff.patch	Mon Jun 25 17:10:34 2012	(r238273)
@@ -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 16:48:21.000000000 -0400
++++ jhagewood/diff/diff/diffreg.c	2012-06-25 17:08:40.000000000 -0400
 @@ -62,15 +62,13 @@
   *	@(#)diffreg.c   8.1 (Berkeley) 6/6/93
   */
@@ -1042,9 +1042,13 @@
  
  	sum = 1;
  	space = 0;
-@@ -1306,19 +1345,18 @@ readhash(FILE *f)
+@@ -1305,19 +1344,19 @@ readhash(FILE *f)
+ 	return (sum == 0 ? 1 : sum);
  }
  
++/* 
++ * Checks to see if a file appears to be a text file. 
++ */ 
  static int
 -asciifile(FILE *f)
 +istextfile(FILE *f)
@@ -1052,22 +1056,20 @@
 -	char		 buf[BUFSIZ];
 -	int		 i, cnt;
 +	char buf[BUFSIZ];
-+	int	i, cnt;
  
  	if (aflag || f == NULL)
  		return (1);
 -
  	rewind(f);
- 	cnt = fread(buf, 1, sizeof(buf), f);
+-	cnt = fread(buf, 1, sizeof(buf), f);
 -	for (i = 0; i < cnt; i++)
-+	for (i = 0; i < cnt || i <= 30; i++) 
- 		if (!isprint(buf[i]) && !isspace(buf[i]))
--			return (0);
-+			return (1);
+-		if (!isprint(buf[i]) && !isspace(buf[i]))
++	fread(buf, 1, sizeof(buf), f);
++		if(buf[0] == 0x7F && buf[1] == 0x45)
+ 			return (0);
  	return (1);
  }
- 
-@@ -1327,10 +1365,10 @@ asciifile(FILE *f)
+@@ -1327,10 +1366,10 @@ asciifile(FILE *f)
  static char *
  match_function(const long *f, int pos, FILE *file)
  {
@@ -1082,7 +1084,7 @@
  
  	lastline = pos;
  	while (pos > last) {
-@@ -1342,7 +1380,6 @@ match_function(const long *f, int pos, F
+@@ -1342,7 +1381,6 @@ match_function(const long *f, int pos, F
  		if (nc > 0) {
  			buf[nc] = '\0';
  			buf[strcspn(buf, "\n")] = '\0';
@@ -1090,7 +1092,7 @@
  			if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {
  				if (begins_with(buf, "private:")) {
  					if (!state)
-@@ -1373,9 +1410,9 @@ static void
+@@ -1373,9 +1411,9 @@ static void
  dump_context_vec(FILE *f1, FILE *f2)
  {
  	struct context_vec *cvp = context_vec_start;
@@ -1103,7 +1105,7 @@
  
  	if (context_vec_start > context_vec_ptr)
  		return;
-@@ -1390,8 +1427,8 @@ dump_context_vec(FILE *f1, FILE *f2)
+@@ -1390,8 +1428,8 @@ dump_context_vec(FILE *f1, FILE *f2)
  	if (pflag) {
  		f = match_function(ixold, lowa-1, f1);
  		if (f != NULL) {
@@ -1114,7 +1116,7 @@
  		}
  	}
  	printf("\n*** ");
-@@ -1478,9 +1515,9 @@ static void
+@@ -1478,9 +1516,9 @@ static void
  dump_unified_vec(FILE *f1, FILE *f2)
  {
  	struct context_vec *cvp = context_vec_start;
@@ -1127,7 +1129,7 @@
  
  	if (context_vec_start > context_vec_ptr)
  		return;
-@@ -1491,19 +1528,19 @@ dump_unified_vec(FILE *f1, FILE *f2)
+@@ -1491,19 +1529,19 @@ dump_unified_vec(FILE *f1, FILE *f2)
  	lowc = MAX(1, cvp->c - context);
  	upd = MIN(len[1], context_vec_ptr->d + context);
  
@@ -1153,7 +1155,7 @@
  
  	/*
  	 * Output changes in "unified" diff format--the old and new lines
-@@ -1551,16 +1588,43 @@ dump_unified_vec(FILE *f1, FILE *f2)
+@@ -1551,16 +1589,43 @@ dump_unified_vec(FILE *f1, FILE *f2)
  static void
  print_header(const char *file1, const char *file2)
  {


More information about the svn-soc-all mailing list